@nx/plugin 23.2.0-beta.4 → 23.2.0-beta.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.
@@ -5,11 +5,11 @@ exports.createPackageGeneratorInternal = createPackageGeneratorInternal;
5
5
  const devkit_1 = require("@nx/devkit");
6
6
  const js_1 = require("@nx/js");
7
7
  const internal_1 = require("@nx/js/internal");
8
- const versions_1 = require("nx/src/utils/versions");
9
8
  const path_1 = require("path");
10
9
  const has_generator_1 = require("../../utils/has-generator");
11
10
  const generator_1 = require("../generator/generator");
12
11
  const normalize_schema_1 = require("./utils/normalize-schema");
12
+ const internal_2 = require("@nx/devkit/internal");
13
13
  async function createPackageGenerator(host, schema) {
14
14
  return await createPackageGeneratorInternal(host, {
15
15
  useProjectJson: true,
@@ -25,7 +25,7 @@ async function createPackageGeneratorInternal(host, schema) {
25
25
  tasks.push((0, js_1.addTsLibDependencies)(host));
26
26
  }
27
27
  const installTask = (0, devkit_1.addDependenciesToPackageJson)(host, {
28
- 'create-nx-workspace': versions_1.nxVersion,
28
+ 'create-nx-workspace': internal_2.nxVersion,
29
29
  }, {});
30
30
  tasks.push(installTask);
31
31
  const cliPackageTask = await createCliPackage(host, options, pluginPackageName);
@@ -86,7 +86,7 @@ async function createCliPackage(host, options, pluginPackageName) {
86
86
  delete packageJson.exports;
87
87
  }
88
88
  packageJson.dependencies = {
89
- 'create-nx-workspace': versions_1.nxVersion,
89
+ 'create-nx-workspace': internal_2.nxVersion,
90
90
  ...(options.bundler === 'tsc' && { tslib: internal_1.tsLibVersion }),
91
91
  };
92
92
  return packageJson;
@@ -16,6 +16,8 @@ describe('<%= cliName %>', () => {
16
16
  });
17
17
 
18
18
 
19
+ // This test shells out synchronously, so its budget has to cover a cold
20
+ // package manager cache. Otherwise work that succeeded still fails on return.
19
21
  it('should be installed', () => {
20
22
  projectDirectory = createTestProject();
21
23
 
@@ -24,7 +26,7 @@ describe('<%= cliName %>', () => {
24
26
  cwd: projectDirectory,
25
27
  stdio: 'inherit',
26
28
  });
27
- });
29
+ }, 180_000);
28
30
  });
29
31
 
