How to use the @nstudio/xplat.updateJsonFile function in @nstudio/xplat

To help you get started, we’ve selected a few @nstudio/xplat examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github nstudio / xplat / packages / angular / src / schematics / helpers / applitools / index.ts View on Github external
const cypressConfigPath = `/apps/${options.target}-e2e/cypress.json`;
    const cypressConfig = getJsonFromFile(tree, cypressConfigPath);
    // console.log('cypressConfig:', cypressConfig);
    // plugin path is always defined so ensure support matches
    const pluginsFilePath = cypressConfig.pluginsFile;
    // console.log('pluginsFilePath:', pluginsFilePath);
    const outputPath = pluginsFilePath.split('plugins/')[0];
    cypressConfig.supportFile = `${outputPath}support/index.js`;
    // console.log('cypressConfig.supportFile:', cypressConfig.supportFile);
    helperChains.push(updateJsonFile(tree, cypressConfigPath, cypressConfig));

    // Add applitools modules
    const packageJson = getJsonFromFile(tree, 'package.json');
    packageJson.devDependencies = packageJson.devDependencies || {};
    packageJson.devDependencies['@applitools/eyes-cypress'] = '^3.7.1';
    helperChains.push(updateJsonFile(tree, 'package.json', packageJson));

    // update sample test
    helperChains.push(
      createOrUpdate(
        tree,
        `/apps/${options.target}-e2e/src/integration/app.spec.ts`,
        updateSampleTest()
      )
    );
  };
}
github nstudio / xplat / packages / schematics / migrations / update-6-2-0 / update-6-2-0.ts View on Github external
const packageJson = getJsonFromFile(tree, packagePath);

      if (packageJson) {
        packageJson.dependencies = packageJson.dependencies || {};
        packageJson.devDependencies = packageJson.devDependencies || {};
        packageJson.devDependencies = {
          ...packageJson.devDependencies,
          '@angular/compiler-cli': '~6.1.1',
          'nativescript-dev-webpack': '~0.15.0',
          '@ngtools/webpack': '~6.1.1'
        };

        // console.log('path:',path);
        // console.log('packageJson overwrite:', JSON.stringify(packageJson));
        tree = updateJsonFile(tree, packagePath, packageJson);
      }
    }
  }
  return tree;
}
github nstudio / xplat / packages / schematics / migrations / update-6-1-6 / update-6-1-6.ts View on Github external
'sass-loader': '^7.0.2',
          'tns-platform-declarations':
            'file:../../node_modules/tns-platform-declarations',
          typescript: 'file:../../node_modules/typescript',
          'uglifyjs-webpack-plugin': '~1.2.5',
          webpack: '~4.12.0',
          'webpack-bundle-analyzer': '~2.13.0',
          'webpack-cli': '~3.0.7',
          'webpack-sources': '~1.1.0'
        };
        // ensure dev sass is removed
        delete packageJson.devDependencies['nativescript-dev-sass'];

        // console.log('path:',path);
        // console.log('packageJson overwrite:', JSON.stringify(packageJson));
        tree = updateJsonFile(tree, packagePath, packageJson);
      }
    }
  }
  return tree;
}
github nstudio / xplat / packages / schematics / migrations / update-7-3-2 / update-7-3-2.ts View on Github external
if (packageJson) {
        packageJson.dependencies = packageJson.dependencies || {};
        packageJson.devDependencies = packageJson.devDependencies || {};
        packageJson.devDependencies = {
          ...packageJson.devDependencies,
          '@angular/compiler-cli': '~7.2.0',
          '@ngtools/webpack': '~7.2.0',
          'nativescript-dev-webpack': '~0.20.0',
          'terser-webpack-plugin':
            'file:../../node_modules/terser-webpack-plugin'
        };

        // console.log('path:',path);
        // console.log('packageJson overwrite:', JSON.stringify(packageJson));
        tree = updateJsonFile(tree, packagePath, packageJson);
      }
    }
  }
  return tree;
}
github nstudio / xplat / packages / schematics / migrations / update-6-1-5 / update-6-1-5.ts View on Github external
'nativescript-worker-loader': '~0.9.0',
          'raw-loader': '~0.5.1',
          'resolve-url-loader': '~2.3.0',
          'sass-loader': '^7.0.2',
          'uglifyjs-webpack-plugin': '~1.2.5',
          webpack: '~4.12.0',
          'webpack-bundle-analyzer': '~2.13.0',
          'webpack-cli': '~3.0.7',
          'webpack-sources': '~1.1.0'
        };
        // ensure dev sass is removed
        delete packageJson.devDependencies['nativescript-dev-sass'];

        // console.log('path:',path);
        // console.log('packageJson overwrite:', JSON.stringify(packageJson));
        tree = updateJsonFile(tree, packagePath, packageJson);
      }
    }
  }
  return tree;
}
github nstudio / xplat / packages / schematics / migrations / update-6-2-0 / update-6-2-0.ts View on Github external
'@capacitor/cli': '^1.0.0-beta.3',
          '@capacitor/core': '^1.0.0-beta.3',
          '@capacitor/ios': '^1.0.0-beta.3'
        };
        packageJson.devDependencies = packageJson.devDependencies || {};
        packageJson.devDependencies = {
          ...packageJson.devDependencies,
          '@angular-devkit/architect': '0.7.2',
          '@angular-devkit/build-angular': '0.7.2',
          '@angular-devkit/core': '0.7.2',
          '@angular-devkit/schematics': '0.7.2'
        };

        // console.log('path:',path);
        // console.log('packageJson overwrite:', JSON.stringify(packageJson));
        tree = updateJsonFile(tree, packagePath, packageJson);
      }
    }
  }
  return tree;
}
github nstudio / xplat / packages / schematics / migrations / update-7-0-0 / update-7-0-0.ts View on Github external
const packageJson = getJsonFromFile(tree, packagePath);

      if (packageJson) {
        packageJson.dependencies = packageJson.dependencies || {};
        packageJson.devDependencies = packageJson.devDependencies || {};
        packageJson.devDependencies = {
          ...packageJson.devDependencies,
          '@angular/compiler-cli': '~7.0.0',
          '@ngtools/webpack': '~7.0.0',
          'nativescript-dev-webpack': '~0.18.0'
        };

        // console.log('path:',path);
        // console.log('packageJson overwrite:', JSON.stringify(packageJson));
        tree = updateJsonFile(tree, packagePath, packageJson);
      }
    }
  }
  return tree;
}
github nstudio / xplat / packages / schematics / migrations / update-6-1-0 / update-6-1-0.ts View on Github external
tree = updateJsonFile(tree, packagePath, packageJson);
      }

      try {
        // cleanup
        tree.delete(`${appDir}/tsconfig.aot.json`);
        tree.delete(`${appDir}/app/vendor-platform.android.ts`);
        tree.delete(`${appDir}/app/vendor-platform.ios.ts`);
        tree.delete(`${appDir}/app/vendor.ts`);
        tree.delete(`${appDir}/tools/app-before-watch.js`);
        tree.delete(`${appDir}/tools/app-postinstall.js`);
      } catch (err) {}
    }
  }
  tree = updateJsonFile(tree, angularConfigPath, angularJson);
  tree = updateJsonFile(tree, nxConfigPath, nxJson);
  return tree;
}
github nstudio / xplat / packages / angular / src / utils / xplat.ts View on Github external
}
            }
          }
        };
      }

      if (nxJson && nxJson.projects) {
        nxJson.projects['libs'] = {
          tags: []
        };
        nxJson.projects['xplat'] = {
          tags: []
        };
      }

      tree = updateJsonFile(tree, configPath, workspaceJson);
      tree = updateJsonFile(tree, nxConfigPath, nxJson);
      return tree;
    };
  }
github nstudio / xplat / packages / angular / src / utils / xplat.ts View on Github external
}
          }
        };
      }

      if (nxJson && nxJson.projects) {
        nxJson.projects['libs'] = {
          tags: []
        };
        nxJson.projects['xplat'] = {
          tags: []
        };
      }

      tree = updateJsonFile(tree, configPath, workspaceJson);
      tree = updateJsonFile(tree, nxConfigPath, nxJson);
      return tree;
    };
  }