@nx/angular 17.2.8 → 17.3.0-beta.2
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/README.md +9 -4
- package/migrations.json +9 -0
- package/package.json +10 -10
- package/src/executors/module-federation-dev-server/module-federation-dev-server.impl.d.ts +2 -1
- package/src/executors/module-federation-dev-server/module-federation-dev-server.impl.js +2 -0
- package/src/generators/application/files/ng-module/src/app/app.component.spec.ts__tpl__ +3 -1
- package/src/generators/application/files/ng-module/src/app/nx-welcome.component.ts__tpl__ +1 -1
- package/src/generators/application/files/standalone-components/src/app/app.component.spec.ts__tpl__ +6 -4
- package/src/generators/application/files/standalone-components/src/app/nx-welcome.component.ts__tpl__ +1 -1
- package/src/generators/application/files/standalone-components/src/main.ts__tpl__ +3 -1
- package/src/generators/component/files/__fileName__.spec.ts__tpl__ +2 -3
- package/src/generators/component/lib/component.js +1 -1
- package/src/generators/component-cypress-spec/files/__componentFileName__.__fileExt__ +13 -8
- package/src/generators/component-story/files/__componentFileName__.stories.ts__tmpl__ +2 -2
- package/src/generators/component-test/component-test.d.ts +1 -1
- package/src/generators/component-test/component-test.js +4 -1
- package/src/generators/component-test/files/__componentFileName__.cy.ts__tpl__ +9 -11
- package/src/generators/convert-to-with-mf/convert-to-with-mf.js +3 -1
- package/src/generators/convert-to-with-mf/lib/write-new-webpack-config.js +3 -2
- package/src/generators/convert-to-with-mf/schema.d.ts +1 -0
- package/src/generators/convert-to-with-mf/schema.json +6 -0
- package/src/generators/cypress-component-configuration/cypress-component-configuration.d.ts +1 -1
- package/src/generators/cypress-component-configuration/cypress-component-configuration.js +2 -4
- package/src/generators/directive/files/__fileName__.ts__tpl__ +1 -3
- package/src/generators/host/files/ts/webpack.server.config.ts__tmpl__ +2 -2
- package/src/generators/library/files/ng-module/src/lib/lib.routes.ts__tpl__ +1 -1
- package/src/generators/library/files/standalone-components/src/lib/lib.routes.ts__tpl__ +1 -1
- package/src/generators/library/lib/add-load-children.js +2 -2
- package/src/generators/library-secondary-entry-point/files/src/index.ts__tmpl__ +1 -5
- package/src/generators/library-secondary-entry-point/library-secondary-entry-point.js +3 -1
- package/src/generators/library-secondary-entry-point/schema.d.ts +1 -0
- package/src/generators/library-secondary-entry-point/schema.json +6 -0
- package/src/generators/ngrx/files/__directory__/__fileName__.models.ts__tmpl__ +1 -1
- package/src/generators/ngrx/files/__directory__/__fileName__.selectors.spec.ts__tmpl__ +1 -1
- package/src/generators/ngrx-feature-store/files/__directory__/__fileName__.models.ts__tmpl__ +1 -1
- package/src/generators/ngrx-feature-store/files/__directory__/__fileName__.selectors.spec.ts__tmpl__ +1 -1
- package/src/generators/pipe/files/__fileName__.ts__tpl__ +0 -2
- package/src/generators/remote/files/base-ts/webpack.server.config.ts__tmpl__ +2 -2
- package/src/generators/remote/files/common/pre-v17/src/main.server.ts__tmpl__ +0 -2
- package/src/generators/remote/files/common/v17+/src/main.server.ts__tmpl__ +0 -1
- package/src/generators/scam/lib/convert-component-to-scam.js +2 -1
- package/src/generators/scam-directive/lib/convert-directive-to-scam.js +2 -1
- package/src/generators/scam-directive/scam-directive.js +3 -1
- package/src/generators/scam-directive/schema.d.ts +1 -0
- package/src/generators/scam-directive/schema.json +6 -0
- package/src/generators/scam-pipe/lib/convert-pipe-to-scam.js +2 -1
- package/src/generators/scam-pipe/scam-pipe.js +3 -1
- package/src/generators/scam-pipe/schema.d.ts +1 -0
- package/src/generators/scam-pipe/schema.json +6 -0
- package/src/generators/setup-mf/files/host-files/app.component.spec.ts__tmpl__ +3 -1
- package/src/generators/setup-mf/files/ts-webpack/webpack.config.ts__tmpl__ +1 -1
- package/src/generators/setup-mf/files/ts-webpack/webpack.prod.config.ts__tmpl__ +12 -12
- package/src/generators/setup-mf/files/webpack/module-federation.config.js__tmpl__ +1 -1
- package/src/generators/setup-mf/lib/add-remote-entry.js +1 -1
- package/src/generators/setup-mf/lib/add-remote-to-host.js +1 -1
- package/src/generators/setup-mf/lib/fix-bootstrap.js +7 -6
- package/src/generators/setup-mf/lib/remove-dead-code-from-remote.js +10 -10
- package/src/generators/setup-mf/lib/update-host-app-routes.js +2 -2
- package/src/generators/setup-ssr/files/server/server-builder/pre-v17/__serverFileName__ +4 -4
- package/src/generators/setup-ssr/lib/set-router-initial-navigation.js +1 -1
- package/src/generators/utils/export-scam.js +2 -2
- package/src/generators/utils/testing.js +12 -1
- package/src/utils/nx-devkit/testing.js +27 -31
- package/src/utils/versions.d.ts +1 -1
- package/src/utils/versions.js +1 -1
package/README.md
CHANGED
|
@@ -1,4 +1,9 @@
|
|
|
1
|
-
<p style="text-align: center;"
|
|
1
|
+
<p style="text-align: center;">
|
|
2
|
+
<picture>
|
|
3
|
+
<source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/nrwl/nx/master/images/nx-dark.svg">
|
|
4
|
+
<img alt="Nx - Smart Monorepos · Fast CI" src="https://raw.githubusercontent.com/nrwl/nx/master/images/nx-light.svg" width="100%">
|
|
5
|
+
</picture>
|
|
6
|
+
</p>
|
|
2
7
|
|
|
3
8
|
<div style="text-align: center;">
|
|
4
9
|
|
|
@@ -15,9 +20,9 @@
|
|
|
15
20
|
|
|
16
21
|
<hr>
|
|
17
22
|
|
|
18
|
-
# Nx: Smart
|
|
23
|
+
# Nx: Smart Monorepos · Fast CI
|
|
19
24
|
|
|
20
|
-
Nx is a
|
|
25
|
+
Nx is a build system with built-in tooling and advanced CI capabilities. It helps you maintain and scale monorepos, both locally and on CI.
|
|
21
26
|
|
|
22
27
|
This package is an [Angular plugin for Nx](https://nx.dev/packages/angular).
|
|
23
28
|
|
|
@@ -59,5 +64,5 @@ npx nx@latest init
|
|
|
59
64
|
- [Blog Posts About Nx](https://blog.nrwl.io/nx/home)
|
|
60
65
|
|
|
61
66
|
<p style="text-align: center;"><a href="https://nx.dev/#learning-materials" target="_blank" rel="noreferrer"><img src="https://raw.githubusercontent.com/nrwl/nx/master/images/nx-courses-and-videos.svg"
|
|
62
|
-
width="100%" alt="Nx - Smart
|
|
67
|
+
width="100%" alt="Nx - Smart Monorepos · Fast CI"></a></p>
|
|
63
68
|
|
package/migrations.json
CHANGED
|
@@ -1527,6 +1527,15 @@
|
|
|
1527
1527
|
"alwaysAddToPackageJson": false
|
|
1528
1528
|
}
|
|
1529
1529
|
}
|
|
1530
|
+
},
|
|
1531
|
+
"17.3.0": {
|
|
1532
|
+
"version": "17.3.0-beta.3",
|
|
1533
|
+
"packages": {
|
|
1534
|
+
"@types/node": {
|
|
1535
|
+
"version": "18.16.9",
|
|
1536
|
+
"alwaysAddToPackageJson": false
|
|
1537
|
+
}
|
|
1538
|
+
}
|
|
1530
1539
|
}
|
|
1531
1540
|
}
|
|
1532
1541
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nx/angular",
|
|
3
|
-
"version": "17.2
|
|
3
|
+
"version": "17.3.0-beta.2",
|
|
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.2
|
|
82
|
-
"@nx/cypress": "17.2
|
|
83
|
-
"@nx/jest": "17.2
|
|
84
|
-
"@nx/js": "17.2
|
|
85
|
-
"@nx/eslint": "17.2
|
|
86
|
-
"@nx/webpack": "17.2
|
|
87
|
-
"@nx/web": "17.2
|
|
88
|
-
"@nx/workspace": "17.2
|
|
89
|
-
"@nrwl/angular": "17.2
|
|
81
|
+
"@nx/devkit": "17.3.0-beta.2",
|
|
82
|
+
"@nx/cypress": "17.3.0-beta.2",
|
|
83
|
+
"@nx/jest": "17.3.0-beta.2",
|
|
84
|
+
"@nx/js": "17.3.0-beta.2",
|
|
85
|
+
"@nx/eslint": "17.3.0-beta.2",
|
|
86
|
+
"@nx/webpack": "17.3.0-beta.2",
|
|
87
|
+
"@nx/web": "17.3.0-beta.2",
|
|
88
|
+
"@nx/workspace": "17.3.0-beta.2",
|
|
89
|
+
"@nrwl/angular": "17.3.0-beta.2"
|
|
90
90
|
},
|
|
91
91
|
"peerDependencies": {
|
|
92
92
|
"@angular-devkit/build-angular": ">= 15.0.0 < 18.0.0",
|
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
import { type ExecutorContext } from '@nx/devkit';
|
|
2
2
|
import { type Schema } from './schema';
|
|
3
|
-
export
|
|
3
|
+
export declare function moduleFederationDevServerExecutor(schema: Schema, context: ExecutorContext): AsyncGenerator<any, any, undefined>;
|
|
4
|
+
export default moduleFederationDevServerExecutor;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.moduleFederationDevServerExecutor = void 0;
|
|
3
4
|
const devkit_1 = require("@nx/devkit");
|
|
4
5
|
const lib_1 = require("./lib");
|
|
5
6
|
const rxjs_for_await_1 = require("@nx/devkit/src/utils/rxjs-for-await");
|
|
@@ -107,4 +108,5 @@ async function* moduleFederationDevServerExecutor(schema, context) {
|
|
|
107
108
|
}
|
|
108
109
|
}));
|
|
109
110
|
}
|
|
111
|
+
exports.moduleFederationDevServerExecutor = moduleFederationDevServerExecutor;
|
|
110
112
|
exports.default = moduleFederationDevServerExecutor;
|
|
@@ -15,7 +15,9 @@ describe('AppComponent', () => {
|
|
|
15
15
|
const fixture = TestBed.createComponent(AppComponent);
|
|
16
16
|
fixture.detectChanges();
|
|
17
17
|
const compiled = fixture.nativeElement as HTMLElement;
|
|
18
|
-
expect(compiled.querySelector('h1')?.textContent).toContain(
|
|
18
|
+
expect(compiled.querySelector('h1')?.textContent).toContain(
|
|
19
|
+
'Welcome <%= appName %>'
|
|
20
|
+
);
|
|
19
21
|
});<% if(!minimal) { %>
|
|
20
22
|
|
|
21
23
|
it(`should have as title '<%= appName %>'`, () => {
|
|
@@ -689,7 +689,7 @@ import { Component, ViewEncapsulation } from '@angular/core';
|
|
|
689
689
|
<path stroke-width="2" d="M23 6v14.1667C23 21.7307 21.7307 23 20.1667 23H6c0-3.128 2.53867-5.6667 5.6667-5.6667 3.128 0 5.6666-2.5386 5.6666-5.6666C17.3333 8.53867 19.872 6 23 6Z" />
|
|
690
690
|
</svg>
|
|
691
691
|
<h2>
|
|
692
|
-
|
|
692
|
+
Nx Cloud
|
|
693
693
|
<span>
|
|
694
694
|
Enable faster CI & better DX
|
|
695
695
|
</span>
|
package/src/generators/application/files/standalone-components/src/app/app.component.spec.ts__tpl__
CHANGED
|
@@ -11,10 +11,12 @@ describe('AppComponent', () => {
|
|
|
11
11
|
});
|
|
12
12
|
|
|
13
13
|
it('should render title', () => {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
14
|
+
const fixture = TestBed.createComponent(AppComponent);
|
|
15
|
+
fixture.detectChanges();
|
|
16
|
+
const compiled = fixture.nativeElement as HTMLElement;
|
|
17
|
+
expect(compiled.querySelector('h1')?.textContent).toContain(
|
|
18
|
+
'Welcome <%= appName %>'
|
|
19
|
+
);
|
|
18
20
|
});<% if(!minimal) { %>
|
|
19
21
|
|
|
20
22
|
it(`should have as title '<%= appName %>'`, () => {
|
|
@@ -692,7 +692,7 @@ import { CommonModule } from '@angular/common';
|
|
|
692
692
|
<path stroke-width="2" d="M23 6v14.1667C23 21.7307 21.7307 23 20.1667 23H6c0-3.128 2.53867-5.6667 5.6667-5.6667 3.128 0 5.6666-2.5386 5.6666-5.6666C17.3333 8.53867 19.872 6 23 6Z" />
|
|
693
693
|
</svg>
|
|
694
694
|
<h2>
|
|
695
|
-
|
|
695
|
+
Nx Cloud
|
|
696
696
|
<span>
|
|
697
697
|
Enable faster CI & better DX
|
|
698
698
|
</span>
|
|
@@ -2,4 +2,6 @@ import { bootstrapApplication } from '@angular/platform-browser';
|
|
|
2
2
|
import { appConfig } from './app/app.config';
|
|
3
3
|
import { AppComponent } from './app/app.component';
|
|
4
4
|
|
|
5
|
-
bootstrapApplication(AppComponent, appConfig).catch((err) =>
|
|
5
|
+
bootstrapApplication(AppComponent, appConfig).catch((err) =>
|
|
6
|
+
console.error(err)
|
|
7
|
+
);
|
|
@@ -7,9 +7,8 @@ describe('<%= symbolName %>', () => {
|
|
|
7
7
|
|
|
8
8
|
beforeEach(async () => {
|
|
9
9
|
await TestBed.configureTestingModule({
|
|
10
|
-
<%= standalone ? 'imports' : 'declarations' %>: [
|
|
11
|
-
})
|
|
12
|
-
.compileComponents();
|
|
10
|
+
<%= standalone ? 'imports' : 'declarations' %>: [<%= symbolName %>]
|
|
11
|
+
}).compileComponents();
|
|
13
12
|
|
|
14
13
|
fixture = TestBed.createComponent(<%= symbolName %>);
|
|
15
14
|
component = fixture.componentInstance;
|
|
@@ -28,7 +28,7 @@ function exportComponentInEntryPoint(tree, schema) {
|
|
|
28
28
|
}
|
|
29
29
|
const relativePathFromEntryPoint = (0, path_1.getRelativeImportToFile)(entryPointPath, schema.filePath);
|
|
30
30
|
const updateEntryPointContent = (0, devkit_1.stripIndents) `${tree.read(entryPointPath, 'utf-8')}
|
|
31
|
-
export * from
|
|
31
|
+
export * from '${relativePathFromEntryPoint}';`;
|
|
32
32
|
tree.write(entryPointPath, updateEntryPointContent);
|
|
33
33
|
}
|
|
34
34
|
exports.exportComponentInEntryPoint = exportComponentInEntryPoint;
|
|
@@ -1,12 +1,17 @@
|
|
|
1
1
|
describe('<%=projectName%>', () => {
|
|
2
|
-
beforeEach(() =>
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
2
|
+
beforeEach(() =>
|
|
3
|
+
cy.visit(
|
|
4
|
+
'/iframe.html?id=<%= componentName.toLowerCase() %>--primary<% if ( props && props.length > 0 ) { %>&args=<% } %><%
|
|
5
|
+
for(let prop of props) {
|
|
6
|
+
%><%=prop.name%><%
|
|
7
|
+
if(prop.defaultValue !== undefined && (prop.defaultValue || prop.defaultValue === false)) {
|
|
8
|
+
%>:<%=prop.defaultValue%><%
|
|
9
|
+
} %>;<%
|
|
10
|
+
}%>'
|
|
11
|
+
)
|
|
12
|
+
);
|
|
13
|
+
|
|
9
14
|
it('should render the component', () => {
|
|
10
15
|
cy.get('<%=componentSelector%>').should('exist');
|
|
11
16
|
});
|
|
12
|
-
});
|
|
17
|
+
});
|
|
@@ -14,14 +14,14 @@ type Story = StoryObj<<%=componentName%>>;
|
|
|
14
14
|
|
|
15
15
|
export const Primary: Story = {
|
|
16
16
|
args: {<% for (let prop of props) { %>
|
|
17
|
-
<%= prop.name %>:
|
|
17
|
+
<%= prop.name %>: <%- prop.defaultValue %>,<% } %>
|
|
18
18
|
},
|
|
19
19
|
};
|
|
20
20
|
|
|
21
21
|
<% if ( interactionTests ) { %>
|
|
22
22
|
export const Heading: Story = {
|
|
23
23
|
args: {<% for (let prop of props) { %>
|
|
24
|
-
<%= prop.name %>:
|
|
24
|
+
<%= prop.name %>: <%- prop.defaultValue %>,<% } %>
|
|
25
25
|
},
|
|
26
26
|
play: async ({ canvasElement }) => {
|
|
27
27
|
const canvas = within(canvasElement);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { Tree } from '@nx/devkit';
|
|
2
2
|
import { ComponentTestSchema } from './schema';
|
|
3
|
-
export declare function componentTestGenerator(tree: Tree, options: ComponentTestSchema): void
|
|
3
|
+
export declare function componentTestGenerator(tree: Tree, options: ComponentTestSchema): Promise<void>;
|
|
4
4
|
export default componentTestGenerator;
|
|
@@ -4,7 +4,7 @@ exports.componentTestGenerator = void 0;
|
|
|
4
4
|
const cypress_version_1 = require("@nx/cypress/src/utils/cypress-version");
|
|
5
5
|
const devkit_1 = require("@nx/devkit");
|
|
6
6
|
const storybook_inputs_1 = require("../utils/storybook-ast/storybook-inputs");
|
|
7
|
-
function componentTestGenerator(tree, options) {
|
|
7
|
+
async function componentTestGenerator(tree, options) {
|
|
8
8
|
(0, cypress_version_1.assertMinimumCypressVersion)(10);
|
|
9
9
|
const { root } = (0, devkit_1.readProjectConfiguration)(tree, options.project);
|
|
10
10
|
const componentDirPath = (0, devkit_1.joinPathFragments)(root, options.componentDir);
|
|
@@ -21,6 +21,9 @@ function componentTestGenerator(tree, options) {
|
|
|
21
21
|
tpl: '',
|
|
22
22
|
});
|
|
23
23
|
}
|
|
24
|
+
if (!options.skipFormat) {
|
|
25
|
+
await (0, devkit_1.formatFiles)(tree);
|
|
26
|
+
}
|
|
24
27
|
}
|
|
25
28
|
exports.componentTestGenerator = componentTestGenerator;
|
|
26
29
|
exports.default = componentTestGenerator;
|
|
@@ -2,22 +2,20 @@ import { TestBed } from '@angular/core/testing';
|
|
|
2
2
|
import { <%= componentName %> } from './<%= componentFileName %>';
|
|
3
3
|
|
|
4
4
|
describe(<%= componentName %>.name, () => {
|
|
5
|
-
|
|
6
5
|
beforeEach(() => {
|
|
7
6
|
TestBed.overrideComponent(<%= componentName %>, {
|
|
8
7
|
add: {
|
|
9
8
|
imports: [],
|
|
10
9
|
providers: []
|
|
11
10
|
}
|
|
12
|
-
})
|
|
13
|
-
})
|
|
11
|
+
});
|
|
12
|
+
});
|
|
14
13
|
|
|
15
14
|
it('renders', () => {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
})
|
|
22
|
-
|
|
23
|
-
})
|
|
15
|
+
cy.mount(<%= componentName %><% if(props.length > 0) { %>, {
|
|
16
|
+
componentProperties: {<% for (let prop of props) { %>
|
|
17
|
+
<%= prop.name %>: <%- prop.defaultValue %>,<% } %>
|
|
18
|
+
}
|
|
19
|
+
}<% } %>);
|
|
20
|
+
});
|
|
21
|
+
});
|
|
@@ -24,7 +24,9 @@ async function convertToWithMF(tree, schema) {
|
|
|
24
24
|
const [updatedWebpackConfig, mfConfig] = (0, lib_1.writeNewWebpackConfig)(webpackAst, (0, lib_1.isHostRemoteConfig)(webpackAst), schema.project);
|
|
25
25
|
tree.write(pathToWebpackConfig, updatedWebpackConfig);
|
|
26
26
|
tree.write((0, devkit_1.joinPathFragments)(project.root, 'module-federation.config.js'), mfConfig);
|
|
27
|
-
|
|
27
|
+
if (!schema.skipFormat) {
|
|
28
|
+
await (0, devkit_1.formatFiles)(tree);
|
|
29
|
+
}
|
|
28
30
|
}
|
|
29
31
|
exports.convertToWithMF = convertToWithMF;
|
|
30
32
|
exports.default = convertToWithMF;
|
|
@@ -4,8 +4,9 @@ exports.writeNewWebpackConfig = void 0;
|
|
|
4
4
|
const is_host_remote_config_1 = require("./is-host-remote-config");
|
|
5
5
|
function writeNewWebpackConfig(ast, mfType, projectName) {
|
|
6
6
|
const webpackConfig = `const { withModuleFederation } = require('@nx/angular/module-federation');
|
|
7
|
-
|
|
8
|
-
|
|
7
|
+
const config = require('./module-federation.config');
|
|
8
|
+
module.exports = withModuleFederation(config);
|
|
9
|
+
`;
|
|
9
10
|
let mfeConfig = '';
|
|
10
11
|
if (!mfType) {
|
|
11
12
|
mfeConfig = `
|
|
@@ -22,6 +22,12 @@
|
|
|
22
22
|
},
|
|
23
23
|
"x-prompt": "What micro frontend project would you like to migrate?",
|
|
24
24
|
"x-priority": "important"
|
|
25
|
+
},
|
|
26
|
+
"skipFormat": {
|
|
27
|
+
"description": "Skip formatting files.",
|
|
28
|
+
"type": "boolean",
|
|
29
|
+
"default": false,
|
|
30
|
+
"x-priority": "internal"
|
|
25
31
|
}
|
|
26
32
|
}
|
|
27
33
|
}
|
|
@@ -4,5 +4,5 @@ import { CypressComponentConfigSchema } from './schema';
|
|
|
4
4
|
* This is for cypress built in component testing, if you want to test with
|
|
5
5
|
* storybook + cypress then use the componentCypressGenerator instead.
|
|
6
6
|
*/
|
|
7
|
-
export declare function cypressComponentConfiguration(tree: Tree, options: CypressComponentConfigSchema): Promise<()
|
|
7
|
+
export declare function cypressComponentConfiguration(tree: Tree, options: CypressComponentConfigSchema): Promise<import("@nx/devkit").GeneratorCallback>;
|
|
8
8
|
export default cypressComponentConfiguration;
|
|
@@ -25,9 +25,7 @@ async function cypressComponentConfiguration(tree, options) {
|
|
|
25
25
|
if (!options.skipFormat) {
|
|
26
26
|
await (0, devkit_1.formatFiles)(tree);
|
|
27
27
|
}
|
|
28
|
-
return
|
|
29
|
-
installTask();
|
|
30
|
-
};
|
|
28
|
+
return installTask;
|
|
31
29
|
}
|
|
32
30
|
exports.cypressComponentConfiguration = cypressComponentConfiguration;
|
|
33
31
|
async function addFiles(tree, projectConfig, options) {
|
|
@@ -49,7 +47,7 @@ async function addFiles(tree, projectConfig, options) {
|
|
|
49
47
|
continue;
|
|
50
48
|
}
|
|
51
49
|
const componentDirFromProjectRoot = (0, path_1.relative)(projectConfig.root, (0, devkit_1.joinPathFragments)(info.moduleFolderPath, info.path));
|
|
52
|
-
(0, component_test_1.componentTestGenerator)(tree, {
|
|
50
|
+
await (0, component_test_1.componentTestGenerator)(tree, {
|
|
53
51
|
project: options.project,
|
|
54
52
|
componentName: info.name,
|
|
55
53
|
componentDir: componentDirFromProjectRoot,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {withModuleFederationForSSR} from '@nx/angular/module-federation';
|
|
1
|
+
import { withModuleFederationForSSR } from '@nx/angular/module-federation';
|
|
2
2
|
import config from './module-federation.config';
|
|
3
3
|
|
|
4
|
-
export default withModuleFederationForSSR(config)
|
|
4
|
+
export default withModuleFederationForSSR(config);
|
|
@@ -2,5 +2,5 @@ import { Route } from '@angular/router';
|
|
|
2
2
|
import { <%= libClassName %>Component } from './<%= pathToComponent %>.component';
|
|
3
3
|
|
|
4
4
|
export const <%= libPropertyName %>Routes: Route[] = [
|
|
5
|
-
{path: '', component: <%= libClassName %>Component}
|
|
5
|
+
{ path: '', component: <%= libClassName %>Component }
|
|
6
6
|
];
|
|
@@ -14,9 +14,9 @@ function addLoadChildren(tree, options) {
|
|
|
14
14
|
}
|
|
15
15
|
const moduleSource = tree.read(options.parent, 'utf-8');
|
|
16
16
|
const sourceFile = tsModule.createSourceFile(options.parent, moduleSource, tsModule.ScriptTarget.Latest, true);
|
|
17
|
-
const route = `{path: '${(0, devkit_1.names)(options.fileName).fileName}', loadChildren: () => import('${options.importPath}').then(m => m.${options.standalone
|
|
17
|
+
const route = `{ path: '${(0, devkit_1.names)(options.fileName).fileName}', loadChildren: () => import('${options.importPath}').then(m => m.${options.standalone
|
|
18
18
|
? `${(0, devkit_1.names)(options.name).propertyName}Routes`
|
|
19
|
-
: options.moduleName})}`;
|
|
19
|
+
: options.moduleName}) }`;
|
|
20
20
|
(0, route_utils_1.addRoute)(tree, options.parent, route);
|
|
21
21
|
}
|
|
22
22
|
exports.addLoadChildren = addLoadChildren;
|
|
@@ -1,5 +1 @@
|
|
|
1
|
-
<% if (!skipModule) { %>
|
|
2
|
-
export * from './lib/<%= fileName %>.module';
|
|
3
|
-
<% } else { %>
|
|
4
|
-
export const greeting = 'Hello World!';
|
|
5
|
-
<% } %>
|
|
1
|
+
<% if (!skipModule) { %>export * from './lib/<%= fileName %>.module';<% } else { %>export const greeting = 'Hello World!';<% } %>
|
|
@@ -8,7 +8,9 @@ async function librarySecondaryEntryPointGenerator(tree, rawOptions) {
|
|
|
8
8
|
(0, lib_1.addFiles)(tree, options);
|
|
9
9
|
(0, lib_1.addPathMapping)(tree, options);
|
|
10
10
|
(0, lib_1.updateTsConfigIncludedFiles)(tree, options);
|
|
11
|
-
|
|
11
|
+
if (!options.skipFormat) {
|
|
12
|
+
await (0, devkit_1.formatFiles)(tree);
|
|
13
|
+
}
|
|
12
14
|
}
|
|
13
15
|
exports.librarySecondaryEntryPointGenerator = librarySecondaryEntryPointGenerator;
|
|
14
16
|
exports.default = librarySecondaryEntryPointGenerator;
|
|
@@ -29,6 +29,12 @@
|
|
|
29
29
|
"type": "boolean",
|
|
30
30
|
"description": "Skip generating a module for the secondary entry point.",
|
|
31
31
|
"default": false
|
|
32
|
+
},
|
|
33
|
+
"skipFormat": {
|
|
34
|
+
"description": "Skip formatting files.",
|
|
35
|
+
"type": "boolean",
|
|
36
|
+
"default": false,
|
|
37
|
+
"x-priority": "internal"
|
|
32
38
|
}
|
|
33
39
|
},
|
|
34
40
|
"additionalProperties": false,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {withModuleFederationForSSR} from '@nx/angular/module-federation';
|
|
1
|
+
import { withModuleFederationForSSR } from '@nx/angular/module-federation';
|
|
2
2
|
import config from './module-federation.config';
|
|
3
3
|
|
|
4
|
-
export default withModuleFederationForSSR(config)
|
|
4
|
+
export default withModuleFederationForSSR(config);
|
|
@@ -31,7 +31,6 @@ export function app(): express.Express {
|
|
|
31
31
|
server.set('view engine', 'html');
|
|
32
32
|
server.set('views', browserBundles);
|
|
33
33
|
|
|
34
|
-
|
|
35
34
|
// Example Express Rest API endpoints
|
|
36
35
|
// server.get('/api/**', (req, res) => { });
|
|
37
36
|
// Serve static files from /browser
|
|
@@ -41,7 +40,6 @@ export function app(): express.Express {
|
|
|
41
40
|
|
|
42
41
|
// All regular routes use the Universal engine
|
|
43
42
|
server.get('*', (req, res) => {
|
|
44
|
-
|
|
45
43
|
res.render(indexHtml, {
|
|
46
44
|
req,
|
|
47
45
|
providers: [{ provide: APP_BASE_HREF, useValue: req.baseUrl }],
|
|
@@ -18,7 +18,9 @@ async function scamDirectiveGenerator(tree, rawOptions) {
|
|
|
18
18
|
});
|
|
19
19
|
(0, lib_1.convertDirectiveToScam)(tree, options);
|
|
20
20
|
(0, export_scam_1.exportScam)(tree, options);
|
|
21
|
-
|
|
21
|
+
if (!options.skipFormat) {
|
|
22
|
+
await (0, devkit_1.formatFiles)(tree);
|
|
23
|
+
}
|
|
22
24
|
}
|
|
23
25
|
exports.scamDirectiveGenerator = scamDirectiveGenerator;
|
|
24
26
|
exports.default = scamDirectiveGenerator;
|
|
@@ -84,6 +84,12 @@
|
|
|
84
84
|
"description": "Specifies if the SCAM should be exported from the project's entry point (normally `index.ts`). It only applies to libraries.",
|
|
85
85
|
"default": true,
|
|
86
86
|
"x-priority": "important"
|
|
87
|
+
},
|
|
88
|
+
"skipFormat": {
|
|
89
|
+
"description": "Skip formatting files.",
|
|
90
|
+
"type": "boolean",
|
|
91
|
+
"default": false,
|
|
92
|
+
"x-priority": "internal"
|
|
87
93
|
}
|
|
88
94
|
},
|
|
89
95
|
"required": ["name"]
|
|
@@ -18,7 +18,9 @@ async function scamPipeGenerator(tree, rawOptions) {
|
|
|
18
18
|
});
|
|
19
19
|
(0, lib_1.convertPipeToScam)(tree, options);
|
|
20
20
|
(0, export_scam_1.exportScam)(tree, options);
|
|
21
|
-
|
|
21
|
+
if (!options.skipFormat) {
|
|
22
|
+
await (0, devkit_1.formatFiles)(tree);
|
|
23
|
+
}
|
|
22
24
|
}
|
|
23
25
|
exports.scamPipeGenerator = scamPipeGenerator;
|
|
24
26
|
exports.default = scamPipeGenerator;
|
|
@@ -65,6 +65,12 @@
|
|
|
65
65
|
"description": "Specifies if the SCAM should be exported from the project's entry point (normally `index.ts`). It only applies to libraries.",
|
|
66
66
|
"default": true,
|
|
67
67
|
"x-priority": "important"
|
|
68
|
+
},
|
|
69
|
+
"skipFormat": {
|
|
70
|
+
"description": "Skip formatting files.",
|
|
71
|
+
"type": "boolean",
|
|
72
|
+
"default": false,
|
|
73
|
+
"x-priority": "internal"
|
|
68
74
|
}
|
|
69
75
|
},
|
|
70
76
|
"required": ["name"]
|
|
@@ -37,6 +37,8 @@ describe('AppComponent', () => {
|
|
|
37
37
|
tick();
|
|
38
38
|
fixture.detectChanges();
|
|
39
39
|
const compiled = fixture.nativeElement as HTMLElement;
|
|
40
|
-
expect(compiled.querySelector('h1')?.textContent).toContain(
|
|
40
|
+
expect(compiled.querySelector('h1')?.textContent).toContain(
|
|
41
|
+
'Welcome <%= appName %>'
|
|
42
|
+
);
|
|
41
43
|
}));
|
|
42
44
|
});
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import {withModuleFederation} from '@nx/angular/module-federation';
|
|
1
|
+
import { withModuleFederation } from '@nx/angular/module-federation';
|
|
2
2
|
import config from './module-federation.config';
|
|
3
3
|
|
|
4
4
|
export default withModuleFederation({
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
5
|
+
...config,
|
|
6
|
+
/*
|
|
7
|
+
* Remote overrides for production.
|
|
8
|
+
* Each entry is a pair of a unique name and the URL where it is deployed.
|
|
9
|
+
*
|
|
10
|
+
* e.g.
|
|
11
|
+
* remotes: [
|
|
12
|
+
* ['app1', 'https://app1.example.com'],
|
|
13
|
+
* ['app2', 'https://app2.example.com'],
|
|
14
|
+
* ]
|
|
15
|
+
*/
|
|
16
16
|
});
|
|
@@ -16,7 +16,7 @@ function addRemoteEntry(tree, { appName, routing, prefix, standalone }, appRoot)
|
|
|
16
16
|
(0, route_utils_1.addRoute)(tree, (0, devkit_1.joinPathFragments)(appRoot, 'src/app/app.routes.ts'), `{path: '', loadChildren: () => import('./remote-entry/entry.routes').then(m => m.remoteRoutes)}`);
|
|
17
17
|
}
|
|
18
18
|
else if (routing) {
|
|
19
|
-
(0, route_utils_1.addRoute)(tree, (0, devkit_1.joinPathFragments)(appRoot, 'src/app/app.routes.ts'), `{path: '', loadChildren: () => import('./remote-entry/entry.module').then(m => m.RemoteEntryModule)}`);
|
|
19
|
+
(0, route_utils_1.addRoute)(tree, (0, devkit_1.joinPathFragments)(appRoot, 'src/app/app.routes.ts'), `{ path: '', loadChildren: () => import('./remote-entry/entry.module').then(m => m.RemoteEntryModule) }`);
|
|
20
20
|
}
|
|
21
21
|
}
|
|
22
22
|
exports.addRemoteEntry = addRemoteEntry;
|
|
@@ -102,7 +102,7 @@ function addLazyLoadedRouteToHostAppModule(tree, options, hostFederationType) {
|
|
|
102
102
|
if (appComponent.includes(`<ul class="remote-menu">`) &&
|
|
103
103
|
appComponent.includes('</ul>')) {
|
|
104
104
|
const indexOfClosingMenuTag = appComponent.indexOf('</ul>');
|
|
105
|
-
const newAppComponent = `${appComponent.slice(0, indexOfClosingMenuTag)}<li><a routerLink=
|
|
105
|
+
const newAppComponent = `${appComponent.slice(0, indexOfClosingMenuTag)}<li><a routerLink="${options.appName}">${(0, devkit_1.names)(options.appName).className}</a></li>\n${appComponent.slice(indexOfClosingMenuTag)}`;
|
|
106
106
|
tree.write(pathToAppComponentTemplate, newAppComponent);
|
|
107
107
|
}
|
|
108
108
|
}
|
|
@@ -11,10 +11,10 @@ function fixBootstrap(tree, appRoot, options) {
|
|
|
11
11
|
else {
|
|
12
12
|
tree.write((0, devkit_1.joinPathFragments)(appRoot, 'src/bootstrap.ts'), bootstrapCode);
|
|
13
13
|
}
|
|
14
|
-
const bootstrapImportCode = `import('./bootstrap').catch(err => console.error(err))
|
|
14
|
+
const bootstrapImportCode = `import('./bootstrap').catch(err => console.error(err));`;
|
|
15
15
|
const fetchMFManifestCode = `import { setRemoteDefinitions } from '@nx/angular/mf';
|
|
16
16
|
|
|
17
|
-
|
|
17
|
+
fetch('/assets/module-federation.manifest.json')
|
|
18
18
|
.then((res) => res.json())
|
|
19
19
|
.then(definitions => setRemoteDefinitions(definitions))
|
|
20
20
|
.then(() => ${bootstrapImportCode})`;
|
|
@@ -23,10 +23,11 @@ function fixBootstrap(tree, appRoot, options) {
|
|
|
23
23
|
: bootstrapImportCode);
|
|
24
24
|
}
|
|
25
25
|
exports.fixBootstrap = fixBootstrap;
|
|
26
|
-
const standaloneBootstrapCode = () => `import {bootstrapApplication} from
|
|
27
|
-
import {appConfig} from './app/app.config';
|
|
28
|
-
import {RemoteEntryComponent} from './app/remote-entry/entry.component';
|
|
26
|
+
const standaloneBootstrapCode = () => `import { bootstrapApplication } from '@angular/platform-browser';
|
|
27
|
+
import { appConfig } from './app/app.config';
|
|
28
|
+
import { RemoteEntryComponent } from './app/remote-entry/entry.component';
|
|
29
29
|
|
|
30
30
|
bootstrapApplication(RemoteEntryComponent, appConfig).catch((err) =>
|
|
31
31
|
console.error(err)
|
|
32
|
-
)
|
|
32
|
+
);
|
|
33
|
+
`;
|
|
@@ -30,16 +30,16 @@ import { RouterModule } from '@angular/router';
|
|
|
30
30
|
import { AppComponent } from './app.component';
|
|
31
31
|
|
|
32
32
|
@NgModule({
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
33
|
+
declarations: [AppComponent],
|
|
34
|
+
imports: [
|
|
35
|
+
BrowserModule,
|
|
36
|
+
RouterModule.forRoot([{
|
|
37
|
+
path: '',
|
|
38
|
+
loadChildren: () => import('./remote-entry/entry.module').then(m => m.RemoteEntryModule)
|
|
39
|
+
}], { initialNavigation: 'enabledBlocking' }),
|
|
40
|
+
],
|
|
41
|
+
providers: [],
|
|
42
|
+
bootstrap: [AppComponent],
|
|
43
43
|
})
|
|
44
44
|
export class AppModule {}`);
|
|
45
45
|
}
|
|
@@ -15,7 +15,7 @@ function updateHostAppRoutes(tree, options) {
|
|
|
15
15
|
? options.remotes.reduce((routes, remote) => `${routes}\n<li><a routerLink='${remote}'>${(0, devkit_1.names)(remote).className}</a></li>`, '')
|
|
16
16
|
: '';
|
|
17
17
|
tree.write((0, devkit_1.joinPathFragments)(sourceRoot, 'app/app.component.html'), `<ul class="remote-menu">
|
|
18
|
-
<li><a routerLink=
|
|
18
|
+
<li><a routerLink="/">Home</a></li>${remoteRoutes}
|
|
19
19
|
</ul>
|
|
20
20
|
<router-outlet></router-outlet>
|
|
21
21
|
`);
|
|
@@ -31,7 +31,7 @@ function updateHostAppRoutes(tree, options) {
|
|
|
31
31
|
component: NxWelcomeComponent
|
|
32
32
|
}`);
|
|
33
33
|
tree.write(pathToHostRootRoutingFile, `import { NxWelcomeComponent } from './nx-welcome.component';
|
|
34
|
-
|
|
34
|
+
${tree.read(pathToHostRootRoutingFile, 'utf-8')}`);
|
|
35
35
|
(0, devkit_1.generateFiles)(tree, (0, devkit_1.joinPathFragments)(__dirname, '../files/host-files'), (0, devkit_1.joinPathFragments)(sourceRoot, 'app'), {
|
|
36
36
|
appName: options.appName,
|
|
37
37
|
standalone: options.standalone,
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import 'zone.js/dist/zone-node';
|
|
2
2
|
|
|
3
|
-
import {APP_BASE_HREF} from '@angular/common';
|
|
4
|
-
import {ngExpressEngine} from '@nguniversal/express-engine';
|
|
3
|
+
import { APP_BASE_HREF } from '@angular/common';
|
|
4
|
+
import { ngExpressEngine } from '@nguniversal/express-engine';
|
|
5
5
|
import * as express from 'express';
|
|
6
|
-
import {existsSync} from 'fs';
|
|
7
|
-
import {join} from 'path';
|
|
6
|
+
import { existsSync } from 'fs';
|
|
7
|
+
import { join } from 'path';
|
|
8
8
|
import <% if (standalone) { %>bootstrap<% } else { %>{ <%= rootModuleClassName %> }<% } %> from './src/<%= main.slice(0, -3) %>';
|
|
9
9
|
|
|
10
10
|
// The Express app is exported so that it can be used by serverless Functions.
|
|
@@ -72,7 +72,7 @@ function updateRouterModuleForRootCallExpression(node) {
|
|
|
72
72
|
(0, typescript_1.isIdentifier)(exp.name) &&
|
|
73
73
|
exp.name.text === 'initialNavigation')))
|
|
74
74
|
: typescript_1.factory.createNodeArray();
|
|
75
|
-
const enabledLiteral = typescript_1.factory.createStringLiteral('enabledBlocking');
|
|
75
|
+
const enabledLiteral = typescript_1.factory.createStringLiteral('enabledBlocking', true);
|
|
76
76
|
const initialNavigationProperty = typescript_1.factory.createPropertyAssignment('initialNavigation', enabledLiteral);
|
|
77
77
|
const routerOptions = existingOptions
|
|
78
78
|
? typescript_1.factory.updateObjectLiteralExpression(existingOptions, typescript_1.factory.createNodeArray([
|
|
@@ -25,12 +25,12 @@ function exportScam(tree, options) {
|
|
|
25
25
|
const relativePathFromEntryPoint = (0, path_1.getRelativeImportToFile)(entryPointPath, options.filePath);
|
|
26
26
|
const entryPointContent = tree.read(entryPointPath, 'utf-8');
|
|
27
27
|
let updatedEntryPointContent = (0, devkit_1.stripIndents) `${entryPointContent}
|
|
28
|
-
export * from
|
|
28
|
+
export * from '${relativePathFromEntryPoint}';`;
|
|
29
29
|
if (!options.inlineScam) {
|
|
30
30
|
const moduleFilePath = (0, devkit_1.joinPathFragments)(options.directory, `${(0, devkit_1.names)(options.name).fileName}.module.ts`);
|
|
31
31
|
const relativePathFromModule = (0, path_1.getRelativeImportToFile)(entryPointPath, moduleFilePath);
|
|
32
32
|
updatedEntryPointContent = (0, devkit_1.stripIndents) `${updatedEntryPointContent}
|
|
33
|
-
export * from
|
|
33
|
+
export * from '${relativePathFromModule}';`;
|
|
34
34
|
}
|
|
35
35
|
tree.write(entryPointPath, updatedEntryPointContent);
|
|
36
36
|
}
|
|
@@ -51,7 +51,7 @@ async function createStorybookTestWorkspaceForLib(libName) {
|
|
|
51
51
|
linter: eslint_1.Linter.EsLint,
|
|
52
52
|
publishable: false,
|
|
53
53
|
simpleName: false,
|
|
54
|
-
skipFormat:
|
|
54
|
+
skipFormat: true,
|
|
55
55
|
unitTestRunner: test_runners_1.UnitTestRunner.Jest,
|
|
56
56
|
projectNameAndRootFormat: 'as-provided',
|
|
57
57
|
standalone: false,
|
|
@@ -60,6 +60,7 @@ async function createStorybookTestWorkspaceForLib(libName) {
|
|
|
60
60
|
name: 'test-button',
|
|
61
61
|
project: libName,
|
|
62
62
|
standalone: false,
|
|
63
|
+
skipFormat: true,
|
|
63
64
|
});
|
|
64
65
|
tree.write(`${libName}/src/lib/test-button/test-button.component.ts`, `import { Component, Input } from '@angular/core';
|
|
65
66
|
|
|
@@ -91,6 +92,7 @@ export class TestButtonComponent {
|
|
|
91
92
|
path: `${libName}/src/lib/barrel`,
|
|
92
93
|
module: 'barrel',
|
|
93
94
|
standalone: false,
|
|
95
|
+
skipFormat: true,
|
|
94
96
|
});
|
|
95
97
|
tree.write(`${libName}/src/lib/barrel/barrel-button/index.ts`, `export * from './barrel-button.component';`);
|
|
96
98
|
tree.write(`${libName}/src/lib/barrel/barrel.module.ts`, `import { NgModule } from '@angular/core';
|
|
@@ -113,6 +115,7 @@ export class BarrelModule {}`);
|
|
|
113
115
|
path: `${libName}/src/lib/variable-declare`,
|
|
114
116
|
module: 'variable-declare',
|
|
115
117
|
standalone: false,
|
|
118
|
+
skipFormat: true,
|
|
116
119
|
});
|
|
117
120
|
await (0, component_1.componentGenerator)(tree, {
|
|
118
121
|
name: 'variable-declare-view',
|
|
@@ -120,6 +123,7 @@ export class BarrelModule {}`);
|
|
|
120
123
|
path: `${libName}/src/lib/variable-declare`,
|
|
121
124
|
module: 'variable-declare',
|
|
122
125
|
standalone: false,
|
|
126
|
+
skipFormat: true,
|
|
123
127
|
});
|
|
124
128
|
tree.write(`${libName}/src/lib/variable-declare/variable-declare.module.ts`, `import { NgModule } from '@angular/core';
|
|
125
129
|
import { CommonModule } from '@angular/common';
|
|
@@ -148,6 +152,7 @@ export class VariableDeclareModule {}`);
|
|
|
148
152
|
path: `${libName}/src/lib/variable-spread-declare`,
|
|
149
153
|
module: 'variable-spread-declare',
|
|
150
154
|
standalone: false,
|
|
155
|
+
skipFormat: true,
|
|
151
156
|
});
|
|
152
157
|
await (0, component_1.componentGenerator)(tree, {
|
|
153
158
|
name: 'variable-spread-declare-view',
|
|
@@ -155,6 +160,7 @@ export class VariableDeclareModule {}`);
|
|
|
155
160
|
path: `${libName}/src/lib/variable-spread-declare`,
|
|
156
161
|
module: 'variable-spread-declare',
|
|
157
162
|
standalone: false,
|
|
163
|
+
skipFormat: true,
|
|
158
164
|
});
|
|
159
165
|
await (0, component_1.componentGenerator)(tree, {
|
|
160
166
|
name: 'variable-spread-declare-anotherview',
|
|
@@ -162,6 +168,7 @@ export class VariableDeclareModule {}`);
|
|
|
162
168
|
path: `${libName}/src/lib/variable-spread-declare`,
|
|
163
169
|
module: 'variable-spread-declare',
|
|
164
170
|
standalone: false,
|
|
171
|
+
skipFormat: true,
|
|
165
172
|
});
|
|
166
173
|
tree.write(`${libName}/src/lib/variable-spread-declare/variable-spread-declare.module.ts`, `import { NgModule } from '@angular/core';
|
|
167
174
|
import { CommonModule } from '@angular/common';
|
|
@@ -190,6 +197,7 @@ export class VariableSpreadDeclareModule {}`);
|
|
|
190
197
|
path: `${libName}/src/lib/static-member-declarations`,
|
|
191
198
|
module: 'static-member-declarations',
|
|
192
199
|
standalone: false,
|
|
200
|
+
skipFormat: true,
|
|
193
201
|
});
|
|
194
202
|
await (0, component_1.componentGenerator)(tree, {
|
|
195
203
|
name: 'cmp2',
|
|
@@ -197,6 +205,7 @@ export class VariableSpreadDeclareModule {}`);
|
|
|
197
205
|
path: `${libName}/src/lib/static-member-declarations`,
|
|
198
206
|
module: 'static-member-declarations',
|
|
199
207
|
standalone: false,
|
|
208
|
+
skipFormat: true,
|
|
200
209
|
});
|
|
201
210
|
tree.write(`${libName}/src/lib/static-member-declarations/static-member-declarations.module.ts`, `import { NgModule } from '@angular/core';
|
|
202
211
|
import { CommonModule } from '@angular/common';
|
|
@@ -223,11 +232,13 @@ export class StaticMemberDeclarationsModule {
|
|
|
223
232
|
module: 'nested',
|
|
224
233
|
path: `${libName}/src/lib/nested`,
|
|
225
234
|
standalone: false,
|
|
235
|
+
skipFormat: true,
|
|
226
236
|
});
|
|
227
237
|
await (0, component_1.componentGenerator)(tree, {
|
|
228
238
|
name: 'test-other',
|
|
229
239
|
project: libName,
|
|
230
240
|
standalone: false,
|
|
241
|
+
skipFormat: true,
|
|
231
242
|
});
|
|
232
243
|
return tree;
|
|
233
244
|
}
|
|
@@ -19,26 +19,24 @@ function createApp(tree, appName, routing = true) {
|
|
|
19
19
|
appName,
|
|
20
20
|
appModule: `${appName}/src/app/app.module.ts`,
|
|
21
21
|
};
|
|
22
|
-
tree.write(appConfig.appModule, `
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
tree.write(`${appName}/src/main.ts`, `
|
|
35
|
-
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
|
|
22
|
+
tree.write(appConfig.appModule, `import { NgModule } from '@angular/core';
|
|
23
|
+
import { BrowserModule } from '@angular/platform-browser';
|
|
24
|
+
${routing ? "import { RouterModule } from '@angular/router'" : ''};
|
|
25
|
+
import { AppComponent } from './app.component';
|
|
26
|
+
@NgModule({
|
|
27
|
+
imports: [BrowserModule, ${routing ? 'RouterModule.forRoot([])' : ''}],
|
|
28
|
+
declarations: [AppComponent],
|
|
29
|
+
bootstrap: [AppComponent]
|
|
30
|
+
})
|
|
31
|
+
export class AppModule {}
|
|
32
|
+
`);
|
|
33
|
+
tree.write(`${appName}/src/main.ts`, `import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
|
|
36
34
|
|
|
37
|
-
|
|
35
|
+
import { AppModule } from './app/app.module';
|
|
38
36
|
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
37
|
+
platformBrowserDynamic()
|
|
38
|
+
.bootstrapModule(AppModule)
|
|
39
|
+
.catch(err => console.log(err));
|
|
42
40
|
`);
|
|
43
41
|
tree.write(`${appName}/tsconfig.app.json`, JSON.stringify({
|
|
44
42
|
include: ['**/*.ts'],
|
|
@@ -70,19 +68,17 @@ function createLib(tree, libName) {
|
|
|
70
68
|
module: `${propertyName}/src/lib/${fileName}.module.ts`,
|
|
71
69
|
barrel: `${propertyName}/src/index.ts`,
|
|
72
70
|
};
|
|
73
|
-
tree.write(libConfig.module, `
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
export class ${className}Module { }
|
|
83
|
-
`);
|
|
84
|
-
tree.write(libConfig.barrel, `
|
|
85
|
-
export * from './lib/${fileName}.module';
|
|
71
|
+
tree.write(libConfig.module, `import { NgModule } from '@angular/core';
|
|
72
|
+
import { CommonModule } from '@angular/common';
|
|
73
|
+
@NgModule({
|
|
74
|
+
imports: [
|
|
75
|
+
CommonModule
|
|
76
|
+
],
|
|
77
|
+
providers: []
|
|
78
|
+
})
|
|
79
|
+
export class ${className}Module { }
|
|
86
80
|
`);
|
|
81
|
+
tree.write(libConfig.barrel, `export * from './lib/${fileName}.module';
|
|
82
|
+
`);
|
|
87
83
|
}
|
|
88
84
|
exports.createLib = createLib;
|
package/src/utils/versions.d.ts
CHANGED
|
@@ -21,6 +21,6 @@ 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
23
|
export declare const jestPresetAngularVersion = "~13.1.4";
|
|
24
|
-
export declare const typesNodeVersion = "16.
|
|
24
|
+
export declare const typesNodeVersion = "18.16.9";
|
|
25
25
|
export declare const jasmineMarblesVersion = "^0.9.2";
|
|
26
26
|
export declare const jsoncEslintParserVersion = "^2.1.0";
|
package/src/utils/versions.js
CHANGED
|
@@ -24,6 +24,6 @@ exports.postcssUrlVersion = '~10.1.3';
|
|
|
24
24
|
exports.autoprefixerVersion = '^10.4.0';
|
|
25
25
|
exports.tsNodeVersion = '10.9.1';
|
|
26
26
|
exports.jestPresetAngularVersion = '~13.1.4';
|
|
27
|
-
exports.typesNodeVersion = '16.
|
|
27
|
+
exports.typesNodeVersion = '18.16.9';
|
|
28
28
|
exports.jasmineMarblesVersion = '^0.9.2';
|
|
29
29
|
exports.jsoncEslintParserVersion = '^2.1.0';
|