How to use the @nrwl/workspace.addUpdateTask function in @nrwl/workspace

To help you get started, weโ€™ve selected a few @nrwl/workspace 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 nrwl / nx / packages / schematics / migrations / update-7-0-0 / update-7-0-0.ts View on Github external
return chain([
    updateJsonInTree('package.json', json => {
      json.devDependencies = json.devDependencies || {};
      json.devDependencies = {
        ...json.devDependencies,
        codelyzer: '~4.5.0',
        'jasmine-marbles': '0.4.0'
      };

      if (json.devDependencies['ng-packagr']) {
        json.devDependencies['ng-packagr'] = '^4.2.0';
      }

      return json;
    }),
    addUpdateTask('@angular/core', '7.0.0'),
    addUpdateTask('@angular/cli', '7.0.1')
  ]);
}
github nrwl / nx / packages / schematics / migrations / update-7-0-0 / update-7-0-0.ts View on Github external
updateJsonInTree('package.json', json => {
      json.devDependencies = json.devDependencies || {};
      json.devDependencies = {
        ...json.devDependencies,
        codelyzer: '~4.5.0',
        'jasmine-marbles': '0.4.0'
      };

      if (json.devDependencies['ng-packagr']) {
        json.devDependencies['ng-packagr'] = '^4.2.0';
      }

      return json;
    }),
    addUpdateTask('@angular/core', '7.0.0'),
    addUpdateTask('@angular/cli', '7.0.1')
  ]);
}
github nrwl / nx / packages / angular / src / migrations / update-8-3-0 / upgrade-ngrx-8-0.ts View on Github external
return (host: Tree) => {
    const { dependencies } = readJsonInTree(host, 'package.json');

    if (dependencies && dependencies['@ngrx/store']) {
      return chain([
        addUpdateTask('@ngrx/store', '8.1.0', updateDeps),
        formatFiles()
      ]);
    }

    return noop();
  };
}
github nrwl / nx / packages / schematics / migrations / update-8-0-0 / update-8-0-0.ts View on Github external
export const runAngularMigrations: Rule = (
  host: Tree,
  context: SchematicContext
) => {
  const { dependencies } = readJsonInTree(host, 'package.json');

  return chain([
    addUpdateTask('@angular/cli', '8.0.1'),
    ...(dependencies['@angular/core']
      ? [addUpdateTask('@angular/core', '8.0.0')]
      : [])
  ]);
};
github nrwl / nx / packages / angular / src / migrations / update-9-0-0 / update-9-0-0.ts View on Github external
return (_, context: SchematicContext) => {
    const postInstallTask = context.addTask(
      new RunSchematicTask(
        join(__dirname, '../../../migrations.json'),
        'add-postinstall',
        {}
      )
    );
    return chain([
      addUpdateTask('@angular/core', '9.0.0-rc.4', [postInstallTask]),
      addUpdateTask('@angular/cli', '9.0.0-rc.4', [postInstallTask])
    ])
  };
}
github nrwl / nx / packages / schematics / migrations / update-7-6-0 / update-7-6-0.ts View on Github external
}
  if (!json.schematics['@nrwl/schematics:application'].e2eTestRunner) {
    json.schematics['@nrwl/schematics:application'].e2eTestRunner =
      'protractor';
  }
  if (!json.schematics['@nrwl/schematics:node-application']) {
    json.schematics['@nrwl/schematics:node-application'] = {};
  }
  if (!json.schematics['@nrwl/schematics:node-application'].framework) {
    json.schematics['@nrwl/schematics:node-application'].framework = 'express';
  }
  return json;
});

const updateAngularCLI = chain([
  addUpdateTask('@angular/cli', '7.3.1'),
  addDepsToPackageJson(
    {},
    {
      '@angular-devkit/build-angular': '~0.13.1'
    }
  )
]);

export default function(): Rule {
  return chain([
    addExtensionRecommendations,
    addDotEnv,
    updateAngularCLI,
    migrateNgrx,
    updateNgrx,
    setDefaults,
github nrwl / nx / packages / schematics / migrations / update-8-0-0 / update-8-0-0.ts View on Github external
export const runAngularMigrations: Rule = (
  host: Tree,
  context: SchematicContext
) => {
  const { dependencies } = readJsonInTree(host, 'package.json');

  return chain([
    addUpdateTask('@angular/cli', '8.0.1'),
    ...(dependencies['@angular/core']
      ? [addUpdateTask('@angular/core', '8.0.0')]
      : [])
  ]);
};
github nrwl / nx / packages / angular / src / migrations / update-8-5-0 / upgrade-cli-8-3.ts View on Github external
import { chain, Tree, noop, TaskId } from '@angular-devkit/schematics';
import {
  addUpdateTask,
  readJsonInTree,
  formatFiles,
  updateJsonInTree,
  checkAndCleanWithSemver
} from '@nrwl/workspace';
import { NodePackageInstallTask } from '@angular-devkit/schematics/tasks';
import { gt } from 'semver';

const updateAngular = addUpdateTask('@angular/core', '8.2.4');

function updateCLI() {
  const tasks: TaskId[] = [];
  const rule = chain([
    updateJsonInTree('package.json', json => {
      json.devDependencies = json.devDependencies || {};
      const cliVersion = json.devDependencies['@angular/cli'];
      const cleanCliVersion = checkAndCleanWithSemver(
        '@angular/cli',
        cliVersion
      );

      if (cleanCliVersion && gt(cleanCliVersion, '8.3.3')) {
        return json;
      }
github nrwl / nx / packages / schematics / migrations / update-7-5-0 / update-7-5-0.ts View on Github external
import { Rule, chain, externalSchematic } from '@angular-devkit/schematics';

import { updateJsonInTree, addUpdateTask } from '@nrwl/workspace';

const updateAngularCLI = addUpdateTask('@angular/cli', '7.2.2');

const updateTypescript = updateJsonInTree('package.json', json => {
  json.devDependencies = json.devDependencies || {};
  json.devDependencies = {
    ...json.devDependencies,
    typescript: '~3.2.2'
  };
  return json;
});

export default function(): Rule {
  return chain([updateTypescript, updateAngularCLI]);
}