@nx/express 16.8.0-beta.1 → 16.8.0-beta.3
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/generators.json
CHANGED
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
},
|
|
13
13
|
|
|
14
14
|
"application": {
|
|
15
|
-
"factory": "./src/generators/application/application#
|
|
15
|
+
"factory": "./src/generators/application/application#applicationGeneratorInternal",
|
|
16
16
|
"schema": "./src/generators/application/schema.json",
|
|
17
17
|
"aliases": ["app"],
|
|
18
18
|
"x-type": "application",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nx/express",
|
|
3
|
-
"version": "16.8.0-beta.
|
|
3
|
+
"version": "16.8.0-beta.3",
|
|
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": {
|
|
@@ -30,9 +30,9 @@
|
|
|
30
30
|
"migrations": "./migrations.json"
|
|
31
31
|
},
|
|
32
32
|
"dependencies": {
|
|
33
|
-
"@nrwl/express": "16.8.0-beta.
|
|
34
|
-
"@nx/devkit": "16.8.0-beta.
|
|
35
|
-
"@nx/node": "16.8.0-beta.
|
|
33
|
+
"@nrwl/express": "16.8.0-beta.3",
|
|
34
|
+
"@nx/devkit": "16.8.0-beta.3",
|
|
35
|
+
"@nx/node": "16.8.0-beta.3",
|
|
36
36
|
"tslib": "^2.3.0"
|
|
37
37
|
},
|
|
38
38
|
"peerDependencies": {
|
|
@@ -47,5 +47,5 @@
|
|
|
47
47
|
"access": "public"
|
|
48
48
|
},
|
|
49
49
|
"type": "commonjs",
|
|
50
|
-
"gitHead": "
|
|
50
|
+
"gitHead": "dcd48165a485bc8db57a1fb02b96a0772de3b7e9"
|
|
51
51
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { Tree } from '@nx/devkit';
|
|
2
2
|
import type { Schema } from './schema';
|
|
3
3
|
export declare function applicationGenerator(tree: Tree, schema: Schema): Promise<() => Promise<void>>;
|
|
4
|
+
export declare function applicationGeneratorInternal(tree: Tree, schema: Schema): Promise<() => Promise<void>>;
|
|
4
5
|
export default applicationGenerator;
|
|
5
6
|
export declare const applicationSchematic: (generatorOptions: Schema) => (tree: any, context: any) => Promise<any>;
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.applicationSchematic = exports.applicationGenerator = void 0;
|
|
3
|
+
exports.applicationSchematic = exports.applicationGeneratorInternal = exports.applicationGenerator = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const devkit_1 = require("@nx/devkit");
|
|
6
|
+
const project_name_and_root_utils_1 = require("@nx/devkit/src/generators/project-name-and-root-utils");
|
|
6
7
|
const node_1 = require("@nx/node");
|
|
7
8
|
const path_1 = require("path");
|
|
8
9
|
const init_1 = require("../init/init");
|
|
@@ -26,7 +27,7 @@ const app = express();
|
|
|
26
27
|
app.use('/assets', express.static(path.join(__dirname, 'assets')));
|
|
27
28
|
|
|
28
29
|
app.get('/api', (req, res) => {
|
|
29
|
-
res.send({ message: 'Welcome to ${options.
|
|
30
|
+
res.send({ message: 'Welcome to ${options.appProjectName}!' });
|
|
30
31
|
});
|
|
31
32
|
|
|
32
33
|
const port = process.env.PORT || 3333;
|
|
@@ -41,7 +42,13 @@ server.on('error', console.error);
|
|
|
41
42
|
}
|
|
42
43
|
function applicationGenerator(tree, schema) {
|
|
43
44
|
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
44
|
-
|
|
45
|
+
return yield applicationGeneratorInternal(tree, Object.assign({ projectNameAndRootFormat: 'derived' }, schema));
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
exports.applicationGenerator = applicationGenerator;
|
|
49
|
+
function applicationGeneratorInternal(tree, schema) {
|
|
50
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
51
|
+
const options = yield normalizeOptions(tree, schema);
|
|
45
52
|
const initTask = yield (0, init_1.initGenerator)(tree, Object.assign(Object.assign({}, options), { skipFormat: true }));
|
|
46
53
|
const applicationTask = yield (0, node_1.applicationGenerator)(tree, Object.assign(Object.assign({}, schema), { bundler: 'webpack', skipFormat: true }));
|
|
47
54
|
addMainFile(tree, options);
|
|
@@ -55,15 +62,20 @@ function applicationGenerator(tree, schema) {
|
|
|
55
62
|
});
|
|
56
63
|
});
|
|
57
64
|
}
|
|
58
|
-
exports.
|
|
65
|
+
exports.applicationGeneratorInternal = applicationGeneratorInternal;
|
|
59
66
|
exports.default = applicationGenerator;
|
|
60
67
|
exports.applicationSchematic = (0, devkit_1.convertNxGenerator)(applicationGenerator);
|
|
61
68
|
function normalizeOptions(host, options) {
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
70
|
+
const { projectName: appProjectName, projectRoot: appProjectRoot, projectNameAndRootFormat, } = yield (0, project_name_and_root_utils_1.determineProjectNameAndRootOptions)(host, {
|
|
71
|
+
name: options.name,
|
|
72
|
+
projectType: 'application',
|
|
73
|
+
directory: options.directory,
|
|
74
|
+
projectNameAndRootFormat: options.projectNameAndRootFormat,
|
|
75
|
+
callingGenerator: '@nx/express:application',
|
|
76
|
+
});
|
|
77
|
+
options.projectNameAndRootFormat = projectNameAndRootFormat;
|
|
78
|
+
return Object.assign(Object.assign({}, options), { appProjectName,
|
|
79
|
+
appProjectRoot });
|
|
80
|
+
});
|
|
69
81
|
}
|
|
@@ -1,11 +1,13 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { ProjectNameAndRootFormat } from '@nx/devkit/src/generators/project-name-and-root-utils';
|
|
2
2
|
import type { Linter } from '@nx/linter';
|
|
3
|
+
import type { UnitTestRunner } from '../../utils/test-runners';
|
|
3
4
|
|
|
4
5
|
export interface Schema {
|
|
5
6
|
name: string;
|
|
6
7
|
skipFormat: boolean;
|
|
7
8
|
skipPackageJson: boolean;
|
|
8
9
|
directory?: string;
|
|
10
|
+
projectNameAndRootFormat?: ProjectNameAndRootFormat;
|
|
9
11
|
unitTestRunner: UnitTestRunner;
|
|
10
12
|
tags?: string;
|
|
11
13
|
linter: Linter;
|
|
@@ -14,12 +14,17 @@
|
|
|
14
14
|
"index": 0
|
|
15
15
|
},
|
|
16
16
|
"x-prompt": "What name would you like to use for the node application?",
|
|
17
|
-
"pattern": "^[a-zA-Z]
|
|
17
|
+
"pattern": "^[a-zA-Z][^:]*$"
|
|
18
18
|
},
|
|
19
19
|
"directory": {
|
|
20
20
|
"description": "The directory of the new application.",
|
|
21
21
|
"type": "string"
|
|
22
22
|
},
|
|
23
|
+
"projectNameAndRootFormat": {
|
|
24
|
+
"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`).",
|
|
25
|
+
"type": "string",
|
|
26
|
+
"enum": ["as-provided", "derived"]
|
|
27
|
+
},
|
|
23
28
|
"skipFormat": {
|
|
24
29
|
"description": "Skip formatting files.",
|
|
25
30
|
"type": "boolean",
|