@nx/node 0.0.0-pr-32119-240ff46 → 0.0.0-pr-32120-8333cfc

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nx/node",
3
- "version": "0.0.0-pr-32119-240ff46",
3
+ "version": "0.0.0-pr-32120-8333cfc",
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,15 +32,16 @@
32
32
  },
33
33
  "dependencies": {
34
34
  "tslib": "^2.3.0",
35
- "@nx/devkit": "0.0.0-pr-32119-240ff46",
36
- "@nx/jest": "0.0.0-pr-32119-240ff46",
37
- "@nx/js": "0.0.0-pr-32119-240ff46",
38
- "@nx/eslint": "0.0.0-pr-32119-240ff46",
35
+ "@nx/devkit": "0.0.0-pr-32120-8333cfc",
36
+ "@nx/jest": "0.0.0-pr-32120-8333cfc",
37
+ "@nx/js": "0.0.0-pr-32120-8333cfc",
38
+ "@nx/eslint": "0.0.0-pr-32120-8333cfc",
39
+ "@nx/docker": "0.0.0-pr-32120-8333cfc",
39
40
  "tcp-port-used": "^1.0.2",
40
41
  "kill-port": "^1.6.1"
41
42
  },
42
43
  "devDependencies": {
43
- "nx": "0.0.0-pr-32119-240ff46"
44
+ "nx": "0.0.0-pr-32120-8333cfc"
44
45
  },
45
46
  "publishConfig": {
46
47
  "access": "public"
@@ -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,CAAC,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE,gBAAgB,QAwD/D"}
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;AAQvD,wBAAgB,UAAU,CAAC,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE,gBAAgB,QAoD/D"}
@@ -28,10 +28,6 @@ function addProject(tree, options) {
28
28
  project.targets.build = (0, create_targets_1.getNestWebpackBuildConfig)();
29
29
  }
30
30
  }
31
- project.targets = {
32
- ...project.targets,
33
- ...(0, create_targets_1.getPruneTargets)('build'),
34
- };
35
31
  project.targets.serve = (0, create_targets_1.getServeConfig)(options);
