Revert "Revert "feat(core): update to next version of angular deps"" (#2264)

This reverts commit f816fc424d4b0d850e0a49d0ed8e4a30ddca308c.
This commit is contained in:
Jason Jean 2020-01-31 13:08:50 -05:00 committed by GitHub
parent 1c4078986f
commit b6e6b3f1c3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
61 changed files with 1710 additions and 1819 deletions

View File

@ -52,11 +52,11 @@ Test runner to use for end to end (e2e) tests
### enableIvy ### enableIvy
Default: `false` Default: `true`
Type: `boolean` Type: `boolean`
**EXPERIMENTAL** True to create a new app that uses the Ivy rendering engine. Create a new app that uses the Ivy rendering engine.
### inlineStyle ### inlineStyle

View File

@ -52,11 +52,11 @@ Test runner to use for end to end (e2e) tests
### enableIvy ### enableIvy
Default: `false` Default: `true`
Type: `boolean` Type: `boolean`
**EXPERIMENTAL** True to create a new app that uses the Ivy rendering engine. Create a new app that uses the Ivy rendering engine.
### inlineStyle ### inlineStyle

View File

@ -52,11 +52,11 @@ Test runner to use for end to end (e2e) tests
### enableIvy ### enableIvy
Default: `false` Default: `true`
Type: `boolean` Type: `boolean`
**EXPERIMENTAL** True to create a new app that uses the Ivy rendering engine. Create a new app that uses the Ivy rendering engine.
### inlineStyle ### inlineStyle

View File

@ -63,13 +63,13 @@ forEachCli(() => {
console.log( console.log(
`The current es2015 bundle size is ${es2015BundleSize / 1000} KB` `The current es2015 bundle size is ${es2015BundleSize / 1000} KB`
); );
expect(es2015BundleSize).toBeLessThanOrEqual(160000); expect(es2015BundleSize).toBeLessThanOrEqual(125000);
const es5BundleSize = getSize( const es5BundleSize = getSize(
tmpProjPath(`dist/apps/my-dir/${myapp}/main-es5.js`) tmpProjPath(`dist/apps/my-dir/${myapp}/main-es5.js`)
); );
console.log(`The current es5 bundle size is ${es5BundleSize / 1000} KB`); console.log(`The current es5 bundle size is ${es5BundleSize / 1000} KB`);
expect(es5BundleSize).toBeLessThanOrEqual(175000); expect(es5BundleSize).toBeLessThanOrEqual(150000);
// running tests for the app // running tests for the app
expectTestsPass(await runCLIAsync(`test my-dir-${myapp} --no-watch`)); expectTestsPass(await runCLIAsync(`test my-dir-${myapp} --no-watch`));

View File

@ -1,5 +1,5 @@
import { capitalize } from '@nrwl/workspace/src/utils/strings';
import { fork } from 'child_process'; import { fork } from 'child_process';
import { stringUtils } from '@nrwl/workspace';
import * as http from 'http'; import * as http from 'http';
import { import {
checkFilesExist, checkFilesExist,
@ -63,7 +63,9 @@ module.exports = {
` `
import dynamic from 'next/dynamic'; import dynamic from 'next/dynamic';
const DynamicComponent = dynamic( const DynamicComponent = dynamic(
() => import('@proj/${libName}').then(d => d.${capitalize(libName)}) () => import('@proj/${libName}').then(d => d.${stringUtils.capitalize(
libName
)})
); );
` + readFile(mainPath) ` + readFile(mainPath)
); );

View File

@ -132,7 +132,7 @@ forEachCli('angular', () => {
expect(updatedAngularCLIJson.projects.proj.architect.build).toEqual({ expect(updatedAngularCLIJson.projects.proj.architect.build).toEqual({
builder: '@angular-devkit/build-angular:browser', builder: '@angular-devkit/build-angular:browser',
options: { options: {
aot: false, aot: true,
outputPath: 'dist/apps/proj', outputPath: 'dist/apps/proj',
index: 'apps/proj/src/index.html', index: 'apps/proj/src/index.html',
main: 'apps/proj/src/main.ts', main: 'apps/proj/src/main.ts',
@ -167,7 +167,6 @@ forEachCli('angular', () => {
sourceMap: false, sourceMap: false,
extractCss: true, extractCss: true,
namedChunks: false, namedChunks: false,
aot: true,
extractLicenses: true, extractLicenses: true,
vendorChunk: false, vendorChunk: false,
buildOptimizer: true buildOptimizer: true

View File

@ -129,7 +129,7 @@ forEachCli(currentCLIName => {
done(); done();
}); });
}); });
}, 60000); }, 120000);
it('should have correct ts options for nest application', async () => { it('should have correct ts options for nest application', async () => {
if (currentCLIName === 'angular') { if (currentCLIName === 'angular') {
@ -158,7 +158,8 @@ forEachCli(currentCLIName => {
); // respects "extends" inside tsconfigs ); // respects "extends" inside tsconfigs
expect(config.options.emitDecoratorMetadata).toEqual(true); // required by nest to function properly expect(config.options.emitDecoratorMetadata).toEqual(true); // required by nest to function properly
}, 60000); cleanup();
}, 120000);
it('should be able to generate a nest application', async done => { it('should be able to generate a nest application', async done => {
ensureProject(); ensureProject();
@ -222,7 +223,7 @@ forEachCli(currentCLIName => {
done(); done();
}); });
}); });
}, 60000); }, 120000);
it('should be able to generate an empty application', async () => { it('should be able to generate an empty application', async () => {
ensureProject(); ensureProject();

View File

@ -1,4 +1,4 @@
import { packagesWeCareAbout } from '@nrwl/workspace/src/command-line/report'; import { packagesWeCareAbout } from '../packages/workspace/src/command-line/report';
import { ensureProject, forEachCli, runCommand } from './utils'; import { ensureProject, forEachCli, runCommand } from './utils';
const testTimeout = 120000; const testTimeout = 120000;

View File

@ -84,6 +84,17 @@ export function runYarnInstall(silent: boolean = true) {
return install ? install.toString() : ''; return install ? install.toString() : '';
} }
export function runNgcc(silent: boolean = true) {
const install = execSync(
'node ./node_modules/@angular/compiler-cli/ngcc/main-ngcc.js',
{
cwd: tmpProjPath(),
...(silent ? { stdio: ['ignore', 'ignore', 'ignore'] } : {})
}
);
return install ? install.toString() : '';
}
/** /**
* Run the `new` command for the currently selected CLI * Run the `new` command for the currently selected CLI
* *
@ -150,6 +161,8 @@ function default_1(factoryOptions = {}) {
exports.default = default_1;` exports.default = default_1;`
); );
runNgcc();
execSync(`mv ${tmpProjPath()} ${tmpBackupProjPath()}`); execSync(`mv ${tmpProjPath()} ${tmpBackupProjPath()}`);
} }
execSync(`cp -a ${tmpBackupProjPath()} ${tmpProjPath()}`); execSync(`cp -a ${tmpBackupProjPath()} ${tmpProjPath()}`);
@ -241,6 +254,7 @@ export function copyMissingPackages(): void {
'document-register-element', 'document-register-element',
'@angular/forms', '@angular/forms',
'@storybook',
'fork-ts-checker-webpack-plugin', 'fork-ts-checker-webpack-plugin',

View File

@ -26,32 +26,32 @@
"documentation": "./scripts/documentation/documentation.sh && ./scripts/documentation/check-documentation.sh" "documentation": "./scripts/documentation/documentation.sh && ./scripts/documentation/check-documentation.sh"
}, },
"devDependencies": { "devDependencies": {
"@angular-devkit/architect": "0.803.23", "@angular-devkit/architect": "0.900.0-rc.12",
"@angular-devkit/build-angular": "0.803.23", "@angular-devkit/build-angular": "0.900.0-rc.12",
"@angular-devkit/build-ng-packagr": "0.803.23", "@angular-devkit/build-ng-packagr": "0.900.0-rc.12",
"@angular-devkit/build-optimizer": "0.803.23", "@angular-devkit/build-optimizer": "0.900.0-rc.12",
"@angular-devkit/build-webpack": "0.803.23", "@angular-devkit/build-webpack": "0.900.0-rc.12",
"@angular-devkit/core": "8.3.23", "@angular-devkit/core": "9.0.0-rc.12",
"@angular-devkit/schematics": "8.3.23", "@angular-devkit/schematics": "9.0.0-rc.12",
"@angular-eslint/builder": "0.0.1-alpha.18", "@angular-eslint/builder": "0.0.1-alpha.18",
"@angular/cli": "8.3.23", "@angular/cli": "9.0.0-rc.12",
"@angular/common": "^8.2.12", "@angular/common": "9.0.0-rc.12",
"@angular/compiler": "^8.2.12", "@angular/compiler": "9.0.0-rc.12",
"@angular/compiler-cli": "^8.2.12", "@angular/compiler-cli": "9.0.0-rc.12",
"@angular/core": "^8.2.12", "@angular/core": "9.0.0-rc.12",
"@angular/forms": "^8.2.12", "@angular/forms": "9.0.0-rc.12",
"@angular/platform-browser": "^8.2.12", "@angular/platform-browser": "9.0.0-rc.12",
"@angular/platform-browser-dynamic": "^8.2.12", "@angular/platform-browser-dynamic": "9.0.0-rc.12",
"@angular/router": "^8.2.12", "@angular/router": "9.0.0-rc.12",
"@angular/service-worker": "^8.2.12", "@angular/service-worker": "9.0.0-rc.12",
"@angular/upgrade": "^8.2.12", "@angular/upgrade": "9.0.0-rc.12",
"@babel/core": "7.8.3", "@babel/core": "7.5.5",
"@babel/preset-env": "7.8.3", "@babel/plugin-proposal-class-properties": "7.5.5",
"@babel/preset-react": "7.8.3", "@babel/plugin-proposal-decorators": "7.4.4",
"@babel/plugin-proposal-class-properties": "7.8.3", "@babel/plugin-transform-regenerator": "7.4.5",
"@babel/plugin-proposal-decorators": "7.8.3", "@babel/preset-env": "7.5.5",
"@babel/plugin-transform-regenerator": "7.8.3", "@babel/preset-react": "7.0.0",
"@babel/preset-typescript": "7.8.3", "@babel/preset-typescript": "7.3.3",
"@bazel/bazel": "^1.2.0", "@bazel/bazel": "^1.2.0",
"@bazel/ibazel": "^0.10.3", "@bazel/ibazel": "^0.10.3",
"@cypress/webpack-preprocessor": "^4.1.0", "@cypress/webpack-preprocessor": "^4.1.0",
@ -66,12 +66,12 @@
"@ngrx/schematics": "8.5.0", "@ngrx/schematics": "8.5.0",
"@ngrx/store": "8.5.0", "@ngrx/store": "8.5.0",
"@ngrx/store-devtools": "8.5.0", "@ngrx/store-devtools": "8.5.0",
"@ngtools/webpack": "8.3.23", "@ngtools/webpack": "9.0.0-rc.12",
"@schematics/angular": "8.3.23", "@schematics/angular": "9.0.0-rc.12",
"@storybook/addon-knobs": "^5.2.5", "@storybook/addon-knobs": "5.3.9",
"@storybook/angular": "^5.2.5", "@storybook/angular": "5.3.9",
"@storybook/core": "^5.2.5", "@storybook/core": "5.3.9",
"@storybook/react": "^5.2.5", "@storybook/react": "5.3.9",
"@svgr/webpack": "^4.3.3", "@svgr/webpack": "^4.3.3",
"@testing-library/react": "9.4.0", "@testing-library/react": "9.4.0",
"@types/express": "4.17.0", "@types/express": "4.17.0",
@ -191,7 +191,7 @@
"rollup-plugin-peer-deps-external": "2.2.0", "rollup-plugin-peer-deps-external": "2.2.0",
"rollup-plugin-postcss": "2.0.3", "rollup-plugin-postcss": "2.0.3",
"rollup-plugin-typescript2": "0.24.3", "rollup-plugin-typescript2": "0.24.3",
"rxjs": "~6.4.0", "rxjs": "6.5.3",
"sass": "1.22.9", "sass": "1.22.9",
"sass-loader": "7.2.0", "sass-loader": "7.2.0",
"semver": "6.3.0", "semver": "6.3.0",
@ -216,7 +216,7 @@
"tsickle": "^0.37.0", "tsickle": "^0.37.0",
"tslib": "^1.9.3", "tslib": "^1.9.3",
"tslint": "5.11.0", "tslint": "5.11.0",
"typescript": "~3.5.3", "typescript": "~3.7.4",
"url-loader": "^2.2.0", "url-loader": "^2.2.0",
"webpack": "4.41.2", "webpack": "4.41.2",
"webpack-dev-middleware": "3.7.0", "webpack-dev-middleware": "3.7.0",

View File

@ -1,5 +1,11 @@
{ {
"schematics": { "schematics": {
"add-postinstall": {
"version": "0.0.0",
"description": "Adds postinstall to run ngcc",
"factory": "./src/migrations/update-9-0-0/add-postinstall",
"hidden": true
},
"upgrade-ngrx-8-0": { "upgrade-ngrx-8-0": {
"version": "8.3.0-beta.1", "version": "8.3.0-beta.1",
"description": "Upgrades NgRx dependencies to version 8, and runs migrations for breaking changes", "description": "Upgrades NgRx dependencies to version 8, and runs migrations for breaking changes",
@ -14,6 +20,11 @@
"version": "8.12.0-beta.1", "version": "8.12.0-beta.1",
"description": "Changes Angular library builder to @nrwl/angular:package", "description": "Changes Angular library builder to @nrwl/angular:package",
"factory": "./src/migrations/update-8-12-0/change-angular-lib-builder" "factory": "./src/migrations/update-8-12-0/change-angular-lib-builder"
},
"update-9-0-0": {
"version": "9.0.0-beta.1",
"description": "Upgrades Angular and Angular CLI to 9.0.0",
"factory": "./src/migrations/update-9-0-0/update-9-0-0"
} }
} }
} }

View File

@ -38,8 +38,8 @@
"dependencies": { "dependencies": {
"@nrwl/cypress": "*", "@nrwl/cypress": "*",
"@nrwl/jest": "*", "@nrwl/jest": "*",
"@angular-devkit/schematics": "8.3.23", "@angular-devkit/schematics": "9.0.0-rc.12",
"@schematics/angular": "8.3.23", "@schematics/angular": "9.0.0-rc.12",
"jasmine-marbles": "~0.6.0" "jasmine-marbles": "~0.6.0"
} }
} }

View File

@ -5,7 +5,7 @@ import {
UnitTestTree UnitTestTree
} from '@angular-devkit/schematics/testing'; } from '@angular-devkit/schematics/testing';
import { serializeJson } from '@nrwl/workspace'; import { serializeJson } from '@nrwl/workspace';
import { join } from 'path'; import { runMigration } from '../../utils/testing';
describe('Update 8.5.0', () => { describe('Update 8.5.0', () => {
let tree: Tree; let tree: Tree;
@ -13,11 +13,6 @@ describe('Update 8.5.0', () => {
beforeEach(() => { beforeEach(() => {
tree = new UnitTestTree(Tree.empty()); tree = new UnitTestTree(Tree.empty());
schematicRunner = new SchematicTestRunner(
'@nrwl/workspace',
join(__dirname, '../../../migrations.json')
);
}); });
describe('Update Angular CLI', () => { describe('Update Angular CLI', () => {
@ -31,9 +26,7 @@ describe('Update 8.5.0', () => {
}) })
); );
const result = await schematicRunner const result = await runMigration('upgrade-cli-8-3', {}, tree);
.runSchematicAsync('upgrade-cli-8-3', {}, tree)
.toPromise();
expect( expect(
readJsonInTree(result, 'package.json').devDependencies['@angular/cli'] readJsonInTree(result, 'package.json').devDependencies['@angular/cli']
@ -50,9 +43,7 @@ describe('Update 8.5.0', () => {
}) })
); );
const result = await schematicRunner const result = await runMigration('upgrade-cli-8-3', {}, tree);
.runSchematicAsync('upgrade-cli-8-3', {}, tree)
.toPromise();
expect( expect(
readJsonInTree(result, 'package.json').devDependencies['@angular/cli'] readJsonInTree(result, 'package.json').devDependencies['@angular/cli']
@ -69,9 +60,7 @@ describe('Update 8.5.0', () => {
}) })
); );
const result = await schematicRunner const result = await runMigration('upgrade-cli-8-3', {}, tree);
.runSchematicAsync('upgrade-cli-8-3', {}, tree)
.toPromise();
expect( expect(
readJsonInTree(result, 'package.json').devDependencies['@angular/cli'] readJsonInTree(result, 'package.json').devDependencies['@angular/cli']
@ -91,9 +80,7 @@ describe('Update 8.5.0', () => {
); );
try { try {
await schematicRunner await runMigration('upgrade-cli-8-3', {}, tree);
.runSchematicAsync('upgrade-cli-8-3', {}, tree)
.toPromise();
} catch (e) { } catch (e) {
error = e; error = e;
} }

View File

@ -0,0 +1,37 @@
import { Tree } from '@angular-devkit/schematics';
import { readJsonInTree, updateJsonInTree } from '@nrwl/workspace';
import { callRule, runMigration } from '../../utils/testing';
describe('add-postinstall', () => {
let tree: Tree;
beforeEach(async () => {
tree = Tree.empty();
tree = await callRule(updateJsonInTree('package.json', () => ({})), tree);
});
it('should add a postinstall for "ngcc"', async () => {
const result = await runMigration('add-postinstall', {}, tree);
const packageJson = readJsonInTree(result, 'package.json');
expect(packageJson.scripts.postinstall).toEqual(
'ngcc --properties es2015 browser module main --first-only --create-ivy-entry-points'
);
});
it('should not add a postinstall if one exists', async () => {
tree = await callRule(
updateJsonInTree('package.json', json => {
json.scripts = {
postinstall: './postinstall.sh'
};
return json;
}),
tree
);
const result = await runMigration('add-postinstall', {}, tree);
const packageJson = readJsonInTree(result, 'package.json');
expect(packageJson.scripts.postinstall).toEqual('./postinstall.sh');
});
});

View File

@ -0,0 +1,25 @@
import { updateJsonInTree } from '@nrwl/workspace';
import { stripIndents } from '@angular-devkit/core/src/utils/literals';
export default function() {
return updateJsonInTree('package.json', (json, context) => {
json.scripts = json.scripts || {};
if (json.scripts.postinstall) {
context.logger.warn(
stripIndents`
---------------------------------------------------------------------------------------
Angular Ivy requires you to run ngcc after every npm install.
The easiest way to accomplish this is to update your postinstall script to invoke ngcc.
---------------------------------------------------------------------------------------
`
);
} else {
context.logger.info(
stripIndents`A "postinstall" script has been added to package.json to run ngcc.`
);
json.scripts.postinstall =
'ngcc --properties es2015 browser module main --first-only --create-ivy-entry-points';
}
return json;
});
}

View File

@ -0,0 +1,20 @@
import { chain, SchematicContext } from '@angular-devkit/schematics';
import { addUpdateTask } from '@nrwl/workspace';
import { RunSchematicTask } from '@angular-devkit/schematics/tasks';
import { join } from 'path';
export default function() {
return (_, context: SchematicContext) => {
const postInstallTask = context.addTask(
new RunSchematicTask(
join(__dirname, '../../../migrations.json'),
'add-postinstall',
{}
)
);
return chain([
addUpdateTask('@angular/core', '9.0.0-rc.12', [postInstallTask]),
addUpdateTask('@angular/cli', '9.0.0-rc.12', [postInstallTask])
]);
};
}

View File

@ -8,7 +8,7 @@ import { DataPersistence } from './data-persistence';
*/ */
@NgModule({}) @NgModule({})
export class NxModule { export class NxModule {
static forRoot(): ModuleWithProviders { static forRoot(): ModuleWithProviders<NxModule> {
return { ngModule: NxModule, providers: [DataPersistence] }; return { ngModule: NxModule, providers: [DataPersistence] };
} }
} }

View File

@ -374,7 +374,6 @@ describe('app', () => {
tree, tree,
'apps/my-app/tsconfig.app.json' 'apps/my-app/tsconfig.app.json'
); );
expect(tsconfigAppJson.exclude).toEqual(['src/test.ts', '**/*.spec.ts']);
expect(tsconfigAppJson.compilerOptions.outDir).toEqual( expect(tsconfigAppJson.compilerOptions.outDir).toEqual(
'../../dist/out-tsc' '../../dist/out-tsc'
); );
@ -529,17 +528,5 @@ describe('app', () => {
'exclude' 'exclude'
); );
}); });
it('should only include dts files in the tsconfig.app.json', async () => {
const tree = await runSchematic(
'app',
{ name: 'my-app', enableIvy: true },
appTree
);
expect(tree.readContent('apps/my-app/tsconfig.app.json')).toContain(
`\"include\": [\"src/**/*.d.ts\"]`
);
});
}); });
}); });

