Revert "Revert "feat(core): update to next version of angular deps"" (#2264)
This reverts commit f816fc424d4b0d850e0a49d0ed8e4a30ddca308c.
This commit is contained in:
parent
1c4078986f
commit
b6e6b3f1c3
@ -52,11 +52,11 @@ Test runner to use for end to end (e2e) tests
|
||||
|
||||
### enableIvy
|
||||
|
||||
Default: `false`
|
||||
Default: `true`
|
||||
|
||||
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
|
||||
|
||||
|
||||
@ -52,11 +52,11 @@ Test runner to use for end to end (e2e) tests
|
||||
|
||||
### enableIvy
|
||||
|
||||
Default: `false`
|
||||
Default: `true`
|
||||
|
||||
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
|
||||
|
||||
|
||||
@ -52,11 +52,11 @@ Test runner to use for end to end (e2e) tests
|
||||
|
||||
### enableIvy
|
||||
|
||||
Default: `false`
|
||||
Default: `true`
|
||||
|
||||
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
|
||||
|
||||
|
||||
@ -63,13 +63,13 @@ forEachCli(() => {
|
||||
console.log(
|
||||
`The current es2015 bundle size is ${es2015BundleSize / 1000} KB`
|
||||
);
|
||||
expect(es2015BundleSize).toBeLessThanOrEqual(160000);
|
||||
expect(es2015BundleSize).toBeLessThanOrEqual(125000);
|
||||
|
||||
const es5BundleSize = getSize(
|
||||
tmpProjPath(`dist/apps/my-dir/${myapp}/main-es5.js`)
|
||||
);
|
||||
console.log(`The current es5 bundle size is ${es5BundleSize / 1000} KB`);
|
||||
expect(es5BundleSize).toBeLessThanOrEqual(175000);
|
||||
expect(es5BundleSize).toBeLessThanOrEqual(150000);
|
||||
|
||||
// running tests for the app
|
||||
expectTestsPass(await runCLIAsync(`test my-dir-${myapp} --no-watch`));
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
import { capitalize } from '@nrwl/workspace/src/utils/strings';
|
||||
import { fork } from 'child_process';
|
||||
import { stringUtils } from '@nrwl/workspace';
|
||||
import * as http from 'http';
|
||||
import {
|
||||
checkFilesExist,
|
||||
@ -63,7 +63,9 @@ module.exports = {
|
||||
`
|
||||
import dynamic from 'next/dynamic';
|
||||
const DynamicComponent = dynamic(
|
||||
() => import('@proj/${libName}').then(d => d.${capitalize(libName)})
|
||||
() => import('@proj/${libName}').then(d => d.${stringUtils.capitalize(
|
||||
libName
|
||||
)})
|
||||
);
|
||||
` + readFile(mainPath)
|
||||
);
|
||||
|
||||
@ -132,7 +132,7 @@ forEachCli('angular', () => {
|
||||
expect(updatedAngularCLIJson.projects.proj.architect.build).toEqual({
|
||||
builder: '@angular-devkit/build-angular:browser',
|
||||
options: {
|
||||
aot: false,
|
||||
aot: true,
|
||||
outputPath: 'dist/apps/proj',
|
||||
index: 'apps/proj/src/index.html',
|
||||
main: 'apps/proj/src/main.ts',
|
||||
@ -167,7 +167,6 @@ forEachCli('angular', () => {
|
||||
sourceMap: false,
|
||||
extractCss: true,
|
||||
namedChunks: false,
|
||||
aot: true,
|
||||
extractLicenses: true,
|
||||
vendorChunk: false,
|
||||
buildOptimizer: true
|
||||
|
||||
@ -129,7 +129,7 @@ forEachCli(currentCLIName => {
|
||||
done();
|
||||
});
|
||||
});
|
||||
}, 60000);
|
||||
}, 120000);
|
||||
|
||||
it('should have correct ts options for nest application', async () => {
|
||||
if (currentCLIName === 'angular') {
|
||||
@ -158,7 +158,8 @@ forEachCli(currentCLIName => {
|
||||
); // respects "extends" inside tsconfigs
|
||||
|
||||
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 => {
|
||||
ensureProject();
|
||||
@ -222,7 +223,7 @@ forEachCli(currentCLIName => {
|
||||
done();
|
||||
});
|
||||
});
|
||||
}, 60000);
|
||||
}, 120000);
|
||||
|
||||
it('should be able to generate an empty application', async () => {
|
||||
ensureProject();
|
||||
|
||||
@ -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';
|
||||
|
||||
const testTimeout = 120000;
|
||||
|
||||
14
e2e/utils.ts
14
e2e/utils.ts
@ -84,6 +84,17 @@ export function runYarnInstall(silent: boolean = true) {
|
||||
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
|
||||
*
|
||||
@ -150,6 +161,8 @@ function default_1(factoryOptions = {}) {
|
||||
exports.default = default_1;`
|
||||
);
|
||||
|
||||
runNgcc();
|
||||
|
||||
execSync(`mv ${tmpProjPath()} ${tmpBackupProjPath()}`);
|
||||
}
|
||||
execSync(`cp -a ${tmpBackupProjPath()} ${tmpProjPath()}`);
|
||||
@ -241,6 +254,7 @@ export function copyMissingPackages(): void {
|
||||
'document-register-element',
|
||||
|
||||
'@angular/forms',
|
||||
'@storybook',
|
||||
|
||||
'fork-ts-checker-webpack-plugin',
|
||||
|
||||
|
||||
66
package.json
66
package.json
@ -26,32 +26,32 @@
|
||||
"documentation": "./scripts/documentation/documentation.sh && ./scripts/documentation/check-documentation.sh"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@angular-devkit/architect": "0.803.23",
|
||||
"@angular-devkit/build-angular": "0.803.23",
|
||||
"@angular-devkit/build-ng-packagr": "0.803.23",
|
||||
"@angular-devkit/build-optimizer": "0.803.23",
|
||||
"@angular-devkit/build-webpack": "0.803.23",
|
||||
"@angular-devkit/core": "8.3.23",
|
||||
"@angular-devkit/schematics": "8.3.23",
|
||||
"@angular-devkit/architect": "0.900.0-rc.12",
|
||||
"@angular-devkit/build-angular": "0.900.0-rc.12",
|
||||
"@angular-devkit/build-ng-packagr": "0.900.0-rc.12",
|
||||
"@angular-devkit/build-optimizer": "0.900.0-rc.12",
|
||||
"@angular-devkit/build-webpack": "0.900.0-rc.12",
|
||||
"@angular-devkit/core": "9.0.0-rc.12",
|
||||
"@angular-devkit/schematics": "9.0.0-rc.12",
|
||||
"@angular-eslint/builder": "0.0.1-alpha.18",
|
||||
"@angular/cli": "8.3.23",
|
||||
"@angular/common": "^8.2.12",
|
||||
"@angular/compiler": "^8.2.12",
|
||||
"@angular/compiler-cli": "^8.2.12",
|
||||
"@angular/core": "^8.2.12",
|
||||
"@angular/forms": "^8.2.12",
|
||||
"@angular/platform-browser": "^8.2.12",
|
||||
"@angular/platform-browser-dynamic": "^8.2.12",
|
||||
"@angular/router": "^8.2.12",
|
||||
"@angular/service-worker": "^8.2.12",
|
||||
"@angular/upgrade": "^8.2.12",
|
||||
"@babel/core": "7.8.3",
|
||||
"@babel/preset-env": "7.8.3",
|
||||
"@babel/preset-react": "7.8.3",
|
||||
"@babel/plugin-proposal-class-properties": "7.8.3",
|
||||
"@babel/plugin-proposal-decorators": "7.8.3",
|
||||
"@babel/plugin-transform-regenerator": "7.8.3",
|
||||
"@babel/preset-typescript": "7.8.3",
|
||||
"@angular/cli": "9.0.0-rc.12",
|
||||
"@angular/common": "9.0.0-rc.12",
|
||||
"@angular/compiler": "9.0.0-rc.12",
|
||||
"@angular/compiler-cli": "9.0.0-rc.12",
|
||||
"@angular/core": "9.0.0-rc.12",
|
||||
"@angular/forms": "9.0.0-rc.12",
|
||||
"@angular/platform-browser": "9.0.0-rc.12",
|
||||
"@angular/platform-browser-dynamic": "9.0.0-rc.12",
|
||||
"@angular/router": "9.0.0-rc.12",
|
||||
"@angular/service-worker": "9.0.0-rc.12",
|
||||
"@angular/upgrade": "9.0.0-rc.12",
|
||||
"@babel/core": "7.5.5",
|
||||
"@babel/plugin-proposal-class-properties": "7.5.5",
|
||||
"@babel/plugin-proposal-decorators": "7.4.4",
|
||||
"@babel/plugin-transform-regenerator": "7.4.5",
|
||||
"@babel/preset-env": "7.5.5",
|
||||
"@babel/preset-react": "7.0.0",
|
||||
"@babel/preset-typescript": "7.3.3",
|
||||
"@bazel/bazel": "^1.2.0",
|
||||
"@bazel/ibazel": "^0.10.3",
|
||||
"@cypress/webpack-preprocessor": "^4.1.0",
|
||||
@ -66,12 +66,12 @@
|
||||
"@ngrx/schematics": "8.5.0",
|
||||
"@ngrx/store": "8.5.0",
|
||||
"@ngrx/store-devtools": "8.5.0",
|
||||
"@ngtools/webpack": "8.3.23",
|
||||
"@schematics/angular": "8.3.23",
|
||||
"@storybook/addon-knobs": "^5.2.5",
|
||||
"@storybook/angular": "^5.2.5",
|
||||
"@storybook/core": "^5.2.5",
|
||||
"@storybook/react": "^5.2.5",
|
||||
"@ngtools/webpack": "9.0.0-rc.12",
|
||||
"@schematics/angular": "9.0.0-rc.12",
|
||||
"@storybook/addon-knobs": "5.3.9",
|
||||
"@storybook/angular": "5.3.9",
|
||||
"@storybook/core": "5.3.9",
|
||||
"@storybook/react": "5.3.9",
|
||||
"@svgr/webpack": "^4.3.3",
|
||||
"@testing-library/react": "9.4.0",
|
||||
"@types/express": "4.17.0",
|
||||
@ -191,7 +191,7 @@
|
||||
"rollup-plugin-peer-deps-external": "2.2.0",
|
||||
"rollup-plugin-postcss": "2.0.3",
|
||||
"rollup-plugin-typescript2": "0.24.3",
|
||||
"rxjs": "~6.4.0",
|
||||
"rxjs": "6.5.3",
|
||||
"sass": "1.22.9",
|
||||
"sass-loader": "7.2.0",
|
||||
"semver": "6.3.0",
|
||||
@ -216,7 +216,7 @@
|
||||
"tsickle": "^0.37.0",
|
||||
"tslib": "^1.9.3",
|
||||
"tslint": "5.11.0",
|
||||
"typescript": "~3.5.3",
|
||||
"typescript": "~3.7.4",
|
||||
"url-loader": "^2.2.0",
|
||||
"webpack": "4.41.2",
|
||||
"webpack-dev-middleware": "3.7.0",
|
||||
|
||||
@ -1,5 +1,11 @@
|
||||
{
|
||||
"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": {
|
||||
"version": "8.3.0-beta.1",
|
||||
"description": "Upgrades NgRx dependencies to version 8, and runs migrations for breaking changes",
|
||||
@ -14,6 +20,11 @@
|
||||
"version": "8.12.0-beta.1",
|
||||
"description": "Changes Angular library builder to @nrwl/angular:package",
|
||||
"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"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -38,8 +38,8 @@
|
||||
"dependencies": {
|
||||
"@nrwl/cypress": "*",
|
||||
"@nrwl/jest": "*",
|
||||
"@angular-devkit/schematics": "8.3.23",
|
||||
"@schematics/angular": "8.3.23",
|
||||
"@angular-devkit/schematics": "9.0.0-rc.12",
|
||||
"@schematics/angular": "9.0.0-rc.12",
|
||||
"jasmine-marbles": "~0.6.0"
|
||||
}
|
||||
}
|
||||
|
||||
@ -5,7 +5,7 @@ import {
|
||||
UnitTestTree
|
||||
} from '@angular-devkit/schematics/testing';
|
||||
import { serializeJson } from '@nrwl/workspace';
|
||||
import { join } from 'path';
|
||||
import { runMigration } from '../../utils/testing';
|
||||
|
||||
describe('Update 8.5.0', () => {
|
||||
let tree: Tree;
|
||||
@ -13,11 +13,6 @@ describe('Update 8.5.0', () => {
|
||||
|
||||
beforeEach(() => {
|
||||
tree = new UnitTestTree(Tree.empty());
|
||||
|
||||
schematicRunner = new SchematicTestRunner(
|
||||
'@nrwl/workspace',
|
||||
join(__dirname, '../../../migrations.json')
|
||||
);
|
||||
});
|
||||
|
||||
describe('Update Angular CLI', () => {
|
||||
@ -31,9 +26,7 @@ describe('Update 8.5.0', () => {
|
||||
})
|
||||
);
|
||||
|
||||
const result = await schematicRunner
|
||||
.runSchematicAsync('upgrade-cli-8-3', {}, tree)
|
||||
.toPromise();
|
||||
const result = await runMigration('upgrade-cli-8-3', {}, tree);
|
||||
|
||||
expect(
|
||||
readJsonInTree(result, 'package.json').devDependencies['@angular/cli']
|
||||
@ -50,9 +43,7 @@ describe('Update 8.5.0', () => {
|
||||
})
|
||||
);
|
||||
|
||||
const result = await schematicRunner
|
||||
.runSchematicAsync('upgrade-cli-8-3', {}, tree)
|
||||
.toPromise();
|
||||
const result = await runMigration('upgrade-cli-8-3', {}, tree);
|
||||
|
||||
expect(
|
||||
readJsonInTree(result, 'package.json').devDependencies['@angular/cli']
|
||||
@ -69,9 +60,7 @@ describe('Update 8.5.0', () => {
|
||||
})
|
||||
);
|
||||
|
||||
const result = await schematicRunner
|
||||
.runSchematicAsync('upgrade-cli-8-3', {}, tree)
|
||||
.toPromise();
|
||||
const result = await runMigration('upgrade-cli-8-3', {}, tree);
|
||||
|
||||
expect(
|
||||
readJsonInTree(result, 'package.json').devDependencies['@angular/cli']
|
||||
@ -91,9 +80,7 @@ describe('Update 8.5.0', () => {
|
||||
);
|
||||
|
||||
try {
|
||||
await schematicRunner
|
||||
.runSchematicAsync('upgrade-cli-8-3', {}, tree)
|
||||
.toPromise();
|
||||
await runMigration('upgrade-cli-8-3', {}, tree);
|
||||
} catch (e) {
|
||||
error = e;
|
||||
}
|
||||
|
||||
@ -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');
|
||||
});
|
||||
});
|
||||
@ -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;
|
||||
});
|
||||
}
|
||||
20
packages/angular/src/migrations/update-9-0-0/update-9-0-0.ts
Normal file
20
packages/angular/src/migrations/update-9-0-0/update-9-0-0.ts
Normal 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])
|
||||
]);
|
||||
};
|
||||
}
|
||||
@ -8,7 +8,7 @@ import { DataPersistence } from './data-persistence';
|
||||
*/
|
||||
@NgModule({})
|
||||
export class NxModule {
|
||||
static forRoot(): ModuleWithProviders {
|
||||
static forRoot(): ModuleWithProviders<NxModule> {
|
||||
return { ngModule: NxModule, providers: [DataPersistence] };
|
||||
}
|
||||
}
|
||||
|
||||
@ -374,7 +374,6 @@ describe('app', () => {
|
||||
tree,
|
||||
'apps/my-app/tsconfig.app.json'
|
||||
);
|
||||
expect(tsconfigAppJson.exclude).toEqual(['src/test.ts', '**/*.spec.ts']);
|
||||
expect(tsconfigAppJson.compilerOptions.outDir).toEqual(
|
||||
'../../dist/out-tsc'
|
||||
);
|
||||
@ -529,17 +528,5 @@ describe('app', () => {
|
||||
'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\"]`
|
||||
);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@ -529,7 +529,7 @@ function updateProject(options: NormalizedSchema): Rule {
|
||||
: options.unitTestRunner === 'jest'
|
||||
? ['src/test-setup.ts', '**/*.spec.ts']
|
||||
: ['src/test.ts', '**/*.spec.ts'],
|
||||
include: [options.enableIvy ? 'src/**/*.d.ts' : '**/*.ts']
|
||||
include: options.enableIvy ? undefined : ['src/**/*.d.ts']
|
||||
};
|
||||
}),
|
||||
host => {
|
||||
|
||||
@ -2,6 +2,5 @@
|
||||
"extends": "<%= offsetFromRoot %>tsconfig.json",
|
||||
"compilerOptions": {
|
||||
"types": []
|
||||
},
|
||||
"include": ["**/*.ts"]
|
||||
}
|
||||
}
|
||||
|
||||
@ -68,9 +68,9 @@
|
||||
"type": "string"
|
||||
},
|
||||
"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",
|
||||
"default": false
|
||||
"default": true
|
||||
},
|
||||
"prefix": {
|
||||
"type": "string",
|
||||
|
||||
@ -32,6 +32,22 @@ describe('init', () => {
|
||||
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('karma', () => {
|
||||
it('should add karma dependencies', async () => {
|
||||
|
||||
@ -10,17 +10,19 @@ import {
|
||||
readJsonInTree,
|
||||
addDepsToPackageJson,
|
||||
updateWorkspace,
|
||||
formatFiles
|
||||
formatFiles,
|
||||
updateJsonInTree
|
||||
} from '@nrwl/workspace';
|
||||
import {
|
||||
angularVersion,
|
||||
angularDevkitVersion,
|
||||
rxjsVersion
|
||||
rxjsVersion,
|
||||
jestPresetAngularVersion
|
||||
} from '../../utils/versions';
|
||||
import { Schema } from './schema';
|
||||
import { UnitTestRunner, E2eTestRunner } from '../../utils/test-runners';
|
||||
import { jestPresetAngularVersion } from '../../utils/versions';
|
||||
import { JsonObject } from '@angular-devkit/core';
|
||||
import { stripIndents } from '@angular-devkit/core/src/utils/literals';
|
||||
|
||||
function updateDependencies(): Rule {
|
||||
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 {
|
||||
return chain([
|
||||
setDefaults(options),
|
||||
// TODO: Remove this when ngcc can be run in parallel
|
||||
addPostinstall(),
|
||||
updateDependencies(),
|
||||
addUnitTestRunner(options),
|
||||
addE2eTestRunner(options),
|
||||
|
||||
@ -15,6 +15,11 @@ const testRunner = new SchematicTestRunner(
|
||||
join(__dirname, '../../collection.json')
|
||||
);
|
||||
|
||||
const migrationTestRunner = new SchematicTestRunner(
|
||||
'@nrwl/workspace',
|
||||
join(__dirname, '../../migrations.json')
|
||||
);
|
||||
|
||||
export function runSchematic<SchemaOptions = any>(
|
||||
schematicName: string,
|
||||
options: SchemaOptions,
|
||||
@ -23,6 +28,16 @@ export function runSchematic<SchemaOptions = any>(
|
||||
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>(
|
||||
collectionName: string,
|
||||
schematicName: string,
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
export const nxVersion = '*';
|
||||
export const angularVersion = '^8.2.0';
|
||||
export const angularDevkitVersion = '^0.803.23';
|
||||
export const angularVersion = '9.0.0-rc.12';
|
||||
export const angularDevkitVersion = '0.900.0-rc.12';
|
||||
export const angularJsVersion = '1.6.6';
|
||||
export const ngrxVersion = '8.5.0';
|
||||
export const rxjsVersion = '~6.4.0';
|
||||
export const rxjsVersion = '~6.5.0';
|
||||
export const jestPresetAngularVersion = '7.0.0';
|
||||
|
||||
@ -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');
|
||||
@ -1,4 +0,0 @@
|
||||
filegroup(
|
||||
name = "patches",
|
||||
srcs = glob(["*.patch"]),
|
||||
)
|
||||
@ -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', () => {
|
||||
it('should be added', async () => {
|
||||
const result = await runSchematic('init', {}, tree);
|
||||
@ -38,7 +27,6 @@ describe('@nrwl/bazel:sync', () => {
|
||||
const packageJson = readJsonInTree(result, 'package.json');
|
||||
expect(packageJson.devDependencies['@bazel/bazel']).toBeDefined();
|
||||
expect(packageJson.devDependencies['@bazel/ibazel']).toBeDefined();
|
||||
expect(packageJson.devDependencies['patch-package']).toBeDefined();
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
@ -6,13 +6,9 @@ import {
|
||||
template,
|
||||
url
|
||||
} from '@angular-devkit/schematics';
|
||||
import {
|
||||
addDepsToPackageJson,
|
||||
readJsonInTree,
|
||||
updateJsonInTree
|
||||
} from '@nrwl/workspace';
|
||||
import { addDepsToPackageJson, readJsonInTree } from '@nrwl/workspace';
|
||||
import ignore from 'ignore';
|
||||
import { bazelVersion, iBazelVersion, patchVersion } from '../utils/versions';
|
||||
import { bazelVersion, iBazelVersion } from '../utils/versions';
|
||||
import { noop } from 'rxjs';
|
||||
|
||||
function updateGitIgnore(): Rule {
|
||||
@ -37,50 +33,22 @@ function updateGitIgnore(): Rule {
|
||||
const addRequiredPackages = addDepsToPackageJson(
|
||||
{},
|
||||
{
|
||||
'patch-package': patchVersion,
|
||||
'@bazel/bazel': bazelVersion,
|
||||
'@bazel/ibazel': iBazelVersion
|
||||
},
|
||||
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() {
|
||||
return host => {
|
||||
if (host.exists('patches/BUILD.bazel')) {
|
||||
if (host.exists('/.bazelrc')) {
|
||||
return noop;
|
||||
}
|
||||
return mergeWith(
|
||||
apply(url('./files/root'), [
|
||||
template({
|
||||
tmpl: ''
|
||||
}),
|
||||
() => {
|
||||
if (host.exists('BUILD.bazel')) {
|
||||
host.delete('BUILD.bazel');
|
||||
}
|
||||
}
|
||||
})
|
||||
])
|
||||
);
|
||||
};
|
||||
@ -92,7 +60,6 @@ export default (): Rule => {
|
||||
return chain([
|
||||
updateGitIgnore(),
|
||||
!packageJson.devDependencies['@bazel/bazel'] ? addRequiredPackages : noop,
|
||||
addPostInstall,
|
||||
addFiles()
|
||||
]);
|
||||
};
|
||||
|
||||
@ -26,7 +26,6 @@ load("@build_bazel_rules_nodejs//:index.bzl", "yarn_install")
|
||||
yarn_install(
|
||||
# Name this npm so that Bazel Label references look like @npm//package
|
||||
name = "npm",
|
||||
data = ["//patches"],
|
||||
package_json = "//:package.json",
|
||||
yarn_lock = "//:yarn.lock",
|
||||
)
|
||||
|
||||
@ -57,7 +57,6 @@ describe('@nrwl/bazel:sync', () => {
|
||||
yarn_install(
|
||||
# Name this npm so that Bazel Label references look like @npm//package
|
||||
name = "npm",
|
||||
data = ["//patches"],
|
||||
package_json = "//:package.json",
|
||||
yarn_lock = "//:yarn.lock",
|
||||
)
|
||||
|
||||
@ -1,6 +1,5 @@
|
||||
export const bazelVersion = '^1.2.0';
|
||||
export const iBazelVersion = '0.10.3';
|
||||
export const patchVersion = '^6.2.0';
|
||||
export const rulesNodeJSVersion = '0.42.3';
|
||||
export const rulesNodeJSSha =
|
||||
'a54b2511d6dae42c1f7cdaeb08144ee2808193a088004fc3b464a04583d5aa2e';
|
||||
|
||||
@ -36,8 +36,8 @@
|
||||
"cypress": "^3.8.2"
|
||||
},
|
||||
"dependencies": {
|
||||
"@angular-devkit/architect": "0.803.23",
|
||||
"@angular-devkit/core": "8.3.23",
|
||||
"@angular-devkit/architect": "0.900.0-rc.12",
|
||||
"@angular-devkit/core": "9.0.0-rc.12",
|
||||
"@cypress/webpack-preprocessor": "~4.1.0",
|
||||
"tree-kill": "1.2.2",
|
||||
"ts-loader": "^5.3.1",
|
||||
|
||||
@ -34,6 +34,6 @@
|
||||
"dependencies": {
|
||||
"@nrwl/node": "*",
|
||||
"@nrwl/jest": "*",
|
||||
"@angular-devkit/schematics": "8.3.23"
|
||||
"@angular-devkit/schematics": "9.0.0-rc.12"
|
||||
}
|
||||
}
|
||||
|
||||
@ -35,8 +35,8 @@
|
||||
"@nrwl/workspace": "*"
|
||||
},
|
||||
"dependencies": {
|
||||
"@angular-devkit/architect": "0.803.23",
|
||||
"@angular-devkit/core": "8.3.23",
|
||||
"@angular-devkit/schematics": "8.3.23"
|
||||
"@angular-devkit/architect": "0.900.0-rc.12",
|
||||
"@angular-devkit/core": "9.0.0-rc.12",
|
||||
"@angular-devkit/schematics": "9.0.0-rc.12"
|
||||
}
|
||||
}
|
||||
|
||||
@ -27,7 +27,7 @@
|
||||
"@nrwl/workspace": "*"
|
||||
},
|
||||
"dependencies": {
|
||||
"@angular-devkit/architect": "0.803.23",
|
||||
"@angular-devkit/architect": "0.900.0-rc.12",
|
||||
"@angular-eslint/builder": "0.0.1-alpha.18"
|
||||
}
|
||||
}
|
||||
|
||||
@ -34,6 +34,6 @@
|
||||
"dependencies": {
|
||||
"@nrwl/node": "*",
|
||||
"@nrwl/jest": "*",
|
||||
"@angular-devkit/schematics": "8.3.23"
|
||||
"@angular-devkit/schematics": "9.0.0-rc.12"
|
||||
}
|
||||
}
|
||||
|
||||
@ -34,7 +34,7 @@
|
||||
},
|
||||
"dependencies": {
|
||||
"@nrwl/react": "*",
|
||||
"@angular-devkit/schematics": "8.3.23",
|
||||
"@angular-devkit/schematics": "9.0.0-rc.12",
|
||||
"@svgr/webpack": "^4.3.3",
|
||||
"url-loader": "^2.2.0"
|
||||
}
|
||||
|
||||
@ -34,10 +34,10 @@
|
||||
"dependencies": {
|
||||
"@nrwl/jest": "*",
|
||||
"@nrwl/linter": "*",
|
||||
"@angular-devkit/architect": "0.803.23",
|
||||
"@angular-devkit/core": "8.3.23",
|
||||
"@angular-devkit/schematics": "8.3.23",
|
||||
"@angular-devkit/build-webpack": "0.803.23",
|
||||
"@angular-devkit/architect": "0.900.0-rc.12",
|
||||
"@angular-devkit/core": "9.0.0-rc.12",
|
||||
"@angular-devkit/schematics": "9.0.0-rc.12",
|
||||
"@angular-devkit/build-webpack": "0.900.0-rc.12",
|
||||
"circular-dependency-plugin": "5.2.0",
|
||||
"copy-webpack-plugin": "5.1.1",
|
||||
"fork-ts-checker-webpack-plugin": "^3.1.1",
|
||||
|
||||
@ -3,7 +3,6 @@ import { JsonObject, workspaces } from '@angular-devkit/core';
|
||||
import { runWebpack, BuildResult } from '@angular-devkit/build-webpack';
|
||||
|
||||
import { Observable, from } from 'rxjs';
|
||||
import { writeFileSync } from 'fs';
|
||||
import { resolve } from 'path';
|
||||
import { map, concatMap } from 'rxjs/operators';
|
||||
import { getNodeWebpackConfig } from '../../utils/node.config';
|
||||
@ -50,7 +49,8 @@ function run(
|
||||
runWebpack(config, context, {
|
||||
logging: stats => {
|
||||
context.logger.info(stats.toString(config.stats));
|
||||
}
|
||||
},
|
||||
webpackFactory: require('webpack')
|
||||
})
|
||||
),
|
||||
map((buildEvent: BuildResult) => {
|
||||
|
||||
@ -34,7 +34,7 @@
|
||||
"@nrwl/cypress": "*",
|
||||
"@nrwl/jest": "*",
|
||||
"@nrwl/web": "*",
|
||||
"@angular-devkit/schematics": "8.3.23",
|
||||
"@angular-devkit/schematics": "9.0.0-rc.12",
|
||||
"@svgr/webpack": "^4.3.3",
|
||||
"confusing-browser-globals": "^1.0.8",
|
||||
"eslint-plugin-import": "^2.19.1",
|
||||
|
||||
@ -39,7 +39,7 @@
|
||||
"graphviz": "0.0.8",
|
||||
"ignore": "5.0.4",
|
||||
"opn": "^5.3.0",
|
||||
"rxjs": "^6.4.0",
|
||||
"rxjs": "6.5.3",
|
||||
"semver": "5.4.1",
|
||||
"strip-json-comments": "2.0.1",
|
||||
"tmp": "0.0.33",
|
||||
|
||||
@ -5,5 +5,28 @@
|
||||
"description": "Update storybook builder and tsconfig",
|
||||
"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
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -29,10 +29,10 @@
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@nrwl/workspace": "*",
|
||||
"@storybook/angular": "^5.2.5",
|
||||
"@storybook/react": "^5.2.5",
|
||||
"@storybook/core": "^5.2.5",
|
||||
"@storybook/addon-knobs": "^5.2.5",
|
||||
"@storybook/angular": "5.3.9",
|
||||
"@storybook/react": "5.3.9",
|
||||
"@storybook/core": "5.3.9",
|
||||
"@storybook/addon-knobs": "5.3.9",
|
||||
"babel-loader": "^8.0.6",
|
||||
"@babel/core": "^7.5.4"
|
||||
},
|
||||
|
||||
@ -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]);
|
||||
}
|
||||
@ -1,3 +1,3 @@
|
||||
export const storybookVersion = '5.2.5';
|
||||
export const storybookVersion = '5.3.9';
|
||||
export const babelCoreVersion = '7.8.3';
|
||||
export const babelLoaderVersion = '8.0.6';
|
||||
|
||||
@ -29,9 +29,9 @@
|
||||
},
|
||||
"homepage": "https://nx.dev",
|
||||
"dependencies": {
|
||||
"@angular-devkit/schematics": "8.3.23",
|
||||
"@angular-devkit/core": "8.3.23",
|
||||
"@angular-devkit/architect": "0.803.23",
|
||||
"@angular-devkit/schematics": "9.0.0-rc.12",
|
||||
"@angular-devkit/core": "9.0.0-rc.12",
|
||||
"@angular-devkit/architect": "0.900.0-rc.12",
|
||||
"inquirer": "^6.3.1",
|
||||
"minimist": "^1.2.0",
|
||||
"strip-json-comments": "2.0.1",
|
||||
|
||||
@ -1,11 +1,10 @@
|
||||
import { logging, normalize, virtualFs } from '@angular-devkit/core';
|
||||
import * as core from '@angular-devkit/core/node';
|
||||
import { NodeJsSyncHost } from '@angular-devkit/core/node';
|
||||
import { BaseWorkflow } from '@angular-devkit/schematics/src/workflow';
|
||||
import { NodeModulesEngineHost } from '@angular-devkit/schematics/tools';
|
||||
import { execSync } from 'child_process';
|
||||
import { readFileSync, writeFileSync } from 'fs';
|
||||
import * as path from 'path';
|
||||
import { dirname, extname, join, resolve } from 'path';
|
||||
import { gt, lte } from 'semver';
|
||||
import * as stripJsonComments from 'strip-json-comments';
|
||||
import { dirSync } from 'tmp';
|
||||
@ -383,7 +382,7 @@ function versions(root: string, from: { [p: string]: string }) {
|
||||
return from[packageName];
|
||||
}
|
||||
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'];
|
||||
} catch (e) {
|
||||
@ -408,7 +407,7 @@ function createFetcher(logger: logging.Logger) {
|
||||
const json = JSON.parse(
|
||||
stripJsonComments(
|
||||
readFileSync(
|
||||
path.join(dir, 'node_modules', packageName, 'package.json')
|
||||
join(dir, 'node_modules', packageName, 'package.json')
|
||||
).toString()
|
||||
)
|
||||
);
|
||||
@ -427,7 +426,7 @@ function createFetcher(logger: logging.Logger) {
|
||||
const json = JSON.parse(
|
||||
stripJsonComments(
|
||||
readFileSync(
|
||||
path.join(dir, 'node_modules', packageName, migrationsFile)
|
||||
join(dir, 'node_modules', packageName, migrationsFile)
|
||||
).toString()
|
||||
)
|
||||
);
|
||||
@ -458,7 +457,7 @@ function createFetcher(logger: logging.Logger) {
|
||||
|
||||
function createMigrationsFile(root: string, migrations: any[]) {
|
||||
writeFileSync(
|
||||
path.join(root, 'migrations.json'),
|
||||
join(root, 'migrations.json'),
|
||||
JSON.stringify({ migrations }, null, 2)
|
||||
);
|
||||
}
|
||||
@ -469,7 +468,7 @@ function updatePackageJson(
|
||||
[p: string]: { version: string; alwaysAddToPackageJson: boolean };
|
||||
}
|
||||
) {
|
||||
const packageJsonPath = path.join(root, 'package.json');
|
||||
const packageJsonPath = join(root, 'package.json');
|
||||
const json = JSON.parse(
|
||||
stripJsonComments(readFileSync(packageJsonPath).toString())
|
||||
);
|
||||
@ -579,20 +578,22 @@ class MigrationEngineHost extends NodeModulesEngineHost {
|
||||
protected _resolveCollectionPath(name: string): string {
|
||||
let collectionPath: string | undefined = undefined;
|
||||
|
||||
if (name.replace(/\\/g, '/').split('/').length > (name[0] == '@' ? 2 : 1)) {
|
||||
try {
|
||||
collectionPath = this._resolvePath(name, process.cwd());
|
||||
} catch {}
|
||||
try {
|
||||
return super._resolveCollectionPath(name);
|
||||
} catch {}
|
||||
|
||||
if (name.startsWith('.') || name.startsWith('/')) {
|
||||
name = resolve(name);
|
||||
}
|
||||
|
||||
if (!collectionPath) {
|
||||
let packageJsonPath = this._resolvePackageJson(name, process.cwd());
|
||||
if (!core.fs.isFile(packageJsonPath)) {
|
||||
packageJsonPath = path.join(packageJsonPath, 'package.json');
|
||||
}
|
||||
let pkgJsonSchematics = require(packageJsonPath)['nx-migrations'];
|
||||
if (extname(name)) {
|
||||
collectionPath = require.resolve(name);
|
||||
} else {
|
||||
const packageJsonPath = require.resolve(join(name, 'package.json'));
|
||||
const packageJson = require(packageJsonPath);
|
||||
let pkgJsonSchematics = packageJson['nx-migrations'];
|
||||
if (!pkgJsonSchematics) {
|
||||
pkgJsonSchematics = require(packageJsonPath)['ng-update'];
|
||||
pkgJsonSchematics = packageJson['ng-update'];
|
||||
if (!pkgJsonSchematics) {
|
||||
throw new Error(`Could find migrations in package: "${name}"`);
|
||||
}
|
||||
@ -600,10 +601,7 @@ class MigrationEngineHost extends NodeModulesEngineHost {
|
||||
if (typeof pkgJsonSchematics != 'string') {
|
||||
pkgJsonSchematics = pkgJsonSchematics.migrations;
|
||||
}
|
||||
collectionPath = this._resolvePath(
|
||||
pkgJsonSchematics,
|
||||
path.dirname(packageJsonPath)
|
||||
);
|
||||
collectionPath = resolve(dirname(packageJsonPath), pkgJsonSchematics);
|
||||
}
|
||||
|
||||
try {
|
||||
@ -635,9 +633,7 @@ async function runMigrations(
|
||||
opts: { runMigrations: string }
|
||||
) {
|
||||
const migrationsFile = JSON.parse(
|
||||
stripJsonComments(
|
||||
readFileSync(path.join(root, opts.runMigrations)).toString()
|
||||
)
|
||||
stripJsonComments(readFileSync(join(root, opts.runMigrations)).toString())
|
||||
);
|
||||
|
||||
const host = new virtualFs.ScopedHost(new NodeJsSyncHost(), normalize(root));
|
||||
|
||||
@ -6,7 +6,8 @@ import {
|
||||
logging,
|
||||
normalize,
|
||||
schema,
|
||||
terminal
|
||||
terminal,
|
||||
workspaces
|
||||
} from '@angular-devkit/core';
|
||||
import { NodeJsSyncHost } from '@angular-devkit/core/node';
|
||||
import { getLogger } from '../shared/logger';
|
||||
@ -18,6 +19,7 @@ import {
|
||||
} from '../shared/params';
|
||||
import { commandName, printHelp } from '../shared/print-help';
|
||||
import minimist = require('minimist');
|
||||
import { WorkspaceDefinition } from '@angular-devkit/core/src/workspace';
|
||||
|
||||
export interface RunOptions {
|
||||
project: string;
|
||||
@ -92,12 +94,12 @@ function printRunHelp(
|
||||
}
|
||||
|
||||
export function validateTargetAndConfiguration(
|
||||
workspace: experimental.workspace.Workspace,
|
||||
workspace: WorkspaceDefinition,
|
||||
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) {
|
||||
throw new Error(
|
||||
`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 () => {
|
||||
const fsHost = new NodeJsSyncHost();
|
||||
const workspace = await new experimental.workspace.Workspace(
|
||||
normalize(root) as any,
|
||||
fsHost
|
||||
)
|
||||
.loadWorkspaceFromHost('workspace.json' as any)
|
||||
.toPromise();
|
||||
const { workspace } = await workspaces.readWorkspace(
|
||||
'workspace.json',
|
||||
workspaces.createWorkspaceHost(fsHost)
|
||||
);
|
||||
|
||||
const opts = parseRunOpts(args, workspace.getDefaultProjectName(), logger);
|
||||
const opts = parseRunOpts(
|
||||
args,
|
||||
workspace.extensions['defaultProject'] as string,
|
||||
logger
|
||||
);
|
||||
validateTargetAndConfiguration(workspace, opts);
|
||||
|
||||
const registry = new json.schema.CoreSchemaRegistry();
|
||||
|
||||
@ -34,20 +34,20 @@
|
||||
"@nrwl/cypress": "*",
|
||||
"@nrwl/jest": "*",
|
||||
"@nrwl/linter": "*",
|
||||
"@angular/service-worker": "8.2.12",
|
||||
"@angular-devkit/architect": "0.803.23",
|
||||
"@angular-devkit/build-ng-packagr": "0.803.23",
|
||||
"@angular-devkit/build-optimizer": "0.803.23",
|
||||
"@angular-devkit/build-webpack": "0.803.23",
|
||||
"@angular-devkit/core": "8.3.23",
|
||||
"@angular-devkit/schematics": "8.3.23",
|
||||
"@angular/service-worker": "9.0.0-rc.12",
|
||||
"@angular-devkit/architect": "0.900.0-rc.12",
|
||||
"@angular-devkit/build-ng-packagr": "0.900.0-rc.12",
|
||||
"@angular-devkit/build-optimizer": "0.900.0-rc.12",
|
||||
"@angular-devkit/build-webpack": "0.900.0-rc.12",
|
||||
"@angular-devkit/core": "9.0.0-rc.12",
|
||||
"@angular-devkit/schematics": "9.0.0-rc.12",
|
||||
"@babel/core": "7.8.3",
|
||||
"@babel/preset-env": "7.8.3",
|
||||
"@babel/preset-typescript": "7.8.3",
|
||||
"@babel/plugin-proposal-class-properties": "7.8.3",
|
||||
"@babel/plugin-proposal-decorators": "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",
|
||||
"autoprefixer": "9.6.1",
|
||||
"babel-loader": "8.0.6",
|
||||
@ -83,7 +83,7 @@
|
||||
"postcss-import": "12.0.1",
|
||||
"postcss-loader": "3.0.0",
|
||||
"raw-loader": "3.1.0",
|
||||
"rxjs": "6.4.0",
|
||||
"rxjs": "6.5.3",
|
||||
"regenerator-runtime": "0.13.3",
|
||||
"rollup": "1.20.3",
|
||||
"rollup-plugin-babel": "4.3.3",
|
||||
|
||||
@ -116,7 +116,8 @@ export function run(options: WebBuildBuilderOptions, context: BuilderContext) {
|
||||
if (IGNORED_WEBPACK_OUTPUT.every(r => !r.test(msg))) {
|
||||
context.logger.info(msg);
|
||||
}
|
||||
}
|
||||
},
|
||||
webpackFactory: require('webpack')
|
||||
});
|
||||
} else {
|
||||
return of();
|
||||
|
||||
@ -101,7 +101,9 @@ function run(
|
||||
return runWebpackDevServer(config, context, {
|
||||
logging: stats => {
|
||||
context.logger.info(stats.toString(config.stats));
|
||||
}
|
||||
},
|
||||
webpackFactory: require('webpack'),
|
||||
webpackDevServerFactory: require('webpack-dev-server')
|
||||
}).pipe(
|
||||
map(output => {
|
||||
output.baseUrl = serverUrl;
|
||||
|
||||
@ -49,6 +49,11 @@
|
||||
"version": "8.12.0-beta.1",
|
||||
"description": "Add enforceBuildableLibDependency flag to the nx 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": {
|
||||
@ -340,6 +345,19 @@
|
||||
"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
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -50,15 +50,15 @@
|
||||
"prettier": "^1.18.2"
|
||||
},
|
||||
"dependencies": {
|
||||
"@angular-devkit/core": "8.3.23",
|
||||
"@angular-devkit/schematics": "8.3.23",
|
||||
"@angular-devkit/core": "9.0.0-rc.12",
|
||||
"@angular-devkit/schematics": "9.0.0-rc.12",
|
||||
"cosmiconfig": "4.0.0",
|
||||
"fs-extra": "6.0.0",
|
||||
"ignore": "5.0.4",
|
||||
"npm-run-all": "4.1.5",
|
||||
"hasha": "5.1.0",
|
||||
"opn": "^5.3.0",
|
||||
"rxjs": "^6.4.0",
|
||||
"rxjs": "6.5.3",
|
||||
"semver": "5.4.1",
|
||||
"strip-json-comments": "2.0.1",
|
||||
"tmp": "0.0.33",
|
||||
|
||||
@ -17,7 +17,7 @@ export interface NxJson<T = '*' | string[]> {
|
||||
tasksRunnerOptions?: {
|
||||
[tasksRunnerName: string]: {
|
||||
runner: string;
|
||||
options?: unknown;
|
||||
options?: object;
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
@ -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]);
|
||||
}
|
||||
@ -9,7 +9,7 @@ import {
|
||||
TestingArchitectHost,
|
||||
TestLogger
|
||||
} 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';
|
||||
|
||||
export function getFileContent(tree: Tree, path: string): string {
|
||||
@ -136,4 +136,13 @@ export class MockBuilderContext implements BuilderContext {
|
||||
reportProgress(current: number, total?: number, status?: string) {}
|
||||
|
||||
addTeardown(teardown: () => Promise<void> | void) {}
|
||||
|
||||
async getProjectMetadata(
|
||||
target: Target | string
|
||||
): Promise<json.JsonObject | null> {
|
||||
return (
|
||||
this.architectHost &&
|
||||
this.architectHost.getProjectMetadata(target as string)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@ -3,6 +3,7 @@ import {
|
||||
SchematicContext,
|
||||
TaskConfiguration,
|
||||
TaskConfigurationGenerator,
|
||||
TaskExecutor,
|
||||
TaskExecutorFactory,
|
||||
TaskId,
|
||||
Tree
|
||||
@ -66,7 +67,7 @@ function createRunUpdateTask(): TaskExecutorFactory<UpdateTaskOptions> {
|
||||
return {
|
||||
name: 'RunUpdate',
|
||||
create: () => {
|
||||
return Promise.resolve(
|
||||
return Promise.resolve<TaskExecutor<UpdateTaskOptions>>(
|
||||
(options: UpdateTaskOptions, context: SchematicContext) => {
|
||||
context.logger.info(`Updating ${options.package} to ${options.to}`);
|
||||
const forkOptions = {
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
export const nxVersion = '*';
|
||||
|
||||
export const angularCliVersion = '8.3.14';
|
||||
export const typescriptVersion = '~3.5.3';
|
||||
export const angularCliVersion = '9.0.0-rc.12';
|
||||
export const typescriptVersion = '~3.7.4';
|
||||
export const prettierVersion = '1.18.2';
|
||||
export const typescriptESLintVersion = '2.3.2';
|
||||
export const eslintVersion = '6.1.0';
|
||||
|
||||
@ -5,7 +5,7 @@ if [ "$1" = "fast" ]; then
|
||||
fi
|
||||
|
||||
if [ "$1" != "fast" ]; then
|
||||
./scripts/build.sh
|
||||
./scripts/package.sh --local
|
||||
fi
|
||||
|
||||
rm -rf node_modules/@nrwl
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user