Skip to content

Commit

Permalink
feat(schematics): update @angular/cli to 6.2.3 and ngrx 6.1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
FrozenPandaz authored and vsavkin committed Sep 28, 2018
1 parent ac7cc3b commit c9d3f97
Show file tree
Hide file tree
Showing 12 changed files with 628 additions and 341 deletions.
3 changes: 2 additions & 1 deletion e2e/schematics/ngrx.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { newApp, newProject, runCLI } from '../utils';
import { newApp, newProject, runCLI, copyMissingPackages } from '../utils';

describe('ngrx', () => {
it(
Expand All @@ -11,6 +11,7 @@ describe('ngrx', () => {
runCLI(
'generate ngrx users --module=apps/myapp/src/app/app.module.ts --root --collection=@nrwl/schematics'
);
copyMissingPackages();

// Generate feature library and ngrx state within that library
runCLI('g @nrwl/schematics:lib feature-flights --prefix=fl');
Expand Down
13 changes: 0 additions & 13 deletions e2e/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,27 +48,14 @@ export function createNxWorkspace(command: string): string {
export function copyMissingPackages(): void {
const modulesToCopy = [
'@ngrx',
'jasmine-marbles',
'@nrwl',
'angular',
'@angular-devkit',
'@angular/upgrade',
'npm-run-all',
'yargs',
'yargs-parser'
];
modulesToCopy.forEach(m => copyNodeModule(projectName, m));
execSync(
`rm -rf tmp/${projectName}/node_modules/@angular-devkit/build-angular/node_modules`
);
execSync(
`rm -rf tmp/${projectName}/node_modules/@angular-devkit/core/node_modules`
);

execSync(`rm tmp/${projectName}/node_modules/.bin/semver`);
execSync(
`cp -a node_modules/.bin/semver tmp/${projectName}/node_modules/.bin/semver`
);

const libIndex = `./tmp/${projectName}/node_modules/@schematics/angular/library/index.js`;
const content = readFileSync(libIndex).toString();
Expand Down
40 changes: 20 additions & 20 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,24 +19,24 @@
"checkformat": "prettier \"./**/*.{ts,js,json,css,md}\" \"!./**/{__name__,__directory__}/**\" --list-different"
},
"devDependencies": {
"@angular-devkit/build-angular": "^0.7.2",
"@angular-devkit/core": "^0.7.2",
"@angular-devkit/schematics": "^0.7.2",
"@angular/cli": "6.1.2",
"@angular/common": "6.1.0",
"@angular/compiler": "6.1.0",
"@angular/compiler-cli": "6.1.0",
"@angular/core": "6.1.0",
"@angular/platform-browser": "6.1.0",
"@angular/platform-browser-dynamic": "6.1.0",
"@angular/router": "6.1.0",
"@angular/upgrade": "6.1.0",
"@ngrx/effects": "6.0.1",
"@ngrx/router-store": "6.0.1",
"@ngrx/schematics": "6.0.1",
"@ngrx/store": "6.0.1",
"@ngrx/store-devtools": "6.0.1",
"@schematics/angular": "^0.7.2",
"@angular-devkit/build-angular": "0.8.3",
"@angular-devkit/core": "0.8.3",
"@angular-devkit/schematics": "0.8.3",
"@angular/cli": "6.2.3",
"@angular/common": "6.1.8",
"@angular/compiler": "6.1.8",
"@angular/compiler-cli": "6.1.8",
"@angular/core": "6.1.8",
"@angular/platform-browser": "6.1.8",
"@angular/platform-browser-dynamic": "6.1.8",
"@angular/router": "6.1.8",
"@angular/upgrade": "6.1.8",
"@ngrx/effects": "6.1.0",
"@ngrx/router-store": "6.1.0",
"@ngrx/schematics": "6.1.0",
"@ngrx/store": "6.1.0",
"@ngrx/store-devtools": "6.1.0",
"@schematics/angular": "0.8.3",
"@types/jasmine": "~2.8.6",
"@types/jasminewd2": "~2.0.3",
"@types/node": "~8.9.4",
Expand Down Expand Up @@ -67,12 +67,12 @@
"precise-commits": "1.0.2",
"prettier": "1.10.2",
"release-it": "^7.4.0",
"rxjs": "^6.2.2",
"rxjs": "6.2.2",
"semver": "5.4.1",
"strip-json-comments": "2.0.1",
"tmp": "0.0.33",
"tslint": "5.11.0",
"typescript": "~2.7.2",
"typescript": "~2.9.2",
"viz.js": "^1.8.1",
"yargs": "^11.0.0",
"yargs-parser": "10.0.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/builders/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
"homepage": "https://github.com/nrwl/nx#readme",
"builders": "./src/builders.json",
"dependencies": {
"@angular-devkit/architect": "~0.7.0",
"@angular-devkit/architect": "~0.8.0",
"rxjs": "6.2.2"
}
}
5 changes: 5 additions & 0 deletions packages/schematics/migrations/migrations.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,11 @@
"version": "6.3.2",
"description": "Update jest-preset-angular",
"factory": "./update-6-3-2/update-6-3-2"
},
"update-6.4.0": {
"version": "6.4.0",
"description": "Update to @angular/cli@6.2.3",
"factory": "./update-6-4-0/update-6-4-0"
}
}
}
122 changes: 122 additions & 0 deletions packages/schematics/migrations/update-6-4-0/update-6-4-0.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,122 @@
import { Tree } from '@angular-devkit/schematics';
import { SchematicTestRunner } from '@angular-devkit/schematics/testing';
import { serializeJson } from '../../src/utils/fileutils';

import * as path from 'path';

describe('Update 6.4.0', () => {
let initialTree: Tree;
let schematicRunner: SchematicTestRunner;

beforeEach(() => {
initialTree = Tree.empty();
initialTree.create(
'package.json',
serializeJson({
dependencies: {
'@angular/animations': '^6.1.0',
'@angular/common': '^6.1.0',
'@angular/compiler': '^6.1.0',
'@angular/core': '^6.1.0',
'@angular/forms': '^6.1.0',
'@angular/platform-browser': '^6.1.0',
'@angular/platform-browser-dynamic': '^6.1.0',
'@angular/router': '^6.1.0',
'core-js': '^2.5.4',
rxjs: '^6.0.0',
'zone.js': '^0.8.26',
'@nrwl/nx': '6.1.0',
'@ngrx/effects': '6.0.1',
'@ngrx/store': '6.0.1',
'@ngrx/router-store': '6.0.1'
},
devDependencies: {
'@angular/cli': '6.1.2',
'@angular/compiler-cli': '^6.1.0',
'@angular/language-service': '^6.1.0',
'@angular-devkit/build-angular': '~0.7.0',
'@angular-devkit/build-ng-packagr': '~0.7.0',
'@ngrx/store-devtools': '6.0.1',
'@nrwl/schematics': '6.1.0',
'jasmine-marbles': '0.3.1',
'@types/jasmine': '~2.8.6',
'@types/jasminewd2': '~2.0.3',
'@types/node': '~8.9.4',
codelyzer: '~4.2.1',
'jasmine-core': '~2.99.1',
'jasmine-spec-reporter': '~4.2.1',
karma: '~2.0.0',
'karma-chrome-launcher': '~2.2.0',
'karma-coverage-istanbul-reporter': '~1.4.2',
'karma-jasmine': '~1.1.0',
'karma-jasmine-html-reporter': '^0.2.2',
'ngrx-store-freeze': '0.2.4',
protractor: '~5.3.0',
'ts-node': '~5.0.1',
tslint: '~5.9.1',
typescript: '~2.7.2',
prettier: '1.10.2'
}
})
);
schematicRunner = new SchematicTestRunner(
'@nrwl/schematics',
path.join(__dirname, '../migrations.json')
);
});

it('should update dependencies', () => {
const result = schematicRunner.runSchematic(
'update-6.4.0',
{},
initialTree
);

expect(JSON.parse(result.readContent('package.json'))).toEqual({
dependencies: {
'@angular/animations': '^6.1.0',
'@angular/common': '^6.1.0',
'@angular/compiler': '^6.1.0',
'@angular/core': '^6.1.0',
'@angular/forms': '^6.1.0',
'@angular/platform-browser': '^6.1.0',
'@angular/platform-browser-dynamic': '^6.1.0',
'@angular/router': '^6.1.0',
'core-js': '^2.5.4',
rxjs: '^6.0.0',
'zone.js': '^0.8.26',
'@nrwl/nx': '6.1.0',
'@ngrx/effects': '6.1.0',
'@ngrx/store': '6.1.0',
'@ngrx/router-store': '6.1.0'
},
devDependencies: {
'@angular/cli': '6.2.3',
'@angular/compiler-cli': '^6.1.0',
'@angular/language-service': '^6.1.0',
'@angular-devkit/build-angular': '~0.8.0',
'@angular-devkit/build-ng-packagr': '~0.8.0',
'@ngrx/store-devtools': '6.1.0',
'@nrwl/schematics': '6.1.0',
'jasmine-marbles': '0.3.1',
'@types/jasmine': '~2.8.6',
'@types/jasminewd2': '~2.0.3',
'@types/node': '~8.9.4',
codelyzer: '~4.2.1',
'jasmine-core': '~2.99.1',
'jasmine-spec-reporter': '~4.2.1',
karma: '~3.0.0',
'karma-chrome-launcher': '~2.2.0',
'karma-coverage-istanbul-reporter': '~2.0.1',
'karma-jasmine': '~1.1.0',
'karma-jasmine-html-reporter': '^0.2.2',
'ngrx-store-freeze': '0.2.4',
protractor: '~5.4.0',
'ts-node': '~7.0.0',
tslint: '~5.11.0',
typescript: '~2.9.2',
prettier: '1.10.2'
}
});
});
});
51 changes: 51 additions & 0 deletions packages/schematics/migrations/update-6-4-0/update-6-4-0.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
import {
Rule,
SchematicContext,
chain,
template,
apply,
mergeWith,
url
} from '@angular-devkit/schematics';
import { stripIndents } from '@angular-devkit/core/src/utils/literals';
import { updateJsonInTree } from '../../src/utils/ast-utils';
import { NodePackageInstallTask } from '@angular-devkit/schematics/tasks';

function updateDependencies() {
return updateJsonInTree('package.json', json => {
json.dependencies = json.dependencies || {};
json.dependencies = {
...json.dependencies,
'@ngrx/effects': '6.1.0',
'@ngrx/store': '6.1.0',
'@ngrx/router-store': '6.1.0'
};
json.devDependencies = json.devDependencies || {};
json.devDependencies = {
...json.devDependencies,
'@angular/cli': '6.2.3',
'@angular-devkit/build-angular': '~0.8.0',
'@ngrx/store-devtools': '6.1.0',
karma: '~3.0.0',
'karma-coverage-istanbul-reporter': '~2.0.1',
protractor: '~5.4.0',
'ts-node': '~7.0.0',
tslint: '~5.11.0',
typescript: '~2.9.2'
};

if (json.devDependencies['@angular-devkit/build-ng-packagr']) {
json.devDependencies['@angular-devkit/build-ng-packagr'] = '~0.8.0';
}

return json;
});
}

const addInstall = (_, context: SchematicContext) => {
context.addTask(new NodePackageInstallTask());
};

export default function(): Rule {
return chain([updateDependencies(), addInstall]);
}
7 changes: 0 additions & 7 deletions packages/schematics/src/collection/library/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -212,12 +212,6 @@ function updateNgPackage(options: NormalizedSchema): Rule {
options.projectDirectory
}`;
return chain([
updateJsonInTree(`${options.projectRoot}/ng-package.prod.json`, json => {
return {
...json,
dest
};
}),
updateJsonInTree(`${options.projectRoot}/ng-package.json`, json => {
return {
...json,
Expand All @@ -238,7 +232,6 @@ function updateProject(options: NormalizedSchema): Rule {

if (!options.publishable) {
host.delete(path.join(options.projectRoot, 'ng-package.json'));
host.delete(path.join(options.projectRoot, 'ng-package.prod.json'));
host.delete(path.join(options.projectRoot, 'package.json'));
}

Expand Down
12 changes: 1 addition & 11 deletions packages/schematics/src/collection/library/library.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,17 +26,11 @@ describe('lib', () => {
{ name: 'myLib', publishable: true },
appTree
);

let ngPackageProd = readJsonInTree(
publishableTree,
'libs/my-lib/ng-package.prod.json'
);
let ngPackage = readJsonInTree(
publishableTree,
'libs/my-lib/ng-package.json'
);

expect(ngPackageProd.dest).toEqual('../../dist/libs/my-lib');
expect(ngPackage.dest).toEqual('../../dist/libs/my-lib');
});

Expand Down Expand Up @@ -202,15 +196,11 @@ describe('lib', () => {
{ name: 'myLib', directory: 'myDir', publishable: true },
appTree
);
let ngPackageProd = readJsonInTree(
publishableTree,
'libs/my-dir/my-lib/ng-package.prod.json'
);

let ngPackage = readJsonInTree(
publishableTree,
'libs/my-dir/my-lib/ng-package.json'
);
expect(ngPackageProd.dest).toEqual('../../../dist/libs/my-dir/my-lib');
expect(ngPackage.dest).toEqual('../../../dist/libs/my-dir/my-lib');
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,14 +58,14 @@
"codelyzer": "~4.2.1",
"jasmine-core": "~2.99.1",
"jasmine-spec-reporter": "~4.2.1",
"karma": "~2.0.0",
"karma": "~3.0.0",
"karma-chrome-launcher": "~2.2.0",
"karma-coverage-istanbul-reporter": "~1.4.2",
"karma-coverage-istanbul-reporter": "~2.0.1",
"karma-jasmine": "~1.1.0",
"karma-jasmine-html-reporter": "^0.2.2",
"protractor": "~5.3.0",
"ts-node": "~5.0.1",
"tslint": "~5.9.1",
"protractor": "~5.4.0",
"ts-node": "~7.0.0",
"tslint": "~5.11.0",
"typescript": "<%= typescriptVersion %>",
"prettier": "<%= prettierVersion %>"
}
Expand Down
Loading

0 comments on commit c9d3f97

Please sign in to comment.