@nx/plugin 17.0.5 → 17.0.6

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 (31) hide show
  1. package/LICENSE +1 -1
  2. package/README.md +4 -9
  3. package/executors.json +1 -1
  4. package/generators.json +1 -1
  5. package/package.json +7 -7
  6. package/src/executors/e2e/e2e.impl.js +2 -2
  7. package/src/generators/create-package/files/create-framework-package/bin/index.ts__tmpl__ +1 -1
  8. package/src/generators/create-package/schema.d.ts +1 -1
  9. package/src/generators/create-package/schema.json +1 -1
  10. package/src/generators/e2e-project/e2e.js +7 -11
  11. package/src/generators/e2e-project/files/src/__pluginName__.spec.ts__tmpl__ +1 -1
  12. package/src/generators/e2e-project/schema.d.ts +1 -2
  13. package/src/generators/e2e-project/schema.json +1 -1
  14. package/src/generators/executor/files/executor/schema.json.template +1 -1
  15. package/src/generators/executor/schema.d.ts +1 -1
  16. package/src/generators/executor/schema.json +2 -2
  17. package/src/generators/generator/files/generator/schema.json.template +1 -1
  18. package/src/generators/generator/schema.d.ts +1 -1
  19. package/src/generators/generator/schema.json +2 -2
  20. package/src/generators/lint-checks/generator.js +27 -25
  21. package/src/generators/lint-checks/schema.json +1 -1
  22. package/src/generators/migration/migration.js +1 -1
  23. package/src/generators/migration/schema.d.ts +1 -1
  24. package/src/generators/migration/schema.json +2 -2
  25. package/src/generators/plugin/plugin.js +0 -3
  26. package/src/generators/plugin/schema.d.ts +1 -1
  27. package/src/generators/plugin/schema.json +1 -1
  28. package/src/generators/preset/schema.json +1 -1
  29. package/src/utils/testing-utils/async-commands.js +1 -2
  30. package/src/utils/testing-utils/commands.js +2 -3
  31. package/src/utils/testing-utils/nx-project.js +2 -3
package/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  (The MIT License)
2
2
 
3
- Copyright (c) 2017-2024 Narwhal Technologies Inc.
3
+ Copyright (c) 2017-2023 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
@@ -1,9 +1,4 @@
1
- <p style="text-align: center;">
2
- <picture>
3
- <source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/nrwl/nx/master/images/nx-dark.svg">
4
- <img alt="Nx - Smart Monorepos · Fast CI" src="https://raw.githubusercontent.com/nrwl/nx/master/images/nx-light.svg" width="100%">
5
- </picture>
6
- </p>
1
+ <p style="text-align: center;"><img src="https://raw.githubusercontent.com/nrwl/nx/master/images/nx.png" width="600" alt="Nx - Smart, Fast and Extensible Build System"></p>
7
2
 
8
3
  <div style="text-align: center;">
9
4
 
@@ -20,9 +15,9 @@
20
15
 
21
16
  <hr>
22
17
 
23
- # Nx: Smart Monorepos · Fast CI
18
+ # Nx: Smart, Fast and Extensible Build System
24
19
 
25
- Nx is a build system with built-in tooling and advanced CI capabilities. It helps you maintain and scale monorepos, both locally and on CI.
20
+ Nx is a next generation build system with first class monorepo support and powerful integrations.
26
21
 
27
22
  ## What is It?
28
23
 
@@ -68,5 +63,5 @@ npx nx@latest init
68
63
  - [Blog Posts About Nx](https://blog.nrwl.io/nx/home)
69
64
 
70
65
  <p style="text-align: center;"><a href="https://nx.dev/#learning-materials" target="_blank" rel="noreferrer"><img src="https://raw.githubusercontent.com/nrwl/nx/master/images/nx-courses-and-videos.svg"
71
- width="100%" alt="Nx - Smart Monorepos · Fast CI"></a></p>
66
+ width="100%" alt="Nx - Smart, Fast and Extensible Build System"></a></p>
72
67
 
package/executors.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "implementation": "./src/executors/e2e/e2e.impl",
5
5
  "schema": "./src/executors/e2e/schema.json",
6
6
  "description": "Creates and runs the E2E tests for an Nx Plugin.",
7
- "x-deprecated": "@nx/plugin:e2e is deprecated and will be removed in Nx v19. Use @nx/jest:jest instead."
7
+ "x-deprecated": "@nx/plugin:e2e is deprecated and will be removed in Nx 18. Use @nx/jest:jest instead."
8
8
  }
