@nx/node 0.0.0-pr-30715-a5f5e3b → 0.0.0-pr-31222-862e973

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.
Files changed (46) hide show
  1. package/LICENSE +1 -1
  2. package/README.md +1 -1
  3. package/migrations.json +38 -24
  4. package/package.json +8 -9
  5. package/src/generators/application/application.d.ts +1 -3
  6. package/src/generators/application/application.js +27 -102
  7. package/src/generators/application/files/common/tsconfig.app.json +1 -0
  8. package/src/generators/application/files/common/webpack.config.js__tmpl__ +4 -4
  9. package/src/generators/application/schema.d.ts +5 -5
  10. package/src/generators/application/schema.json +30 -27
  11. package/src/generators/e2e-project/e2e-project.js +32 -112
  12. package/src/generators/e2e-project/files/cli/jest.config.ts__tmpl__ +4 -17
  13. package/src/generators/e2e-project/files/cli/tsconfig.spec.json__tmpl__ +12 -0
  14. package/src/generators/e2e-project/files/server/common/jest.config.ts__tmpl__ +4 -17
  15. package/src/generators/e2e-project/files/server/common/src/support/global-setup.ts__tmpl__ +0 -6
  16. package/src/generators/e2e-project/files/server/common/src/support/global-teardown.ts__tmpl__ +0 -3
  17. package/src/generators/e2e-project/files/server/common/src/support/test-setup.ts__tmpl__ +1 -0
  18. package/src/generators/e2e-project/files/server/common/tsconfig.json__tmpl__ +13 -0
  19. package/src/generators/e2e-project/schema.d.ts +3 -1
  20. package/src/generators/e2e-project/schema.json +5 -4
  21. package/src/generators/library/files/lib/package.json__tmpl__ +4 -0
  22. package/src/generators/library/library.d.ts +0 -1
  23. package/src/generators/library/library.js +43 -78
  24. package/src/generators/library/schema.d.ts +5 -3
  25. package/src/generators/library/schema.json +24 -21
  26. package/src/migrations/update-16-0-0/update-webpack-executor.d.ts +2 -0
  27. package/src/migrations/update-16-0-0/update-webpack-executor.js +17 -0
  28. package/src/migrations/update-16-0-0-add-nx-packages/update-16-0-0-add-nx-packages.d.ts +2 -0
  29. package/src/migrations/update-16-0-0-add-nx-packages/update-16-0-0-add-nx-packages.js +9 -0
  30. package/src/migrations/update-16-3-1/update-webpack-executor.d.ts +2 -0
  31. package/src/migrations/update-16-3-1/update-webpack-executor.js +17 -0
  32. package/src/migrations/update-16-4-0/replace-node-executor.d.ts +2 -0
  33. package/src/migrations/update-16-4-0/replace-node-executor.js +14 -0
  34. package/src/utils/versions.d.ts +6 -6
  35. package/src/utils/versions.js +6 -6
  36. package/src/generators/e2e-project/files/ts-solution/tsconfig.json__tmpl__ +0 -14
  37. package/src/generators/library/files/ts-solution/tsconfig.lib.json +0 -15
  38. package/src/utils/kill-port.d.ts +0 -7
  39. package/src/utils/kill-port.js +0 -36
  40. package/src/utils/wait-for-port-open.d.ts +0 -24
  41. package/src/utils/wait-for-port-open.js +0 -47
  42. package/utils.d.ts +0 -2
  43. package/utils.js +0 -7
  44. /package/src/generators/e2e-project/files/{non-ts-solution → cli}/tsconfig.json__tmpl__ +0 -0
  45. /package/src/generators/e2e-project/files/{non-ts-solution → server/common}/tsconfig.spec.json__tmpl__ +0 -0
  46. /package/src/generators/library/files/{non-ts-solution → lib}/tsconfig.lib.json +0 -0
package/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  (The MIT License)
2
2
 
