How to use the @nstudio/xplat.createOrUpdate 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 / schematics / migrations / update-6-1-1 / update-6-1-1.ts View on Github external
const nxJson = getJsonFromFile(tree, nxConfigPath);

  const npmScope = nxJson.npmScope;
  const appsDir = tree.getDir('apps');
  const appFolders = appsDir.subdirs;
  // console.log("npmScope:", npmScope);
  // console.log("prefix:", prefix);

  // update {N} apps and configs
  for (const dir of appFolders) {
    // console.log(dir);
    if (dir.indexOf('nativescript-') === 0) {
      const appDir = `${appsDir.path}/${dir}`;
      // console.log('appDir:', appDir);

      createOrUpdate(tree, `${appDir}/tsconfig.esm.json`, getTsConfigESM());
      createOrUpdate(tree, `${appDir}/tsconfig.json`, getTsConfig(npmScope));
    }
  }
  return tree;
}
github nstudio / xplat / packages / schematics / migrations / update-6-1-6 / update-6-1-6.ts View on Github external
cwd,
    'node_modules/@nstudio/schematics/src/app.nativescript/_files/app/app.module.ngfactory.d.ts'
  );
  // console.log('webpackConfigPath:', webpackConfigPath);
  const ngAppFactory = fs.readFileSync(ngAppFactoryPath, 'UTF-8');

  // update {N} apps and configs
  for (const dir of appFolders) {
    // console.log(dir);
    if (dir.indexOf('nativescript-') === 0) {
      const appDir = `${appsDir.path}/${dir}`;
      // console.log('appDir:', appDir);

      createOrUpdate(tree, `${appDir}/webpack.config.js`, webpackConfig);

      createOrUpdate(
        tree,
        `${appDir}/app/app.module.ngfactory.d.ts`,
        ngAppFactory
      );

      // update {N} app deps
      const packagePath = `${appDir}/package.json`;

      const packageJson = getJsonFromFile(tree, packagePath);

      if (packageJson) {
        packageJson.dependencies = packageJson.dependencies || {};
        packageJson.devDependencies = packageJson.devDependencies || {};
        packageJson.devDependencies = {
          ...packageJson.devDependencies,
          '@angular/compiler-cli':
github nstudio / xplat / packages / schematics / migrations / update-6-1-1 / update-6-1-1.ts View on Github external
const npmScope = nxJson.npmScope;
  const appsDir = tree.getDir('apps');
  const appFolders = appsDir.subdirs;
  // console.log("npmScope:", npmScope);
  // console.log("prefix:", prefix);

  // update {N} apps and configs
  for (const dir of appFolders) {
    // console.log(dir);
    if (dir.indexOf('nativescript-') === 0) {
      const appDir = `${appsDir.path}/${dir}`;
      // console.log('appDir:', appDir);

      createOrUpdate(tree, `${appDir}/tsconfig.esm.json`, getTsConfigESM());
      createOrUpdate(tree, `${appDir}/tsconfig.json`, getTsConfig(npmScope));
    }
  }
  return tree;
}
github nstudio / xplat / packages / schematics / migrations / update-6-2-0 / update-6-2-0.ts View on Github external
const cwd = process.cwd();
  const webpackConfigPath = join(
    cwd,
    'node_modules/@nstudio/schematics/src/app.nativescript/_files/webpack.config.js'
  );
  // console.log('webpackConfigPath:', webpackConfigPath);
  const webpackConfig = fs.readFileSync(webpackConfigPath, 'UTF-8');

  // update {N} apps and configs
  for (const dir of appFolders) {
    // console.log(dir);
    if (dir.indexOf('nativescript-') === 0) {
      const appDir = `${appsDir.path}/${dir}`;
      // console.log('appDir:', appDir);

      createOrUpdate(tree, `${appDir}/webpack.config.js`, webpackConfig);

      // update {N} app deps
      const packagePath = `${appDir}/package.json`;

      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'
        };
github nstudio / xplat / packages / schematics / migrations / update-7-3-2 / update-7-3-2.ts View on Github external
'node_modules/@nstudio/schematics/src/app.nativescript/_files/webpack.config.js'
  );
  // console.log('webpackConfigPath:', webpackConfigPath);
  const webpackConfig = fs.readFileSync(webpackConfigPath, 'UTF-8');

  // update {N} apps and configs
  for (const dir of appFolders) {
    // console.log(dir);
    if (
      dir.indexOf('nativescript-') === 0 ||
      dir.indexOf('-nativescript') === 0
    ) {
      const appDir = `${appsDir.path}/${dir}`;
      // console.log('appDir:', appDir);

      createOrUpdate(tree, `${appDir}/webpack.config.js`, webpackConfig);

      createOrUpdate(tree, `${appDir}/app/main.ts`, mainFile);

      // update {N} app deps
      const packagePath = `${appDir}/package.json`;
      const packageJson = getJsonFromFile(tree, packagePath);

      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':
github nstudio / xplat / packages / schematics / migrations / update-7-0-0 / update-7-0-0.ts View on Github external
cwd,
    'node_modules/@nstudio/schematics/src/app.nativescript/_files/app/main.ts'
  );
  // console.log('webpackConfigPath:', webpackConfigPath);
  const mainFile = fs.readFileSync(mainPath, 'UTF-8');

  // update {N} apps and configs
  for (const dir of appFolders) {
    // console.log(dir);
    if (dir.indexOf('nativescript-') === 0) {
      const appDir = `${appsDir.path}/${dir}`;
      // console.log('appDir:', appDir);

      createOrUpdate(tree, `${appDir}/webpack.config.js`, webpackConfig);

      createOrUpdate(tree, `${appDir}/app/main.ts`, mainFile);

      // update {N} app deps
      const packagePath = `${appDir}/package.json`;

      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'
        };
github nstudio / xplat / packages / schematics / migrations / update-7-0-1 / update-7-0-1.ts View on Github external
);
  let hmrNavigation = fs.readFileSync(hmrNavigationPath, 'UTF-8');

  // update {N} apps and configs
  for (const dir of appFolders) {
    // console.log(dir);
    if (dir.indexOf('nativescript-') === 0) {
      const appDir = `${appsDir.path}/${dir}`;
      // console.log('appDir:', appDir);

      createOrUpdate(tree, `${appDir}/app/main.ts`, mainFile);
    }
  }

  if (tree.exists('xplat/nativescript')) {
    createOrUpdate(
      tree,
      `xplat/nativescript/utils/livesync-navigation.ts`,
      hmrNavigation
    );

    const utilsTreePath = 'xplat/nativescript/utils/index.ts';
    const utilsFullPath = join(cwd, utilsTreePath);
    let utilsIndex;
    if (fs.existsSync(utilsFullPath)) {
      utilsIndex = fs.readFileSync(utilsFullPath, 'UTF-8');
      utilsIndex += `\nexport * from './livesync-navigation';`;
      createOrUpdate(tree, utilsTreePath, utilsIndex);
    }
  }
  return tree;
}
github nstudio / xplat / packages / schematics / migrations / update-7-0-0 / update-7-0-0.ts View on Github external
// console.log('webpackConfig:',webpackConfig);
  const mainPath = join(
    cwd,
    'node_modules/@nstudio/schematics/src/app.nativescript/_files/app/main.ts'
  );
  // console.log('webpackConfigPath:', webpackConfigPath);
  const mainFile = fs.readFileSync(mainPath, 'UTF-8');

  // update {N} apps and configs
  for (const dir of appFolders) {
    // console.log(dir);
    if (dir.indexOf('nativescript-') === 0) {
      const appDir = `${appsDir.path}/${dir}`;
      // console.log('appDir:', appDir);

      createOrUpdate(tree, `${appDir}/webpack.config.js`, webpackConfig);

      createOrUpdate(tree, `${appDir}/app/main.ts`, mainFile);

      // update {N} app deps
      const packagePath = `${appDir}/package.json`;

      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'
github nstudio / xplat / packages / schematics / migrations / update-7-3-1 / update-7-3-1.ts View on Github external
const tsConfigPath = join(
    cwd,
    'node_modules/@nstudio/schematics/src/app.electron/_files/tsconfig.json'
  );
  // console.log('tsConfigPath:', tsConfigPath);
  const tsConfig = fs.readFileSync(tsConfigPath, 'UTF-8');
  // console.log('tsConfig:',tsConfig);

  // update electron apps
  for (const dir of appFolders) {
    // console.log(dir);
    if (dir.indexOf('electron-') === 0 || dir.indexOf('-electron') > -1) {
      const appDir = `${appsDir.path}/${dir}`;
      // console.log('appDir:', appDir);

      createOrUpdate(tree, `${appDir}/tsconfig.json`, tsConfig);
    }
  }
  return tree;
}
github nstudio / xplat / packages / schematics / migrations / update-6-1-0 / update-6-1-0.ts View on Github external
schematics: {
            '@schematics/angular:component': {
              styleext: 'scss'
            }
          }
        };
      }

      if (nxJson && nxJson.projects) {
        nxJson.projects[dir] = {
          tags: []
        };
      }

      createOrUpdate(tree, `${appDir}/tsconfig.esm.json`, getTsConfigESM());
      createOrUpdate(tree, `${appDir}/webpack.config.js`, getWebpackConfig());
      createOrUpdate(
        tree,
        `${appDir}/tools/xplat-before-watch.js`,
        getxPlatBeforeWatch(npmScope)
      );
      createOrUpdate(
        tree,
        `${appDir}/tools/xplat-postinstall.js`,
        getxPlatPostinstall()
      );

      // update {N} app deps
      const packagePath = `${appDir}/package.json`;

      const packageJson = getJsonFromFile(tree, packagePath);