@nx/node 19.2.0-rc.1 → 19.2.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/package.json +6 -6
- package/src/generators/application/application.d.ts +1 -0
- package/src/generators/application/application.js +4 -3
- package/src/generators/setup-docker/schema.d.ts +1 -0
- package/src/generators/setup-docker/schema.json +4 -0
- package/src/generators/setup-docker/setup-docker.js +8 -32
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nx/node",
|
|
3
|
-
"version": "19.2.
|
|
3
|
+
"version": "19.2.1",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "The Node Plugin for Nx contains generators to manage Node applications within an Nx workspace.",
|
|
6
6
|
"repository": {
|
|
@@ -32,11 +32,11 @@
|
|
|
32
32
|
},
|
|
33
33
|
"dependencies": {
|
|
34
34
|
"tslib": "^2.3.0",
|
|
35
|
-
"@nx/devkit": "19.2.
|
|
36
|
-
"@nx/jest": "19.2.
|
|
37
|
-
"@nx/js": "19.2.
|
|
38
|
-
"@nx/eslint": "19.2.
|
|
39
|
-
"@nrwl/node": "19.2.
|
|
35
|
+
"@nx/devkit": "19.2.1",
|
|
36
|
+
"@nx/jest": "19.2.1",
|
|
37
|
+
"@nx/js": "19.2.1",
|
|
38
|
+
"@nx/eslint": "19.2.1",
|
|
39
|
+
"@nrwl/node": "19.2.1"
|
|
40
40
|
},
|
|
41
41
|
"publishConfig": {
|
|
42
42
|
"access": "public"
|
|
@@ -3,6 +3,7 @@ import { Schema } from './schema';
|
|
|
3
3
|
export interface NormalizedSchema extends Schema {
|
|
4
4
|
appProjectRoot: string;
|
|
5
5
|
parsedTags: string[];
|
|
6
|
+
outputPath: string;
|
|
6
7
|
}
|
|
7
8
|
export declare function addLintingToApplication(tree: Tree, options: NormalizedSchema): Promise<GeneratorCallback>;
|
|
8
9
|
export declare function applicationGenerator(tree: Tree, schema: Schema): Promise<GeneratorCallback>;
|
|
@@ -23,7 +23,7 @@ function getWebpackBuildConfig(project, options) {
|
|
|
23
23
|
options: {
|
|
24
24
|
target: 'node',
|
|
25
25
|
compiler: 'tsc',
|
|
26
|
-
outputPath:
|
|
26
|
+
outputPath: options.outputPath,
|
|
27
27
|
main: (0, devkit_1.joinPathFragments)(project.sourceRoot, 'main' + (options.js ? '.js' : '.ts')),
|
|
28
28
|
tsConfig: (0, devkit_1.joinPathFragments)(options.appProjectRoot, 'tsconfig.app.json'),
|
|
29
29
|
assets: [(0, devkit_1.joinPathFragments)(project.sourceRoot, 'assets')],
|
|
@@ -44,7 +44,7 @@ function getEsBuildConfig(project, options) {
|
|
|
44
44
|
defaultConfiguration: 'production',
|
|
45
45
|
options: {
|
|
46
46
|
platform: 'node',
|
|
47
|
-
outputPath:
|
|
47
|
+
outputPath: options.outputPath,
|
|
48
48
|
// Use CJS for Node apps for widest compatibility.
|
|
49
49
|
format: ['cjs'],
|
|
50
50
|
bundle: false,
|
|
@@ -120,7 +120,7 @@ function addAppFiles(tree, options) {
|
|
|
120
120
|
rootTsConfigPath: (0, js_1.getRelativePathToRootTsConfig)(tree, options.appProjectRoot),
|
|
121
121
|
webpackPluginOptions: (0, has_webpack_plugin_1.hasWebpackPlugin)(tree)
|
|
122
122
|
? {
|
|
123
|
-
outputPath:
|
|
123
|
+
outputPath: options.outputPath,
|
|
124
124
|
main: './src/main' + (options.js ? '.js' : '.ts'),
|
|
125
125
|
tsConfig: './tsconfig.app.json',
|
|
126
126
|
assets: ['./src/assets'],
|
|
@@ -407,6 +407,7 @@ async function normalizeOptions(host, options) {
|
|
|
407
407
|
unitTestRunner: options.unitTestRunner ?? 'jest',
|
|
408
408
|
rootProject: options.rootProject ?? false,
|
|
409
409
|
port: options.port ?? 3000,
|
|
410
|
+
outputPath: (0, devkit_1.joinPathFragments)('dist', options.rootProject ? options.name : appProjectRoot),
|
|
410
411
|
};
|
|
411
412
|
}
|
|
412
413
|
exports.default = applicationGenerator;
|
|
@@ -3,8 +3,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.setupDockerGenerator = exports.updateProjectConfig = void 0;
|
|
4
4
|
const devkit_1 = require("@nx/devkit");
|
|
5
5
|
const path_1 = require("path");
|
|
6
|
-
const utils_1 = require("nx/src/tasks-runner/utils");
|
|
7
|
-
const project_graph_1 = require("nx/src/project-graph/project-graph");
|
|
8
6
|
function normalizeOptions(tree, setupOptions) {
|
|
9
7
|
return {
|
|
10
8
|
...setupOptions,
|
|
@@ -14,37 +12,15 @@ function normalizeOptions(tree, setupOptions) {
|
|
|
14
12
|
};
|
|
15
13
|
}
|
|
16
14
|
function addDocker(tree, options) {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
!projectConfig.targets ||
|
|
21
|
-
!projectConfig.targets[options.buildTarget]) {
|
|
22
|
-
return;
|
|
23
|
-
}
|
|
24
|
-
// Returns an string like {workspaceRoot}/dist/apps/{projectName}
|
|
25
|
-
// Non crystalized projects would return {options.outputPath}
|
|
26
|
-
const tokenizedOutputPath = projectConfig.targets[`${options.buildTarget}`]?.outputs?.[0];
|
|
27
|
-
const maybeBuildOptions = projectConfig.targets[`${options.buildTarget}`]?.options;
|
|
28
|
-
if (tree.exists((0, devkit_1.joinPathFragments)(projectConfig.root, 'DockerFile'))) {
|
|
29
|
-
devkit_1.logger.info(`Skipping setup since a Dockerfile already exists inside ${projectConfig.root}`);
|
|
30
|
-
}
|
|
31
|
-
else if (!tokenizedOutputPath) {
|
|
32
|
-
devkit_1.logger.error(`Skipping setup since the output path for the build target ${options.buildTarget} is not defined.`);
|
|
33
|
-
}
|
|
34
|
-
else {
|
|
35
|
-
const outputPath = (0, utils_1.interpolate)(tokenizedOutputPath, {
|
|
36
|
-
projectName: projectConfig.name,
|
|
37
|
-
projectRoot: projectConfig.root,
|
|
38
|
-
workspaceRoot: '',
|
|
39
|
-
options: maybeBuildOptions || '',
|
|
40
|
-
});
|
|
41
|
-
(0, devkit_1.generateFiles)(tree, (0, path_1.join)(__dirname, './files'), projectConfig.root, {
|
|
42
|
-
tmpl: '',
|
|
43
|
-
app: projectConfig.sourceRoot,
|
|
44
|
-
buildLocation: outputPath,
|
|
45
|
-
project: options.project,
|
|
46
|
-
});
|
|
15
|
+
const projectConfig = (0, devkit_1.readProjectConfiguration)(tree, options.project);
|
|
16
|
+
if (!projectConfig) {
|
|
17
|
+
throw new Error(`Cannot find project configuration for ${options.project}`);
|
|
47
18
|
}
|
|
19
|
+
(0, devkit_1.generateFiles)(tree, (0, path_1.join)(__dirname, './files'), projectConfig.root, {
|
|
20
|
+
tmpl: '',
|
|
21
|
+
buildLocation: options.outputPath,
|
|
22
|
+
project: options.project,
|
|
23
|
+
});
|
|
48
24
|
}
|
|
49
25
|
function updateProjectConfig(tree, options) {
|
|
50
26
|
let projectConfig = (0, devkit_1.readProjectConfiguration)(tree, options.project);
|