9
9
  }
10
10
  }
package/generators.json CHANGED
@@ -41,7 +41,7 @@
41
41
  "preset": {
42
42
  "factory": "./src/generators/preset/generator",
43
43
  "schema": "./src/generators/preset/schema.json",
44
- "description": "Initializes a workspace with an nx-plugin inside of it. Use as: `create-nx-workspace --preset @nx/plugin`.",
44
+ "description": "Initializes a workspace with an nx-plugin inside of it. Use as: `create-nx-workspace --preset @nrwl/nx-plugin`.",
45
45
  "hidden": true,
46
46
  "x-use-standalone-layout": true
47
47
  }
package/package.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@nx/plugin",
3
- "version": "17.0.5",
3
+ "version": "v17.0.6",
4
4
  "private": false,
5
5
  "description": "This plugin is used to create Nx plugins! It contains generators for generating common plugin features like generators, executors, migrations and more.",
6
6
  "repository": {
7
7
  "type": "git",
8
8
  "url": "https://github.com/nrwl/nx.git",
9
- "directory": "packages/plugin"
9
+ "directory": "packages/nx-plugin"
10
10
  },
11
11
  "keywords": [
12
12
  "Monorepo",
@@ -31,11 +31,11 @@
31
31
  "@phenomnomnominal/tsquery": "~5.0.1",
32
32
  "fs-extra": "^11.1.0",
33
33
  "tslib": "^2.3.0",
34
- "@nx/devkit": "17.0.5",
35
- "@nx/jest": "17.0.5",
36
- "@nx/js": "17.0.5",
37
- "@nx/eslint": "17.0.5",
38
- "@nrwl/nx-plugin": "17.0.5"
34
+ "@nx/devkit": "v17.0.6",
35
+ "@nx/jest": "v17.0.6",
36
+ "@nx/js": "v17.0.6",
37
+ "@nx/eslint": "v17.0.6",
38
+ "@nrwl/nx-plugin": "v17.0.6"
39
39
  },
