Skip to content

Commit

Permalink
update to nx 11 (#123)
Browse files Browse the repository at this point in the history
  • Loading branch information
FrozenPandaz authored Dec 11, 2020
1 parent bb6e6d6 commit 2726397
Show file tree
Hide file tree
Showing 6 changed files with 2,039 additions and 1,100 deletions.
34 changes: 22 additions & 12 deletions angular.json
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@
"optimization": true,
"outputHashing": "all",
"sourceMap": false,
"extractCss": true,
"namedChunks": false,
"aot": true,
"extractLicenses": true,
Expand All @@ -72,7 +71,8 @@
}
]
}
}
},
"outputs": ["{options.outputPath}"]
},
"serve": {
"builder": "@angular-devkit/build-angular:dev-server",
Expand Down Expand Up @@ -106,7 +106,8 @@
"options": {
"jestConfig": "apps/products/jest.config.js",
"passWithNoTests": true
}
},
"outputs": ["coverage/apps/products"]
},
"deploy": {
"builder": "@nrwl/workspace:run-commands",
Expand Down Expand Up @@ -207,7 +208,8 @@
}
]
}
}
},
"outputs": ["{options.outputPath}"]
},
"serve": {
"builder": "@nrwl/web:dev-server",
Expand Down Expand Up @@ -235,7 +237,8 @@
"options": {
"jestConfig": "apps/cart/jest.config.js",
"passWithNoTests": true
}
},
"outputs": ["coverage/apps/cart"]
},
"deploy": {
"builder": "@nrwl/workspace:run-commands",
Expand Down Expand Up @@ -327,7 +330,8 @@
"options": {
"jestConfig": "libs/shared/product/ui/jest.config.js",
"passWithNoTests": true
}
},
"outputs": ["coverage/libs/shared/product/ui"]
}
}
},
Expand All @@ -352,7 +356,8 @@
"options": {
"jestConfig": "libs/products/home-page/jest.config.js",
"passWithNoTests": true
}
},
"outputs": ["coverage/libs/products/home-page"]
}
},
"schematics": {
Expand Down Expand Up @@ -382,7 +387,8 @@
"options": {
"jestConfig": "libs/cart/cart-page/jest.config.js",
"passWithNoTests": true
}
},
"outputs": ["coverage/libs/cart/cart-page"]
}
}
},
Expand Down Expand Up @@ -437,7 +443,8 @@
"options": {
"jestConfig": "libs/shared/cart/state/jest.config.js",
"passWithNoTests": true
}
},
"outputs": ["coverage/libs/shared/cart/state"]
}
},
"schematics": {
Expand Down Expand Up @@ -467,7 +474,8 @@
"options": {
"jestConfig": "libs/shared/product/state/jest.config.js",
"passWithNoTests": true
}
},
"outputs": ["coverage/libs/shared/product/state"]
}
},
"schematics": {
Expand Down Expand Up @@ -504,7 +512,8 @@
"options": {
"jestConfig": "libs/shared/header/jest.config.js",
"passWithNoTests": true
}
},
"outputs": ["coverage/libs/shared/header"]
}
}
},
Expand Down Expand Up @@ -532,7 +541,8 @@
"options": {
"jestConfig": "libs/products/product-detail-page/jest.config.js",
"passWithNoTests": true
}
},
"outputs": ["coverage/libs/products/product-detail-page"]
}
},
"schematics": {
Expand Down
16 changes: 8 additions & 8 deletions apps/products/src/app/app.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,23 +16,23 @@ import { AppComponent } from './app.component';
pathMatch: 'full',
loadChildren: () =>
import('@nx-example/products/home-page').then(
module => module.ProductsHomePageModule
)
(module) => module.ProductsHomePageModule
),
},
{
path: 'product',
loadChildren: () =>
import('@nx-example/products/product-detail-page').then(
module => module.ProductsProductDetailPageModule
)
}
(module) => module.ProductsProductDetailPageModule
),
},
],
{ initialNavigation: 'enabled' }
{ initialNavigation: 'enabled', relativeLinkResolution: 'legacy' }
),
StoreModule.forRoot({})
StoreModule.forRoot({}),
],
providers: [],
bootstrap: [AppComponent],
schemas: [CUSTOM_ELEMENTS_SCHEMA]
schemas: [CUSTOM_ELEMENTS_SCHEMA],
})
export class AppModule {}
35 changes: 1 addition & 34 deletions decorate-angular-cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,39 +35,6 @@ try {
process.exit(0);
}

/**
* Paths to files being patched
*/
const angularCLIInitPath = 'node_modules/@angular/cli/lib/cli/index.js';

