@nx/workspace 0.0.0-pr-30418-4e2b721 → 0.0.0-pr-3-ec41644

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 (28) hide show
  1. package/package.json +3 -5
  2. package/src/generators/ci-workflow/ci-workflow.js +0 -3
  3. package/src/generators/ci-workflow/files/azure/azure-pipelines.yml__tmpl__ +1 -1
  4. package/src/generators/ci-workflow/files/bitbucket-pipelines/bitbucket-pipelines.yml__tmpl__ +2 -2
  5. package/src/generators/ci-workflow/files/circleci/.circleci/config.yml__tmpl__ +1 -1
  6. package/src/generators/ci-workflow/files/github/.github/workflows/__workflowFileName__.yml__tmpl__ +1 -1
  7. package/src/generators/ci-workflow/files/gitlab/.gitlab-ci.yml__tmpl__ +1 -1
  8. package/src/generators/move/lib/create-project-configuration-in-new-destination.js +2 -8
  9. package/src/generators/move/lib/normalize-schema.js +38 -32
  10. package/src/generators/move/move.d.ts +2 -2
  11. package/src/generators/move/move.js +1 -19
  12. package/src/generators/move/schema.d.ts +0 -1
  13. package/src/generators/new/generate-preset.js +4 -4
  14. package/src/generators/new/generate-workspace-files.js +18 -5
  15. package/src/generators/new/new.d.ts +0 -1
  16. package/src/generators/new/schema.json +1 -6
  17. package/src/generators/npm-package/npm-package.js +4 -4
  18. package/src/generators/preset/preset.js +32 -14
  19. package/src/generators/preset/schema.d.ts +0 -1
  20. package/src/generators/preset/schema.json +1 -6
  21. package/src/generators/utils/presets.d.ts +2 -0
  22. package/src/generators/utils/presets.js +2 -0
  23. package/src/utilities/typescript/ts-solution-setup.d.ts +0 -1
  24. package/src/utilities/typescript/ts-solution-setup.js +0 -48
  25. package/src/utils/versions.d.ts +1 -1
  26. package/src/utils/versions.js +1 -1
  27. package/src/utilities/package-manager-workspaces.d.ts +0 -5
  28. package/src/utilities/package-manager-workspaces.js +0 -39
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nx/workspace",
3
- "version": "0.0.0-pr-30418-4e2b721",
3
+ "version": "0.0.0-pr-3-ec41644",
4
4
  "private": false,
5
5
  "description": "The Workspace plugin contains executors and generators that are useful for any Nx workspace. It should be present in every Nx workspace and other plugins build on it.",
6
6
  "repository": {
@@ -38,14 +38,12 @@
38
38
  }
39
39
  },
40
40
  "dependencies": {
41
- "@nx/devkit": "0.0.0-pr-30418-4e2b721",
42
- "@zkochan/js-yaml": "0.0.7",
41
+ "@nx/devkit": "0.0.0-pr-3-ec41644",
43
42
  "chalk": "^4.1.0",
44
43
  "enquirer": "~2.3.6",
45
- "picomatch": "4.0.2",
46
44
  "tslib": "^2.3.0",
47
45
  "yargs-parser": "21.1.1",
48
- "nx": "0.0.0-pr-30418-4e2b721"
46
+ "nx": "0.0.0-pr-3-ec41644"
49
47
  },