40
40
  "publishConfig": {
41
41
  "access": "public"
@@ -3,11 +3,11 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.nxPluginE2EExecutor = void 0;
4
4
  const devkit_1 = require("@nx/devkit");
5
5
  const jest_impl_1 = require("@nx/jest/src/executors/jest/jest.impl");
6
- // TODO(v19): remove this
6
+ // TODO(v18): remove this
7
7
  async function* nxPluginE2EExecutor(options, context) {
8
8
  const { target, ...jestOptions } = options;
9
9
  devkit_1.output.warn({
10
- title: `"@nx/plugin:e2e" is deprecated and will be removed in Nx 19`,
10
+ title: `"@nx/plugin:e2e" is deprecated and will be removed in Nx 18`,
11
11
  bodyLines: [
12
12
  'Use the "@nx/jest:jest" executor instead and set the following:',
13
13
  `"dependsOn": ["${target}"]`,
@@ -17,7 +17,7 @@ async function main() {
17
17
  // TODO: update below to customize the workspace
18
18
  const { directory } = await createWorkspace(`<%= preset %>@${presetVersion}`, {
19
19
  name,
20
- nxCloud: 'skip',
20
+ nxCloud: false,
21
21
  packageManager: 'npm',
22
22
  });
23
23
 
@@ -1,4 +1,4 @@
1
- import type { ProjectNameAndRootFormat } from '@nx/devkit/src/generators/project-name-and-root-utils';
1
+ import type { ProjectNameAndRootFormat } from '@nx/devkit/src/generators/project-name-directory-utils';
2
2
  import type { Linter } from '@nx/eslint';
3
3
 
4
4
  export interface CreatePackageSchema {
@@ -1,5 +1,5 @@
1
1
  {
2
- "$schema": "https://json-schema.org/schema",
2
+ "$schema": "http://json-schema.org/schema",
3
3
  "cli": "nx",
4
4
  "$id": "NxPluginCreatePackage",
5
5
  "title": "Create a framework package",
@@ -11,10 +11,6 @@ const eslint_1 = require("@nx/eslint");
11
11
  const path_1 = require("path");
12
12
  async function normalizeOptions(host, options) {
13
13
  const projectName = options.rootProject ? 'e2e' : `${options.pluginName}-e2e`;
14
- const nxJson = (0, devkit_1.readNxJson)(host);
15
- const addPlugin = process.env.NX_ADD_PLUGINS !== 'false' &&
16
- nxJson.useInferencePlugins !== false;
17
- options.addPlugin ??= addPlugin;
18
14
  let projectRoot;
19
15
  if (options.projectNameAndRootFormat === 'as-provided') {
20
16
  const projectNameAndRootOptions = await (0, project_name_and_root_utils_1.determineProjectNameAndRootOptions)(host, {
@@ -76,26 +72,27 @@ async function addJest(host, options) {
76
72
  });
77
73
  const jestTask = await (0, jest_1.configurationGenerator)(host, {
78
74
  project: options.projectName,
79
- targetName: 'e2e',
80
75
  setupFile: 'none',
81
76
  supportTsx: false,
82
77
  skipSerializers: true,
83
78
  skipFormat: true,
84
- addPlugin: options.addPlugin,
85
79
  });
86
80
  const { startLocalRegistryPath, stopLocalRegistryPath } = (0, add_local_registry_scripts_1.addLocalRegistryScripts)(host);
87
81
  (0, jest_1.addPropertyToJestConfig)(host, (0, path_1.join)(options.projectRoot, 'jest.config.ts'), 'globalSetup', (0, path_1.join)((0, devkit_1.offsetFromRoot)(options.projectRoot), startLocalRegistryPath));
88
82
  (0, jest_1.addPropertyToJestConfig)(host, (0, path_1.join)(options.projectRoot, 'jest.config.ts'), 'globalTeardown', (0, path_1.join)((0, devkit_1.offsetFromRoot)(options.projectRoot), stopLocalRegistryPath));
89
83
  const project = (0, devkit_1.readProjectConfiguration)(host, options.projectName);
90
- const e2eTarget = project.targets.e2e;
84
+ const testTarget = project.targets.test;
91
85
  project.targets.e2e = {
92
- ...e2eTarget,
86
+ ...testTarget,
93
87
  dependsOn: [`^build`],
94
88
  options: {
95
- ...e2eTarget.options,
89
+ ...testTarget.options,
96
90
  runInBand: true,
97
91
  },
92
+ configurations: testTarget.configurations,
98
93
  };
94
+ // remove the jest build target
95
+ delete project.targets.test;
99
96
  (0, devkit_1.updateProjectConfiguration)(host, options.projectName, project);
100
97
  return jestTask;
101
98
  }
@@ -106,16 +103,15 @@ async function addLintingToApplication(tree, options) {
106
103
  tsConfigPaths: [
107
104
  (0, devkit_1.joinPathFragments)(options.projectRoot, 'tsconfig.app.json'),
108
105
  ],
106
+ eslintFilePatterns: [`${options.projectRoot}/**/*.ts`],
109
107
  unitTestRunner: 'jest',
110
108
  skipFormat: true,
111
109
  setParserOptionsProject: false,
112
- addPlugin: options.addPlugin,
113
110
  });
114
111
  return lintTask;
115
112
  }
116
113
  async function e2eProjectGenerator(host, schema) {
117
114
  return await e2eProjectGeneratorInternal(host, {
118
- addPlugin: false,
119
115
  projectNameAndRootFormat: 'derived',
120
116
  ...schema,
121
117
  });
@@ -53,7 +53,7 @@ function createTestProject() {
53
53
  });
54
54
 
55
55
  execSync(
56
- `<%= packageManagerCommands.exec %> --yes create-nx-workspace@latest ${projectName} --preset apps --nxCloud=skip --no-interactive`,
56
+ `<%= packageManagerCommands.exec %> --yes create-nx-workspace@latest ${projectName} --preset apps --no-nxCloud --no-interactive`,
57
57
  {
58
58
  cwd: dirname(projectDirectory),
59
59
  stdio: 'inherit',
@@ -1,4 +1,4 @@
1
- import type { ProjectNameAndRootFormat } from '@nx/devkit/src/generators/project-name-and-root-utils';
1
+ import type { ProjectNameAndRootFormat } from '@nx/devkit/src/generators/project-name-directory-utils';
2
2
  import type { Linter } from '@nx/eslint';
3
3
 
4
4
  export interface Schema {
@@ -11,5 +11,4 @@ export interface Schema {
11
11
  linter?: Linter;
12
12
  skipFormat?: boolean;
13
13
  rootProject?: boolean;
14
- addPlugin?: boolean;
15
14
  }
@@ -1,5 +1,5 @@
1
1
  {
2
- "$schema": "https://json-schema.org/schema",
2
+ "$schema": "http://json-schema.org/schema",
3
3
  "cli": "nx",
4
4
  "$id": "NxPluginE2E",
5
5
  "title": "Create an E2E app for a Nx Plugin",
@@ -1,5 +1,5 @@
1
1
  {
2
- "$schema": "https://json-schema.org/schema",
2
+ "$schema": "http://json-schema.org/schema",
3
3
  "version": 2,
4
4
  "title": "<%= className %> executor",
5
5
  "description": "",
@@ -11,7 +11,7 @@ export interface Schema {
11
11
  skipFormat?: boolean;
12
12
 
13
13
  /**
14
- * @deprecated Provide the `directory` option instead. The project will be determined from the directory provided. It will be removed in Nx v19.
14
+ * @deprecated Provide the `directory` option instead. The project will be determined from the directory provided. It will be removed in Nx v18.
15
15
  */
16
16
  project?: string;
17
17
  }
@@ -1,5 +1,5 @@
1
1
  {
2
- "$schema": "https://json-schema.org/schema",
2
+ "$schema": "http://json-schema.org/schema",
3
3
  "cli": "nx",
4
4
  "$id": "NxPluginExecutor",
5
5
  "title": "Create an Executor for an Nx Plugin",
@@ -62,7 +62,7 @@
62
62
  "$default": {
63
63
  "$source": "projectName"
64
64
  },
65
- "x-deprecated": "Provide the `directory` option instead and use the `as-provided` format. The project will be determined from the directory provided. It will be removed in Nx v19."
65
+ "x-deprecated": "Provide the `directory` option instead and use the `as-provided` format. The project will be determined from the directory provided. It will be removed in Nx v18."
66
66
  },
67
67
  "skipFormat": {
68
68
  "type": "boolean",
@@ -1,5 +1,5 @@
1
1
  {
2
- "$schema": "https://json-schema.org/schema",
2
+ "$schema": "http://json-schema.org/schema",
3
3
  "$id": "<%= className %>",
4
4
  "title": "",
5
5
  "type": "object",
@@ -10,7 +10,7 @@ export interface Schema {
10
10
  nameAndDirectoryFormat?: NameAndDirectoryFormat;
11
11
 
12
12
  /**
13
- * @deprecated Provide the `directory` option instead. The project will be determined from the directory provided. It will be removed in Nx v19.
13
+ * @deprecated Provide the `directory` option instead. The project will be determined from the directory provided. It will be removed in Nx v18.
14
14
  */
15
15
  project?: string;
16
16
  }
@@ -1,5 +1,5 @@
1
1
  {
2
- "$schema": "https://json-schema.org/schema",
2
+ "$schema": "http://json-schema.org/schema",
3
3
  "cli": "nx",
4
4
  "$id": "NxPluginGenerator",
5
5
  "title": "Create a Generator for an Nx Plugin",
@@ -51,7 +51,7 @@
51
51
  "$default": {
52
52
  "$source": "projectName"
53
53
  },
54
- "x-deprecated": "Provide the `directory` option instead and use the `as-provided` format. The project will be determined from the directory provided. It will be removed in Nx v19."
54
+ "x-deprecated": "Provide the `directory` option instead and use the `as-provided` format. The project will be determined from the directory provided. It will be removed in Nx v18."
55
55
  },
56
56
  "skipFormat": {
57
57
  "type": "boolean",
@@ -10,7 +10,7 @@ async function pluginLintCheckGenerator(host, options) {
10
10
  const project = (0, devkit_1.readProjectConfiguration)(host, options.projectName);
11
11
  const packageJson = (0, devkit_1.readJson)(host, (0, devkit_1.joinPathFragments)(project.root, 'package.json'));
12
12
  // This rule is eslint **only**
13
- if (projectIsEsLintEnabled(host, project)) {
13
+ if (projectIsEsLintEnabled(project)) {
14
14
  updateRootEslintConfig(host);
15
15
  updateProjectEslintConfig(host, project, packageJson);
16
16
  updateProjectTarget(host, options, packageJson);
@@ -18,6 +18,12 @@ async function pluginLintCheckGenerator(host, options) {
18
18
  if (host.exists('.vscode')) {
19
19
  setupVsCodeLintingForJsonFiles(host);
20
20
  }
21
+ // Project contains migrations.json
22
+ const migrationsPath = (0, package_json_1.readNxMigrateConfig)(packageJson).migrations;
23
+ if (migrationsPath &&
24
+ host.exists((0, devkit_1.joinPathFragments)(project.root, migrationsPath))) {
25
+ addMigrationJsonChecks(host, options, packageJson);
26
+ }
21
27
  }
22
28
  else {
23
29
  devkit_1.logger.error(`${logger_1.NX_PREFIX} plugin lint checks can only be added to plugins which use eslint for linting`);
@@ -29,34 +35,31 @@ async function pluginLintCheckGenerator(host, options) {
29
35
  exports.default = pluginLintCheckGenerator;
30
36
  function addMigrationJsonChecks(host, options, packageJson) {
31
37
  const projectConfiguration = (0, devkit_1.readProjectConfiguration)(host, options.projectName);
32
- if (!projectIsEsLintEnabled(host, projectConfiguration)) {
38
+ if (!projectIsEsLintEnabled(projectConfiguration)) {
33
39
  return;
34
40
  }
35
- const [eslintTarget, eslintTargetConfiguration] = getEsLintOptions(projectConfiguration) ?? [];
41
+ const [eslintTarget, eslintTargetConfiguration] = getEsLintOptions(projectConfiguration);
36
42
  const relativeMigrationsJsonPath = (0, package_json_1.readNxMigrateConfig)(packageJson).migrations;
37
43
  if (!relativeMigrationsJsonPath) {
38
44
  return;
39
45
  }
40
46
  const migrationsJsonPath = (0, devkit_1.joinPathFragments)(projectConfiguration.root, relativeMigrationsJsonPath);
41
- if (!eslintTarget) {
42
- return;
43
- }
44
- // Add path to lintFilePatterns if different than default "{projectRoot}"
45
- if (eslintTargetConfiguration.options?.lintFilePatterns &&
46
- !eslintTargetConfiguration.options.lintFilePatterns.includes(migrationsJsonPath)) {
47
+ if (eslintTarget &&
48
+ !eslintTargetConfiguration.options?.lintFilePatterns?.includes(migrationsJsonPath)) {
49
+ // Add to lintFilePatterns
47
50
  eslintTargetConfiguration.options.lintFilePatterns.push(migrationsJsonPath);
48
51
  (0, devkit_1.updateProjectConfiguration)(host, options.projectName, projectConfiguration);
52
+ // Update project level eslintrc
53
+ (0, eslint_file_1.updateOverrideInLintConfig)(host, projectConfiguration.root, (o) => Object.keys(o.rules ?? {})?.includes('@nx/nx-plugin-checks') ||
54
+ Object.keys(o.rules ?? {})?.includes('@nrwl/nx/nx-plugin-checks'), (o) => {
55
+ const fileSet = new Set(Array.isArray(o.files) ? o.files : [o.files]);
56
+ fileSet.add(relativeMigrationsJsonPath);
57
+ return {
58
+ ...o,
59
+ files: Array.from(fileSet),
60
+ };
61
+ });
49
62
  }
50
- // Update project level eslintrc
51
- (0, eslint_file_1.updateOverrideInLintConfig)(host, projectConfiguration.root, (o) => Object.keys(o.rules ?? {})?.includes('@nx/nx-plugin-checks') ||
52
- Object.keys(o.rules ?? {})?.includes('@nrwl/nx/nx-plugin-checks'), (o) => {
53
- const fileSet = new Set(Array.isArray(o.files) ? o.files : [o.files]);
54
- fileSet.add(relativeMigrationsJsonPath);
55
- return {
56
- ...o,
57
- files: Array.from(fileSet),
58
- };
59
- });
60
63
  }
61
64
  exports.addMigrationJsonChecks = addMigrationJsonChecks;
62
65
  function updateProjectTarget(host, options, packageJson) {
@@ -65,9 +68,9 @@ function updateProjectTarget(host, options, packageJson) {
65
68
  return;
66
69
  }
67
70
  for (const [target, configuration] of Object.entries(project.targets)) {
68
- if (configuration.executor === '@nx/eslint:lint' &&
69
- // only add patterns if there are already hardcoded ones
70
- configuration.options?.lintFilePatterns) {
71
+ if (configuration.executor === '@nx/eslint:lint' ||
72
+ configuration.executor === '@nx/linter:eslint' ||
73
+ configuration.executor === '@nrwl/linter:eslint') {
71
74
  const opts = configuration.options ?? {};
72
75
  opts.lintFilePatterns ??= [];
73
76
  if (packageJson.generators) {
@@ -101,7 +104,6 @@ function updateProjectEslintConfig(host, options, packageJson) {
101
104
  packageJson.executors,
102
105
  packageJson.schematics,
103
106
  packageJson.builders,
104
- (0, package_json_1.readNxMigrateConfig)(packageJson).migrations,
105
107
  ].filter((f) => !!f);
106
108
  const parser = (0, flat_config_1.useFlatConfig)(host)
107
109
  ? { languageOptions: { parser: 'jsonc-eslint-parser' } }
@@ -176,8 +178,8 @@ function setupVsCodeLintingForJsonFiles(host) {
176
178
  }
177
179
  (0, devkit_1.writeJson)(host, '.vscode/settings.json', existing);
178
180
  }
179
- function projectIsEsLintEnabled(tree, project) {
180
- return !!(0, eslint_file_1.findEslintFile)(tree, project.root);
181
+ function projectIsEsLintEnabled(project) {
182
+ return !!getEsLintOptions(project);
181
183
  }
182
184
  function getEsLintOptions(project) {
183
185
  return Object.entries(project.targets || {}).find(([, x]) => x.executor === '@nx/eslint:lint' ||
@@ -1,5 +1,5 @@
1
1
  {
2
- "$schema": "https://json-schema.org/schema",
2
+ "$schema": "http://json-schema.org/schema",
3
3
  "cli": "nx",
4
4
  "$id": "PluginLint",
5
5
  "title": "",
@@ -3,11 +3,11 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.migrationGeneratorInternal = exports.migrationGenerator = void 0;
4
4
  const devkit_1 = require("@nx/devkit");
5
5
  const path = require("path");
6
- const path_1 = require("path");
7
6
  const generator_1 = require("../lint-checks/generator");
8
7
  const package_json_1 = require("nx/src/utils/package-json");
9
8
  const versions_1 = require("../../utils/versions");
10
9
  const artifact_name_and_directory_utils_1 = require("@nx/devkit/src/generators/artifact-name-and-directory-utils");
10
+ const path_1 = require("path");
11
11
  async function normalizeOptions(tree, options) {
12
12
  let name;
13
13
  if (options.name) {
@@ -10,7 +10,7 @@ export interface Schema {
10
10
  nameAndDirectoryFormat?: NameAndDirectoryFormat;
11
11
 
12
12
  /**
13
- * @deprecated Provide the `directory` option instead. The project will be determined from the directory provided. It will be removed in Nx v19.
13
+ * @deprecated Provide the `directory` option instead. The project will be determined from the directory provided. It will be removed in Nx v18.
14
14
  */
15
15
  project?: string;
16
16
  }
@@ -1,5 +1,5 @@
1
1
  {
2
- "$schema": "https://json-schema.org/schema",
2
+ "$schema": "http://json-schema.org/schema",
3
3
  "cli": "nx",
4
4
  "$id": "NxPluginMigration",
5
5
  "title": "Create a Migration for an Nx Plugin",
@@ -44,7 +44,7 @@
44
44
  "$default": {
45
45
  "$source": "projectName"
46
46
  },
47
- "x-deprecated": "Provide the `directory` option instead and use the `as-provided` format. The project will be determined from the directory provided. It will be removed in Nx v19."
47
+ "x-deprecated": "Provide the `directory` option instead and use the `as-provided` format. The project will be determined from the directory provided. It will be removed in Nx v18."
48
48
  },
49
49
  "packageJsonUpdates": {
50
50
  "type": "boolean",
@@ -62,13 +62,10 @@ async function pluginGeneratorInternal(host, schema) {
62
62
  const tasks = [];
63
63
  tasks.push(await (0, js_1.libraryGenerator)(host, {
64
64
  ...schema,
65
- name: options.name,
66
- directory: options.projectRoot,
67
65
  config: 'project',
68
66
  bundler: options.bundler,
69
67
  publishable: options.publishable,
70
68
  importPath: options.npmPackageName,
71
- projectNameAndRootFormat: 'as-provided',
72
69
  skipFormat: true,
73
70
  }));
74
71
  if (options.bundler === 'tsc') {
@@ -1,4 +1,4 @@
1
- import type { ProjectNameAndRootFormat } from '@nx/devkit/src/generators/project-name-and-root-utils';
1
+ import type { ProjectNameAndRootFormat } from '@nx/devkit/src/generators/project-name-directory-utils';
2
2
  import type { Linter } from '@nx/eslint';
3
3
 
4
4
  export interface Schema {
@@ -1,5 +1,5 @@
1
1
  {
2
- "$schema": "https://json-schema.org/schema",
2
+ "$schema": "http://json-schema.org/schema",
3
3
  "cli": "nx",
4
4
  "$id": "NxPluginPlugin",
5
5
  "title": "Create a Plugin for Nx",
@@ -1,5 +1,5 @@
1
1
  {
2
- "$schema": "https://json-schema.org/schema",
2
+ "$schema": "http://json-schema.org/schema",
3
3
  "cli": "nx",
4
4
  "$id": "NxPluginPreset",
5
5
  "title": "Generator ran by create-nx-plugin",
@@ -35,9 +35,8 @@ exports.runCommandAsync = runCommandAsync;
35
35
  function runNxCommandAsync(command, opts = {
36
36
  silenceError: false,
37
37
  }) {
38
- const cwd = opts.cwd ?? (0, paths_1.tmpProjPath)();
39
38
  if ((0, utils_1.fileExists)((0, paths_1.tmpProjPath)('package.json'))) {
40
- const pmc = (0, devkit_1.getPackageManagerCommand)((0, devkit_1.detectPackageManager)(cwd));
39
+ const pmc = (0, devkit_1.getPackageManagerCommand)();
41
40
  return runCommandAsync(`${pmc.exec} nx ${command}`, opts);
42
41
  }
43
42
  else if (process.platform === 'win32') {
@@ -16,13 +16,12 @@ function runNxCommand(command, opts = {
16
16
  silenceError: false,
17
17
  }) {
18
18
  function _runNxCommand(c) {
19
- const cwd = opts.cwd ?? (0, paths_1.tmpProjPath)();
20
19
  const execSyncOptions = {
21
- cwd,
20
+ cwd: opts.cwd ?? (0, paths_1.tmpProjPath)(),
22
21
  env: { ...process.env, ...opts.env },
23
22
  };
24
23
  if ((0, utils_1.fileExists)((0, paths_1.tmpProjPath)('package.json'))) {
25
- const pmc = (0, devkit_1.getPackageManagerCommand)((0, devkit_1.detectPackageManager)(cwd));
24
+ const pmc = (0, devkit_1.getPackageManagerCommand)();
26
25
  return (0, child_process_1.execSync)(`${pmc.exec} nx ${command}`, execSyncOptions);
27
26
  }
28
27
  else if (process.platform === 'win32') {
@@ -37,10 +37,9 @@ exports.uniq = uniq;
37
37
  * @param silent silent output from the install
38
38
  */
39
39
  function runPackageManagerInstall(silent = true) {
40
- const cwd = (0, paths_1.tmpProjPath)();
41
- const pmc = (0, devkit_2.getPackageManagerCommand)((0, devkit_1.detectPackageManager)(cwd));
40
+ const pmc = (0, devkit_2.getPackageManagerCommand)();
42
41
  const install = (0, child_process_1.execSync)(pmc.install, {
43
- cwd,
42
+ cwd: (0, paths_1.tmpProjPath)(),
44
43
  ...(silent ? { stdio: ['ignore', 'ignore', 'ignore'] } : {}),
45
44
  });
46
45
  return install ? install.toString() : '';