@nx/node 0.0.0-pr-31222-862e973 → 0.0.0-pr-31313-387cdca
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/LICENSE +1 -1
- package/README.md +1 -1
- package/migrations.json +24 -38
- package/package.json +9 -8
- package/src/generators/application/application.d.ts +3 -1
- package/src/generators/application/application.js +102 -27
- package/src/generators/application/files/common/tsconfig.app.json +0 -1
- package/src/generators/application/files/common/webpack.config.js__tmpl__ +4 -4
- package/src/generators/application/schema.d.ts +5 -5
- package/src/generators/application/schema.json +27 -30
- package/src/generators/e2e-project/e2e-project.js +112 -32
- package/src/generators/e2e-project/files/cli/jest.config.ts__tmpl__ +17 -4
- package/src/generators/e2e-project/files/server/common/jest.config.ts__tmpl__ +17 -4
- package/src/generators/e2e-project/files/server/common/src/support/global-setup.ts__tmpl__ +6 -0
- package/src/generators/e2e-project/files/server/common/src/support/global-teardown.ts__tmpl__ +3 -0
- package/src/generators/e2e-project/files/server/common/src/support/test-setup.ts__tmpl__ +0 -1
- package/src/generators/e2e-project/files/ts-solution/tsconfig.json__tmpl__ +14 -0
- package/src/generators/e2e-project/schema.d.ts +1 -3
- package/src/generators/e2e-project/schema.json +4 -5
- package/src/generators/library/files/ts-solution/tsconfig.lib.json +15 -0
- package/src/generators/library/library.d.ts +1 -0
- package/src/generators/library/library.js +78 -43
- package/src/generators/library/schema.d.ts +3 -5
- package/src/generators/library/schema.json +21 -24
- package/src/utils/kill-port.d.ts +7 -0
- package/src/utils/kill-port.js +36 -0
- package/src/utils/versions.d.ts +6 -6
- package/src/utils/versions.js +6 -6
- package/src/utils/wait-for-port-open.d.ts +24 -0
- package/src/utils/wait-for-port-open.js +47 -0
- package/utils.d.ts +2 -0
- package/utils.js +7 -0
- package/src/generators/e2e-project/files/cli/tsconfig.spec.json__tmpl__ +0 -12
- package/src/generators/e2e-project/files/server/common/tsconfig.json__tmpl__ +0 -13
- package/src/generators/library/files/lib/package.json__tmpl__ +0 -4
- package/src/migrations/update-16-0-0/update-webpack-executor.d.ts +0 -2
- package/src/migrations/update-16-0-0/update-webpack-executor.js +0 -17
- package/src/migrations/update-16-0-0-add-nx-packages/update-16-0-0-add-nx-packages.d.ts +0 -2
- package/src/migrations/update-16-0-0-add-nx-packages/update-16-0-0-add-nx-packages.js +0 -9
- package/src/migrations/update-16-3-1/update-webpack-executor.d.ts +0 -2
- package/src/migrations/update-16-3-1/update-webpack-executor.js +0 -17
- package/src/migrations/update-16-4-0/replace-node-executor.d.ts +0 -2
- package/src/migrations/update-16-4-0/replace-node-executor.js +0 -14
- /package/src/generators/e2e-project/files/{cli → non-ts-solution}/tsconfig.json__tmpl__ +0 -0
- /package/src/generators/e2e-project/files/{server/common → non-ts-solution}/tsconfig.spec.json__tmpl__ +0 -0
- /package/src/generators/library/files/{lib → non-ts-solution}/tsconfig.lib.json +0 -0
|
@@ -12,43 +12,42 @@
|
|
|
12
12
|
}
|
|
13
13
|
],
|
|
14
14
|
"properties": {
|
|
15
|
-
"
|
|
15
|
+
"directory": {
|
|
16
16
|
"type": "string",
|
|
17
|
-
"description": "
|
|
17
|
+
"description": "A directory where the lib is placed",
|
|
18
|
+
"alias": "dir",
|
|
18
19
|
"$default": {
|
|
19
20
|
"$source": "argv",
|
|
20
21
|
"index": 0
|
|
21
22
|
},
|
|
22
|
-
"x-prompt": "
|
|
23
|
-
"pattern": "(?:^@[a-zA-Z0-9-*~][a-zA-Z0-9-*._~]*\\/[a-zA-Z0-9-~][a-zA-Z0-9-._~]*|^[a-zA-Z][^:]*)$"
|
|
23
|
+
"x-prompt": "Which directory do you want to create the library in?"
|
|
24
24
|
},
|
|
25
|
-
"
|
|
25
|
+
"name": {
|
|
26
26
|
"type": "string",
|
|
27
|
-
"description": "
|
|
28
|
-
"
|
|
27
|
+
"description": "Library name",
|
|
28
|
+
"pattern": "(?:^@[a-zA-Z0-9-*~][a-zA-Z0-9-*._~]*\\/[a-zA-Z0-9-~][a-zA-Z0-9-._~]*|^[a-zA-Z][^:]*)$",
|
|
29
29
|
"x-priority": "important"
|
|
30
30
|
},
|
|
31
|
-
"projectNameAndRootFormat": {
|
|
32
|
-
"description": "Whether to generate the project name and root directory as provided (`as-provided`) or generate them composing their values and taking the configured layout into account (`derived`).",
|
|
33
|
-
"type": "string",
|
|
34
|
-
"enum": ["as-provided", "derived"]
|
|
35
|
-
},
|
|
36
31
|
"simpleModuleName": {
|
|
37
|
-
"description": "Keep the module name simple
|
|
32
|
+
"description": "Keep the module name simple.",
|
|
38
33
|
"type": "boolean",
|
|
39
34
|
"default": false
|
|
40
35
|
},
|
|
41
36
|
"linter": {
|
|
42
37
|
"description": "The tool to use for running lint checks.",
|
|
43
38
|
"type": "string",
|
|
44
|
-
"enum": ["eslint"],
|
|
45
|
-
"default": "
|
|
39
|
+
"enum": ["eslint", "none"],
|
|
40
|
+
"default": "none",
|
|
41
|
+
"x-prompt": "Which linter would you like to use?",
|
|
42
|
+
"x-priority": "important"
|
|
46
43
|
},
|
|
47
44
|
"unitTestRunner": {
|
|
48
45
|
"type": "string",
|
|
49
46
|
"enum": ["jest", "none"],
|
|
50
47
|
"description": "Test runner to use for unit tests.",
|
|
51
|
-
"default": "
|
|
48
|
+
"default": "none",
|
|
49
|
+
"x-prompt": "Which unit test runner would you like to use?",
|
|
50
|
+
"x-priority": "important"
|
|
52
51
|
},
|
|
53
52
|
"tags": {
|
|
54
53
|
"type": "string",
|
|
@@ -74,7 +73,7 @@
|
|
|
74
73
|
},
|
|
75
74
|
"buildable": {
|
|
76
75
|
"type": "boolean",
|
|
77
|
-
"default":
|
|
76
|
+
"default": true,
|
|
78
77
|
"description": "Generate a buildable library.",
|
|
79
78
|
"x-priority": "important"
|
|
80
79
|
},
|
|
@@ -104,12 +103,6 @@
|
|
|
104
103
|
"description": "Use `babel` instead of `ts-jest`.",
|
|
105
104
|
"default": false
|
|
106
105
|
},
|
|
107
|
-
"pascalCaseFiles": {
|
|
108
|
-
"type": "boolean",
|
|
109
|
-
"description": "Use pascal case file names.",
|
|
110
|
-
"alias": "P",
|
|
111
|
-
"default": false
|
|
112
|
-
},
|
|
113
106
|
"js": {
|
|
114
107
|
"type": "boolean",
|
|
115
108
|
"description": "Generate JavaScript files rather than TypeScript files.",
|
|
@@ -130,7 +123,11 @@
|
|
|
130
123
|
"type": "boolean",
|
|
131
124
|
"description": "Whether or not to configure the ESLint `parserOptions.project`. We do not do this by default for lint performance reasons.",
|
|
132
125
|
"default": false
|
|
126
|
+
},
|
|
127
|
+
"useProjectJson": {
|
|
128
|
+
"type": "boolean",
|
|
129
|
+
"description": "Use a `project.json` configuration file instead of inlining the Nx configuration in the `package.json` file."
|
|
133
130
|
}
|
|
134
131
|
},
|
|
135
|
-
"required": ["
|
|
132
|
+
"required": ["directory"]
|
|
136
133
|
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.kill = void 0;
|
|
4
|
+
exports.killPort = killPort;
|
|
5
|
+
const devkit_1 = require("@nx/devkit");
|
|
6
|
+
const tcp_port_used_1 = require("tcp-port-used");
|
|
7
|
+
exports.kill = require('kill-port');
|
|
8
|
+
/**
|
|
9
|
+
* Kills the process on the given port
|
|
10
|
+
* @param port
|
|
11
|
+
* @param killPortDelay
|
|
12
|
+
*/
|
|
13
|
+
async function killPort(port, killPortDelay = 2500) {
|
|
14
|
+
if (await (0, tcp_port_used_1.check)(port)) {
|
|
15
|
+
let killPortResult;
|
|
16
|
+
try {
|
|
17
|
+
devkit_1.logger.info(`Attempting to close port ${port}`);
|
|
18
|
+
killPortResult = await (0, exports.kill)(port);
|
|
19
|
+
await new Promise((resolve) => setTimeout(() => resolve(), killPortDelay));
|
|
20
|
+
if (await (0, tcp_port_used_1.check)(port)) {
|
|
21
|
+
devkit_1.logger.error(`Port ${port} still open ${JSON.stringify(killPortResult)}`);
|
|
22
|
+
}
|
|
23
|
+
else {
|
|
24
|
+
devkit_1.logger.info(`Port ${port} successfully closed`);
|
|
25
|
+
return true;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
catch {
|
|
29
|
+
devkit_1.logger.error(`Port ${port} closing failed`);
|
|
30
|
+
}
|
|
31
|
+
return false;
|
|
32
|
+
}
|
|
33
|
+
else {
|
|
34
|
+
return true;
|
|
35
|
+
}
|
|
36
|
+
}
|
package/src/utils/versions.d.ts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
export declare const nxVersion: any;
|
|
2
2
|
export declare const tslibVersion = "^2.3.0";
|
|
3
3
|
export declare const typesNodeVersion = "~18.16.9";
|
|
4
|
-
export declare const expressVersion = "
|
|
5
|
-
export declare const expressTypingsVersion = "
|
|
4
|
+
export declare const expressVersion = "^4.21.2";
|
|
5
|
+
export declare const expressTypingsVersion = "^4.17.21";
|
|
6
6
|
export declare const koaVersion = "~2.14.1";
|
|
7
7
|
export declare const koaTypingsVersion = "~2.13.5";
|
|
8
|
-
export declare const fastifyVersion = "~
|
|
9
|
-
export declare const fastifyAutoloadVersion = "~
|
|
10
|
-
export declare const fastifySensibleVersion = "~
|
|
11
|
-
export declare const fastifyPluginVersion = "~
|
|
8
|
+
export declare const fastifyVersion = "~5.2.1";
|
|
9
|
+
export declare const fastifyAutoloadVersion = "~6.0.3";
|
|
10
|
+
export declare const fastifySensibleVersion = "~6.0.2";
|
|
11
|
+
export declare const fastifyPluginVersion = "~5.0.1";
|
|
12
12
|
export declare const axiosVersion = "^1.6.0";
|
package/src/utils/versions.js
CHANGED
|
@@ -4,12 +4,12 @@ exports.axiosVersion = exports.fastifyPluginVersion = exports.fastifySensibleVer
|
|
|
4
4
|
exports.nxVersion = require('../../package.json').version;
|
|
5
5
|
exports.tslibVersion = '^2.3.0';
|
|
6
6
|
exports.typesNodeVersion = '~18.16.9';
|
|
7
|
-
exports.expressVersion = '
|
|
8
|
-
exports.expressTypingsVersion = '
|
|
7
|
+
exports.expressVersion = '^4.21.2';
|
|
8
|
+
exports.expressTypingsVersion = '^4.17.21';
|
|
9
9
|
exports.koaVersion = '~2.14.1';
|
|
10
10
|
exports.koaTypingsVersion = '~2.13.5';
|
|
11
|
-
exports.fastifyVersion = '~
|
|
12
|
-
exports.fastifyAutoloadVersion = '~
|
|
13
|
-
exports.fastifySensibleVersion = '~
|
|
14
|
-
exports.fastifyPluginVersion = '~
|
|
11
|
+
exports.fastifyVersion = '~5.2.1';
|
|
12
|
+
exports.fastifyAutoloadVersion = '~6.0.3';
|
|
13
|
+
exports.fastifySensibleVersion = '~6.0.2';
|
|
14
|
+
exports.fastifyPluginVersion = '~5.0.1';
|
|
15
15
|
exports.axiosVersion = '^1.6.0';
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
interface WaitForPortOpenOptions {
|
|
2
|
+
/**
|
|
3
|
+
* The host to connect to
|
|
4
|
+
* @default 'localhost'
|
|
5
|
+
*/
|
|
6
|
+
host?: string;
|
|
7
|
+
/**
|
|
8
|
+
* The number of retries to attempt
|
|
9
|
+
* @default 120
|
|
10
|
+
*/
|
|
11
|
+
retries?: number;
|
|
12
|
+
/**
|
|
13
|
+
* The delay between retries
|
|
14
|
+
* @default 1000
|
|
15
|
+
*/
|
|
16
|
+
retryDelay?: number;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Waits for the given port to be open
|
|
20
|
+
* @param port
|
|
21
|
+
* @param options
|
|
22
|
+
*/
|
|
23
|
+
export declare function waitForPortOpen(port: number, options?: WaitForPortOpenOptions): Promise<void>;
|
|
24
|
+
export {};
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.waitForPortOpen = waitForPortOpen;
|
|
4
|
+
const net = require("net");
|
|
5
|
+
const devkit_1 = require("@nx/devkit");
|
|
6
|
+
/**
|
|
7
|
+
* Waits for the given port to be open
|
|
8
|
+
* @param port
|
|
9
|
+
* @param options
|
|
10
|
+
*/
|
|
11
|
+
function waitForPortOpen(port, options = {}) {
|
|
12
|
+
const host = options.host ?? 'localhost';
|
|
13
|
+
const allowedErrorCodes = ['ECONNREFUSED', 'ECONNRESET', 'ETIMEDOUT'];
|
|
14
|
+
return new Promise((resolve, reject) => {
|
|
15
|
+
const checkPort = (retries = options.retries ?? 120) => {
|
|
16
|
+
const client = new net.Socket();
|
|
17
|
+
const cleanupClient = () => {
|
|
18
|
+
client.removeAllListeners('connect');
|
|
19
|
+
client.removeAllListeners('error');
|
|
20
|
+
client.end();
|
|
21
|
+
client.destroy();
|
|
22
|
+
client.unref();
|
|
23
|
+
};
|
|
24
|
+
client.once('connect', () => {
|
|
25
|
+
cleanupClient();
|
|
26
|
+
resolve();
|
|
27
|
+
});
|
|
28
|
+
client.once('error', (err) => {
|
|
29
|
+
if (retries === 0 || !allowedErrorCodes.includes(err['code'])) {
|
|
30
|
+
if (process.env['NX_VERBOSE_LOGGING'] === 'true') {
|
|
31
|
+
devkit_1.logger.info(`Error connecting on ${host}:${port}: ${err['code'] || err}`);
|
|
32
|
+
}
|
|
33
|
+
cleanupClient();
|
|
34
|
+
reject(err);
|
|
35
|
+
}
|
|
36
|
+
else {
|
|
37
|
+
setTimeout(() => checkPort(retries - 1), options.retryDelay ?? 1000);
|
|
38
|
+
}
|
|
39
|
+
});
|
|
40
|
+
if (process.env['NX_VERBOSE_LOGGING'] === 'true') {
|
|
41
|
+
devkit_1.logger.info(`Connecting on ${host}:${port}`);
|
|
42
|
+
}
|
|
43
|
+
client.connect({ port, host });
|
|
44
|
+
};
|
|
45
|
+
checkPort();
|
|
46
|
+
});
|
|
47
|
+
}
|
package/utils.d.ts
ADDED
package/utils.js
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.killPort = exports.waitForPortOpen = void 0;
|
|
4
|
+
var wait_for_port_open_1 = require("./src/utils/wait-for-port-open");
|
|
5
|
+
Object.defineProperty(exports, "waitForPortOpen", { enumerable: true, get: function () { return wait_for_port_open_1.waitForPortOpen; } });
|
|
6
|
+
var kill_port_1 = require("./src/utils/kill-port");
|
|
7
|
+
Object.defineProperty(exports, "killPort", { enumerable: true, get: function () { return kill_port_1.killPort; } });
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"extends": "<%= offsetFromRoot %><% if (rootProject) { %>tsconfig.json<% } else { %>tsconfig.base.json<% } %>",
|
|
3
|
-
"files": [],
|
|
4
|
-
"include": [],
|
|
5
|
-
"references": [
|
|
6
|
-
{
|
|
7
|
-
"path": "./tsconfig.spec.json"
|
|
8
|
-
}
|
|
9
|
-
],
|
|
10
|
-
"compilerOptions": {
|
|
11
|
-
"esModuleInterop": true
|
|
12
|
-
}
|
|
13
|
-
}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.default = update;
|
|
4
|
-
const devkit_1 = require("@nx/devkit");
|
|
5
|
-
const executor_options_utils_1 = require("@nx/devkit/src/generators/executor-options-utils");
|
|
6
|
-
async function update(tree) {
|
|
7
|
-
const migrateProject = (options, projectName, targetName) => {
|
|
8
|
-
const projectConfig = (0, devkit_1.readProjectConfiguration)(tree, projectName);
|
|
9
|
-
projectConfig.targets[targetName].executor = '@nx/webpack:webpack';
|
|
10
|
-
projectConfig.targets[targetName].options.compiler = 'tsc';
|
|
11
|
-
projectConfig.targets[targetName].options.target = 'node';
|
|
12
|
-
(0, devkit_1.updateProjectConfiguration)(tree, projectName, projectConfig);
|
|
13
|
-
};
|
|
14
|
-
(0, executor_options_utils_1.forEachExecutorOptions)(tree, '@nx/node:webpack', migrateProject);
|
|
15
|
-
(0, executor_options_utils_1.forEachExecutorOptions)(tree, '@nrwl/node:webpack', migrateProject);
|
|
16
|
-
await (0, devkit_1.formatFiles)(tree);
|
|
17
|
-
}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.default = replacePackage;
|
|
4
|
-
const devkit_1 = require("@nx/devkit");
|
|
5
|
-
const replace_package_1 = require("@nx/devkit/src/utils/replace-package");
|
|
6
|
-
async function replacePackage(tree) {
|
|
7
|
-
await (0, replace_package_1.replaceNrwlPackageWithNxPackage)(tree, '@nrwl/node', '@nx/node');
|
|
8
|
-
await (0, devkit_1.formatFiles)(tree);
|
|
9
|
-
}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.default = update;
|
|
4
|
-
const devkit_1 = require("@nx/devkit");
|
|
5
|
-
const executor_options_utils_1 = require("@nx/devkit/src/generators/executor-options-utils");
|
|
6
|
-
async function update(tree) {
|
|
7
|
-
const migrateProject = (options, projectName, targetName) => {
|
|
8
|
-
const projectConfig = (0, devkit_1.readProjectConfiguration)(tree, projectName);
|
|
9
|
-
projectConfig.targets[targetName].executor = '@nx/webpack:webpack';
|
|
10
|
-
projectConfig.targets[targetName].options.compiler = 'tsc';
|
|
11
|
-
projectConfig.targets[targetName].options.target = 'node';
|
|
12
|
-
(0, devkit_1.updateProjectConfiguration)(tree, projectName, projectConfig);
|
|
13
|
-
};
|
|
14
|
-
(0, executor_options_utils_1.forEachExecutorOptions)(tree, '@nx/node:webpack', migrateProject);
|
|
15
|
-
(0, executor_options_utils_1.forEachExecutorOptions)(tree, '@nrwl/node:webpack', migrateProject);
|
|
16
|
-
await (0, devkit_1.formatFiles)(tree);
|
|
17
|
-
}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.default = update;
|
|
4
|
-
const devkit_1 = require("@nx/devkit");
|
|
5
|
-
const executor_options_utils_1 = require("@nx/devkit/src/generators/executor-options-utils");
|
|
6
|
-
async function update(tree) {
|
|
7
|
-
const migrateProject = (_options, projectName, targetName) => {
|
|
8
|
-
const projectConfig = (0, devkit_1.readProjectConfiguration)(tree, projectName);
|
|
9
|
-
projectConfig.targets[targetName].executor = '@nx/js:node';
|
|
10
|
-
(0, devkit_1.updateProjectConfiguration)(tree, projectName, projectConfig);
|
|
11
|
-
};
|
|
12
|
-
(0, executor_options_utils_1.forEachExecutorOptions)(tree, '@nx/node:node', migrateProject);
|
|
13
|
-
await (0, devkit_1.formatFiles)(tree);
|
|
14
|
-
}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|