50
48
  "publishConfig": {
51
49
  "access": "public"
@@ -5,7 +5,6 @@ const devkit_1 = require("@nx/devkit");
5
5
  const default_base_1 = require("../../utilities/default-base");
6
6
  const path_1 = require("path");
7
7
  const nx_cloud_utils_1 = require("nx/src/utils/nx-cloud-utils");
8
- const ts_solution_setup_1 = require("../../utilities/typescript/ts-solution-setup");
9
8
  async function ciWorkflowGenerator(tree, schema) {
10
9
  const ci = schema.ci;
11
10
  const options = normalizeOptions(schema, tree);
@@ -36,7 +35,6 @@ function normalizeOptions(options, tree) {
36
35
  const hasCypress = allDependencies['@nx/cypress'];
37
36
  const hasPlaywright = allDependencies['@nx/playwright'];
38
37
  const hasE2E = hasCypress || hasPlaywright;
39
- const hasTypecheck = (0, ts_solution_setup_1.isUsingTsSolutionSetup)(tree);
40
38
  const connectedToCloud = (0, nx_cloud_utils_1.isNxCloudUsed)((0, devkit_1.readJson)(tree, 'nx.json'));
41
39
  return {
42
40
  workflowName,
@@ -49,7 +47,6 @@ function normalizeOptions(options, tree) {
49
47
  hasCypress,
50
48
  hasE2E,
51
49
  hasPlaywright,
52
- hasTypecheck,
53
50
  nxCloudHost,
54
51
  tmpl: '',
55
52
  connectedToCloud,
@@ -68,4 +68,4 @@ jobs:
68
68
  # - script: <%= packageManagerPrefix %> nx-cloud record -- echo Hello World
69
69
  # Nx Affected runs only tasks affected by the changes in this PR/commit. Learn more: https://nx.dev/ci/features/affected<% if(hasE2E){ %>
70
70
  # When you enable task distribution, run the e2e-ci task instead of e2e<% } %>
71
- - script: <%= packageManagerPrefix %> nx affected --base=$(BASE_SHA) --head=$(HEAD_SHA) lint test build<% if(hasTypecheck){ %> typecheck<% } %><% if(hasE2E){ %> e2e<% } %>
71
+ - script: <%= packageManagerPrefix %> nx affected --base=$(BASE_SHA) --head=$(HEAD_SHA) lint test build<% if(hasE2E){ %> e2e<% } %>
@@ -33,7 +33,7 @@ pipelines:
33
33
  # <%= packageManagerPrefix %> nx-cloud record -- echo Hello World
34
34
  # Nx Affected runs only tasks affected by the changes in this PR/commit. Learn more: https://nx.dev/ci/features/affected<% if(hasE2E){ %>
35
35
  # When you enable task distribution, run the e2e-ci task instead of e2e<% } %>
36
- - <%= packageManagerPrefix %> nx affected --base=origin/<%= mainBranch %> -t lint test build<% if(hasTypecheck){ %> typecheck<% } %><% if(hasE2E){ %> e2e<% } %>
36
+ - <%= packageManagerPrefix %> nx affected --base=origin/<%= mainBranch %> -t lint test build<% if(hasE2E){ %> e2e<% } %>
37
37
 
38
38
  branches:
39
39
  main:
@@ -59,4 +59,4 @@ pipelines:
59
59
  # Prepend any command with "nx-cloud record --" to record its logs to Nx Cloud
60
60
  # - <%= packageManagerPrefix %> nx-cloud record -- echo Hello World
61
61
  # Nx Affected runs only tasks affected by the changes in this PR/commit. Learn more: https://nx.dev/ci/features/affected
62
- - <%= packageManagerPrefix %> nx affected -t lint test build<% if(hasTypecheck){ %> typecheck<% } %><% if(hasE2E){ %> e2e-ci<% } %> --base=HEAD~1
62
+ - <%= packageManagerPrefix %> nx affected -t lint test build<% if(hasE2E){ %> e2e-ci<% } %> --base=HEAD~1
@@ -37,7 +37,7 @@ jobs:
37
37
  # - run: <%= packageManagerPrefix %> nx-cloud record -- echo Hello World
38
38
  # Nx Affected runs only tasks affected by the changes in this PR/commit. Learn more: https://nx.dev/ci/features/affected<% if(hasE2E){ %>
39
39
  # When you enable task distribution, run the e2e-ci task instead of e2e<% } %>
40
- - run: <%= packageManagerPrefix %> nx affected -t lint test build<% if(hasTypecheck){ %> typecheck<% } %><% if(hasE2E){ %> e2e<% } %>
40
+ - run: <%= packageManagerPrefix %> nx affected -t lint test build<% if(hasE2E){ %> e2e<% } %>
41
41
 
42
42
  workflows:
43
43
  version: 2
@@ -50,4 +50,4 @@ jobs:
50
50
  # - run: <%= packageManagerPrefix %> nx-cloud record -- echo Hello World
51
51
  # Nx Affected runs only tasks affected by the changes in this PR/commit. Learn more: https://nx.dev/ci/features/affected<% if(hasE2E){ %>
52
52
  # When you enable task distribution, run the e2e-ci task instead of e2e<% } %>
53
- - run: <%= packageManagerPrefix %> nx affected -t lint test build<% if(hasTypecheck){ %> typecheck<% } %><% if(hasE2E){ %> e2e<% } %>
53
+ - run: <%= packageManagerPrefix %> nx affected -t lint test build<% if(hasE2E){ %> e2e<% } %>
@@ -31,4 +31,4 @@ variables:
31
31
  # - <%= packageManagerPrefix %> nx-cloud record -- echo Hello World
32
32
  # Nx Affected runs only tasks affected by the changes in this PR/commit. Learn more: https://nx.dev/ci/features/affected<% if(hasE2E){ %>
33
33
  # When you enable task distribution, run the e2e-ci task instead of e2e<% } %>
34
- - <%= packageManagerPrefix %> nx affected -t lint test build<% if(hasTypecheck){ %> typecheck<% } %><% if(hasE2E){ %> e2e<% } %>
34
+ - <%= packageManagerPrefix %> nx affected -t lint test build<% if(hasE2E){ %> e2e<% } %>
@@ -48,12 +48,6 @@ function createProjectConfigurationInNewDestination(tree, schema, projectConfig)
48
48
  if (isRootProject && projectConfig.sourceRoot) {
49
49
  newProject.sourceRoot = (0, devkit_1.joinPathFragments)(schema.relativeToRootDestination, projectConfig.sourceRoot);
50
50
  }
51
- if (schema.isNxConfiguredInPackageJson) {
52
- // Update the existing project configuration in the package.json
53
- (0, devkit_1.updateProjectConfiguration)(tree, schema.newProjectName, newProject);
54
- }
55
- else {
56
- // Create a new project with the root replaced
57
- (0, devkit_1.addProjectConfiguration)(tree, schema.newProjectName, newProject);
58
- }
51
+ // Create a new project with the root replaced
52
+ (0, devkit_1.addProjectConfiguration)(tree, schema.newProjectName, newProject);
59
53
  }
@@ -1,53 +1,23 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.normalizeSchema = normalizeSchema;
4
- const devkit_1 = require("@nx/devkit");
5
4
  const get_import_path_1 = require("../../../utilities/get-import-path");
6
5
  const utils_1 = require("./utils");
7
6
  const ts_solution_setup_1 = require("../../../utils/ts-solution-setup");
8
7
  async function normalizeSchema(tree, schema, projectConfiguration) {
9
8
  const { destination, newProjectName, importPath } = await determineProjectNameAndRootOptions(tree, schema, projectConfiguration);
10
- const isNxConfiguredInPackageJson = !tree.exists((0, devkit_1.joinPathFragments)(projectConfiguration.root, 'project.json'));
11
9
  return {
12
10
  ...schema,
13
11
  destination: (0, utils_1.normalizePathSlashes)(schema.destination),
14
12
  importPath,
15
13
  newProjectName,
16
14
  relativeToRootDestination: destination,
17
- isNxConfiguredInPackageJson,
18
15
  };
19
16
  }
20
17
  async function determineProjectNameAndRootOptions(tree, options, projectConfiguration) {
21
18
  validateName(tree, options.newProjectName, projectConfiguration);
22
- let destination = (0, utils_1.normalizePathSlashes)(options.destination);
23
- if (options.newProjectName &&
24
- options.newProjectName.includes('/') &&
25
- !options.newProjectName.startsWith('@')) {
26
- throw new Error(`You can't specify a new project name with a directory path (${options.newProjectName}). ` +
27
- `Please provide a valid name without path segments and the full destination with the "--destination" option.`);
28
- }
29
- const newProjectName = options.newProjectName ?? options.projectName;
30
- if (projectConfiguration.projectType !== 'library') {
31
- return { destination, newProjectName };
32
- }
33
- let importPath = options.importPath;
34
- if (importPath) {
35
- return { destination, newProjectName, importPath };
36
- }
37
- if (options.newProjectName?.startsWith('@')) {
38
- // keep the existing import path if the name didn't change
39
- importPath =
40
- options.newProjectName && options.projectName !== options.newProjectName
41
- ? newProjectName
42
- : undefined;
43
- }
44
- else if (options.newProjectName) {
45
- const npmScope = (0, get_import_path_1.getNpmScope)(tree);
46
- importPath = npmScope
47
- ? `${npmScope === '@' ? '' : '@'}${npmScope}/${newProjectName}`
48
- : newProjectName;
49
- }
50
- return { destination, newProjectName, importPath };
19
+ const projectNameAndRootOptions = getProjectNameAndRootOptions(tree, options, projectConfiguration);
20
+ return projectNameAndRootOptions;
51
21
  }
52
22
  function validateName(tree, name, projectConfiguration) {
53
23
  if (!name) {
@@ -79,3 +49,39 @@ function validateName(tree, name, projectConfiguration) {
79
49
  }
80
50
  }
81
51
  }
52
+ function getProjectNameAndRootOptions(tree, options, projectConfiguration) {
53
+ let destination = (0, utils_1.normalizePathSlashes)(options.destination);
54
+ if (options.newProjectName &&
55
+ options.newProjectName.includes('/') &&
56
+ !options.newProjectName.startsWith('@')) {
57
+ throw new Error(`You can't specify a new project name with a directory path (${options.newProjectName}). ` +
58
+ `Please provide a valid name without path segments and the full destination with the "--destination" option.`);
59
+ }
60
+ const asProvidedOptions = getAsProvidedOptions(tree, { ...options, destination }, projectConfiguration);
61
+ return asProvidedOptions;
62
+ }
63
+ function getAsProvidedOptions(tree, options, projectConfiguration) {
64
+ const newProjectName = options.newProjectName ?? options.projectName;
65
+ const destination = options.destination;
66
+ if (projectConfiguration.projectType !== 'library') {
67
+ return { destination, newProjectName };
68
+ }
69
+ let importPath = options.importPath;
70
+ if (importPath) {
71
+ return { destination, newProjectName, importPath };
72
+ }
73
+ if (options.newProjectName?.startsWith('@')) {
74
+ // keep the existing import path if the name didn't change
75
+ importPath =
76
+ options.newProjectName && options.projectName !== options.newProjectName
77
+ ? newProjectName
78
+ : undefined;
79
+ }
80
+ else if (options.newProjectName) {
81
+ const npmScope = (0, get_import_path_1.getNpmScope)(tree);
82
+ importPath = npmScope
83
+ ? `${npmScope === '@' ? '' : '@'}${npmScope}/${newProjectName}`
84
+ : newProjectName;
85
+ }
86
+ return { destination, newProjectName, importPath };
87
+ }
@@ -1,4 +1,4 @@
1
- import { type GeneratorCallback, type Tree } from '@nx/devkit';
1
+ import { Tree } from '@nx/devkit';
2
2
  import { Schema } from './schema';
3
- export declare function moveGenerator(tree: Tree, rawSchema: Schema): Promise<GeneratorCallback>;
3
+ export declare function moveGenerator(tree: Tree, rawSchema: Schema): Promise<void>;
4
4
  export default moveGenerator;
@@ -2,11 +2,8 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.moveGenerator = moveGenerator;
4
4
  const devkit_1 = require("@nx/devkit");
5
- const package_manager_workspaces_1 = require("../../utilities/package-manager-workspaces");
6
- const ts_solution_setup_1 = require("../../utilities/typescript/ts-solution-setup");
7
5
  const check_destination_1 = require("./lib/check-destination");
8
6
  const create_project_configuration_in_new_destination_1 = require("./lib/create-project-configuration-in-new-destination");
9
- const extract_base_configs_1 = require("./lib/extract-base-configs");
10
7
  const move_project_files_1 = require("./lib/move-project-files");
11
8
  const normalize_schema_1 = require("./lib/normalize-schema");
12
9
  const run_angular_plugin_1 = require("./lib/run-angular-plugin");
@@ -21,9 +18,9 @@ const update_package_json_1 = require("./lib/update-package-json");
21
18
  const update_project_root_files_1 = require("./lib/update-project-root-files");
22
19
  const update_readme_1 = require("./lib/update-readme");
23
20
  const update_storybook_config_1 = require("./lib/update-storybook-config");
21
+ const extract_base_configs_1 = require("./lib/extract-base-configs");
24
22
  async function moveGenerator(tree, rawSchema) {
25
23
  let projectConfig = (0, devkit_1.readProjectConfiguration)(tree, rawSchema.projectName);
26
- const wasIncludedInWorkspaces = (0, package_manager_workspaces_1.isProjectIncludedInPackageManagerWorkspaces)(tree, projectConfig.root);
27
24
  const schema = await (0, normalize_schema_1.normalizeSchema)(tree, rawSchema, projectConfig);
28
25
  (0, check_destination_1.checkDestination)(tree, schema, rawSchema.destination);
29
26
  if (projectConfig.root === '.') {
@@ -51,23 +48,8 @@ async function moveGenerator(tree, rawSchema) {
51
48
  (0, extract_base_configs_1.maybeMigrateEslintConfigIfRootProject)(tree, projectConfig);
52
49
  }
53
50
  await (0, run_angular_plugin_1.runAngularPlugin)(tree, schema);
54
- let task;
55
- if (wasIncludedInWorkspaces) {
56
- // check if the new destination is included in the package manager workspaces
57
- const isIncludedInWorkspaces = (0, package_manager_workspaces_1.isProjectIncludedInPackageManagerWorkspaces)(tree, schema.destination);
58
- if (!isIncludedInWorkspaces) {
59
- // the new destination is not included in the package manager workspaces
60
- // so we need to add it and run a package install to ensure the symlink
61
- // is created
62
- await (0, ts_solution_setup_1.addProjectToTsSolutionWorkspace)(tree, schema.destination);
63
- task = () => (0, devkit_1.installPackagesTask)(tree, true);
64
- }
65
- }
66
51
  if (!schema.skipFormat) {
67
52
  await (0, devkit_1.formatFiles)(tree);
68
53
  }
69
- if (task) {
70
- return task;
71
- }
72
54
  }
73
55
  exports.default = moveGenerator;
@@ -9,5 +9,4 @@ export interface Schema {
9
9
 
10
10
  export interface NormalizedSchema extends Schema {
11
11
  relativeToRootDestination: string;
12
- isNxConfiguredInPackageJson?: boolean;
13
12
  }
@@ -70,9 +70,6 @@ function generatePreset(host, opts) {
70
70
  : null,
71
71
  parsedArgs.interactive ? '--interactive=true' : '--interactive=false',
72
72
  opts.routing !== undefined ? `--routing=${opts.routing}` : null,
73
- opts.useReactRouter !== undefined
74
- ? `--useReactRouter=${opts.useReactRouter}`
75
- : null,
76
73
  opts.unitTestRunner !== undefined
77
74
  ? `--unitTestRunner=${opts.unitTestRunner}`
78
75
  : null,
@@ -84,7 +81,7 @@ function generatePreset(host, opts) {
84
81
  opts.prefix !== undefined ? `--prefix=${opts.prefix}` : null,
85
82
  opts.nxCloudToken ? `--nxCloudToken=${opts.nxCloudToken}` : null,
86
83
  opts.formatter ? `--formatter=${opts.formatter}` : null,
87
- opts.workspaces !== false ? `--workspaces` : `--no-workspaces`,
84
+ opts.workspaces ? `--workspaces` : null,
88
85
  ].filter((e) => !!e);
89
86
  }
90
87
  }
@@ -115,6 +112,9 @@ function getPresetDependencies({ preset, presetVersion, bundler, e2eTestRunner,
115
112
  case presets_1.Preset.NextJs:
116
113
  case presets_1.Preset.NextJsStandalone:
117
114
  return { dependencies: { '@nx/next': versions_1.nxVersion }, dev: {} };
115
+ case presets_1.Preset.RemixStandalone:
116
+ case presets_1.Preset.RemixMonorepo:
117
+ return { dependencies: { '@nx/remix': versions_1.nxVersion }, dev: {} };
118
118
  case presets_1.Preset.VueMonorepo:
119
119
  case presets_1.Preset.VueStandalone:
120
120
  return {
@@ -52,6 +52,16 @@ const presetToPluginMap = {
52
52
  generateLibCmd: '@nx/react',
53
53
  learnMoreLink: 'https://nx.dev/nx-api/next?utm_source=nx_project&utm_medium=readme&utm_campaign=nx_projects',
54
54
  },
55
+ [presets_1.Preset.RemixMonorepo]: {
56
+ generateAppCmd: '@nx/remix',
57
+ generateLibCmd: '@nx/react',
58
+ learnMoreLink: 'https://nx.dev/nx-api/remix?utm_source=nx_project&utm_medium=readme&utm_campaign=nx_projects',
59
+ },
60
+ [presets_1.Preset.RemixStandalone]: {
61
+ generateAppCmd: '@nx/remix',
62
+ generateLibCmd: '@nx/react',
63
+ learnMoreLink: 'https://nx.dev/nx-api/remix?utm_source=nx_project&utm_medium=readme&utm_campaign=nx_projects',
64
+ },
55
65
  [presets_1.Preset.ReactNative]: {
56
66
  generateAppCmd: '@nx/react-native',
57
67
  generateLibCmd: '@nx/react',
@@ -197,11 +207,12 @@ function createFiles(tree, options) {
197
207
  options.preset === presets_1.Preset.NuxtStandalone ||
198
208
  options.preset === presets_1.Preset.NodeStandalone ||
199
209
  options.preset === presets_1.Preset.NextJsStandalone ||
210
+ options.preset === presets_1.Preset.RemixStandalone ||
200
211
  options.preset === presets_1.Preset.TsStandalone
201
212
  ? './files-root-app'
202
213
  : (options.preset === presets_1.Preset.TS &&
203
- options.workspaces &&
204
- process.env.NX_ADD_PLUGINS !== 'false') ||
214
+ process.env.NX_ADD_PLUGINS !== 'false' &&
215
+ process.env.NX_ADD_TS_PLUGIN !== 'false') ||
205
216
  options.preset === presets_1.Preset.NPM
206
217
  ? './files-package-based-repo'
207
218
  : './files-integrated-repo';
@@ -216,7 +227,7 @@ function createFiles(tree, options) {
216
227
  packageManager: options.packageManager,
217
228
  });
218
229
  }
219
- async function createReadme(tree, { name, appName, directory, preset, nxCloud, workspaces }, nxCloudToken) {
230
+ async function createReadme(tree, { name, appName, directory, preset, nxCloud }, nxCloudToken) {
220
231
  const formattedNames = (0, devkit_1.names)(name);
221
232
  // default to an empty one for custom presets
222
233
  const presetInfo = presetToPluginMap[preset] ?? {
@@ -230,7 +241,8 @@ async function createReadme(tree, { name, appName, directory, preset, nxCloud, w
230
241
  formattedNames,
231
242
  isJsStandalone: preset === presets_1.Preset.TsStandalone,
232
243
  isTsPreset: preset === presets_1.Preset.TS,
233
- isUsingNewTsSolutionSetup: process.env.NX_ADD_PLUGINS !== 'false' && workspaces,
244
+ isUsingNewTsSolutionSetup: process.env.NX_ADD_PLUGINS !== 'false' &&
245
+ process.env.NX_ADD_TS_PLUGIN !== 'false',
234
246
  isEmptyRepo: !appName,
235
247
  appName,
236
248
  generateAppCmd: presetInfo.generateAppCmd,
@@ -313,11 +325,12 @@ function setUpWorkspacesInPackageJson(tree, options) {
313
325
  if (options.preset === presets_1.Preset.NPM ||
314
326
  (options.preset === presets_1.Preset.TS &&
315
327
  process.env.NX_ADD_PLUGINS !== 'false' &&
316
- options.workspaces) ||
328
+ process.env.NX_ADD_TS_PLUGIN !== 'false') ||
317
329
  ((options.preset === presets_1.Preset.Expo ||
318
330
  options.preset === presets_1.Preset.NextJs ||
319
331
  options.preset === presets_1.Preset.ReactMonorepo ||
320
332
  options.preset === presets_1.Preset.ReactNative ||
333
+ options.preset === presets_1.Preset.RemixMonorepo ||
321
334
  options.preset === presets_1.Preset.VueMonorepo ||
322
335
  options.preset === presets_1.Preset.Nuxt ||
323
336
  options.preset === presets_1.Preset.NodeMonorepo ||
@@ -17,7 +17,6 @@ interface Schema {
17
17
  bundler?: 'vite' | 'webpack';
18
18
  standaloneApi?: boolean;
19
19
  routing?: boolean;
20
- useReactRouter?: boolean;
21
20
  packageManager?: PackageManager;
22
21
  unitTestRunner?: 'jest' | 'vitest' | 'none';
23
22
  e2eTestRunner?: 'cypress' | 'playwright' | 'detox' | 'jest' | 'none';
@@ -25,11 +25,6 @@
25
25
  "type": "boolean",
26
26
  "default": true
27
27
  },
28
- "useReactRouter": {
29
- "description": "Use React Router for routing.",
30
- "type": "boolean",
31
- "default": false
32
- },
33
28
  "standaloneApi": {
34
29
  "description": "Use Standalone Components if generating an Angular application.",
35
30
  "type": "boolean",
@@ -110,7 +105,7 @@
110
105
  "workspaces": {
111
106
  "description": "Whether to use package manager workspaces.",
112
107
  "type": "boolean",
113
- "default": true
108
+ "default": false
114
109
  }
115
110
  },
116
111
  "additionalProperties": true
@@ -4,9 +4,10 @@ exports.npmPackageGenerator = npmPackageGenerator;
4
4
  const devkit_1 = require("@nx/devkit");
5
5
  const project_name_and_root_utils_1 = require("@nx/devkit/src/generators/project-name-and-root-utils");
6
6
  const path_1 = require("path");
7
+ const get_import_path_1 = require("../../utilities/get-import-path");
7
8
  async function normalizeOptions(tree, options) {
8
- await (0, project_name_and_root_utils_1.ensureRootProjectName)(options, 'library');
9
- const { projectName, projectRoot, importPath } = await (0, project_name_and_root_utils_1.determineProjectNameAndRootOptions)(tree, {
9
+ await (0, project_name_and_root_utils_1.ensureProjectName)(tree, options, 'library');
10
+ const { projectName, projectRoot } = await (0, project_name_and_root_utils_1.determineProjectNameAndRootOptions)(tree, {
10
11
  name: options.name,
11
12
  projectType: 'library',
12
13
  directory: options.directory,
@@ -15,13 +16,12 @@ async function normalizeOptions(tree, options) {
15
16
  ...options,
16
17
  name: projectName,
17
18
  projectRoot,
18
- importPath,
19
19
  };
20
20
  }
21
21
  function addFiles(projectRoot, tree, options) {
22
22
  const packageJsonPath = (0, path_1.join)(projectRoot, 'package.json');
23
23
  (0, devkit_1.writeJson)(tree, packageJsonPath, {
24
- name: options.importPath,
24
+ name: (0, get_import_path_1.getImportPath)(tree, options.name),
25
25
  version: '0.0.0',
26
26
  scripts: {
27
27
  test: 'node index.js',
@@ -70,12 +70,9 @@ async function createPreset(tree, options) {
70
70
  unitTestRunner: options.unitTestRunner ??
71
71
  (options.bundler === 'vite' ? 'vitest' : 'jest'),
72
72
  addPlugin,
73
- routing: options.routing,
74
- useReactRouter: options.useReactRouter,
75
73
  nxCloudToken: options.nxCloudToken,
76
74
  useTsSolution: options.workspaces,
77
75
  formatter: options.formatter,
78
- useProjectJson: !options.workspaces,
79
76
  });
80
77
  }
81
78
  else if (options.preset === presets_1.Preset.ReactStandalone) {
@@ -89,8 +86,6 @@ async function createPreset(tree, options) {
89
86
  linter: options.linter,
90
87
  rootProject: true,
91
88
  bundler,
92
- routing: options.routing,
93
- useReactRouter: options.useReactRouter,
94
89
  e2eTestRunner: options.e2eTestRunner ?? 'playwright',
95
90
  unitTestRunner: options.unitTestRunner ?? (bundler === 'vite' ? 'vitest' : 'jest'),
96
91
  addPlugin,
@@ -98,6 +93,36 @@ async function createPreset(tree, options) {
98
93
  formatter: options.formatter,
99
94
  });
100
95
  }
96
+ else if (options.preset === presets_1.Preset.RemixMonorepo) {
97
+ const { applicationGenerator: remixApplicationGenerator } = require('@nx' +
98
+ '/remix/generators');
99
+ return remixApplicationGenerator(tree, {
100
+ name: options.name,
101
+ directory: (0, path_1.join)('apps', options.name),
102
+ linter: options.linter,
103
+ e2eTestRunner: options.e2eTestRunner ?? 'playwright',
104
+ unitTestRunner: options.unitTestRunner ?? 'vitest',
105
+ addPlugin,
106
+ nxCloudToken: options.nxCloudToken,
107
+ useTsSolution: options.workspaces,
108
+ formatter: options.formatter,
109
+ });
110
+ }
111
+ else if (options.preset === presets_1.Preset.RemixStandalone) {
112
+ const { applicationGenerator: remixApplicationGenerator } = require('@nx' +
113
+ '/remix/generators');
114
+ return remixApplicationGenerator(tree, {
115
+ name: options.name,
116
+ directory: '.',
117
+ linter: options.linter,
118
+ e2eTestRunner: options.e2eTestRunner ?? 'playwright',
119
+ rootProject: true,
120
+ unitTestRunner: options.unitTestRunner ?? 'vitest',
121
+ addPlugin,
122
+ nxCloudToken: options.nxCloudToken,
123
+ formatter: options.formatter,
124
+ });
125
+ }
101
126
  else if (options.preset === presets_1.Preset.VueMonorepo) {
102
127
  const { applicationGenerator: vueApplicationGenerator } = require('@nx' +
103
128
  '/vue');
@@ -112,7 +137,6 @@ async function createPreset(tree, options) {
112
137
  nxCloudToken: options.nxCloudToken,
113
138
  useTsSolution: options.workspaces,
114
139
  formatter: options.formatter,
115
- useProjectJson: !options.workspaces,
116
140
  });
117
141
  }
118
142
  else if (options.preset === presets_1.Preset.VueStandalone) {
@@ -144,7 +168,6 @@ async function createPreset(tree, options) {
144
168
  nxCloudToken: options.nxCloudToken,
145
169
  useTsSolution: options.workspaces,
146
170
  formatter: options.formatter,
147
- useProjectJson: !options.workspaces,
148
171
  });
149
172
  }
150
173
  else if (options.preset === presets_1.Preset.NuxtStandalone) {
@@ -177,7 +200,6 @@ async function createPreset(tree, options) {
177
200
  addPlugin,
178
201
  useTsSolution: options.workspaces,
179
202
  formatter: options.formatter,
180
- useProjectJson: !options.workspaces,
181
203
  });
182
204
  }
183
205
  else if (options.preset === presets_1.Preset.NextJsStandalone) {
@@ -223,7 +245,6 @@ async function createPreset(tree, options) {
223
245
  addPlugin,
224
246
  useTsSolution: options.workspaces,
225
247
  formatter: options.formatter,
226
- useProjectJson: !options.workspaces,
227
248
  });
228
249
  }
229
250
  else if (options.preset === presets_1.Preset.Express) {
@@ -237,7 +258,6 @@ async function createPreset(tree, options) {
237
258
  addPlugin,
238
259
  useTsSolution: options.workspaces,
239
260
  formatter: options.formatter,
240
- useProjectJson: !options.workspaces,
241
261
  });
242
262
  }
243
263
  else if (options.preset === presets_1.Preset.ReactNative) {
@@ -254,7 +274,6 @@ async function createPreset(tree, options) {
254
274
  bundler: options.bundler ?? 'webpack',
255
275
  useTsSolution: options.workspaces,
256
276
  formatter: options.formatter,
257
- useProjectJson: !options.workspaces,
258
277
  });
259
278
  }
260
279
  else if (options.preset === presets_1.Preset.Expo) {
@@ -269,14 +288,14 @@ async function createPreset(tree, options) {
269
288
  nxCloudToken: options.nxCloudToken,
270
289
  useTsSolution: options.workspaces,
271
290
  formatter: options.formatter,
272
- useProjectJson: !options.workspaces,
273
291
  });
274
292
  }
275
293
  else if (options.preset === presets_1.Preset.TS) {
276
294
  const { initGenerator } = require('@nx' + '/js');
277
295
  return initGenerator(tree, {
278
296
  formatter: options.formatter,
279
- addTsPlugin: process.env.NX_ADD_PLUGINS !== 'false' && options.workspaces,
297
+ addTsPlugin: process.env.NX_ADD_PLUGINS !== 'false' &&
298
+ process.env.NX_ADD_TS_PLUGIN !== 'false',
280
299
  });
281
300
  }
282
301
  else if (options.preset === presets_1.Preset.TsStandalone) {
@@ -327,7 +346,6 @@ async function createPreset(tree, options) {
327
346
  addPlugin,
328
347
  useTsSolution: options.workspaces,
329
348
  formatter: options.formatter,
330
- useProjectJson: !options.workspaces,
331
349
  });
332
350
  }
333
351
  else {
@@ -16,7 +16,6 @@ export interface Schema {
16
16
  nextAppDir?: boolean;
17
17
  nextSrcDir?: boolean;
18
18
  routing?: boolean;
19
- useReactRouter?: boolean;
20
19
  standaloneApi?: boolean;
21
20
  unitTestRunner?: 'jest' | 'vitest' | 'none';
22
21
  e2eTestRunner?: 'cypress' | 'playwright' | 'jest' | 'detox' | 'none';
@@ -25,11 +25,6 @@
25
25
  "type": "boolean",
26
26
  "default": true
27
27
  },
28
- "useReactRouter": {
29
- "description": "Use React Router for routing.",
30
- "type": "boolean",
31
- "default": false
32
- },
33
28
  "style": {
34
29
  "description": "The file extension to be used for style files.",
35
30
  "type": "string",
@@ -127,7 +122,7 @@
127
122
  "workspaces": {
128
123
  "description": "Whether to use package manager workspaces.",
129
124
  "type": "boolean",
130
- "default": true
125
+ "default": false
131
126
  }
132
127
  },
133
128
  "required": ["preset", "name"]
@@ -8,6 +8,8 @@ export declare enum Preset {
8
8
  ReactMonorepo = "react-monorepo",
9
9
  ReactStandalone = "react-standalone",
10
10
  NextJsStandalone = "nextjs-standalone",
11
+ RemixMonorepo = "remix-monorepo",
12
+ RemixStandalone = "remix-standalone",
11
13
  ReactNative = "react-native",
12
14
  VueMonorepo = "vue-monorepo",
13
15
  VueStandalone = "vue-standalone",
@@ -12,6 +12,8 @@ var Preset;
12
12
  Preset["ReactMonorepo"] = "react-monorepo";
13
13
  Preset["ReactStandalone"] = "react-standalone";
14
14
  Preset["NextJsStandalone"] = "nextjs-standalone";
15
+ Preset["RemixMonorepo"] = "remix-monorepo";
16
+ Preset["RemixStandalone"] = "remix-standalone";
15
17
  Preset["ReactNative"] = "react-native";
16
18
  Preset["VueMonorepo"] = "vue-monorepo";
17
19
  Preset["VueStandalone"] = "vue-standalone";
@@ -1,3 +1,2 @@
1
1
  import { type Tree } from '@nx/devkit';
2
2
  export declare function isUsingTsSolutionSetup(tree?: Tree): boolean;
3
- export declare function addProjectToTsSolutionWorkspace(tree: Tree, projectDir: string): Promise<void>;
@@ -1,11 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.isUsingTsSolutionSetup = isUsingTsSolutionSetup;
4
- exports.addProjectToTsSolutionWorkspace = addProjectToTsSolutionWorkspace;
5
4
  const devkit_1 = require("@nx/devkit");
6
- const posix_1 = require("node:path/posix");
7
5
  const tree_1 = require("nx/src/generators/tree");
8
- const package_manager_workspaces_1 = require("../package-manager-workspaces");
9
6
  function isUsingPackageManagerWorkspaces(tree) {
10
7
  return isWorkspacesEnabled(tree);
11
8
  }
@@ -58,48 +55,3 @@ function isUsingTsSolutionSetup(tree) {
58
55
  return (isUsingPackageManagerWorkspaces(tree) &&
59
56
  isWorkspaceSetupWithTsSolution(tree));
60
57
  }
61
- async function addProjectToTsSolutionWorkspace(tree, projectDir) {
62
- const isIncluded = (0, package_manager_workspaces_1.isProjectIncludedInPackageManagerWorkspaces)(tree, projectDir);
63
- if (isIncluded) {
64
- return;
65
- }
66
- // If dir is "libs/foo", we try to use "libs/*" but we only do it if it's
67
- // safe to do so. So, we first check if adding that pattern doesn't result
68
- // in extra projects being matched. If extra projects are matched, or the
69
- // dir is just "foo" then we add it as is.
70
- const baseDir = (0, posix_1.dirname)(projectDir);
71
- let pattern = projectDir;
72
- if (baseDir !== '.') {
73
- const patterns = (0, package_manager_workspaces_1.getPackageManagerWorkspacesPatterns)(tree);
74
- const projectsBefore = await (0, devkit_1.globAsync)(tree, patterns);
75
- patterns.push(`${baseDir}/*/package.json`);
76
- const projectsAfter = await (0, devkit_1.globAsync)(tree, patterns);
77
- if (projectsBefore.length + 1 === projectsAfter.length) {
78
- // Adding the pattern to the parent directory only results in one extra
79
- // project being matched, which is the project we're adding. It's safe
80
- // to add the pattern to the parent directory.
81
- pattern = `${baseDir}/*`;
82
- }
83
- }
84
- if (tree.exists('pnpm-workspace.yaml')) {
85
- const { load, dump } = require('@zkochan/js-yaml');
86
- const workspaceFile = tree.read('pnpm-workspace.yaml', 'utf-8');
87
- const yamlData = load(workspaceFile) ?? {};
88
- yamlData.packages ??= [];
89
- if (!yamlData.packages.includes(pattern)) {
90
- yamlData.packages.push(pattern);
91
- tree.write('pnpm-workspace.yaml', dump(yamlData, { indent: 2, quotingType: '"', forceQuotes: true }));
92
- }
93
- }
94
- else {
95
- // Update package.json
96
- const packageJson = (0, devkit_1.readJson)(tree, 'package.json');
97
- if (!packageJson.workspaces) {
98
- packageJson.workspaces = [];
99
- }
100
- if (!packageJson.workspaces.includes(pattern)) {
101
- packageJson.workspaces.push(pattern);
102
- tree.write('package.json', JSON.stringify(packageJson, null, 2));
103
- }
104
- }
105
- }
@@ -1,3 +1,3 @@
1
1
  export declare const nxVersion: any;
2
2
  export declare const typescriptVersion = "~5.7.2";
3
- export declare const angularCliVersion = "~19.2.0";
3
+ export declare const angularCliVersion = "~19.1.0";
@@ -5,4 +5,4 @@ exports.nxVersion = require('../../package.json').version;
5
5
  exports.typescriptVersion = '~5.7.2';
6
6
  // TODO: remove when preset generation is reworked and
7
7
  // deps are not installed from workspace
8
- exports.angularCliVersion = '~19.2.0';
8
+ exports.angularCliVersion = '~19.1.0';
@@ -1,5 +0,0 @@
1
- import { type Tree } from '@nx/devkit';
2
- export declare function isProjectIncludedInPackageManagerWorkspaces(tree: Tree, projectRoot: string): boolean;
3
- export declare function getPackageManagerWorkspacesPatterns(tree: Tree): string[];
4
- export declare function isUsingPackageManagerWorkspaces(tree: Tree): boolean;
5
- export declare function isWorkspacesEnabled(tree: Tree): boolean;
@@ -1,39 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.isProjectIncludedInPackageManagerWorkspaces = isProjectIncludedInPackageManagerWorkspaces;
4
- exports.getPackageManagerWorkspacesPatterns = getPackageManagerWorkspacesPatterns;
5
- exports.isUsingPackageManagerWorkspaces = isUsingPackageManagerWorkspaces;
6
- exports.isWorkspacesEnabled = isWorkspacesEnabled;
7
- const devkit_1 = require("@nx/devkit");
8
- const posix_1 = require("node:path/posix");
9
- const package_json_1 = require("nx/src/plugins/package-json");
10
- const picomatch = require("picomatch");
11
- function isProjectIncludedInPackageManagerWorkspaces(tree, projectRoot) {
12
- if (!isUsingPackageManagerWorkspaces(tree)) {
13
- return false;
14
- }
15
- const patterns = getPackageManagerWorkspacesPatterns(tree);
16
- return patterns.some((p) => picomatch(p)((0, posix_1.join)(projectRoot, 'package.json')));
17
- }
18
- function getPackageManagerWorkspacesPatterns(tree) {
19
- return (0, package_json_1.getGlobPatternsFromPackageManagerWorkspaces)(tree.root, (path) => (0, devkit_1.readJson)(tree, path, { expectComments: true }), (path) => {
20
- const content = tree.read(path, 'utf-8');
21
- const { load } = require('@zkochan/js-yaml');
22
- return load(content, { filename: path });
23
- }, (path) => tree.exists(path));
24
- }
25
- function isUsingPackageManagerWorkspaces(tree) {
26
- return isWorkspacesEnabled(tree);
27
- }
28
- function isWorkspacesEnabled(tree) {
29
- const packageManager = (0, devkit_1.detectPackageManager)(tree.root);
30
- if (packageManager === 'pnpm') {
31
- return tree.exists('pnpm-workspace.yaml');
32
- }
33
- // yarn and npm both use the same 'workspaces' property in package.json
34
- if (tree.exists('package.json')) {
35
- const packageJson = (0, devkit_1.readJson)(tree, 'package.json');
36
- return !!packageJson?.workspaces;
37
- }
38
- return false;
39
- }