@nrwl/js 13.8.3 → 13.8.5

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.
Files changed (82) hide show
  1. package/executors.json +0 -10
  2. package/generators.json +0 -14
  3. package/migrations.json +14 -1
  4. package/package.json +5 -5
  5. package/src/executors/swc/schema.json +18 -1
  6. package/src/executors/swc/swc.impl.js +16 -12
  7. package/src/executors/swc/swc.impl.js.map +1 -1
  8. package/src/executors/tsc/schema.json +11 -0
  9. package/src/executors/tsc/tsc.impl.js +3 -3
  10. package/src/executors/tsc/tsc.impl.js.map +1 -1
  11. package/src/generators/convert-to-swc/convert-to-swc.js +1 -1
  12. package/src/generators/convert-to-swc/convert-to-swc.js.map +1 -1
  13. package/src/generators/library/files/jest-config/jest.config.js__tmpl__ +17 -0
  14. package/src/generators/library/files/{README.md → lib/README.md} +0 -0
  15. package/src/generators/{application/files → library/files/lib}/package.json__tmpl__ +0 -0
  16. package/src/generators/library/files/{src → lib/src}/index.ts__tmpl__ +0 -0
  17. package/src/generators/{application/files/src/app → library/files/lib/src/lib}/__fileName__.spec.ts__tmpl__ +0 -0
  18. package/src/generators/{application/files/src/app → library/files/lib/src/lib}/__fileName__.ts__tmpl__ +0 -0
  19. package/src/generators/library/files/{tsconfig.json__tmpl__ → lib/tsconfig.json__tmpl__} +0 -0
  20. package/src/generators/library/files/{tsconfig.lib.json__tmpl__ → lib/tsconfig.lib.json__tmpl__} +0 -0
  21. package/src/generators/library/library.d.ts +14 -4
  22. package/src/generators/library/library.js +210 -3
  23. package/src/generators/library/library.js.map +1 -1
  24. package/src/generators/library/schema.json +5 -0
  25. package/src/index.d.ts +0 -1
  26. package/src/index.js +1 -3
  27. package/src/index.js.map +1 -1
  28. package/src/migrations/update-13-8-5/update-node-executor.d.ts +2 -0
  29. package/src/migrations/update-13-8-5/update-node-executor.js +28 -0
  30. package/src/migrations/update-13-8-5/update-node-executor.js.map +1 -0
  31. package/src/migrations/update-13-8-5/update-swcrc.d.ts +2 -0
  32. package/src/migrations/update-13-8-5/update-swcrc.js +35 -0
  33. package/src/migrations/update-13-8-5/update-swcrc.js.map +1 -0
  34. package/src/utils/check-dependencies.d.ts +4 -1
  35. package/src/utils/check-dependencies.js +4 -0
  36. package/src/utils/check-dependencies.js.map +1 -1
  37. package/src/utils/schema.d.ts +10 -8
  38. package/src/utils/swc/add-swc-config.d.ts +1 -0
  39. package/src/utils/swc/add-swc-config.js +13 -5
  40. package/src/utils/swc/add-swc-config.js.map +1 -1
  41. package/src/utils/swc/compile-swc.js +5 -8
  42. package/src/utils/swc/compile-swc.js.map +1 -1
  43. package/src/utils/typescript/compile-typescript-files.js +2 -2
  44. package/src/utils/typescript/compile-typescript-files.js.map +1 -1
  45. package/src/utils/typescript/{load-ts-plugins.d.ts → load-ts-transformers.d.ts} +1 -1
  46. package/src/utils/typescript/{load-ts-plugins.js → load-ts-transformers.js} +4 -4
  47. package/src/utils/typescript/load-ts-transformers.js.map +1 -0
  48. package/src/utils/update-package-json.d.ts +4 -1
  49. package/src/utils/update-package-json.js +10 -9
  50. package/src/utils/update-package-json.js.map +1 -1
  51. package/src/utils/versions.d.ts +3 -3
  52. package/src/utils/versions.js +4 -4
  53. package/src/utils/versions.js.map +1 -1
  54. package/src/executors/node/compat.d.ts +0 -2
  55. package/src/executors/node/compat.js +0 -6
  56. package/src/executors/node/compat.js.map +0 -1
  57. package/src/executors/node/node-with-require-overrides.d.ts +0 -5
  58. package/src/executors/node/node-with-require-overrides.js +0 -20
  59. package/src/executors/node/node-with-require-overrides.js.map +0 -1
  60. package/src/executors/node/node.impl.d.ts +0 -5
  61. package/src/executors/node/node.impl.js +0 -142
  62. package/src/executors/node/node.impl.js.map +0 -1
  63. package/src/executors/node/schema.d.ts +0 -16
  64. package/src/executors/node/schema.json +0 -72
  65. package/src/generators/application/application.d.ts +0 -5
  66. package/src/generators/application/application.js +0 -17
  67. package/src/generators/application/application.js.map +0 -1
  68. package/src/generators/application/files/README.md +0 -19
  69. package/src/generators/application/files/src/index.ts__tmpl__ +0 -3
  70. package/src/generators/application/files/tsconfig.app.json__tmpl__ +0 -10
  71. package/src/generators/application/files/tsconfig.json__tmpl__ +0 -14
  72. package/src/generators/application/schema.json +0 -99
  73. package/src/generators/library/files/package.json__tmpl__ +0 -5
  74. package/src/generators/library/files/src/lib/__fileName__.spec.ts__tmpl__ +0 -7
  75. package/src/generators/library/files/src/lib/__fileName__.ts__tmpl__ +0 -3
  76. package/src/utils/project-generator.d.ts +0 -12
  77. package/src/utils/project-generator.js +0 -203
  78. package/src/utils/project-generator.js.map +0 -1
  79. package/src/utils/swc/add-temp-swcrc.d.ts +0 -2
  80. package/src/utils/swc/add-temp-swcrc.js +0 -27
  81. package/src/utils/swc/add-temp-swcrc.js.map +0 -1
  82. package/src/utils/typescript/load-ts-plugins.js.map +0 -1