/**
* Patch index.js to warn you if you invoke the undecorated Angular CLI.
*/
function patchAngularCLI(initPath) {
const angularCLIInit = fs.readFileSync(initPath, 'utf-8').toString();

if (!angularCLIInit.includes('NX_CLI_SET')) {
fs.writeFileSync(
initPath,
`
if (!process.env['NX_CLI_SET']) {
const { output } = require('@nrwl/workspace');
output.warn({ title: 'The Angular CLI was invoked instead of the Nx CLI. Use "npx ng [command]" or "nx [command]" instead.' });
}
if (process.argv[2] === 'update') {
const { output } = require('@nrwl/workspace');
output.error({
title: '"ng update" is deprecated in favor of "nx migrate". Read more: https://nx.dev/latest/angular/workspace/update'
});
throw new Error();
}
${angularCLIInit}
`
);
}
}

/**
* Symlink of ng to nx, so you can keep using `ng build/test/lint` and still
* invoke the Nx CLI and get the benefits of computation caching.
Expand Down Expand Up @@ -101,7 +68,7 @@ function symlinkNgCLItoNxCLI() {

try {
symlinkNgCLItoNxCLI();
patchAngularCLI(angularCLIInitPath);
require('@nrwl/cli/lib/decorate-cli').decorateCli();
output.log({
title: 'Angular CLI has been decorated to enable computation caching.',
});
Expand Down
52 changes: 26 additions & 26 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,22 +30,22 @@
},
"private": true,
"dependencies": {
"@angular/animations": "10.1.4",
"@angular/common": "10.1.4",
"@angular/compiler": "10.1.4",
"@angular/core": "10.1.4",
"@angular/forms": "10.1.4",
"@angular/platform-browser": "10.1.4",
"@angular/platform-browser-dynamic": "10.1.4",
"@angular/router": "10.1.4",
"@emotion/babel-preset-css-prop": "10.0.27",
"@emotion/core": "10.0.28",
"@emotion/styled": "10.0.27",
"@angular/animations": "11.0.4",
"@angular/common": "11.0.4",
"@angular/compiler": "11.0.4",
"@angular/core": "11.0.4",
"@angular/forms": "11.0.4",
"@angular/platform-browser": "11.0.4",
"@angular/platform-browser-dynamic": "11.0.4",
"@angular/router": "11.0.4",
"@emotion/babel-preset-css-prop": "11.0.0",
"@emotion/react": "11.0.0",
"@emotion/styled": "11.0.0",
"@ngrx/effects": "10.0.0",
"@ngrx/entity": "10.0.0",
"@ngrx/router-store": "10.0.0",
"@ngrx/store": "10.0.0",
"@nrwl/angular": "10.4.7",
"@nrwl/angular": "11.0.0-rc.0",
"core-js": "^2.5.4",
"document-register-element": "1.13.1",
"normalize.css": "^8.0.1",
Expand All @@ -57,28 +57,28 @@
"zone.js": "~0.10.3"
},
"devDependencies": {
"@angular-devkit/build-angular": "0.1001.4",
"@angular/cli": "10.1.4",
"@angular/compiler-cli": "10.1.4",
"@angular/language-service": "10.1.4",
"@angular-devkit/build-angular": "0.1100.4",
"@angular/cli": "11.0.4",
"@angular/compiler-cli": "11.0.4",
"@angular/language-service": "11.0.4",
"@babel/preset-react": "7.0.0",
"@ngrx/store-devtools": "10.0.0",
"@nrwl/cli": "10.4.7",
"@nrwl/cypress": "10.4.7",
"@nrwl/jest": "10.4.7",
"@nrwl/cli": "11.0.0-rc.0",
"@nrwl/cypress": "11.0.0-rc.0",
"@nrwl/jest": "11.0.0-rc.0",
"@nrwl/nx-cloud": "10.1.9",
"@nrwl/react": "10.4.7",
"@nrwl/tao": "10.4.7",
"@nrwl/web": "10.4.7",
"@nrwl/workspace": "10.4.7",
"@nrwl/react": "11.0.0-rc.0",
"@nrwl/tao": "11.0.0-rc.0",
"@nrwl/web": "11.0.0-rc.0",
"@nrwl/workspace": "11.0.0-rc.0",
"@testing-library/react": "11.1.2",
"@types/jest": "26.0.8",
"@types/node": "^12.11.1",
"@types/node": "12.12.38",
"@types/react": "16.9.56",
"@types/react-dom": "16.9.9",
"@types/react-router-dom": "5.1.6",
"codelyzer": "^6.0.0",
"cypress": "^3.8.2",
"codelyzer": "6.0.1",
"cypress": "^5.0.0",
"dotenv": "6.2.0",
"fuzzy": "^0.1.3",
"inquirer": "^6.2.2",
Expand Down
File renamed without changes.
Loading

0 comments on commit 2726397

Please sign in to comment.