@nx/express 23.0.0-pr.35465.2bc2643 → 23.0.0-rc.1
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/{index.d.ts → dist/index.d.ts} +0 -1
- package/{src → dist/src}/generators/application/application.d.ts +0 -1
- package/{src → dist/src}/generators/application/application.js +12 -10
- package/{src → dist/src}/generators/application/schema.d.ts +1 -1
- package/{src → dist/src}/generators/application/schema.json +6 -0
- package/{src → dist/src}/generators/init/init.d.ts +0 -1
- package/{src → dist/src}/generators/init/init.js +7 -1
- package/{src → dist/src}/generators/init/schema.json +1 -1
- package/dist/src/utils/assert-supported-express-version.d.ts +2 -0
- package/dist/src/utils/assert-supported-express-version.js +8 -0
- package/dist/src/utils/versions.d.ts +12 -0
- package/dist/src/utils/versions.js +37 -0
- package/generators.json +4 -4
- package/package.json +30 -9
- package/index.d.ts.map +0 -1
- package/src/generators/application/application.d.ts.map +0 -1
- package/src/generators/init/init.d.ts.map +0 -1
- package/src/utils/versions.d.ts +0 -4
- package/src/utils/versions.d.ts.map +0 -1
- package/src/utils/versions.js +0 -6
- /package/{LICENSE → dist/LICENSE} +0 -0
- /package/{index.js → dist/index.js} +0 -0
- /package/{src → dist/src}/generators/init/schema.d.ts +0 -0
|
@@ -3,4 +3,3 @@ import type { Schema } from './schema';
|
|
|
3
3
|
export declare function applicationGenerator(tree: Tree, schema: Schema): Promise<GeneratorCallback>;
|
|
4
4
|
export declare function applicationGeneratorInternal(tree: Tree, schema: Schema): Promise<GeneratorCallback>;
|
|
5
5
|
export default applicationGenerator;
|
|
6
|
-
//# sourceMappingURL=application.d.ts.map
|
|
@@ -2,13 +2,14 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.applicationGenerator = applicationGenerator;
|
|
4
4
|
exports.applicationGeneratorInternal = applicationGeneratorInternal;
|
|
5
|
+
const internal_1 = require("@nx/devkit/internal");
|
|
5
6
|
const devkit_1 = require("@nx/devkit");
|
|
6
|
-
const
|
|
7
|
-
const ts_solution_setup_1 = require("@nx/js/src/utils/typescript/ts-solution-setup");
|
|
7
|
+
const internal_2 = require("@nx/js/internal");
|
|
8
8
|
const node_1 = require("@nx/node");
|
|
9
|
-
const
|
|
9
|
+
const internal_3 = require("@nx/node/internal");
|
|
10
10
|
const path_1 = require("path");
|
|
11
|
-
const
|
|
11
|
+
const assert_supported_express_version_1 = require("../../utils/assert-supported-express-version");
|
|
12
|
+
const versions_1 = require("../../utils/versions");
|
|
12
13
|
const init_1 = require("../init/init");
|
|
13
14
|
function addTypes(tree, options) {
|
|
14
15
|
(0, devkit_1.updateJson)(tree, (0, path_1.join)(options.appProjectRoot, 'tsconfig.app.json'), (json) => {
|
|
@@ -51,6 +52,7 @@ async function applicationGenerator(tree, schema) {
|
|
|
51
52
|
});
|
|
52
53
|
}
|
|
53
54
|
async function applicationGeneratorInternal(tree, schema) {
|
|
55
|
+
(0, assert_supported_express_version_1.assertSupportedExpressVersion)(tree);
|
|
54
56
|
const options = await normalizeOptions(tree, schema);
|
|
55
57
|
const tasks = [];
|
|
56
58
|
const initTask = await (0, init_1.initGenerator)(tree, { ...options, skipFormat: true });
|
|
@@ -65,7 +67,7 @@ async function applicationGeneratorInternal(tree, schema) {
|
|
|
65
67
|
addMainFile(tree, options);
|
|
66
68
|
addTypes(tree, options);
|
|
67
69
|
if (!options.skipPackageJson) {
|
|
68
|
-
tasks.push(ensureDependencies(tree));
|
|
70
|
+
tasks.push(ensureDependencies(tree, options));
|
|
69
71
|
}
|
|
70
72
|
if (!options.skipFormat) {
|
|
71
73
|
await (0, devkit_1.formatFiles)(tree);
|
|
@@ -74,8 +76,8 @@ async function applicationGeneratorInternal(tree, schema) {
|
|
|
74
76
|
}
|
|
75
77
|
exports.default = applicationGenerator;
|
|
76
78
|
async function normalizeOptions(host, options) {
|
|
77
|
-
await (0,
|
|
78
|
-
const { projectName: appProjectName, projectRoot: appProjectRoot } = await (0,
|
|
79
|
+
await (0, internal_1.ensureRootProjectName)(options, 'application');
|
|
80
|
+
const { projectName: appProjectName, projectRoot: appProjectRoot } = await (0, internal_1.determineProjectNameAndRootOptions)(host, {
|
|
79
81
|
name: options.name,
|
|
80
82
|
projectType: 'application',
|
|
81
83
|
directory: options.directory,
|
|
@@ -84,7 +86,7 @@ async function normalizeOptions(host, options) {
|
|
|
84
86
|
const addPlugin = process.env.NX_ADD_PLUGINS !== 'false' &&
|
|
85
87
|
nxJson.useInferencePlugins !== false;
|
|
86
88
|
options.addPlugin ??= addPlugin;
|
|
87
|
-
const useProjectJson = options.useProjectJson ?? !(0,
|
|
89
|
+
const useProjectJson = options.useProjectJson ?? !(0, internal_2.isUsingTsSolutionSetup)(host);
|
|
88
90
|
return {
|
|
89
91
|
...options,
|
|
90
92
|
appProjectName,
|
|
@@ -92,6 +94,6 @@ async function normalizeOptions(host, options) {
|
|
|
92
94
|
useProjectJson,
|
|
93
95
|
};
|
|
94
96
|
}
|
|
95
|
-
function ensureDependencies(tree) {
|
|
96
|
-
return (0, devkit_1.addDependenciesToPackageJson)(tree, { tslib:
|
|
97
|
+
function ensureDependencies(tree, options) {
|
|
98
|
+
return (0, devkit_1.addDependenciesToPackageJson)(tree, { tslib: internal_3.tslibVersion }, { '@nx/express': versions_1.nxVersion }, undefined, options.keepExistingVersions ?? true);
|
|
97
99
|
}
|
|
@@ -14,8 +14,8 @@ export interface Schema {
|
|
|
14
14
|
/** @deprecated use `swcJest` instead */
|
|
15
15
|
babelJest?: boolean;
|
|
16
16
|
js: boolean;
|
|
17
|
-
standaloneConfig?: boolean;
|
|
18
17
|
setParserOptionsProject?: boolean;
|
|
19
18
|
addPlugin?: boolean;
|
|
20
19
|
useProjectJson?: boolean;
|
|
20
|
+
keepExistingVersions?: boolean;
|
|
21
21
|
}
|
|
@@ -77,6 +77,12 @@
|
|
|
77
77
|
"useProjectJson": {
|
|
78
78
|
"type": "boolean",
|
|
79
79
|
"description": "Use a `project.json` configuration file instead of inlining the Nx configuration in the `package.json` file."
|
|
80
|
+
},
|
|
81
|
+
"keepExistingVersions": {
|
|
82
|
+
"type": "boolean",
|
|
83
|
+
"x-priority": "internal",
|
|
84
|
+
"description": "Keep existing dependencies versions",
|
|
85
|
+
"default": true
|
|
80
86
|
}
|
|
81
87
|
},
|
|
82
88
|
"required": ["directory"]
|
|
@@ -2,14 +2,20 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.initGenerator = initGenerator;
|
|
4
4
|
const devkit_1 = require("@nx/devkit");
|
|
5
|
+
const assert_supported_express_version_1 = require("../../utils/assert-supported-express-version");
|
|
5
6
|
const versions_1 = require("../../utils/versions");
|
|
6
7
|
function updateDependencies(tree, schema) {
|
|
7
8
|
const tasks = [];
|
|
8
9
|
tasks.push((0, devkit_1.removeDependenciesFromPackageJson)(tree, ['@nx/express'], []));
|
|
9
|
-
|
|
10
|
+
const pkgVersions = (0, versions_1.versions)(tree);
|
|
11
|
+
tasks.push((0, devkit_1.addDependenciesToPackageJson)(tree, { express: pkgVersions.expressVersion }, {
|
|
12
|
+
'@nx/express': versions_1.nxVersion,
|
|
13
|
+
'@types/express': pkgVersions.expressTypingsVersion,
|
|
14
|
+
}, undefined, schema.keepExistingVersions ?? true));
|
|
10
15
|
return (0, devkit_1.runTasksInSerial)(...tasks);
|
|
11
16
|
}
|
|
12
17
|
async function initGenerator(tree, schema) {
|
|
18
|
+
(0, assert_supported_express_version_1.assertSupportedExpressVersion)(tree);
|
|
13
19
|
let installTask = () => { };
|
|
14
20
|
if (!schema.skipPackageJson) {
|
|
15
21
|
installTask = updateDependencies(tree, schema);
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.assertSupportedExpressVersion = assertSupportedExpressVersion;
|
|
4
|
+
const internal_1 = require("@nx/devkit/internal");
|
|
5
|
+
const versions_1 = require("./versions");
|
|
6
|
+
function assertSupportedExpressVersion(tree) {
|
|
7
|
+
(0, internal_1.assertSupportedPackageVersion)(tree, 'express', versions_1.minSupportedExpressVersion);
|
|
8
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { type Tree } from '@nx/devkit';
|
|
2
|
+
export declare const nxVersion: any;
|
|
3
|
+
export declare const minSupportedExpressVersion = "4.0.0";
|
|
4
|
+
export declare const expressVersion = "^5.1.0";
|
|
5
|
+
export declare const expressTypingsVersion = "^5.0.0";
|
|
6
|
+
type ExpressVersions = {
|
|
7
|
+
expressVersion: string;
|
|
8
|
+
expressTypingsVersion: string;
|
|
9
|
+
};
|
|
10
|
+
export declare function versions(tree: Tree): ExpressVersions;
|
|
11
|
+
export declare function getInstalledExpressVersion(tree?: Tree): string | null;
|
|
12
|
+
export {};
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.expressTypingsVersion = exports.expressVersion = exports.minSupportedExpressVersion = exports.nxVersion = void 0;
|
|
4
|
+
exports.versions = versions;
|
|
5
|
+
exports.getInstalledExpressVersion = getInstalledExpressVersion;
|
|
6
|
+
const internal_1 = require("@nx/devkit/internal");
|
|
7
|
+
const semver_1 = require("semver");
|
|
8
|
+
const path_1 = require("path");
|
|
9
|
+
exports.nxVersion = require((0, path_1.join)('@nx/express', 'package.json')).version;
|
|
10
|
+
exports.minSupportedExpressVersion = '4.0.0';
|
|
11
|
+
// Fresh-install constants (latest supported major).
|
|
12
|
+
exports.expressVersion = '^5.1.0';
|
|
13
|
+
exports.expressTypingsVersion = '^5.0.0';
|
|
14
|
+
const latestVersions = {
|
|
15
|
+
expressVersion: exports.expressVersion,
|
|
16
|
+
expressTypingsVersion: exports.expressTypingsVersion,
|
|
17
|
+
};
|
|
18
|
+
const versionMap = {
|
|
19
|
+
4: {
|
|
20
|
+
expressVersion: '^4.21.2',
|
|
21
|
+
expressTypingsVersion: '^4.17.21',
|
|
22
|
+
},
|
|
23
|
+
};
|
|
24
|
+
function versions(tree) {
|
|
25
|
+
const installedExpressVersion = getInstalledExpressVersion(tree);
|
|
26
|
+
if (!installedExpressVersion) {
|
|
27
|
+
return latestVersions;
|
|
28
|
+
}
|
|
29
|
+
const expressMajorVersion = (0, semver_1.major)(installedExpressVersion);
|
|
30
|
+
return versionMap[expressMajorVersion] ?? latestVersions;
|
|
31
|
+
}
|
|
32
|
+
function getInstalledExpressVersion(tree) {
|
|
33
|
+
if (!tree) {
|
|
34
|
+
return (0, internal_1.getInstalledPackageVersion)('express');
|
|
35
|
+
}
|
|
36
|
+
return (0, internal_1.getDeclaredPackageVersion)(tree, 'express');
|
|
37
|
+
}
|
package/generators.json
CHANGED
|
@@ -4,15 +4,15 @@
|
|
|
4
4
|
"extends": ["@nx/workspace"],
|
|
5
5
|
"generators": {
|
|
6
6
|
"init": {
|
|
7
|
-
"factory": "./src/generators/init/init#initGenerator",
|
|
8
|
-
"schema": "./src/generators/init/schema.json",
|
|
7
|
+
"factory": "./dist/src/generators/init/init#initGenerator",
|
|
8
|
+
"schema": "./dist/src/generators/init/schema.json",
|
|
9
9
|
"description": "Initialize the `@nx/express` plugin.",
|
|
10
10
|
"aliases": ["ng-add"],
|
|
11
11
|
"hidden": true
|
|
12
12
|
},
|
|
13
13
|
"application": {
|
|
14
|
-
"factory": "./src/generators/application/application#applicationGeneratorInternal",
|
|
15
|
-
"schema": "./src/generators/application/schema.json",
|
|
14
|
+
"factory": "./dist/src/generators/application/application#applicationGeneratorInternal",
|
|
15
|
+
"schema": "./dist/src/generators/application/schema.json",
|
|
16
16
|
"aliases": ["app"],
|
|
17
17
|
"x-type": "application",
|
|
18
18
|
"description": "Create an Express application."
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nx/express",
|
|
3
|
-
"version": "23.0.0-
|
|
3
|
+
"version": "23.0.0-rc.1",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "The Nx Plugin for Express contains executors and generators for allowing your workspace to create powerful Express Node applications and APIs.",
|
|
6
6
|
"repository": {
|
|
@@ -17,9 +17,15 @@
|
|
|
17
17
|
"CLI",
|
|
18
18
|
"Backend"
|
|
19
19
|
],
|
|
20
|
-
"main": "./index.js",
|
|
20
|
+
"main": "./dist/index.js",
|
|
21
21
|
"type": "commonjs",
|
|
22
|
-
"types": "./index.d.ts",
|
|
22
|
+
"types": "./dist/index.d.ts",
|
|
23
|
+
"files": [
|
|
24
|
+
"dist",
|
|
25
|
+
"!dist/tsconfig.tsbuildinfo",
|
|
26
|
+
"migrations.json",
|
|
27
|
+
"generators.json"
|
|
28
|
+
],
|
|
23
29
|
"author": "Victor Savkin",
|
|
24
30
|
"license": "MIT",
|
|
25
31
|
"bugs": {
|
|
@@ -29,16 +35,18 @@
|
|
|
29
35
|
"generators": "./generators.json",
|
|
30
36
|
"ng-update": {
|
|
31
37
|
"requirements": {},
|
|
32
|
-
"migrations": "./migrations.json"
|
|
38
|
+
"migrations": "./migrations.json",
|
|
39
|
+
"supportsOptionalMigrations": true
|
|
33
40
|
},
|
|
34
41
|
"dependencies": {
|
|
35
|
-
"
|
|
36
|
-
"
|
|
37
|
-
"@nx/
|
|
38
|
-
"
|
|
42
|
+
"semver": "^7.6.3",
|
|
43
|
+
"tslib": "^2.3.0",
|
|
44
|
+
"@nx/devkit": "23.0.0-rc.1",
|
|
45
|
+
"@nx/js": "23.0.0-rc.1",
|
|
46
|
+
"@nx/node": "23.0.0-rc.1"
|
|
39
47
|
},
|
|
40
48
|
"peerDependencies": {
|
|
41
|
-
"express": "
|
|
49
|
+
"express": ">=4.0.0 <6.0.0"
|
|
42
50
|
},
|
|
43
51
|
"peerDependenciesMeta": {
|
|
44
52
|
"express": {
|
|
@@ -47,5 +55,18 @@
|
|
|
47
55
|
},
|
|
48
56
|
"publishConfig": {
|
|
49
57
|
"access": "public"
|
|
58
|
+
},
|
|
59
|
+
"exports": {
|
|
60
|
+
".": {
|
|
61
|
+
"@nx/nx-source": "./index.ts",
|
|
62
|
+
"types": "./dist/index.d.ts",
|
|
63
|
+
"default": "./dist/index.js"
|
|
64
|
+
},
|
|
65
|
+
"./package.json": "./package.json",
|
|
66
|
+
"./migrations.json": "./migrations.json",
|
|
67
|
+
"./generators.json": "./generators.json"
|
|
68
|
+
},
|
|
69
|
+
"typesVersions": {
|
|
70
|
+
"*": {}
|
|
50
71
|
}
|
|
51
72
|
}
|
package/index.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../packages/express/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,0CAA0C,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"application.d.ts","sourceRoot":"","sources":["../../../../../../packages/express/src/generators/application/application.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AAmB1D,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAkDvC,wBAAsB,oBAAoB,CAAC,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,8BAMpE;AAED,wBAAsB,4BAA4B,CAAC,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,8BAyB5E;AAED,eAAe,oBAAoB,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../../../../../../packages/express/src/generators/init/init.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,iBAAiB,EAGjB,IAAI,EACL,MAAM,YAAY,CAAC;AAEpB,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAoBvC,wBAAsB,aAAa,CAAC,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,8BAW7D;AAED,eAAe,aAAa,CAAC"}
|
package/src/utils/versions.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"versions.d.ts","sourceRoot":"","sources":["../../../../../packages/express/src/utils/versions.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,SAAS,KAAwC,CAAC;AAE/D,eAAO,MAAM,cAAc,YAAY,CAAC;AACxC,eAAO,MAAM,qBAAqB,aAAa,CAAC"}
|
package/src/utils/versions.js
DELETED
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.expressTypingsVersion = exports.expressVersion = exports.nxVersion = void 0;
|
|
4
|
-
exports.nxVersion = require('../../package.json').version;
|
|
5
|
-
exports.expressVersion = '^4.21.2';
|
|
6
|
-
exports.expressTypingsVersion = '^4.17.21';
|
|
File without changes
|
|
File without changes
|
|
File without changes
|