@nx/node 19.2.2 → 19.3.0-canary.20240606-bccb2c5
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 +0 -1
- package/src/generators/application/application.js +3 -4
- package/src/generators/setup-docker/schema.d.ts +0 -1
- package/src/generators/setup-docker/schema.json +0 -4
- package/src/generators/setup-docker/setup-docker.js +32 -8
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nx/node",
|
|
3
|
-
"version": "19.
|
|
3
|
+
"version": "19.3.0-canary.20240606-bccb2c5",
|
|
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.
|
|
36
|
-
"@nx/jest": "19.
|
|
37
|
-
"@nx/js": "19.
|
|
38
|
-
"@nx/eslint": "19.
|
|
39
|
-
"@nrwl/node": "19.
|
|
35
|
+
"@nx/devkit": "19.3.0-canary.20240606-bccb2c5",
|
|
36
|
+
"@nx/jest": "19.3.0-canary.20240606-bccb2c5",
|
|
37
|
+
"@nx/js": "19.3.0-canary.20240606-bccb2c5",
|
|
38
|
+
"@nx/eslint": "19.3.0-canary.20240606-bccb2c5",
|
|
39
|
+
"@nrwl/node": "19.3.0-canary.20240606-bccb2c5"
|
|
40
40
|
},
|
|
41
41
|
"publishConfig": {
|
|
42
42
|
"access": "public"
|
|
@@ -3,7 +3,6 @@ import { Schema } from './schema';
|
|
|
3
3
|
export interface NormalizedSchema extends Schema {
|
|
4
4
|
appProjectRoot: string;
|
|
5
5
|
parsedTags: string[];
|
|
6
|
-
outputPath: string;
|
|
7
6
|
}
|
|
8
7
|
export declare function addLintingToApplication(tree: Tree, options: NormalizedSchema): Promise<GeneratorCallback>;
|
|
9
8
|
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: options.
|
|
26
|
+
outputPath: (0, devkit_1.joinPathFragments)('dist', options.rootProject ? options.name : options.appProjectRoot),
|
|
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: options.
|
|
47
|
+
outputPath: (0, devkit_1.joinPathFragments)('dist', options.rootProject ? options.name : options.appProjectRoot),
|
|
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: options.
|
|
123
|
+
outputPath: (0, devkit_1.joinPathFragments)('dist', options.rootProject ? options.name : options.appProjectRoot),
|
|
124
124
|
main: './src/main' + (options.js ? '.js' : '.ts'),
|
|
125
125
|
tsConfig: './tsconfig.app.json',
|
|
126
126
|
assets: ['./src/assets'],
|
|
@@ -407,7 +407,6 @@ 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),
|
|
411
410
|
};
|
|
412
411
|
}
|
|
413
412
|
exports.default = applicationGenerator;
|
|
@@ -3,6 +3,8 @@ 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");
|
|
6
8
|
function normalizeOptions(tree, setupOptions) {
|
|
7
9
|
return {
|
|
8
10
|
...setupOptions,
|
|
@@ -12,15 +14,37 @@ function normalizeOptions(tree, setupOptions) {
|
|
|
12
14
|
};
|
|
13
15
|
}
|
|
14
16
|
function addDocker(tree, options) {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
17
|
+
// Inferred targets are only available in the project graph
|
|
18
|
+
const projectConfig = (0, project_graph_1.readCachedProjectConfiguration)(options.project);
|
|
19
|
+
if (!projectConfig ||
|
|
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
|
+
});
|
|
18
47
|
}
|
|
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
|
-
});
|
|
24
48
|
}
|
|
25
49
|
function updateProjectConfig(tree, options) {
|
|
26
50
|
let projectConfig = (0, devkit_1.readProjectConfiguration)(tree, options.project);
|