feat(angular): upgrade Angular to v12.0.0-rc.3 (#5630)
* feat(angular): upgrade Angular to v12.0.0-rc.3 * feat(angular): target Nx v12.4.0-beta.0 for Angular v12.0.0-rc.0 upgrade * fix(angular): use defaultConfiguration if no other configuration is passed * cleanup(angular): sync migration folder name to target version * fix(repo): creating custom schema flattener for docs * chore(repo): amend yarn.lock * feat(angular): update angular storybook to use webpack 5 * fix(angular): add legacy peer deps for angular+jest * fix(angular): move migrations to 12.3.0-rc.0 Co-authored-by: Zack DeRose <zack.derose@gmail.com> Co-authored-by: Jason Jean <jasonjean1993@gmail.com>
This commit is contained in:
parent
6db97832e6
commit
678818a58b
@ -14,33 +14,21 @@ A list of CommonJS packages that are allowed to be used without a build time war
|
||||
|
||||
### aot
|
||||
|
||||
Default: `false`
|
||||
Default: `true`
|
||||
|
||||
Type: `boolean`
|
||||
|
||||
Build using Ahead of Time compilation.
|
||||
|
||||
### assets
|
||||
|
||||
Type: `array`
|
||||
|
||||
List of static application assets.
|
||||
|
||||
### baseHref
|
||||
|
||||
Type: `string`
|
||||
|
||||
Base url for the application being built.
|
||||
|
||||
### budgets
|
||||
|
||||
Type: `array`
|
||||
|
||||
Budget thresholds to ensure parts of your application stay within boundaries which you set.
|
||||
|
||||
### buildOptimizer
|
||||
|
||||
Default: `false`
|
||||
Default: `true`
|
||||
|
||||
Type: `boolean`
|
||||
|
||||
@ -58,7 +46,7 @@ Default: `true`
|
||||
|
||||
Type: `boolean`
|
||||
|
||||
Use a separate bundle containing code used across multiple bundles.
|
||||
Generate a seperate bundle containing code used across multiple bundles.
|
||||
|
||||
### crossOrigin
|
||||
|
||||
@ -84,67 +72,23 @@ Type: `string`
|
||||
|
||||
URL where files will be deployed.
|
||||
|
||||
### experimentalRollupPass
|
||||
|
||||
Default: `false`
|
||||
|
||||
Type: `boolean`
|
||||
|
||||
Concatenate modules with Rollup before bundling them with Webpack.
|
||||
|
||||
### extractCss
|
||||
|
||||
Default: `false`
|
||||
|
||||
Type: `boolean`
|
||||
|
||||
Extract css from global styles into css files instead of js ones.
|
||||
|
||||
### extractLicenses
|
||||
|
||||
Default: `false`
|
||||
|
||||
Type: `boolean`
|
||||
|
||||
Extract all licenses in a separate file.
|
||||
|
||||
### fileReplacements
|
||||
|
||||
Type: `array`
|
||||
|
||||
Replace compilation source files with other compilation source files in the build.
|
||||
|
||||
### forkTypeChecker
|
||||
### ~~extractCss~~
|
||||
|
||||
Default: `true`
|
||||
|
||||
Type: `boolean`
|
||||
|
||||
Run the TypeScript type checker in a forked process.
|
||||
**Deprecated:** Deprecated since version 11.0. No longer required to disable CSS extraction for HMR.
|
||||
|
||||
### ~~i18nFile~~
|
||||
Extract CSS from global styles into '.css' files instead of '.js'.
|
||||
|
||||
Type: `string`
|
||||
### extractLicenses
|
||||
|
||||
**Deprecated:** Use 'locales' object in the project metadata instead.
|
||||
Default: `true`
|
||||
|
||||
Localization file to use for i18n.
|
||||
Type: `boolean`
|
||||
|
||||
### ~~i18nFormat~~
|
||||
|
||||
Type: `string`
|
||||
|
||||
**Deprecated:** No longer needed as the format will be determined automatically.
|
||||
|
||||
Format of the localization file specified with --i18n-file.
|
||||
|
||||
### ~~i18nLocale~~
|
||||
|
||||
Type: `string`
|
||||
|
||||
**Deprecated:** Use 'localize' instead.
|
||||
|
||||
Locale to use for i18n.
|
||||
Extract all licenses in a separate file.
|
||||
|
||||
### i18nMissingTranslation
|
||||
|
||||
@ -162,17 +106,21 @@ Type: `string`
|
||||
|
||||
Configures the generation of the application's HTML index.
|
||||
|
||||
### ~~lazyModules~~
|
||||
### inlineStyleLanguage
|
||||
|
||||
Type: `array`
|
||||
Default: `css`
|
||||
|
||||
**Deprecated:** 'SystemJsNgModuleLoader' is deprecated, and this is part of its usage. Use 'import()' syntax instead.
|
||||
Type: `string`
|
||||
|
||||
List of additional NgModule files that will be lazy loaded. Lazy router modules will be discovered automatically.
|
||||
Possible values: `css`, `less`, `sass`, `scss`
|
||||
|
||||
The stylesheet language to use for the application's inline component styles.
|
||||
|
||||
### localize
|
||||
|
||||
Type: `boolean | boolean[] `
|
||||
Type: `boolean`
|
||||
|
||||
Translate the bundles in one or more locales.
|
||||
|
||||
### main
|
||||
|
||||
@ -182,7 +130,7 @@ The full path for the main entry point to the app, relative to the current works
|
||||
|
||||
### namedChunks
|
||||
|
||||
Default: `true`
|
||||
Default: `false`
|
||||
|
||||
Type: `boolean`
|
||||
|
||||
@ -196,11 +144,11 @@ Path to ngsw-config.json.
|
||||
|
||||
### optimization
|
||||
|
||||
Default: `false`
|
||||
Default: `true`
|
||||
|
||||
Type: `boolean`
|
||||
|
||||
Enables optimization of the build output.
|
||||
Enables optimization of the build output. Including minification of scripts and styles, tree-shaking, dead-code elimination, inlining of critical CSS and fonts inlining. For more information, see https://angular.io/guide/workspace-config#optimization-configuration.
|
||||
|
||||
### outputHashing
|
||||
|
||||
@ -240,6 +188,8 @@ Do not use the real path when resolving modules. If unset then will default to `
|
||||
|
||||
### progress
|
||||
|
||||
Default: `true`
|
||||
|
||||
Type: `boolean`
|
||||
|
||||
Log progress to the console while building.
|
||||
@ -250,12 +200,6 @@ Type: `string`
|
||||
|
||||
The path where style resources will be placed, relative to outputPath.
|
||||
|
||||
### scripts
|
||||
|
||||
Type: `array`
|
||||
|
||||
Global scripts to be included in the build.
|
||||
|
||||
### serviceWorker
|
||||
|
||||
Default: `false`
|
||||
@ -270,17 +214,17 @@ Default: `false`
|
||||
|
||||
Type: `boolean`
|
||||
|
||||
**Deprecated:** The recommended method to detect circular dependencies in project code is to use a either a lint rule or other external tooling.
|
||||
**Deprecated:** The recommended method to detect circular dependencies in project code is to use either a lint rule or other external tooling.
|
||||
|
||||
Show circular dependency warnings on builds.
|
||||
|
||||
### sourceMap
|
||||
|
||||
Default: `true`
|
||||
Default: `false`
|
||||
|
||||
Type: `boolean`
|
||||
|
||||
Output sourcemaps.
|
||||
Output source maps for scripts and styles. For more information, see https://angular.io/guide/workspace-config#source-map-configuration.
|
||||
|
||||
### statsJson
|
||||
|
||||
@ -290,12 +234,6 @@ Type: `boolean`
|
||||
|
||||
Generates a 'stats.json' file which can be analyzed using tools such as 'webpack-bundle-analyzer'.
|
||||
|
||||
### styles
|
||||
|
||||
Type: `array`
|
||||
|
||||
Global styles to be included in the build.
|
||||
|
||||
### subresourceIntegrity
|
||||
|
||||
Default: `false`
|
||||
@ -320,11 +258,11 @@ The full path for the TypeScript configuration file, relative to the current wor
|
||||
|
||||
### vendorChunk
|
||||
|
||||
Default: `true`
|
||||
Default: `false`
|
||||
|
||||
Type: `boolean`
|
||||
|
||||
Use a separate bundle containing only vendor libraries.
|
||||
Generate a seperate bundle containing only vendor libraries. This option should only used for development.
|
||||
|
||||
### verbose
|
||||
|
||||
|
||||
@ -50,14 +50,6 @@ Possible values: `protractor`, `cypress`, `none`
|
||||
|
||||
Test runner to use for end to end (e2e) tests
|
||||
|
||||
### enableIvy
|
||||
|
||||
Default: `true`
|
||||
|
||||
Type: `boolean`
|
||||
|
||||
Create a new app that uses the Ivy rendering engine.
|
||||
|
||||
### inlineStyle
|
||||
|
||||
Alias(es): s
|
||||
@ -84,7 +76,7 @@ Default: `eslint`
|
||||
|
||||
Type: `string`
|
||||
|
||||
Possible values: `tslint`, `eslint`
|
||||
Possible values: `eslint`, `none`
|
||||
|
||||
The tool to use for running lint checks.
|
||||
|
||||
|
||||
@ -78,7 +78,7 @@ Default: `eslint`
|
||||
|
||||
Type: `string`
|
||||
|
||||
Possible values: `tslint`, `eslint`
|
||||
Possible values: `eslint`, `none`
|
||||
|
||||
The tool to use for running lint checks.
|
||||
|
||||
@ -158,16 +158,6 @@ Type: `boolean`
|
||||
|
||||
Creates a library with stricter type checking and build optimization options.
|
||||
|
||||
### style
|
||||
|
||||
Default: `css`
|
||||
|
||||
Type: `string`
|
||||
|
||||
Possible values: `css`, `scss`, `styl`, `less`
|
||||
|
||||
The file extension to be used for style files.
|
||||
|
||||
### tags
|
||||
|
||||
Type: `string`
|
||||
|
||||
@ -60,7 +60,7 @@ Default: `eslint`
|
||||
|
||||
Type: `string`
|
||||
|
||||
Possible values: `eslint`, `tslint`
|
||||
Possible values: `eslint`, `none`
|
||||
|
||||
The tool to use for running lint checks.
|
||||
|
||||
|
||||
@ -104,6 +104,6 @@ Hide output text.
|
||||
|
||||
### tsConfig
|
||||
|
||||
Type: `string | string[] `
|
||||
Type: `string`
|
||||
|
||||
The name of the TypeScript configuration file.
|
||||
|
||||
@ -6,24 +6,6 @@ Properties can be configured in angular.json when defining the executor, or when
|
||||
|
||||
## Properties
|
||||
|
||||
### fileReplacements
|
||||
|
||||
Type: `object[]`
|
||||
|
||||
Replace files with other files in the build.
|
||||
|
||||
#### replace
|
||||
|
||||
Type: `string`
|
||||
|
||||
undefined
|
||||
|
||||
#### with
|
||||
|
||||
Type: `string`
|
||||
|
||||
undefined
|
||||
|
||||
### nextConfig
|
||||
|
||||
Type: `string`
|
||||
|
||||
@ -6,12 +6,6 @@ Properties can be configured in angular.json when defining the executor, or when
|
||||
|
||||
## Properties
|
||||
|
||||
### assets
|
||||
|
||||
Type: `array`
|
||||
|
||||
List of static application assets.
|
||||
|
||||
### buildLibsFromSource
|
||||
|
||||
Default: `true`
|
||||
@ -24,7 +18,7 @@ Read buildable libraries from source instead of building them separately.
|
||||
|
||||
Default: `all`
|
||||
|
||||
Type: `string | string[] `
|
||||
Type: `string`
|
||||
|
||||
Dependencies to keep external to the bundle. ("all" (default), "none", or an array of module names)
|
||||
|
||||
@ -36,24 +30,6 @@ Type: `boolean`
|
||||
|
||||
Extract all licenses in a separate file, in the case of production builds only.
|
||||
|
||||
### fileReplacements
|
||||
|
||||
Type: `object[]`
|
||||
|
||||
Replace files with other files in the build.
|
||||
|
||||
#### replace
|
||||
|
||||
Type: `string`
|
||||
|
||||
undefined
|
||||
|
||||
#### with
|
||||
|
||||
Type: `string`
|
||||
|
||||
undefined
|
||||
|
||||
### generatePackageJson
|
||||
|
||||
Default: `false`
|
||||
@ -158,6 +134,6 @@ Run build when files change.
|
||||
|
||||
### webpackConfig
|
||||
|
||||
Type: `array[] | string `
|
||||
Type: `string`
|
||||
|
||||
Path to a function which takes a webpack config, context and returns the resulting webpack config
|
||||
|
||||
@ -6,12 +6,6 @@ Properties can be configured in angular.json when defining the executor, or when
|
||||
|
||||
## Properties
|
||||
|
||||
### assets
|
||||
|
||||
Type: `array`
|
||||
|
||||
List of static library assets.
|
||||
|
||||
### buildableProjectDepsInPackageJsonType
|
||||
|
||||
Default: `dependencies`
|
||||
|
||||
@ -50,7 +50,7 @@ Default: `eslint`
|
||||
|
||||
Type: `string`
|
||||
|
||||
Possible values: `eslint`, `tslint`
|
||||
Possible values: `eslint`, `tslint`, `none`
|
||||
|
||||
The tool to use for running lint checks.
|
||||
|
||||
|
||||
@ -44,7 +44,7 @@ Default: `eslint`
|
||||
|
||||
Type: `string`
|
||||
|
||||
Possible values: `eslint`, `tslint`
|
||||
Possible values: `eslint`, `tslint`, `none`
|
||||
|
||||
The tool to use for running lint checks.
|
||||
|
||||
|
||||
@ -6,12 +6,6 @@ Properties can be configured in angular.json when defining the executor, or when
|
||||
|
||||
## Properties
|
||||
|
||||
### assets
|
||||
|
||||
Type: `array`
|
||||
|
||||
List of static application assets.
|
||||
|
||||
### baseHref
|
||||
|
||||
Default: `/`
|
||||
@ -20,12 +14,6 @@ Type: `string`
|
||||
|
||||
Base url for the application being built.
|
||||
|
||||
### budgets
|
||||
|
||||
Type: `array`
|
||||
|
||||
Budget thresholds to ensure parts of your application stay within boundaries which you set.
|
||||
|
||||
### buildLibsFromSource
|
||||
|
||||
Default: `true`
|
||||
@ -84,24 +72,6 @@ Type: `boolean`
|
||||
|
||||
Extract all licenses in a separate file, in the case of production builds only.
|
||||
|
||||
### fileReplacements
|
||||
|
||||
Type: `object[]`
|
||||
|
||||
Replace files with other files in the build.
|
||||
|
||||
#### replace
|
||||
|
||||
Type: `string`
|
||||
|
||||
undefined
|
||||
|
||||
#### with
|
||||
|
||||
Type: `string`
|
||||
|
||||
undefined
|
||||
|
||||
### index
|
||||
|
||||
Type: `string`
|
||||
@ -178,12 +148,6 @@ Type: `boolean`
|
||||
|
||||
Use a separate bundle containing the runtime.
|
||||
|
||||
### scripts
|
||||
|
||||
Type: `array`
|
||||
|
||||
External Scripts which will be included before the main application entry
|
||||
|
||||
### ~~showCircularDependencies~~
|
||||
|
||||
Default: `false`
|
||||
@ -210,12 +174,6 @@ Type: `boolean`
|
||||
|
||||
Generates a 'stats.json' file which can be analyzed using tools such as: 'webpack-bundle-analyzer' or <https://webpack.github.io/analyse>.
|
||||
|
||||
### styles
|
||||
|
||||
Type: `array`
|
||||
|
||||
External Styles which will be included with the application
|
||||
|
||||
### subresourceIntegrity
|
||||
|
||||
Default: `false`
|
||||
|
||||
@ -6,12 +6,6 @@ Properties can be configured in angular.json when defining the executor, or when
|
||||
|
||||
## Properties
|
||||
|
||||
### assets
|
||||
|
||||
Type: `array`
|
||||
|
||||
List of static assets.
|
||||
|
||||
### ~~babelConfig~~
|
||||
|
||||
Type: `string`
|
||||
@ -58,24 +52,6 @@ Type: `boolean`
|
||||
|
||||
CSS files will be extracted to the output folder.
|
||||
|
||||
### globals
|
||||
|
||||
Type: `object[]`
|
||||
|
||||
A mapping of node modules to their UMD global names. Used by the UMD bundle
|
||||
|
||||
#### moduleId
|
||||
|
||||
Type: `string`
|
||||
|
||||
The node module to map from (e.g. `react-dom`).
|
||||
|
||||
#### global
|
||||
|
||||
Type: `string`
|
||||
|
||||
The global name to map to (e.g. `ReactDOM`).
|
||||
|
||||
### outputPath
|
||||
|
||||
Type: `string`
|
||||
@ -90,7 +66,7 @@ The path to package.json file.
|
||||
|
||||
### rollupConfig
|
||||
|
||||
Type: `array[] | string `
|
||||
Type: `string`
|
||||
|
||||
Path to a function which takes a rollup config and returns an updated rollup config
|
||||
|
||||
|
||||
@ -182,10 +182,6 @@ Type: `string`
|
||||
|
||||
Command to run in child process
|
||||
|
||||
### commands
|
||||
|
||||
Type: `array`
|
||||
|
||||
### cwd
|
||||
|
||||
Type: `string`
|
||||
@ -200,7 +196,7 @@ You may specify a custom .env file path
|
||||
|
||||
### outputPath
|
||||
|
||||
Type: `string | string[] `
|
||||
Type: `string`
|
||||
|
||||
Allows you to specify where the build artifacts are stored. This allows Nx Cloud to pick them up correctly, in the case that the build artifacts are placed somewhere other than the top level dist folder.
|
||||
|
||||
|
||||
@ -6,12 +6,6 @@ Properties can be configured in angular.json when defining the executor, or when
|
||||
|
||||
## Properties
|
||||
|
||||
### assets
|
||||
|
||||
Type: `array`
|
||||
|
||||
List of static assets.
|
||||
|
||||
### main
|
||||
|
||||
Type: `string`
|
||||
|
||||
@ -15,33 +15,21 @@ A list of CommonJS packages that are allowed to be used without a build time war
|
||||
|
||||
### aot
|
||||
|
||||
Default: `false`
|
||||
Default: `true`
|
||||
|
||||
Type: `boolean`
|
||||
|
||||
Build using Ahead of Time compilation.
|
||||
|
||||
### assets
|
||||
|
||||
Type: `array`
|
||||
|
||||
List of static application assets.
|
||||
|
||||
### baseHref
|
||||
|
||||
Type: `string`
|
||||
|
||||
Base url for the application being built.
|
||||
|
||||
### budgets
|
||||
|
||||
Type: `array`
|
||||
|
||||
Budget thresholds to ensure parts of your application stay within boundaries which you set.
|
||||
|
||||
### buildOptimizer
|
||||
|
||||
Default: `false`
|
||||
Default: `true`
|
||||
|
||||
Type: `boolean`
|
||||
|
||||
@ -59,7 +47,7 @@ Default: `true`
|
||||
|
||||
Type: `boolean`
|
||||
|
||||
Use a separate bundle containing code used across multiple bundles.
|
||||
Generate a seperate bundle containing code used across multiple bundles.
|
||||
|
||||
### crossOrigin
|
||||
|
||||
@ -85,67 +73,23 @@ Type: `string`
|
||||
|
||||
URL where files will be deployed.
|
||||
|
||||
### experimentalRollupPass
|
||||
|
||||
Default: `false`
|
||||
|
||||
Type: `boolean`
|
||||
|
||||
Concatenate modules with Rollup before bundling them with Webpack.
|
||||
|
||||
### extractCss
|
||||
|
||||
Default: `false`
|
||||
|
||||
Type: `boolean`
|
||||
|
||||
Extract css from global styles into css files instead of js ones.
|
||||
|
||||
### extractLicenses
|
||||
|
||||
Default: `false`
|
||||
|
||||
Type: `boolean`
|
||||
|
||||
Extract all licenses in a separate file.
|
||||
|
||||
### fileReplacements
|
||||
|
||||
Type: `array`
|
||||
|
||||
Replace compilation source files with other compilation source files in the build.
|
||||
|
||||
### forkTypeChecker
|
||||
### ~~extractCss~~
|
||||
|
||||
Default: `true`
|
||||
|
||||
Type: `boolean`
|
||||
|
||||
Run the TypeScript type checker in a forked process.
|
||||
**Deprecated:** Deprecated since version 11.0. No longer required to disable CSS extraction for HMR.
|
||||
|
||||
### ~~i18nFile~~
|
||||
Extract CSS from global styles into '.css' files instead of '.js'.
|
||||
|
||||
Type: `string`
|
||||
### extractLicenses
|
||||
|
||||
**Deprecated:** Use 'locales' object in the project metadata instead.
|
||||
Default: `true`
|
||||
|
||||
Localization file to use for i18n.
|
||||
Type: `boolean`
|
||||
|
||||
### ~~i18nFormat~~
|
||||
|
||||
Type: `string`
|
||||
|
||||
**Deprecated:** No longer needed as the format will be determined automatically.
|
||||
|
||||
Format of the localization file specified with --i18n-file.
|
||||
|
||||
### ~~i18nLocale~~
|
||||
|
||||
Type: `string`
|
||||
|
||||
**Deprecated:** Use 'localize' instead.
|
||||
|
||||
Locale to use for i18n.
|
||||
Extract all licenses in a separate file.
|
||||
|
||||
### i18nMissingTranslation
|
||||
|
||||
@ -163,17 +107,21 @@ Type: `string`
|
||||
|
||||
Configures the generation of the application's HTML index.
|
||||
|
||||
### ~~lazyModules~~
|
||||
### inlineStyleLanguage
|
||||
|
||||
Type: `array`
|
||||
Default: `css`
|
||||
|
||||
**Deprecated:** 'SystemJsNgModuleLoader' is deprecated, and this is part of its usage. Use 'import()' syntax instead.
|
||||
Type: `string`
|
||||
|
||||
List of additional NgModule files that will be lazy loaded. Lazy router modules will be discovered automatically.
|
||||
Possible values: `css`, `less`, `sass`, `scss`
|
||||
|
||||
The stylesheet language to use for the application's inline component styles.
|
||||
|
||||
### localize
|
||||
|
||||
Type: `boolean | boolean[] `
|
||||
Type: `boolean`
|
||||
|
||||
Translate the bundles in one or more locales.
|
||||
|
||||
### main
|
||||
|
||||
@ -183,7 +131,7 @@ The full path for the main entry point to the app, relative to the current works
|
||||
|
||||
### namedChunks
|
||||
|
||||
Default: `true`
|
||||
Default: `false`
|
||||
|
||||
Type: `boolean`
|
||||
|
||||
@ -197,11 +145,11 @@ Path to ngsw-config.json.
|
||||
|
||||
### optimization
|
||||
|
||||
Default: `false`
|
||||
Default: `true`
|
||||
|
||||
Type: `boolean`
|
||||
|
||||
Enables optimization of the build output.
|
||||
Enables optimization of the build output. Including minification of scripts and styles, tree-shaking, dead-code elimination, inlining of critical CSS and fonts inlining. For more information, see https://angular.io/guide/workspace-config#optimization-configuration.
|
||||
|
||||
### outputHashing
|
||||
|
||||
@ -241,6 +189,8 @@ Do not use the real path when resolving modules. If unset then will default to `
|
||||
|
||||
### progress
|
||||
|
||||
Default: `true`
|
||||
|
||||
Type: `boolean`
|
||||
|
||||
Log progress to the console while building.
|
||||
@ -251,12 +201,6 @@ Type: `string`
|
||||
|
||||
The path where style resources will be placed, relative to outputPath.
|
||||
|
||||
### scripts
|
||||
|
||||
Type: `array`
|
||||
|
||||
Global scripts to be included in the build.
|
||||
|
||||
### serviceWorker
|
||||
|
||||
Default: `false`
|
||||
@ -271,17 +215,17 @@ Default: `false`
|
||||
|
||||
Type: `boolean`
|
||||
|
||||
**Deprecated:** The recommended method to detect circular dependencies in project code is to use a either a lint rule or other external tooling.
|
||||
**Deprecated:** The recommended method to detect circular dependencies in project code is to use either a lint rule or other external tooling.
|
||||
|
||||
Show circular dependency warnings on builds.
|
||||
|
||||
### sourceMap
|
||||
|
||||
Default: `true`
|
||||
Default: `false`
|
||||
|
||||
Type: `boolean`
|
||||
|
||||
Output sourcemaps.
|
||||
Output source maps for scripts and styles. For more information, see https://angular.io/guide/workspace-config#source-map-configuration.
|
||||
|
||||
### statsJson
|
||||
|
||||
@ -291,12 +235,6 @@ Type: `boolean`
|
||||
|
||||
Generates a 'stats.json' file which can be analyzed using tools such as 'webpack-bundle-analyzer'.
|
||||
|
||||
### styles
|
||||
|
||||
Type: `array`
|
||||
|
||||
Global styles to be included in the build.
|
||||
|
||||
### subresourceIntegrity
|
||||
|
||||
Default: `false`
|
||||
@ -321,11 +259,11 @@ The full path for the TypeScript configuration file, relative to the current wor
|
||||
|
||||
### vendorChunk
|
||||
|
||||
Default: `true`
|
||||
Default: `false`
|
||||
|
||||
Type: `boolean`
|
||||
|
||||
Use a separate bundle containing only vendor libraries.
|
||||
Generate a seperate bundle containing only vendor libraries. This option should only used for development.
|
||||
|
||||
### verbose
|
||||
|
||||
|
||||
@ -50,14 +50,6 @@ Possible values: `protractor`, `cypress`, `none`
|
||||
|
||||
Test runner to use for end to end (e2e) tests
|
||||
|
||||
### enableIvy
|
||||
|
||||
Default: `true`
|
||||
|
||||
Type: `boolean`
|
||||
|
||||
Create a new app that uses the Ivy rendering engine.
|
||||
|
||||
### inlineStyle
|
||||
|
||||
Alias(es): s
|
||||
@ -84,7 +76,7 @@ Default: `eslint`
|
||||
|
||||
Type: `string`
|
||||
|
||||
Possible values: `tslint`, `eslint`
|
||||
Possible values: `eslint`, `none`
|
||||
|
||||
The tool to use for running lint checks.
|
||||
|
||||
|
||||
@ -78,7 +78,7 @@ Default: `eslint`
|
||||
|
||||
Type: `string`
|
||||
|
||||
Possible values: `tslint`, `eslint`
|
||||
Possible values: `eslint`, `none`
|
||||
|
||||
The tool to use for running lint checks.
|
||||
|
||||
@ -158,16 +158,6 @@ Type: `boolean`
|
||||
|
||||
Creates a library with stricter type checking and build optimization options.
|
||||
|
||||
### style
|
||||
|
||||
Default: `css`
|
||||
|
||||
Type: `string`
|
||||
|
||||
Possible values: `css`, `scss`, `styl`, `less`
|
||||
|
||||
The file extension to be used for style files.
|
||||
|
||||
### tags
|
||||
|
||||
Type: `string`
|
||||
|
||||
@ -60,7 +60,7 @@ Default: `eslint`
|
||||
|
||||
Type: `string`
|
||||
|
||||
Possible values: `eslint`, `tslint`
|
||||
Possible values: `eslint`, `none`
|
||||
|
||||
The tool to use for running lint checks.
|
||||
|
||||
|
||||
@ -105,6 +105,6 @@ Hide output text.
|
||||
|
||||
### tsConfig
|
||||
|
||||
Type: `string | string[] `
|
||||
Type: `string`
|
||||
|
||||
The name of the TypeScript configuration file.
|
||||
|
||||
@ -7,24 +7,6 @@ Read more about how to use executors and the CLI here: https://nx.dev/node/getti
|
||||
|
||||
## Properties
|
||||
|
||||
### fileReplacements
|
||||
|
||||
Type: `object[]`
|
||||
|
||||
Replace files with other files in the build.
|
||||
|
||||
#### replace
|
||||
|
||||
Type: `string`
|
||||
|
||||
undefined
|
||||
|
||||
#### with
|
||||
|
||||
Type: `string`
|
||||
|
||||
undefined
|
||||
|
||||
### nextConfig
|
||||
|
||||
Type: `string`
|
||||
|
||||
@ -7,12 +7,6 @@ Read more about how to use executors and the CLI here: https://nx.dev/node/getti
|
||||
|
||||
## Properties
|
||||
|
||||
### assets
|
||||
|
||||
Type: `array`
|
||||
|
||||
List of static application assets.
|
||||
|
||||
### buildLibsFromSource
|
||||
|
||||
Default: `true`
|
||||
@ -25,7 +19,7 @@ Read buildable libraries from source instead of building them separately.
|
||||
|
||||
Default: `all`
|
||||
|
||||
Type: `string | string[] `
|
||||
Type: `string`
|
||||
|
||||
Dependencies to keep external to the bundle. ("all" (default), "none", or an array of module names)
|
||||
|
||||
@ -37,24 +31,6 @@ Type: `boolean`
|
||||
|
||||
Extract all licenses in a separate file, in the case of production builds only.
|
||||
|
||||
### fileReplacements
|
||||
|
||||
Type: `object[]`
|
||||
|
||||
Replace files with other files in the build.
|
||||
|
||||
#### replace
|
||||
|
||||
Type: `string`
|
||||
|
||||
undefined
|
||||
|
||||
#### with
|
||||
|
||||
Type: `string`
|
||||
|
||||
undefined
|
||||
|
||||
### generatePackageJson
|
||||
|
||||
Default: `false`
|
||||
@ -159,6 +135,6 @@ Run build when files change.
|
||||
|
||||
### webpackConfig
|
||||
|
||||
Type: `array[] | string `
|
||||
Type: `string`
|
||||
|
||||
Path to a function which takes a webpack config, context and returns the resulting webpack config
|
||||
|
||||
@ -7,12 +7,6 @@ Read more about how to use executors and the CLI here: https://nx.dev/node/getti
|
||||
|
||||
## Properties
|
||||
|
||||
### assets
|
||||
|
||||
Type: `array`
|
||||
|
||||
List of static library assets.
|
||||
|
||||
### buildableProjectDepsInPackageJsonType
|
||||
|
||||
Default: `dependencies`
|
||||
|
||||
@ -50,7 +50,7 @@ Default: `eslint`
|
||||
|
||||
Type: `string`
|
||||
|
||||
Possible values: `eslint`, `tslint`
|
||||
Possible values: `eslint`, `tslint`, `none`
|
||||
|
||||
The tool to use for running lint checks.
|
||||
|
||||
|
||||
@ -44,7 +44,7 @@ Default: `eslint`
|
||||
|
||||
Type: `string`
|
||||
|
||||
Possible values: `eslint`, `tslint`
|
||||
Possible values: `eslint`, `tslint`, `none`
|
||||
|
||||
The tool to use for running lint checks.
|
||||
|
||||
|
||||
@ -7,12 +7,6 @@ Read more about how to use executors and the CLI here: https://nx.dev/node/getti
|
||||
|
||||
## Properties
|
||||
|
||||
### assets
|
||||
|
||||
Type: `array`
|
||||
|
||||
List of static application assets.
|
||||
|
||||
### baseHref
|
||||
|
||||
Default: `/`
|
||||
@ -21,12 +15,6 @@ Type: `string`
|
||||
|
||||
Base url for the application being built.
|
||||
|
||||
### budgets
|
||||
|
||||
Type: `array`
|
||||
|
||||
Budget thresholds to ensure parts of your application stay within boundaries which you set.
|
||||
|
||||
### buildLibsFromSource
|
||||
|
||||
Default: `true`
|
||||
@ -85,24 +73,6 @@ Type: `boolean`
|
||||
|
||||
Extract all licenses in a separate file, in the case of production builds only.
|
||||
|
||||
### fileReplacements
|
||||
|
||||
Type: `object[]`
|
||||
|
||||
Replace files with other files in the build.
|
||||
|
||||
#### replace
|
||||
|
||||
Type: `string`
|
||||
|
||||
undefined
|
||||
|
||||
#### with
|
||||
|
||||
Type: `string`
|
||||
|
||||
undefined
|
||||
|
||||
### index
|
||||
|
||||
Type: `string`
|
||||
@ -179,12 +149,6 @@ Type: `boolean`
|
||||
|
||||
Use a separate bundle containing the runtime.
|
||||
|
||||
### scripts
|
||||
|
||||
Type: `array`
|
||||
|
||||
External Scripts which will be included before the main application entry
|
||||
|
||||
### ~~showCircularDependencies~~
|
||||
|
||||
Default: `false`
|
||||
@ -211,12 +175,6 @@ Type: `boolean`
|
||||
|
||||
Generates a 'stats.json' file which can be analyzed using tools such as: 'webpack-bundle-analyzer' or <https://webpack.github.io/analyse>.
|
||||
|
||||
### styles
|
||||
|
||||
Type: `array`
|
||||
|
||||
External Styles which will be included with the application
|
||||
|
||||
### subresourceIntegrity
|
||||
|
||||
Default: `false`
|
||||
|
||||
@ -7,12 +7,6 @@ Read more about how to use executors and the CLI here: https://nx.dev/node/getti
|
||||
|
||||
## Properties
|
||||
|
||||
### assets
|
||||
|
||||
Type: `array`
|
||||
|
||||
List of static assets.
|
||||
|
||||
### ~~babelConfig~~
|
||||
|
||||
Type: `string`
|
||||
@ -59,24 +53,6 @@ Type: `boolean`
|
||||
|
||||
CSS files will be extracted to the output folder.
|
||||
|
||||
### globals
|
||||
|
||||
Type: `object[]`
|
||||
|
||||
A mapping of node modules to their UMD global names. Used by the UMD bundle
|
||||
|
||||
#### moduleId
|
||||
|
||||
Type: `string`
|
||||
|
||||
The node module to map from (e.g. `react-dom`).
|
||||
|
||||
#### global
|
||||
|
||||
Type: `string`
|
||||
|
||||
The global name to map to (e.g. `ReactDOM`).
|
||||
|
||||
### outputPath
|
||||
|
||||
Type: `string`
|
||||
@ -91,7 +67,7 @@ The path to package.json file.
|
||||
|
||||
### rollupConfig
|
||||
|
||||
Type: `array[] | string `
|
||||
Type: `string`
|
||||
|
||||
Path to a function which takes a rollup config and returns an updated rollup config
|
||||
|
||||
|
||||
@ -183,10 +183,6 @@ Type: `string`
|
||||
|
||||
Command to run in child process
|
||||
|
||||
### commands
|
||||
|
||||
Type: `array`
|
||||
|
||||
### cwd
|
||||
|
||||
Type: `string`
|
||||
@ -201,7 +197,7 @@ You may specify a custom .env file path
|
||||
|
||||
### outputPath
|
||||
|
||||
Type: `string | string[] `
|
||||
Type: `string`
|
||||
|
||||
Allows you to specify where the build artifacts are stored. This allows Nx Cloud to pick them up correctly, in the case that the build artifacts are placed somewhere other than the top level dist folder.
|
||||
|
||||
|
||||
@ -7,12 +7,6 @@ Read more about how to use executors and the CLI here: https://nx.dev/node/getti
|
||||
|
||||
## Properties
|
||||
|
||||
### assets
|
||||
|
||||
Type: `array`
|
||||
|
||||
List of static assets.
|
||||
|
||||
### main
|
||||
|
||||
Type: `string`
|
||||
|
||||
@ -15,33 +15,21 @@ A list of CommonJS packages that are allowed to be used without a build time war
|
||||
|
||||
### aot
|
||||
|
||||
Default: `false`
|
||||
Default: `true`
|
||||
|
||||
Type: `boolean`
|
||||
|
||||
Build using Ahead of Time compilation.
|
||||
|
||||
### assets
|
||||
|
||||
Type: `array`
|
||||
|
||||
List of static application assets.
|
||||
|
||||
### baseHref
|
||||
|
||||
Type: `string`
|
||||
|
||||
Base url for the application being built.
|
||||
|
||||
### budgets
|
||||
|
||||
Type: `array`
|
||||
|
||||
Budget thresholds to ensure parts of your application stay within boundaries which you set.
|
||||
|
||||
### buildOptimizer
|
||||
|
||||
Default: `false`
|
||||
Default: `true`
|
||||
|
||||
Type: `boolean`
|
||||
|
||||
@ -59,7 +47,7 @@ Default: `true`
|
||||
|
||||
Type: `boolean`
|
||||
|
||||
Use a separate bundle containing code used across multiple bundles.
|
||||
Generate a seperate bundle containing code used across multiple bundles.
|
||||
|
||||
### crossOrigin
|
||||
|
||||
@ -85,67 +73,23 @@ Type: `string`
|
||||
|
||||
URL where files will be deployed.
|
||||
|
||||
### experimentalRollupPass
|
||||
|
||||
Default: `false`
|
||||
|
||||
Type: `boolean`
|
||||
|
||||
Concatenate modules with Rollup before bundling them with Webpack.
|
||||
|
||||
### extractCss
|
||||
|
||||
Default: `false`
|
||||
|
||||
Type: `boolean`
|
||||
|
||||
Extract css from global styles into css files instead of js ones.
|
||||
|
||||
### extractLicenses
|
||||
|
||||
Default: `false`
|
||||
|
||||
Type: `boolean`
|
||||
|
||||
Extract all licenses in a separate file.
|
||||
|
||||
### fileReplacements
|
||||
|
||||
Type: `array`
|
||||
|
||||
Replace compilation source files with other compilation source files in the build.
|
||||
|
||||
### forkTypeChecker
|
||||
### ~~extractCss~~
|
||||
|
||||
Default: `true`
|
||||
|
||||
Type: `boolean`
|
||||
|
||||
Run the TypeScript type checker in a forked process.
|
||||
**Deprecated:** Deprecated since version 11.0. No longer required to disable CSS extraction for HMR.
|
||||
|
||||
### ~~i18nFile~~
|
||||
Extract CSS from global styles into '.css' files instead of '.js'.
|
||||
|
||||
Type: `string`
|
||||
### extractLicenses
|
||||
|
||||
**Deprecated:** Use 'locales' object in the project metadata instead.
|
||||
Default: `true`
|
||||
|
||||
Localization file to use for i18n.
|
||||
Type: `boolean`
|
||||
|
||||
### ~~i18nFormat~~
|
||||
|
||||
Type: `string`
|
||||
|
||||
**Deprecated:** No longer needed as the format will be determined automatically.
|
||||
|
||||
Format of the localization file specified with --i18n-file.
|
||||
|
||||
### ~~i18nLocale~~
|
||||
|
||||
Type: `string`
|
||||
|
||||
**Deprecated:** Use 'localize' instead.
|
||||
|
||||
Locale to use for i18n.
|
||||
Extract all licenses in a separate file.
|
||||
|
||||
### i18nMissingTranslation
|
||||
|
||||
@ -163,17 +107,21 @@ Type: `string`
|
||||
|
||||
Configures the generation of the application's HTML index.
|
||||
|
||||
### ~~lazyModules~~
|
||||
### inlineStyleLanguage
|
||||
|
||||
Type: `array`
|
||||
Default: `css`
|
||||
|
||||
**Deprecated:** 'SystemJsNgModuleLoader' is deprecated, and this is part of its usage. Use 'import()' syntax instead.
|
||||
Type: `string`
|
||||
|
||||
List of additional NgModule files that will be lazy loaded. Lazy router modules will be discovered automatically.
|
||||
Possible values: `css`, `less`, `sass`, `scss`
|
||||
|
||||
The stylesheet language to use for the application's inline component styles.
|
||||
|
||||
### localize
|
||||
|
||||
Type: `boolean | boolean[] `
|
||||
Type: `boolean`
|
||||
|
||||
Translate the bundles in one or more locales.
|
||||
|
||||
### main
|
||||
|
||||
@ -183,7 +131,7 @@ The full path for the main entry point to the app, relative to the current works
|
||||
|
||||
### namedChunks
|
||||
|
||||
Default: `true`
|
||||
Default: `false`
|
||||
|
||||
Type: `boolean`
|
||||
|
||||
@ -197,11 +145,11 @@ Path to ngsw-config.json.
|
||||
|
||||
### optimization
|
||||
|
||||
Default: `false`
|
||||
Default: `true`
|
||||
|
||||
Type: `boolean`
|
||||
|
||||
Enables optimization of the build output.
|
||||
Enables optimization of the build output. Including minification of scripts and styles, tree-shaking, dead-code elimination, inlining of critical CSS and fonts inlining. For more information, see https://angular.io/guide/workspace-config#optimization-configuration.
|
||||
|
||||
### outputHashing
|
||||
|
||||
@ -241,6 +189,8 @@ Do not use the real path when resolving modules. If unset then will default to `
|
||||
|
||||
### progress
|
||||
|
||||
Default: `true`
|
||||
|
||||
Type: `boolean`
|
||||
|
||||
Log progress to the console while building.
|
||||
@ -251,12 +201,6 @@ Type: `string`
|
||||
|
||||
The path where style resources will be placed, relative to outputPath.
|
||||
|
||||
### scripts
|
||||
|
||||
Type: `array`
|
||||
|
||||
Global scripts to be included in the build.
|
||||
|
||||
### serviceWorker
|
||||
|
||||
Default: `false`
|
||||
@ -271,17 +215,17 @@ Default: `false`
|
||||
|
||||
Type: `boolean`
|
||||
|
||||
**Deprecated:** The recommended method to detect circular dependencies in project code is to use a either a lint rule or other external tooling.
|
||||
**Deprecated:** The recommended method to detect circular dependencies in project code is to use either a lint rule or other external tooling.
|
||||
|
||||
Show circular dependency warnings on builds.
|
||||
|
||||
### sourceMap
|
||||
|
||||
Default: `true`
|
||||
Default: `false`
|
||||
|
||||
Type: `boolean`
|
||||
|
||||
Output sourcemaps.
|
||||
Output source maps for scripts and styles. For more information, see https://angular.io/guide/workspace-config#source-map-configuration.
|
||||
|
||||
### statsJson
|
||||
|
||||
@ -291,12 +235,6 @@ Type: `boolean`
|
||||
|
||||
Generates a 'stats.json' file which can be analyzed using tools such as 'webpack-bundle-analyzer'.
|
||||
|
||||
### styles
|
||||
|
||||
Type: `array`
|
||||
|
||||
Global styles to be included in the build.
|
||||
|
||||
### subresourceIntegrity
|
||||
|
||||
Default: `false`
|
||||
@ -321,11 +259,11 @@ The full path for the TypeScript configuration file, relative to the current wor
|
||||
|
||||
### vendorChunk
|
||||
|
||||
Default: `true`
|
||||
Default: `false`
|
||||
|
||||
Type: `boolean`
|
||||
|
||||
Use a separate bundle containing only vendor libraries.
|
||||
Generate a seperate bundle containing only vendor libraries. This option should only used for development.
|
||||
|
||||
### verbose
|
||||
|
||||
|
||||
@ -50,14 +50,6 @@ Possible values: `protractor`, `cypress`, `none`
|
||||
|
||||
Test runner to use for end to end (e2e) tests
|
||||
|
||||
### enableIvy
|
||||
|
||||
Default: `true`
|
||||
|
||||
Type: `boolean`
|
||||
|
||||
Create a new app that uses the Ivy rendering engine.
|
||||
|
||||
### inlineStyle
|
||||
|
||||
Alias(es): s
|
||||
@ -84,7 +76,7 @@ Default: `eslint`
|
||||
|
||||
Type: `string`
|
||||
|
||||
Possible values: `tslint`, `eslint`
|
||||
Possible values: `eslint`, `none`
|
||||
|
||||
The tool to use for running lint checks.
|
||||
|
||||
|
||||
@ -78,7 +78,7 @@ Default: `eslint`
|
||||
|
||||
Type: `string`
|
||||
|
||||
Possible values: `tslint`, `eslint`
|
||||
Possible values: `eslint`, `none`
|
||||
|
||||
The tool to use for running lint checks.
|
||||
|
||||
@ -158,16 +158,6 @@ Type: `boolean`
|
||||
|
||||
Creates a library with stricter type checking and build optimization options.
|
||||
|
||||
### style
|
||||
|
||||
Default: `css`
|
||||
|
||||
Type: `string`
|
||||
|
||||
Possible values: `css`, `scss`, `styl`, `less`
|
||||
|
||||
The file extension to be used for style files.
|
||||
|
||||
### tags
|
||||
|
||||
Type: `string`
|
||||
|
||||
@ -60,7 +60,7 @@ Default: `eslint`
|
||||
|
||||
Type: `string`
|
||||
|
||||
Possible values: `eslint`, `tslint`
|
||||
Possible values: `eslint`, `none`
|
||||
|
||||
The tool to use for running lint checks.
|
||||
|
||||
|
||||
@ -105,6 +105,6 @@ Hide output text.
|
||||
|
||||
### tsConfig
|
||||
|
||||
Type: `string | string[] `
|
||||
Type: `string`
|
||||
|
||||
The name of the TypeScript configuration file.
|
||||
|
||||
@ -7,24 +7,6 @@ Read more about how to use executors and the CLI here: https://nx.dev/react/gett
|
||||
|
||||
## Properties
|
||||
|
||||
### fileReplacements
|
||||
|
||||
Type: `object[]`
|
||||
|
||||
Replace files with other files in the build.
|
||||
|
||||
#### replace
|
||||
|
||||
Type: `string`
|
||||
|
||||
undefined
|
||||
|
||||
#### with
|
||||
|
||||
Type: `string`
|
||||
|
||||
undefined
|
||||
|
||||
### nextConfig
|
||||
|
||||
Type: `string`
|
||||
|
||||
@ -7,12 +7,6 @@ Read more about how to use executors and the CLI here: https://nx.dev/react/gett
|
||||
|
||||
## Properties
|
||||
|
||||
### assets
|
||||
|
||||
Type: `array`
|
||||
|
||||
List of static application assets.
|
||||
|
||||
### buildLibsFromSource
|
||||
|
||||
Default: `true`
|
||||
@ -25,7 +19,7 @@ Read buildable libraries from source instead of building them separately.
|
||||
|
||||
Default: `all`
|
||||
|
||||
Type: `string | string[] `
|
||||
Type: `string`
|
||||
|
||||
Dependencies to keep external to the bundle. ("all" (default), "none", or an array of module names)
|
||||
|
||||
@ -37,24 +31,6 @@ Type: `boolean`
|
||||
|
||||
Extract all licenses in a separate file, in the case of production builds only.
|
||||
|
||||
### fileReplacements
|
||||
|
||||
Type: `object[]`
|
||||
|
||||
Replace files with other files in the build.
|
||||
|
||||
#### replace
|
||||
|
||||
Type: `string`
|
||||
|
||||
undefined
|
||||
|
||||
#### with
|
||||
|
||||
Type: `string`
|
||||
|
||||
undefined
|
||||
|
||||
### generatePackageJson
|
||||
|
||||
Default: `false`
|
||||
@ -159,6 +135,6 @@ Run build when files change.
|
||||
|
||||
### webpackConfig
|
||||
|
||||
Type: `array[] | string `
|
||||
Type: `string`
|
||||
|
||||
Path to a function which takes a webpack config, context and returns the resulting webpack config
|
||||
|
||||
@ -7,12 +7,6 @@ Read more about how to use executors and the CLI here: https://nx.dev/react/gett
|
||||
|
||||
## Properties
|
||||
|
||||
### assets
|
||||
|
||||
Type: `array`
|
||||
|
||||
List of static library assets.
|
||||
|
||||
### buildableProjectDepsInPackageJsonType
|
||||
|
||||
Default: `dependencies`
|
||||
|
||||
@ -50,7 +50,7 @@ Default: `eslint`
|
||||
|
||||
Type: `string`
|
||||
|
||||
Possible values: `eslint`, `tslint`
|
||||
Possible values: `eslint`, `tslint`, `none`
|
||||
|
||||
The tool to use for running lint checks.
|
||||
|
||||
|
||||
@ -44,7 +44,7 @@ Default: `eslint`
|
||||
|
||||
Type: `string`
|
||||
|
||||
Possible values: `eslint`, `tslint`
|
||||
Possible values: `eslint`, `tslint`, `none`
|
||||
|
||||
The tool to use for running lint checks.
|
||||
|
||||
|
||||
@ -7,12 +7,6 @@ Read more about how to use executors and the CLI here: https://nx.dev/react/gett
|
||||
|
||||
## Properties
|
||||
|
||||
### assets
|
||||
|
||||
Type: `array`
|
||||
|
||||
List of static application assets.
|
||||
|
||||
### baseHref
|
||||
|
||||
Default: `/`
|
||||
@ -21,12 +15,6 @@ Type: `string`
|
||||
|
||||
Base url for the application being built.
|
||||
|
||||
### budgets
|
||||
|
||||
Type: `array`
|
||||
|
||||
Budget thresholds to ensure parts of your application stay within boundaries which you set.
|
||||
|
||||
### buildLibsFromSource
|
||||
|
||||
Default: `true`
|
||||
@ -85,24 +73,6 @@ Type: `boolean`
|
||||
|
||||
Extract all licenses in a separate file, in the case of production builds only.
|
||||
|
||||
### fileReplacements
|
||||
|
||||
Type: `object[]`
|
||||
|
||||
Replace files with other files in the build.
|
||||
|
||||
#### replace
|
||||
|
||||
Type: `string`
|
||||
|
||||
undefined
|
||||
|
||||
#### with
|
||||
|
||||
Type: `string`
|
||||
|
||||
undefined
|
||||
|
||||
### index
|
||||
|
||||
Type: `string`
|
||||
@ -179,12 +149,6 @@ Type: `boolean`
|
||||
|
||||
Use a separate bundle containing the runtime.
|
||||
|
||||
### scripts
|
||||
|
||||
Type: `array`
|
||||
|
||||
External Scripts which will be included before the main application entry
|
||||
|
||||
### ~~showCircularDependencies~~
|
||||
|
||||
Default: `false`
|
||||
@ -211,12 +175,6 @@ Type: `boolean`
|
||||
|
||||
Generates a 'stats.json' file which can be analyzed using tools such as: 'webpack-bundle-analyzer' or <https://webpack.github.io/analyse>.
|
||||
|
||||
### styles
|
||||
|
||||
Type: `array`
|
||||
|
||||
External Styles which will be included with the application
|
||||
|
||||
### subresourceIntegrity
|
||||
|
||||
Default: `false`
|
||||
|
||||
@ -7,12 +7,6 @@ Read more about how to use executors and the CLI here: https://nx.dev/react/gett
|
||||
|
||||
## Properties
|
||||
|
||||
### assets
|
||||
|
||||
Type: `array`
|
||||
|
||||
List of static assets.
|
||||
|
||||
### ~~babelConfig~~
|
||||
|
||||
Type: `string`
|
||||
@ -59,24 +53,6 @@ Type: `boolean`
|
||||
|
||||
CSS files will be extracted to the output folder.
|
||||
|
||||
### globals
|
||||
|
||||
Type: `object[]`
|
||||
|
||||
A mapping of node modules to their UMD global names. Used by the UMD bundle
|
||||
|
||||
#### moduleId
|
||||
|
||||
Type: `string`
|
||||
|
||||
The node module to map from (e.g. `react-dom`).
|
||||
|
||||
#### global
|
||||
|
||||
Type: `string`
|
||||
|
||||
The global name to map to (e.g. `ReactDOM`).
|
||||
|
||||
### outputPath
|
||||
|
||||
Type: `string`
|
||||
@ -91,7 +67,7 @@ The path to package.json file.
|
||||
|
||||
### rollupConfig
|
||||
|
||||
Type: `array[] | string `
|
||||
Type: `string`
|
||||
|
||||
Path to a function which takes a rollup config and returns an updated rollup config
|
||||
|
||||
|
||||
@ -183,10 +183,6 @@ Type: `string`
|
||||
|
||||
Command to run in child process
|
||||
|
||||
### commands
|
||||
|
||||
Type: `array`
|
||||
|
||||
### cwd
|
||||
|
||||
Type: `string`
|
||||
@ -201,7 +197,7 @@ You may specify a custom .env file path
|
||||
|
||||
### outputPath
|
||||
|
||||
Type: `string | string[] `
|
||||
Type: `string`
|
||||
|
||||
Allows you to specify where the build artifacts are stored. This allows Nx Cloud to pick them up correctly, in the case that the build artifacts are placed somewhere other than the top level dist folder.
|
||||
|
||||
|
||||
@ -7,12 +7,6 @@ Read more about how to use executors and the CLI here: https://nx.dev/react/gett
|
||||
|
||||
## Properties
|
||||
|
||||
### assets
|
||||
|
||||
Type: `array`
|
||||
|
||||
List of static assets.
|
||||
|
||||
### main
|
||||
|
||||
Type: `string`
|
||||
|
||||
@ -169,7 +169,7 @@ import { names } from '@nrwl/devkit';
|
||||
|
||||
const jsonFile = readJson(`dist/libs/${parentLib}/package.json`);
|
||||
|
||||
expect(jsonFile.dependencies['tslib']).toEqual('^2.0.0');
|
||||
expect(jsonFile.dependencies['tslib']).toEqual('^2.1.0');
|
||||
expect(jsonFile.peerDependencies[`@${proj}/${childLib}`]).toBeDefined();
|
||||
expect(
|
||||
jsonFile.peerDependencies[`@${proj}/${childLib2}`]
|
||||
|
||||
@ -36,7 +36,7 @@ describe('ngrx', () => {
|
||||
`generate @nrwl/angular:ngrx flights --module=libs/${mylib}/src/lib/${mylib}.module.ts --facade --syntax=classes`
|
||||
);
|
||||
|
||||
expect(runCLI(`build ${myapp}`)).toContain('main.js');
|
||||
expect(runCLI(`build ${myapp}`)).toMatch(/main\.[a-z0-9]+\.js/);
|
||||
expectTestsPass(await runCLIAsync(`test ${myapp} --no-watch`));
|
||||
expectTestsPass(await runCLIAsync(`test ${mylib} --no-watch`));
|
||||
}, 1000000);
|
||||
@ -66,7 +66,7 @@ describe('ngrx', () => {
|
||||
`generate @nrwl/angular:ngrx flights --module=libs/${mylib}/src/lib/${mylib}.module.ts ${flags}`
|
||||
);
|
||||
|
||||
expect(runCLI(`build ${myapp}`)).toContain('main.js');
|
||||
expect(runCLI(`build ${myapp}`)).toMatch(/main\.[a-z0-9]+\.js/);
|
||||
expectTestsPass(await runCLIAsync(`test ${myapp} --no-watch`));
|
||||
expectTestsPass(await runCLIAsync(`test ${mylib} --no-watch`));
|
||||
}, 1000000);
|
||||
|
||||
@ -73,11 +73,9 @@ export function runCreateWorkspace(
|
||||
|
||||
const pm = getPackageManagerCommand({ packageManager });
|
||||
|
||||
const linterArg =
|
||||
preset === 'angular' || preset === 'angular-nest' ? ' --linter=tslint' : '';
|
||||
let command = `${pm.createWorkspace} ${name} --cli=${
|
||||
cli || currentCli()
|
||||
} --preset=${preset} ${linterArg} --no-nxCloud --no-interactive`;
|
||||
} --preset=${preset} --no-nxCloud --no-interactive`;
|
||||
if (appName) {
|
||||
command += ` --appName=${appName}`;
|
||||
}
|
||||
|
||||
52
package.json
52
package.json
@ -24,26 +24,26 @@
|
||||
"prepare": "is-ci || husky install"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@angular-devkit/architect": "~0.1102.0",
|
||||
"@angular-devkit/build-angular": "~0.1102.0",
|
||||
"@angular-devkit/build-optimizer": "~0.1102.0",
|
||||
"@angular-devkit/build-webpack": "~0.1102.0",
|
||||
"@angular-devkit/core": "~11.2.0",
|
||||
"@angular-devkit/schematics": "~11.2.0",
|
||||
"@angular-eslint/eslint-plugin": "~4.2.0",
|
||||
"@angular-eslint/eslint-plugin-template": "~4.2.0",
|
||||
"@angular-eslint/template-parser": "~4.2.0",
|
||||
"@angular/cli": "~11.2.0",
|
||||
"@angular/common": "~11.2.0",
|
||||
"@angular/compiler": "~11.2.0",
|
||||
"@angular/compiler-cli": "~11.2.0",
|
||||
"@angular/core": "~11.2.0",
|
||||
"@angular/forms": "~11.2.0",
|
||||
"@angular/platform-browser": "~11.2.0",
|
||||
"@angular/platform-browser-dynamic": "~11.2.0",
|
||||
"@angular/router": "~11.2.0",
|
||||
"@angular/service-worker": "~11.2.0",
|
||||
"@angular/upgrade": "~11.2.0",
|
||||
"@angular-devkit/architect": "~0.1200.0-rc.3",
|
||||
"@angular-devkit/build-angular": "~12.0.0-rc.3",
|
||||
"@angular-devkit/build-optimizer": "~0.1200.0-rc.3",
|
||||
"@angular-devkit/build-webpack": "~0.1200.0-rc.3",
|
||||
"@angular-devkit/core": "~12.0.0-rc.3",
|
||||
"@angular-devkit/schematics": "~12.0.0-rc.3",
|
||||
"@angular-eslint/eslint-plugin": "~12.0.0-alpha.0",
|
||||
"@angular-eslint/eslint-plugin-template": "~12.0.0-alpha.0",
|
||||
"@angular-eslint/template-parser": "~12.0.0-alpha.0",
|
||||
"@angular/cli": "~12.0.0-rc.3",
|
||||
"@angular/common": "~12.0.0-rc.3",
|
||||
"@angular/compiler": "~12.0.0-rc.3",
|
||||
"@angular/compiler-cli": "~12.0.0-rc.3",
|
||||
"@angular/core": "~12.0.0-rc.3",
|
||||
"@angular/forms": "~12.0.0-rc.3",
|
||||
"@angular/platform-browser": "~12.0.0-rc.3",
|
||||
"@angular/platform-browser-dynamic": "~12.0.0-rc.3",
|
||||
"@angular/router": "~12.0.0-rc.3",
|
||||
"@angular/service-worker": "~12.0.0-rc.3",
|
||||
"@angular/upgrade": "~12.0.0-rc.3",
|
||||
"@cypress/webpack-preprocessor": "~4.1.2",
|
||||
"@nestjs/common": "^7.0.0",
|
||||
"@nestjs/core": "^7.0.0",
|
||||
@ -75,7 +75,7 @@
|
||||
"@rollup/plugin-image": "2.0.4",
|
||||
"@rollup/plugin-json": "^4.1.0",
|
||||
"@rollup/plugin-node-resolve": "7.1.1",
|
||||
"@schematics/angular": "~11.2.0",
|
||||
"@schematics/angular": "~12.0.0-rc.3",
|
||||
"@storybook/addon-knobs": "^6.0.21",
|
||||
"@storybook/angular": "^6.0.21",
|
||||
"@storybook/core": "^6.0.21",
|
||||
@ -175,7 +175,7 @@
|
||||
"mini-css-extract-plugin": "0.8.0",
|
||||
"minimatch": "3.0.4",
|
||||
"next": "10.2.0",
|
||||
"ng-packagr": "~11.2.0",
|
||||
"ng-packagr": "~12.0.0-rc.3",
|
||||
"ngrx-store-freeze": "0.2.4",
|
||||
"npm-run-all": "^4.1.5",
|
||||
"open": "^7.4.2",
|
||||
@ -200,7 +200,7 @@
|
||||
"rollup-plugin-peer-deps-external": "2.2.2",
|
||||
"rollup-plugin-postcss": "^4.0.0",
|
||||
"rollup-plugin-typescript2": "^0.27.1",
|
||||
"rxjs": "6.6.3",
|
||||
"rxjs": "6.6.7",
|
||||
"rxjs-for-await": "0.0.2",
|
||||
"sass": "1.26.3",
|
||||
"sass-loader": "8.0.2",
|
||||
@ -227,7 +227,7 @@
|
||||
"tslib": "^2.0.0",
|
||||
"tslint": "6.1.3",
|
||||
"tslint-to-eslint-config": "2.2.0",
|
||||
"typescript": "4.1.5",
|
||||
"typescript": "4.2.4",
|
||||
"url-loader": "^3.0.0",
|
||||
"verdaccio": "^4.11.1",
|
||||
"webpack": "4.42.0",
|
||||
@ -239,7 +239,7 @@
|
||||
"worker-plugin": "3.2.0",
|
||||
"yargs": "15.4.1",
|
||||
"yargs-parser": "20.0.0",
|
||||
"zone.js": "^0.10.0"
|
||||
"zone.js": "~0.11.4"
|
||||
},
|
||||
"author": "Victor Savkin",
|
||||
"license": "MIT",
|
||||
@ -270,6 +270,6 @@
|
||||
"weak-napi": "^2.0.2"
|
||||
},
|
||||
"resolutions": {
|
||||
"ng-packagr/rxjs": "6.6.3"
|
||||
"ng-packagr/rxjs": "6.6.7"
|
||||
}
|
||||
}
|
||||
@ -60,6 +60,18 @@
|
||||
"version": "12.0.0-beta.0",
|
||||
"description": "adjusts the ngcc postinstall command to just leave 'ngcc' in there. This fixes Ivy in Jest tests and Storybooks",
|
||||
"factory": "./src/migrations/update-12-0-0/update-ngcc-postinstall"
|
||||
},
|
||||
"update-webpack-browser-config": {
|
||||
"cli": "nx",
|
||||
"version": "12.3.0-rc.0",
|
||||
"description": "Remove deprecated options and update others according to new defaults. It syncs with the v12 migration of Angular builders.",
|
||||
"factory": "./src/migrations/update-12-3-0/update-webpack-browser-config"
|
||||
},
|
||||
"update-storybook": {
|
||||
"cli": "nx",
|
||||
"version": "12.3.0-rc.0",
|
||||
"description": "Updates storybook configurations to support webpack 5",
|
||||
"factory": "./src/migrations/update-12-3-0/update-storybook"
|
||||
}
|
||||
},
|
||||
"packageJsonUpdates": {
|
||||
@ -461,6 +473,95 @@
|
||||
"alwaysAddToPackageJson": false
|
||||
}
|
||||
}
|
||||
},
|
||||
"12.3.0-rc.0": {
|
||||
"version": "12.3.0-rc.0",
|
||||
"packages": {
|
||||
"@angular/cli": {
|
||||
"version": "^12.0.0-rc.3",
|
||||
"alwaysAddToPackageJson": false
|
||||
},
|
||||
"@angular-devkit/build-angular": {
|
||||
"version": "^12.0.0-rc.3",
|
||||
"alwaysAddToPackageJson": false
|
||||
},
|
||||
"@angular-devkit/build-optimizer": {
|
||||
"version": "^0.1200.0-rc.3",
|
||||
"alwaysAddToPackageJson": false
|
||||
},
|
||||
"@angular/core": {
|
||||
"version": "^12.0.0-rc.3",
|
||||
"alwaysAddToPackageJson": false
|
||||
},
|
||||
"@angular/common": {
|
||||
"version": "^12.0.0-rc.3",
|
||||
"alwaysAddToPackageJson": false
|
||||
},
|
||||
"@angular/forms": {
|
||||
"version": "^12.0.0-rc.3",
|
||||
"alwaysAddToPackageJson": false
|
||||
},
|
||||
"@angular/elements": {
|
||||
"version": "^12.0.0-rc.3",
|
||||
"alwaysAddToPackageJson": false
|
||||
},
|
||||
"@angular/compiler": {
|
||||
"version": "^12.0.0-rc.3",
|
||||
"alwaysAddToPackageJson": false
|
||||
},
|
||||
"@angular/compiler-cli": {
|
||||
"version": "^12.0.0-rc.3",
|
||||
"alwaysAddToPackageJson": false
|
||||
},
|
||||
"@angular/platform-browser": {
|
||||
"version": "^12.0.0-rc.3",
|
||||
"alwaysAddToPackageJson": false
|
||||
},
|
||||
"@angular/platform-browser-dynamic": {
|
||||
"version": "^12.0.0-rc.3",
|
||||
"alwaysAddToPackageJson": false
|
||||
},
|
||||
"@angular/router": {
|
||||
"version": "^12.0.0-rc.3",
|
||||
"alwaysAddToPackageJson": false
|
||||
},
|
||||
"@angular/upgrade": {
|
||||
"version": "^12.0.0-rc.3",
|
||||
"alwaysAddToPackageJson": false
|
||||
},
|
||||
"@angular/language-service": {
|
||||
"version": "^12.0.0-rc.3",
|
||||
"alwaysAddToPackageJson": false
|
||||
},
|
||||
"@angular/animations": {
|
||||
"version": "^12.0.0-rc.3",
|
||||
"alwaysAddToPackageJson": false
|
||||
},
|
||||
"@angular/service-worker": {
|
||||
"version": "^12.0.0-rc.3",
|
||||
"alwaysAddToPackageJson": false
|
||||
},
|
||||
"ng-packagr": {
|
||||
"version": "^12.0.0-rc.3",
|
||||
"alwaysAddToPackageJson": false
|
||||
},
|
||||
"typescript": {
|
||||
"version": "~4.2.4",
|
||||
"alwaysAddToPackageJson": false
|
||||
},
|
||||
"@angular-eslint/eslint-plugin": {
|
||||
"version": "~12.0.0-alpha.0",
|
||||
"alwaysAddToPackageJson": false
|
||||
},
|
||||
"@angular-eslint/eslint-plugin-template": {
|
||||
"version": "~12.0.0-alpha.0",
|
||||
"alwaysAddToPackageJson": false
|
||||
},
|
||||
"@angular-eslint/template-parser": {
|
||||
"version": "~12.0.0-alpha.0",
|
||||
"alwaysAddToPackageJson": false
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -10,7 +10,7 @@
|
||||
"jasmine-marbles": "jasmine-marbles"
|
||||
}
|
||||
},
|
||||
"whitelistedNonPeerDependencies": [
|
||||
"allowedNonPeerDependencies": [
|
||||
"@nrwl/",
|
||||
"@angular-devkit",
|
||||
"@angular-eslint/",
|
||||
|
||||
@ -33,12 +33,12 @@
|
||||
"migrations": "./migrations.json"
|
||||
},
|
||||
"dependencies": {
|
||||
"@angular-devkit/schematics": "~11.2.0",
|
||||
"@angular-devkit/schematics": "~12.0.0-rc.3",
|
||||
"@nrwl/cypress": "*",
|
||||
"@nrwl/devkit": "*",
|
||||
"@nrwl/jest": "*",
|
||||
"@nrwl/linter": "*",
|
||||
"@schematics/angular": "~11.2.0",
|
||||
"@schematics/angular": "~12.0.0-rc.3",
|
||||
"jasmine-marbles": "~0.6.0"
|
||||
}
|
||||
}
|
||||
|
||||
@ -23,7 +23,7 @@ import { NgPackage } from 'ng-packagr/lib/ng-package/package';
|
||||
import {
|
||||
copyFile,
|
||||
exists,
|
||||
rimraf,
|
||||
rmdir,
|
||||
stat,
|
||||
writeFile,
|
||||
} from 'ng-packagr/lib/utils/fs';
|
||||
@ -31,6 +31,8 @@ import { globFiles } from 'ng-packagr/lib/utils/glob';
|
||||
import { ensureUnixPath } from 'ng-packagr/lib/utils/path';
|
||||
import * as path from 'path';
|
||||
|
||||
type CompilationMode = 'partial' | 'full' | undefined;
|
||||
|
||||
export const nxWritePackageTransform: Transform = transformFromPromise(
|
||||
async (graph) => {
|
||||
const entryPoint: EntryPointNode = graph.find(isEntryPointInProgress());
|
||||
@ -104,7 +106,7 @@ export const nxWritePackageTransform: Transform = transformFromPromise(
|
||||
const relativeUnixFromDestPath = (filePath: string) =>
|
||||
ensureUnixPath(path.relative(ngEntryPoint.destinationPath, filePath));
|
||||
|
||||
const isIvy = !!entryPoint.data.tsConfig.options.enableIvy;
|
||||
const { enableIvy, compilationMode } = entryPoint.data.tsConfig.options;
|
||||
|
||||
await writePackageJson(
|
||||
ngEntryPoint,
|
||||
@ -114,13 +116,14 @@ export const nxWritePackageTransform: Transform = transformFromPromise(
|
||||
esm2015: relativeUnixFromDestPath(destinationFiles.esm2015),
|
||||
typings: relativeUnixFromDestPath(destinationFiles.declarations),
|
||||
// Ivy doesn't generate metadata files
|
||||
metadata: isIvy
|
||||
metadata: enableIvy
|
||||
? undefined
|
||||
: relativeUnixFromDestPath(destinationFiles.metadata),
|
||||
// webpack v4+ specific flag to enable advanced optimizations and code splitting
|
||||
sideEffects: ngEntryPoint.sideEffects,
|
||||
},
|
||||
isIvy
|
||||
!!enableIvy,
|
||||
compilationMode as CompilationMode
|
||||
);
|
||||
} catch (error) {
|
||||
throw error;
|
||||
@ -150,7 +153,8 @@ async function writePackageJson(
|
||||
entryPoint: NgEntryPoint,
|
||||
pkg: NgPackage,
|
||||
additionalProperties: { [key: string]: string | boolean | string[] },
|
||||
isIvy: boolean
|
||||
isIvy: boolean,
|
||||
compilationMode: CompilationMode
|
||||
): Promise<void> {
|
||||
// set additional properties
|
||||
const packageJson = { ...entryPoint.packageJson, ...additionalProperties };
|
||||
@ -198,7 +202,7 @@ async function writePackageJson(
|
||||
try {
|
||||
checkNonPeerDependencies(packageJson, 'dependencies', allowedList);
|
||||
} catch (e) {
|
||||
await rimraf(entryPoint.destinationPath);
|
||||
await rmdir(entryPoint.destinationPath, { recursive: true });
|
||||
throw e;
|
||||
}
|
||||
|
||||
@ -216,12 +220,16 @@ async function writePackageJson(
|
||||
}
|
||||
}
|
||||
|
||||
if (isIvy && !entryPoint.isSecondaryEntryPoint) {
|
||||
if (
|
||||
isIvy &&
|
||||
!entryPoint.isSecondaryEntryPoint &&
|
||||
compilationMode !== 'partial'
|
||||
) {
|
||||
const scripts = packageJson.scripts || (packageJson.scripts = {});
|
||||
scripts.prepublishOnly =
|
||||
'node --eval "console.error(\'' +
|
||||
'ERROR: Trying to publish a package that has been compiled by Ivy. This is not allowed.\\n' +
|
||||
'Please delete and rebuild the package, without compiling with Ivy, before attempting to publish.\\n' +
|
||||
'ERROR: Trying to publish a package that has been compiled by Ivy in full compilation mode. This is not allowed.\\n' +
|
||||
'Please delete and rebuild the package with Ivy partial compilation mode, before attempting to publish.\\n' +
|
||||
'\')" ' +
|
||||
'&& exit 1';
|
||||
}
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
{
|
||||
"$schema": "http://json-schema.org/schema",
|
||||
"$schema": "http://json-schema.org/draft-07/schema",
|
||||
"title": "Webpack browser schema for Build Facade.",
|
||||
"description": "Browser target options",
|
||||
"type": "object",
|
||||
@ -18,8 +18,7 @@
|
||||
},
|
||||
"main": {
|
||||
"type": "string",
|
||||
"description": "The full path for the main entry point to the app, relative to the current workspace.",
|
||||
"$valueDescription": "fileName"
|
||||
"description": "The full path for the main entry point to the app, relative to the current workspace."
|
||||
},
|
||||
"polyfills": {
|
||||
"type": "string",
|
||||
@ -45,6 +44,12 @@
|
||||
"$ref": "#/definitions/extraEntryPoint"
|
||||
}
|
||||
},
|
||||
"inlineStyleLanguage": {
|
||||
"description": "The stylesheet language to use for the application's inline component styles.",
|
||||
"type": "string",
|
||||
"default": "css",
|
||||
"enum": ["css", "less", "sass", "scss"]
|
||||
},
|
||||
"stylePreprocessorOptions": {
|
||||
"description": "Options to pass to style preprocessors.",
|
||||
"type": "object",
|
||||
@ -61,9 +66,9 @@
|
||||
"additionalProperties": false
|
||||
},
|
||||
"optimization": {
|
||||
"description": "Enables optimization of the build output.",
|
||||
"description": "Enables optimization of the build output. Including minification of scripts and styles, tree-shaking, dead-code elimination, inlining of critical CSS and fonts inlining. For more information, see https://angular.io/guide/workspace-config#optimization-configuration.",
|
||||
"x-user-analytics": 16,
|
||||
"default": false,
|
||||
"default": true,
|
||||
"oneOf": [
|
||||
{
|
||||
"type": "object",
|
||||
@ -74,9 +79,29 @@
|
||||
"default": true
|
||||
},
|
||||
"styles": {
|
||||
"type": "boolean",
|
||||
"description": "Enables optimization of the styles output.",
|
||||
"default": true
|
||||
"default": true,
|
||||
"oneOf": [
|
||||
{
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"minify": {
|
||||
"type": "boolean",
|
||||
"description": "Minify CSS definitions by removing extraneous whitespace and comments, merging identifiers and minimizing values.",
|
||||
"default": true
|
||||
},
|
||||
"inlineCritical": {
|
||||
"type": "boolean",
|
||||
"description": "Extract and inline critical CSS definitions to improve first paint time.",
|
||||
"default": true
|
||||
}
|
||||
},
|
||||
"additionalProperties": false
|
||||
},
|
||||
{
|
||||
"type": "boolean"
|
||||
}
|
||||
]
|
||||
},
|
||||
"fonts": {
|
||||
"description": "Enables optimization for fonts. This option requires internet access. `HTTPS_PROXY` environment variable can be used to specify a proxy server.",
|
||||
@ -127,33 +152,33 @@
|
||||
"type": "boolean",
|
||||
"description": "Build using Ahead of Time compilation.",
|
||||
"x-user-analytics": 13,
|
||||
"default": false
|
||||
"default": true
|
||||
},
|
||||
"sourceMap": {
|
||||
"description": "Output sourcemaps.",
|
||||
"default": true,
|
||||
"description": "Output source maps for scripts and styles. For more information, see https://angular.io/guide/workspace-config#source-map-configuration.",
|
||||
"default": false,
|
||||
"oneOf": [
|
||||
{
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"scripts": {
|
||||
"type": "boolean",
|
||||
"description": "Output sourcemaps for all scripts.",
|
||||
"description": "Output source maps for all scripts.",
|
||||
"default": true
|
||||
},
|
||||
"styles": {
|
||||
"type": "boolean",
|
||||
"description": "Output sourcemaps for all styles.",
|
||||
"description": "Output source maps for all styles.",
|
||||
"default": true
|
||||
},
|
||||
"hidden": {
|
||||
"type": "boolean",
|
||||
"description": "Output sourcemaps used for error reporting tools.",
|
||||
"description": "Output source maps used for error reporting tools.",
|
||||
"default": false
|
||||
},
|
||||
"vendor": {
|
||||
"type": "boolean",
|
||||
"description": "Resolve vendor packages sourcemaps.",
|
||||
"description": "Resolve vendor packages source maps.",
|
||||
"default": false
|
||||
}
|
||||
},
|
||||
@ -166,12 +191,12 @@
|
||||
},
|
||||
"vendorChunk": {
|
||||
"type": "boolean",
|
||||
"description": "Use a separate bundle containing only vendor libraries.",
|
||||
"default": true
|
||||
"description": "Generate a seperate bundle containing only vendor libraries. This option should only used for development.",
|
||||
"default": false
|
||||
},
|
||||
"commonChunk": {
|
||||
"type": "boolean",
|
||||
"description": "Use a separate bundle containing code used across multiple bundles.",
|
||||
"description": "Generate a seperate bundle containing code used across multiple bundles.",
|
||||
"default": true
|
||||
},
|
||||
"baseHref": {
|
||||
@ -189,22 +214,8 @@
|
||||
},
|
||||
"progress": {
|
||||
"type": "boolean",
|
||||
"description": "Log progress to the console while building."
|
||||
},
|
||||
"i18nFile": {
|
||||
"type": "string",
|
||||
"description": "Localization file to use for i18n.",
|
||||
"x-deprecated": "Use 'locales' object in the project metadata instead."
|
||||
},
|
||||
"i18nFormat": {
|
||||
"type": "string",
|
||||
"description": "Format of the localization file specified with --i18n-file.",
|
||||
"x-deprecated": "No longer needed as the format will be determined automatically."
|
||||
},
|
||||
"i18nLocale": {
|
||||
"type": "string",
|
||||
"description": "Locale to use for i18n.",
|
||||
"x-deprecated": "Use 'localize' instead."
|
||||
"description": "Log progress to the console while building.",
|
||||
"default": true
|
||||
},
|
||||
"i18nMissingTranslation": {
|
||||
"type": "string",
|
||||
@ -213,6 +224,7 @@
|
||||
"default": "warning"
|
||||
},
|
||||
"localize": {
|
||||
"description": "Translate the bundles in one or more locales.",
|
||||
"oneOf": [
|
||||
{
|
||||
"type": "boolean",
|
||||
@ -231,8 +243,9 @@
|
||||
},
|
||||
"extractCss": {
|
||||
"type": "boolean",
|
||||
"description": "Extract css from global styles into css files instead of js ones.",
|
||||
"default": false
|
||||
"description": "Extract CSS from global styles into '.css' files instead of '.js'.",
|
||||
"default": true,
|
||||
"x-deprecated": "Deprecated since version 11.0. No longer required to disable CSS extraction for HMR."
|
||||
},
|
||||
"watch": {
|
||||
"type": "boolean",
|
||||
@ -261,23 +274,23 @@
|
||||
"extractLicenses": {
|
||||
"type": "boolean",
|
||||
"description": "Extract all licenses in a separate file.",
|
||||
"default": false
|
||||
"default": true
|
||||
},
|
||||
"showCircularDependencies": {
|
||||
"type": "boolean",
|
||||
"description": "Show circular dependency warnings on builds.",
|
||||
"default": false,
|
||||
"x-deprecated": "The recommended method to detect circular dependencies in project code is to use a either a lint rule or other external tooling."
|
||||
"x-deprecated": "The recommended method to detect circular dependencies in project code is to use either a lint rule or other external tooling."
|
||||
},
|
||||
"buildOptimizer": {
|
||||
"type": "boolean",
|
||||
"description": "Enables '@angular-devkit/build-optimizer' optimizations when using the 'aot' option.",
|
||||
"default": false
|
||||
"default": true
|
||||
},
|
||||
"namedChunks": {
|
||||
"type": "boolean",
|
||||
"description": "Use file name for lazy loaded chunks.",
|
||||
"default": true
|
||||
"default": false
|
||||
},
|
||||
"subresourceIntegrity": {
|
||||
"type": "boolean",
|
||||
@ -325,20 +338,6 @@
|
||||
"description": "Generates a 'stats.json' file which can be analyzed using tools such as 'webpack-bundle-analyzer'.",
|
||||
"default": false
|
||||
},
|
||||
"forkTypeChecker": {
|
||||
"type": "boolean",
|
||||
"description": "Run the TypeScript type checker in a forked process.",
|
||||
"default": true
|
||||
},
|
||||
"lazyModules": {
|
||||
"description": "List of additional NgModule files that will be lazy loaded. Lazy router modules will be discovered automatically.",
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "string"
|
||||
},
|
||||
"x-deprecated": "'SystemJsNgModuleLoader' is deprecated, and this is part of its usage. Use 'import()' syntax instead.",
|
||||
"default": []
|
||||
},
|
||||
"budgets": {
|
||||
"description": "Budget thresholds to ensure parts of your application stay within boundaries which you set.",
|
||||
"type": "array",
|
||||
@ -357,11 +356,6 @@
|
||||
"default": "none",
|
||||
"enum": ["none", "anonymous", "use-credentials"]
|
||||
},
|
||||
"experimentalRollupPass": {
|
||||
"type": "boolean",
|
||||
"description": "Concatenate modules with Rollup before bundling them with Webpack.",
|
||||
"default": false
|
||||
},
|
||||
"allowedCommonJsDependencies": {
|
||||
"description": "A list of CommonJS packages that are allowed to be used without a build time warning.",
|
||||
"type": "array",
|
||||
@ -384,6 +378,11 @@
|
||||
{
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"followSymlinks": {
|
||||
"type": "boolean",
|
||||
"default": false,
|
||||
"description": "Allow glob patterns to follow symlink directories. This allows subdirectories of the symlink to be searched."
|
||||
},
|
||||
"glob": {
|
||||
"type": "string",
|
||||
"description": "The pattern to match."
|
||||
@ -418,10 +417,12 @@
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"src": {
|
||||
"type": "string"
|
||||
"type": "string",
|
||||
"pattern": "\\.(([cm]?j|t)sx?|json)$"
|
||||
},
|
||||
"replaceWith": {
|
||||
"type": "string"
|
||||
"type": "string",
|
||||
"pattern": "\\.(([cm]?j|t)sx?|json)$"
|
||||
}
|
||||
},
|
||||
"additionalProperties": false,
|
||||
@ -431,10 +432,12 @@
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"replace": {
|
||||
"type": "string"
|
||||
"type": "string",
|
||||
"pattern": "\\.(([cm]?j|t)sx?|json)$"
|
||||
},
|
||||
"with": {
|
||||
"type": "string"
|
||||
"type": "string",
|
||||
"pattern": "\\.(([cm]?j|t)sx?|json)$"
|
||||
}
|
||||
},
|
||||
"additionalProperties": false,
|
||||
@ -453,14 +456,9 @@
|
||||
},
|
||||
"bundleName": {
|
||||
"type": "string",
|
||||
"pattern": "^[\\w\\-.]*$",
|
||||
"description": "The bundle name for this extra entry point."
|
||||
},
|
||||
"lazy": {
|
||||
"type": "boolean",
|
||||
"description": "If the bundle will be lazy loaded.",
|
||||
"default": false,
|
||||
"x-deprecated": "Use 'inject' option with 'false' value instead."
|
||||
},
|
||||
"inject": {
|
||||
"type": "boolean",
|
||||
"description": "If the bundle will be referenced in the HTML file.",
|
||||
|
||||
@ -4,9 +4,9 @@ exports[`convert-tslint-to-eslint should work for Angular applications 1`] = `
|
||||
Object {
|
||||
"dependencies": Object {},
|
||||
"devDependencies": Object {
|
||||
"@angular-eslint/eslint-plugin": "~4.2.0",
|
||||
"@angular-eslint/eslint-plugin-template": "~4.2.0",
|
||||
"@angular-eslint/template-parser": "~4.2.0",
|
||||
"@angular-eslint/eslint-plugin": "~12.0.0-alpha.0",
|
||||
"@angular-eslint/eslint-plugin-template": "~12.0.0-alpha.0",
|
||||
"@angular-eslint/template-parser": "~12.0.0-alpha.0",
|
||||
"@nrwl/eslint-plugin-nx": "*",
|
||||
"@nrwl/linter": "*",
|
||||
"@typescript-eslint/eslint-plugin": "4.19.0",
|
||||
@ -356,9 +356,9 @@ exports[`convert-tslint-to-eslint should work for Angular libraries 1`] = `
|
||||
Object {
|
||||
"dependencies": Object {},
|
||||
"devDependencies": Object {
|
||||
"@angular-eslint/eslint-plugin": "~4.2.0",
|
||||
"@angular-eslint/eslint-plugin-template": "~4.2.0",
|
||||
"@angular-eslint/template-parser": "~4.2.0",
|
||||
"@angular-eslint/eslint-plugin": "~12.0.0-alpha.0",
|
||||
"@angular-eslint/eslint-plugin-template": "~12.0.0-alpha.0",
|
||||
"@angular-eslint/template-parser": "~12.0.0-alpha.0",
|
||||
"@nrwl/eslint-plugin-nx": "*",
|
||||
"@nrwl/linter": "*",
|
||||
"@typescript-eslint/eslint-plugin": "4.19.0",
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
{
|
||||
"$schema": "http://json-schema.org/schema",
|
||||
"id": "angular-convert-tslint-to-eslint",
|
||||
"$id": "angular-convert-tslint-to-eslint",
|
||||
"cli": "nx",
|
||||
"title": "Convert an Angular project from TSLint to ESLint",
|
||||
"description": "NOTE: Does not work in --dry-run mode",
|
||||
|
||||
@ -0,0 +1,132 @@
|
||||
import { addProjectConfiguration, readJson, Tree } from '@nrwl/devkit';
|
||||
import { createTreeWithEmptyWorkspace } from '@nrwl/devkit/testing';
|
||||
|
||||
import update from './update-storybook';
|
||||
|
||||
describe('12.4.0 - Update Storybook', () => {
|
||||
let tree: Tree;
|
||||
beforeEach(() => {
|
||||
tree = createTreeWithEmptyWorkspace();
|
||||
jest.mock('@storybook/core/package.json', () => ({
|
||||
version: '6.2.0',
|
||||
}));
|
||||
});
|
||||
|
||||
afterEach(() => {
|
||||
jest.resetAllMocks();
|
||||
});
|
||||
|
||||
it('should update storybook config', async () => {
|
||||
addProjectConfiguration(tree, 'proj', {
|
||||
projectType: 'library',
|
||||
root: 'proj',
|
||||
targets: {
|
||||
storybook: {
|
||||
executor: '@nrwl/storybook:storybook',
|
||||
options: {
|
||||
uiFramework: '@storybook/angular',
|
||||
config: {
|
||||
configFolder: 'proj/.storybook',
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
});
|
||||
tree.write('proj/.storybook/main.js', 'module.exports = {};');
|
||||
jest.requireMock('@storybook/core/package.json').version = '6.2.0';
|
||||
jest.mock('/virtual/proj/.storybook/main.js', () => ({}), {
|
||||
virtual: true,
|
||||
});
|
||||
|
||||
await update(tree);
|
||||
|
||||
expect(tree.read('proj/.storybook/main.js').toString())
|
||||
.toMatchInlineSnapshot(`
|
||||
"module.exports = {};
|
||||
module.exports.core = { ...module.exports.core, builder: 'webpack5' };"
|
||||
`);
|
||||
expect(
|
||||
readJson(tree, 'package.json').devDependencies[
|
||||
'@storybook/builder-webpack5'
|
||||
]
|
||||
).toEqual('6.2.0');
|
||||
|
||||
// Should not do it again if run again
|
||||
jest.requireMock('/virtual/proj/.storybook/main.js').core = {
|
||||
builder: 'webpack5',
|
||||
};
|
||||
await update(tree);
|
||||
|
||||
expect(tree.read('proj/.storybook/main.js').toString())
|
||||
.toMatchInlineSnapshot(`
|
||||
"module.exports = {};
|
||||
module.exports.core = { ...module.exports.core, builder: 'webpack5' };"
|
||||
`);
|
||||
});
|
||||
|
||||
it('should error if storybook 5 is installed', async () => {
|
||||
addProjectConfiguration(tree, 'proj', {
|
||||
projectType: 'library',
|
||||
root: 'proj',
|
||||
targets: {
|
||||
storybook: {
|
||||
executor: '@nrwl/storybook:storybook',
|
||||
options: {
|
||||
uiFramework: '@storybook/angular',
|
||||
config: {
|
||||
configFolder: 'proj/.storybook',
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
});
|
||||
tree.write('proj/.storybook/main.js', 'module.exports = {};');
|
||||
jest.requireMock('@storybook/core/package.json').version = '5.2.0';
|
||||
jest.mock('/virtual/proj/.storybook/main.js', () => ({}), {
|
||||
virtual: true,
|
||||
});
|
||||
|
||||
try {
|
||||
await update(tree);
|
||||
fail('Should fail');
|
||||
} catch (e) {
|
||||
expect(e.message).toMatchInlineSnapshot(
|
||||
`"Could not migrate to Angular 12"`
|
||||
);
|
||||
}
|
||||
});
|
||||
|
||||
it('should not update projects that are not angular', async () => {
|
||||
addProjectConfiguration(tree, 'proj', {
|
||||
projectType: 'library',
|
||||
root: 'proj',
|
||||
targets: {
|
||||
storybook: {
|
||||
executor: '@nrwl/storybook:storybook',
|
||||
options: {
|
||||
uiFramework: '@storybook/react',
|
||||
config: {
|
||||
configFolder: 'proj/.storybook',
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
});
|
||||
tree.write('proj/.storybook/main.js', 'module.exports = {};');
|
||||
jest.requireMock('@storybook/core/package.json').version = '6.2.0';
|
||||
jest.mock('/virtual/proj/.storybook/main.js', () => ({}), {
|
||||
virtual: true,
|
||||
});
|
||||
|
||||
await update(tree);
|
||||
|
||||
expect(
|
||||
tree.read('proj/.storybook/main.js').toString()
|
||||
).toMatchInlineSnapshot(`"module.exports = {};"`);
|
||||
expect(
|
||||
readJson(tree, 'package.json').devDependencies[
|
||||
'@storybook/builder-webpack5'
|
||||
]
|
||||
).not.toBeDefined();
|
||||
});
|
||||
});
|
||||
@ -0,0 +1,82 @@
|
||||
import {
|
||||
addDependenciesToPackageJson,
|
||||
formatFiles,
|
||||
logger,
|
||||
stripIndents,
|
||||
Tree,
|
||||
} from '@nrwl/devkit';
|
||||
import { lt } from 'semver';
|
||||
import { join } from 'path';
|
||||
import { forEachExecutorOptions } from '@nrwl/workspace/src/utilities/executor-options-utils';
|
||||
import type { StorybookExecutorOptions } from '@nrwl/storybook/src/executors/storybook/storybook.impl';
|
||||
|
||||
export default async function (tree: Tree) {
|
||||
let storybookVersion;
|
||||
try {
|
||||
storybookVersion = require('@storybook/core/package.json').version;
|
||||
} catch {}
|
||||
|
||||
if (!storybookVersion) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (lt(storybookVersion, '6.2.0')) {
|
||||
logger.error(stripIndents`NX Could not migrate to Angular 12
|
||||
Angular 12 uses Webpack 5.
|
||||
This workspace uses Storybook ${storybookVersion} which does not support Webpack 5.
|
||||
Storybook 6.2+ is required to support Webpack 5.
|
||||
See our documentation on migrating to Storybook 6:
|
||||
https://nx.dev/angular/storybook/overview#upgrading-to-storybook-6-using-the-nx-migration-generator
|
||||
`);
|
||||
throw new Error('Could not migrate to Angular 12');
|
||||
}
|
||||
|
||||
let updated;
|
||||
forEachExecutorOptions<StorybookExecutorOptions>(
|
||||
tree,
|
||||
'@nrwl/storybook:storybook',
|
||||
(options) => {
|
||||
if (options.uiFramework !== '@storybook/angular') {
|
||||
return;
|
||||
}
|
||||
|
||||
const configFolder = options?.config?.configFolder;
|
||||
|
||||
if (!configFolder) {
|
||||
return;
|
||||
}
|
||||
|
||||
const configPath = join(configFolder, 'main.js');
|
||||
|
||||
if (!tree.exists(configPath)) {
|
||||
logger.warn(
|
||||
`Could not migrate ${configPath} to use webpack 5. The config.core.builder should be set to "webpack5". See https://gist.github.com/shilman/8856ea1786dcd247139b47b270912324#upgrade`
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
updated = true;
|
||||
const originalContents = tree.read(configPath).toString();
|
||||
const configureWebpack5 = `module.exports.core = { ...module.exports.core, builder: 'webpack5' };`;
|
||||
try {
|
||||
const config = require(join(tree.root, configPath));
|
||||
if (config?.core?.builder !== 'webpack5') {
|
||||
tree.write(configPath, originalContents + '\n' + configureWebpack5);
|
||||
}
|
||||
} catch {}
|
||||
}
|
||||
);
|
||||
|
||||
const installTask = updated
|
||||
? addDependenciesToPackageJson(
|
||||
tree,
|
||||
{},
|
||||
{
|
||||
'@storybook/builder-webpack5': storybookVersion,
|
||||
}
|
||||
)
|
||||
: () => {};
|
||||
await formatFiles(tree);
|
||||
|
||||
return installTask;
|
||||
}
|
||||
@ -0,0 +1,90 @@
|
||||
import { addProjectConfiguration, readJson, Tree } from '@nrwl/devkit';
|
||||
import { createTreeWithEmptyWorkspace } from '@nrwl/devkit/testing';
|
||||
import updateAngularConfig from './update-webpack-browser-config';
|
||||
|
||||
function getBuildTarget(tree: Tree) {
|
||||
return readJson(tree, 'workspace.json').projects['ng-app'].architect.build;
|
||||
}
|
||||
|
||||
describe('Migration to update targets with @nrwl/angular:webpack-browser executor', () => {
|
||||
let tree: Tree;
|
||||
|
||||
beforeEach(async () => {
|
||||
tree = createTreeWithEmptyWorkspace();
|
||||
|
||||
addProjectConfiguration(tree, 'ng-app', {
|
||||
root: '',
|
||||
sourceRoot: 'src',
|
||||
projectType: 'application',
|
||||
targets: {
|
||||
build: {
|
||||
executor: '@nrwl/angular:webpack-browser',
|
||||
options: {
|
||||
aot: true,
|
||||
optimization: true,
|
||||
experimentalRollupPass: false,
|
||||
buildOptimizer: false,
|
||||
namedChunks: true,
|
||||
} as any,
|
||||
configurations: {
|
||||
one: {
|
||||
aot: true,
|
||||
},
|
||||
two: {
|
||||
experimentalRollupPass: true,
|
||||
aot: false,
|
||||
optimization: false,
|
||||
},
|
||||
} as any,
|
||||
},
|
||||
},
|
||||
});
|
||||
});
|
||||
|
||||
it(`should remove 'experimentalRollupPass'`, async () => {
|
||||
await updateAngularConfig(tree);
|
||||
const { configurations, options } = getBuildTarget(tree);
|
||||
|
||||
expect(options.experimentalRollupPass).toBeUndefined();
|
||||
expect(options.buildOptimizer).toBe(false);
|
||||
expect(configurations).toBeDefined();
|
||||
expect(configurations?.one.experimentalRollupPass).toBeUndefined();
|
||||
expect(configurations?.two.experimentalRollupPass).toBeUndefined();
|
||||
});
|
||||
|
||||
it(`should remove value from "options" section which value is now the new default`, async () => {
|
||||
await updateAngularConfig(tree);
|
||||
const { configurations, options } = getBuildTarget(tree);
|
||||
|
||||
expect(options.aot).toBeUndefined();
|
||||
expect(configurations?.one.aot).toBeUndefined();
|
||||
expect(configurations?.two.aot).toBe(false);
|
||||
});
|
||||
|
||||
it(`should remove value from "configuration" section when value is the same as that of "options"`, async () => {
|
||||
await updateAngularConfig(tree);
|
||||
const { configurations, options } = getBuildTarget(tree);
|
||||
|
||||
expect(options.aot).toBeUndefined();
|
||||
expect(configurations?.one.aot).toBeUndefined();
|
||||
expect(configurations?.two.aot).toBe(false);
|
||||
});
|
||||
|
||||
it(`should add value in "options" section when option was not defined`, async () => {
|
||||
await updateAngularConfig(tree);
|
||||
const { configurations, options } = getBuildTarget(tree);
|
||||
|
||||
expect(options.sourceMap).toBe(true);
|
||||
expect(configurations?.one.sourceMap).toBeUndefined();
|
||||
expect(configurations?.two.sourceMap).toBeUndefined();
|
||||
expect(configurations?.two.optimization).toBe(false);
|
||||
});
|
||||
|
||||
it(`should not remove value in "options" when value is not the new default`, async () => {
|
||||
await updateAngularConfig(tree);
|
||||
const { options } = getBuildTarget(tree);
|
||||
|
||||
expect(options.namedChunks).toBe(true);
|
||||
expect(options.buildOptimizer).toBe(false);
|
||||
});
|
||||
});
|
||||
@ -0,0 +1,92 @@
|
||||
import {
|
||||
formatFiles,
|
||||
getProjects,
|
||||
TargetConfiguration,
|
||||
Tree,
|
||||
updateProjectConfiguration,
|
||||
} from '@nrwl/devkit';
|
||||
|
||||
type ExecutorOptionsType = Readonly<
|
||||
[
|
||||
optionName: string,
|
||||
oldDefault: boolean | undefined,
|
||||
newDefault: boolean | undefined
|
||||
][]
|
||||
>;
|
||||
|
||||
const optionsToUpdate: ExecutorOptionsType = [
|
||||
['aot', false, true],
|
||||
['vendorChunk', true, false],
|
||||
['extractLicenses', false, true],
|
||||
['buildOptimizer', false, true],
|
||||
['sourceMap', true, false],
|
||||
['optimization', false, true],
|
||||
['namedChunks', true, false],
|
||||
];
|
||||
|
||||
export default async function updateAngularConfig(host: Tree) {
|
||||
const projects = getProjects(host);
|
||||
|
||||
for (const [name, project] of projects) {
|
||||
for (const target of Object.values(project.targets)) {
|
||||
if (target.executor === '@nrwl/angular:webpack-browser') {
|
||||
updateOptions(target, optionsToUpdate);
|
||||
|
||||
for (const options of allTargetOptions(target)) {
|
||||
delete options.experimentalRollupPass;
|
||||
delete options.lazyModules;
|
||||
delete options.forkTypeChecker;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
updateProjectConfiguration(host, name, project);
|
||||
}
|
||||
|
||||
await formatFiles(host);
|
||||
}
|
||||
|
||||
function* allTargetOptions(target: TargetConfiguration): IterableIterator<any> {
|
||||
if (target.options) {
|
||||
yield target.options;
|
||||
}
|
||||
|
||||
if (!target.configurations) {
|
||||
return;
|
||||
}
|
||||
|
||||
for (const [, options] of Object.entries(target.configurations)) {
|
||||
if (options !== undefined) {
|
||||
yield options;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function updateOptions(
|
||||
target: TargetConfiguration,
|
||||
options: typeof optionsToUpdate
|
||||
): void {
|
||||
if (!target.options) {
|
||||
target.options = {};
|
||||
}
|
||||
|
||||
const configurationOptions =
|
||||
target.configurations && Object.values(target.configurations);
|
||||
|
||||
for (const [optionName, oldDefault, newDefault] of options) {
|
||||
let value = target.options[optionName];
|
||||
if (value === newDefault) {
|
||||
// Value is same as new default
|
||||
delete target.options[optionName];
|
||||
} else if (value === undefined) {
|
||||
// Value is not defined, hence the default in the executor was used.
|
||||
target.options[optionName] = oldDefault;
|
||||
value = oldDefault;
|
||||
}
|
||||
|
||||
// Remove overrides in configurations which are no longer needed.
|
||||
configurationOptions
|
||||
?.filter((o) => o && o[optionName] === value)
|
||||
.forEach((o) => o && delete o[optionName]);
|
||||
}
|
||||
}
|
||||
@ -1,11 +1,9 @@
|
||||
import { join, normalize } from '@angular-devkit/core';
|
||||
import { chain, noop, Rule, Tree } from '@angular-devkit/schematics';
|
||||
import { chain, Rule, Tree } from '@angular-devkit/schematics';
|
||||
import { wrapAngularDevkitSchematic } from '@nrwl/devkit/ngcli-adapter';
|
||||
import {
|
||||
addLintFiles,
|
||||
getWorkspacePath,
|
||||
Linter,
|
||||
offsetFromRoot,
|
||||
updateJsonInTree,
|
||||
} from '@nrwl/workspace';
|
||||
import {
|
||||
@ -17,106 +15,24 @@ import { Schema } from './schema';
|
||||
|
||||
export default function addLinting(options: Schema): Rule {
|
||||
return chain([
|
||||
addLintFiles(options.projectRoot, options.linter, {
|
||||
onlyGlobal: options.linter === Linter.TsLint, // local lint files are added differently when tslint
|
||||
localConfig:
|
||||
options.linter === Linter.TsLint
|
||||
? undefined
|
||||
: createAngularEslintJson(options.projectRoot, options.prefix),
|
||||
extraPackageDeps:
|
||||
options.linter === Linter.TsLint ? undefined : extraEslintDependencies,
|
||||
addLintFiles(options.projectRoot, Linter.EsLint, {
|
||||
onlyGlobal: false,
|
||||
localConfig: createAngularEslintJson(options.projectRoot, options.prefix),
|
||||
extraPackageDeps: extraEslintDependencies,
|
||||
}),
|
||||
options.projectType === 'application' && options.linter === Linter.TsLint
|
||||
? updateTsLintConfig(options)
|
||||
: noop(),
|
||||
options.projectType === 'library' && options.linter === Linter.TsLint
|
||||
? updateJsonInTree(`${options.projectRoot}/tslint.json`, (json) => {
|
||||
return {
|
||||
...json,
|
||||
extends: `${offsetFromRoot(options.projectRoot)}tslint.json`,
|
||||
linterOptions: {
|
||||
exclude: ['!**/*'],
|
||||
},
|
||||
};
|
||||
})
|
||||
: noop(),
|
||||
updateProject(options),
|
||||
]);
|
||||
}
|
||||
|
||||
function updateTsLintConfig(options: Schema): Rule {
|
||||
return chain([
|
||||
updateJsonInTree('tslint.json', (json) => {
|
||||
if (
|
||||
json.rulesDirectory &&
|
||||
json.rulesDirectory.indexOf('node_modules/codelyzer') === -1
|
||||
) {
|
||||
json.rulesDirectory.push('node_modules/codelyzer');
|
||||
json.rules = {
|
||||
...json.rules,
|
||||
|
||||
'directive-selector': [true, 'attribute', 'app', 'camelCase'],
|
||||
'component-selector': [true, 'element', 'app', 'kebab-case'],
|
||||
'no-conflicting-lifecycle': true,
|
||||
'no-host-metadata-property': true,
|
||||
'no-input-rename': true,
|
||||
'no-inputs-metadata-property': true,
|
||||
'no-output-native': true,
|
||||
'no-output-on-prefix': true,
|
||||
'no-output-rename': true,
|
||||
'no-outputs-metadata-property': true,
|
||||
'template-banana-in-box': true,
|
||||
'template-no-negated-async': true,
|
||||
'use-lifecycle-interface': true,
|
||||
'use-pipe-transform-interface': true,
|
||||
};
|
||||
}
|
||||
return json;
|
||||
}),
|
||||
updateJsonInTree(`${options.projectRoot}/tslint.json`, (json) => {
|
||||
json.extends = `${offsetFromRoot(options.projectRoot)}tslint.json`;
|
||||
json.linterOptions = {
|
||||
exclude: ['!**/*'],
|
||||
};
|
||||
return json;
|
||||
}),
|
||||
]);
|
||||
}
|
||||
|
||||
function updateProject(options: Schema): Rule {
|
||||
return (host: Tree) => {
|
||||
return chain([
|
||||
updateJsonInTree(getWorkspacePath(host), (json) => {
|
||||
const project = json.projects[options.projectName];
|
||||
|
||||
if (options.linter === Linter.TsLint) {
|
||||
project.architect.lint.options.exclude.push(
|
||||
'!' + join(normalize(options.projectRoot), '**/*')
|
||||
);
|
||||
|
||||
if (options.projectType === 'application') {
|
||||
project.architect.lint.options.tsConfig = project.architect.lint.options.tsConfig.filter(
|
||||
(path) =>
|
||||
path !==
|
||||
join(normalize(options.projectRoot), 'tsconfig.spec.json') &&
|
||||
path !==
|
||||
join(normalize(options.projectRoot), 'e2e/tsconfig.json')
|
||||
);
|
||||
}
|
||||
|
||||
if (options.projectType === 'library') {
|
||||
project.architect.lint.options.tsConfig = Array.from(
|
||||
new Set(project.architect.lint.options.tsConfig)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
if (options.linter === Linter.EsLint) {
|
||||
project.architect.lint = createAngularProjectESLintLintTarget(
|
||||
options.projectRoot
|
||||
);
|
||||
host.delete(`${options.projectRoot}/tslint.json`);
|
||||
}
|
||||
project.architect.lint = createAngularProjectESLintLintTarget(
|
||||
options.projectRoot
|
||||
);
|
||||
|
||||
json.projects[options.projectName] = project;
|
||||
return json;
|
||||
|
||||
@ -2,8 +2,6 @@ import { Linter } from '@nrwl/workspace';
|
||||
|
||||
export interface Schema {
|
||||
projectName: string;
|
||||
projectType: 'application' | 'library';
|
||||
projectRoot: string;
|
||||
prefix: string;
|
||||
linter: Linter;
|
||||
}
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
{
|
||||
"$schema": "http://json-schema.org/schema",
|
||||
"id": "SchematicsAngularAddLinting",
|
||||
"$id": "SchematicsAngularAddLinting",
|
||||
"title": "Add linting to an Angular project",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
@ -13,19 +13,9 @@
|
||||
"type": "string",
|
||||
"description": "The name of the selected project."
|
||||
},
|
||||
"projectType": {
|
||||
"type": "string",
|
||||
"enum": ["application", "library"]
|
||||
},
|
||||
"projectRoot": {
|
||||
"type": "string",
|
||||
"description": "The path to the root of the selected project."
|
||||
},
|
||||
"linter": {
|
||||
"description": "The tool to use for running lint checks.",
|
||||
"type": "string",
|
||||
"enum": ["tslint", "eslint"],
|
||||
"default": "eslint"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -6,36 +6,38 @@ Object {
|
||||
"build": Object {
|
||||
"builder": "@angular-devkit/build-angular:browser",
|
||||
"configurations": Object {
|
||||
"development": Object {
|
||||
"buildOptimizer": false,
|
||||
"extractLicenses": false,
|
||||
"namedChunks": true,
|
||||
"optimization": false,
|
||||
"sourceMap": true,
|
||||
"vendorChunk": true,
|
||||
},
|
||||
"production": Object {
|
||||
"budgets": Array [
|
||||
Object {
|
||||
"maximumError": "5mb",
|
||||
"maximumWarning": "2mb",
|
||||
"maximumError": "1mb",
|
||||
"maximumWarning": "500kb",
|
||||
"type": "initial",
|
||||
},
|
||||
Object {
|
||||
"maximumError": "10kb",
|
||||
"maximumWarning": "6kb",
|
||||
"maximumError": "4kb",
|
||||
"maximumWarning": "2kb",
|
||||
"type": "anyComponentStyle",
|
||||
},
|
||||
],
|
||||
"buildOptimizer": true,
|
||||
"extractLicenses": true,
|
||||
"fileReplacements": Array [
|
||||
Object {
|
||||
"replace": "apps/my-dir/my-app/src/environments/environment.ts",
|
||||
"with": "apps/my-dir/my-app/src/environments/environment.prod.ts",
|
||||
},
|
||||
],
|
||||
"namedChunks": false,
|
||||
"optimization": true,
|
||||
"outputHashing": "all",
|
||||
"sourceMap": false,
|
||||
"vendorChunk": false,
|
||||
},
|
||||
},
|
||||
"defaultConfiguration": "production",
|
||||
"options": Object {
|
||||
"aot": true,
|
||||
"assets": Array [
|
||||
"apps/my-dir/my-app/src/favicon.ico",
|
||||
"apps/my-dir/my-app/src/assets",
|
||||
@ -69,13 +71,14 @@ Object {
|
||||
"serve": Object {
|
||||
"builder": "@angular-devkit/build-angular:dev-server",
|
||||
"configurations": Object {
|
||||
"development": Object {
|
||||
"browserTarget": "my-dir-my-app:build:development",
|
||||
},
|
||||
"production": Object {
|
||||
"browserTarget": "my-dir-my-app:build:production",
|
||||
},
|
||||
},
|
||||
"options": Object {
|
||||
"browserTarget": "my-dir-my-app:build",
|
||||
},
|
||||
"defaultConfiguration": "development",
|
||||
},
|
||||
"test": Object {
|
||||
"builder": "@nrwl/jest:jest",
|
||||
@ -132,36 +135,38 @@ Object {
|
||||
"build": Object {
|
||||
"builder": "@angular-devkit/build-angular:browser",
|
||||
"configurations": Object {
|
||||
"development": Object {
|
||||
"buildOptimizer": false,
|
||||
"extractLicenses": false,
|
||||
"namedChunks": true,
|
||||
"optimization": false,
|
||||
"sourceMap": true,
|
||||
"vendorChunk": true,
|
||||
},
|
||||
"production": Object {
|
||||
"budgets": Array [
|
||||
Object {
|
||||
"maximumError": "5mb",
|
||||
"maximumWarning": "2mb",
|
||||
"maximumError": "1mb",
|
||||
"maximumWarning": "500kb",
|
||||
"type": "initial",
|
||||
},
|
||||
Object {
|
||||
"maximumError": "10kb",
|
||||
"maximumWarning": "6kb",
|
||||
"maximumError": "4kb",
|
||||
"maximumWarning": "2kb",
|
||||
"type": "anyComponentStyle",
|
||||
},
|
||||
],
|
||||
"buildOptimizer": true,
|
||||
"extractLicenses": true,
|
||||
"fileReplacements": Array [
|
||||
Object {
|
||||
"replace": "apps/my-app/src/environments/environment.ts",
|
||||
"with": "apps/my-app/src/environments/environment.prod.ts",
|
||||
},
|
||||
],
|
||||
"namedChunks": false,
|
||||
"optimization": true,
|
||||
"outputHashing": "all",
|
||||
"sourceMap": false,
|
||||
"vendorChunk": false,
|
||||
},
|
||||
},
|
||||
"defaultConfiguration": "production",
|
||||
"options": Object {
|
||||
"aot": true,
|
||||
"assets": Array [
|
||||
"apps/my-app/src/favicon.ico",
|
||||
"apps/my-app/src/assets",
|
||||
@ -195,13 +200,14 @@ Object {
|
||||
"serve": Object {
|
||||
"builder": "@angular-devkit/build-angular:dev-server",
|
||||
"configurations": Object {
|
||||
"development": Object {
|
||||
"browserTarget": "my-app:build:development",
|
||||
},
|
||||
"production": Object {
|
||||
"browserTarget": "my-app:build:production",
|
||||
},
|
||||
},
|
||||
"options": Object {
|
||||
"browserTarget": "my-app:build",
|
||||
},
|
||||
"defaultConfiguration": "development",
|
||||
},
|
||||
"test": Object {
|
||||
"builder": "@nrwl/jest:jest",
|
||||
|
||||
@ -441,65 +441,15 @@ describe('app', () => {
|
||||
});
|
||||
});
|
||||
|
||||
describe('tslint', () => {
|
||||
it('should add an architect target for lint', async () => {
|
||||
describe('none', () => {
|
||||
it('should not add an architect target for lint', async () => {
|
||||
const tree = await runSchematic(
|
||||
'app',
|
||||
{ name: 'myApp', linter: 'tslint' },
|
||||
{ name: 'myApp', linter: 'none' },
|
||||
appTree
|
||||
);
|
||||
const workspaceJson = readJsonInTree(tree, 'workspace.json');
|
||||
expect(workspaceJson.projects['my-app'].architect.lint)
|
||||
.toMatchInlineSnapshot(`
|
||||
Object {
|
||||
"builder": "@angular-devkit/build-angular:tslint",
|
||||
"options": Object {
|
||||
"exclude": Array [
|
||||
"**/node_modules/**",
|
||||
"!apps/my-app/**/*",
|
||||
],
|
||||
"tsConfig": Array [
|
||||
"apps/my-app/tsconfig.app.json",
|
||||
"apps/my-app/tsconfig.spec.json",
|
||||
"apps/my-app/tsconfig.editor.json",
|
||||
],
|
||||
},
|
||||
}
|
||||
`);
|
||||
});
|
||||
|
||||
it('should add valid tslint JSON configuration', async () => {
|
||||
const tree = await runSchematic(
|
||||
'app',
|
||||
{ name: 'myApp', linter: 'tslint' },
|
||||
appTree
|
||||
);
|
||||
|
||||
const tslintConfig = readJsonInTree(tree, 'apps/my-app/tslint.json');
|
||||
expect(tslintConfig).toMatchInlineSnapshot(`
|
||||
Object {
|
||||
"extends": "../../tslint.json",
|
||||
"linterOptions": Object {
|
||||
"exclude": Array [
|
||||
"!**/*",
|
||||
],
|
||||
},
|
||||
"rules": Object {
|
||||
"component-selector": Array [
|
||||
true,
|
||||
"element",
|
||||
"proj",
|
||||
"kebab-case",
|
||||
],
|
||||
"directive-selector": Array [
|
||||
true,
|
||||
"attribute",
|
||||
"proj",
|
||||
"camelCase",
|
||||
],
|
||||
},
|
||||
}
|
||||
`);
|
||||
expect(workspaceJson.projects['my-app'].architect.lint).toBeUndefined();
|
||||
});
|
||||
});
|
||||
});
|
||||
@ -586,14 +536,17 @@ describe('app', () => {
|
||||
e2e: {
|
||||
builder: '@angular-devkit/build-angular:protractor',
|
||||
options: {
|
||||
devServerTarget: 'my-app:serve',
|
||||
protractorConfig: 'apps/my-app-e2e/protractor.conf.js',
|
||||
},
|
||||
configurations: {
|
||||
development: {
|
||||
devServerTarget: 'my-app:serve:development',
|
||||
},
|
||||
production: {
|
||||
devServerTarget: 'my-app:serve:production',
|
||||
},
|
||||
},
|
||||
defaultConfiguration: 'development',
|
||||
},
|
||||
lint: {
|
||||
builder: '@nrwl/linter:eslint',
|
||||
|
||||
@ -466,12 +466,6 @@ function updateProject(options: NormalizedSchema): Rule {
|
||||
...json.compilerOptions,
|
||||
outDir: `${offsetFromRoot(options.appProjectRoot)}dist/out-tsc`,
|
||||
},
|
||||
exclude: options.enableIvy
|
||||
? undefined
|
||||
: options.unitTestRunner === 'jest'
|
||||
? ['src/test-setup.ts', '**/*.spec.ts']
|
||||
: ['src/test.ts', '**/*.spec.ts'],
|
||||
include: options.enableIvy ? undefined : ['src/**/*.d.ts'],
|
||||
};
|
||||
}
|
||||
),
|
||||
@ -601,20 +595,6 @@ function addEditorTsConfigReference(options: NormalizedSchema): Rule {
|
||||
return json;
|
||||
}
|
||||
),
|
||||
updateWorkspace((workspace) => {
|
||||
const projectConfig = workspace.projects.get(options.name);
|
||||
const lintTarget = projectConfig.targets.get('lint');
|
||||
|
||||
const isUsingTSLint =
|
||||
lintTarget?.builder === '@angular-devkit/build-angular:tslint';
|
||||
|
||||
if (isUsingTSLint) {
|
||||
const tsConfigs = lintTarget.options.tsConfig as string[];
|
||||
tsConfigs.push(
|
||||
join(normalize(options.appProjectRoot), 'tsconfig.editor.json')
|
||||
);
|
||||
}
|
||||
}),
|
||||
]);
|
||||
}
|
||||
|
||||
@ -634,7 +614,10 @@ function addProxyConfig(options: NormalizedSchema): Rule {
|
||||
};
|
||||
}),
|
||||
updateWorkspaceInTree((json) => {
|
||||
projectConfig.architect.serve.options.proxyConfig = pathToProxyFile;
|
||||
projectConfig.architect.serve.options = {
|
||||
...projectConfig.architect.serve.options,
|
||||
proxyConfig: pathToProxyFile,
|
||||
};
|
||||
json.projects[options.name] = projectConfig;
|
||||
return json;
|
||||
}),
|
||||
@ -703,6 +686,19 @@ function enableStrictTypeChecking(schema: Schema): Rule {
|
||||
};
|
||||
}
|
||||
|
||||
function addProtractor(
|
||||
options: NormalizedSchema,
|
||||
e2eProjectRoot: string
|
||||
): Rule {
|
||||
return chain([
|
||||
externalSchematic('@schematics/angular', 'e2e', {
|
||||
relatedAppName: options.name,
|
||||
rootSelector: `${options.prefix}-root`,
|
||||
}),
|
||||
move(e2eProjectRoot, options.e2eProjectRoot),
|
||||
]);
|
||||
}
|
||||
|
||||
export default function (schema: Schema): Rule {
|
||||
return (host: Tree, context: SchematicContext) => {
|
||||
const options = normalizeOptions(host, schema);
|
||||
@ -731,14 +727,13 @@ export default function (schema: Schema): Rule {
|
||||
skipTests: options.skipTests,
|
||||
style: options.style,
|
||||
viewEncapsulation: options.viewEncapsulation,
|
||||
enableIvy: options.enableIvy,
|
||||
routing: false,
|
||||
skipInstall: true,
|
||||
skipPackageJson: false,
|
||||
}),
|
||||
addSchematicFiles(appProjectRoot, options),
|
||||
options.e2eTestRunner === 'protractor'
|
||||
? move(e2eProjectRoot, options.e2eProjectRoot)
|
||||
? addProtractor(options, e2eProjectRoot)
|
||||
: removeE2e(options, e2eProjectRoot),
|
||||
options.e2eTestRunner === 'protractor'
|
||||
? updateE2eProject(options)
|
||||
@ -749,7 +744,7 @@ export default function (schema: Schema): Rule {
|
||||
updateComponentStyles(options),
|
||||
options.unitTestRunner !== 'none' ? updateComponentSpec(options) : noop(),
|
||||
options.routing ? addRouterRootConfiguration(options) : noop(),
|
||||
addLinting(options),
|
||||
options.linter === Linter.EsLint ? addLinting(options) : noop(),
|
||||
options.unitTestRunner === 'jest'
|
||||
? externalSchematic('@nrwl/jest', 'jest-project', {
|
||||
project: options.name,
|
||||
@ -784,25 +779,11 @@ export default function (schema: Schema): Rule {
|
||||
const addLinting = (options: NormalizedSchema) => () => {
|
||||
return chain([
|
||||
schematic('add-linting', {
|
||||
linter: options.linter,
|
||||
projectType: 'application',
|
||||
projectName: options.name,
|
||||
projectRoot: options.appProjectRoot,
|
||||
prefix: options.prefix,
|
||||
}),
|
||||
/**
|
||||
* I cannot explain why this extra rule is needed, the add-linting
|
||||
* schematic applies the exact same host.delete() call but the main
|
||||
* chain of this schematic still preserves it...
|
||||
*/
|
||||
(host) => {
|
||||
if (
|
||||
options.linter === Linter.EsLint &&
|
||||
host.exists(`${options.appProjectRoot}/tslint.json`)
|
||||
) {
|
||||
host.delete(`${options.appProjectRoot}/tslint.json`);
|
||||
}
|
||||
},
|
||||
]);
|
||||
};
|
||||
|
||||
|
||||
@ -9,13 +9,12 @@ export interface Schema {
|
||||
inlineTemplate?: boolean;
|
||||
viewEncapsulation?: 'Emulated' | 'Native' | 'None';
|
||||
routing?: boolean;
|
||||
enableIvy?: boolean;
|
||||
prefix?: string;
|
||||
style?: string;
|
||||
skipTests?: boolean;
|
||||
directory?: string;
|
||||
tags?: string;
|
||||
linter: Linter;
|
||||
linter: Exclude<Linter, Linter.TsLint>;
|
||||
unitTestRunner: UnitTestRunner;
|
||||
e2eTestRunner: E2eTestRunner;
|
||||
backendProject?: string;
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
{
|
||||
"$schema": "http://json-schema.org/schema",
|
||||
"id": "SchematicsNxApp",
|
||||
"$id": "SchematicsNxApp",
|
||||
"title": "Nx Application Options Schema",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
@ -68,11 +68,6 @@
|
||||
"enum": ["Emulated", "Native", "None"],
|
||||
"type": "string"
|
||||
},
|
||||
"enableIvy": {
|
||||
"description": "Create a new app that uses the Ivy rendering engine.",
|
||||
"type": "boolean",
|
||||
"default": true
|
||||
},
|
||||
"prefix": {
|
||||
"type": "string",
|
||||
"format": "html-selector",
|
||||
@ -114,7 +109,7 @@
|
||||
"linter": {
|
||||
"description": "The tool to use for running lint checks.",
|
||||
"type": "string",
|
||||
"enum": ["tslint", "eslint"],
|
||||
"enum": ["eslint", "none"],
|
||||
"default": "eslint"
|
||||
},
|
||||
"backendProject": {
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
{
|
||||
"$schema": "http://json-schema.org/schema",
|
||||
"id": "component-cypress-spec",
|
||||
"$id": "NxAngularComponentCypressSpec",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"projectName": {
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
{
|
||||
"$schema": "http://json-schema.org/schema",
|
||||
"id": "component-story",
|
||||
"$id": "NxAngularComponentStory",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"projectPath": {
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
{
|
||||
"$schema": "http://json-schema.org/schema",
|
||||
"id": "SchematicsNxDowngradeModule",
|
||||
"$id": "SchematicsNxDowngradeModule",
|
||||
"title": "Generates downgradeModule setup",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
|
||||
@ -230,34 +230,22 @@ describe('init', () => {
|
||||
});
|
||||
});
|
||||
|
||||
describe('tslint', () => {
|
||||
it('should set the default to tslint', async () => {
|
||||
describe('none', () => {
|
||||
it('should set the default to none', async () => {
|
||||
const tree = await runSchematic(
|
||||
'init',
|
||||
{
|
||||
linter: 'tslint',
|
||||
linter: 'none',
|
||||
},
|
||||
appTree
|
||||
);
|
||||
const workspaceJson = readJsonInTree(tree, 'workspace.json');
|
||||
expect(
|
||||
workspaceJson.schematics['@nrwl/angular:application'].linter
|
||||
).toEqual('tslint');
|
||||
).toEqual('none');
|
||||
expect(
|
||||
workspaceJson.schematics['@nrwl/angular:library'].linter
|
||||
).toEqual('tslint');
|
||||
});
|
||||
|
||||
it('should add codelyzer', async () => {
|
||||
const tree = await runSchematic(
|
||||
'init',
|
||||
{
|
||||
linter: 'tslint',
|
||||
},
|
||||
appTree
|
||||
);
|
||||
const { devDependencies } = readJsonInTree(tree, 'package.json');
|
||||
expect(devDependencies['codelyzer']).toBeDefined();
|
||||
).toEqual('none');
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@ -13,10 +13,8 @@ import {
|
||||
setDefaultCollection,
|
||||
updateJsonInTree,
|
||||
updateWorkspace,
|
||||
Linter,
|
||||
} from '@nrwl/workspace';
|
||||
import {
|
||||
angularDevkitVersion,
|
||||
angularVersion,
|
||||
jestPresetAngularVersion,
|
||||
rxjsVersion,
|
||||
@ -24,7 +22,7 @@ import {
|
||||
import { Schema } from './schema';
|
||||
import { E2eTestRunner, UnitTestRunner } from '../../utils/test-runners';
|
||||
|
||||
const updateDependencies = (options: Pick<Schema, 'linter'>): Rule =>
|
||||
const updateDependencies = (): Rule =>
|
||||
addDepsToPackageJson(
|
||||
{
|
||||
'@angular/animations': angularVersion,
|
||||
@ -37,13 +35,12 @@ const updateDependencies = (options: Pick<Schema, 'linter'>): Rule =>
|
||||
'@angular/router': angularVersion,
|
||||
rxjs: rxjsVersion,
|
||||
tslib: '^2.0.0',
|
||||
'zone.js': '^0.10.2',
|
||||
'zone.js': '~0.11.4',
|
||||
},
|
||||
{
|
||||
'@angular/compiler-cli': angularVersion,
|
||||
'@angular/language-service': angularVersion,
|
||||
'@angular-devkit/build-angular': angularDevkitVersion,
|
||||
codelyzer: options.linter === Linter.TsLint ? '^6.0.0' : undefined,
|
||||
'@angular-devkit/build-angular': angularVersion,
|
||||
}
|
||||
);
|
||||
|
||||
@ -54,6 +51,9 @@ export function addUnitTestRunner(
|
||||
case UnitTestRunner.Karma:
|
||||
return schematic('karma', {});
|
||||
case UnitTestRunner.Jest:
|
||||
// TODO: remove this when we use `jest-preset-angular@9.0.0`
|
||||
process.env.npm_config_legacy_peer_deps = 'true';
|
||||
|
||||
return chain([
|
||||
addDepsToPackageJson(
|
||||
{},
|
||||
@ -163,7 +163,7 @@ export default function (options: Schema): Rule {
|
||||
setDefaults(options),
|
||||
// TODO: Remove this when ngcc can be run in parallel
|
||||
addPostinstall(),
|
||||
updateDependencies(options),
|
||||
updateDependencies(),
|
||||
addUnitTestRunner(options),
|
||||
addE2eTestRunner(options),
|
||||
formatFiles(options),
|
||||
|
||||
@ -7,5 +7,5 @@ export interface Schema {
|
||||
skipFormat: boolean;
|
||||
skipInstall?: boolean;
|
||||
style?: string;
|
||||
linter: Linter;
|
||||
linter: Exclude<Linter, Linter.TsLint>;
|
||||
}
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
{
|
||||
"$schema": "http://json-schema.org/schema",
|
||||
"id": "SchematicsAngularModuleInit",
|
||||
"$id": "SchematicsAngularModuleInit",
|
||||
"title": "Init Angular Plugin",
|
||||
"description": "NOTE: Does not work in the --dry-run mode",
|
||||
"type": "object",
|
||||
@ -30,7 +30,7 @@
|
||||
"linter": {
|
||||
"description": "The tool to use for running lint checks.",
|
||||
"type": "string",
|
||||
"enum": ["tslint", "eslint"],
|
||||
"enum": ["eslint", "none"],
|
||||
"default": "eslint"
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
import { Tree } from '@angular-devkit/schematics';
|
||||
import { createEmptyWorkspace } from '@nrwl/workspace/testing';
|
||||
import { runSchematic } from '../../utils/testing';
|
||||
import { Linter, readJsonInTree } from '@nrwl/workspace';
|
||||
import { readJsonInTree } from '@nrwl/workspace';
|
||||
|
||||
describe('karmaProject', () => {
|
||||
let appTree: Tree;
|
||||
@ -196,47 +196,4 @@ module.exports = function(config) {
|
||||
expect(testTs).not.toContain("import 'zone.js/dist/zone';");
|
||||
});
|
||||
});
|
||||
|
||||
describe('linter', () => {
|
||||
it('should work with tslint as linter', async () => {
|
||||
const resultTree = await runSchematic(
|
||||
'lib',
|
||||
{
|
||||
name: 'lib-with-tslint-and-karma',
|
||||
unitTestRunner: 'karma',
|
||||
linter: Linter.TsLint,
|
||||
},
|
||||
appTree
|
||||
);
|
||||
const workspaceJson = readJsonInTree(resultTree, 'workspace.json');
|
||||
|
||||
expect(workspaceJson.projects['lib-with-tslint-and-karma'].architect.lint)
|
||||
.toMatchInlineSnapshot(`
|
||||
Object {
|
||||
"builder": "@angular-devkit/build-angular:tslint",
|
||||
"options": Object {
|
||||
"exclude": Array [
|
||||
"**/node_modules/**",
|
||||
"!libs/lib-with-tslint-and-karma/**/*",
|
||||
],
|
||||
"tsConfig": Array [
|
||||
"libs/lib-with-tslint-and-karma/tsconfig.lib.json",
|
||||
"libs/lib-with-tslint-and-karma/tsconfig.spec.json",
|
||||
],
|
||||
},
|
||||
}
|
||||
`);
|
||||
|
||||
expect(
|
||||
workspaceJson.projects['lib-with-tslint-and-karma'].architect.test
|
||||
).toEqual({
|
||||
builder: '@angular-devkit/build-angular:karma',
|
||||
options: {
|
||||
main: 'libs/lib-with-tslint-and-karma/src/test.ts',
|
||||
tsConfig: 'libs/lib-with-tslint-and-karma/tsconfig.spec.json',
|
||||
karmaConfig: 'libs/lib-with-tslint-and-karma/karma.conf.js',
|
||||
},
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
{
|
||||
"$schema": "http://json-schema.org/schema",
|
||||
"id": "SchematicsNxKarmaProject",
|
||||
"$id": "SchematicsNxKarmaProject",
|
||||
"title": "Create Karma Configuration for a project",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
{
|
||||
"$schema": "http://json-schema.org/schema",
|
||||
"id": "NxAngularKarma",
|
||||
"$id": "NxAngularKarma",
|
||||
"title": "Add Karma Configuration to the workspace",
|
||||
"type": "object",
|
||||
"properties": {},
|
||||
|
||||
@ -1244,64 +1244,15 @@ describe('lib', () => {
|
||||
});
|
||||
});
|
||||
|
||||
describe('tslint', () => {
|
||||
it('should add an architect target for lint', async () => {
|
||||
describe('none', () => {
|
||||
it('should not add an architect target for lint', async () => {
|
||||
const tree = await runSchematic(
|
||||
'lib',
|
||||
{ name: 'myLib', linter: 'tslint' },
|
||||
{ name: 'myLib', linter: 'none' },
|
||||
appTree
|
||||
);
|
||||
const workspaceJson = readJsonInTree(tree, 'workspace.json');
|
||||
expect(workspaceJson.projects['my-lib'].architect.lint)
|
||||
.toMatchInlineSnapshot(`
|
||||
Object {
|
||||
"builder": "@angular-devkit/build-angular:tslint",
|
||||
"options": Object {
|
||||
"exclude": Array [
|
||||
"**/node_modules/**",
|
||||
"!libs/my-lib/**/*",
|
||||
],
|
||||
"tsConfig": Array [
|
||||
"libs/my-lib/tsconfig.lib.json",
|
||||
"libs/my-lib/tsconfig.spec.json",
|
||||
],
|
||||
},
|
||||
}
|
||||
`);
|
||||
});
|
||||
|
||||
it('should add valid tslint JSON configuration', async () => {
|
||||
const tree = await runSchematic(
|
||||
'lib',
|
||||
{ name: 'myLib', linter: 'tslint' },
|
||||
appTree
|
||||
);
|
||||
|
||||
const tslintConfig = readJsonInTree(tree, 'libs/my-lib/tslint.json');
|
||||
expect(tslintConfig).toMatchInlineSnapshot(`
|
||||
Object {
|
||||
"extends": "../../tslint.json",
|
||||
"linterOptions": Object {
|
||||
"exclude": Array [
|
||||
"!**/*",
|
||||
],
|
||||
},
|
||||
"rules": Object {
|
||||
"component-selector": Array [
|
||||
true,
|
||||
"element",
|
||||
"proj",
|
||||
"kebab-case",
|
||||
],
|
||||
"directive-selector": Array [
|
||||
true,
|
||||
"attribute",
|
||||
"proj",
|
||||
"camelCase",
|
||||
],
|
||||
},
|
||||
}
|
||||
`);
|
||||
expect(workspaceJson.projects['my-lib'].architect.lint).toBeUndefined();
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@ -52,7 +52,6 @@ export default function (schema: Schema): Rule {
|
||||
externalSchematic('@schematics/angular', 'library', {
|
||||
name: options.name,
|
||||
prefix: options.prefix,
|
||||
style: options.style,
|
||||
entryFile: 'index',
|
||||
skipPackageJson: !(options.publishable || options.buildable),
|
||||
skipTsConfig: true,
|
||||
@ -82,7 +81,7 @@ export default function (schema: Schema): Rule {
|
||||
: noop(),
|
||||
addModule(options),
|
||||
options.strict ? enableStrictTypeChecking(options) : noop(),
|
||||
addLinting(options),
|
||||
options.linter !== Linter.None ? addLinting(options) : noop(),
|
||||
formatFiles(options),
|
||||
]);
|
||||
};
|
||||
@ -97,19 +96,6 @@ const addLinting = (options: NormalizedSchema) => () => {
|
||||
projectRoot: options.projectRoot,
|
||||
prefix: options.prefix,
|
||||
}),
|
||||
/**
|
||||
* I cannot explain why this extra rule is needed, the add-linting
|
||||
* schematic applies the exact same host.delete() call but the main
|
||||
* chain of this library schematic still preserves it...
|
||||
*/
|
||||
(host) => {
|
||||
if (
|
||||
options.linter === Linter.EsLint &&
|
||||
host.exists(`${options.projectRoot}/tslint.json`)
|
||||
) {
|
||||
host.delete(`${options.projectRoot}/tslint.json`);
|
||||
}
|
||||
},
|
||||
]);
|
||||
};
|
||||
|
||||
|
||||
@ -16,7 +16,6 @@ export interface Schema {
|
||||
flat?: boolean;
|
||||
commonModule?: boolean;
|
||||
|
||||
style?: string;
|
||||
prefix?: string;
|
||||
routing?: boolean;
|
||||
lazy?: boolean;
|
||||
@ -24,7 +23,7 @@ export interface Schema {
|
||||
tags?: string;
|
||||
strict?: boolean;
|
||||
|
||||
linter: Linter;
|
||||
linter: Exclude<Linter, Linter.TsLint>;
|
||||
unitTestRunner: UnitTestRunner;
|
||||
|
||||
enableIvy: boolean;
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
{
|
||||
"$schema": "http://json-schema.org/schema",
|
||||
"id": "SchematicsAngularLibrary",
|
||||
"$id": "SchematicsAngularLibrary",
|
||||
"title": "Create a library",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
@ -59,33 +59,6 @@
|
||||
"default": false,
|
||||
"description": "Do not update tsconfig.json for development experience."
|
||||
},
|
||||
"style": {
|
||||
"description": "The file extension to be used for style files.",
|
||||
"type": "string",
|
||||
"default": "css",
|
||||
"x-prompt": {
|
||||
"message": "Which stylesheet format would you like to use?",
|
||||
"type": "list",
|
||||
"items": [
|
||||
{
|
||||
"value": "css",
|
||||
"label": "CSS"
|
||||
},
|
||||
{
|
||||
"value": "scss",
|
||||
"label": "SASS(.scss) [ http://sass-lang.com ]"
|
||||
},
|
||||
{
|
||||
"value": "styl",
|
||||
"label": "Stylus(.styl)[ http://stylus-lang.com ]"
|
||||
},
|
||||
{
|
||||
"value": "less",
|
||||
"label": "LESS [ http://lesscss.org ]"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"routing": {
|
||||
"type": "boolean",
|
||||
"default": false,
|
||||
@ -122,7 +95,7 @@
|
||||
"linter": {
|
||||
"description": "The tool to use for running lint checks.",
|
||||
"type": "string",
|
||||
"enum": ["tslint", "eslint"],
|
||||
"enum": ["eslint", "none"],
|
||||
"default": "eslint"
|
||||
},
|
||||
"enableIvy": {
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
{
|
||||
"$schema": "http://json-schema.org/schema",
|
||||
"id": "NxAngularMove",
|
||||
"$id": "NxAngularMove",
|
||||
"title": "Nx Angular Move",
|
||||
"description": "Move an Angular project to another folder in the workspace",
|
||||
"type": "object",
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
{
|
||||
"$schema": "http://json-schema.org/schema",
|
||||
"id": "SchematicsNxNgrx",
|
||||
"$id": "SchematicsNxNgrx",
|
||||
"title": "Add NgRx support to an application or library",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
{
|
||||
"$schema": "http://json-schema.org/schema",
|
||||
"id": "storybook-stories",
|
||||
"$id": "NxAngularStorybookStories",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"name": {
|
||||
|
||||
@ -1,5 +1,18 @@
|
||||
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
||||
|
||||
exports[`schematic:configuration should configure storybook to use webpack 5 1`] = `
|
||||
"const rootMain = require('../../../.storybook/main');
|
||||
|
||||
rootMain.core = { ...rootMain.core, builder: 'webpack5' };
|
||||
|
||||
// Use the following syntax to add addons!
|
||||
// rootMain.addons.push('');
|
||||
rootMain.stories.push(...['../src/lib/**/*.stories.mdx', '../src/lib/**/*.stories.@(js|jsx|ts|tsx)'])
|
||||
|
||||
module.exports = rootMain;
|
||||
"
|
||||
`;
|
||||
|
||||
exports[`schematic:configuration should generate in the correct folder 1`] = `
|
||||
Array [
|
||||
"/workspace.json",
|
||||
|
||||
@ -55,6 +55,22 @@ describe('schematic:configuration', () => {
|
||||
).toBeFalsy();
|
||||
});
|
||||
|
||||
it('should configure storybook to use webpack 5', async () => {
|
||||
const tree = await runSchematic(
|
||||
'storybook-configuration',
|
||||
<StorybookConfigureSchema>{
|
||||
name: 'test-ui-lib',
|
||||
configureCypress: false,
|
||||
generateCypressSpecs: false,
|
||||
generateStories: false,
|
||||
},
|
||||
appTree
|
||||
);
|
||||
expect(
|
||||
tree.readContent('libs/test-ui-lib/.storybook/main.js')
|
||||
).toMatchSnapshot();
|
||||
});
|
||||
|
||||
it('should configure everything at once', async () => {
|
||||
const tree = await runSchematic(
|
||||
'storybook-configuration',
|
||||
|
||||
@ -11,8 +11,22 @@ import { StorybookConfigureSchema } from './schema';
|
||||
import { wrapAngularDevkitSchematic } from '@nrwl/devkit/ngcli-adapter';
|
||||
import { getE2eProjectName } from '@nrwl/cypress/src/utils/project-name';
|
||||
import { getWorkspace } from '@nrwl/workspace';
|
||||
import { lt } from 'semver';
|
||||
|
||||
function assertCompatibleStorybookVersion() {
|
||||
let storybookVersion: string;
|
||||
try {
|
||||
require(require.resolve('@storybook/angular/package.json')).version;
|
||||
} catch {}
|
||||
|
||||
if (storybookVersion && lt(storybookVersion, '6.2.0')) {
|
||||
throw new Error('Incompatible Storybook Version');
|
||||
}
|
||||
}
|
||||
|
||||
export default function (schema: StorybookConfigureSchema): Rule {
|
||||
assertCompatibleStorybookVersion();
|
||||
|
||||
if (schema.generateCypressSpecs && !schema.generateStories) {
|
||||
throw new Error(
|
||||
'Cannot set generateCypressSpecs to true when generateStories is set to false.'
|
||||
|
||||
@ -5,6 +5,6 @@ export interface StorybookConfigureSchema {
|
||||
configureCypress: boolean;
|
||||
generateStories: boolean;
|
||||
generateCypressSpecs: boolean;
|
||||
linter: Linter;
|
||||
linter: Exclude<Linter, Linter.TsLint>;
|
||||
cypressDirectory?: string;
|
||||
}
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
{
|
||||
"$schema": "http://json-schema.org/schema",
|
||||
"id": "storybook-configure",
|
||||
"$id": "NxAngularStorybookConfigure",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"name": {
|
||||
@ -36,7 +36,7 @@
|
||||
"linter": {
|
||||
"description": "The tool to use for running lint checks.",
|
||||
"type": "string",
|
||||
"enum": ["eslint", "tslint"],
|
||||
"enum": ["eslint", "none"],
|
||||
"default": "eslint"
|
||||
}
|
||||
},
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
{
|
||||
"$schema": "http://json-schema.org/schema",
|
||||
"id": "storybook-migrate-defaults-5-to-6",
|
||||
"$id": "storybook-migrate-defaults-5-to-6",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"all": {
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
{
|
||||
"$schema": "http://json-schema.org/schema",
|
||||
"id": "SchematicsNxUpgradeModule",
|
||||
"$id": "SchematicsNxUpgradeModule",
|
||||
"title": "Generates UpgradeModule setup",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
|
||||
@ -1,8 +1,7 @@
|
||||
export const nxVersion = '*';
|
||||
export const angularVersion = '^11.2.0';
|
||||
export const angularDevkitVersion = '~0.1102.0';
|
||||
export const angularVersion = '^12.0.0-rc.3';
|
||||
export const angularJsVersion = '1.7.9';
|
||||
export const ngrxVersion = '^11.1.0';
|
||||
export const rxjsVersion = '~6.6.3';
|
||||
export const rxjsVersion = '~6.6.0';
|
||||
export const jestPresetAngularVersion = '8.4.0';
|
||||
export const angularEslintVersion = '~4.2.0';
|
||||
export const angularEslintVersion = '~12.0.0-alpha.0';
|
||||
|
||||
@ -97,11 +97,6 @@ export function parseRunOneOptions(
|
||||
project = defaultProjectName;
|
||||
}
|
||||
|
||||
if (parsedArgs.configuration) {
|
||||
configuration = parsedArgs.configuration;
|
||||
} else if (parsedArgs.prod) {
|
||||
configuration = 'production';
|
||||
}
|
||||
if (parsedArgs.project) {
|
||||
project = parsedArgs.project;
|
||||
}
|
||||
@ -121,6 +116,14 @@ export function parseRunOneOptions(
|
||||
if ((!targets || !targets[target]) && projectIsNotSetExplicitly) return false;
|
||||
if (invalidTargetNames.indexOf(target) > -1) return false;
|
||||
|
||||
if (parsedArgs.configuration) {
|
||||
configuration = parsedArgs.configuration;
|
||||
} else if (parsedArgs.prod) {
|
||||
configuration = 'production';
|
||||
} else if (targets[target].defaultConfiguration) {
|
||||
configuration = targets[target].defaultConfiguration;
|
||||
}
|
||||
|
||||
const res = { project, target, configuration, parsedArgs };
|
||||
delete parsedArgs['c'];
|
||||
delete parsedArgs['configuration'];
|
||||
|
||||
@ -97,7 +97,6 @@ const parsedArgs: any = yargsParser(process.argv.slice(2), {
|
||||
'preset',
|
||||
'appName',
|
||||
'style',
|
||||
'linter',
|
||||
'defaultBase',
|
||||
'packageManager',
|
||||
],
|
||||
@ -121,15 +120,9 @@ if (parsedArgs.help) {
|
||||
|
||||
(async function main() {
|
||||
const packageManager: PackageManager = parsedArgs.packageManager || 'npm';
|
||||
const {
|
||||
name,
|
||||
cli,
|
||||
preset,
|
||||
appName,
|
||||
style,
|
||||
linter,
|
||||
nxCloud,
|
||||
} = await getConfiguration(parsedArgs);
|
||||
const { name, cli, preset, appName, style, nxCloud } = await getConfiguration(
|
||||
parsedArgs
|
||||
);
|
||||
|
||||
const tmpDir = createSandbox(packageManager);
|
||||
await createApp(tmpDir, name, packageManager, {
|
||||
@ -138,7 +131,6 @@ if (parsedArgs.help) {
|
||||
preset,
|
||||
appName,
|
||||
style,
|
||||
linter,
|
||||
nxCloud,
|
||||
});
|
||||
|
||||
@ -175,8 +167,6 @@ function showHelp() {
|
||||
style Default style option to be used when a non-empty preset is selected
|
||||
options: ("css", "scss", "styl", "less") for React/Next.js also ("styled-components", "@emotion/styled")
|
||||
|
||||
linter Default linter. Options: "eslint", "tslint".
|
||||
|
||||
interactive Enable interactive mode when using presets (boolean)
|
||||
|
||||
packageManager Package manager to use (npm, yarn, pnpm)
|
||||
@ -194,7 +184,6 @@ async function getConfiguration(parsedArgs) {
|
||||
const appName = await determineAppName(preset, parsedArgs);
|
||||
const style = await determineStyle(preset, parsedArgs);
|
||||
const cli = await determineCli(preset, parsedArgs);
|
||||
const linter = await determineLinter(preset, parsedArgs);
|
||||
const nxCloud = await askAboutNxCloud(parsedArgs);
|
||||
|
||||
return {
|
||||
@ -203,7 +192,6 @@ async function getConfiguration(parsedArgs) {
|
||||
appName,
|
||||
style,
|
||||
cli,
|
||||
linter,
|
||||
nxCloud,
|
||||
};
|
||||
} catch (e) {
|
||||
@ -414,45 +402,6 @@ function determineStyle(preset: Preset, parsedArgs: any) {
|
||||
return Promise.resolve(parsedArgs.style);
|
||||
}
|
||||
|
||||
function determineLinter(preset: Preset, parsedArgs: any) {
|
||||
if (!parsedArgs.linter) {
|
||||
if (preset === Preset.Angular || preset === Preset.AngularWithNest) {
|
||||
return enquirer
|
||||
.prompt([
|
||||
{
|
||||
name: 'linter',
|
||||
message: `Default linter `,
|
||||
initial: 'eslint' as any,
|
||||
type: 'select',
|
||||
choices: [
|
||||
{
|
||||
name: 'eslint',
|
||||
message: 'ESLint [ Modern linting tool ]',
|
||||
},
|
||||
{
|
||||
name: 'tslint',
|
||||
message: 'TSLint [ Used by Angular CLI. Deprecated. ]',
|
||||
},
|
||||
],
|
||||
},
|
||||
])
|
||||
.then((a: { linter: string }) => a.linter);
|
||||
} else {
|
||||
return Promise.resolve('eslint');
|
||||
}
|
||||
} else {
|
||||
if (parsedArgs.linter !== 'eslint' && parsedArgs.linter !== 'tslint') {
|
||||
output.error({
|
||||
title: 'Invalid linter',
|
||||
bodyLines: [`It must be one of the following:`, '', 'eslint', 'tslint'],
|
||||
});
|
||||
process.exit(1);
|
||||
} else {
|
||||
return Promise.resolve(parsedArgs.linter);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function createSandbox(packageManager: string) {
|
||||
output.log({
|
||||
title: 'Nx is creating your workspace.',
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
{
|
||||
"$schema": "http://json-schema.org/schema",
|
||||
"id": "cypress-convert-tslint-to-eslint",
|
||||
"$id": "cypress-convert-tslint-to-eslint",
|
||||
"cli": "nx",
|
||||
"title": "Convert a Cypress project from TSLint to ESLint",
|
||||
"description": "NOTE: Does not work in --dry-run mode",
|
||||
|
||||
@ -89,6 +89,18 @@ describe('schematic:cypress-project', () => {
|
||||
});
|
||||
});
|
||||
|
||||
it('should not add lint target when "none" is passed', async () => {
|
||||
await cypressProjectGenerator(tree, {
|
||||
name: 'my-app-e2e',
|
||||
project: 'my-app',
|
||||
linter: Linter.None,
|
||||
});
|
||||
const workspaceJson = readJson(tree, 'workspace.json');
|
||||
const project = workspaceJson.projects['my-app-e2e'];
|
||||
|
||||
expect(project.architect.lint).toBeUndefined();
|
||||
});
|
||||
|
||||
it('should update nx.json', async () => {
|
||||
await cypressProjectGenerator(tree, {
|
||||
name: 'my-app-e2e',
|
||||
|
||||
@ -8,7 +8,6 @@ import {
|
||||
joinPathFragments,
|
||||
names,
|
||||
offsetFromRoot,
|
||||
readProjectConfiguration,
|
||||
toJS,
|
||||
Tree,
|
||||
updateJson,
|
||||
@ -67,6 +66,10 @@ function addProject(host: Tree, options: CypressProjectSchema) {
|
||||
}
|
||||
|
||||
export async function addLinter(host: Tree, options: CypressProjectSchema) {
|
||||
if (options.linter === Linter.None) {
|
||||
return () => {};
|
||||
}
|
||||
|
||||
const installTask = await lintProjectGenerator(host, {
|
||||
project: options.projectName,
|
||||
linter: options.linter,
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
{
|
||||
"$schema": "http://json-schema.org/schema",
|
||||
"id": "Nx Cypress Project Generator Schema",
|
||||
"$id": "NxCypressProjectGeneratorSchema",
|
||||
"cli": "nx",
|
||||
"title": "Create Cypress Configuration for the workspace",
|
||||
"type": "object",
|
||||
@ -28,7 +28,7 @@
|
||||
"linter": {
|
||||
"description": "The tool to use for running lint checks.",
|
||||
"type": "string",
|
||||
"enum": ["eslint", "tslint"],
|
||||
"enum": ["eslint", "tslint", "none"],
|
||||
"default": "eslint"
|
||||
},
|
||||
"js": {
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
{
|
||||
"$schema": "http://json-schema.org/schema",
|
||||
"id": "NxCypressInit",
|
||||
"$id": "NxCypressInit",
|
||||
"cli": "nx",
|
||||
"title": "Add Cypress Configuration to the workspace",
|
||||
"type": "object",
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
{
|
||||
"$schema": "http://json-schema.org/schema",
|
||||
"cli": "nx",
|
||||
"id": "SchematicsNxExpressApp",
|
||||
"$id": "SchematicsNxExpressApp",
|
||||
"title": "Nx Application Options Schema",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
{
|
||||
"$schema": "http://json-schema.org/schema",
|
||||
"cli": "nx",
|
||||
"id": "NxExpressInit",
|
||||
"$id": "NxExpressInit",
|
||||
"title": "Init Express Plugin",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
{
|
||||
"$schema": "http://json-schema.org/schema",
|
||||
"cli": "nx",
|
||||
"id": "NxGatsbyApp",
|
||||
"$id": "NxGatsbyApp",
|
||||
"title": "",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user