@nrwl/angular 14.4.0-beta.1 → 14.4.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/CHANGELOG.md +1 -1
- package/migrations.json +16 -0
- package/package.json +9 -9
- package/src/generators/change-storybook-targets/change-storybook-targets.d.ts +2 -1
- package/src/generators/change-storybook-targets/change-storybook-targets.js +5 -1
- package/src/generators/change-storybook-targets/change-storybook-targets.js.map +1 -1
- package/src/generators/change-storybook-targets/compat.d.ts +1 -1
- package/src/generators/change-storybook-targets/schema.d.ts +3 -0
- package/src/generators/change-storybook-targets/schema.json +7 -1
- package/src/generators/component/component.d.ts +1 -1
- package/src/generators/component/component.js +7 -4
- package/src/generators/component/component.js.map +1 -1
- package/src/generators/component/lib/component.d.ts +2 -2
- package/src/generators/component/lib/component.js +8 -15
- package/src/generators/component/lib/component.js.map +1 -1
- package/src/generators/component/lib/entry-point.d.ts +0 -1
- package/src/generators/component/lib/entry-point.js +3 -21
- package/src/generators/component/lib/entry-point.js.map +1 -1
- package/src/generators/component/lib/module.d.ts +2 -2
- package/src/generators/component/lib/module.js.map +1 -1
- package/src/generators/component/lib/normalize-options.d.ts +3 -0
- package/src/generators/component/lib/normalize-options.js +16 -0
- package/src/generators/component/lib/normalize-options.js.map +1 -0
- package/src/generators/component/schema.d.ts +6 -0
- package/src/generators/component-cypress-spec/component-cypress-spec.js +3 -0
- package/src/generators/component-cypress-spec/component-cypress-spec.js.map +1 -1
- package/src/generators/component-cypress-spec/schema.d.ts +1 -0
- package/src/generators/component-cypress-spec/schema.json +5 -0
- package/src/generators/component-story/component-story.js +3 -0
- package/src/generators/component-story/component-story.js.map +1 -1
- package/src/generators/component-story/schema.d.ts +1 -0
- package/src/generators/component-story/schema.json +5 -0
- package/src/generators/scam/lib/convert-component-to-scam.d.ts +4 -0
- package/src/generators/scam/lib/convert-component-to-scam.js +44 -0
- package/src/generators/scam/lib/convert-component-to-scam.js.map +1 -0
- package/src/generators/scam/lib/export-scam.d.ts +4 -0
- package/src/generators/scam/lib/export-scam.js +37 -0
- package/src/generators/scam/lib/export-scam.js.map +1 -0
- package/src/generators/scam/lib/index.d.ts +3 -0
- package/src/generators/scam/lib/index.js +6 -0
- package/src/generators/scam/lib/index.js.map +1 -1
- package/src/generators/scam/lib/normalize-options.d.ts +3 -0
- package/src/generators/scam/lib/normalize-options.js +16 -0
- package/src/generators/scam/lib/normalize-options.js.map +1 -0
- package/src/generators/scam/scam.d.ts +1 -1
- package/src/generators/scam/scam.js +10 -6
- package/src/generators/scam/scam.js.map +1 -1
- package/src/generators/scam/schema.d.ts +6 -0
- package/src/generators/stories/schema.d.ts +1 -0
- package/src/generators/stories/schema.json +5 -0
- package/src/generators/stories/stories.js +5 -0
- package/src/generators/stories/stories.js.map +1 -1
- package/src/generators/storybook-configuration/schema.d.ts +1 -0
- package/src/generators/storybook-configuration/schema.json +5 -0
- package/src/generators/storybook-configuration/storybook-configuration.d.ts +1 -1
- package/src/generators/storybook-configuration/storybook-configuration.js +5 -1
- package/src/generators/storybook-configuration/storybook-configuration.js.map +1 -1
- package/src/generators/utils/component.d.ts +14 -0
- package/src/generators/utils/component.js +20 -0
- package/src/generators/utils/component.js.map +1 -0
- package/src/generators/utils/entry-point.d.ts +2 -0
- package/src/generators/utils/entry-point.js +22 -0
- package/src/generators/utils/entry-point.js.map +1 -0
- package/src/generators/utils/path.d.ts +1 -0
- package/src/generators/utils/path.js +7 -1
- package/src/generators/utils/path.js.map +1 -1
- package/src/utils/versions.d.ts +1 -1
- package/src/utils/versions.js +1 -1
- package/src/generators/component/lib/path.d.ts +0 -1
- package/src/generators/component/lib/path.js +0 -11
- package/src/generators/component/lib/path.js.map +0 -1
- package/src/generators/scam/lib/create-module.d.ts +0 -3
- package/src/generators/scam/lib/create-module.js +0 -90
- package/src/generators/scam/lib/create-module.js.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,6 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
-
# [14.4.0-beta.
|
|
6
|
+
# [14.4.0-beta.2](https://github.com/nrwl/nx/compare/14.3.6...14.4.0-beta.2) (2022-06-27)
|
|
7
7
|
|
|
8
8
|
**Note:** Version bump only for package @nrwl/angular
|
package/migrations.json
CHANGED
|
@@ -1314,6 +1314,22 @@
|
|
|
1314
1314
|
"alwaysAddToPackageJson": false
|
|
1315
1315
|
},
|
|
1316
1316
|
"@ngrx/component-store": {
|
|
1317
|
+
"version": "~14.0.0"
|
|
1318
|
+
}
|
|
1319
|
+
}
|
|
1320
|
+
},
|
|
1321
|
+
"14.4.0": {
|
|
1322
|
+
"version": "14.4.0-beta.1",
|
|
1323
|
+
"packages": {
|
|
1324
|
+
"@angular-eslint/eslint-plugin": {
|
|
1325
|
+
"version": "~14.0.0",
|
|
1326
|
+
"alwaysAddToPackageJson": false
|
|
1327
|
+
},
|
|
1328
|
+
"@angular-eslint/eslint-plugin-template": {
|
|
1329
|
+
"version": "~14.0.0",
|
|
1330
|
+
"alwaysAddToPackageJson": false
|
|
1331
|
+
},
|
|
1332
|
+
"@angular-eslint/template-parser": {
|
|
1317
1333
|
"version": "~14.0.0",
|
|
1318
1334
|
"alwaysAddToPackageJson": false
|
|
1319
1335
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nrwl/angular",
|
|
3
|
-
"version": "14.4.0-beta.
|
|
3
|
+
"version": "14.4.0-beta.2",
|
|
4
4
|
"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, Cypress, Karma, and Protractor. \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.",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -65,13 +65,13 @@
|
|
|
65
65
|
},
|
|
66
66
|
"dependencies": {
|
|
67
67
|
"@angular-devkit/schematics": "~14.0.0",
|
|
68
|
-
"@nrwl/cypress": "14.4.0-beta.
|
|
69
|
-
"@nrwl/devkit": "14.4.0-beta.
|
|
70
|
-
"@nrwl/jest": "14.4.0-beta.
|
|
71
|
-
"@nrwl/linter": "14.4.0-beta.
|
|
72
|
-
"@nrwl/storybook": "14.4.0-beta.
|
|
73
|
-
"@nrwl/web": "14.4.0-beta.
|
|
74
|
-
"@nrwl/workspace": "14.4.0-beta.
|
|
68
|
+
"@nrwl/cypress": "14.4.0-beta.2",
|
|
69
|
+
"@nrwl/devkit": "14.4.0-beta.2",
|
|
70
|
+
"@nrwl/jest": "14.4.0-beta.2",
|
|
71
|
+
"@nrwl/linter": "14.4.0-beta.2",
|
|
72
|
+
"@nrwl/storybook": "14.4.0-beta.2",
|
|
73
|
+
"@nrwl/web": "14.4.0-beta.2",
|
|
74
|
+
"@nrwl/workspace": "14.4.0-beta.2",
|
|
75
75
|
"@phenomnomnominal/tsquery": "4.1.1",
|
|
76
76
|
"@schematics/angular": "~14.0.0",
|
|
77
77
|
"chalk": "4.1.0",
|
|
@@ -94,5 +94,5 @@
|
|
|
94
94
|
"fesm2015": "fesm2015/nrwl-angular.mjs",
|
|
95
95
|
"typings": "index.d.ts",
|
|
96
96
|
"sideEffects": false,
|
|
97
|
-
"gitHead": "
|
|
97
|
+
"gitHead": "bf11bbf70947113abdf3495eaaa5fbfd1e26a894"
|
|
98
98
|
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
import type { Tree } from '@nrwl/devkit';
|
|
2
|
-
|
|
2
|
+
import type { Schema } from './schema';
|
|
3
|
+
export declare function angularChangeStorybookTargestGenerator(tree: Tree, schema: Schema): Promise<void>;
|
|
3
4
|
export default angularChangeStorybookTargestGenerator;
|
|
@@ -2,10 +2,14 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.angularChangeStorybookTargestGenerator = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
|
+
const devkit_1 = require("@nrwl/devkit");
|
|
5
6
|
const storybook_1 = require("@nrwl/storybook");
|
|
6
|
-
function angularChangeStorybookTargestGenerator(tree) {
|
|
7
|
+
function angularChangeStorybookTargestGenerator(tree, schema) {
|
|
7
8
|
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
8
9
|
yield (0, storybook_1.changeStorybookTargetsGenerator)(tree);
|
|
10
|
+
if (!schema.skipFormat) {
|
|
11
|
+
yield (0, devkit_1.formatFiles)(tree);
|
|
12
|
+
}
|
|
9
13
|
});
|
|
10
14
|
}
|
|
11
15
|
exports.angularChangeStorybookTargestGenerator = angularChangeStorybookTargestGenerator;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"change-storybook-targets.js","sourceRoot":"","sources":["../../../../../../packages/angular/src/generators/change-storybook-targets/change-storybook-targets.ts"],"names":[],"mappings":";;;;AACA,+CAAkE;
|
|
1
|
+
{"version":3,"file":"change-storybook-targets.js","sourceRoot":"","sources":["../../../../../../packages/angular/src/generators/change-storybook-targets/change-storybook-targets.ts"],"names":[],"mappings":";;;;AACA,yCAA2C;AAC3C,+CAAkE;AAIlE,SAAsB,sCAAsC,CAC1D,IAAU,EACV,MAAc;;QAEd,MAAM,IAAA,2CAA+B,EAAC,IAAI,CAAC,CAAC;QAE5C,IAAI,CAAC,MAAM,CAAC,UAAU,EAAE;YACtB,MAAM,IAAA,oBAAW,EAAC,IAAI,CAAC,CAAC;SACzB;IACH,CAAC;CAAA;AATD,wFASC;AAED,kBAAe,sCAAsC,CAAC"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
declare const _default: (generatorOptions:
|
|
1
|
+
declare const _default: (generatorOptions: import("./schema").Schema) => (tree: any, context: any) => Promise<any>;
|
|
2
2
|
export default _default;
|
|
@@ -5,7 +5,13 @@
|
|
|
5
5
|
"description": "Change the Storybook target executors.",
|
|
6
6
|
"type": "object",
|
|
7
7
|
"cli": "nx",
|
|
8
|
-
"properties": {
|
|
8
|
+
"properties": {
|
|
9
|
+
"skipFormat": {
|
|
10
|
+
"description": "Skip formatting files.",
|
|
11
|
+
"type": "boolean",
|
|
12
|
+
"default": false
|
|
13
|
+
}
|
|
14
|
+
},
|
|
9
15
|
"additionalProperties": false,
|
|
10
16
|
"required": []
|
|
11
17
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import type { Tree } from '@nrwl/devkit';
|
|
2
2
|
import type { Schema } from './schema';
|
|
3
|
-
export declare function componentGenerator(tree: Tree,
|
|
3
|
+
export declare function componentGenerator(tree: Tree, rawOptions: Schema): Promise<void>;
|
|
4
4
|
export default componentGenerator;
|
|
@@ -6,12 +6,15 @@ const devkit_1 = require("@nrwl/devkit");
|
|
|
6
6
|
const ngcli_adapter_1 = require("@nrwl/devkit/ngcli-adapter");
|
|
7
7
|
const path_1 = require("../utils/path");
|
|
8
8
|
const component_1 = require("./lib/component");
|
|
9
|
-
|
|
9
|
+
const normalize_options_1 = require("./lib/normalize-options");
|
|
10
|
+
function componentGenerator(tree, rawOptions) {
|
|
10
11
|
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
11
|
-
|
|
12
|
+
const options = (0, normalize_options_1.normalizeOptions)(tree, rawOptions);
|
|
13
|
+
const { projectSourceRoot } = options, schematicOptions = tslib_1.__rest(options, ["projectSourceRoot"]);
|
|
14
|
+
checkPathUnderProjectRoot(tree, options);
|
|
12
15
|
const angularComponentSchematic = (0, ngcli_adapter_1.wrapAngularDevkitSchematic)('@schematics/angular', 'component');
|
|
13
|
-
yield angularComponentSchematic(tree,
|
|
14
|
-
(0, component_1.exportComponentInEntryPoint)(tree,
|
|
16
|
+
yield angularComponentSchematic(tree, schematicOptions);
|
|
17
|
+
(0, component_1.exportComponentInEntryPoint)(tree, options);
|
|
15
18
|
yield (0, devkit_1.formatFiles)(tree);
|
|
16
19
|
});
|
|
17
20
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"component.js","sourceRoot":"","sources":["../../../../../../packages/angular/src/generators/component/component.ts"],"names":[],"mappings":";;;;AACA,yCAKsB;AACtB,8DAAwE;AACxE,wCAA+C;AAC/C,+CAA8D;
|
|
1
|
+
{"version":3,"file":"component.js","sourceRoot":"","sources":["../../../../../../packages/angular/src/generators/component/component.ts"],"names":[],"mappings":";;;;AACA,yCAKsB;AACtB,8DAAwE;AACxE,wCAA+C;AAC/C,+CAA8D;AAC9D,+DAA2D;AAG3D,SAAsB,kBAAkB,CAAC,IAAU,EAAE,UAAkB;;QACrE,MAAM,OAAO,GAAG,IAAA,oCAAgB,EAAC,IAAI,EAAE,UAAU,CAAC,CAAC;QACnD,MAAM,EAAE,iBAAiB,KAA0B,OAAO,EAA5B,gBAAgB,kBAAK,OAAO,EAApD,qBAA0C,CAAU,CAAC;QAE3D,yBAAyB,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;QAEzC,MAAM,yBAAyB,GAAG,IAAA,0CAA0B,EAC1D,qBAAqB,EACrB,WAAW,CACZ,CAAC;QACF,MAAM,yBAAyB,CAAC,IAAI,EAAE,gBAAgB,CAAC,CAAC;QAExD,IAAA,uCAA2B,EAAC,IAAI,EAAE,OAAO,CAAC,CAAC;QAE3C,MAAM,IAAA,oBAAW,EAAC,IAAI,CAAC,CAAC;IAC1B,CAAC;CAAA;AAfD,gDAeC;AAED,SAAS,yBAAyB,CAAC,IAAU,EAAE,MAAwB;;IACrE,IAAI,CAAC,MAAM,CAAC,IAAI,EAAE;QAChB,OAAO;KACR;IAED,MAAM,OAAO,GACX,MAAA,MAAM,CAAC,OAAO,mCAAI,IAAA,mCAA0B,EAAC,IAAI,CAAC,CAAC,cAAc,CAAC;IACpE,MAAM,EAAE,IAAI,EAAE,GAAG,IAAA,iCAAwB,EAAC,IAAI,EAAE,OAAO,CAAC,CAAC;IAEzD,IAAI,eAAe,GAAG,IAAA,sBAAa,EAAC,MAAM,CAAC,IAAI,CAAC,CAAC;IACjD,eAAe,GAAG,eAAe,CAAC,UAAU,CAAC,GAAG,CAAC;QAC/C,CAAC,CAAC,eAAe,CAAC,KAAK,CAAC,CAAC,CAAC;QAC1B,CAAC,CAAC,eAAe,CAAC;IAEpB,IAAI,CAAC,IAAA,qBAAc,EAAC,eAAe,EAAE,IAAI,CAAC,EAAE;QAC1C,MAAM,IAAI,KAAK,CACb,wCAAwC,MAAM,CAAC,IAAI,4CAA4C,IAAI,KAAK;YACtG,wEAAwE,CAC3E,CAAC;KACH;AACH,CAAC;AAED,kBAAe,kBAAkB,CAAC"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import type { Tree } from '@nrwl/devkit';
|
|
2
|
-
import type {
|
|
3
|
-
export declare function exportComponentInEntryPoint(tree: Tree, schema:
|
|
2
|
+
import type { NormalizedSchema } from '../schema';
|
|
3
|
+
export declare function exportComponentInEntryPoint(tree: Tree, schema: NormalizedSchema): void;
|
|
@@ -2,28 +2,21 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.exportComponentInEntryPoint = void 0;
|
|
4
4
|
const devkit_1 = require("@nrwl/devkit");
|
|
5
|
-
const
|
|
5
|
+
const component_1 = require("../../utils/component");
|
|
6
|
+
const entry_point_1 = require("../../utils/entry-point");
|
|
7
|
+
const path_1 = require("../../utils/path");
|
|
8
|
+
const entry_point_2 = require("./entry-point");
|
|
6
9
|
const module_1 = require("./module");
|
|
7
|
-
const path_1 = require("./path");
|
|
8
10
|
function exportComponentInEntryPoint(tree, schema) {
|
|
9
|
-
var _a, _b;
|
|
10
11
|
if (!schema.export || (schema.skipImport && !schema.standalone)) {
|
|
11
12
|
return;
|
|
12
13
|
}
|
|
13
|
-
const
|
|
14
|
-
const { root, sourceRoot, projectType } = (0, devkit_1.readProjectConfiguration)(tree, project);
|
|
14
|
+
const { root, projectType } = (0, devkit_1.readProjectConfiguration)(tree, schema.project);
|
|
15
15
|
if (projectType === 'application') {
|
|
16
16
|
return;
|
|
17
17
|
}
|
|
18
|
-
const
|
|
19
|
-
const
|
|
20
|
-
const projectSourceRoot = sourceRoot !== null && sourceRoot !== void 0 ? sourceRoot : (0, devkit_1.joinPathFragments)(root, 'src');
|
|
21
|
-
(_b = schema.path) !== null && _b !== void 0 ? _b : (schema.path = (0, devkit_1.joinPathFragments)(projectSourceRoot, 'lib'));
|
|
22
|
-
const componentDirectory = schema.flat
|
|
23
|
-
? (0, devkit_1.normalizePath)(schema.path)
|
|
24
|
-
: (0, devkit_1.joinPathFragments)(schema.path, componentNames.fileName);
|
|
25
|
-
const componentFilePath = (0, devkit_1.joinPathFragments)(componentDirectory, `${componentFileName}.ts`);
|
|
26
|
-
const entryPointPath = (0, entry_point_1.locateLibraryEntryPointFromDirectory)(tree, componentDirectory, root, projectSourceRoot);
|
|
18
|
+
const { componentDirectory, componentFilePath } = (0, component_1.getComponentFileInfo)(tree, schema);
|
|
19
|
+
const entryPointPath = (0, entry_point_1.locateLibraryEntryPointFromDirectory)(tree, componentDirectory, root, schema.projectSourceRoot);
|
|
27
20
|
if (!entryPointPath) {
|
|
28
21
|
devkit_1.logger.warn(`Unable to determine whether the component should be exported in the library entry point file. ` +
|
|
29
22
|
`The library's entry point file could not be found. Skipping exporting the component in the entry point file.`);
|
|
@@ -31,7 +24,7 @@ function exportComponentInEntryPoint(tree, schema) {
|
|
|
31
24
|
}
|
|
32
25
|
if (!schema.standalone) {
|
|
33
26
|
const modulePath = (0, module_1.findModuleFromOptions)(tree, schema, root);
|
|
34
|
-
if (!(0,
|
|
27
|
+
if (!(0, entry_point_2.shouldExportInEntryPoint)(tree, entryPointPath, modulePath)) {
|
|
35
28
|
return;
|
|
36
29
|
}
|
|
37
30
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"component.js","sourceRoot":"","sources":["../../../../../../../packages/angular/src/generators/component/lib/component.ts"],"names":[],"mappings":";;;AACA,
|
|
1
|
+
{"version":3,"file":"component.js","sourceRoot":"","sources":["../../../../../../../packages/angular/src/generators/component/lib/component.ts"],"names":[],"mappings":";;;AACA,yCAA8E;AAC9E,qDAA6D;AAC7D,yDAA+E;AAC/E,2CAA2D;AAE3D,+CAAyD;AACzD,qCAAiD;AAEjD,SAAgB,2BAA2B,CACzC,IAAU,EACV,MAAwB;IAExB,IAAI,CAAC,MAAM,CAAC,MAAM,IAAI,CAAC,MAAM,CAAC,UAAU,IAAI,CAAC,MAAM,CAAC,UAAU,CAAC,EAAE;QAC/D,OAAO;KACR;IAED,MAAM,EAAE,IAAI,EAAE,WAAW,EAAE,GAAG,IAAA,iCAAwB,EAAC,IAAI,EAAE,MAAM,CAAC,OAAO,CAAC,CAAC;IAE7E,IAAI,WAAW,KAAK,aAAa,EAAE;QACjC,OAAO;KACR;IAED,MAAM,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,GAAG,IAAA,gCAAoB,EACpE,IAAI,EACJ,MAAM,CACP,CAAC;IAEF,MAAM,cAAc,GAAG,IAAA,kDAAoC,EACzD,IAAI,EACJ,kBAAkB,EAClB,IAAI,EACJ,MAAM,CAAC,iBAAiB,CACzB,CAAC;IACF,IAAI,CAAC,cAAc,EAAE;QACnB,eAAM,CAAC,IAAI,CACT,gGAAgG;YAC9F,8GAA8G,CACjH,CAAC;QAEF,OAAO;KACR;IAED,IAAI,CAAC,MAAM,CAAC,UAAU,EAAE;QACtB,MAAM,UAAU,GAAG,IAAA,8BAAqB,EAAC,IAAI,EAAE,MAAM,EAAE,IAAI,CAAC,CAAC;QAC7D,IAAI,CAAC,IAAA,sCAAwB,EAAC,IAAI,EAAE,cAAc,EAAE,UAAU,CAAC,EAAE;YAC/D,OAAO;SACR;KACF;IAED,MAAM,0BAA0B,GAAG,IAAA,8BAAuB,EACxD,cAAc,EACd,iBAAiB,CAClB,CAAC;IACF,MAAM,uBAAuB,GAAG,IAAA,qBAAY,EAAA,GAAG,IAAI,CAAC,IAAI,CACtD,cAAc,EACd,OAAO,CACR;qBACkB,0BAA0B,IAAI,CAAC;IAElD,IAAI,CAAC,KAAK,CAAC,cAAc,EAAE,uBAAuB,CAAC,CAAC;AACtD,CAAC;AApDD,kEAoDC"}
|
|
@@ -1,3 +1,2 @@
|
|
|
1
1
|
import type { Tree } from '@nrwl/devkit';
|
|
2
|
-
export declare function locateLibraryEntryPointFromDirectory(tree: Tree, directory: string, projectRoot: string, projectSourceRoot: string): string | null;
|
|
3
2
|
export declare function shouldExportInEntryPoint(tree: Tree, entryPoint: string, modulePath: string): boolean;
|
|
@@ -1,31 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.shouldExportInEntryPoint =
|
|
4
|
-
const devkit_1 = require("@nrwl/devkit");
|
|
3
|
+
exports.shouldExportInEntryPoint = void 0;
|
|
5
4
|
const tsquery_1 = require("@phenomnomnominal/tsquery");
|
|
6
|
-
const path_1 = require("path");
|
|
7
|
-
const path_2 = require("./path");
|
|
8
|
-
function locateLibraryEntryPointFromDirectory(tree, directory, projectRoot, projectSourceRoot) {
|
|
9
|
-
var _a;
|
|
10
|
-
const ngPackageJsonPath = (0, devkit_1.joinPathFragments)(directory, 'ng-package.json');
|
|
11
|
-
let entryPointFile = tree.exists(ngPackageJsonPath)
|
|
12
|
-
? (_a = (0, devkit_1.readJson)(tree, ngPackageJsonPath).lib) === null || _a === void 0 ? void 0 : _a.entryFile
|
|
13
|
-
: null;
|
|
14
|
-
if (entryPointFile) {
|
|
15
|
-
return (0, devkit_1.joinPathFragments)(directory, entryPointFile);
|
|
16
|
-
}
|
|
17
|
-
if (directory === projectRoot) {
|
|
18
|
-
const indexFile = (0, devkit_1.joinPathFragments)(projectSourceRoot, 'index.ts');
|
|
19
|
-
return tree.exists(indexFile) ? indexFile : null;
|
|
20
|
-
}
|
|
21
|
-
return locateLibraryEntryPointFromDirectory(tree, (0, path_1.dirname)(directory), projectRoot, projectSourceRoot);
|
|
22
|
-
}
|
|
23
|
-
exports.locateLibraryEntryPointFromDirectory = locateLibraryEntryPointFromDirectory;
|
|
5
|
+
const path_1 = require("../../utils/path");
|
|
24
6
|
function shouldExportInEntryPoint(tree, entryPoint, modulePath) {
|
|
25
7
|
if (!modulePath) {
|
|
26
8
|
return false;
|
|
27
9
|
}
|
|
28
|
-
const moduleImportPath = (0,
|
|
10
|
+
const moduleImportPath = (0, path_1.getRelativeImportToFile)(entryPoint, modulePath);
|
|
29
11
|
const entryPointContent = tree.read(entryPoint, 'utf-8');
|
|
30
12
|
const entryPointAst = tsquery_1.tsquery.ast(entryPointContent);
|
|
31
13
|
const moduleExport = (0, tsquery_1.tsquery)(entryPointAst, `ExportDeclaration StringLiteral[value='${moduleImportPath}']`, { visitAllChildren: true })[0];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"entry-point.js","sourceRoot":"","sources":["../../../../../../../packages/angular/src/generators/component/lib/entry-point.ts"],"names":[],"mappings":";;;AACA,
|
|
1
|
+
{"version":3,"file":"entry-point.js","sourceRoot":"","sources":["../../../../../../../packages/angular/src/generators/component/lib/entry-point.ts"],"names":[],"mappings":";;;AACA,uDAAoD;AAEpD,2CAA2D;AAE3D,SAAgB,wBAAwB,CACtC,IAAU,EACV,UAAkB,EAClB,UAAkB;IAElB,IAAI,CAAC,UAAU,EAAE;QACf,OAAO,KAAK,CAAC;KACd;IAED,MAAM,gBAAgB,GAAG,IAAA,8BAAuB,EAAC,UAAU,EAAE,UAAU,CAAC,CAAC;IACzE,MAAM,iBAAiB,GAAG,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE,OAAO,CAAC,CAAC;IACzD,MAAM,aAAa,GAAG,iBAAO,CAAC,GAAG,CAAC,iBAAiB,CAAC,CAAC;IACrD,MAAM,YAAY,GAAG,IAAA,iBAAO,EAC1B,aAAa,EACb,0CAA0C,gBAAgB,IAAI,EAC9D,EAAE,gBAAgB,EAAE,IAAI,EAAE,CAC3B,CAAC,CAAC,CAAkB,CAAC;IAEtB,OAAO,OAAO,CAAC,YAAY,CAAC,CAAC;AAC/B,CAAC;AAnBD,4DAmBC"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import type { Tree } from '@nrwl/devkit';
|
|
2
|
-
import type {
|
|
3
|
-
export declare function findModuleFromOptions(tree: Tree, options:
|
|
2
|
+
import type { NormalizedSchema } from '../schema';
|
|
3
|
+
export declare function findModuleFromOptions(tree: Tree, options: NormalizedSchema, projectRoot: string): string | null;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"module.js","sourceRoot":"","sources":["../../../../../../../packages/angular/src/generators/component/lib/module.ts"],"names":[],"mappings":";;;AACA,yCAAgE;AAChE,+BAAyC;AAGzC,uHAAuH;AACvH,8EAA8E;AAC9E,2EAA2E;AAC3E,MAAM,SAAS,GAAG,YAAY,CAAC;AAC/B,MAAM,gBAAgB,GAAG,oBAAoB,CAAC;AAE9C,SAAgB,qBAAqB,CACnC,IAAU,EACV,
|
|
1
|
+
{"version":3,"file":"module.js","sourceRoot":"","sources":["../../../../../../../packages/angular/src/generators/component/lib/module.ts"],"names":[],"mappings":";;;AACA,yCAAgE;AAChE,+BAAyC;AAGzC,uHAAuH;AACvH,8EAA8E;AAC9E,2EAA2E;AAC3E,MAAM,SAAS,GAAG,YAAY,CAAC;AAC/B,MAAM,gBAAgB,GAAG,oBAAoB,CAAC;AAE9C,SAAgB,qBAAqB,CACnC,IAAU,EACV,OAAyB,EACzB,WAAmB;IAEnB,IAAI,CAAC,OAAO,CAAC,MAAM,EAAE;QACnB,MAAM,WAAW,GAAG,IAAA,0BAAiB,EAAC,OAAO,CAAC,IAAI,EAAE,OAAO,CAAC,IAAI,CAAC,CAAC;QAElE,OAAO,IAAA,sBAAa,EAAC,UAAU,CAAC,IAAI,EAAE,WAAW,EAAE,WAAW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devkit");
|
|
5
|
+
function normalizeOptions(tree, options) {
|
|
6
|
+
var _a, _b;
|
|
7
|
+
const project = (_a = options.project) !== null && _a !== void 0 ? _a : (0, devkit_1.readWorkspaceConfiguration)(tree).defaultProject;
|
|
8
|
+
const { projectType, root, sourceRoot } = (0, devkit_1.readProjectConfiguration)(tree, project);
|
|
9
|
+
const projectSourceRoot = sourceRoot !== null && sourceRoot !== void 0 ? sourceRoot : (0, devkit_1.joinPathFragments)(root, 'src');
|
|
10
|
+
const path = (_b = options.path) !== null && _b !== void 0 ? _b : (0, devkit_1.joinPathFragments)(projectSourceRoot, projectType === 'application' ? 'app' : 'lib');
|
|
11
|
+
return Object.assign(Object.assign({}, options), { path,
|
|
12
|
+
project,
|
|
13
|
+
projectSourceRoot });
|
|
14
|
+
}
|
|
15
|
+
exports.normalizeOptions = normalizeOptions;
|
|
16
|
+
//# sourceMappingURL=normalize-options.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"normalize-options.js","sourceRoot":"","sources":["../../../../../../../packages/angular/src/generators/component/lib/normalize-options.ts"],"names":[],"mappings":";;;AACA,yCAIsB;AAGtB,SAAgB,gBAAgB,CAC9B,IAAU,EACV,OAAe;;IAEf,MAAM,OAAO,GACX,MAAA,OAAO,CAAC,OAAO,mCAAI,IAAA,mCAA0B,EAAC,IAAI,CAAC,CAAC,cAAc,CAAC;IACrE,MAAM,EAAE,WAAW,EAAE,IAAI,EAAE,UAAU,EAAE,GAAG,IAAA,iCAAwB,EAChE,IAAI,EACJ,OAAO,CACR,CAAC;IACF,MAAM,iBAAiB,GAAG,UAAU,aAAV,UAAU,cAAV,UAAU,GAAI,IAAA,0BAAiB,EAAC,IAAI,EAAE,KAAK,CAAC,CAAC;IACvE,MAAM,IAAI,GACR,MAAA,OAAO,CAAC,IAAI,mCACZ,IAAA,0BAAiB,EACf,iBAAiB,EACjB,WAAW,KAAK,aAAa,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,KAAK,CAC9C,CAAC;IAEJ,uCACK,OAAO,KACV,IAAI;QACJ,OAAO;QACP,iBAAiB,IACjB;AACJ,CAAC;AAxBD,4CAwBC"}
|
|
@@ -27,6 +27,9 @@ function componentCypressSpecGenerator(tree, options) {
|
|
|
27
27
|
props,
|
|
28
28
|
tmpl: '',
|
|
29
29
|
});
|
|
30
|
+
if (!options.skipFormat) {
|
|
31
|
+
(0, devkit_1.formatFiles)(tree);
|
|
32
|
+
}
|
|
30
33
|
}
|
|
31
34
|
exports.componentCypressSpecGenerator = componentCypressSpecGenerator;
|
|
32
35
|
exports.default = componentCypressSpecGenerator;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"component-cypress-spec.js","sourceRoot":"","sources":["../../../../../../packages/angular/src/generators/component-cypress-spec/component-cypress-spec.ts"],"names":[],"mappings":";;;AACA,
|
|
1
|
+
{"version":3,"file":"component-cypress-spec.js","sourceRoot":"","sources":["../../../../../../packages/angular/src/generators/component-cypress-spec/component-cypress-spec.ts"],"names":[],"mappings":";;;AACA,yCAKsB;AACtB,kDAAuD;AACvD,yEAAoE;AACpE,yEAAmE;AAGnE,SAAgB,6BAA6B,CAC3C,IAAU,EACV,OAA6C;IAE7C,MAAM,EACJ,cAAc,EACd,WAAW,EACX,WAAW,EACX,aAAa,EACb,iBAAiB,EACjB,aAAa,GACd,GAAG,OAAO,CAAC;IACZ,MAAM,cAAc,GAAG,cAAc,IAAI,GAAG,WAAW,MAAM,CAAC;IAC9D,MAAM,cAAc,GAAG,IAAA,iCAAwB,EAC7C,IAAI,EACJ,cAAc,CACf,CAAC,UAAU,CAAC;IACb,MAAM,2BAA2B,GAAG,IAAA,0BAAiB,EACnD,cAAc,EACd,aAAa,CACd,CAAC;IAEF,MAAM,YAAY,GAAG,IAAA,0BAAiB,EAAC,SAAS,EAAE,OAAO,CAAC,CAAC;IAC3D,MAAM,cAAc,GAAG,IAAA,0BAAiB,EACtC,2BAA2B,EAC3B,aAAa,CACd,CAAC;IACF,MAAM,SAAS,GAAG,IAAA,0BAAiB,EACjC,cAAc,EACd,GAAG,iBAAiB,UAAU,CAC/B,CAAC;IAEF,IAAI,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,EAAE;QAC1B,OAAO;KACR;IAED,MAAM,iBAAiB,GAAG,IAAA,0BAAiB,EACzC,WAAW,EACX,aAAa,EACb,GAAG,iBAAiB,KAAK,CAC1B,CAAC;IACF,MAAM,KAAK,GAAG,IAAA,6BAAiB,EAAC,IAAI,EAAE,iBAAiB,EAAE,4CAAmB,CAAC,CAAC;IAC9E,MAAM,iBAAiB,GAAG,IAAA,6CAAoB,EAAC,IAAI,EAAE,iBAAiB,CAAC,CAAC;IAExE,IAAA,sBAAa,EAAC,IAAI,EAAE,YAAY,EAAE,cAAc,EAAE;QAChD,WAAW;QACX,iBAAiB;QACjB,aAAa;QACb,iBAAiB;QACjB,KAAK;QACL,IAAI,EAAE,EAAE;KACT,CAAC,CAAC;IAEH,IAAI,CAAC,OAAO,CAAC,UAAU,EAAE;QACvB,IAAA,oBAAW,EAAC,IAAI,CAAC,CAAC;KACnB;AACH,CAAC;AAxDD,sEAwDC;AAED,kBAAe,6BAA6B,CAAC"}
|
|
@@ -33,6 +33,11 @@
|
|
|
33
33
|
"cypressProject": {
|
|
34
34
|
"type": "string",
|
|
35
35
|
"description": "The Cypress project to generate the stories under. By default, inferred from `projectName`."
|
|
36
|
+
},
|
|
37
|
+
"skipFormat": {
|
|
38
|
+
"description": "Skip formatting files.",
|
|
39
|
+
"type": "boolean",
|
|
40
|
+
"default": false
|
|
36
41
|
}
|
|
37
42
|
},
|
|
38
43
|
"additionalProperties": false,
|
|
@@ -19,6 +19,9 @@ function componentStoryGenerator(tree, options) {
|
|
|
19
19
|
props: props.filter((p) => typeof p.defaultValue !== 'undefined'),
|
|
20
20
|
tmpl: '',
|
|
21
21
|
});
|
|
22
|
+
if (!options.skipFormat) {
|
|
23
|
+
(0, devkit_1.formatFiles)(tree);
|
|
24
|
+
}
|
|
22
25
|
}
|
|
23
26
|
exports.componentStoryGenerator = componentStoryGenerator;
|
|
24
27
|
exports.default = componentStoryGenerator;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"component-story.js","sourceRoot":"","sources":["../../../../../../packages/angular/src/generators/component-story/component-story.ts"],"names":[],"mappings":";;;AACA,
|
|
1
|
+
{"version":3,"file":"component-story.js","sourceRoot":"","sources":["../../../../../../packages/angular/src/generators/component-story/component-story.ts"],"names":[],"mappings":";;;AACA,yCAA6E;AAC7E,kDAAuD;AACvD,yEAAmE;AAGnE,SAAgB,uBAAuB,CACrC,IAAU,EACV,OAAuC;IAEvC,MAAM,EAAE,iBAAiB,EAAE,aAAa,EAAE,aAAa,EAAE,WAAW,EAAE,GACpE,OAAO,CAAC;IAEV,MAAM,YAAY,GAAG,IAAA,0BAAiB,EAAC,SAAS,EAAE,OAAO,CAAC,CAAC;IAC3D,MAAM,cAAc,GAAG,IAAA,0BAAiB,EAAC,WAAW,EAAE,aAAa,CAAC,CAAC;IACrE,MAAM,SAAS,GAAG,IAAA,0BAAiB,EACjC,cAAc,EACd,GAAG,iBAAiB,aAAa,CAClC,CAAC;IAEF,IAAI,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,EAAE;QAC1B,OAAO;KACR;IAED,MAAM,KAAK,GAAG,IAAA,6BAAiB,EAC7B,IAAI,EACJ,IAAA,0BAAiB,EAAC,cAAc,EAAE,GAAG,iBAAiB,KAAK,CAAC,EAC5D,4CAAmB,CACpB,CAAC;IAEF,IAAA,sBAAa,EAAC,IAAI,EAAE,YAAY,EAAE,cAAc,EAAE;QAChD,iBAAiB,EAAE,iBAAiB;QACpC,aAAa,EAAE,aAAa;QAC5B,KAAK,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,OAAO,CAAC,CAAC,YAAY,KAAK,WAAW,CAAC;QACjE,IAAI,EAAE,EAAE;KACT,CAAC,CAAC;IAEH,IAAI,CAAC,OAAO,CAAC,UAAU,EAAE;QACvB,IAAA,oBAAW,EAAC,IAAI,CAAC,CAAC;KACnB;AACH,CAAC;AAlCD,0DAkCC;AAED,kBAAe,uBAAuB,CAAC"}
|
|
@@ -24,6 +24,11 @@
|
|
|
24
24
|
"type": "string",
|
|
25
25
|
"description": "Component file name without the `.ts` extension.",
|
|
26
26
|
"examples": ["awesome.component"]
|
|
27
|
+
},
|
|
28
|
+
"skipFormat": {
|
|
29
|
+
"description": "Skip formatting files.",
|
|
30
|
+
"type": "boolean",
|
|
31
|
+
"default": false
|
|
27
32
|
}
|
|
28
33
|
},
|
|
29
34
|
"additionalProperties": false,
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { Tree } from '@nrwl/devkit';
|
|
2
|
+
import type { Schema } from '../schema';
|
|
3
|
+
import type { ComponentFileInfo } from '../../utils/component';
|
|
4
|
+
export declare function convertComponentToScam(tree: Tree, { componentDirectory, componentFileName, componentFilePath, }: ComponentFileInfo, options: Schema): void;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.convertComponentToScam = void 0;
|
|
4
|
+
const devkit_1 = require("@nrwl/devkit");
|
|
5
|
+
const ast_utils_1 = require("@nrwl/workspace/src/utilities/ast-utils");
|
|
6
|
+
const typescript_1 = require("typescript");
|
|
7
|
+
function convertComponentToScam(tree, { componentDirectory, componentFileName, componentFilePath, }, options) {
|
|
8
|
+
var _a;
|
|
9
|
+
if (!tree.exists(componentFilePath)) {
|
|
10
|
+
throw new Error(`Couldn't find component at path ${componentFilePath} to add SCAM setup.`);
|
|
11
|
+
}
|
|
12
|
+
const componentNames = (0, devkit_1.names)(options.name);
|
|
13
|
+
const typeNames = (0, devkit_1.names)((_a = options.type) !== null && _a !== void 0 ? _a : 'component');
|
|
14
|
+
const componentClassName = `${componentNames.className}${typeNames.className}`;
|
|
15
|
+
if (options.inlineScam) {
|
|
16
|
+
const currentComponentContents = tree.read(componentFilePath, 'utf-8');
|
|
17
|
+
let source = (0, typescript_1.createSourceFile)(componentFilePath, currentComponentContents, typescript_1.ScriptTarget.Latest, true);
|
|
18
|
+
source = (0, ast_utils_1.insertImport)(tree, source, componentFilePath, 'NgModule', '@angular/core');
|
|
19
|
+
source = (0, ast_utils_1.insertImport)(tree, source, componentFilePath, 'CommonModule', '@angular/common');
|
|
20
|
+
let updatedComponentSource = source.getText();
|
|
21
|
+
updatedComponentSource = `${updatedComponentSource}${getNgModuleDeclaration(componentClassName)}`;
|
|
22
|
+
tree.write(componentFilePath, updatedComponentSource);
|
|
23
|
+
return;
|
|
24
|
+
}
|
|
25
|
+
const moduleFilePath = (0, devkit_1.joinPathFragments)(componentDirectory, `${componentNames.fileName}.module.ts`);
|
|
26
|
+
tree.write(moduleFilePath, getModuleFileContent(componentClassName, componentFileName));
|
|
27
|
+
}
|
|
28
|
+
exports.convertComponentToScam = convertComponentToScam;
|
|
29
|
+
function getModuleFileContent(componentClassName, componentFileName) {
|
|
30
|
+
return `import { NgModule } from '@angular/core';
|
|
31
|
+
import { CommonModule } from '@angular/common';
|
|
32
|
+
import { ${componentClassName} } from './${componentFileName}';
|
|
33
|
+
${getNgModuleDeclaration(componentClassName)}`;
|
|
34
|
+
}
|
|
35
|
+
function getNgModuleDeclaration(componentClassName) {
|
|
36
|
+
return `
|
|
37
|
+
@NgModule({
|
|
38
|
+
imports: [CommonModule],
|
|
39
|
+
declarations: [${componentClassName}],
|
|
40
|
+
exports: [${componentClassName}],
|
|
41
|
+
})
|
|
42
|
+
export class ${componentClassName}Module {}`;
|
|
43
|
+
}
|
|
44
|
+
//# sourceMappingURL=convert-component-to-scam.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"convert-component-to-scam.js","sourceRoot":"","sources":["../../../../../../../packages/angular/src/generators/scam/lib/convert-component-to-scam.ts"],"names":[],"mappings":";;;AACA,yCAAwD;AACxD,uEAAuE;AACvE,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AAC,QAAQ,YAAY,CACvC,CAAC;IAEF,IAAI,CAAC,KAAK,CACR,cAAc,EACd,oBAAoB,CAAC,kBAAkB,EAAE,iBAAiB,CAAC,CAC5D,CAAC;AACJ,CAAC;AA7DD,wDA6DC;AAED,SAAS,oBAAoB,CAC3B,kBAA0B,EAC1B,iBAAyB;IAEzB,OAAO;;WAEE,kBAAkB,cAAc,iBAAiB;EAC1D,sBAAsB,CAAC,kBAAkB,CAAC,EAAE,CAAC;AAC/C,CAAC;AAED,SAAS,sBAAsB,CAAC,kBAA0B;IACxD,OAAO;;;mBAGU,kBAAkB;cACvB,kBAAkB;;eAEjB,kBAAkB,WAAW,CAAC;AAC7C,CAAC"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { Tree } from '@nrwl/devkit';
|
|
2
|
+
import type { ComponentFileInfo } from '../../utils/component';
|
|
3
|
+
import type { NormalizedSchema } from '../schema';
|
|
4
|
+
export declare function exportScam(tree: Tree, { componentDirectory, componentFilePath }: ComponentFileInfo, options: NormalizedSchema): void;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.exportScam = void 0;
|
|
4
|
+
const devkit_1 = require("@nrwl/devkit");
|
|
5
|
+
const entry_point_1 = require("../../utils/entry-point");
|
|
6
|
+
const path_1 = require("../../utils/path");
|
|
7
|
+
function exportScam(tree, { componentDirectory, componentFilePath }, options) {
|
|
8
|
+
if (!options.export) {
|
|
9
|
+
return;
|
|
10
|
+
}
|
|
11
|
+
const { root, projectType } = (0, devkit_1.readProjectConfiguration)(tree, options.project);
|
|
12
|
+
if (projectType === 'application') {
|
|
13
|
+
devkit_1.logger.warn('--export=true was ignored as the project the SCAM is being generated in is not a library.');
|
|
14
|
+
return;
|
|
15
|
+
}
|
|
16
|
+
const entryPointPath = (0, entry_point_1.locateLibraryEntryPointFromDirectory)(tree, componentDirectory, root, options.projectSourceRoot);
|
|
17
|
+
if (!entryPointPath) {
|
|
18
|
+
// Let's not error, simply warn the user
|
|
19
|
+
// It's not too much effort to manually do this
|
|
20
|
+
// It would be more frustrating to have to find the correct path and re-run the command
|
|
21
|
+
devkit_1.logger.warn(`Could not export SCAM. Unable to determine project's entry point. SCAM has still been created.`);
|
|
22
|
+
return;
|
|
23
|
+
}
|
|
24
|
+
const relativePathFromEntryPoint = (0, path_1.getRelativeImportToFile)(entryPointPath, componentFilePath);
|
|
25
|
+
const entryPointContent = tree.read(entryPointPath, 'utf-8');
|
|
26
|
+
let updatedEntryPointContent = (0, devkit_1.stripIndents) `${entryPointContent}
|
|
27
|
+
export * from "${relativePathFromEntryPoint}";`;
|
|
28
|
+
if (!options.inlineScam) {
|
|
29
|
+
const moduleFilePath = (0, devkit_1.joinPathFragments)(componentDirectory, `${(0, devkit_1.names)(options.name).fileName}.module.ts`);
|
|
30
|
+
const relativePathFromModule = (0, path_1.getRelativeImportToFile)(entryPointPath, moduleFilePath);
|
|
31
|
+
updatedEntryPointContent = (0, devkit_1.stripIndents) `${updatedEntryPointContent}
|
|
32
|
+
export * from "${relativePathFromModule}";`;
|
|
33
|
+
}
|
|
34
|
+
tree.write(entryPointPath, updatedEntryPointContent);
|
|
35
|
+
}
|
|
36
|
+
exports.exportScam = exportScam;
|
|
37
|
+
//# sourceMappingURL=export-scam.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"export-scam.js","sourceRoot":"","sources":["../../../../../../../packages/angular/src/generators/scam/lib/export-scam.ts"],"names":[],"mappings":";;;AACA,yCAMsB;AAEtB,yDAA+E;AAC/E,2CAA2D;AAG3D,SAAgB,UAAU,CACxB,IAAU,EACV,EAAE,kBAAkB,EAAE,iBAAiB,EAAqB,EAC5D,OAAyB;IAEzB,IAAI,CAAC,OAAO,CAAC,MAAM,EAAE;QACnB,OAAO;KACR;IAED,MAAM,EAAE,IAAI,EAAE,WAAW,EAAE,GAAG,IAAA,iCAAwB,EAAC,IAAI,EAAE,OAAO,CAAC,OAAO,CAAC,CAAC;IAE9E,IAAI,WAAW,KAAK,aAAa,EAAE;QACjC,eAAM,CAAC,IAAI,CACT,2FAA2F,CAC5F,CAAC;QAEF,OAAO;KACR;IAED,MAAM,cAAc,GAAG,IAAA,kDAAoC,EACzD,IAAI,EACJ,kBAAkB,EAClB,IAAI,EACJ,OAAO,CAAC,iBAAiB,CAC1B,CAAC;IACF,IAAI,CAAC,cAAc,EAAE;QACnB,wCAAwC;QACxC,+CAA+C;QAC/C,uFAAuF;QACvF,eAAM,CAAC,IAAI,CACT,gGAAgG,CACjG,CAAC;QAEF,OAAO;KACR;IAED,MAAM,0BAA0B,GAAG,IAAA,8BAAuB,EACxD,cAAc,EACd,iBAAiB,CAClB,CAAC;IACF,MAAM,iBAAiB,GAAG,IAAI,CAAC,IAAI,CAAC,cAAc,EAAE,OAAO,CAAC,CAAC;IAC7D,IAAI,wBAAwB,GAAG,IAAA,qBAAY,EAAA,GAAG,iBAAiB;qBAC5C,0BAA0B,IAAI,CAAC;IAElD,IAAI,CAAC,OAAO,CAAC,UAAU,EAAE;QACvB,MAAM,cAAc,GAAG,IAAA,0BAAiB,EACtC,kBAAkB,EAClB,GAAG,IAAA,cAAK,EAAC,OAAO,CAAC,IAAI,CAAC,CAAC,QAAQ,YAAY,CAC5C,CAAC;QACF,MAAM,sBAAsB,GAAG,IAAA,8BAAuB,EACpD,cAAc,EACd,cAAc,CACf,CAAC;QACF,wBAAwB,GAAG,IAAA,qBAAY,EAAA,GAAG,wBAAwB;uBAC/C,sBAAsB,IAAI,CAAC;KAC/C;IAED,IAAI,CAAC,KAAK,CAAC,cAAc,EAAE,wBAAwB,CAAC,CAAC;AACvD,CAAC;AA1DD,gCA0DC"}
|
|
@@ -1 +1,7 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const tslib_1 = require("tslib");
|
|
4
|
+
tslib_1.__exportStar(require("./convert-component-to-scam"), exports);
|
|
5
|
+
tslib_1.__exportStar(require("./export-scam"), exports);
|
|
6
|
+
tslib_1.__exportStar(require("./normalize-options"), exports);
|
|
1
7
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../../packages/angular/src/generators/scam/lib/index.ts"],"names":[],"mappings":""}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../../packages/angular/src/generators/scam/lib/index.ts"],"names":[],"mappings":";;;AAAA,sEAA4C;AAC5C,wDAA8B;AAC9B,8DAAoC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.normalizeOptions = void 0;
|
|
4
|
+
const devkit_1 = require("@nrwl/devkit");
|
|
5
|
+
function normalizeOptions(tree, options) {
|
|
6
|
+
var _a, _b;
|
|
7
|
+
const project = (_a = options.project) !== null && _a !== void 0 ? _a : (0, devkit_1.readWorkspaceConfiguration)(tree).defaultProject;
|
|
8
|
+
const { projectType, root, sourceRoot } = (0, devkit_1.readProjectConfiguration)(tree, project);
|
|
9
|
+
const projectSourceRoot = sourceRoot !== null && sourceRoot !== void 0 ? sourceRoot : (0, devkit_1.joinPathFragments)(root, 'src');
|
|
10
|
+
const path = (_b = options.path) !== null && _b !== void 0 ? _b : (0, devkit_1.joinPathFragments)(projectSourceRoot, projectType === 'application' ? 'app' : 'lib');
|
|
11
|
+
return Object.assign(Object.assign({}, options), { path,
|
|
12
|
+
project,
|
|
13
|
+
projectSourceRoot });
|
|
14
|
+
}
|
|
15
|
+
exports.normalizeOptions = normalizeOptions;
|
|
16
|
+
//# sourceMappingURL=normalize-options.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"normalize-options.js","sourceRoot":"","sources":["../../../../../../../packages/angular/src/generators/scam/lib/normalize-options.ts"],"names":[],"mappings":";;;AACA,yCAIsB;AAGtB,SAAgB,gBAAgB,CAC9B,IAAU,EACV,OAAe;;IAEf,MAAM,OAAO,GACX,MAAA,OAAO,CAAC,OAAO,mCAAI,IAAA,mCAA0B,EAAC,IAAI,CAAC,CAAC,cAAc,CAAC;IACrE,MAAM,EAAE,WAAW,EAAE,IAAI,EAAE,UAAU,EAAE,GAAG,IAAA,iCAAwB,EAChE,IAAI,EACJ,OAAO,CACR,CAAC;IACF,MAAM,iBAAiB,GAAG,UAAU,aAAV,UAAU,cAAV,UAAU,GAAI,IAAA,0BAAiB,EAAC,IAAI,EAAE,KAAK,CAAC,CAAC;IACvE,MAAM,IAAI,GACR,MAAA,OAAO,CAAC,IAAI,mCACZ,IAAA,0BAAiB,EACf,iBAAiB,EACjB,WAAW,KAAK,aAAa,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,KAAK,CAC9C,CAAC;IAEJ,uCACK,OAAO,KACV,IAAI;QACJ,OAAO;QACP,iBAAiB,IACjB;AACJ,CAAC;AAxBD,4CAwBC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import type { Tree } from '@nrwl/devkit';
|
|
2
2
|
import type { Schema } from './schema';
|
|
3
|
-
export declare function scamGenerator(tree: Tree,
|
|
3
|
+
export declare function scamGenerator(tree: Tree, rawOptions: Schema): Promise<void>;
|
|
4
4
|
export default scamGenerator;
|
|
@@ -2,17 +2,21 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.scamGenerator = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
|
-
const ngcli_adapter_1 = require("@nrwl/devkit/ngcli-adapter");
|
|
6
5
|
const devkit_1 = require("@nrwl/devkit");
|
|
7
|
-
const
|
|
6
|
+
const ngcli_adapter_1 = require("@nrwl/devkit/ngcli-adapter");
|
|
8
7
|
const path_1 = require("../utils/path");
|
|
9
|
-
|
|
8
|
+
const lib_1 = require("./lib");
|
|
9
|
+
const component_1 = require("../utils/component");
|
|
10
|
+
function scamGenerator(tree, rawOptions) {
|
|
10
11
|
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
11
|
-
const
|
|
12
|
+
const options = (0, lib_1.normalizeOptions)(tree, rawOptions);
|
|
13
|
+
const { inlineScam, projectSourceRoot } = options, schematicOptions = tslib_1.__rest(options, ["inlineScam", "projectSourceRoot"]);
|
|
12
14
|
checkPathUnderProjectRoot(tree, options);
|
|
13
15
|
const angularComponentSchematic = (0, ngcli_adapter_1.wrapAngularDevkitSchematic)('@schematics/angular', 'component');
|
|
14
|
-
yield angularComponentSchematic(tree, Object.assign(Object.assign({},
|
|
15
|
-
(0,
|
|
16
|
+
yield angularComponentSchematic(tree, Object.assign(Object.assign({}, schematicOptions), { skipImport: true, export: false }));
|
|
17
|
+
const componentFileInfo = (0, component_1.getComponentFileInfo)(tree, options);
|
|
18
|
+
(0, lib_1.convertComponentToScam)(tree, componentFileInfo, options);
|
|
19
|
+
(0, lib_1.exportScam)(tree, componentFileInfo, options);
|
|
16
20
|
yield (0, devkit_1.formatFiles)(tree);
|
|
17
21
|
});
|
|
18
22
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"scam.js","sourceRoot":"","sources":["../../../../../../packages/angular/src/generators/scam/scam.ts"],"names":[],"mappings":";;;;
|
|
1
|
+
{"version":3,"file":"scam.js","sourceRoot":"","sources":["../../../../../../packages/angular/src/generators/scam/scam.ts"],"names":[],"mappings":";;;;AACA,yCAKsB;AACtB,8DAAwE;AACxE,wCAA+C;AAC/C,+BAA6E;AAC7E,kDAA0D;AAG1D,SAAsB,aAAa,CAAC,IAAU,EAAE,UAAkB;;QAChE,MAAM,OAAO,GAAG,IAAA,sBAAgB,EAAC,IAAI,EAAE,UAAU,CAAC,CAAC;QACnD,MAAM,EAAE,UAAU,EAAE,iBAAiB,KAA0B,OAAO,EAA5B,gBAAgB,kBAAK,OAAO,EAAhE,mCAAsD,CAAU,CAAC;QAEvE,yBAA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,CAAC"}
|
|
@@ -23,6 +23,11 @@
|
|
|
23
23
|
"cypressProject": {
|
|
24
24
|
"type": "string",
|
|
25
25
|
"description": "The Cypress project to generate the stories under. This is inferred from `name` by default."
|
|
26
|
+
},
|
|
27
|
+
"skipFormat": {
|
|
28
|
+
"description": "Skip formatting files.",
|
|
29
|
+
"type": "boolean",
|
|
30
|
+
"default": false
|
|
26
31
|
}
|
|
27
32
|
},
|
|
28
33
|
"additionalProperties": false,
|
|
@@ -30,6 +30,7 @@ function angularStoriesGenerator(tree, options) {
|
|
|
30
30
|
componentName: info.name,
|
|
31
31
|
componentPath: info.path,
|
|
32
32
|
componentFileName: info.componentFileName,
|
|
33
|
+
skipFormat: false,
|
|
33
34
|
});
|
|
34
35
|
if (options.generateCypressSpecs && e2eProject) {
|
|
35
36
|
(0, component_cypress_spec_1.default)(tree, {
|
|
@@ -39,9 +40,13 @@ function angularStoriesGenerator(tree, options) {
|
|
|
39
40
|
componentName: info.name,
|
|
40
41
|
componentPath: info.path,
|
|
41
42
|
componentFileName: info.componentFileName,
|
|
43
|
+
skipFormat: false,
|
|
42
44
|
});
|
|
43
45
|
}
|
|
44
46
|
});
|
|
47
|
+
if (!options.skipFormat) {
|
|
48
|
+
(0, devkit_1.formatFiles)(tree);
|
|
49
|
+
}
|
|
45
50
|
}
|
|
46
51
|
exports.angularStoriesGenerator = angularStoriesGenerator;
|
|
47
52
|
exports.default = angularStoriesGenerator;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"stories.js","sourceRoot":"","sources":["../../../../../../packages/angular/src/generators/stories/stories.ts"],"names":[],"mappings":";;;AACA,
|
|
1
|
+
{"version":3,"file":"stories.js","sourceRoot":"","sources":["../../../../../../packages/angular/src/generators/stories/stories.ts"],"names":[],"mappings":";;;AACA,yCAAmD;AACnD,6EAAgF;AAChF,6FAA6F;AAC7F,wEAAyE;AACzE,yDAG8B;AAC9B,2DAAsD;AACtD,mDAAuD;AAGvD,SAAgB,uBAAuB,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AAI;gBACxB,aAAa,EAAE,IAAI,CAAC,IAAI;gBACxB,iBAAiB,EAAE,IAAI,CAAC,iBAAiB;gBACzC,UAAU,EAAE,KAAK;aAClB,CAAC,CAAC;SACJ;IACH,CAAC,CAAC,CAAC;IAEH,IAAI,CAAC,OAAO,CAAC,UAAU,EAAE;QACvB,IAAA,oBAAW,EAAC,IAAI,CAAC,CAAC;KACnB;AACH,CAAC;AAhDD,0DAgDC;AAED,kBAAe,uBAAuB,CAAC"}
|
|
@@ -46,6 +46,11 @@
|
|
|
46
46
|
"type": "boolean",
|
|
47
47
|
"description": "Configure your project with TypeScript. Generate main.ts and preview.ts files, instead of main.js and preview.js.",
|
|
48
48
|
"default": false
|
|
49
|
+
},
|
|
50
|
+
"skipFormat": {
|
|
51
|
+
"description": "Skip formatting files.",
|
|
52
|
+
"type": "boolean",
|
|
53
|
+
"default": false
|
|
49
54
|
}
|
|
50
55
|
},
|
|
51
56
|
"additionalProperties": false,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { GeneratorCallback, Tree } from '@nrwl/devkit';
|
|
2
2
|
import type { StorybookConfigurationOptions } from './schema';
|
|
3
3
|
export declare function storybookConfigurationGenerator(tree: Tree, options: StorybookConfigurationOptions): Promise<GeneratorCallback>;
|
|
4
4
|
export default storybookConfigurationGenerator;
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.storybookConfigurationGenerator = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
|
+
const devkit_1 = require("@nrwl/devkit");
|
|
5
6
|
const assert_compatible_storybook_version_1 = require("./lib/assert-compatible-storybook-version");
|
|
6
7
|
const generate_stories_1 = require("./lib/generate-stories");
|
|
7
8
|
const generate_storybook_configuration_1 = require("./lib/generate-storybook-configuration");
|
|
@@ -12,7 +13,10 @@ function storybookConfigurationGenerator(tree, options) {
|
|
|
12
13
|
(0, validate_options_1.validateOptions)(options);
|
|
13
14
|
const storybookGeneratorInstallTask = yield (0, generate_storybook_configuration_1.generateStorybookConfiguration)(tree, options);
|
|
14
15
|
if (options.generateStories) {
|
|
15
|
-
(0, generate_stories_1.generateStories)(tree, options);
|
|
16
|
+
(0, generate_stories_1.generateStories)(tree, Object.assign(Object.assign({}, options), { skipFormat: false }));
|
|
17
|
+
}
|
|
18
|
+
if (!options.skipFormat) {
|
|
19
|
+
yield (0, devkit_1.formatFiles)(tree);
|
|
16
20
|
}
|
|
17
21
|
return () => {
|
|
18
22
|
storybookGeneratorInstallTask();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"storybook-configuration.js","sourceRoot":"","sources":["../../../../../../packages/angular/src/generators/storybook-configuration/storybook-configuration.ts"],"names":[],"mappings":";;;;
|
|
1
|
+
{"version":3,"file":"storybook-configuration.js","sourceRoot":"","sources":["../../../../../../packages/angular/src/generators/storybook-configuration/storybook-configuration.ts"],"names":[],"mappings":";;;;AAAA,yCAAoE;AACpE,mGAA6F;AAC7F,6DAAyD;AACzD,6FAAwF;AACxF,6DAAyD;AAGzD,SAAsB,+BAA+B,CACnD,IAAU,EACV,OAAsC;;QAEtC,IAAA,sEAAgC,GAAE,CAAC;QACnC,IAAA,kCAAe,EAAC,OAAO,CAAC,CAAC;QAEzB,MAAM,6BAA6B,GAAG,MAAM,IAAA,iEAA8B,EACxE,IAAI,EACJ,OAAO,CACR,CAAC;QAEF,IAAI,OAAO,CAAC,eAAe,EAAE;YAC3B,IAAA,kCAAe,EAAC,IAAI,kCAAO,OAAO,KAAE,UAAU,EAAE,KAAK,IAAG,CAAC;SAC1D;QAED,IAAI,CAAC,OAAO,CAAC,UAAU,EAAE;YACvB,MAAM,IAAA,oBAAW,EAAC,IAAI,CAAC,CAAC;SACzB;QAED,OAAO,GAAG,EAAE;YACV,6BAA6B,EAAE,CAAC;QAClC,CAAC,CAAC;IACJ,CAAC;CAAA;AAvBD,0EAuBC;AAED,kBAAe,+BAA+B,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { Tree } from '@nrwl/devkit';
|
|
2
|
+
export declare type ComponentGenerationOptions = {
|
|
3
|
+
name: string;
|
|
4
|
+
flat?: boolean;
|
|
5
|
+
path?: string;
|
|
6
|
+
project?: string;
|
|
7
|
+
type?: string;
|
|
8
|
+
};
|
|
9
|
+
export declare type ComponentFileInfo = {
|
|
10
|
+
componentDirectory: string;
|
|
11
|
+
componentFileName: string;
|
|
12
|
+
componentFilePath: string;
|
|
13
|
+
};
|
|
14
|
+
export declare function getComponentFileInfo(tree: Tree, options: ComponentGenerationOptions): ComponentFileInfo;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getComponentFileInfo = void 0;
|
|
4
|
+
const devkit_1 = require("@nrwl/devkit");
|
|
5
|
+
function getComponentFileInfo(tree, options) {
|
|
6
|
+
var _a, _b;
|
|
7
|
+
const project = (_a = options.project) !== null && _a !== void 0 ? _a : (0, devkit_1.readWorkspaceConfiguration)(tree).defaultProject;
|
|
8
|
+
const { root, sourceRoot, projectType } = (0, devkit_1.readProjectConfiguration)(tree, project);
|
|
9
|
+
const { fileName: normalizedName } = (0, devkit_1.names)(options.name);
|
|
10
|
+
const componentFileName = `${normalizedName}.${options.type ? (0, devkit_1.names)(options.type).fileName : 'component'}`;
|
|
11
|
+
const projectSourceRoot = sourceRoot !== null && sourceRoot !== void 0 ? sourceRoot : (0, devkit_1.joinPathFragments)(root, 'src');
|
|
12
|
+
const path = (_b = options.path) !== null && _b !== void 0 ? _b : (0, devkit_1.joinPathFragments)(projectSourceRoot, projectType === 'application' ? 'app' : 'lib');
|
|
13
|
+
const componentDirectory = options.flat
|
|
14
|
+
? (0, devkit_1.normalizePath)(path)
|
|
15
|
+
: (0, devkit_1.joinPathFragments)(path, normalizedName);
|
|
16
|
+
const componentFilePath = (0, devkit_1.joinPathFragments)(componentDirectory, `${componentFileName}.ts`);
|
|
17
|
+
return { componentDirectory, componentFileName, componentFilePath };
|
|
18
|
+
}
|
|
19
|
+
exports.getComponentFileInfo = getComponentFileInfo;
|
|
20
|
+
//# sourceMappingURL=component.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"component.js","sourceRoot":"","sources":["../../../../../../packages/angular/src/generators/utils/component.ts"],"names":[],"mappings":";;;AAAA,yCAOsB;AAetB,SAAgB,oBAAoB,CAClC,IAAU,EACV,OAAmC;;IAEnC,MAAM,OAAO,GACX,MAAA,OAAO,CAAC,OAAO,mCAAI,IAAA,mCAA0B,EAAC,IAAI,CAAC,CAAC,cAAc,CAAC;IACrE,MAAM,EAAE,IAAI,EAAE,UAAU,EAAE,WAAW,EAAE,GAAG,IAAA,iCAAwB,EAChE,IAAI,EACJ,OAAO,CACR,CAAC;IACF,MAAM,EAAE,QAAQ,EAAE,cAAc,EAAE,GAAG,IAAA,cAAK,EAAC,OAAO,CAAC,IAAI,CAAC,CAAC;IAEzD,MAAM,iBAAiB,GAAG,GAAG,cAAc,IACzC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,IAAA,cAAK,EAAC,OAAO,CAAC,IAAI,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,WAChD,EAAE,CAAC;IAEH,MAAM,iBAAiB,GAAG,UAAU,aAAV,UAAU,cAAV,UAAU,GAAI,IAAA,0BAAiB,EAAC,IAAI,EAAE,KAAK,CAAC,CAAC;IACvE,MAAM,IAAI,GACR,MAAA,OAAO,CAAC,IAAI,mCACZ,IAAA,0BAAiB,EACf,iBAAiB,EACjB,WAAW,KAAK,aAAa,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,KAAK,CAC9C,CAAC;IACJ,MAAM,kBAAkB,GAAG,OAAO,CAAC,IAAI;QACrC,CAAC,CAAC,IAAA,sBAAa,EAAC,IAAI,CAAC;QACrB,CAAC,CAAC,IAAA,0BAAiB,EAAC,IAAI,EAAE,cAAc,CAAC,CAAC;IAE5C,MAAM,iBAAiB,GAAG,IAAA,0BAAiB,EACzC,kBAAkB,EAClB,GAAG,iBAAiB,KAAK,CAC1B,CAAC;IAEF,OAAO,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,CAAC;AACtE,CAAC;AAjCD,oDAiCC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.locateLibraryEntryPointFromDirectory = void 0;
|
|
4
|
+
const devkit_1 = require("@nrwl/devkit");
|
|
5
|
+
const path_1 = require("path");
|
|
6
|
+
function locateLibraryEntryPointFromDirectory(tree, directory, projectRoot, projectSourceRoot) {
|
|
7
|
+
var _a, _b;
|
|
8
|
+
const ngPackageJsonPath = (0, devkit_1.joinPathFragments)(directory, 'ng-package.json');
|
|
9
|
+
let entryPointFile = tree.exists(ngPackageJsonPath)
|
|
10
|
+
? (_b = (_a = (0, devkit_1.readJson)(tree, ngPackageJsonPath).lib) === null || _a === void 0 ? void 0 : _a.entryFile) !== null && _b !== void 0 ? _b : 'src/public_api.ts'
|
|
11
|
+
: null;
|
|
12
|
+
if (entryPointFile) {
|
|
13
|
+
return (0, devkit_1.joinPathFragments)(directory, entryPointFile);
|
|
14
|
+
}
|
|
15
|
+
if (directory === projectRoot) {
|
|
16
|
+
const indexFile = (0, devkit_1.joinPathFragments)(projectSourceRoot, 'index.ts');
|
|
17
|
+
return tree.exists(indexFile) ? indexFile : null;
|
|
18
|
+
}
|
|
19
|
+
return locateLibraryEntryPointFromDirectory(tree, (0, path_1.dirname)(directory), projectRoot, projectSourceRoot);
|
|
20
|
+
}
|
|
21
|
+
exports.locateLibraryEntryPointFromDirectory = locateLibraryEntryPointFromDirectory;
|
|
22
|
+
//# sourceMappingURL=entry-point.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"entry-point.js","sourceRoot":"","sources":["../../../../../../packages/angular/src/generators/utils/entry-point.ts"],"names":[],"mappings":";;;AACA,yCAA2D;AAC3D,+BAA+B;AAE/B,SAAgB,oCAAoC,CAClD,IAAU,EACV,SAAiB,EACjB,WAAmB,EACnB,iBAAyB;;IAEzB,MAAM,iBAAiB,GAAG,IAAA,0BAAiB,EAAC,SAAS,EAAE,iBAAiB,CAAC,CAAC;IAC1E,IAAI,cAAc,GAAG,IAAI,CAAC,MAAM,CAAC,iBAAiB,CAAC;QACjD,CAAC,CAAC,MAAA,MAAA,IAAA,iBAAQ,EAAC,IAAI,EAAE,iBAAiB,CAAC,CAAC,GAAG,0CAAE,SAAS,mCAAI,mBAAmB;QACzE,CAAC,CAAC,IAAI,CAAC;IAET,IAAI,cAAc,EAAE;QAClB,OAAO,IAAA,0BAAiB,EAAC,SAAS,EAAE,cAAc,CAAC,CAAC;KACrD;IAED,IAAI,SAAS,KAAK,WAAW,EAAE;QAC7B,MAAM,SAAS,GAAG,IAAA,0BAAiB,EAAC,iBAAiB,EAAE,UAAU,CAAC,CAAC;QAEnE,OAAO,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC;KAClD;IAED,OAAO,oCAAoC,CACzC,IAAI,EACJ,IAAA,cAAO,EAAC,SAAS,CAAC,EAClB,WAAW,EACX,iBAAiB,CAClB,CAAC;AACJ,CAAC;AA3BD,oFA2BC"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.pathStartsWith = void 0;
|
|
3
|
+
exports.getRelativeImportToFile = exports.pathStartsWith = void 0;
|
|
4
|
+
const devkit_1 = require("@nrwl/devkit");
|
|
4
5
|
const path_1 = require("path");
|
|
5
6
|
function pathStartsWith(path1, path2) {
|
|
6
7
|
path1 = (0, path_1.normalize)(path1).replace(/\\/g, '/');
|
|
@@ -8,4 +9,9 @@ function pathStartsWith(path1, path2) {
|
|
|
8
9
|
return path1.startsWith(path2);
|
|
9
10
|
}
|
|
10
11
|
exports.pathStartsWith = pathStartsWith;
|
|
12
|
+
function getRelativeImportToFile(sourceFilePath, targetFilePath) {
|
|
13
|
+
const relativeDirToTarget = (0, path_1.relative)((0, path_1.dirname)(sourceFilePath), (0, path_1.dirname)(targetFilePath));
|
|
14
|
+
return `./${(0, devkit_1.joinPathFragments)(relativeDirToTarget, (0, path_1.basename)(targetFilePath, '.ts'))}`;
|
|
15
|
+
}
|
|
16
|
+
exports.getRelativeImportToFile = getRelativeImportToFile;
|
|
11
17
|
//# sourceMappingURL=path.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"path.js","sourceRoot":"","sources":["../../../../../../packages/angular/src/generators/utils/path.ts"],"names":[],"mappings":";;;AAAA,+
|
|
1
|
+
{"version":3,"file":"path.js","sourceRoot":"","sources":["../../../../../../packages/angular/src/generators/utils/path.ts"],"names":[],"mappings":";;;AAAA,yCAAiD;AACjD,+BAA8D;AAE9D,SAAgB,cAAc,CAAC,KAAa,EAAE,KAAa;IACzD,KAAK,GAAG,IAAA,gBAAS,EAAC,KAAK,CAAC,CAAC,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC;IAC7C,KAAK,GAAG,IAAA,gBAAS,EAAC,KAAK,CAAC,CAAC,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC;IAE7C,OAAO,KAAK,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC;AACjC,CAAC;AALD,wCAKC;AAED,SAAgB,uBAAuB,CACrC,cAAsB,EACtB,cAAsB;IAEtB,MAAM,mBAAmB,GAAG,IAAA,eAAQ,EAClC,IAAA,cAAO,EAAC,cAAc,CAAC,EACvB,IAAA,cAAO,EAAC,cAAc,CAAC,CACxB,CAAC;IAEF,OAAO,KAAK,IAAA,0BAAiB,EAC3B,mBAAmB,EACnB,IAAA,eAAQ,EAAC,cAAc,EAAE,KAAK,CAAC,CAChC,EAAE,CAAC;AACN,CAAC;AAbD,0DAaC"}
|
package/src/utils/versions.d.ts
CHANGED
|
@@ -6,7 +6,7 @@ export declare const angularJsVersion = "1.7.9";
|
|
|
6
6
|
export declare const ngrxVersion = "~14.0.0";
|
|
7
7
|
export declare const rxjsVersion = "~7.4.0";
|
|
8
8
|
export declare const jestPresetAngularVersion = "~11.1.2";
|
|
9
|
-
export declare const angularEslintVersion = "~
|
|
9
|
+
export declare const angularEslintVersion = "~14.0.0";
|
|
10
10
|
export declare const tailwindVersion = "^3.0.2";
|
|
11
11
|
export declare const postcssVersion = "^8.4.5";
|
|
12
12
|
export declare const autoprefixerVersion = "^10.4.0";
|
package/src/utils/versions.js
CHANGED
|
@@ -9,7 +9,7 @@ exports.angularJsVersion = '1.7.9';
|
|
|
9
9
|
exports.ngrxVersion = '~14.0.0';
|
|
10
10
|
exports.rxjsVersion = '~7.4.0';
|
|
11
11
|
exports.jestPresetAngularVersion = '~11.1.2';
|
|
12
|
-
exports.angularEslintVersion = '~
|
|
12
|
+
exports.angularEslintVersion = '~14.0.0';
|
|
13
13
|
exports.tailwindVersion = '^3.0.2';
|
|
14
14
|
exports.postcssVersion = '^8.4.5';
|
|
15
15
|
exports.autoprefixerVersion = '^10.4.0';
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function getRelativeImportToFile(sourceFilePath: string, targetFilePath: string): string;
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getRelativeImportToFile = void 0;
|
|
4
|
-
const devkit_1 = require("@nrwl/devkit");
|
|
5
|
-
const path_1 = require("path");
|
|
6
|
-
function getRelativeImportToFile(sourceFilePath, targetFilePath) {
|
|
7
|
-
const relativeDirToTarget = (0, path_1.relative)((0, path_1.dirname)(sourceFilePath), (0, path_1.dirname)(targetFilePath));
|
|
8
|
-
return `./${(0, devkit_1.joinPathFragments)(relativeDirToTarget, (0, path_1.basename)(targetFilePath, '.ts'))}`;
|
|
9
|
-
}
|
|
10
|
-
exports.getRelativeImportToFile = getRelativeImportToFile;
|
|
11
|
-
//# sourceMappingURL=path.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"path.js","sourceRoot":"","sources":["../../../../../../../packages/angular/src/generators/component/lib/path.ts"],"names":[],"mappings":";;;AAAA,yCAAiD;AACjD,+BAAmD;AAEnD,SAAgB,uBAAuB,CACrC,cAAsB,EACtB,cAAsB;IAEtB,MAAM,mBAAmB,GAAG,IAAA,eAAQ,EAClC,IAAA,cAAO,EAAC,cAAc,CAAC,EACvB,IAAA,cAAO,EAAC,cAAc,CAAC,CACxB,CAAC;IAEF,OAAO,KAAK,IAAA,0BAAiB,EAC3B,mBAAmB,EACnB,IAAA,eAAQ,EAAC,cAAc,EAAE,KAAK,CAAC,CAChC,EAAE,CAAC;AACN,CAAC;AAbD,0DAaC"}
|
|
@@ -1,90 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.createScam = void 0;
|
|
4
|
-
const devkit_1 = require("@nrwl/devkit");
|
|
5
|
-
const devkit_2 = require("@nrwl/devkit");
|
|
6
|
-
const ast_utils_1 = require("@nrwl/workspace/src/utilities/ast-utils");
|
|
7
|
-
const typescript_1 = require("typescript");
|
|
8
|
-
function createScam(tree, schema) {
|
|
9
|
-
var _a, _b, _c;
|
|
10
|
-
const project = (_a = schema.project) !== null && _a !== void 0 ? _a : (0, devkit_2.readWorkspaceConfiguration)(tree).defaultProject;
|
|
11
|
-
const projectConfig = (0, devkit_2.readProjectConfiguration)(tree, project);
|
|
12
|
-
const componentNames = (0, devkit_2.names)(schema.name);
|
|
13
|
-
const typeNames = (0, devkit_2.names)((_b = schema.type) !== null && _b !== void 0 ? _b : 'component');
|
|
14
|
-
const componentFileName = `${componentNames.fileName}.${(_c = schema.type) !== null && _c !== void 0 ? _c : 'component'}`;
|
|
15
|
-
let componentDirectory = schema.flat
|
|
16
|
-
? (0, devkit_2.joinPathFragments)(projectConfig.sourceRoot, projectConfig.projectType === 'application' ? 'app' : 'lib')
|
|
17
|
-
: (0, devkit_2.joinPathFragments)(projectConfig.sourceRoot, projectConfig.projectType === 'application' ? 'app' : 'lib', componentNames.fileName);
|
|
18
|
-
if (schema.path) {
|
|
19
|
-
componentDirectory = schema.flat
|
|
20
|
-
? (0, devkit_2.normalizePath)(schema.path)
|
|
21
|
-
: (0, devkit_2.joinPathFragments)(schema.path, componentNames.fileName);
|
|
22
|
-
}
|
|
23
|
-
const componentFilePath = (0, devkit_2.joinPathFragments)(componentDirectory, `${componentFileName}.ts`);
|
|
24
|
-
if (!tree.exists(componentFilePath)) {
|
|
25
|
-
throw new Error(`Couldn't find component at path ${componentFilePath} to add SCAM setup.`);
|
|
26
|
-
}
|
|
27
|
-
if (schema.inlineScam) {
|
|
28
|
-
const currentComponentContents = tree.read(componentFilePath, 'utf-8');
|
|
29
|
-
let source = (0, typescript_1.createSourceFile)(componentFilePath, currentComponentContents, typescript_1.ScriptTarget.Latest, true);
|
|
30
|
-
source = (0, ast_utils_1.insertImport)(tree, source, componentFilePath, 'NgModule', '@angular/core');
|
|
31
|
-
source = (0, ast_utils_1.insertImport)(tree, source, componentFilePath, 'CommonModule', '@angular/common');
|
|
32
|
-
let updatedComponentSource = source.getText();
|
|
33
|
-
updatedComponentSource = `${updatedComponentSource}${createAngularComponentModule(`${componentNames.className}${typeNames.className}`)}`;
|
|
34
|
-
tree.write(componentFilePath, updatedComponentSource);
|
|
35
|
-
exportScam(tree, schema, componentFilePath);
|
|
36
|
-
return;
|
|
37
|
-
}
|
|
38
|
-
const scamFilePath = (0, devkit_2.joinPathFragments)(componentDirectory, `${componentNames.fileName}.module.ts`);
|
|
39
|
-
tree.write(scamFilePath, createSeparateAngularComponentModuleFile(`${componentNames.className}${typeNames.className}`, componentFileName));
|
|
40
|
-
exportScam(tree, schema, scamFilePath);
|
|
41
|
-
}
|
|
42
|
-
exports.createScam = createScam;
|
|
43
|
-
function exportScam(tree, schema, scamFilePath) {
|
|
44
|
-
var _a, _b;
|
|
45
|
-
if (!schema.export) {
|
|
46
|
-
return;
|
|
47
|
-
}
|
|
48
|
-
const project = (_a = schema.project) !== null && _a !== void 0 ? _a : (0, devkit_2.readWorkspaceConfiguration)(tree).defaultProject;
|
|
49
|
-
const { root, sourceRoot, projectType } = (0, devkit_2.readProjectConfiguration)(tree, project);
|
|
50
|
-
if (projectType === 'application') {
|
|
51
|
-
devkit_1.logger.warn('--export=true was ignored as the project the SCAM is being generated in is not a library.');
|
|
52
|
-
return;
|
|
53
|
-
}
|
|
54
|
-
const ngPackageJsonPath = (0, devkit_2.joinPathFragments)(root, 'ng-package.json');
|
|
55
|
-
const ngPackageEntryPoint = tree.exists(ngPackageJsonPath)
|
|
56
|
-
? (_b = (0, devkit_1.readJson)(tree, ngPackageJsonPath).lib) === null || _b === void 0 ? void 0 : _b.entryFile
|
|
57
|
-
: undefined;
|
|
58
|
-
const projectEntryPoint = ngPackageEntryPoint
|
|
59
|
-
? (0, devkit_2.joinPathFragments)(root, ngPackageEntryPoint)
|
|
60
|
-
: (0, devkit_2.joinPathFragments)(sourceRoot, `index.ts`);
|
|
61
|
-
if (!tree.exists(projectEntryPoint)) {
|
|
62
|
-
// Let's not error, simply warn the user
|
|
63
|
-
// It's not too much effort to manually do this
|
|
64
|
-
// It would be more frustrating to have to find the correct path and re-run the command
|
|
65
|
-
devkit_1.logger.warn(`Could not export SCAM. Unable to determine project's entry point. Path ${projectEntryPoint} does not exist. SCAM has still been created.`);
|
|
66
|
-
return;
|
|
67
|
-
}
|
|
68
|
-
const relativePathFromEntryPoint = `.${scamFilePath
|
|
69
|
-
.split(sourceRoot)[1]
|
|
70
|
-
.replace('.ts', '')}`;
|
|
71
|
-
const updateEntryPointContent = `${tree.read(projectEntryPoint, 'utf-8')}
|
|
72
|
-
export * from "${relativePathFromEntryPoint}";`;
|
|
73
|
-
tree.write(projectEntryPoint, updateEntryPointContent);
|
|
74
|
-
}
|
|
75
|
-
function createAngularComponentModule(name) {
|
|
76
|
-
return `
|
|
77
|
-
@NgModule({
|
|
78
|
-
imports: [CommonModule],
|
|
79
|
-
declarations: [${name}],
|
|
80
|
-
exports: [${name}],
|
|
81
|
-
})
|
|
82
|
-
export class ${name}Module {}`;
|
|
83
|
-
}
|
|
84
|
-
function createSeparateAngularComponentModuleFile(name, componentFileName) {
|
|
85
|
-
return `import { NgModule } from '@angular/core';
|
|
86
|
-
import { CommonModule } from '@angular/common';
|
|
87
|
-
import { ${name} } from './${componentFileName}';
|
|
88
|
-
${createAngularComponentModule(name)}`;
|
|
89
|
-
}
|
|
90
|
-
//# sourceMappingURL=create-module.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"create-module.js","sourceRoot":"","sources":["../../../../../../../packages/angular/src/generators/scam/lib/create-module.ts"],"names":[],"mappings":";;;AAAA,yCAAsD;AAGtD,yCAMsB;AACtB,uEAAuE;AACvE,2CAA4D;AAE5D,SAAgB,UAAU,CAAC,IAAU,EAAE,MAAc;;IACnD,MAAM,OAAO,GACX,MAAA,MAAM,CAAC,OAAO,mCAAI,IAAA,mCAA0B,EAAC,IAAI,CAAC,CAAC,cAAc,CAAC;IACpE,MAAM,aAAa,GAAG,IAAA,iCAAwB,EAAC,IAAI,EAAE,OAAO,CAAC,CAAC;IAE9D,MAAM,cAAc,GAAG,IAAA,cAAK,EAAC,MAAM,CAAC,IAAI,CAAC,CAAC;IAC1C,MAAM,SAAS,GAAG,IAAA,cAAK,EAAC,MAAA,MAAM,CAAC,IAAI,mCAAI,WAAW,CAAC,CAAC;IAEpD,MAAM,iBAAiB,GAAG,GAAG,cAAc,CAAC,QAAQ,IAClD,MAAA,MAAM,CAAC,IAAI,mCAAI,WACjB,EAAE,CAAC;IAEH,IAAI,kBAAkB,GAAG,MAAM,CAAC,IAAI;QAClC,CAAC,CAAC,IAAA,0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