36
32
  const packageJson = {
37
33
  name: options.importPath,
@@ -4,9 +4,4 @@ export declare function getWebpackBuildConfig(tree: Tree, project: ProjectConfig
4
4
  export declare function getEsBuildConfig(tree: Tree, project: ProjectConfiguration, options: NormalizedSchema): TargetConfiguration;
5
5
  export declare function getServeConfig(options: NormalizedSchema): TargetConfiguration;
6
6
  export declare function getNestWebpackBuildConfig(): TargetConfiguration;
7
- export declare function getPruneTargets(buildTarget: string): {
8
- prune: TargetConfiguration;
9
- 'prune-lockfile': TargetConfiguration;
10
- 'copy-workspace-modules': TargetConfiguration;
11
- };
12
7
  //# sourceMappingURL=create-targets.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"create-targets.d.ts","sourceRoot":"","sources":["../../../../../../../packages/node/src/generators/application/lib/create-targets.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,oBAAoB,EACpB,IAAI,EACJ,mBAAmB,EACpB,MAAM,YAAY,CAAC;AAEpB,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAEvD,wBAAgB,qBAAqB,CACnC,IAAI,EAAE,IAAI,EACV,OAAO,EAAE,oBAAoB,EAC7B,OAAO,EAAE,gBAAgB,GACxB,mBAAmB,CA+BrB;AAED,wBAAgB,gBAAgB,CAC9B,IAAI,EAAE,IAAI,EACV,OAAO,EAAE,oBAAoB,EAC7B,OAAO,EAAE,gBAAgB,GACxB,mBAAmB,CAqCrB;AAED,wBAAgB,cAAc,CAAC,OAAO,EAAE,gBAAgB,GAAG,mBAAmB,CAuB7E;AAED,wBAAgB,yBAAyB,IAAI,mBAAmB,CAa/D;AAED,wBAAgB,eAAe,CAAC,WAAW,EAAE,MAAM,GAAG;IACpD,KAAK,EAAE,mBAAmB,CAAC;IAC3B,gBAAgB,EAAE,mBAAmB,CAAC;IACtC,wBAAwB,EAAE,mBAAmB,CAAC;CAC/C,CAsBA"}
1
+ {"version":3,"file":"create-targets.d.ts","sourceRoot":"","sources":["../../../../../../../packages/node/src/generators/application/lib/create-targets.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,oBAAoB,EACpB,IAAI,EACJ,mBAAmB,EACpB,MAAM,YAAY,CAAC;AAEpB,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAEvD,wBAAgB,qBAAqB,CACnC,IAAI,EAAE,IAAI,EACV,OAAO,EAAE,oBAAoB,EAC7B,OAAO,EAAE,gBAAgB,GACxB,mBAAmB,CA+BrB;AAED,wBAAgB,gBAAgB,CAC9B,IAAI,EAAE,IAAI,EACV,OAAO,EAAE,oBAAoB,EAC7B,OAAO,EAAE,gBAAgB,GACxB,mBAAmB,CAqCrB;AAED,wBAAgB,cAAc,CAAC,OAAO,EAAE,gBAAgB,GAAG,mBAAmB,CAuB7E;AAED,wBAAgB,yBAAyB,IAAI,mBAAmB,CAa/D"}
@@ -4,7 +4,6 @@ exports.getWebpackBuildConfig = getWebpackBuildConfig;
4
4
  exports.getEsBuildConfig = getEsBuildConfig;
5
5
  exports.getServeConfig = getServeConfig;
6
6
  exports.getNestWebpackBuildConfig = getNestWebpackBuildConfig;
7
- exports.getPruneTargets = getPruneTargets;
8
7
  const devkit_1 = require("@nx/devkit");
9
8
  const ts_solution_setup_1 = require("@nx/js/src/utils/typescript/ts-solution-setup");
10
9
  function getWebpackBuildConfig(tree, project, options) {
@@ -106,26 +105,3 @@ function getNestWebpackBuildConfig() {
106
105
  },
107
106
  };
108
107
  }
109
- function getPruneTargets(buildTarget) {
110
- return {
111
- 'prune-lockfile': {
112
- cache: true,
113
- executor: '@nx/js:prune-lockfile',
114
- options: {
115
- buildTarget,
116
- },
117
- },
118
- 'copy-workspace-modules': {
119
- cache: true,
120
- executor: '@nx/js:copy-workspace-modules',
121
- options: {
122
- buildTarget,
123
- },
124
- },
125
- prune: {
126
- cache: true,
127
- dependsOn: ['prune-lockfile', 'copy-workspace-modules'],
128
- executor: 'nx:noop',
129
- },
130
- };
131
- }
@@ -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,EAKjB,IAAI,EAEL,MAAM,YAAY,CAAC;AAEpB,OAAO,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAC;AAmD9C,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE,kBAAkB,QAe1E;AAED,wBAAsB,oBAAoB,CACxC,IAAI,EAAE,IAAI,EACV,YAAY,EAAE,kBAAkB,8BAajC;AAED,eAAe,oBAAoB,CAAC"}
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,EAKjB,IAAI,EAEL,MAAM,YAAY,CAAC;AAEpB,OAAO,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAC;AAsD9C,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE,kBAAkB,QAQ1E;AAED,wBAAsB,oBAAoB,CACxC,IAAI,EAAE,IAAI,EACV,YAAY,EAAE,kBAAkB,8BAcjC;AAED,eAAe,oBAAoB,CAAC"}
@@ -3,12 +3,13 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.updateProjectConfig = updateProjectConfig;
4
4
  exports.setupDockerGenerator = setupDockerGenerator;
5
5
  const devkit_1 = require("@nx/devkit");
6
+ const docker_1 = require("@nx/docker");
6
7
  const path_1 = require("path");
7
8
  function normalizeOptions(tree, setupOptions) {
8
9
  return {
9
10
  ...setupOptions,
10
11
  project: setupOptions.project ?? (0, devkit_1.readNxJson)(tree).defaultProject,
11
- targetName: setupOptions.targetName ?? 'docker-build',
12
+ targetName: setupOptions.targetName ?? 'docker:build',
12
13
  buildTarget: setupOptions.buildTarget ?? 'build',
13
14
  };
14
15
  }
@@ -20,7 +21,8 @@ function sanitizeProjectName(projectName) {
20
21
  .replace(/-+/g, '-')
21
22
  .replace(/^-|-$/g, '');
22
23
  }
23
- function addDocker(tree, options) {
24
+ async function addDocker(tree, options) {
25
+ const installTask = await (0, docker_1.initGenerator)(tree, { skipFormat: true });
24
26
  const projectConfig = (0, devkit_1.readProjectConfiguration)(tree, options.project);
25
27
  const outputPath = projectConfig.targets[options.buildTarget]?.options['outputPath'];
26
28
  if (!projectConfig) {
@@ -37,22 +39,20 @@ function addDocker(tree, options) {
37
39
  projectPath: projectConfig.root,
38
40
  sanitizedProjectName,
39
41
  });
42
+ return installTask;
40
43
  }
41
44
  function updateProjectConfig(tree, options) {
42
45
  let projectConfig = (0, devkit_1.readProjectConfiguration)(tree, options.project);
43
- // Use sanitized project name for Docker image tag
44
- const sanitizedProjectName = sanitizeProjectName(options.project);
45
46
  projectConfig.targets[`${options.targetName}`] = {
46
- dependsOn: [`${options.buildTarget}`],
47
- command: `docker build -f ${(0, devkit_1.joinPathFragments)(projectConfig.root, 'Dockerfile')} . -t ${sanitizedProjectName}`,
47
+ dependsOn: [`${options.buildTarget}`, 'prune'],
48
48
  };
49
49
  (0, devkit_1.updateProjectConfiguration)(tree, options.project, projectConfig);
50
50
  }
51
51
  async function setupDockerGenerator(tree, setupOptions) {
52
52
  const tasks = [];
53
53
  const options = normalizeOptions(tree, setupOptions);
54
- // Should check if the node project exists
55
- addDocker(tree, options);
54
+ const installTask = await addDocker(tree, options);
55
+ tasks.push(installTask);
56
56
  updateProjectConfig(tree, options);
57
57
  if (!options.skipFormat) {
58
58
  await (0, devkit_1.formatFiles)(tree);