View File

@ -529,7 +529,7 @@ function updateProject(options: NormalizedSchema): Rule {
: options.unitTestRunner === 'jest' : options.unitTestRunner === 'jest'
? ['src/test-setup.ts', '**/*.spec.ts'] ? ['src/test-setup.ts', '**/*.spec.ts']
: ['src/test.ts', '**/*.spec.ts'], : ['src/test.ts', '**/*.spec.ts'],
include: [options.enableIvy ? 'src/**/*.d.ts' : '**/*.ts'] include: options.enableIvy ? undefined : ['src/**/*.d.ts']
}; };
}), }),
host => { host => {

View File

@ -2,6 +2,5 @@
"extends": "<%= offsetFromRoot %>tsconfig.json", "extends": "<%= offsetFromRoot %>tsconfig.json",
"compilerOptions": { "compilerOptions": {
"types": [] "types": []
}, }
"include": ["**/*.ts"]
} }

View File

@ -68,9 +68,9 @@
"type": "string" "type": "string"
}, },
"enableIvy": { "enableIvy": {
"description": "**EXPERIMENTAL** True to create a new app that uses the Ivy rendering engine.", "description": "Create a new app that uses the Ivy rendering engine.",
"type": "boolean", "type": "boolean",
"default": false "default": true
}, },
"prefix": { "prefix": {
"type": "string", "type": "string",

View File

@ -32,6 +32,22 @@ describe('init', () => {
expect(devDependencies['codelyzer']).toBeDefined(); expect(devDependencies['codelyzer']).toBeDefined();
}); });
it('should add a postinstall script for ngcc', async () => {
const tree = await runSchematic(
'init',
{
unitTestRunner: 'karma'
},
appTree
);
const packageJson = readJsonInTree(tree, 'package.json');
expect(packageJson.scripts.postinstall).toEqual(
'ngcc --properties es2015 browser module main --first-only --create-ivy-entry-points'
);
});
describe('--unit-test-runner', () => { describe('--unit-test-runner', () => {
describe('karma', () => { describe('karma', () => {
it('should add karma dependencies', async () => { it('should add karma dependencies', async () => {

View File

@ -10,17 +10,19 @@ import {
readJsonInTree, readJsonInTree,
addDepsToPackageJson, addDepsToPackageJson,
updateWorkspace, updateWorkspace,
formatFiles formatFiles,
updateJsonInTree
} from '@nrwl/workspace'; } from '@nrwl/workspace';
import { import {
angularVersion, angularVersion,
angularDevkitVersion, angularDevkitVersion,
rxjsVersion rxjsVersion,
jestPresetAngularVersion
} from '../../utils/versions'; } from '../../utils/versions';
import { Schema } from './schema'; import { Schema } from './schema';
import { UnitTestRunner, E2eTestRunner } from '../../utils/test-runners'; import { UnitTestRunner, E2eTestRunner } from '../../utils/test-runners';
import { jestPresetAngularVersion } from '../../utils/versions';
import { JsonObject } from '@angular-devkit/core'; import { JsonObject } from '@angular-devkit/core';
import { stripIndents } from '@angular-devkit/core/src/utils/literals';
function updateDependencies(): Rule { function updateDependencies(): Rule {
const deps = { const deps = {
@ -152,9 +154,32 @@ export function setDefaults(options: Schema): Rule {
}); });
} }
function addPostinstall(): Rule {
return updateJsonInTree('package.json', (json, context) => {
json.scripts = json.scripts || {};
if (!json.scripts.postinstall) {
json.scripts.postinstall =
'ngcc --properties es2015 browser module main --first-only --create-ivy-entry-points';
} else if (!json.scripts.postinstall.includes('ngcc')) {
context.logger.warn(
stripIndents`
---------------------------------------------------------------------------------------
Angular Ivy requires you to run ngcc after every npm install.
The easiest way to accomplish this is to update your postinstall script to invoke ngcc.
---------------------------------------------------------------------------------------
`
);
}
return json;
});
}
export default function(options: Schema): Rule { export default function(options: Schema): Rule {
return chain([ return chain([
setDefaults(options), setDefaults(options),
// TODO: Remove this when ngcc can be run in parallel
addPostinstall(),
updateDependencies(), updateDependencies(),
addUnitTestRunner(options), addUnitTestRunner(options),
addE2eTestRunner(options), addE2eTestRunner(options),

View File

@ -15,6 +15,11 @@ const testRunner = new SchematicTestRunner(
join(__dirname, '../../collection.json') join(__dirname, '../../collection.json')
); );
const migrationTestRunner = new SchematicTestRunner(
'@nrwl/workspace',
join(__dirname, '../../migrations.json')
);
export function runSchematic<SchemaOptions = any>( export function runSchematic<SchemaOptions = any>(
schematicName: string, schematicName: string,
options: SchemaOptions, options: SchemaOptions,
@ -23,6 +28,16 @@ export function runSchematic<SchemaOptions = any>(
return testRunner.runSchematicAsync(schematicName, options, tree).toPromise(); return testRunner.runSchematicAsync(schematicName, options, tree).toPromise();
} }
export function runMigration<SchemaOptions = any>(
schematicName: string,
options: SchemaOptions,
tree: Tree
) {
return migrationTestRunner
.runSchematicAsync(schematicName, options, tree)
.toPromise();
}
export function runExternalSchematic<SchemaOptions = any>( export function runExternalSchematic<SchemaOptions = any>(
collectionName: string, collectionName: string,
schematicName: string, schematicName: string,

View File

@ -1,7 +1,7 @@
export const nxVersion = '*'; export const nxVersion = '*';
export const angularVersion = '^8.2.0'; export const angularVersion = '9.0.0-rc.12';
export const angularDevkitVersion = '^0.803.23'; export const angularDevkitVersion = '0.900.0-rc.12';
export const angularJsVersion = '1.6.6'; export const angularJsVersion = '1.6.6';
export const ngrxVersion = '8.5.0'; export const ngrxVersion = '8.5.0';
export const rxjsVersion = '~6.4.0'; export const rxjsVersion = '~6.5.0';
export const jestPresetAngularVersion = '7.0.0'; export const jestPresetAngularVersion = '7.0.0';

View File

@ -1,50 +0,0 @@
diff --git a/node_modules/@ngtools/webpack/src/loader.js b/node_modules/@ngtools/webpack/src/loader.js
index bf6e8ae..ad943fe 100644
--- a/node_modules/@ngtools/webpack/src/loader.js
+++ b/node_modules/@ngtools/webpack/src/loader.js
@@ -30,9 +30,9 @@ function ngcLoader() {
// We must verify that the plugin is an instance of the right class.
// Throw an error if it isn't, that often means multiple @ngtools/webpack installs.
if (!(plugin instanceof angular_compiler_plugin_1.AngularCompilerPlugin) || !plugin.done) {
- throw new Error('Angular Compiler was detected but it was an instance of the wrong class.\n'
- + 'This likely means you have several @ngtools/webpack packages installed. '
- + 'You can check this with `npm ls @ngtools/webpack`, and then remove the extra copies.');
+ // throw new Error('Angular Compiler was detected but it was an instance of the wrong class.\n'
+ // + 'This likely means you have several @ngtools/webpack packages installed. '
+ // + 'You can check this with `npm ls @ngtools/webpack`, and then remove the extra copies.');
}
benchmark_1.time(timeLabel + '.ngcLoader.AngularCompilerPlugin');
plugin.done
diff --git a/node_modules/@ngtools/webpack/src/ngcc_processor.js b/node_modules/@ngtools/webpack/src/ngcc_processor.js
index 77f218a..d270644 100644
--- a/node_modules/@ngtools/webpack/src/ngcc_processor.js
+++ b/node_modules/@ngtools/webpack/src/ngcc_processor.js
@@ -49,6 +49,16 @@ class NgccProcessor {
this._processedModules.add(moduleName);
return;
}
+ // If the package.json is read only we should skip calling NGCC.
+ // With Bazel when running under sandbox the filesystem is read-only.
+ try {
+ fs_1.accessSync(packageJsonPath, fs_1.constants.W_OK);
+ }
+ catch (_a) {
+ // add it to processed so the second time round we skip this.
+ this._processedModules.add(moduleName);
+ return;
+ }
const timeLabel = `NgccProcessor.processModule.ngcc.process+${moduleName}`;
benchmark_1.time(timeLabel);
ngcc_1.process({
@@ -88,6 +98,11 @@ class NgccProcessor {
}
}
findNodeModulesDirectory(startPoint) {
+ if (process.env.TEST_SRCDIR) {
+ // Check why with bazel build this is not resolved but is with bazel test
+ return path.join(require.resolve('npm/node_modules/@ngtools/webpack/package.json', '../../../'));
+ }
+
let current = startPoint;
while (path.dirname(current) !== current) {
const nodePath = path.join(current, 'node_modules');

View File

@ -1,4 +0,0 @@
filegroup(
name = "patches",
srcs = glob(["*.patch"]),
)

View File

@ -20,17 +20,6 @@ describe('@nrwl/bazel:sync', () => {
}); });
}); });
describe('patches', () => {
it('should be added', async () => {
const result = await runSchematic('init', {}, tree);
expect(result.exists('patches/BUILD.bazel')).toEqual(true);
expect(result.exists('patches/@ngtools+webpack+8.3.20.patch')).toEqual(
true
);
});
});
describe('@bazel dependencies', () => { describe('@bazel dependencies', () => {
it('should be added', async () => { it('should be added', async () => {
const result = await runSchematic('init', {}, tree); const result = await runSchematic('init', {}, tree);
@ -38,7 +27,6 @@ describe('@nrwl/bazel:sync', () => {
const packageJson = readJsonInTree(result, 'package.json'); const packageJson = readJsonInTree(result, 'package.json');
expect(packageJson.devDependencies['@bazel/bazel']).toBeDefined(); expect(packageJson.devDependencies['@bazel/bazel']).toBeDefined();
expect(packageJson.devDependencies['@bazel/ibazel']).toBeDefined(); expect(packageJson.devDependencies['@bazel/ibazel']).toBeDefined();
expect(packageJson.devDependencies['patch-package']).toBeDefined();
}); });
}); });

View File

@ -6,13 +6,9 @@ import {
template, template,
url url
} from '@angular-devkit/schematics'; } from '@angular-devkit/schematics';
import { import { addDepsToPackageJson, readJsonInTree } from '@nrwl/workspace';
addDepsToPackageJson,
readJsonInTree,
updateJsonInTree
} from '@nrwl/workspace';
import ignore from 'ignore'; import ignore from 'ignore';
import { bazelVersion, iBazelVersion, patchVersion } from '../utils/versions'; import { bazelVersion, iBazelVersion } from '../utils/versions';
import { noop } from 'rxjs'; import { noop } from 'rxjs';
function updateGitIgnore(): Rule { function updateGitIgnore(): Rule {
@ -37,50 +33,22 @@ function updateGitIgnore(): Rule {
const addRequiredPackages = addDepsToPackageJson( const addRequiredPackages = addDepsToPackageJson(
{}, {},
{ {
'patch-package': patchVersion,
'@bazel/bazel': bazelVersion, '@bazel/bazel': bazelVersion,
'@bazel/ibazel': iBazelVersion '@bazel/ibazel': iBazelVersion
}, },
true true
); );
const addPostInstall = updateJsonInTree('package.json', json => {
if (!json.scripts) {
json.scripts = {};
}
if (
json.scripts['postinstall'] &&
json.scripts['postinstall'].includes('patch-package')
) {
return json;
}
if (json.scripts.postinstall) {
if (!(json.scripts.postinstall as string).includes('patch-package')) {
json.scripts.postinstall = `patch-package && ${json.script.postinstall}`;
}
} else {
json.scripts.postinstall = 'patch-package';
}
return json;
});
function addFiles() { function addFiles() {
return host => { return host => {
if (host.exists('patches/BUILD.bazel')) { if (host.exists('/.bazelrc')) {
return noop; return noop;
} }
return mergeWith( return mergeWith(
apply(url('./files/root'), [ apply(url('./files/root'), [
template({ template({
tmpl: '' tmpl: ''
}), })
() => {
if (host.exists('BUILD.bazel')) {
host.delete('BUILD.bazel');
}
}
]) ])
); );
}; };
@ -92,7 +60,6 @@ export default (): Rule => {
return chain([ return chain([
updateGitIgnore(), updateGitIgnore(),
!packageJson.devDependencies['@bazel/bazel'] ? addRequiredPackages : noop, !packageJson.devDependencies['@bazel/bazel'] ? addRequiredPackages : noop,
addPostInstall,
addFiles() addFiles()
]); ]);
}; };

View File

@ -26,7 +26,6 @@ load("@build_bazel_rules_nodejs//:index.bzl", "yarn_install")
yarn_install( yarn_install(
# Name this npm so that Bazel Label references look like @npm//package # Name this npm so that Bazel Label references look like @npm//package
name = "npm", name = "npm",
data = ["//patches"],
package_json = "//:package.json", package_json = "//:package.json",
yarn_lock = "//:yarn.lock", yarn_lock = "//:yarn.lock",
) )

View File

@ -57,7 +57,6 @@ describe('@nrwl/bazel:sync', () => {
yarn_install( yarn_install(
# Name this npm so that Bazel Label references look like @npm//package # Name this npm so that Bazel Label references look like @npm//package
name = "npm", name = "npm",
data = ["//patches"],
package_json = "//:package.json", package_json = "//:package.json",
yarn_lock = "//:yarn.lock", yarn_lock = "//:yarn.lock",
) )

View File

@ -1,6 +1,5 @@
export const bazelVersion = '^1.2.0'; export const bazelVersion = '^1.2.0';
export const iBazelVersion = '0.10.3'; export const iBazelVersion = '0.10.3';
export const patchVersion = '^6.2.0';
export const rulesNodeJSVersion = '0.42.3'; export const rulesNodeJSVersion = '0.42.3';
export const rulesNodeJSSha = export const rulesNodeJSSha =
'a54b2511d6dae42c1f7cdaeb08144ee2808193a088004fc3b464a04583d5aa2e'; 'a54b2511d6dae42c1f7cdaeb08144ee2808193a088004fc3b464a04583d5aa2e';

View File

@ -36,8 +36,8 @@
"cypress": "^3.8.2" "cypress": "^3.8.2"
}, },
"dependencies": { "dependencies": {
"@angular-devkit/architect": "0.803.23", "@angular-devkit/architect": "0.900.0-rc.12",
"@angular-devkit/core": "8.3.23", "@angular-devkit/core": "9.0.0-rc.12",
"@cypress/webpack-preprocessor": "~4.1.0", "@cypress/webpack-preprocessor": "~4.1.0",
"tree-kill": "1.2.2", "tree-kill": "1.2.2",
"ts-loader": "^5.3.1", "ts-loader": "^5.3.1",

View File

@ -34,6 +34,6 @@
"dependencies": { "dependencies": {
"@nrwl/node": "*", "@nrwl/node": "*",
"@nrwl/jest": "*", "@nrwl/jest": "*",
"@angular-devkit/schematics": "8.3.23" "@angular-devkit/schematics": "9.0.0-rc.12"
} }
} }

View File

@ -35,8 +35,8 @@
"@nrwl/workspace": "*" "@nrwl/workspace": "*"
}, },
"dependencies": { "dependencies": {
"@angular-devkit/architect": "0.803.23", "@angular-devkit/architect": "0.900.0-rc.12",
"@angular-devkit/core": "8.3.23", "@angular-devkit/core": "9.0.0-rc.12",
"@angular-devkit/schematics": "8.3.23" "@angular-devkit/schematics": "9.0.0-rc.12"
} }
} }

View File

@ -27,7 +27,7 @@
"@nrwl/workspace": "*" "@nrwl/workspace": "*"
}, },
"dependencies": { "dependencies": {
"@angular-devkit/architect": "0.803.23", "@angular-devkit/architect": "0.900.0-rc.12",
"@angular-eslint/builder": "0.0.1-alpha.18" "@angular-eslint/builder": "0.0.1-alpha.18"
} }
} }

View File

@ -34,6 +34,6 @@
"dependencies": { "dependencies": {
"@nrwl/node": "*", "@nrwl/node": "*",
"@nrwl/jest": "*", "@nrwl/jest": "*",
"@angular-devkit/schematics": "8.3.23" "@angular-devkit/schematics": "9.0.0-rc.12"
} }
} }

View File

@ -34,7 +34,7 @@
}, },
"dependencies": { "dependencies": {
"@nrwl/react": "*", "@nrwl/react": "*",
"@angular-devkit/schematics": "8.3.23", "@angular-devkit/schematics": "9.0.0-rc.12",
"@svgr/webpack": "^4.3.3", "@svgr/webpack": "^4.3.3",
"url-loader": "^2.2.0" "url-loader": "^2.2.0"
} }

View File

@ -34,10 +34,10 @@
"dependencies": { "dependencies": {
"@nrwl/jest": "*", "@nrwl/jest": "*",
"@nrwl/linter": "*", "@nrwl/linter": "*",
"@angular-devkit/architect": "0.803.23", "@angular-devkit/architect": "0.900.0-rc.12",
"@angular-devkit/core": "8.3.23", "@angular-devkit/core": "9.0.0-rc.12",
"@angular-devkit/schematics": "8.3.23", "@angular-devkit/schematics": "9.0.0-rc.12",
"@angular-devkit/build-webpack": "0.803.23", "@angular-devkit/build-webpack": "0.900.0-rc.12",
"circular-dependency-plugin": "5.2.0", "circular-dependency-plugin": "5.2.0",
"copy-webpack-plugin": "5.1.1", "copy-webpack-plugin": "5.1.1",
"fork-ts-checker-webpack-plugin": "^3.1.1", "fork-ts-checker-webpack-plugin": "^3.1.1",

View File

@ -3,7 +3,6 @@ import { JsonObject, workspaces } from '@angular-devkit/core';
import { runWebpack, BuildResult } from '@angular-devkit/build-webpack'; import { runWebpack, BuildResult } from '@angular-devkit/build-webpack';
import { Observable, from } from 'rxjs'; import { Observable, from } from 'rxjs';
import { writeFileSync } from 'fs';
import { resolve } from 'path'; import { resolve } from 'path';
import { map, concatMap } from 'rxjs/operators'; import { map, concatMap } from 'rxjs/operators';
import { getNodeWebpackConfig } from '../../utils/node.config'; import { getNodeWebpackConfig } from '../../utils/node.config';
@ -50,7 +49,8 @@ function run(
runWebpack(config, context, { runWebpack(config, context, {
logging: stats => { logging: stats => {
context.logger.info(stats.toString(config.stats)); context.logger.info(stats.toString(config.stats));
} },
webpackFactory: require('webpack')
}) })
), ),
map((buildEvent: BuildResult) => { map((buildEvent: BuildResult) => {

View File

@ -34,7 +34,7 @@
"@nrwl/cypress": "*", "@nrwl/cypress": "*",
"@nrwl/jest": "*", "@nrwl/jest": "*",
"@nrwl/web": "*", "@nrwl/web": "*",
"@angular-devkit/schematics": "8.3.23", "@angular-devkit/schematics": "9.0.0-rc.12",
"@svgr/webpack": "^4.3.3", "@svgr/webpack": "^4.3.3",
"confusing-browser-globals": "^1.0.8", "confusing-browser-globals": "^1.0.8",
"eslint-plugin-import": "^2.19.1", "eslint-plugin-import": "^2.19.1",

View File

@ -39,7 +39,7 @@
"graphviz": "0.0.8", "graphviz": "0.0.8",
"ignore": "5.0.4", "ignore": "5.0.4",
"opn": "^5.3.0", "opn": "^5.3.0",
"rxjs": "^6.4.0", "rxjs": "6.5.3",
"semver": "5.4.1", "semver": "5.4.1",
"strip-json-comments": "2.0.1", "strip-json-comments": "2.0.1",
"tmp": "0.0.33", "tmp": "0.0.33",

View File

@ -5,5 +5,28 @@
"description": "Update storybook builder and tsconfig", "description": "Update storybook builder and tsconfig",
"factory": "./src/migrations/update-8-8-2/update-builder-8-8-2" "factory": "./src/migrations/update-8-8-2/update-builder-8-8-2"
} }
},
"packageJsonUpdates": {
"9.0.0": {
"version": "9.0.0-beta.1",
"packages": {
"@storybook/angular": {
"version": "5.3.9",
"alwaysAddToPackageJson": false
},
"@storybook/react": {
"version": "5.3.9",
"alwaysAddToPackageJson": false
},
"@storybook/web": {
"version": "5.3.9",
"alwaysAddToPackageJson": false
},
"@storybook/addon-knobs": {
"version": "5.3.9",
"alwaysAddToPackageJson": false
}
}
}
} }
} }

View File

@ -29,10 +29,10 @@
}, },
"peerDependencies": { "peerDependencies": {
"@nrwl/workspace": "*", "@nrwl/workspace": "*",
"@storybook/angular": "^5.2.5", "@storybook/angular": "5.3.9",
"@storybook/react": "^5.2.5", "@storybook/react": "5.3.9",
"@storybook/core": "^5.2.5", "@storybook/core": "5.3.9",
"@storybook/addon-knobs": "^5.2.5", "@storybook/addon-knobs": "5.3.9",
"babel-loader": "^8.0.6", "babel-loader": "^8.0.6",
"@babel/core": "^7.5.4" "@babel/core": "^7.5.4"
}, },

View File

@ -0,0 +1,12 @@
import { chain } from '@angular-devkit/schematics';
import { updatePackagesInPackageJson } from '@nrwl/workspace';
import { join } from 'path';
const updatePackages = updatePackagesInPackageJson(
join(__dirname, '../../../', 'migrations.json'),
'9.0.0'
);
export default function() {
return chain([updatePackages]);
}

View File

@ -1,3 +1,3 @@
export const storybookVersion = '5.2.5'; export const storybookVersion = '5.3.9';
export const babelCoreVersion = '7.8.3'; export const babelCoreVersion = '7.8.3';
export const babelLoaderVersion = '8.0.6'; export const babelLoaderVersion = '8.0.6';

View File

@ -29,9 +29,9 @@
}, },
"homepage": "https://nx.dev", "homepage": "https://nx.dev",
"dependencies": { "dependencies": {
"@angular-devkit/schematics": "8.3.23", "@angular-devkit/schematics": "9.0.0-rc.12",
"@angular-devkit/core": "8.3.23", "@angular-devkit/core": "9.0.0-rc.12",
"@angular-devkit/architect": "0.803.23", "@angular-devkit/architect": "0.900.0-rc.12",
"inquirer": "^6.3.1", "inquirer": "^6.3.1",
"minimist": "^1.2.0", "minimist": "^1.2.0",
"strip-json-comments": "2.0.1", "strip-json-comments": "2.0.1",

View File

@ -1,11 +1,10 @@
import { logging, normalize, virtualFs } from '@angular-devkit/core'; import { logging, normalize, virtualFs } from '@angular-devkit/core';
import * as core from '@angular-devkit/core/node';
import { NodeJsSyncHost } from '@angular-devkit/core/node'; import { NodeJsSyncHost } from '@angular-devkit/core/node';
import { BaseWorkflow } from '@angular-devkit/schematics/src/workflow'; import { BaseWorkflow } from '@angular-devkit/schematics/src/workflow';
import { NodeModulesEngineHost } from '@angular-devkit/schematics/tools'; import { NodeModulesEngineHost } from '@angular-devkit/schematics/tools';
import { execSync } from 'child_process'; import { execSync } from 'child_process';
import { readFileSync, writeFileSync } from 'fs'; import { readFileSync, writeFileSync } from 'fs';
import * as path from 'path'; import { dirname, extname, join, resolve } from 'path';
import { gt, lte } from 'semver'; import { gt, lte } from 'semver';
import * as stripJsonComments from 'strip-json-comments'; import * as stripJsonComments from 'strip-json-comments';
import { dirSync } from 'tmp'; import { dirSync } from 'tmp';
@ -383,7 +382,7 @@ function versions(root: string, from: { [p: string]: string }) {
return from[packageName]; return from[packageName];
} }
const content = readFileSync( const content = readFileSync(
path.join(root, `./node_modules/${packageName}/package.json`) join(root, `./node_modules/${packageName}/package.json`)
); );
return JSON.parse(stripJsonComments(content.toString()))['version']; return JSON.parse(stripJsonComments(content.toString()))['version'];
} catch (e) { } catch (e) {
@ -408,7 +407,7 @@ function createFetcher(logger: logging.Logger) {
const json = JSON.parse( const json = JSON.parse(
stripJsonComments( stripJsonComments(
readFileSync( readFileSync(
path.join(dir, 'node_modules', packageName, 'package.json') join(dir, 'node_modules', packageName, 'package.json')
).toString() ).toString()
) )
); );
@ -427,7 +426,7 @@ function createFetcher(logger: logging.Logger) {
const json = JSON.parse( const json = JSON.parse(
stripJsonComments( stripJsonComments(
readFileSync( readFileSync(
path.join(dir, 'node_modules', packageName, migrationsFile) join(dir, 'node_modules', packageName, migrationsFile)
).toString() ).toString()
) )
); );
@ -458,7 +457,7 @@ function createFetcher(logger: logging.Logger) {
function createMigrationsFile(root: string, migrations: any[]) { function createMigrationsFile(root: string, migrations: any[]) {
writeFileSync( writeFileSync(
path.join(root, 'migrations.json'), join(root, 'migrations.json'),
JSON.stringify({ migrations }, null, 2) JSON.stringify({ migrations }, null, 2)
); );
} }
@ -469,7 +468,7 @@ function updatePackageJson(
[p: string]: { version: string; alwaysAddToPackageJson: boolean }; [p: string]: { version: string; alwaysAddToPackageJson: boolean };
} }
) { ) {
const packageJsonPath = path.join(root, 'package.json'); const packageJsonPath = join(root, 'package.json');
const json = JSON.parse( const json = JSON.parse(
stripJsonComments(readFileSync(packageJsonPath).toString()) stripJsonComments(readFileSync(packageJsonPath).toString())
); );
@ -579,20 +578,22 @@ class MigrationEngineHost extends NodeModulesEngineHost {
protected _resolveCollectionPath(name: string): string { protected _resolveCollectionPath(name: string): string {
let collectionPath: string | undefined = undefined; let collectionPath: string | undefined = undefined;
if (name.replace(/\\/g, '/').split('/').length > (name[0] == '@' ? 2 : 1)) { try {
try { return super._resolveCollectionPath(name);
collectionPath = this._resolvePath(name, process.cwd()); } catch {}
} catch {}
if (name.startsWith('.') || name.startsWith('/')) {
name = resolve(name);
} }
if (!collectionPath) { if (extname(name)) {
let packageJsonPath = this._resolvePackageJson(name, process.cwd()); collectionPath = require.resolve(name);
if (!core.fs.isFile(packageJsonPath)) { } else {
packageJsonPath = path.join(packageJsonPath, 'package.json'); const packageJsonPath = require.resolve(join(name, 'package.json'));
} const packageJson = require(packageJsonPath);
let pkgJsonSchematics = require(packageJsonPath)['nx-migrations']; let pkgJsonSchematics = packageJson['nx-migrations'];
if (!pkgJsonSchematics) { if (!pkgJsonSchematics) {
pkgJsonSchematics = require(packageJsonPath)['ng-update']; pkgJsonSchematics = packageJson['ng-update'];
if (!pkgJsonSchematics) { if (!pkgJsonSchematics) {
throw new Error(`Could find migrations in package: "${name}"`); throw new Error(`Could find migrations in package: "${name}"`);
} }
@ -600,10 +601,7 @@ class MigrationEngineHost extends NodeModulesEngineHost {
if (typeof pkgJsonSchematics != 'string') { if (typeof pkgJsonSchematics != 'string') {
pkgJsonSchematics = pkgJsonSchematics.migrations; pkgJsonSchematics = pkgJsonSchematics.migrations;
} }
collectionPath = this._resolvePath( collectionPath = resolve(dirname(packageJsonPath), pkgJsonSchematics);
pkgJsonSchematics,
path.dirname(packageJsonPath)
);
} }
try { try {
@ -635,9 +633,7 @@ async function runMigrations(
opts: { runMigrations: string } opts: { runMigrations: string }
) { ) {
const migrationsFile = JSON.parse( const migrationsFile = JSON.parse(
stripJsonComments( stripJsonComments(readFileSync(join(root, opts.runMigrations)).toString())
readFileSync(path.join(root, opts.runMigrations)).toString()
)
); );
const host = new virtualFs.ScopedHost(new NodeJsSyncHost(), normalize(root)); const host = new virtualFs.ScopedHost(new NodeJsSyncHost(), normalize(root));

View File

@ -6,7 +6,8 @@ import {
logging, logging,
normalize, normalize,
schema, schema,
terminal terminal,
workspaces
} from '@angular-devkit/core'; } from '@angular-devkit/core';
import { NodeJsSyncHost } from '@angular-devkit/core/node'; import { NodeJsSyncHost } from '@angular-devkit/core/node';
import { getLogger } from '../shared/logger'; import { getLogger } from '../shared/logger';
@ -18,6 +19,7 @@ import {
} from '../shared/params'; } from '../shared/params';
import { commandName, printHelp } from '../shared/print-help'; import { commandName, printHelp } from '../shared/print-help';
import minimist = require('minimist'); import minimist = require('minimist');
import { WorkspaceDefinition } from '@angular-devkit/core/src/workspace';
export interface RunOptions { export interface RunOptions {
project: string; project: string;
@ -92,12 +94,12 @@ function printRunHelp(
} }
export function validateTargetAndConfiguration( export function validateTargetAndConfiguration(
workspace: experimental.workspace.Workspace, workspace: WorkspaceDefinition,
opts: RunOptions opts: RunOptions
) { ) {
const targets = workspace.getProjectTargets(opts.project); const targets = workspace.projects.get(opts.project).targets;
const target = targets[opts.target]; const target = targets.get(opts.target);
if (!target) { if (!target) {
throw new Error( throw new Error(
`Could not find target "${opts.target}" in the ${ `Could not find target "${opts.target}" in the ${
@ -135,14 +137,16 @@ export async function run(root: string, args: string[], isVerbose: boolean) {
return handleErrors(logger, isVerbose, async () => { return handleErrors(logger, isVerbose, async () => {
const fsHost = new NodeJsSyncHost(); const fsHost = new NodeJsSyncHost();
const workspace = await new experimental.workspace.Workspace( const { workspace } = await workspaces.readWorkspace(
normalize(root) as any, 'workspace.json',
fsHost workspaces.createWorkspaceHost(fsHost)
) );
.loadWorkspaceFromHost('workspace.json' as any)
.toPromise();
const opts = parseRunOpts(args, workspace.getDefaultProjectName(), logger); const opts = parseRunOpts(
args,
workspace.extensions['defaultProject'] as string,
logger
);
validateTargetAndConfiguration(workspace, opts); validateTargetAndConfiguration(workspace, opts);
const registry = new json.schema.CoreSchemaRegistry(); const registry = new json.schema.CoreSchemaRegistry();

View File

@ -34,20 +34,20 @@
"@nrwl/cypress": "*", "@nrwl/cypress": "*",
"@nrwl/jest": "*", "@nrwl/jest": "*",
"@nrwl/linter": "*", "@nrwl/linter": "*",
"@angular/service-worker": "8.2.12", "@angular/service-worker": "9.0.0-rc.12",
"@angular-devkit/architect": "0.803.23", "@angular-devkit/architect": "0.900.0-rc.12",
"@angular-devkit/build-ng-packagr": "0.803.23", "@angular-devkit/build-ng-packagr": "0.900.0-rc.12",
"@angular-devkit/build-optimizer": "0.803.23", "@angular-devkit/build-optimizer": "0.900.0-rc.12",
"@angular-devkit/build-webpack": "0.803.23", "@angular-devkit/build-webpack": "0.900.0-rc.12",
"@angular-devkit/core": "8.3.23", "@angular-devkit/core": "9.0.0-rc.12",
"@angular-devkit/schematics": "8.3.23", "@angular-devkit/schematics": "9.0.0-rc.12",
"@babel/core": "7.8.3", "@babel/core": "7.8.3",
"@babel/preset-env": "7.8.3", "@babel/preset-env": "7.8.3",
"@babel/preset-typescript": "7.8.3", "@babel/preset-typescript": "7.8.3",
"@babel/plugin-proposal-class-properties": "7.8.3", "@babel/plugin-proposal-class-properties": "7.8.3",
"@babel/plugin-proposal-decorators": "7.8.3", "@babel/plugin-proposal-decorators": "7.8.3",
"@babel/plugin-transform-regenerator": "7.8.3", "@babel/plugin-transform-regenerator": "7.8.3",
"@ngtools/webpack": "8.3.23", "@ngtools/webpack": "9.0.0-rc.12",
"ajv": "6.10.2", "ajv": "6.10.2",
"autoprefixer": "9.6.1", "autoprefixer": "9.6.1",
"babel-loader": "8.0.6", "babel-loader": "8.0.6",
@ -83,7 +83,7 @@
"postcss-import": "12.0.1", "postcss-import": "12.0.1",
"postcss-loader": "3.0.0", "postcss-loader": "3.0.0",
"raw-loader": "3.1.0", "raw-loader": "3.1.0",
"rxjs": "6.4.0", "rxjs": "6.5.3",
"regenerator-runtime": "0.13.3", "regenerator-runtime": "0.13.3",
"rollup": "1.20.3", "rollup": "1.20.3",
"rollup-plugin-babel": "4.3.3", "rollup-plugin-babel": "4.3.3",

View File

@ -116,7 +116,8 @@ export function run(options: WebBuildBuilderOptions, context: BuilderContext) {
if (IGNORED_WEBPACK_OUTPUT.every(r => !r.test(msg))) { if (IGNORED_WEBPACK_OUTPUT.every(r => !r.test(msg))) {
context.logger.info(msg); context.logger.info(msg);
} }
} },
webpackFactory: require('webpack')
}); });
} else { } else {
return of(); return of();

View File

@ -101,7 +101,9 @@ function run(
return runWebpackDevServer(config, context, { return runWebpackDevServer(config, context, {
logging: stats => { logging: stats => {
context.logger.info(stats.toString(config.stats)); context.logger.info(stats.toString(config.stats));
} },
webpackFactory: require('webpack'),
webpackDevServerFactory: require('webpack-dev-server')
}).pipe( }).pipe(
map(output => { map(output => {
output.baseUrl = serverUrl; output.baseUrl = serverUrl;

View File

@ -49,6 +49,11 @@
"version": "8.12.0-beta.1", "version": "8.12.0-beta.1",
"description": "Add enforceBuildableLibDependency flag to the nx enforce boundary lint rule", "description": "Add enforceBuildableLibDependency flag to the nx enforce boundary lint rule",
"factory": "./src/migrations/update-8-12-0/update-enforce-boundary-lint-rule" "factory": "./src/migrations/update-8-12-0/update-enforce-boundary-lint-rule"
},
"update-9-0-0": {
"version": "9.0.0-beta.1",
"description": "Update typescript to 3.6 and angular/cli to version 9",
"factory": "./src/migrations/update-9-0-0/update-9-0-0"
} }
}, },
"packageJsonUpdates": { "packageJsonUpdates": {
@ -340,6 +345,19 @@
"alwaysAddToPackageJson": false "alwaysAddToPackageJson": false
} }
} }
},
"9.0.0": {
"version": "9.0.0-beta.1",
"packages": {
"@angular/cli": {
"version": "9.0.0-rc.12",
"alwaysAddToPackageJson": false
},
"typescript": {
"version": "~3.7.4",
"alwaysAddToPackageJson": false
}
}
} }
} }
} }

View File

@ -50,15 +50,15 @@
"prettier": "^1.18.2" "prettier": "^1.18.2"
}, },
"dependencies": { "dependencies": {
"@angular-devkit/core": "8.3.23", "@angular-devkit/core": "9.0.0-rc.12",
"@angular-devkit/schematics": "8.3.23", "@angular-devkit/schematics": "9.0.0-rc.12",
"cosmiconfig": "4.0.0", "cosmiconfig": "4.0.0",
"fs-extra": "6.0.0", "fs-extra": "6.0.0",
"ignore": "5.0.4", "ignore": "5.0.4",
"npm-run-all": "4.1.5", "npm-run-all": "4.1.5",
"hasha": "5.1.0", "hasha": "5.1.0",
"opn": "^5.3.0", "opn": "^5.3.0",
"rxjs": "^6.4.0", "rxjs": "6.5.3",
"semver": "5.4.1", "semver": "5.4.1",
"strip-json-comments": "2.0.1", "strip-json-comments": "2.0.1",
"tmp": "0.0.33", "tmp": "0.0.33",

View File

@ -17,7 +17,7 @@ export interface NxJson<T = '*' | string[]> {
tasksRunnerOptions?: { tasksRunnerOptions?: {
[tasksRunnerName: string]: { [tasksRunnerName: string]: {
runner: string; runner: string;
options?: unknown; options?: object;
}; };
}; };
} }

View File

@ -0,0 +1,12 @@
import { chain } from '@angular-devkit/schematics';
import { updatePackagesInPackageJson } from '@nrwl/workspace';
import { join } from 'path';
const updatePackages = updatePackagesInPackageJson(
join(__dirname, '../../../', 'migrations.json'),
'9.0.0'
);
export default function() {
return chain([updatePackages]);
}

View File

@ -9,7 +9,7 @@ import {
TestingArchitectHost, TestingArchitectHost,
TestLogger TestLogger
} from '@angular-devkit/architect/testing'; } from '@angular-devkit/architect/testing';
import { JsonObject } from '@angular-devkit/core'; import { json, JsonObject } from '@angular-devkit/core';
import { ScheduleOptions } from '@angular-devkit/architect/src/api'; import { ScheduleOptions } from '@angular-devkit/architect/src/api';
export function getFileContent(tree: Tree, path: string): string { export function getFileContent(tree: Tree, path: string): string {
@ -136,4 +136,13 @@ export class MockBuilderContext implements BuilderContext {
reportProgress(current: number, total?: number, status?: string) {} reportProgress(current: number, total?: number, status?: string) {}
addTeardown(teardown: () => Promise<void> | void) {} addTeardown(teardown: () => Promise<void> | void) {}
async getProjectMetadata(
target: Target | string
): Promise<json.JsonObject | null> {
return (
this.architectHost &&
this.architectHost.getProjectMetadata(target as string)
);
}
} }

View File

@ -3,6 +3,7 @@ import {
SchematicContext, SchematicContext,
TaskConfiguration, TaskConfiguration,
TaskConfigurationGenerator, TaskConfigurationGenerator,
TaskExecutor,
TaskExecutorFactory, TaskExecutorFactory,
TaskId, TaskId,
Tree Tree
@ -66,7 +67,7 @@ function createRunUpdateTask(): TaskExecutorFactory<UpdateTaskOptions> {
return { return {
name: 'RunUpdate', name: 'RunUpdate',
create: () => { create: () => {
return Promise.resolve( return Promise.resolve<TaskExecutor<UpdateTaskOptions>>(
(options: UpdateTaskOptions, context: SchematicContext) => { (options: UpdateTaskOptions, context: SchematicContext) => {
context.logger.info(`Updating ${options.package} to ${options.to}`); context.logger.info(`Updating ${options.package} to ${options.to}`);
const forkOptions = { const forkOptions = {

View File

@ -1,7 +1,7 @@
export const nxVersion = '*'; export const nxVersion = '*';
export const angularCliVersion = '8.3.14'; export const angularCliVersion = '9.0.0-rc.12';
export const typescriptVersion = '~3.5.3'; export const typescriptVersion = '~3.7.4';
export const prettierVersion = '1.18.2'; export const prettierVersion = '1.18.2';
export const typescriptESLintVersion = '2.3.2'; export const typescriptESLintVersion = '2.3.2';
export const eslintVersion = '6.1.0'; export const eslintVersion = '6.1.0';

View File

@ -5,7 +5,7 @@ if [ "$1" = "fast" ]; then
fi fi
if [ "$1" != "fast" ]; then if [ "$1" != "fast" ]; then
./scripts/build.sh ./scripts/package.sh --local
fi fi
rm -rf node_modules/@nrwl rm -rf node_modules/@nrwl

2853
yarn.lock

File diff suppressed because it is too large Load Diff