3
- Copyright (c) 2017-2025 Narwhal Technologies Inc.
3
+ Copyright (c) 2017-2024 Narwhal Technologies Inc.
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining
6
6
  a copy of this software and associated documentation files (the
package/README.md CHANGED
@@ -9,7 +9,7 @@
9
9
 
10
10
  [![CircleCI](https://circleci.com/gh/nrwl/nx.svg?style=svg)](https://circleci.com/gh/nrwl/nx)
11
11
  [![License](https://img.shields.io/npm/l/@nx/workspace.svg?style=flat-square)]()
12
- [![NPM Version](https://badge.fury.io/js/nx.svg)](https://www.npmjs.com/package/nx)
12
+ [![NPM Version](https://badge.fury.io/js/%40nrwl%2Fworkspace.svg)](https://www.npmjs.com/@nx/workspace)
13
13
  [![Semantic Release](https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg?style=flat-square)]()
14
14
  [![Commitizen friendly](https://img.shields.io/badge/commitizen-friendly-brightgreen.svg)](http://commitizen.github.io/cz-cli/)
15
15
  [![Join the chat at https://gitter.im/nrwl-nx/community](https://badges.gitter.im/nrwl-nx/community.svg)](https://gitter.im/nrwl-nx/community?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
package/migrations.json CHANGED
@@ -1,31 +1,45 @@
1
1
  {
2
- "generators": {},
2
+ "generators": {
3
+ "update-16-0-0-add-nx-packages": {
4
+ "cli": "nx",
5
+ "version": "16.0.0-beta.1",
6
+ "description": "Replace @nrwl/node with @nx/node",
7
+ "implementation": "./src/migrations/update-16-0-0-add-nx-packages/update-16-0-0-add-nx-packages"
8
+ },
9
+ "update-16-0-0-update-executor": {
10
+ "cli": "nx",
11
+ "version": "16.0.0-beta.5",
12
+ "description": "Replace @nrwl/node:webpack with @nx/node:webpack",
13
+ "implementation": "./src/migrations/update-16-0-0/update-webpack-executor"
14
+ },
15
+ "update-16-3-1-update-executor": {
16
+ "cli": "nx",
17
+ "version": "16.3.1-beta.0",
18
+ "description": "Replace @nrwl/node:webpack and @nx/node:webpack with @nx/webpack:webpack for all project targets",
19
+ "implementation": "./src/migrations/update-16-3-1/update-webpack-executor"
20
+ },
21
+ "update-16-4-0-replace-node-executor": {
22
+ "cli": "nx",
23
+ "version": "16.4.0-beta.8",
24
+ "description": "Replace @nx/node:node with @nx/js:node for all project targets",
25
+ "implementation": "./src/migrations/update-16-4-0/replace-node-executor"
26
+ }
27
+ },
3
28
  "packageJsonUpdates": {
4
- "20.4.0": {
5
- "version": "20.4.0-beta.3",
29
+ "17.3.0": {
30
+ "version": "17.3.0-beta.3",
6
31
  "packages": {
7
- "fastify": {
8
- "version": "~5.2.1",
9
- "alwaysAddToPackageJson": false
10
- },
11
- "fastify-plugin": {
12
- "version": "~5.0.1",
13
- "alwaysAddToPackageJson": false
14
- },
15
- "@fastify/autoload": {
16
- "version": "~6.0.3",
17
- "alwaysAddToPackageJson": false
18
- },
19
- "@fastify/sensible": {
20
- "version": "~6.0.2",
32
+ "@types/node": {
33
+ "version": "18.16.9",
21
34
  "alwaysAddToPackageJson": false
22
- },
23
- "express": {
24
- "version": "^4.21.2",
25
- "alwaysAddToPackageJson": false
26
- },
27
- "@types/express": {
28
- "version": "^4.17.21",
35
+ }
36
+ }
37
+ },
38
+ "17.3.1": {
39
+ "version": "17.3.1-beta.0",
40
+ "packages": {
41
+ "axios": {
42
+ "version": "^1.6.0",
29
43
  "alwaysAddToPackageJson": false
30
44
  }
31
45
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nx/node",
3
- "version": "0.0.0-pr-30715-a5f5e3b",
3
+ "version": "0.0.0-pr-31222-862e973",
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,15 @@
32
32
  },
33
33
  "dependencies": {
34
34
  "tslib": "^2.3.0",
35
- "@nx/devkit": "0.0.0-pr-30715-a5f5e3b",
36
- "@nx/jest": "0.0.0-pr-30715-a5f5e3b",
37
- "@nx/js": "0.0.0-pr-30715-a5f5e3b",
38
- "@nx/eslint": "0.0.0-pr-30715-a5f5e3b",
39
- "tcp-port-used": "^1.0.2",
40
- "kill-port": "^1.6.1"
35
+ "@nx/devkit": "0.0.0-pr-31222-862e973",
36
+ "@nx/jest": "0.0.0-pr-31222-862e973",
37
+ "@nx/js": "0.0.0-pr-31222-862e973",
38
+ "@nx/eslint": "0.0.0-pr-31222-862e973",
39
+ "@nrwl/node": "0.0.0-pr-31222-862e973"
41
40
  },
42
41
  "publishConfig": {
43
42
  "access": "public"
44
43
  },
45
- "types": "./index.d.ts",
46
- "type": "commonjs"
44
+ "type": "commonjs",
45
+ "types": "./index.d.ts"
47
46
  }
@@ -1,11 +1,9 @@
1
1
  import { GeneratorCallback, Tree } from '@nx/devkit';
2
2
  import { Schema } from './schema';
3
- export interface NormalizedSchema extends Omit<Schema, 'useTsSolution'> {
3
+ export interface NormalizedSchema extends Schema {
4
4
  appProjectRoot: string;
5
5
  parsedTags: string[];
6
6
  outputPath: string;
7
- importPath: string;
8
- isUsingTsSolutionConfig: boolean;
9
7
  }
10
8
  export declare function addLintingToApplication(tree: Tree, options: NormalizedSchema): Promise<GeneratorCallback>;
11
9
  export declare function applicationGenerator(tree: Tree, schema: Schema): Promise<GeneratorCallback>;
@@ -17,8 +17,6 @@ const setup_docker_1 = require("../setup-docker/setup-docker");
17
17
  const has_webpack_plugin_1 = require("../../utils/has-webpack-plugin");
18
18
  const target_defaults_utils_1 = require("@nx/devkit/src/generators/target-defaults-utils");
19
19
  const log_show_project_command_1 = require("@nx/devkit/src/utils/log-show-project-command");
20
- const ts_solution_setup_1 = require("@nx/js/src/utils/typescript/ts-solution-setup");
21
- const sort_fields_1 = require("@nx/js/src/utils/package-json/sort-fields");
22
20
  function getWebpackBuildConfig(project, options) {
23
21
  return {
24
22
  executor: `@nx/webpack:webpack`,
@@ -32,7 +30,7 @@ function getWebpackBuildConfig(project, options) {
32
30
  tsConfig: (0, devkit_1.joinPathFragments)(options.appProjectRoot, 'tsconfig.app.json'),
33
31
  assets: [(0, devkit_1.joinPathFragments)(project.sourceRoot, 'assets')],
34
32
  webpackConfig: (0, devkit_1.joinPathFragments)(options.appProjectRoot, 'webpack.config.js'),
35
- generatePackageJson: options.isUsingTsSolutionConfig ? undefined : true,
33
+ generatePackageJson: true,
36
34
  },
37
35
  configurations: {
38
36
  development: {},
@@ -56,7 +54,7 @@ function getEsBuildConfig(project, options) {
56
54
  main: (0, devkit_1.joinPathFragments)(project.sourceRoot, 'main' + (options.js ? '.js' : '.ts')),
57
55
  tsConfig: (0, devkit_1.joinPathFragments)(options.appProjectRoot, 'tsconfig.app.json'),
58
56
  assets: [(0, devkit_1.joinPathFragments)(project.sourceRoot, 'assets')],
59
- generatePackageJson: options.isUsingTsSolutionConfig ? undefined : true,
57
+ generatePackageJson: true,
60
58
  esbuildOptions: {
61
59
  sourcemap: true,
62
60
  // Generate CJS files as .js so imports can be './foo' rather than './foo.cjs'.
@@ -78,7 +76,6 @@ function getEsBuildConfig(project, options) {
78
76
  }
79
77
  function getServeConfig(options) {
80
78
  return {
81
- continuous: true,
82
79
  executor: '@nx/js:node',
83
80
  defaultConfiguration: 'development',
84
81
  // Run build, which includes dependency on "^build" by default, so the first run
@@ -100,20 +97,6 @@ function getServeConfig(options) {
100
97
  },
101
98
  };
102
99
  }
103
- function getNestWebpackBuildConfig() {
104
- return {
105
- executor: 'nx:run-commands',
106
- options: {
107
- command: 'webpack-cli build',
108
- args: ['node-env=production'],
109
- },
110
- configurations: {
111
- development: {
112
- args: ['node-env=development'],
113
- },
114
- },
115
- };
116
- }
117
100
  function addProject(tree, options) {
118
101
  const project = {
119
102
  root: options.appProjectRoot,
@@ -131,33 +114,12 @@ function addProject(tree, options) {
131
114
  (0, target_defaults_utils_1.addBuildTargetDefaults)(tree, `@nx/webpack:webpack`);
132
115
  project.targets.build = getWebpackBuildConfig(project, options);
133
116
  }
134
- else if (options.isNest) {
135
- // If we are using Nest that has the webpack plugin we need to override the
136
- // build target so that node-env can be set to production or development so the serve target can be run in development mode
137
- project.targets.build = getNestWebpackBuildConfig();
138
- }
139
117
  }
140
118
  project.targets.serve = getServeConfig(options);
141
- const packageJson = {
142
- name: options.importPath,
143
- version: '0.0.1',
144
- private: true,
145
- };
146
- if (!options.useProjectJson) {
147
- packageJson.nx = {
148
- name: options.name !== options.importPath ? options.name : undefined,
149
- targets: project.targets,
150
- tags: project.tags?.length ? project.tags : undefined,
151
- };
152
- }
153
- else {
154
- (0, devkit_1.addProjectConfiguration)(tree, options.name, project, options.standaloneConfig);
155
- }
156
- if (!options.useProjectJson || options.isUsingTsSolutionConfig) {
157
- (0, devkit_1.writeJson)(tree, (0, devkit_1.joinPathFragments)(options.appProjectRoot, 'package.json'), packageJson);
158
- }
119
+ (0, devkit_1.addProjectConfiguration)(tree, options.name, project, options.standaloneConfig);
159
120
  }
160
121
  function addAppFiles(tree, options) {
122
+ const sourceRoot = (0, devkit_1.joinPathFragments)(options.appProjectRoot, 'src');
161
123
  (0, devkit_1.generateFiles)(tree, (0, path_1.join)(__dirname, './files/common'), options.appProjectRoot, {
162
124
  ...options,
163
125
  tmpl: '',
@@ -167,9 +129,7 @@ function addAppFiles(tree, options) {
167
129
  rootTsConfigPath: (0, js_1.getRelativePathToRootTsConfig)(tree, options.appProjectRoot),
168
130
  webpackPluginOptions: (0, has_webpack_plugin_1.hasWebpackPlugin)(tree)
169
131
  ? {
170
- outputPath: options.isUsingTsSolutionConfig
171
- ? 'dist'
172
- : (0, devkit_1.joinPathFragments)((0, devkit_1.offsetFromRoot)(options.appProjectRoot), 'dist', options.rootProject ? options.name : options.appProjectRoot),
132
+ outputPath: options.outputPath,
173
133
  main: './src/main' + (options.js ? '.js' : '.ts'),
174
134
  tsConfig: './tsconfig.app.json',
175
135
  assets: ['./src/assets'],
@@ -192,19 +152,16 @@ function addAppFiles(tree, options) {
192
152
  if (options.js) {
193
153
  (0, devkit_1.toJS)(tree);
194
154
  }
155
+ if (options.pascalCaseFiles) {
156
+ devkit_1.logger.warn('NOTE: --pascalCaseFiles is a noop');
157
+ }
195
158
  }
196
159
  function addProxy(tree, options) {
197
160
  const projectConfig = (0, devkit_1.readProjectConfiguration)(tree, options.frontendProject);
198
- if (projectConfig.targets &&
199
- ['serve', 'dev'].find((t) => !!projectConfig.targets[t])) {
200
- const targetName = ['serve', 'dev'].find((t) => !!projectConfig.targets[t]);
201
- projectConfig.targets[targetName].dependsOn = [
202
- ...(projectConfig.targets[targetName].dependsOn ?? []),
203
- `${options.name}:serve`,
204
- ];
161
+ if (projectConfig.targets && projectConfig.targets.serve) {
205
162
  const pathToProxyFile = `${projectConfig.root}/proxy.conf.json`;
206
- projectConfig.targets[targetName].options = {
207
- ...projectConfig.targets[targetName].options,
163
+ projectConfig.targets.serve.options = {
164
+ ...projectConfig.targets.serve.options,
208
165
  proxyConfig: pathToProxyFile,
209
166
  };
210
167
  if (!tree.exists(pathToProxyFile)) {
@@ -291,9 +248,6 @@ function addProjectDependencies(tree, options) {
291
248
  });
292
249
  }
293
250
  function updateTsConfigOptions(tree, options) {
294
- if (options.isUsingTsSolutionConfig) {
295
- return;
296
- }
297
251
  (0, devkit_1.updateJson)(tree, `${options.appProjectRoot}/tsconfig.json`, (json) => {
298
252
  if (options.rootProject) {
299
253
  return {
@@ -321,20 +275,13 @@ function updateTsConfigOptions(tree, options) {
321
275
  async function applicationGenerator(tree, schema) {
322
276
  return await applicationGeneratorInternal(tree, {
323
277
  addPlugin: false,
324
- useProjectJson: true,
278
+ projectNameAndRootFormat: 'derived',
325
279
  ...schema,
326
280
  });
327
281
  }
328
282
  async function applicationGeneratorInternal(tree, schema) {
329
- const tasks = [];
330
- const jsInitTask = await (0, js_1.initGenerator)(tree, {
331
- ...schema,
332
- tsConfigName: schema.rootProject ? 'tsconfig.json' : 'tsconfig.base.json',
333
- skipFormat: true,
334
- addTsPlugin: schema.useTsSolution,
335
- });
336
- tasks.push(jsInitTask);
337
283
  const options = await normalizeOptions(tree, schema);
284
+ const tasks = [];
338
285
  if (options.framework === 'nest') {
339
286
  // nx-ignore-next-line
340
287
  const { applicationGenerator } = (0, devkit_1.ensurePackage)('@nx/nest', versions_2.nxVersion);
@@ -358,6 +305,12 @@ async function applicationGeneratorInternal(tree, schema) {
358
305
  },
359
306
  ]);
360
307
  }
308
+ const jsInitTask = await (0, js_1.initGenerator)(tree, {
309
+ ...schema,
310
+ tsConfigName: schema.rootProject ? 'tsconfig.json' : 'tsconfig.base.json',
311
+ skipFormat: true,
312
+ });
313
+ tasks.push(jsInitTask);
361
314
  const initTask = await (0, init_1.initGenerator)(tree, {
362
315
  ...schema,
363
316
  skipFormat: true,
@@ -382,13 +335,8 @@ async function applicationGeneratorInternal(tree, schema) {
382
335
  }
383
336
  addAppFiles(tree, options);
384
337
  addProject(tree, options);
385
- // If we are using the new TS solution
386
- // We need to update the workspace file (package.json or pnpm-workspaces.yaml) to include the new project
387
- if (options.isUsingTsSolutionConfig) {
388
- await (0, ts_solution_setup_1.addProjectToTsSolutionWorkspace)(tree, options.appProjectRoot);
389
- }
390
338
  updateTsConfigOptions(tree, options);
391
- if (options.linter === 'eslint') {
339
+ if (options.linter === eslint_1.Linter.EsLint) {
392
340
  const lintTask = await addLintingToApplication(tree, options);
393
341
  tasks.push(lintTask);
394
342
  }
@@ -404,13 +352,6 @@ async function applicationGeneratorInternal(tree, schema) {
404
352
  skipFormat: true,
405
353
  });
406
354
  tasks.push(jestTask);
407
- // There are no tests by default, so set `--passWithNoTests` to avoid test failure on new project.
408
- const projectConfig = (0, devkit_1.readProjectConfiguration)(tree, options.name);
409
- projectConfig.targets ??= {};
410
- projectConfig.targets.test = {
411
- options: { passWithNoTests: true },
412
- };
413
- (0, devkit_1.updateProjectConfiguration)(tree, options.name, projectConfig);
414
355
  }
415
356
  else {
416
357
  // No need for default spec file if unit testing is not setup.
@@ -422,6 +363,7 @@ async function applicationGeneratorInternal(tree, schema) {
422
363
  projectType: options.framework === 'none' ? 'cli' : 'server',
423
364
  name: options.rootProject ? 'e2e' : `${options.name}-e2e`,
424
365
  directory: options.rootProject ? 'e2e' : `${options.appProjectRoot}-e2e`,
366
+ projectNameAndRootFormat: 'as-provided',
425
367
  project: options.name,
426
368
  port: options.port,
427
369
  isNest: options.isNest,
@@ -443,15 +385,6 @@ async function applicationGeneratorInternal(tree, schema) {
443
385
  });
444
386
  tasks.push(dockerTask);
445
387
  }
446
- if (options.isUsingTsSolutionConfig) {
447
- (0, ts_solution_setup_1.updateTsconfigFiles)(tree, options.appProjectRoot, 'tsconfig.app.json', {
448
- module: 'nodenext',
449
- moduleResolution: 'nodenext',
450
- }, options.linter === 'eslint'
451
- ? ['eslint.config.js', 'eslint.config.cjs', 'eslint.config.mjs']
452
- : undefined);
453
- }
454
- (0, sort_fields_1.sortPackageJsonFields)(tree, options.appProjectRoot);
455
388
  if (!options.skipFormat) {
456
389
  await (0, devkit_1.formatFiles)(tree);
457
390
  }
@@ -461,14 +394,16 @@ async function applicationGeneratorInternal(tree, schema) {
461
394
  return (0, devkit_1.runTasksInSerial)(...tasks);
462
395
  }
463
396
  async function normalizeOptions(host, options) {
464
- await (0, project_name_and_root_utils_1.ensureRootProjectName)(options, 'application');
465
- const { projectName, projectRoot: appProjectRoot, importPath, } = await (0, project_name_and_root_utils_1.determineProjectNameAndRootOptions)(host, {
397
+ const { projectName: appProjectName, projectRoot: appProjectRoot, projectNameAndRootFormat, } = await (0, project_name_and_root_utils_1.determineProjectNameAndRootOptions)(host, {
466
398
  name: options.name,
467
399
  projectType: 'application',
468
400
  directory: options.directory,
401
+ projectNameAndRootFormat: options.projectNameAndRootFormat,
469
402
  rootProject: options.rootProject,
403
+ callingGenerator: '@nx/node:application',
470
404
  });
471
405
  options.rootProject = appProjectRoot === '.';
406
+ options.projectNameAndRootFormat = projectNameAndRootFormat;
472
407
  options.bundler = options.bundler ?? 'esbuild';
473
408
  options.e2eTestRunner = options.e2eTestRunner ?? 'jest';
474
409
  const parsedTags = options.tags
@@ -477,10 +412,6 @@ async function normalizeOptions(host, options) {
477
412
  const nxJson = (0, devkit_1.readNxJson)(host);
478
413
  const addPlugin = process.env.NX_ADD_PLUGINS !== 'false' &&
479
414
  nxJson.useInferencePlugins !== false;
480
- const isUsingTsSolutionConfig = (0, ts_solution_setup_1.isUsingTsSolutionSetup)(host);
481
- const swcJest = options.swcJest ?? isUsingTsSolutionConfig;
482
- const appProjectName = !isUsingTsSolutionConfig || options.name ? projectName : importPath;
483
- const useProjectJson = options.useProjectJson ?? !isUsingTsSolutionConfig;
484
415
  return {
485
416
  addPlugin,
486
417
  ...options,
@@ -489,18 +420,12 @@ async function normalizeOptions(host, options) {
489
420
  ? (0, devkit_1.names)(options.frontendProject).fileName
490
421
  : undefined,
491
422
  appProjectRoot,
492
- importPath,
493
423
  parsedTags,
494
- linter: options.linter ?? 'eslint',
424
+ linter: options.linter ?? eslint_1.Linter.EsLint,
495
425
  unitTestRunner: options.unitTestRunner ?? 'jest',
496
426
  rootProject: options.rootProject ?? false,
497
427
  port: options.port ?? 3000,
498
- outputPath: isUsingTsSolutionConfig
499
- ? (0, devkit_1.joinPathFragments)(appProjectRoot, 'dist')
500
- : (0, devkit_1.joinPathFragments)('dist', options.rootProject ? appProjectName : appProjectRoot),
501
- isUsingTsSolutionConfig,
502
- swcJest,
503
- useProjectJson,
428
+ outputPath: (0, devkit_1.joinPathFragments)('dist', options.rootProject ? options.name : appProjectRoot),
504
429
  };
505
430
  }
506
431
  exports.default = applicationGenerator;
@@ -5,5 +5,6 @@
5
5
  "module": "commonjs",
6
6
  "types": ["node"]
7
7
  },
8
+ "exclude": ["jest.config.ts", "src/**/*.spec.ts", "src/**/*.test.ts"],
8
9
  "include": ["src/**/*.ts"]
9
10
  }
@@ -1,10 +1,10 @@
1
- <%_ if (webpackPluginOptions) { _%>
1
+ <% if (webpackPluginOptions) { %>
2
2
  const { NxAppWebpackPlugin } = require('@nx/webpack/app-plugin');
3
3
  const { join } = require('path');
4
4
 
5
5
  module.exports = {
6
6
  output: {
7
- path: join(__dirname, '<%= webpackPluginOptions.outputPath %>'),
7
+ path: join(__dirname, '<%= offset %><%= webpackPluginOptions.outputPath %>'),
8
8
  },
9
9
  plugins: [
10
10
  new NxAppWebpackPlugin({
@@ -19,7 +19,7 @@ module.exports = {
19
19
  })
20
20
  ],
21
21
  };
22
- <%_ } else { _%>
22
+ <% } else { %>
23
23
  const { composePlugins, withNx} = require('@nx/webpack');
24
24
 
25
25
  // Nx plugins for webpack.
@@ -33,4 +33,4 @@ module.exports = composePlugins(
33
33
  return config;
34
34
  }
35
35
  );
36
- <%_ } _%>
36
+ <% } %>
@@ -1,20 +1,22 @@
1
+ import type { ProjectNameAndRootFormat } from '@nx/devkit/src/generators/project-name-and-root-utils';
1
2
  import type { Linter, LinterType } from '@nx/eslint';
2
3
 
3
4
  export interface Schema {
4
- directory: string;
5
- name?: string;
5
+ name: string;
6
6
  skipFormat?: boolean;
7
7
  skipPackageJson?: boolean;
8
+ directory?: string;
9
+ projectNameAndRootFormat?: ProjectNameAndRootFormat;
8
10
  unitTestRunner?: 'jest' | 'none';
9
11
  e2eTestRunner?: 'jest' | 'none';
10
12
  linter?: Linter | LinterType;
11
- formatter?: 'none' | 'prettier';
12
13
  tags?: string;
13
14
  frontendProject?: string;
14
15
  swcJest?: boolean;
15
16
  /** @deprecated use `swcJest` instead */
16
17
  babelJest?: boolean;
17
18
  js?: boolean;
19
+ pascalCaseFiles?: boolean;
18
20
  setParserOptionsProject?: boolean;
19
21
  standaloneConfig?: boolean;
20
22
  bundler?: 'esbuild' | 'webpack';
@@ -24,8 +26,6 @@ export interface Schema {
24
26
  docker?: boolean;
25
27
  isNest?: boolean;
26
28
  addPlugin?: boolean;
27
- useTsSolution?: boolean;
28
- useProjectJson?: boolean;
29
29
  }
30
30
 
31
31
  export type NodeJsFrameWorks = 'express' | 'koa' | 'fastify' | 'nest' | 'none';
@@ -6,21 +6,27 @@
6
6
  "description": "Nx Application Options Schema.",
7
7
  "type": "object",
8
8
  "properties": {
9
- "directory": {
10
- "description": "The directory of the new application.",
9
+ "name": {
10
+ "description": "The name of the application.",
11
11
  "type": "string",
12
12
  "$default": {
13
13
  "$source": "argv",
14
14
  "index": 0
15
15
  },
16
- "x-prompt": "Which directory do you want to create the application in?"
16
+ "x-prompt": "What name would you like to use for the node application?",
17
+ "x-priority": "important",
18
+ "pattern": "^[a-zA-Z][^:]*$"
17
19
  },
18
- "name": {
19
- "description": "The name of the application.",
20
+ "directory": {
21
+ "description": "The directory of the new application.",
20
22
  "type": "string",
21
- "pattern": "^[a-zA-Z][^:]*$",
22
23
  "x-priority": "important"
23
24
  },
25
+ "projectNameAndRootFormat": {
26
+ "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`).",
27
+ "type": "string",
28
+ "enum": ["as-provided", "derived"]
29
+ },
24
30
  "skipFormat": {
25
31
  "description": "Skip formatting files",
26
32
  "type": "boolean",
@@ -36,26 +42,14 @@
36
42
  "linter": {
37
43
  "description": "The tool to use for running lint checks.",
38
44
  "type": "string",
39
- "enum": ["eslint", "none"],
40
- "default": "none",
41
- "x-prompt": "Which linter would you like to use?",
42
- "x-priority": "important"
45
+ "enum": ["eslint"],
46
+ "default": "eslint"
43
47
  },
44
48
  "unitTestRunner": {
45
49
  "type": "string",
46
50
  "enum": ["jest", "none"],
47
51
  "description": "Test runner to use for unit tests.",
48
- "default": "none",
49
- "x-priority": "important",
50
- "x-prompt": "Which unit test runner would you like to use?"
51
- },
52
- "e2eTestRunner": {
53
- "type": "string",
54
- "enum": ["jest", "none"],
55
- "description": "Test runner to use for end-to-end tests",
56
- "default": "none",
57
- "x-priority": "important",
58
- "x-prompt": "Which end-to-end test runner would you like to use?"
52
+ "default": "jest"
59
53
  },
60
54
  "tags": {
61
55
  "type": "string",
@@ -69,7 +63,8 @@
69
63
  },
70
64
  "swcJest": {
71
65
  "type": "boolean",
72
- "description": "Use `@swc/jest` instead `ts-jest` for faster test compilation."
66
+ "description": "Use `@swc/jest` instead `ts-jest` for faster test compilation.",
67
+ "default": false
73
68
  },
74
69
  "babelJest": {
75
70
  "type": "boolean",
@@ -77,6 +72,12 @@
77
72
  "default": false,
78
73
  "x-deprecated": "Use --swcJest instead for faster compilation"
79
74
  },
75
+ "pascalCaseFiles": {
76
+ "type": "boolean",
77
+ "description": "Use pascal case file names.",
78
+ "alias": "P",
79
+ "default": false
80
+ },
80
81
  "js": {
81
82
  "type": "boolean",
82
83
  "description": "Generate JavaScript files rather than TypeScript files.",
@@ -120,14 +121,16 @@
120
121
  "hidden": true,
121
122
  "x-priority": "internal"
122
123
  },
124
+ "e2eTestRunner": {
125
+ "type": "string",
126
+ "enum": ["jest", "none"],
127
+ "description": "Test runner to use for end to end (e2e) tests",
128
+ "default": "jest"
129
+ },
123
130
  "docker": {
124
131
  "type": "boolean",
125
132
  "description": "Add a docker build target"
126
- },
127
- "useProjectJson": {
128
- "type": "boolean",
129
- "description": "Use a `project.json` configuration file instead of inlining the Nx configuration in the `package.json` file."
130
133
  }
131
134
  },
132
- "required": ["directory"]
135
+ "required": ["name"]
133
136
  }