@@ -1,142 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.nodeExecutor = void 0;
4
- const tslib_1 = require("tslib");
5
- const devkit_1 = require("@nrwl/devkit");
6
- const child_process_1 = require("child_process");
7
- const treeKill = require("tree-kill");
8
- const util_1 = require("util");
9
- const project_graph_1 = require("@nrwl/workspace/src/core/project-graph");
10
- const buildable_libs_utils_1 = require("@nrwl/workspace/src/utilities/buildable-libs-utils");
11
- let subProcess = null;
12
- function nodeExecutor(options, context) {
13
- return (0, tslib_1.__asyncGenerator)(this, arguments, function* nodeExecutor_1() {
14
- var e_1, _a;
15
- process.on('SIGTERM', () => (0, tslib_1.__awaiter)(this, void 0, void 0, function* () {
16
- yield killProcess();
17
- process.exit(128 + 15);
18
- }));
19
- process.on('SIGINT', () => (0, tslib_1.__awaiter)(this, void 0, void 0, function* () {
20
- yield killProcess();
21
- process.exit(128 + 2);
22
- }));
23
- process.on('SIGHUP', () => (0, tslib_1.__awaiter)(this, void 0, void 0, function* () {
24
- yield killProcess();
25
- process.exit(128 + 1);
26
- }));
27
- if (options.waitUntilTargets && options.waitUntilTargets.length > 0) {
28
- const results = yield (0, tslib_1.__await)(runWaitUntilTargets(options, context));
29
- for (const [i, result] of results.entries()) {
30
- if (!result.success) {
31
- throw new Error(`Wait until target failed: ${options.waitUntilTargets[i]}.`);
32
- }
33
- }
34
- }
35
- const mappings = calculateResolveMappings(context, options);
36
- try {
37
- for (var _b = (0, tslib_1.__asyncValues)(startBuild(options, context)), _c; _c = yield (0, tslib_1.__await)(_b.next()), !_c.done;) {
38
- const event = _c.value;
39
- if (!event.success) {
40
- devkit_1.logger.error('There was an error with the build. See above.');
41
- devkit_1.logger.info(`${event.outfile} was not restarted.`);
42
- }
43
- yield (0, tslib_1.__await)(handleBuildEvent(event, options, mappings));
44
- yield yield (0, tslib_1.__await)(event);
45
- }
46
- }
47
- catch (e_1_1) { e_1 = { error: e_1_1 }; }
48
- finally {
49
- try {
50
- if (_c && !_c.done && (_a = _b.return)) yield (0, tslib_1.__await)(_a.call(_b));
51
- }
52
- finally { if (e_1) throw e_1.error; }
53
- }
54
- });
55
- }
56
- exports.nodeExecutor = nodeExecutor;
57
- function calculateResolveMappings(context, options) {
58
- const projectGraph = (0, project_graph_1.readCachedProjectGraph)();
59
- const parsed = (0, devkit_1.parseTargetString)(options.buildTarget);
60
- const { dependencies } = (0, buildable_libs_utils_1.calculateProjectDependencies)(projectGraph, context.root, parsed.project, parsed.target, parsed.configuration);
61
- return dependencies.reduce((m, c) => {
62
- if (!c.outputs[0] && c.node.type === 'npm') {
63
- c.outputs[0] = `node_modules/${c.node.data.packageName}`;
64
- }
65
- m[c.name] = (0, devkit_1.joinPathFragments)(context.root, c.outputs[0]);
66
- return m;
67
- }, {});
68
- }
69
- function runProcess(event, options, mappings) {
70
- subProcess = (0, child_process_1.fork)((0, devkit_1.joinPathFragments)(__dirname, 'node-with-require-overrides'), options.args, {
71
- execArgv: getExecArgv(options),
72
- stdio: 'inherit',
73
- env: Object.assign(Object.assign({}, process.env), { NX_FILE_TO_RUN: event.outfile, NX_MAPPINGS: JSON.stringify(mappings) }),
74
- });
75
- }
76
- function getExecArgv(options) {
77
- const args = [
78
- '-r',
79
- require.resolve('source-map-support/register'),
80
- ...options.runtimeArgs,
81
- ];
82
- if (options.inspect === true) {
83
- options.inspect = "inspect" /* Inspect */;
84
- }
85
- if (options.inspect) {
86
- args.push(`--${options.inspect}=${options.host}:${options.port}`);
87
- }
88
- return args;
89
- }
90
- function handleBuildEvent(event, options, mappings) {
91
- return (0, tslib_1.__awaiter)(this, void 0, void 0, function* () {
92
- if ((!event.success || options.watch) && subProcess) {
93
- yield killProcess();
94
- }
95
- if (event.success) {
96
- runProcess(event, options, mappings);
97
- }
98
- });
99
- }
100
- function killProcess() {
101
- return (0, tslib_1.__awaiter)(this, void 0, void 0, function* () {
102
- const promisifiedTreeKill = (0, util_1.promisify)(treeKill);
103
- try {
104
- yield promisifiedTreeKill(subProcess.pid, 'SIGTERM');
105
- }
106
- catch (err) {
107
- if (Array.isArray(err) && err[0] && err[2]) {
108
- const errorMessage = err[2];
109
- devkit_1.logger.error(errorMessage);
110
- }
111
- else if (err.message) {
112
- devkit_1.logger.error(err.message);
113
- }
114
- }
115
- finally {
116
- subProcess = null;
117
- }
118
- });
119
- }
120
- function startBuild(options, context) {
121
- return (0, tslib_1.__asyncGenerator)(this, arguments, function* startBuild_1() {
122
- const buildTarget = (0, devkit_1.parseTargetString)(options.buildTarget);
123
- yield (0, tslib_1.__await)(yield* (0, tslib_1.__asyncDelegator)((0, tslib_1.__asyncValues)(yield (0, tslib_1.__await)((0, devkit_1.runExecutor)(buildTarget, Object.assign(Object.assign({}, options.buildTargetOptions), { watch: options.watch }), context)))));
124
- });
125
- }
126
- function runWaitUntilTargets(options, context) {
127
- return Promise.all(options.waitUntilTargets.map((waitUntilTarget) => (0, tslib_1.__awaiter)(this, void 0, void 0, function* () {
128
- const target = (0, devkit_1.parseTargetString)(waitUntilTarget);
129
- const output = yield (0, devkit_1.runExecutor)(target, {}, context);
130
- return new Promise((resolve) => (0, tslib_1.__awaiter)(this, void 0, void 0, function* () {
131
- let event = yield output.next();
132
- // Resolve after first event
133
- resolve(event.value);
134
- // Continue iterating
135
- while (!event.done) {
136
- event = yield output.next();
137
- }
138
- }));
139
- })));
140
- }
141
- exports.default = nodeExecutor;
142
- //# sourceMappingURL=node.impl.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"node.impl.js","sourceRoot":"","sources":["../../../../../../packages/js/src/executors/node/node.impl.ts"],"names":[],"mappings":";;;;AAAA,yCAMsB;AACtB,iDAAmD;AACnD,sCAAsC;AACtC,+BAAiC;AAGjC,0EAAgF;AAChF,6FAAkG;AAElG,IAAI,UAAU,GAAiB,IAAI,CAAC;AAEpC,SAAuB,YAAY,CACjC,OAA4B,EAC5B,OAAwB;;;QAExB,OAAO,CAAC,EAAE,CAAC,SAAS,EAAE,GAAS,EAAE;YAC/B,MAAM,WAAW,EAAE,CAAC;YACpB,OAAO,CAAC,IAAI,CAAC,GAAG,GAAG,EAAE,CAAC,CAAC;QACzB,CAAC,CAAA,CAAC,CAAC;QACH,OAAO,CAAC,EAAE,CAAC,QAAQ,EAAE,GAAS,EAAE;YAC9B,MAAM,WAAW,EAAE,CAAC;YACpB,OAAO,CAAC,IAAI,CAAC,GAAG,GAAG,CAAC,CAAC,CAAC;QACxB,CAAC,CAAA,CAAC,CAAC;QACH,OAAO,CAAC,EAAE,CAAC,QAAQ,EAAE,GAAS,EAAE;YAC9B,MAAM,WAAW,EAAE,CAAC;YACpB,OAAO,CAAC,IAAI,CAAC,GAAG,GAAG,CAAC,CAAC,CAAC;QACxB,CAAC,CAAA,CAAC,CAAC;QAEH,IAAI,OAAO,CAAC,gBAAgB,IAAI,OAAO,CAAC,gBAAgB,CAAC,MAAM,GAAG,CAAC,EAAE;YACnE,MAAM,OAAO,GAAG,2BAAM,mBAAmB,CAAC,OAAO,EAAE,OAAO,CAAC,CAAA,CAAC;YAC5D,KAAK,MAAM,CAAC,CAAC,EAAE,MAAM,CAAC,IAAI,OAAO,CAAC,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AG,CAChB,OAAO,CAAC,gBAAgB,CAAC,GAAG,CAAC,CAAO,eAAe,EAAE,EAAE;QACrD,MAAM,MAAM,GAAG,IAAA,0BAAiB,EAAC,eAAe,CAAC,CAAC;QAClD,MAAM,MAAM,GAAG,MAAM,IAAA,oBAAW,EAAC,MAAM,EAAE,EAAE,EAAE,OAAO,CAAC,CAAC;QACtD,OAAO,IAAI,OAAO,CAAuB,CAAO,OAAO,EAAE,EAAE;YACzD,IAAI,KAAK,GAAG,MAAM,MAAM,CAAC,IAAI,EAAE,CAAC;YAChC,4BAA4B;YAC5B,OAAO,CAAC,KAAK,CAAC,KAA6B,CAAC,CAAC;YAE7C,qBAAqB;YACrB,OAAO,CAAC,KAAK,CAAC,IAAI,EAAE;gBAClB,KAAK,GAAG,MAAM,MAAM,CAAC,IAAI,EAAE,CAAC;aAC7B;QACH,CAAC,CAAA,CAAC,CAAC;IACL,CAAC,CAAA,CAAC,CACH,CAAC;AACJ,CAAC;AAED,kBAAe,YAAY,CAAC"}
@@ -1,16 +0,0 @@
1
- export const enum InspectType {
2
- Inspect = 'inspect',
3
- InspectBrk = 'inspect-brk',
4
- }
5
-
6
- export interface NodeExecutorOptions {
7
- inspect: boolean | InspectType;
8
- runtimeArgs: string[];
9
- args: string[];
10
- waitUntilTargets: string[];
11
- buildTarget: string;
12
- buildTargetOptions: Record<string, any>;
13
- host: string;
14
- port: number;
15
- watch?: boolean;
16
- }
@@ -1,72 +0,0 @@
1
- {
2
- "$schema": "http://json-schema.org/schema",
3
- "cli": "nx",
4
- "title": "Node executor",
5
- "description": "Execute Nodejs applications",
6
- "type": "object",
7
- "properties": {
8
- "buildTarget": {
9
- "type": "string",
10
- "description": "The target to run to build you the app"
11
- },
12
- "buildTargetOptions": {
13
- "type": "object",
14
- "description": "Additional options to pass into the build target.",
15
- "default": {}
16
- },
17
- "waitUntilTargets": {
18
- "type": "array",
19
- "description": "The targets to run to before starting the node app",
20
- "default": [],
21
- "items": {
22
- "type": "string"
23
- }
24
- },
25
- "host": {
26
- "type": "string",
27
- "default": "localhost",
28
- "description": "The host to inspect the process on"
29
- },
30
- "port": {
31
- "type": "number",
32
- "default": 9229,
33
- "description": "The port to inspect the process on. Setting port to 0 will assign random free ports to all forked processes."
34
- },
35
- "inspect": {
36
- "oneOf": [
37
- {
38
- "type": "string",
39
- "enum": ["inspect", "inspect-brk"]
40
- },
41
- {
42
- "type": "boolean"
43
- }
44
- ],
45
- "description": "Ensures the app is starting with debugging",
46
- "default": "inspect"
47
- },
48
- "runtimeArgs": {
49
- "type": "array",
50
- "description": "Extra args passed to the node process",
51
- "default": [],
52
- "items": {
53
- "type": "string"
54
- }
55
- },
56
- "args": {
57
- "type": "array",
58
- "description": "Extra args when starting the app",
59
- "default": [],
60
- "items": {
61
- "type": "string"
62
- }
63
- },
64
- "watch": {
65
- "type": "boolean",
66
- "description": "Enable re-building when files change.",
67
- "default": true
68
- }
69
- },
70
- "additionalProperties": false,
71
- "required": ["buildTarget"]
72
- }
@@ -1,5 +0,0 @@
1
- import { Tree } from '@nrwl/devkit';
2
- import { GeneratorSchema } from '../../utils/schema';
3
- export declare function applicationGenerator(tree: Tree, schema: GeneratorSchema): Promise<import("@nrwl/devkit").GeneratorCallback>;
4
- export default applicationGenerator;
5
- export declare const applicationSchematic: (options: GeneratorSchema) => (tree: any, context: any) => Promise<any>;
@@ -1,17 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.applicationSchematic = exports.applicationGenerator = void 0;
4
- const tslib_1 = require("tslib");
5
- const devkit_1 = require("@nrwl/devkit");
6
- const path_1 = require("path");
7
- const project_generator_1 = require("../../utils/project-generator");
8
- function applicationGenerator(tree, schema) {
9
- return (0, tslib_1.__awaiter)(this, void 0, void 0, function* () {
10
- const { appsDir } = (0, devkit_1.getWorkspaceLayout)(tree);
11
- return (0, project_generator_1.projectGenerator)(tree, Object.assign(Object.assign({}, schema), { buildable: true, skipTsConfig: true }), appsDir, (0, path_1.join)(__dirname, './files'), 'application');
12
- });
13
- }
14
- exports.applicationGenerator = applicationGenerator;
15
- exports.default = applicationGenerator;
16
- exports.applicationSchematic = (0, devkit_1.convertNxGenerator)(applicationGenerator);
17
- //# sourceMappingURL=application.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"application.js","sourceRoot":"","sources":["../../../../../../packages/js/src/generators/application/application.ts"],"names":[],"mappings":";;;;AAAA,yCAA4E;AAC5E,+BAA4B;AAC5B,qEAAiE;AAGjE,SAAsB,oBAAoB,CACxC,IAAU,EACV,MAAuB;;QAEvB,MAAM,EAAE,OAAO,EAAE,GAAG,IAAA,2BAAkB,EAAC,IAAI,CAAC,CAAC;QAC7C,OAAO,IAAA,oCAAgB,EACrB,IAAI,kCACC,MAAM,KAAE,SAAS,EAAE,IAAI,EAAE,YAAY,EAAE,IAAI,KAChD,OAAO,EACP,IAAA,WAAI,EAAC,SAAS,EAAE,SAAS,CAAC,EAC1B,aAAa,CACd,CAAC;IACJ,CAAC;CAAA;AAZD,oDAYC;AAED,kBAAe,oBAAoB,CAAC;AACvB,QAAA,oBAAoB,GAAG,IAAA,2BAAkB,EAAC,oBAAoB,CAAC,CAAC"}
@@ -1,19 +0,0 @@
1
- # <%= name %>
2
-
3
- This application was generated with [Nx](https://nx.dev).
4
-
5
- ## Building
6
-
7
- Run `<%= cliCommand %> build <%= name %>` to build the application.
8
-
9
- ## Starting
10
-
11
- Run `<%= cliCommand %> start <%= name %>` to start/run the application.
12
-
13
- <% if (hasUnitTestRunner) { %>
14
-
15
- ## Running unit tests
16
-
17
- Run `<%= cliCommand %> test <%= name %>` to execute the unit tests via [Jest](https://jestjs.io).
18
-
19
- <% } %>
@@ -1,3 +0,0 @@
1
- import {<%= propertyName %>} from './app/<%= fileName %>';
2
-
3
- console.log(`Running ${<%= propertyName %>()}`)
@@ -1,10 +0,0 @@
1
- {
2
- "extends": "./tsconfig.json",
3
- "compilerOptions": {
4
- "outDir": "<%= offsetFromRoot %>dist/out-tsc",
5
- "declaration": true,
6
- "types": []
7
- },
8
- "include": ["**/*.ts"<% if (js) { %>, "**/*.js"<% } %>],
9
- "exclude": ["**/*.spec.ts", "**/*.test.ts"<% if (js) { %>, "**/*.spec.js", "**/*.test.js"<% } %>]
10
- }
@@ -1,14 +0,0 @@
1
- {
2
- "extends": "<%= offsetFromRoot %>tsconfig.base.json",
3
- "compilerOptions": {
4
- "module": "CommonJS"<% if (js) { %>,
5
- "allowJs": true<% } %>
6
- },
7
- "files": [],
8
- "include": [],
9
- "references": [
10
- {
11
- "path": "./tsconfig.app.json"
12
- }
13
- ]
14
- }
@@ -1,99 +0,0 @@
1
- {
2
- "$schema": "http://json-schema.org/schema",
3
- "$id": "NxTypescriptApplication",
4
- "cli": "nx",
5
- "title": "Create a TypeScript application",
6
- "type": "object",
7
- "examples": [
8
- {
9
- "command": "g lib mylib --directory=myapp",
10
- "description": "Generate libs/myapp/mylib"
11
- }
12
- ],
13
- "properties": {
14
- "name": {
15
- "type": "string",
16
- "description": "Library name",
17
- "$default": {
18
- "$source": "argv",
19
- "index": 0
20
- },
21
- "x-prompt": "What name would you like to use for the library?",
22
- "pattern": "^[a-zA-Z].*$"
23
- },
24
- "directory": {
25
- "type": "string",
26
- "description": "A directory where the lib is placed"
27
- },
28
- "linter": {
29
- "description": "The tool to use for running lint checks.",
30
- "type": "string",
31
- "enum": ["eslint", "none"],
32
- "default": "eslint"
33
- },
34
- "unitTestRunner": {
35
- "type": "string",
36
- "enum": ["jest", "none"],
37
- "description": "Test runner to use for unit tests",
38
- "default": "jest"
39
- },
40
- "tags": {
41
- "type": "string",
42
- "description": "Add tags to the library (used for linting)"
43
- },
44
- "skipFormat": {
45
- "description": "Skip formatting files",
46
- "type": "boolean",
47
- "default": false
48
- },
49
- "skipTsConfig": {
50
- "type": "boolean",
51
- "description": "Do not update tsconfig.json for development experience.",
52
- "default": false
53
- },
54
- "testEnvironment": {
55
- "type": "string",
56
- "enum": ["jsdom", "node"],
57
- "description": "The test environment to use if unitTestRunner is set to jest",
58
- "default": "jsdom"
59
- },
60
- "importPath": {
61
- "type": "string",
62
- "description": "The library name used to import it, like @myorg/my-awesome-lib"
63
- },
64
- "pascalCaseFiles": {
65
- "type": "boolean",
66
- "description": "Use pascal case file names.",
67
- "alias": "P",
68
- "default": false
69
- },
70
- "js": {
71
- "type": "boolean",
72
- "description": "Generate JavaScript files rather than TypeScript files",
73
- "default": false
74
- },
75
- "strict": {
76
- "type": "boolean",
77
- "description": "Whether to enable tsconfig strict mode or not.",
78
- "default": true
79
- },
80
- "setParserOptionsProject": {
81
- "type": "boolean",
82
- "description": "Whether or not to configure the ESLint \"parserOptions.project\" option. We do not do this by default for lint performance reasons.",
83
- "default": false
84
- },
85
- "config": {
86
- "type": "string",
87
- "enum": ["workspace", "project", "npm-scripts"],
88
- "default": "project",
89
- "description": "Determines whether the project's executors should be configured in workspace.json, project.json or as npm scripts"
90
- },
91
- "compiler": {
92
- "type": "string",
93
- "enum": ["tsc", "swc"],
94
- "default": "tsc",
95
- "description": "The compiler used by the build and test targets"
96
- }
97
- },
98
- "required": ["name"]
99
- }
@@ -1,5 +0,0 @@
1
- {
2
- "name": "<%= importPath %>",
3
- "version": "0.0.1",
4
- "type": "commonjs"
5
- }
@@ -1,7 +0,0 @@
1
- import { <%= propertyName %> } from './<%= fileName %>';
2
-
3
- describe('<%= propertyName %>', () => {
4
- it('should work', () => {
5
- expect(<%= propertyName %>()).toEqual('<%= name %>');
6
- })
7
- })
@@ -1,3 +0,0 @@
1
- export function <%= propertyName %>(): string {
2
- return '<%= name %>';
3
- }
@@ -1,12 +0,0 @@
1
- import { GeneratorCallback, Tree } from '@nrwl/devkit';
2
- import { GeneratorSchema } from './schema';
3
- export declare function projectGenerator(tree: Tree, schema: GeneratorSchema, destinationDir: string, filesDir: string, projectType: 'library' | 'application'): Promise<GeneratorCallback>;
4
- export interface NormalizedSchema extends GeneratorSchema {
5
- name: string;
6
- fileName: string;
7
- projectRoot: string;
8
- projectDirectory: string;
9
- parsedTags: string[];
10
- importPath?: string;
11
- }
12
- export declare function addLint(tree: Tree, options: NormalizedSchema): Promise<GeneratorCallback>;
@@ -1,203 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.addLint = exports.projectGenerator = void 0;
4
- const tslib_1 = require("tslib");
5
- const devkit_1 = require("@nrwl/devkit");
6
- const run_tasks_in_serial_1 = require("@nrwl/workspace/src/utilities/run-tasks-in-serial");
7
- const path_1 = require("path");
8
- const add_swc_config_1 = require("./swc/add-swc-config");
9
- const add_swc_dependencies_1 = require("./swc/add-swc-dependencies");
10
- // nx-ignore-next-line
11
- const { jestProjectGenerator } = require('@nrwl/jest');
12
- // nx-ignore-next-line
13
- const { lintProjectGenerator, Linter } = require('@nrwl/linter');
14
- function projectGenerator(tree, schema, destinationDir, filesDir, projectType) {
15
- return (0, tslib_1.__awaiter)(this, void 0, void 0, function* () {
16
- const options = normalizeOptions(tree, schema, destinationDir);
17
- createFiles(tree, options, filesDir);
18
- addProject(tree, options, destinationDir, projectType);
19
- if (!schema.skipTsConfig) {
20
- updateRootTsConfig(tree, options);
21
- }
22
- const tasks = [];
23
- if (options.linter !== 'none') {
24
- const lintCallback = yield addLint(tree, options);
25
- tasks.push(lintCallback);
26
- }
27
- if (options.unitTestRunner === 'jest') {
28
- const jestCallback = yield addJest(tree, options);
29
- tasks.push(jestCallback);
30
- }
31
- if (!options.skipFormat) {
32
- yield (0, devkit_1.formatFiles)(tree);
33
- }
34
- return (0, run_tasks_in_serial_1.runTasksInSerial)(...tasks);
35
- });
36
- }
37
- exports.projectGenerator = projectGenerator;
38
- function addProject(tree, options, destinationDir, projectType) {
39
- const projectConfiguration = {
40
- root: options.projectRoot,
41
- sourceRoot: (0, devkit_1.joinPathFragments)(options.projectRoot, 'src'),
42
- projectType: projectType,
43
- targets: {},
44
- tags: options.parsedTags,
45
- };
46
- if (options.buildable && options.config != 'npm-scripts') {
47
- projectConfiguration.targets.build = {
48
- executor: `@nrwl/js:${options.compiler}`,
49
- outputs: ['{options.outputPath}'],
50
- options: {
51
- outputPath: `dist/${destinationDir}/${options.projectDirectory}`,
52
- main: `${options.projectRoot}/src/index` + (options.js ? '.js' : '.ts'),
53
- tsConfig: `${options.projectRoot}/${projectType === 'library' ? 'tsconfig.lib.json' : 'tsconfig.app.json'}`,
54
- assets: [`${options.projectRoot}/*.md`],
55
- },
56
- };
57
- if (options.compiler === 'swc' && options.skipTypeCheck) {
58
- projectConfiguration.targets.build.options.skipTypeCheck = true;
59
- }
60
- if (projectType === 'application') {
61
- projectConfiguration.targets.serve = {
62
- executor: `@nrwl/js:node`,
63
- options: {
64
- buildTarget: `${options.name}:build`,
65
- },
66
- };
67
- }
68
- }
69
- if (options.config === 'workspace') {
70
- (0, devkit_1.addProjectConfiguration)(tree, options.name, projectConfiguration, false);
71
- }
72
- else if (options.config === 'project') {
73
- (0, devkit_1.addProjectConfiguration)(tree, options.name, projectConfiguration, true);
74
- }
75
- else {
76
- (0, devkit_1.addProjectConfiguration)(tree, options.name, {
77
- root: projectConfiguration.root,
78
- tags: projectConfiguration.tags,
79
- }, true);
80
- }
81
- }
82
- function addLint(tree, options) {
83
- return lintProjectGenerator(tree, {
84
- project: options.name,
85
- linter: options.linter,
86
- skipFormat: true,
87
- tsConfigPaths: [
88
- (0, devkit_1.joinPathFragments)(options.projectRoot, 'tsconfig.lib.json'),
89
- ],
90
- eslintFilePatterns: [
91
- `${options.projectRoot}/**/*.${options.js ? 'js' : 'ts'}`,
92
- ],
93
- setParserOptionsProject: options.setParserOptionsProject,
94
- });
95
- }
96
- exports.addLint = addLint;
97
- function updateTsConfig(tree, options) {
98
- (0, devkit_1.updateJson)(tree, (0, path_1.join)(options.projectRoot, 'tsconfig.json'), (json) => {
99
- if (options.strict) {
100
- json.compilerOptions = Object.assign(Object.assign({}, json.compilerOptions), { forceConsistentCasingInFileNames: true, strict: true, noImplicitOverride: true, noPropertyAccessFromIndexSignature: true, noImplicitReturns: true, noFallthroughCasesInSwitch: true });
101
- }
102
- return json;
103
- });
104
- }
105
- function createFiles(tree, options, filesDir) {
106
- const { className, name, propertyName } = (0, devkit_1.names)(options.name);
107
- (0, devkit_1.generateFiles)(tree, filesDir, options.projectRoot, Object.assign(Object.assign({}, options), { dot: '.', className,
108
- name,
109
- propertyName, js: !!options.js, cliCommand: 'nx', strict: undefined, tmpl: '', offsetFromRoot: (0, devkit_1.offsetFromRoot)(options.projectRoot), buildable: options.buildable === true, hasUnitTestRunner: options.unitTestRunner !== 'none' }));
110
- if (options.buildable && options.compiler === 'swc') {
111
- (0, add_swc_dependencies_1.addSwcDependencies)(tree);
112
- (0, add_swc_config_1.addSwcConfig)(tree, options.projectRoot);
113
- }
114
- if (options.unitTestRunner === 'none') {
115
- tree.delete((0, path_1.join)(options.projectRoot, 'src/lib', `${options.fileName}.spec.ts`));
116
- tree.delete((0, path_1.join)(options.projectRoot, 'src/app', `${options.fileName}.spec.ts`));
117
- }
118
- if (options.js) {
119
- (0, devkit_1.toJS)(tree);
120
- }
121
- const packageJsonPath = (0, path_1.join)(options.projectRoot, 'package.json');
122
- if (options.config === 'npm-scripts') {
123
- (0, devkit_1.updateJson)(tree, packageJsonPath, (json) => {
124
- json.scripts = {
125
- build: "echo 'implement build'",
126
- test: "echo 'implement test'",
127
- };
128
- return json;
129
- });
130
- }
131
- else if (!options.buildable) {
132
- tree.delete(packageJsonPath);
133
- }
134
- updateTsConfig(tree, options);
135
- }
136
- function addJest(tree, options) {
137
- return (0, tslib_1.__awaiter)(this, void 0, void 0, function* () {
138
- return yield jestProjectGenerator(tree, {
139
- project: options.name,
140
- setupFile: 'none',
141
- supportTsx: false,
142
- skipSerializers: true,
143
- testEnvironment: options.testEnvironment,
144
- skipFormat: true,
145
- compiler: options.compiler,
146
- });
147
- });
148
- }
149
- function normalizeOptions(tree, options, destinationDir) {
150
- if (options.config === 'npm-scripts') {
151
- options.unitTestRunner = 'none';
152
- options.linter = Linter.None;
153
- options.buildable = false;
154
- }
155
- if (options.compiler === 'swc' && options.skipTypeCheck == null) {
156
- options.skipTypeCheck = false;
157
- }
158
- const name = (0, devkit_1.names)(options.name).fileName;
159
- const projectDirectory = options.directory
160
- ? `${(0, devkit_1.names)(options.directory).fileName}/${name}`
161
- : name;
162
- if (!options.unitTestRunner && options.config !== 'npm-scripts') {
163
- options.unitTestRunner = 'jest';
164
- }
165
- if (!options.linter && options.config !== 'npm-scripts') {
166
- options.linter = Linter.EsLint;
167
- }
168
- const projectName = projectDirectory.replace(new RegExp('/', 'g'), '-');
169
- const fileName = getCaseAwareFileName({
170
- fileName: options.simpleModuleName ? name : projectName,
171
- pascalCaseFiles: options.pascalCaseFiles,
172
- });
173
- const { npmScope } = (0, devkit_1.getWorkspaceLayout)(tree);
174
- const projectRoot = (0, devkit_1.joinPathFragments)(destinationDir, projectDirectory);
175
- const parsedTags = options.tags
176
- ? options.tags.split(',').map((s) => s.trim())
177
- : [];
178
- const defaultImportPath = `@${npmScope}/${projectDirectory}`;
179
- const importPath = options.importPath || defaultImportPath;
180
- return Object.assign(Object.assign({}, options), { fileName, name: projectName, projectRoot,
181
- projectDirectory,
182
- parsedTags,
183
- importPath });
184
- }
185
- function getCaseAwareFileName(options) {
186
- const normalized = (0, devkit_1.names)(options.fileName);
187
- return options.pascalCaseFiles ? normalized.className : normalized.fileName;
188
- }
189
- function updateRootTsConfig(host, options) {
190
- (0, devkit_1.updateJson)(host, 'tsconfig.base.json', (json) => {
191
- const c = json.compilerOptions;
192
- c.paths = c.paths || {};
193
- delete c.paths[options.name];
194
- if (c.paths[options.importPath]) {
195
- throw new Error(`You already have a library using the import path "${options.importPath}". Make sure to specify a unique one.`);
196
- }
197
- c.paths[options.importPath] = [
198
- (0, devkit_1.joinPathFragments)(options.projectRoot, './src', 'index.' + (options.js ? 'js' : 'ts')),
199
- ];
200
- return json;
201
- });
202
- }
203
- //# sourceMappingURL=project-generator.js.map