@nx/node 21.4.0-beta.4 → 21.4.0-beta.5
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 +7 -7
- package/src/generators/application/application.d.ts.map +1 -1
- package/src/generators/application/application.js +2 -2
- package/src/generators/application/lib/add-dependencies.d.ts +4 -1
- package/src/generators/application/lib/add-dependencies.d.ts.map +1 -1
- package/src/generators/application/lib/add-dependencies.js +11 -15
- package/src/generators/application/lib/create-project.d.ts +1 -1
- package/src/generators/application/lib/create-project.d.ts.map +1 -1
- package/src/generators/application/lib/create-project.js +2 -1
- package/src/generators/setup-docker/files/Dockerfile__tmpl__ +10 -9
- package/src/generators/setup-docker/setup-docker.d.ts.map +1 -1
- package/src/generators/setup-docker/setup-docker.js +7 -1
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@nx/node",
|
3
|
-
"version": "21.4.0-beta.
|
3
|
+
"version": "21.4.0-beta.5",
|
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,16 +32,16 @@
|
|
32
32
|
},
|
33
33
|
"dependencies": {
|
34
34
|
"tslib": "^2.3.0",
|
35
|
-
"@nx/devkit": "21.4.0-beta.
|
36
|
-
"@nx/jest": "21.4.0-beta.
|
37
|
-
"@nx/js": "21.4.0-beta.
|
38
|
-
"@nx/eslint": "21.4.0-beta.
|
39
|
-
"@nx/docker": "21.4.0-beta.
|
35
|
+
"@nx/devkit": "21.4.0-beta.5",
|
36
|
+
"@nx/jest": "21.4.0-beta.5",
|
37
|
+
"@nx/js": "21.4.0-beta.5",
|
38
|
+
"@nx/eslint": "21.4.0-beta.5",
|
39
|
+
"@nx/docker": "21.4.0-beta.5",
|
40
40
|
"tcp-port-used": "^1.0.2",
|
41
41
|
"kill-port": "^1.6.1"
|
42
42
|
},
|
43
43
|
"devDependencies": {
|
44
|
-
"nx": "21.4.0-beta.
|
44
|
+
"nx": "21.4.0-beta.5"
|
45
45
|
},
|
46
46
|
"publishConfig": {
|
47
47
|
"access": "public"
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"application.d.ts","sourceRoot":"","sources":["../../../../../../packages/node/src/generators/application/application.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,iBAAiB,EAIjB,IAAI,EAIL,MAAM,YAAY,CAAC;AAapB,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAwClC,wBAAsB,oBAAoB,CAAC,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,8BAMpE;AAED,wBAAsB,4BAA4B,CAAC,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,
|
1
|
+
{"version":3,"file":"application.d.ts","sourceRoot":"","sources":["../../../../../../packages/node/src/generators/application/application.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,iBAAiB,EAIjB,IAAI,EAIL,MAAM,YAAY,CAAC;AAapB,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAwClC,wBAAsB,oBAAoB,CAAC,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,8BAMpE;AAED,wBAAsB,4BAA4B,CAAC,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,8BAmL5E;AAED,eAAe,oBAAoB,CAAC"}
|
@@ -86,7 +86,7 @@ async function applicationGeneratorInternal(tree, schema) {
|
|
86
86
|
skipFormat: true,
|
87
87
|
});
|
88
88
|
tasks.push(initTask);
|
89
|
-
const installTask = (0, lib_1.addProjectDependencies)(tree, options);
|
89
|
+
const { installTask, frameworkDependencies } = (0, lib_1.addProjectDependencies)(tree, options);
|
90
90
|
tasks.push(installTask);
|
91
91
|
if (options.bundler === 'webpack') {
|
92
92
|
const { webpackInitGenerator } = (0, devkit_1.ensurePackage)('@nx/webpack', versions_1.nxVersion);
|
@@ -104,7 +104,7 @@ async function applicationGeneratorInternal(tree, schema) {
|
|
104
104
|
}
|
105
105
|
}
|
106
106
|
(0, lib_1.addAppFiles)(tree, options);
|
107
|
-
(0, lib_1.addProject)(tree, options);
|
107
|
+
(0, lib_1.addProject)(tree, options, frameworkDependencies);
|
108
108
|
// If we are using the new TS solution
|
109
109
|
// We need to update the workspace file (package.json or pnpm-workspaces.yaml) to include the new project
|
110
110
|
if (options.isUsingTsSolutionConfig) {
|
@@ -1,4 +1,7 @@
|
|
1
1
|
import { GeneratorCallback, Tree } from '@nx/devkit';
|
2
2
|
import { NormalizedSchema } from './normalized-schema';
|
3
|
-
export declare function addProjectDependencies(tree: Tree, options: NormalizedSchema):
|
3
|
+
export declare function addProjectDependencies(tree: Tree, options: NormalizedSchema): {
|
4
|
+
installTask: GeneratorCallback;
|
5
|
+
frameworkDependencies: Record<string, string>;
|
6
|
+
};
|
4
7
|
//# sourceMappingURL=add-dependencies.d.ts.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"add-dependencies.d.ts","sourceRoot":"","sources":["../../../../../../../packages/node/src/generators/application/lib/add-dependencies.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,iBAAiB,EAEjB,IAAI,EAEL,MAAM,YAAY,CAAC;AAepB,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAEvD,wBAAgB,sBAAsB,CACpC,IAAI,EAAE,IAAI,EACV,OAAO,EAAE,gBAAgB,GACxB,iBAAiB,
|
1
|
+
{"version":3,"file":"add-dependencies.d.ts","sourceRoot":"","sources":["../../../../../../../packages/node/src/generators/application/lib/add-dependencies.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,iBAAiB,EAEjB,IAAI,EAEL,MAAM,YAAY,CAAC;AAepB,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAEvD,wBAAgB,sBAAsB,CACpC,IAAI,EAAE,IAAI,EACV,OAAO,EAAE,gBAAgB,GACxB;IACD,WAAW,EAAE,iBAAiB,CAAC;IAC/B,qBAAqB,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CAC/C,CAkDA"}
|
@@ -37,19 +37,15 @@ function addProjectDependencies(tree, options) {
|
|
37
37
|
},
|
38
38
|
fastify: {},
|
39
39
|
};
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
}
|
51
|
-
...frameworkDevDependencies[options.framework],
|
52
|
-
...bundlers[options.bundler],
|
53
|
-
'@types/node': versions_2.typesNodeVersion,
|
54
|
-
});
|
40
|
+
return {
|
41
|
+
installTask: (0, devkit_1.addDependenciesToPackageJson)(tree, {
|
42
|
+
...frameworkDependencies[options.framework],
|
43
|
+
tslib: versions_2.tslibVersion,
|
44
|
+
}, {
|
45
|
+
...frameworkDevDependencies[options.framework],
|
46
|
+
...bundlers[options.bundler],
|
47
|
+
'@types/node': versions_2.typesNodeVersion,
|
48
|
+
}),
|
49
|
+
frameworkDependencies: frameworkDependencies[options.framework],
|
50
|
+
};
|
55
51
|
}
|
@@ -1,4 +1,4 @@
|
|
1
1
|
import { Tree } from '@nx/devkit';
|
2
2
|
import { NormalizedSchema } from './normalized-schema';
|
3
|
-
export declare function addProject(tree: Tree, options: NormalizedSchema): void;
|
3
|
+
export declare function addProject(tree: Tree, options: NormalizedSchema, frameworkDependencies: Record<string, string>): void;
|
4
4
|
//# sourceMappingURL=create-project.d.ts.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"create-project.d.ts","sourceRoot":"","sources":["../../../../../../../packages/node/src/generators/application/lib/create-project.ts"],"names":[],"mappings":"AAAA,OAAO,EAIL,IAAI,EAEL,MAAM,YAAY,CAAC;AAIpB,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AASvD,wBAAgB,UAAU,
|
1
|
+
{"version":3,"file":"create-project.d.ts","sourceRoot":"","sources":["../../../../../../../packages/node/src/generators/application/lib/create-project.ts"],"names":[],"mappings":"AAAA,OAAO,EAIL,IAAI,EAEL,MAAM,YAAY,CAAC;AAIpB,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AASvD,wBAAgB,UAAU,CACxB,IAAI,EAAE,IAAI,EACV,OAAO,EAAE,gBAAgB,EACzB,qBAAqB,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,QA0D9C"}
|
@@ -5,7 +5,7 @@ const devkit_1 = require("@nx/devkit");
|
|
5
5
|
const target_defaults_utils_1 = require("@nx/devkit/src/generators/target-defaults-utils");
|
6
6
|
const has_webpack_plugin_1 = require("../../../utils/has-webpack-plugin");
|
7
7
|
const create_targets_1 = require("./create-targets");
|
8
|
-
function addProject(tree, options) {
|
8
|
+
function addProject(tree, options, frameworkDependencies) {
|
9
9
|
const project = {
|
10
10
|
root: options.appProjectRoot,
|
11
11
|
sourceRoot: (0, devkit_1.joinPathFragments)(options.appProjectRoot, 'src'),
|
@@ -37,6 +37,7 @@ function addProject(tree, options) {
|
|
37
37
|
name: options.importPath,
|
38
38
|
version: '0.0.1',
|
39
39
|
private: true,
|
40
|
+
dependencies: { ...frameworkDependencies },
|
40
41
|
};
|
41
42
|
if (!options.useProjectJson) {
|
42
43
|
packageJson.nx = {
|
@@ -10,18 +10,19 @@ FROM docker.io/node:lts-alpine
|
|
10
10
|
|
11
11
|
ENV HOST=0.0.0.0
|
12
12
|
ENV PORT=3000
|
13
|
+
<% if(packageManager === "pnpm" || packageManager === 'yarn') { %>
|
14
|
+
RUN corepack enable
|
15
|
+
<% } %>
|
13
16
|
|
14
17
|
WORKDIR /app
|
15
18
|
|
16
|
-
|
17
|
-
adduser --system -G <%= sanitizedProjectName %> <%= sanitizedProjectName %>
|
18
|
-
|
19
|
-
COPY <%= buildLocation %> <%= sanitizedProjectName %>/
|
20
|
-
<% if (skipDockerPlugin) { %>COPY <%= projectPath %>/package.json <%= sanitizedProjectName %>/<% } else { %>COPY package.json <%= sanitizedProjectName %>/<% } %>
|
21
|
-
RUN chown -R <%= sanitizedProjectName %>:<%= sanitizedProjectName %> .
|
19
|
+
COPY <%= buildLocation %> .
|
22
20
|
|
23
21
|
# You can remove this install step if you build with `--bundle` option.
|
24
22
|
# The bundled output will include external dependencies.
|
25
|
-
|
26
|
-
|
27
|
-
|
23
|
+
<% if(packageManager === 'npm') { %>
|
24
|
+
RUN npm --omit=dev -f install
|
25
|
+
<% } else { %>
|
26
|
+
RUN <%= packageManager %> install
|
27
|
+
<% } %>
|
28
|
+
CMD [ "node", "main.js" ]
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"setup-docker.d.ts","sourceRoot":"","sources":["../../../../../../packages/node/src/generators/setup-docker/setup-docker.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,iBAAiB,EAIjB,IAAI,
|
1
|
+
{"version":3,"file":"setup-docker.d.ts","sourceRoot":"","sources":["../../../../../../packages/node/src/generators/setup-docker/setup-docker.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,iBAAiB,EAIjB,IAAI,EAML,MAAM,YAAY,CAAC;AAEpB,OAAO,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAC;AAsF9C,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE,kBAAkB,QAqB1E;AAED,wBAAsB,oBAAoB,CACxC,IAAI,EAAE,IAAI,EACV,YAAY,EAAE,kBAAkB,8BAcjC;AAED,eAAe,oBAAoB,CAAC"}
|
@@ -5,6 +5,7 @@ exports.setupDockerGenerator = setupDockerGenerator;
|
|
5
5
|
const devkit_1 = require("@nx/devkit");
|
6
6
|
const generators_1 = require("@nx/docker/generators");
|
7
7
|
const path_1 = require("path");
|
8
|
+
const fs_1 = require("fs");
|
8
9
|
function normalizeOptions(tree, setupOptions) {
|
9
10
|
return {
|
10
11
|
...setupOptions,
|
@@ -41,7 +42,8 @@ async function addDocker(tree, options) {
|
|
41
42
|
let buildLocation;
|
42
43
|
if (options.skipDockerPlugin) {
|
43
44
|
// Legacy mode: use workspace-relative paths
|
44
|
-
|
45
|
+
// docker target is set to run at project root, so ensure offset to workspace root
|
46
|
+
buildLocation = (0, devkit_1.joinPathFragments)((0, devkit_1.offsetFromRoot)(projectConfig.root), finalOutputPath);
|
45
47
|
}
|
46
48
|
else {
|
47
49
|
// New mode: use project-relative paths
|
@@ -53,6 +55,9 @@ async function addDocker(tree, options) {
|
|
53
55
|
? finalOutputPath.substring(projectConfig.root.length)
|
54
56
|
: 'dist';
|
55
57
|
}
|
58
|
+
const packageManager = (0, fs_1.existsSync)(projectConfig.root)
|
59
|
+
? (0, devkit_1.detectPackageManager)(projectConfig.root)
|
60
|
+
: (0, devkit_1.detectPackageManager)(devkit_1.workspaceRoot);
|
56
61
|
(0, devkit_1.generateFiles)(tree, (0, path_1.join)(__dirname, './files'), projectConfig.root, {
|
57
62
|
tmpl: '',
|
58
63
|
buildLocation,
|
@@ -60,6 +65,7 @@ async function addDocker(tree, options) {
|
|
60
65
|
projectPath: projectConfig.root,
|
61
66
|
sanitizedProjectName,
|
62
67
|
skipDockerPlugin: options.skipDockerPlugin,
|
68
|
+
packageManager,
|
63
69
|
});
|
64
70
|
return installTask;
|
65
71
|
}
|