30
32
  /**
@@ -202,17 +202,16 @@ export { default as teardown } from './stop-local-registry';
202
202
  project.targets ??= {};
203
203
  if (project.targets.e2e) {
204
204
  const e2eTarget = project.targets.e2e;
205
+ // The suites share a single tmp/test-project directory, so they have to run
206
+ // one at a time. Vitest 4 removed `poolOptions`, and nested options do not
207
+ // survive the executor's argv round-trip anyway, so use the scalar options.
205
208
  project.targets.e2e = {
206
209
  ...e2eTarget,
207
210
  dependsOn: [`^build`],
208
211
  options: {
209
212
  ...e2eTarget.options,
210
- pool: 'forks',
211
- poolOptions: {
212
- forks: {
213
- singleFork: true,
214
- },
215
- },
213
+ maxWorkers: 1,
214
+ isolate: false,
216
215
  },
217
216
  };
218
217
  (0, devkit_1.updateProjectConfiguration)(host, options.projectName, project);
@@ -5,6 +5,9 @@ import { mkdirSync, rmSync } from 'fs';
5
5
  describe('<%= pluginName %>', () => {
6
6
  let projectDirectory: string;
7
7
 
8
+ // This hook shells out synchronously twice, so its budget has to cover both
9
+ // installs on a cold package manager cache. Otherwise work that succeeded
10
+ // still fails on return.
8
11
  beforeAll(() => {
9
12
  projectDirectory = createTestProject();
10
13
 
@@ -15,7 +18,7 @@ describe('<%= pluginName %>', () => {
15
18
  stdio: 'inherit',
16
19
  env: process.env,
17
20
  });
18
- }, 30_000);
21
+ }, 300_000);
19
22
 
20
23
  afterAll(() => {
21
24
  if (projectDirectory) {
@@ -1,7 +1,7 @@
1
1
  import { ProjectConfiguration, TargetConfiguration, Tree } from '@nx/devkit';
2
2
  import type { Schema as EsLintExecutorOptions } from '@nx/eslint/internal';
3
3
  import { PluginLintChecksGeneratorSchema } from './schema';
4
- import { PackageJson } from 'nx/src/utils/package-json';
4
+ import { PackageJson } from '@nx/devkit/internal';
5
5
  export default function pluginLintCheckGenerator(host: Tree, options: PluginLintChecksGeneratorSchema): Promise<void>;
6
6
  export declare function addMigrationJsonChecks(host: Tree, options: PluginLintChecksGeneratorSchema, packageJson: PackageJson): void;
7
7
  export declare function getEsLintOptions(project: ProjectConfiguration): [target: string, configuration: TargetConfiguration<EsLintExecutorOptions>];
@@ -4,9 +4,8 @@ exports.default = pluginLintCheckGenerator;
4
4
  exports.addMigrationJsonChecks = addMigrationJsonChecks;
5
5
  exports.getEsLintOptions = getEsLintOptions;
6
6
  const devkit_1 = require("@nx/devkit");
7
- const logger_1 = require("nx/src/utils/logger");
8
- const package_json_1 = require("nx/src/utils/package-json");
9
7
  const internal_1 = require("@nx/eslint/internal");
8
+ const internal_2 = require("@nx/devkit/internal");
10
9
  async function pluginLintCheckGenerator(host, options) {
11
10
  const project = (0, devkit_1.readProjectConfiguration)(host, options.projectName);
12
11
  const packageJson = (0, devkit_1.readJson)(host, (0, devkit_1.joinPathFragments)(project.root, 'package.json'));
@@ -21,7 +20,7 @@ async function pluginLintCheckGenerator(host, options) {
21
20
  }
22
21
  }
23
22
  else {
24
- devkit_1.logger.error(`${logger_1.NX_PREFIX} plugin lint checks can only be added to plugins which use eslint for linting`);
23
+ devkit_1.logger.error(`${internal_2.NX_PREFIX} plugin lint checks can only be added to plugins which use eslint for linting`);
25
24
  }
26
25
  if (!options.skipFormat) {
27
26
  await (0, devkit_1.formatFiles)(host);
@@ -33,7 +32,7 @@ function addMigrationJsonChecks(host, options, packageJson) {
33
32
  return;
34
33
  }
35
34
  const [eslintTarget, eslintTargetConfiguration] = getEsLintOptions(projectConfiguration) ?? [];
36
- const relativeMigrationsJsonPath = (0, package_json_1.readNxMigrateConfig)(packageJson).migrations;
35
+ const relativeMigrationsJsonPath = (0, internal_2.readNxMigrateConfig)(packageJson).migrations;
37
36
  if (!relativeMigrationsJsonPath) {
38
37
  return;
39
38
  }
@@ -129,7 +128,7 @@ function updateProjectEslintConfig(host, options, packageJson) {
129
128
  packageJson.executors,
130
129
  packageJson.schematics,
131
130
  packageJson.builders,
132
- (0, package_json_1.readNxMigrateConfig)(packageJson).migrations,
131
+ (0, internal_2.readNxMigrateConfig)(packageJson).migrations,
133
132
  ].filter((f) => !!f);
134
133
  const parser = (0, internal_1.useFlatConfig)(host)
135
134
  ? { languageOptions: { parser: 'jsonc-eslint-parser' } }
@@ -195,7 +194,7 @@ function setupVsCodeLintingForJsonFiles(host) {
195
194
  existing = (0, devkit_1.readJson)(host, '.vscode/settings.json');
196
195
  }
197
196
  else {
198
- devkit_1.logger.info(`${logger_1.NX_PREFIX} We've updated the vscode settings for this repository to ensure that plugin lint checks show up inside your IDE. This created .vscode/settings.json. To read more about this file, check vscode's documentation. It is frequently not committed, so other developers may need to add similar settings if they'd like to see the lint checks in the IDE rather than only during linting.`);
197
+ devkit_1.logger.info(`${internal_2.NX_PREFIX} We've updated the vscode settings for this repository to ensure that plugin lint checks show up inside your IDE. This created .vscode/settings.json. To read more about this file, check vscode's documentation. It is frequently not committed, so other developers may need to add similar settings if they'd like to see the lint checks in the IDE rather than only during linting.`);
199
198
  }
200
199
  // setup eslint validation for json files
201
200
  const eslintValidate = existing['eslint.validate'] ?? [];
@@ -5,7 +5,6 @@ const internal_1 = require("@nx/devkit/internal");
5
5
  const devkit_1 = require("@nx/devkit");
6
6
  const internal_2 = require("@nx/js/internal");
7
7
  const node_path_1 = require("node:path");
8
- const package_json_1 = require("nx/src/utils/package-json");
9
8
  const paths_1 = require("../../utils/paths");
10
9
  const versions_1 = require("../../utils/versions");
11
10
  const generator_1 = require("../lint-checks/generator");
@@ -38,7 +37,7 @@ function addFiles(host, options) {
38
37
  });
39
38
  }
40
39
  function updateMigrationsJson(host, options) {
41
- const configuredMigrationPath = (0, package_json_1.readNxMigrateConfig)((0, devkit_1.readJson)(host, (0, devkit_1.joinPathFragments)(options.projectRoot, 'package.json'))).migrations;
40
+ const configuredMigrationPath = (0, internal_1.readNxMigrateConfig)((0, devkit_1.readJson)(host, (0, devkit_1.joinPathFragments)(options.projectRoot, 'package.json'))).migrations;
42
41
  const migrationsPath = (0, devkit_1.joinPathFragments)(options.projectRoot, configuredMigrationPath ?? 'migrations.json');
43
42
  const migrations = host.exists(migrationsPath)
44
43
  ? (0, devkit_1.readJson)(host, migrationsPath)
@@ -1,5 +1,5 @@
1
1
  import type { JsonParseOptions } from '@nx/devkit';
2
- import { directoryExists, fileExists } from 'nx/src/utils/fileutils';
2
+ import { directoryExists, fileExists } from '@nx/devkit/internal';
3
3
  export { directoryExists, fileExists };
4
4
  /**
5
5
  * Copies module folders from the working directory to the e2e directory
@@ -19,9 +19,9 @@ const node_fs_1 = require("node:fs");
19
19
  const path_1 = require("path");
20
20
  const paths_1 = require("./paths");
21
21
  const devkit_1 = require("@nx/devkit");
22
- const fileutils_1 = require("nx/src/utils/fileutils");
23
- Object.defineProperty(exports, "directoryExists", { enumerable: true, get: function () { return fileutils_1.directoryExists; } });
24
- Object.defineProperty(exports, "fileExists", { enumerable: true, get: function () { return fileutils_1.fileExists; } });
22
+ const internal_1 = require("@nx/devkit/internal");
23
+ Object.defineProperty(exports, "directoryExists", { enumerable: true, get: function () { return internal_1.directoryExists; } });
24
+ Object.defineProperty(exports, "fileExists", { enumerable: true, get: function () { return internal_1.fileExists; } });
25
25
  /**
26
26
  * Copies module folders from the working directory to the e2e directory
27
27
  * @param modules a list of module names or scopes to copy
@@ -136,7 +136,7 @@ function getCwd() {
136
136
  * @param path Path to file or directory
137
137
  */
