@nx/angular 17.1.1 → 17.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/migrations.json +16 -0
- package/package.json +10 -10
- package/src/executors/ng-packagr-lite/ng-packagr-adjustments/ng-package/entry-point/write-package.transform.js +5 -1
- package/src/executors/ng-packagr-lite/ng-packagr-adjustments/ngc/compile-source-files.js +1 -3
- package/src/executors/package/ng-packagr-adjustments/ngc/compile-source-files.js +1 -3
- package/src/generators/application/files/ng-module/src/app/app.component.ts__tpl__ +4 -2
- package/src/generators/application/files/standalone-components/src/app/app.component.ts__tpl__ +4 -2
- package/src/generators/application/files/standalone-components/src/app/app.config.ts__tpl__ +1 -1
- package/src/generators/application/files/standalone-components/src/main.ts__tpl__ +1 -7
- package/src/generators/application/lib/create-files.js +3 -3
- package/src/generators/component/component.js +3 -0
- package/src/generators/component/files/__fileName__.ts__tpl__ +8 -2
- package/src/generators/host/host.js +1 -0
- package/src/generators/library/lib/add-standalone-component.d.ts +2 -2
- package/src/generators/library/lib/add-standalone-component.js +5 -4
- package/src/generators/remote/files/common/pre-v17/src/main.server.ts__tmpl__ +1 -1
- package/src/generators/remote/files/common/v17+/src/main.server.ts__tmpl__ +1 -1
- package/src/generators/remote/remote.js +1 -0
- package/src/generators/setup-mf/files/ts-webpack/tsconfig.lint.json__tmpl__ +12 -0
- package/src/generators/setup-mf/lib/generate-config.js +3 -0
- package/src/generators/setup-mf/schema.d.ts +1 -0
- package/src/generators/setup-mf/schema.json +5 -0
- package/src/generators/storybook-configuration/lib/generate-stories.js +3 -3
- package/src/generators/storybook-configuration/lib/generate-storybook-configuration.js +1 -1
- package/src/generators/storybook-configuration/schema.d.ts +1 -1
- package/src/generators/storybook-configuration/schema.json +3 -3
- package/src/migrations/update-17-1-0/replace-nguniversal-engines.js +18 -8
- package/src/utils/versions.d.ts +1 -1
- package/src/utils/versions.js +1 -1
package/migrations.json
CHANGED
|
@@ -1489,6 +1489,22 @@
|
|
|
1489
1489
|
"alwaysAddToPackageJson": false
|
|
1490
1490
|
}
|
|
1491
1491
|
}
|
|
1492
|
+
},
|
|
1493
|
+
"17.1.3-jest": {
|
|
1494
|
+
"version": "17.1.3-beta.0",
|
|
1495
|
+
"requires": {
|
|
1496
|
+
"@angular-devkit/build-angular": ">=13.0.0 <18.0.0",
|
|
1497
|
+
"@angular/compiler-cli": ">=13.0.0 <18.0.0",
|
|
1498
|
+
"@angular/core": ">=13.0.0 <18.0.0",
|
|
1499
|
+
"@angular/platform-browser-dynamic": ">=13.0.0 <18.0.0",
|
|
1500
|
+
"jest": "^29.0.0"
|
|
1501
|
+
},
|
|
1502
|
+
"packages": {
|
|
1503
|
+
"jest-preset-angular": {
|
|
1504
|
+
"version": "~13.1.4",
|
|
1505
|
+
"alwaysAddToPackageJson": false
|
|
1506
|
+
}
|
|
1507
|
+
}
|
|
1492
1508
|
}
|
|
1493
1509
|
}
|
|
1494
1510
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nx/angular",
|
|
3
|
-
"version": "17.1.
|
|
3
|
+
"version": "17.1.3",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "The Nx Plugin for Angular contains executors, generators, and utilities for managing Angular applications and libraries within an Nx workspace. It provides: \n\n- Integration with libraries such as Storybook, Jest, ESLint, Tailwind CSS, and Cypress. \n\n- Generators to help scaffold code quickly (like: Micro Frontends, Libraries, both internal to your codebase and publishable to npm) \n\n- Upgrading AngularJS applications \n\n- Single Component Application Modules (SCAMs) \n\n- NgRx helpers. \n\n- Utilities for automatic workspace refactoring.",
|
|
6
6
|
"repository": {
|
|
@@ -78,15 +78,15 @@
|
|
|
78
78
|
"tslib": "^2.3.0",
|
|
79
79
|
"webpack": "^5.80.0",
|
|
80
80
|
"webpack-merge": "^5.8.0",
|
|
81
|
-
"@nx/devkit": "17.1.
|
|
82
|
-
"@nx/cypress": "17.1.
|
|
83
|
-
"@nx/jest": "17.1.
|
|
84
|
-
"@nx/js": "17.1.
|
|
85
|
-
"@nx/eslint": "17.1.
|
|
86
|
-
"@nx/webpack": "17.1.
|
|
87
|
-
"@nx/web": "17.1.
|
|
88
|
-
"@nx/workspace": "17.1.
|
|
89
|
-
"@nrwl/angular": "17.1.
|
|
81
|
+
"@nx/devkit": "17.1.3",
|
|
82
|
+
"@nx/cypress": "17.1.3",
|
|
83
|
+
"@nx/jest": "17.1.3",
|
|
84
|
+
"@nx/js": "17.1.3",
|
|
85
|
+
"@nx/eslint": "17.1.3",
|
|
86
|
+
"@nx/webpack": "17.1.3",
|
|
87
|
+
"@nx/web": "17.1.3",
|
|
88
|
+
"@nx/workspace": "17.1.3",
|
|
89
|
+
"@nrwl/angular": "17.1.3"
|
|
90
90
|
},
|
|
91
91
|
"peerDependencies": {
|
|
92
92
|
"@angular-devkit/build-angular": ">= 15.0.0 < 18.0.0",
|
|
@@ -78,7 +78,11 @@ const nxWritePackageTransform = (options) => (0, transform_1.transformFromPromis
|
|
|
78
78
|
}
|
|
79
79
|
// Write a package.json in each secondary entry-point
|
|
80
80
|
// This is need for esbuild to secondary entry-points in dist correctly.
|
|
81
|
-
await (0, fs_1.writeFile)(path.join(ngEntryPoint.destinationPath, 'package.json'), JSON.stringify({
|
|
81
|
+
await (0, fs_1.writeFile)(path.join(ngEntryPoint.destinationPath, 'package.json'), JSON.stringify({
|
|
82
|
+
module: relativeUnixFromDestPath(angularVersion.major < 16
|
|
83
|
+
? destinationFiles.esm2020
|
|
84
|
+
: destinationFiles.esm2022),
|
|
85
|
+
}, undefined, 2));
|
|
82
86
|
}
|
|
83
87
|
devkit_1.logger.info(`Built ${ngEntryPoint.moduleId}`);
|
|
84
88
|
return graph;
|
|
@@ -56,9 +56,7 @@ async function compileSourceFiles(graph, tsConfig, moduleResolutionCache, option
|
|
|
56
56
|
cache.oldNgtscProgram = angularProgram;
|
|
57
57
|
}
|
|
58
58
|
else {
|
|
59
|
-
|
|
60
|
-
// using an abstract builder that only wraps a TypeScript program.
|
|
61
|
-
builder = ts.createAbstractBuilder(typeScriptProgram, tsCompilerHost);
|
|
59
|
+
builder = ts.createEmitAndSemanticDiagnosticsBuilderProgram(typeScriptProgram, tsCompilerHost);
|
|
62
60
|
}
|
|
63
61
|
// Update semantic diagnostics cache
|
|
64
62
|
const affectedFiles = new Set();
|
|
@@ -59,9 +59,7 @@ async function compileSourceFiles(graph, tsConfig, moduleResolutionCache, option
|
|
|
59
59
|
cache.oldNgtscProgram = angularProgram;
|
|
60
60
|
}
|
|
61
61
|
else {
|
|
62
|
-
|
|
63
|
-
// using an abstract builder that only wraps a TypeScript program.
|
|
64
|
-
builder = ts.createAbstractBuilder(typeScriptProgram, tsCompilerHost);
|
|
62
|
+
builder = ts.createEmitAndSemanticDiagnosticsBuilderProgram(typeScriptProgram, tsCompilerHost);
|
|
65
63
|
}
|
|
66
64
|
// Update semantic diagnostics cache
|
|
67
65
|
const affectedFiles = new Set();
|
|
@@ -3,9 +3,11 @@ import { Component<% if(viewEncapsulation) { %>, ViewEncapsulation<% } %> } from
|
|
|
3
3
|
@Component({
|
|
4
4
|
selector: '<%= rootSelector %>',<% if(!inlineTemplate) { %>
|
|
5
5
|
templateUrl: './app.component.html',<% } else { %>
|
|
6
|
-
template: `<% if(minimal) { %><h1>Welcome <%= appName %></h1><% } else { %><<%= nxWelcomeSelector %>></<%= nxWelcomeSelector %>><% } %> <% if(routing) { %><router-outlet></router-outlet><% } %>`,<% } %><% if(!inlineStyle) { %>
|
|
6
|
+
template: `<% if(minimal) { %><h1>Welcome <%= appName %></h1><% } else { %><<%= nxWelcomeSelector %>></<%= nxWelcomeSelector %>><% } %> <% if(routing) { %><router-outlet></router-outlet><% } %>`,<% } %><% if (angularMajorVersion < 17) { if(!inlineStyle) { %>
|
|
7
7
|
styleUrls: ['./app.component.<%= style %>'],<% } else { %>
|
|
8
|
-
styles: [
|
|
8
|
+
styles: [``],<% } %><% } else { if(!inlineStyle) { %>
|
|
9
|
+
styleUrl: './app.component.<%= style %>',<% } else { %>
|
|
10
|
+
styles: ``,<% } %><% } %><% if(viewEncapsulation) { %>
|
|
9
11
|
encapsulation: ViewEncapsulation.<%= viewEncapsulation %>,<% } %>
|
|
10
12
|
})
|
|
11
13
|
export class AppComponent {<% if(!minimal) { %>
|
package/src/generators/application/files/standalone-components/src/app/app.component.ts__tpl__
CHANGED
|
@@ -7,9 +7,11 @@ import { NxWelcomeComponent } from './nx-welcome.component';<% } %>
|
|
|
7
7
|
imports: [<% if(!minimal) { %>NxWelcomeComponent, <% } %><% if(routing) { %>RouterModule<% } %>],
|
|
8
8
|
selector: '<%= rootSelector %>',<% if(!inlineTemplate) { %>
|
|
9
9
|
templateUrl: './app.component.html',<% } else { %>
|
|
10
|
-
template: `<% if(minimal) { %><h1>Welcome <%= appName %></h1><% } else { %><<%= nxWelcomeSelector %>></<%= nxWelcomeSelector %>><% } %> <% if(routing) { %><router-outlet></router-outlet><% } %>`,<% } %><% if(!inlineStyle) { %>
|
|
10
|
+
template: `<% if(minimal) { %><h1>Welcome <%= appName %></h1><% } else { %><<%= nxWelcomeSelector %>></<%= nxWelcomeSelector %>><% } %> <% if(routing) { %><router-outlet></router-outlet><% } %>`,<% } %><% if (angularMajorVersion < 17) { if(!inlineStyle) { %>
|
|
11
11
|
styleUrls: ['./app.component.<%= style %>'],<% } else { %>
|
|
12
|
-
styles: [
|
|
12
|
+
styles: [``],<% } %><% } else { if(!inlineStyle) { %>
|
|
13
|
+
styleUrl: './app.component.<%= style %>',<% } else { %>
|
|
14
|
+
styles: ``,<% } %><% } %><% if(viewEncapsulation) { %>
|
|
13
15
|
encapsulation: ViewEncapsulation.<%= viewEncapsulation %>,<% } %>
|
|
14
16
|
})
|
|
15
17
|
export class AppComponent {<% if(!minimal) { %>
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ApplicationConfig } from <% if (
|
|
1
|
+
import { ApplicationConfig } from <% if (angularMajorVersion >= 16) { %>'@angular/core';<% } else { %>'@angular/platform-browser';<% } %><% if (routing) { %>
|
|
2
2
|
import { provideRouter } from '@angular/router';
|
|
3
3
|
import { appRoutes } from './app.routes';<% } %>
|
|
4
4
|
|
|
@@ -1,11 +1,5 @@
|
|
|
1
1
|
import { bootstrapApplication } from '@angular/platform-browser';
|
|
2
2
|
import { appConfig } from './app/app.config';
|
|
3
|
-
import { AppComponent } from './app/app.component'
|
|
4
|
-
import { enableProdMode } from '@angular/core';
|
|
5
|
-
import { environment } from './environments/environment';
|
|
6
|
-
|
|
7
|
-
if(environment.production) {
|
|
8
|
-
enableProdMode();
|
|
9
|
-
}<% } %>
|
|
3
|
+
import { AppComponent } from './app/app.component';
|
|
10
4
|
|
|
11
5
|
bootstrapApplication(AppComponent, appConfig).catch((err) => console.error(err));
|
|
@@ -7,8 +7,8 @@ const create_ts_config_1 = require("../../utils/create-ts-config");
|
|
|
7
7
|
const test_runners_1 = require("../../../utils/test-runners");
|
|
8
8
|
const version_utils_1 = require("../../utils/version-utils");
|
|
9
9
|
async function createFiles(tree, options, rootOffset) {
|
|
10
|
-
const
|
|
11
|
-
const isUsingApplicationBuilder =
|
|
10
|
+
const { major: angularMajorVersion } = (0, version_utils_1.getInstalledAngularVersionInfo)(tree);
|
|
11
|
+
const isUsingApplicationBuilder = angularMajorVersion >= 17 && options.bundler === 'esbuild';
|
|
12
12
|
const substitutions = {
|
|
13
13
|
rootSelector: `${options.prefix}-root`,
|
|
14
14
|
appName: options.name,
|
|
@@ -21,7 +21,7 @@ async function createFiles(tree, options, rootOffset) {
|
|
|
21
21
|
minimal: options.minimal,
|
|
22
22
|
nxWelcomeSelector: `${options.prefix}-nx-welcome`,
|
|
23
23
|
rootTsConfig: (0, devkit_1.joinPathFragments)(rootOffset, (0, js_1.getRootTsConfigFileName)(tree)),
|
|
24
|
-
|
|
24
|
+
angularMajorVersion,
|
|
25
25
|
rootOffset,
|
|
26
26
|
isUsingApplicationBuilder,
|
|
27
27
|
tpl: '',
|
|
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.componentGeneratorInternal = exports.componentGenerator = void 0;
|
|
4
4
|
const devkit_1 = require("@nx/devkit");
|
|
5
5
|
const utils_1 = require("../utils");
|
|
6
|
+
const version_utils_1 = require("../utils/version-utils");
|
|
6
7
|
const lib_1 = require("./lib");
|
|
7
8
|
async function componentGenerator(tree, rawOptions) {
|
|
8
9
|
await componentGeneratorInternal(tree, {
|
|
@@ -13,6 +14,7 @@ async function componentGenerator(tree, rawOptions) {
|
|
|
13
14
|
exports.componentGenerator = componentGenerator;
|
|
14
15
|
async function componentGeneratorInternal(tree, rawOptions) {
|
|
15
16
|
const options = await (0, lib_1.normalizeOptions)(tree, rawOptions);
|
|
17
|
+
const { major: angularMajorVersion } = (0, version_utils_1.getInstalledAngularVersionInfo)(tree);
|
|
16
18
|
(0, devkit_1.generateFiles)(tree, (0, devkit_1.joinPathFragments)(__dirname, 'files'), options.directory, {
|
|
17
19
|
name: options.name,
|
|
18
20
|
fileName: options.fileName,
|
|
@@ -26,6 +28,7 @@ async function componentGeneratorInternal(tree, rawOptions) {
|
|
|
26
28
|
viewEncapsulation: options.viewEncapsulation,
|
|
27
29
|
displayBlock: options.displayBlock,
|
|
28
30
|
selector: options.selector,
|
|
31
|
+
angularMajorVersion,
|
|
29
32
|
tpl: '',
|
|
30
33
|
});
|
|
31
34
|
if (options.skipTests) {
|
|
@@ -6,7 +6,7 @@ import { CommonModule } from '@angular/common';<% } %>
|
|
|
6
6
|
standalone: true,
|
|
7
7
|
imports: [CommonModule],<%}%><% if(inlineTemplate) { %>
|
|
8
8
|
template: `<p><%= name %> works!</p>`<% } else { %>
|
|
9
|
-
templateUrl: './<%= fileName %>.html'<% } if(inlineStyle) { %>,
|
|
9
|
+
templateUrl: './<%= fileName %>.html'<% } if (angularMajorVersion < 17) { if(inlineStyle) { %>,
|
|
10
10
|
styles: [<% if(displayBlock){ %>
|
|
11
11
|
`
|
|
12
12
|
:host {
|
|
@@ -14,7 +14,13 @@ import { CommonModule } from '@angular/common';<% } %>
|
|
|
14
14
|
}
|
|
15
15
|
`<% } %>
|
|
16
16
|
]<% } else if (style !== 'none') { %>,
|
|
17
|
-
styleUrls: ['./<%= fileName %>.<%= style %>']<% } %><% if(
|
|
17
|
+
styleUrls: ['./<%= fileName %>.<%= style %>']<% } %><% } else { if(inlineStyle) { %>,
|
|
18
|
+
styles: `<% if(displayBlock){ %>
|
|
19
|
+
:host {
|
|
20
|
+
display: block;
|
|
21
|
+
}
|
|
22
|
+
<% } %>`<% } else if (style !== 'none') { %>,
|
|
23
|
+
styleUrl: './<%= fileName %>.<%= style %>'<% } %><% } %><% if(!!viewEncapsulation) { %>,
|
|
18
24
|
encapsulation: ViewEncapsulation.<%= viewEncapsulation %><% } if (changeDetection !== 'Default') { %>,
|
|
19
25
|
changeDetection: ChangeDetectionStrategy.<%= changeDetection %><% } %>
|
|
20
26
|
})
|
|
@@ -62,6 +62,7 @@ async function hostInternal(tree, schema) {
|
|
|
62
62
|
prefix: options.prefix,
|
|
63
63
|
typescriptConfiguration,
|
|
64
64
|
standalone: options.standalone,
|
|
65
|
+
setParserOptionsProject: options.setParserOptionsProject,
|
|
65
66
|
});
|
|
66
67
|
let installTasks = [appInstallTask];
|
|
67
68
|
if (options.ssr) {
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { Tree } from 'nx/
|
|
2
|
-
import { NormalizedSchema } from './normalized-schema';
|
|
1
|
+
import { type Tree } from '@nx/devkit';
|
|
2
|
+
import type { NormalizedSchema } from './normalized-schema';
|
|
3
3
|
export declare function addStandaloneComponent(tree: Tree, { libraryOptions, componentOptions }: NormalizedSchema): Promise<void>;
|
|
@@ -1,17 +1,18 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.addStandaloneComponent = void 0;
|
|
4
|
+
const devkit_1 = require("@nx/devkit");
|
|
4
5
|
const component_1 = require("../../component/component");
|
|
5
|
-
const add_load_children_1 = require("./add-load-children");
|
|
6
6
|
const add_children_1 = require("./add-children");
|
|
7
|
+
const add_load_children_1 = require("./add-load-children");
|
|
7
8
|
async function addStandaloneComponent(tree, { libraryOptions, componentOptions }) {
|
|
8
|
-
await (0, component_1.
|
|
9
|
+
await (0, component_1.componentGenerator)(tree, {
|
|
9
10
|
...componentOptions,
|
|
10
11
|
name: componentOptions.name,
|
|
12
|
+
directory: (0, devkit_1.joinPathFragments)(libraryOptions.projectRoot, 'src', 'lib', componentOptions.flat ? '' : componentOptions.name),
|
|
13
|
+
nameAndDirectoryFormat: 'as-provided',
|
|
11
14
|
standalone: true,
|
|
12
15
|
export: true,
|
|
13
|
-
project: libraryOptions.name,
|
|
14
|
-
flat: componentOptions.flat,
|
|
15
16
|
skipFormat: true,
|
|
16
17
|
});
|
|
17
18
|
if (libraryOptions.routing) {
|
|
@@ -36,7 +36,7 @@ export function app(): express.Express {
|
|
|
36
36
|
// server.get('/api/**', (req, res) => { });
|
|
37
37
|
// Serve static files from /browser
|
|
38
38
|
// serve static files
|
|
39
|
-
server.
|
|
39
|
+
server.get('*.*', express.static(browserBundles, { maxAge: '1y' }));
|
|
40
40
|
server.use('/server', express.static(serverBundles, { maxAge: '1y' }));
|
|
41
41
|
|
|
42
42
|
// All regular routes use the Universal engine
|
|
@@ -28,7 +28,7 @@ export function app(): express.Express {
|
|
|
28
28
|
// Example Express Rest API endpoints
|
|
29
29
|
// server.get('/api/**', (req, res) => { });
|
|
30
30
|
// Serve static files from /browser
|
|
31
|
-
server.
|
|
31
|
+
server.get('*.*', express.static(browserBundles, { maxAge: '1y' }));
|
|
32
32
|
// Serve static files from /server
|
|
33
33
|
server.use('/server', express.static(serverBundles, { maxAge: '1y' }));
|
|
34
34
|
|
|
@@ -53,6 +53,7 @@ async function remoteInternal(tree, schema) {
|
|
|
53
53
|
standalone: options.standalone,
|
|
54
54
|
prefix: options.prefix,
|
|
55
55
|
typescriptConfiguration,
|
|
56
|
+
setParserOptionsProject: options.setParserOptionsProject,
|
|
56
57
|
});
|
|
57
58
|
const installSwcHelpersTask = (0, devkit_1.addDependenciesToPackageJson)(tree, {}, {
|
|
58
59
|
'@swc/helpers': versions_1.swcHelpersVersion,
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
{
|
|
2
|
+
"extends": "./tsconfig.json",
|
|
3
|
+
"compilerOptions": {
|
|
4
|
+
"target": "ES2020"
|
|
5
|
+
},
|
|
6
|
+
"include": [
|
|
7
|
+
"src/main.ts",
|
|
8
|
+
<% if(type === "remote") { %> "src/remote-entry/<% if(standalone) { %>entry.routes.ts", <% } else { %> entry.module.ts", <% } } %>
|
|
9
|
+
"webpack.config.ts",
|
|
10
|
+
"webpack.prod.config.ts"
|
|
11
|
+
]
|
|
12
|
+
}
|
|
@@ -23,5 +23,8 @@ function generateWebpackConfig(tree, options, appRoot, remotesWithPorts) {
|
|
|
23
23
|
projectRoot: appRoot,
|
|
24
24
|
standalone: options.standalone,
|
|
25
25
|
});
|
|
26
|
+
if (!options.setParserOptionsProject) {
|
|
27
|
+
tree.delete((0, devkit_1.joinPathFragments)(appRoot, 'tsconfig.lint.json'));
|
|
28
|
+
}
|
|
26
29
|
}
|
|
27
30
|
exports.generateWebpackConfig = generateWebpackConfig;
|
|
@@ -78,6 +78,11 @@
|
|
|
78
78
|
"type": "boolean",
|
|
79
79
|
"description": "Whether the module federation configuration and webpack configuration files should use TS.",
|
|
80
80
|
"default": true
|
|
81
|
+
},
|
|
82
|
+
"setParserOptionsProject": {
|
|
83
|
+
"type": "boolean",
|
|
84
|
+
"description": "Whether or not to configure the ESLint `parserOptions.project` option. We do not do this by default for lint performance reasons.",
|
|
85
|
+
"default": false
|
|
81
86
|
}
|
|
82
87
|
},
|
|
83
88
|
"required": ["appName", "mfType"],
|
|
@@ -5,10 +5,10 @@ const project_name_1 = require("@nx/cypress/src/utils/project-name");
|
|
|
5
5
|
const devkit_1 = require("@nx/devkit");
|
|
6
6
|
const stories_1 = require("../../stories/stories");
|
|
7
7
|
async function generateStories(tree, options) {
|
|
8
|
-
const project = (0, devkit_1.readProjectConfiguration)(tree, options.
|
|
9
|
-
const e2eProjectName = (0, project_name_1.getE2eProjectName)(options.
|
|
8
|
+
const project = (0, devkit_1.readProjectConfiguration)(tree, options.project);
|
|
9
|
+
const e2eProjectName = (0, project_name_1.getE2eProjectName)(options.project, project.root, options.cypressDirectory);
|
|
10
10
|
await (0, stories_1.angularStoriesGenerator)(tree, {
|
|
11
|
-
name: options.
|
|
11
|
+
name: options.project,
|
|
12
12
|
generateCypressSpecs: options.configureCypress && options.generateCypressSpecs,
|
|
13
13
|
cypressProject: e2eProjectName,
|
|
14
14
|
ignorePaths: options.ignorePaths,
|
|
@@ -6,7 +6,7 @@ const versions_1 = require("../../../utils/versions");
|
|
|
6
6
|
async function generateStorybookConfiguration(tree, options) {
|
|
7
7
|
const { configurationGenerator } = (0, devkit_1.ensurePackage)('@nx/storybook', versions_1.nxVersion);
|
|
8
8
|
return await configurationGenerator(tree, {
|
|
9
|
-
|
|
9
|
+
project: options.project,
|
|
10
10
|
uiFramework: '@storybook/angular',
|
|
11
11
|
configureCypress: options.configureCypress,
|
|
12
12
|
linter: options.linter,
|
|
@@ -6,9 +6,9 @@
|
|
|
6
6
|
"cli": "nx",
|
|
7
7
|
"type": "object",
|
|
8
8
|
"properties": {
|
|
9
|
-
"
|
|
9
|
+
"project": {
|
|
10
10
|
"type": "string",
|
|
11
|
-
"aliases": ["
|
|
11
|
+
"aliases": ["name", "projectName"],
|
|
12
12
|
"description": "Project for which to generate Storybook configuration.",
|
|
13
13
|
"$default": {
|
|
14
14
|
"$source": "argv",
|
|
@@ -93,6 +93,6 @@
|
|
|
93
93
|
}
|
|
94
94
|
},
|
|
95
95
|
"additionalProperties": false,
|
|
96
|
-
"required": ["
|
|
96
|
+
"required": ["project"],
|
|
97
97
|
"examplesFile": "../../../docs/storybook-configuration-examples.md"
|
|
98
98
|
}
|
|
@@ -15,13 +15,18 @@ const UNIVERSAL_PACKAGES = [
|
|
|
15
15
|
* @nguniversal/express-engine
|
|
16
16
|
**/
|
|
17
17
|
const NGUNIVERSAL_PACKAGE_REGEXP = /@nguniversal\/(common(\/engine)?|express-engine)/g;
|
|
18
|
+
const serverExecutors = [
|
|
19
|
+
'@angular-devkit/build-angular:server',
|
|
20
|
+
'@nx/angular:webpack-server',
|
|
21
|
+
];
|
|
18
22
|
async function default_1(tree) {
|
|
19
23
|
const packageJson = (0, devkit_1.readJson)(tree, 'package.json');
|
|
20
24
|
if (!UNIVERSAL_PACKAGES.some((pkg) => packageJson.dependencies?.[pkg] || packageJson.devDependencies?.[pkg])) {
|
|
21
25
|
return;
|
|
22
26
|
}
|
|
23
27
|
const projects = await (0, projects_1.getProjectsFilteredByDependencies)(tree, [
|
|
24
|
-
'npm:@
|
|
28
|
+
'npm:@nguniversal/common',
|
|
29
|
+
'npm:@nguniversal/express-engine',
|
|
25
30
|
]);
|
|
26
31
|
for (const { project } of projects) {
|
|
27
32
|
if (project.projectType !== 'application') {
|
|
@@ -29,7 +34,7 @@ async function default_1(tree) {
|
|
|
29
34
|
}
|
|
30
35
|
const serverMainFiles = new Map();
|
|
31
36
|
for (const target of Object.values(project.targets ?? {})) {
|
|
32
|
-
if (target.executor
|
|
37
|
+
if (!serverExecutors.includes(target.executor)) {
|
|
33
38
|
continue;
|
|
34
39
|
}
|
|
35
40
|
const outputPath = project.targets.build?.options?.outputPath;
|
|
@@ -46,19 +51,24 @@ async function default_1(tree) {
|
|
|
46
51
|
const root = project.sourceRoot ?? `${project.root}/src`;
|
|
47
52
|
const tokensFilePath = `${root}/express.tokens.ts`;
|
|
48
53
|
(0, devkit_1.visitNotIgnoredFiles)(tree, root, (path) => {
|
|
49
|
-
|
|
50
|
-
|
|
54
|
+
if (!path.endsWith('.ts') || path.endsWith('.d.ts')) {
|
|
55
|
+
return;
|
|
56
|
+
}
|
|
57
|
+
let content = tree.read(path, 'utf8');
|
|
58
|
+
if (!content.includes('@nguniversal/')) {
|
|
59
|
+
return;
|
|
60
|
+
}
|
|
51
61
|
// Check if file is importing tokens
|
|
52
62
|
if (content.includes('@nguniversal/express-engine/tokens')) {
|
|
53
63
|
hasExpressTokens ||= true;
|
|
54
|
-
let tokensFileRelativePath = (0,
|
|
64
|
+
let tokensFileRelativePath = (0, devkit_1.normalizePath)((0, path_1.relative)((0, path_1.dirname)(path), tokensFilePath));
|
|
55
65
|
if (tokensFileRelativePath.charAt(0) !== '.') {
|
|
56
66
|
tokensFileRelativePath = './' + tokensFileRelativePath;
|
|
57
67
|
}
|
|
58
|
-
|
|
68
|
+
content = content.replaceAll('@nguniversal/express-engine/tokens', tokensFileRelativePath.slice(0, -3));
|
|
59
69
|
}
|
|
60
|
-
|
|
61
|
-
tree.write(path,
|
|
70
|
+
content = content.replaceAll(NGUNIVERSAL_PACKAGE_REGEXP, '@angular/ssr');
|
|
71
|
+
tree.write(path, content);
|
|
62
72
|
});
|
|
63
73
|
// Replace server file and add tokens file if needed
|
|
64
74
|
for (const [path, outputPath] of serverMainFiles.entries()) {
|
package/src/utils/versions.d.ts
CHANGED
|
@@ -20,7 +20,7 @@ export declare const postcssPresetEnvVersion = "~7.5.0";
|
|
|
20
20
|
export declare const postcssUrlVersion = "~10.1.3";
|
|
21
21
|
export declare const autoprefixerVersion = "^10.4.0";
|
|
22
22
|
export declare const tsNodeVersion = "10.9.1";
|
|
23
|
-
export declare const jestPresetAngularVersion = "~13.1.
|
|
23
|
+
export declare const jestPresetAngularVersion = "~13.1.4";
|
|
24
24
|
export declare const typesNodeVersion = "16.11.7";
|
|
25
25
|
export declare const jasmineMarblesVersion = "^0.9.2";
|
|
26
26
|
export declare const jsoncEslintParserVersion = "^2.1.0";
|
package/src/utils/versions.js
CHANGED
|
@@ -23,7 +23,7 @@ exports.postcssPresetEnvVersion = '~7.5.0';
|
|
|
23
23
|
exports.postcssUrlVersion = '~10.1.3';
|
|
24
24
|
exports.autoprefixerVersion = '^10.4.0';
|
|
25
25
|
exports.tsNodeVersion = '10.9.1';
|
|
26
|
-
exports.jestPresetAngularVersion = '~13.1.
|
|
26
|
+
exports.jestPresetAngularVersion = '~13.1.4';
|
|
27
27
|
exports.typesNodeVersion = '16.11.7';
|
|
28
28
|
exports.jasmineMarblesVersion = '^0.9.2';
|
|
29
29
|
exports.jsoncEslintParserVersion = '^2.1.0';
|