@nx/plugin 21.2.3 → 21.3.0-beta.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nx/plugin",
3
- "version": "21.2.3",
3
+ "version": "21.3.0-beta.1",
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": {
@@ -28,10 +28,10 @@
28
28
  },
29
29
  "dependencies": {
30
30
  "tslib": "^2.3.0",
31
- "@nx/devkit": "21.2.3",
32
- "@nx/jest": "21.2.3",
33
- "@nx/js": "21.2.3",
34
- "@nx/eslint": "21.2.3"
31
+ "@nx/devkit": "21.3.0-beta.1",
32
+ "@nx/jest": "21.3.0-beta.1",
33
+ "@nx/js": "21.3.0-beta.1",
34
+ "@nx/eslint": "21.3.0-beta.1"
35
35
  },
36
36
  "publishConfig": {
37
37
  "access": "public"
@@ -131,7 +131,7 @@ function addE2eProject(host, options) {
131
131
  const e2eProjectConfiguration = (0, devkit_1.readProjectConfiguration)(host, options.e2eProject);
132
132
  const projectConfiguration = (0, devkit_1.readProjectConfiguration)(host, options.project);
133
133
  const { name: pluginPackageName } = (0, devkit_1.readJson)(host, (0, path_1.join)(projectConfiguration.root, 'package.json'));
134
- (0, devkit_1.generateFiles)(host, (0, devkit_1.joinPathFragments)(__dirname, './files/e2e'), (0, ts_solution_setup_1.getProjectSourceRoot)(e2eProjectConfiguration, host), {
134
+ (0, devkit_1.generateFiles)(host, (0, devkit_1.joinPathFragments)(__dirname, './files/e2e'), e2eProjectConfiguration.sourceRoot, {
135
135
  pluginName: options.project,
136
136
  cliName: options.name,
137
137
  packageManagerCommands: (0, devkit_1.getPackageManagerCommand)(),
@@ -97,18 +97,16 @@ async function addJest(host, options) {
97
97
  (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));
98
98
  const project = (0, devkit_1.readProjectConfiguration)(host, options.projectName);
99
99
  project.targets ??= {};
100
- if (project.targets.e2e) {
101
- const e2eTarget = project.targets.e2e;
102
- project.targets.e2e = {
103
- ...e2eTarget,
104
- dependsOn: [`^build`],
105
- options: {
106
- ...e2eTarget.options,
107
- runInBand: true,
108
- },
109
- };
110
- (0, devkit_1.updateProjectConfiguration)(host, options.projectName, project);
111
- }
100
+ const e2eTarget = project.targets.e2e;
101
+ project.targets.e2e = {
102
+ ...e2eTarget,
103
+ dependsOn: [`^build`],
104
+ options: {
105
+ ...e2eTarget.options,
106
+ runInBand: true,
107
+ },
108
+ };
109
+ (0, devkit_1.updateProjectConfiguration)(host, options.projectName, project);
112
110
  return jestTask;
113
111
  }
114
112
  async function addLintingToApplication(tree, options) {
@@ -6,7 +6,6 @@ const devkit_1 = require("@nx/devkit");
6
6
  const js_1 = require("@nx/js");
7
7
  const add_swc_dependencies_1 = require("@nx/js/src/utils/swc/add-swc-dependencies");
8
8
  const add_tslib_dependencies_1 = require("@nx/js/src/utils/typescript/add-tslib-dependencies");
9
- const ts_solution_setup_1 = require("@nx/js/src/utils/typescript/ts-solution-setup");
10
9
  const path = require("path");
11
10
  const e2e_1 = require("../e2e-project/e2e");
12
11
  const generator_1 = require("../lint-checks/generator");
@@ -23,7 +22,8 @@ function updatePluginConfig(host, options) {
23
22
  const project = (0, devkit_1.readProjectConfiguration)(host, options.projectName);
24
23
  if (project.targets.build) {
25
24
  if (options.isTsSolutionSetup && options.bundler === 'tsc') {
26
- project.targets.build.options.rootDir = (0, ts_solution_setup_1.getProjectSourceRoot)(project, host);
25
+ project.targets.build.options.rootDir =
26
+ project.sourceRoot ?? (0, devkit_1.joinPathFragments)(project.root, 'src');
27
27
  project.targets.build.options.generatePackageJson = false;
28
28
  }
29
29
  project.targets.build.options.assets = [
@@ -2,7 +2,6 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.getArtifactMetadataDirectory = getArtifactMetadataDirectory;
4
4
  const devkit_1 = require("@nx/devkit");
5
- const ts_solution_setup_1 = require("@nx/js/src/utils/typescript/ts-solution-setup");
6
5
  const posix_1 = require("node:path/posix");
7
6
  function getArtifactMetadataDirectory(tree, projectName, sourceDirectory, isTsSolutionSetup) {
8
7
  const project = (0, devkit_1.readProjectConfiguration)(tree, projectName);
@@ -24,6 +23,9 @@ function getArtifactMetadataDirectory(tree, projectName, sourceDirectory, isTsSo
24
23
  // unless the user manually changed the build process. In that case, we can't
25
24
  // reliably determine the output directory because it depends on the build
26
25
  // tool, so we'll just assume some defaults.
27
- const baseDir = (0, ts_solution_setup_1.getProjectSourceRoot)(project, tree);
26
+ const baseDir = project.sourceRoot ??
27
+ (tree.exists((0, posix_1.join)(project.root, 'src'))
28
+ ? (0, posix_1.join)(project.root, 'src')
29
+ : project.root);
28
30
  return `./${(0, posix_1.join)('dist', (0, posix_1.relative)(baseDir, sourceDirectory))}`;
29
31
  }