138
138
  function exists(path) {
139
- return (0, fileutils_1.directoryExists)(path) || (0, fileutils_1.fileExists)(path);
139
+ return (0, internal_1.directoryExists)(path) || (0, internal_1.fileExists)(path);
140
140
  }
141
141
  /**
142
142
  * Get the size of a file on disk
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nx/plugin",
3
- "version": "23.2.0-beta.4",
3
+ "version": "23.2.0-beta.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": {
@@ -36,16 +36,16 @@
36
36
  },
37
37
  "dependencies": {
38
38
  "tslib": "^2.3.0",
39
- "@nx/devkit": "23.2.0-beta.4",
40
- "@nx/jest": "23.2.0-beta.4",
41
- "@nx/js": "23.2.0-beta.4",
42
- "@nx/eslint": "23.2.0-beta.4"
39
+ "@nx/devkit": "23.2.0-beta.6",
40
+ "@nx/jest": "23.2.0-beta.6",
41
+ "@nx/eslint": "23.2.0-beta.6",
42
+ "@nx/js": "23.2.0-beta.6"
43
43
  },
44
44
  "devDependencies": {
45
- "nx": "23.2.0-beta.4"
45
+ "nx": "23.2.0-beta.6"
46
46
  },
47
47
  "peerDependencies": {
48
- "@nx/vitest": "23.2.0-beta.4"
48
+ "@nx/vitest": "23.2.0-beta.6"
49
49
  },
50
50
  "peerDependenciesMeta": {
51
51
  "@nx/vitest": {