@nx/plugin 23.0.0-beta.2 → 23.0.0-beta.20
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 +6 -6
- package/src/generators/create-package/create-package.d.ts.map +1 -1
- package/src/generators/create-package/create-package.js +8 -10
- package/src/generators/create-package/utils/normalize-schema.d.ts.map +1 -1
- package/src/generators/create-package/utils/normalize-schema.js +7 -8
- package/src/generators/e2e-project/e2e.d.ts.map +1 -1
- package/src/generators/e2e-project/e2e.js +8 -11
- package/src/generators/executor/executor.d.ts.map +1 -1
- package/src/generators/executor/executor.js +4 -4
- package/src/generators/executor/files/executor/__fileName__.ts.template +2 -2
- package/src/generators/executor/files/hasher/hasher.spec.ts.template +2 -1
- package/src/generators/executor/files/hasher/hasher.ts.template +1 -1
- package/src/generators/generator/files/generator/__fileName__.ts.template +2 -2
- package/src/generators/generator/generator.d.ts.map +1 -1
- package/src/generators/generator/generator.js +4 -4
- package/src/generators/lint-checks/generator.d.ts +1 -1
- package/src/generators/lint-checks/generator.d.ts.map +1 -1
- package/src/generators/lint-checks/generator.js +31 -13
- package/src/generators/migration/files/migration/__fileName__.ts__tmpl__ +1 -1
- package/src/generators/migration/migration.d.ts.map +1 -1
- package/src/generators/migration/migration.js +4 -4
- package/src/generators/plugin/plugin.d.ts.map +1 -1
- package/src/generators/plugin/plugin.js +13 -8
- package/src/generators/plugin/utils/normalize-schema.d.ts.map +1 -1
- package/src/generators/plugin/utils/normalize-schema.js +8 -9
- package/src/utils/paths.js +2 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nx/plugin",
|
|
3
|
-
"version": "23.0.0-beta.
|
|
3
|
+
"version": "23.0.0-beta.20",
|
|
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": {
|
|
@@ -29,13 +29,13 @@
|
|
|
29
29
|
},
|
|
30
30
|
"dependencies": {
|
|
31
31
|
"tslib": "^2.3.0",
|
|
32
|
-
"@nx/devkit": "23.0.0-beta.
|
|
33
|
-
"@nx/jest": "23.0.0-beta.
|
|
34
|
-
"@nx/js": "23.0.0-beta.
|
|
35
|
-
"@nx/eslint": "23.0.0-beta.
|
|
32
|
+
"@nx/devkit": "23.0.0-beta.20",
|
|
33
|
+
"@nx/jest": "23.0.0-beta.20",
|
|
34
|
+
"@nx/js": "23.0.0-beta.20",
|
|
35
|
+
"@nx/eslint": "23.0.0-beta.20"
|
|
36
36
|
},
|
|
37
37
|
"devDependencies": {
|
|
38
|
-
"nx": "23.0.0-beta.
|
|
38
|
+
"nx": "23.0.0-beta.20"
|
|
39
39
|
},
|
|
40
40
|
"publishConfig": {
|
|
41
41
|
"access": "public"
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create-package.d.ts","sourceRoot":"","sources":["../../../../../../packages/plugin/src/generators/create-package/create-package.ts"],"names":[],"mappings":"AAAA,OAAO,EAIL,iBAAiB,EAMjB,IAAI,EAGL,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"create-package.d.ts","sourceRoot":"","sources":["../../../../../../packages/plugin/src/generators/create-package/create-package.ts"],"names":[],"mappings":"AAAA,OAAO,EAIL,iBAAiB,EAMjB,IAAI,EAGL,MAAM,YAAY,CAAC;AAepB,OAAO,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAC;AAG/C,wBAAsB,sBAAsB,CAC1C,IAAI,EAAE,IAAI,EACV,MAAM,EAAE,mBAAmB,8BAO5B;AAED,wBAAsB,8BAA8B,CAClD,IAAI,EAAE,IAAI,EACV,MAAM,EAAE,mBAAmB,8BAoC5B;AAwJD,eAAe,sBAAsB,CAAC"}
|
|
@@ -4,10 +4,8 @@ exports.createPackageGenerator = createPackageGenerator;
|
|
|
4
4
|
exports.createPackageGeneratorInternal = createPackageGeneratorInternal;
|
|
5
5
|
const devkit_1 = require("@nx/devkit");
|
|
6
6
|
const js_1 = require("@nx/js");
|
|
7
|
-
const
|
|
8
|
-
const
|
|
9
|
-
const versions_1 = require("@nx/js/src/utils/versions");
|
|
10
|
-
const versions_2 = require("nx/src/utils/versions");
|
|
7
|
+
const internal_1 = require("@nx/js/internal");
|
|
8
|
+
const versions_1 = require("nx/src/utils/versions");
|
|
11
9
|
const path_1 = require("path");
|
|
12
10
|
const has_generator_1 = require("../../utils/has-generator");
|
|
13
11
|
const generator_1 = require("../generator/generator");
|
|
@@ -24,10 +22,10 @@ async function createPackageGeneratorInternal(host, schema) {
|
|
|
24
22
|
const options = await (0, normalize_schema_1.normalizeSchema)(host, schema);
|
|
25
23
|
const pluginPackageName = await addPresetGenerator(host, options);
|
|
26
24
|
if (options.bundler === 'tsc') {
|
|
27
|
-
tasks.push((0,
|
|
25
|
+
tasks.push((0, js_1.addTsLibDependencies)(host));
|
|
28
26
|
}
|
|
29
27
|
const installTask = (0, devkit_1.addDependenciesToPackageJson)(host, {
|
|
30
|
-
'create-nx-workspace':
|
|
28
|
+
'create-nx-workspace': versions_1.nxVersion,
|
|
31
29
|
}, {});
|
|
32
30
|
tasks.push(installTask);
|
|
33
31
|
const cliPackageTask = await createCliPackage(host, options, pluginPackageName);
|
|
@@ -73,7 +71,7 @@ async function createCliPackage(host, options, pluginPackageName) {
|
|
|
73
71
|
useTscExecutor: true,
|
|
74
72
|
});
|
|
75
73
|
host.delete((0, devkit_1.joinPathFragments)(options.projectRoot, 'src'));
|
|
76
|
-
const isTsSolutionSetup = (0,
|
|
74
|
+
const isTsSolutionSetup = (0, internal_1.isUsingTsSolutionSetup)(host);
|
|
77
75
|
// Add the bin entry to the package.json
|
|
78
76
|
(0, devkit_1.updateJson)(host, (0, devkit_1.joinPathFragments)(options.projectRoot, 'package.json'), (packageJson) => {
|
|
79
77
|
packageJson.bin = {
|
|
@@ -88,8 +86,8 @@ async function createCliPackage(host, options, pluginPackageName) {
|
|
|
88
86
|
delete packageJson.exports;
|
|
89
87
|
}
|
|
90
88
|
packageJson.dependencies = {
|
|
91
|
-
'create-nx-workspace':
|
|
92
|
-
...(options.bundler === 'tsc' && { tslib:
|
|
89
|
+
'create-nx-workspace': versions_1.nxVersion,
|
|
90
|
+
...(options.bundler === 'tsc' && { tslib: internal_1.tsLibVersion }),
|
|
93
91
|
};
|
|
94
92
|
return packageJson;
|
|
95
93
|
});
|
|
@@ -131,7 +129,7 @@ function addE2eProject(host, options) {
|
|
|
131
129
|
const e2eProjectConfiguration = (0, devkit_1.readProjectConfiguration)(host, options.e2eProject);
|
|
132
130
|
const projectConfiguration = (0, devkit_1.readProjectConfiguration)(host, options.project);
|
|
133
131
|
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,
|
|
132
|
+
(0, devkit_1.generateFiles)(host, (0, devkit_1.joinPathFragments)(__dirname, './files/e2e'), (0, internal_1.getProjectSourceRoot)(e2eProjectConfiguration, host), {
|
|
135
133
|
pluginName: options.project,
|
|
136
134
|
cliName: options.name,
|
|
137
135
|
packageManagerCommands: (0, devkit_1.getPackageManagerCommand)(),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"normalize-schema.d.ts","sourceRoot":"","sources":["../../../../../../../packages/plugin/src/generators/create-package/utils/normalize-schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAc,IAAI,EAAE,MAAM,YAAY,CAAC;AAE9C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"normalize-schema.d.ts","sourceRoot":"","sources":["../../../../../../../packages/plugin/src/generators/create-package/utils/normalize-schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAc,IAAI,EAAE,MAAM,YAAY,CAAC;AAE9C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAO7C,OAAO,EAAE,mBAAmB,EAAE,MAAM,WAAW,CAAC;AAEhD,MAAM,WAAW,gBAAiB,SAAQ,mBAAmB;IAC3D,OAAO,EAAE,KAAK,GAAG,KAAK,CAAC;IACvB,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,MAAM,CAAC;IACpB,cAAc,EAAE,MAAM,GAAG,QAAQ,GAAG,MAAM,CAAC;IAC3C,MAAM,EAAE,UAAU,CAAC;IACnB,cAAc,EAAE,OAAO,CAAC;IACxB,SAAS,EAAE,OAAO,CAAC;IACnB,iBAAiB,EAAE,OAAO,CAAC;CAC5B;AAED,wBAAsB,eAAe,CACnC,IAAI,EAAE,IAAI,EACV,MAAM,EAAE,mBAAmB,GAC1B,OAAO,CAAC,gBAAgB,CAAC,CAkD3B"}
|
|
@@ -2,16 +2,15 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.normalizeSchema = normalizeSchema;
|
|
4
4
|
const devkit_1 = require("@nx/devkit");
|
|
5
|
-
const
|
|
6
|
-
const
|
|
7
|
-
const ts_solution_setup_1 = require("@nx/js/src/utils/typescript/ts-solution-setup");
|
|
5
|
+
const internal_1 = require("@nx/devkit/internal");
|
|
6
|
+
const internal_2 = require("@nx/js/internal");
|
|
8
7
|
async function normalizeSchema(host, schema) {
|
|
9
|
-
const linter = await (0,
|
|
10
|
-
const unitTestRunner = await (0,
|
|
8
|
+
const linter = await (0, internal_2.normalizeLinterOption)(host, schema.linter);
|
|
9
|
+
const unitTestRunner = await (0, internal_2.normalizeUnitTestRunnerOption)(host, schema.unitTestRunner, ['jest']);
|
|
11
10
|
if (!schema.directory) {
|
|
12
11
|
throw new Error(`Please provide the --directory option. It should be the directory containing the project '${schema.project}'.`);
|
|
13
12
|
}
|
|
14
|
-
const { projectName, names: projectNames, projectRoot, } = await (0,
|
|
13
|
+
const { projectName, names: projectNames, projectRoot, } = await (0, internal_1.determineProjectNameAndRootOptions)(host, {
|
|
15
14
|
name: schema.name,
|
|
16
15
|
projectType: 'library',
|
|
17
16
|
directory: schema.directory,
|
|
@@ -20,8 +19,8 @@ async function normalizeSchema(host, schema) {
|
|
|
20
19
|
// jsLibraryGenerator, so, if the TS solution setup is not configured, we
|
|
21
20
|
// additionally check if the TS solution setup will be configured by the
|
|
22
21
|
// jsLibraryGenerator
|
|
23
|
-
const isTsSolutionSetup = (0,
|
|
24
|
-
(0,
|
|
22
|
+
const isTsSolutionSetup = (0, internal_2.isUsingTsSolutionSetup)(host) ||
|
|
23
|
+
(0, internal_2.shouldConfigureTsSolutionSetup)(host, schema.addPlugin);
|
|
25
24
|
const nxJson = (0, devkit_1.readNxJson)(host);
|
|
26
25
|
const addPlugin = schema.addPlugin ??
|
|
27
26
|
(isTsSolutionSetup &&
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"e2e.d.ts","sourceRoot":"","sources":["../../../../../../packages/plugin/src/generators/e2e-project/e2e.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"e2e.d.ts","sourceRoot":"","sources":["../../../../../../packages/plugin/src/generators/e2e-project/e2e.ts"],"names":[],"mappings":"AACA,OAAO,EAeL,KAAK,iBAAiB,EAEtB,KAAK,IAAI,EACV,MAAM,YAAY,CAAC;AAgBpB,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AA+LvC,wBAAsB,mBAAmB,CAAC,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,8BAMnE;AAED,wBAAsB,2BAA2B,CAAC,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,8BA8C3E;AAED,eAAe,mBAAmB,CAAC"}
|
|
@@ -2,25 +2,22 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.e2eProjectGenerator = e2eProjectGenerator;
|
|
4
4
|
exports.e2eProjectGeneratorInternal = e2eProjectGeneratorInternal;
|
|
5
|
+
const internal_1 = require("@nx/devkit/internal");
|
|
5
6
|
const devkit_1 = require("@nx/devkit");
|
|
6
|
-
const project_name_and_root_utils_1 = require("@nx/devkit/src/generators/project-name-and-root-utils");
|
|
7
7
|
const eslint_1 = require("@nx/eslint");
|
|
8
8
|
const jest_1 = require("@nx/jest");
|
|
9
9
|
const js_1 = require("@nx/js");
|
|
10
|
-
const
|
|
11
|
-
const add_local_registry_scripts_1 = require("@nx/js/src/utils/add-local-registry-scripts");
|
|
12
|
-
const generator_prompts_1 = require("@nx/js/src/utils/generator-prompts");
|
|
13
|
-
const ts_solution_setup_1 = require("@nx/js/src/utils/typescript/ts-solution-setup");
|
|
10
|
+
const internal_2 = require("@nx/js/internal");
|
|
14
11
|
const path_1 = require("path");
|
|
15
12
|
async function normalizeOptions(host, options) {
|
|
16
|
-
const linter = await (0,
|
|
13
|
+
const linter = await (0, internal_2.normalizeLinterOption)(host, options.linter);
|
|
17
14
|
const projectName = options.rootProject ? 'e2e' : `${options.pluginName}-e2e`;
|
|
18
15
|
const nxJson = (0, devkit_1.readNxJson)(host);
|
|
19
16
|
const addPlugin = options.addPlugin ??
|
|
20
17
|
(process.env.NX_ADD_PLUGINS !== 'false' &&
|
|
21
18
|
nxJson.useInferencePlugins !== false);
|
|
22
19
|
let projectRoot;
|
|
23
|
-
const projectNameAndRootOptions = await (0,
|
|
20
|
+
const projectNameAndRootOptions = await (0, internal_1.determineProjectNameAndRootOptions)(host, {
|
|
24
21
|
name: projectName,
|
|
25
22
|
projectType: 'application',
|
|
26
23
|
directory: options.rootProject || !options.projectDirectory
|
|
@@ -29,7 +26,7 @@ async function normalizeOptions(host, options) {
|
|
|
29
26
|
});
|
|
30
27
|
projectRoot = projectNameAndRootOptions.projectRoot;
|
|
31
28
|
const pluginPropertyName = (0, devkit_1.names)(options.pluginName).propertyName;
|
|
32
|
-
const isTsSolutionSetup = (0,
|
|
29
|
+
const isTsSolutionSetup = (0, internal_2.isUsingTsSolutionSetup)(host);
|
|
33
30
|
return {
|
|
34
31
|
...options,
|
|
35
32
|
projectName,
|
|
@@ -92,7 +89,7 @@ async function addJest(host, options) {
|
|
|
92
89
|
addPlugin: options.addPlugin,
|
|
93
90
|
compiler: options.isTsSolutionSetup ? 'swc' : undefined,
|
|
94
91
|
});
|
|
95
|
-
const { startLocalRegistryPath, stopLocalRegistryPath } = (0,
|
|
92
|
+
const { startLocalRegistryPath, stopLocalRegistryPath } = (0, internal_2.addLocalRegistryScripts)(host);
|
|
96
93
|
const jestConfigPath = (0, jest_1.findJestConfig)(host, options.projectRoot);
|
|
97
94
|
if (!jestConfigPath) {
|
|
98
95
|
throw new Error(`Could not find Jest config for project ${options.projectName} at ${options.projectRoot}`);
|
|
@@ -149,7 +146,7 @@ async function e2eProjectGeneratorInternal(host, schema) {
|
|
|
149
146
|
validatePlugin(host, schema.pluginName);
|
|
150
147
|
const options = await normalizeOptions(host, schema);
|
|
151
148
|
addFiles(host, options);
|
|
152
|
-
tasks.push(await (0,
|
|
149
|
+
tasks.push(await (0, js_1.setupVerdaccio)(host, {
|
|
153
150
|
skipFormat: true,
|
|
154
151
|
}));
|
|
155
152
|
tasks.push(await addJest(host, options));
|
|
@@ -174,7 +171,7 @@ async function e2eProjectGeneratorInternal(host, schema) {
|
|
|
174
171
|
// If we are using the new TS solution
|
|
175
172
|
// We need to update the workspace file (package.json or pnpm-workspaces.yaml) to include the new project
|
|
176
173
|
if (options.isTsSolutionSetup) {
|
|
177
|
-
await (0,
|
|
174
|
+
await (0, internal_2.addProjectToTsSolutionWorkspace)(host, options.projectRoot);
|
|
178
175
|
}
|
|
179
176
|
if (!options.skipFormat) {
|
|
180
177
|
await (0, devkit_1.formatFiles)(host);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"executor.d.ts","sourceRoot":"","sources":["../../../../../../packages/plugin/src/generators/executor/executor.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"executor.d.ts","sourceRoot":"","sources":["../../../../../../packages/plugin/src/generators/executor/executor.ts"],"names":[],"mappings":"AACA,OAAO,EAUL,KAAK,IAAI,EACV,MAAM,YAAY,CAAC;AAOpB,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAmCvC,wBAAsB,mBAAmB,CACvC,IAAI,EAAE,IAAI,EACV,WAAW,EAAE,MAAM,EACnB,WAAW,EAAE,MAAM,EACnB,cAAc,CAAC,EAAE,OAAO,iBAsBzB;AAsID,wBAAsB,iBAAiB,CAAC,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,iBAajE;AAED,eAAe,iBAAiB,CAAC"}
|
|
@@ -3,9 +3,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.createExecutorsJson = createExecutorsJson;
|
|
4
4
|
exports.executorGenerator = executorGenerator;
|
|
5
5
|
const tslib_1 = require("tslib");
|
|
6
|
+
const internal_1 = require("@nx/devkit/internal");
|
|
6
7
|
const devkit_1 = require("@nx/devkit");
|
|
7
|
-
const
|
|
8
|
-
const ts_solution_setup_1 = require("@nx/js/src/utils/typescript/ts-solution-setup");
|
|
8
|
+
const internal_2 = require("@nx/js/internal");
|
|
9
9
|
const path_1 = require("path");
|
|
10
10
|
const paths_1 = require("../../utils/paths");
|
|
11
11
|
const versions_1 = require("../../utils/versions");
|
|
@@ -85,7 +85,7 @@ async function updateExecutorJson(host, options) {
|
|
|
85
85
|
});
|
|
86
86
|
}
|
|
87
87
|
async function normalizeOptions(tree, options) {
|
|
88
|
-
const { artifactName: name, directory: initialDirectory, fileName, project, } = await (0,
|
|
88
|
+
const { artifactName: name, directory: initialDirectory, fileName, project, } = await (0, internal_1.determineArtifactNameAndDirectoryOptions)(tree, {
|
|
89
89
|
path: options.path,
|
|
90
90
|
name: options.name,
|
|
91
91
|
allowedFileExtensions: ['ts'],
|
|
@@ -124,7 +124,7 @@ async function normalizeOptions(tree, options) {
|
|
|
124
124
|
description,
|
|
125
125
|
projectRoot,
|
|
126
126
|
projectSourceRoot: projectSourceRoot ?? (0, path_1.join)(projectRoot, 'src'),
|
|
127
|
-
isTsSolutionSetup: (0,
|
|
127
|
+
isTsSolutionSetup: (0, internal_2.isUsingTsSolutionSetup)(tree),
|
|
128
128
|
};
|
|
129
129
|
}
|
|
130
130
|
async function executorGenerator(host, schema) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { PromiseExecutor } from "@nx/devkit";
|
|
2
|
-
import { <%= className %>ExecutorSchema } from './schema';
|
|
1
|
+
import type { PromiseExecutor } from "@nx/devkit";
|
|
2
|
+
import type { <%= className %>ExecutorSchema } from './schema';
|
|
3
3
|
|
|
4
4
|
const runExecutor: PromiseExecutor<<%= className %>ExecutorSchema> = async (options) => {
|
|
5
5
|
console.log('Executor ran for <%= className %>', options);
|
|
@@ -2,10 +2,10 @@ import {
|
|
|
2
2
|
addProjectConfiguration,
|
|
3
3
|
formatFiles,
|
|
4
4
|
generateFiles,
|
|
5
|
-
Tree,
|
|
5
|
+
type Tree,
|
|
6
6
|
} from '@nx/devkit';
|
|
7
7
|
import * as path from 'path';
|
|
8
|
-
import { <%= className %>GeneratorSchema } from './schema';
|
|
8
|
+
import type { <%= className %>GeneratorSchema } from './schema';
|
|
9
9
|
|
|
10
10
|
export async function <%= generatorFnName %> (tree: Tree, options: <%= schemaInterfaceName %>) {
|
|
11
11
|
const projectRoot = `libs/${options.name}`;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generator.d.ts","sourceRoot":"","sources":["../../../../../../packages/plugin/src/generators/generator/generator.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"generator.d.ts","sourceRoot":"","sources":["../../../../../../packages/plugin/src/generators/generator/generator.ts"],"names":[],"mappings":"AACA,OAAO,EAQL,IAAI,EAGL,MAAM,YAAY,CAAC;AAQpB,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AA2FvC,wBAAsB,oBAAoB,CACxC,IAAI,EAAE,IAAI,EACV,WAAW,EAAE,MAAM,EACnB,WAAW,EAAE,MAAM,EACnB,cAAc,CAAC,EAAE,OAAO,EACxB,UAAU,CAAC,EAAE,OAAO,iBAuBrB;AA2ED,wBAAsB,kBAAkB,CAAC,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,iBAalE;AAED,eAAe,kBAAkB,CAAC"}
|
|
@@ -3,16 +3,16 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.createGeneratorsJson = createGeneratorsJson;
|
|
4
4
|
exports.generatorGenerator = generatorGenerator;
|
|
5
5
|
const tslib_1 = require("tslib");
|
|
6
|
+
const internal_1 = require("@nx/devkit/internal");
|
|
6
7
|
const devkit_1 = require("@nx/devkit");
|
|
7
|
-
const
|
|
8
|
-
const ts_solution_setup_1 = require("@nx/js/src/utils/typescript/ts-solution-setup");
|
|
8
|
+
const internal_2 = require("@nx/js/internal");
|
|
9
9
|
const node_path_1 = require("node:path");
|
|
10
10
|
const has_generator_1 = require("../../utils/has-generator");
|
|
11
11
|
const paths_1 = require("../../utils/paths");
|
|
12
12
|
const versions_1 = require("../../utils/versions");
|
|
13
13
|
const generator_1 = tslib_1.__importDefault(require("../lint-checks/generator"));
|
|
14
14
|
async function normalizeOptions(tree, options) {
|
|
15
|
-
const { artifactName: name, directory: initialDirectory, fileName, project, } = await (0,
|
|
15
|
+
const { artifactName: name, directory: initialDirectory, fileName, project, } = await (0, internal_1.determineArtifactNameAndDirectoryOptions)(tree, {
|
|
16
16
|
path: options.path,
|
|
17
17
|
name: options.name,
|
|
18
18
|
allowedFileExtensions: ['ts'],
|
|
@@ -51,7 +51,7 @@ async function normalizeOptions(tree, options) {
|
|
|
51
51
|
description,
|
|
52
52
|
projectRoot,
|
|
53
53
|
projectSourceRoot: projectSourceRoot ?? (0, node_path_1.join)(projectRoot, 'src'),
|
|
54
|
-
isTsSolutionSetup: (0,
|
|
54
|
+
isTsSolutionSetup: (0, internal_2.isUsingTsSolutionSetup)(tree),
|
|
55
55
|
};
|
|
56
56
|
}
|
|
57
57
|
function addFiles(host, options) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ProjectConfiguration, TargetConfiguration, Tree } from '@nx/devkit';
|
|
2
|
-
import type { Schema as EsLintExecutorOptions } from '@nx/eslint/
|
|
2
|
+
import type { Schema as EsLintExecutorOptions } from '@nx/eslint/internal';
|
|
3
3
|
import { PluginLintChecksGeneratorSchema } from './schema';
|
|
4
4
|
import { PackageJson } from 'nx/src/utils/package-json';
|
|
5
5
|
export default function pluginLintCheckGenerator(host: Tree, options: PluginLintChecksGeneratorSchema): Promise<void>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generator.d.ts","sourceRoot":"","sources":["../../../../../../packages/plugin/src/generators/lint-checks/generator.ts"],"names":[],"mappings":"AAAA,OAAO,EAKL,oBAAoB,EAGpB,mBAAmB,EACnB,IAAI,EAIL,MAAM,YAAY,CAAC;AAEpB,OAAO,KAAK,EAAE,MAAM,IAAI,qBAAqB,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"generator.d.ts","sourceRoot":"","sources":["../../../../../../packages/plugin/src/generators/lint-checks/generator.ts"],"names":[],"mappings":"AAAA,OAAO,EAKL,oBAAoB,EAGpB,mBAAmB,EACnB,IAAI,EAIL,MAAM,YAAY,CAAC;AAEpB,OAAO,KAAK,EAAE,MAAM,IAAI,qBAAqB,EAAE,MAAM,qBAAqB,CAAC;AAE3E,OAAO,EAAE,+BAA+B,EAAE,MAAM,UAAU,CAAC;AAE3D,OAAO,EAAE,WAAW,EAAuB,MAAM,2BAA2B,CAAC;AAU7E,wBAA8B,wBAAwB,CACpD,IAAI,EAAE,IAAI,EACV,OAAO,EAAE,+BAA+B,iBA2BzC;AAED,wBAAgB,sBAAsB,CACpC,IAAI,EAAE,IAAI,EACV,OAAO,EAAE,+BAA+B,EACxC,WAAW,EAAE,WAAW,QAyDzB;AA2MD,wBAAgB,gBAAgB,CAC9B,OAAO,EAAE,oBAAoB,GAC5B,CAAC,MAAM,EAAE,MAAM,EAAE,aAAa,EAAE,mBAAmB,CAAC,qBAAqB,CAAC,CAAC,CAO7E"}
|
|
@@ -6,8 +6,7 @@ exports.getEsLintOptions = getEsLintOptions;
|
|
|
6
6
|
const devkit_1 = require("@nx/devkit");
|
|
7
7
|
const logger_1 = require("nx/src/utils/logger");
|
|
8
8
|
const package_json_1 = require("nx/src/utils/package-json");
|
|
9
|
-
const
|
|
10
|
-
const flat_config_1 = require("@nx/eslint/src/utils/flat-config");
|
|
9
|
+
const internal_1 = require("@nx/eslint/internal");
|
|
11
10
|
async function pluginLintCheckGenerator(host, options) {
|
|
12
11
|
const project = (0, devkit_1.readProjectConfiguration)(host, options.projectName);
|
|
13
12
|
const packageJson = (0, devkit_1.readJson)(host, (0, devkit_1.joinPathFragments)(project.root, 'package.json'));
|
|
@@ -49,7 +48,7 @@ function addMigrationJsonChecks(host, options, packageJson) {
|
|
|
49
48
|
(0, devkit_1.updateProjectConfiguration)(host, options.projectName, projectConfiguration);
|
|
50
49
|
}
|
|
51
50
|
// Update project level eslintrc
|
|
52
|
-
(0,
|
|
51
|
+
(0, internal_1.updateOverrideInLintConfig)(host, projectConfiguration.root, (o) => Object.keys(o.rules ?? {})?.includes('@nx/nx-plugin-checks') ||
|
|
53
52
|
Object.keys(o.rules ?? {})?.includes('@nrwl/nx/nx-plugin-checks'), (o) => {
|
|
54
53
|
const fileSet = new Set(Array.isArray(o.files) ? o.files : [o.files]);
|
|
55
54
|
fileSet.add(relativeMigrationsJsonPath);
|
|
@@ -60,7 +59,7 @@ function addMigrationJsonChecks(host, options, packageJson) {
|
|
|
60
59
|
});
|
|
61
60
|
}
|
|
62
61
|
function formatFilesEntries(tree, files) {
|
|
63
|
-
if (!(0,
|
|
62
|
+
if (!(0, internal_1.useFlatConfig)(tree)) {
|
|
64
63
|
return files;
|
|
65
64
|
}
|
|
66
65
|
const filesAfter = files.map((f) => {
|
|
@@ -97,12 +96,31 @@ function updateProjectTarget(host, options, packageJson) {
|
|
|
97
96
|
opts.lintFilePatterns.push(`${project.root}/package.json`);
|
|
98
97
|
opts.lintFilePatterns = [...new Set(opts.lintFilePatterns)];
|
|
99
98
|
project.targets[target].options = opts;
|
|
99
|
+
// Plugin checks read schema/implementation files which may live in the
|
|
100
|
+
// project's build outputs (and migration prompt files copied as assets).
|
|
101
|
+
// Ensure lint runs after build and includes the relevant build outputs
|
|
102
|
+
// as inputs so the sandbox allows the reads and the cache invalidates
|
|
103
|
+
// when those outputs change.
|
|
104
|
+
const targetConfig = project.targets[target];
|
|
105
|
+
const dependsOn = new Set(targetConfig.dependsOn ?? []);
|
|
106
|
+
dependsOn.add('build');
|
|
107
|
+
targetConfig.dependsOn = Array.from(dependsOn);
|
|
108
|
+
const inputs = targetConfig.inputs ?? ['...'];
|
|
109
|
+
const hasDependentOutputs = inputs.some((input) => typeof input === 'object' &&
|
|
110
|
+
input !== null &&
|
|
111
|
+
'dependentTasksOutputFiles' in input);
|
|
112
|
+
if (!hasDependentOutputs) {
|
|
113
|
+
inputs.push({
|
|
114
|
+
dependentTasksOutputFiles: '**/*.{json,d.ts,js,md}',
|
|
115
|
+
});
|
|
116
|
+
}
|
|
117
|
+
targetConfig.inputs = inputs;
|
|
100
118
|
}
|
|
101
119
|
}
|
|
102
120
|
(0, devkit_1.updateProjectConfiguration)(host, options.projectName, project);
|
|
103
121
|
}
|
|
104
122
|
function updateProjectEslintConfig(host, options, packageJson) {
|
|
105
|
-
if ((0,
|
|
123
|
+
if ((0, internal_1.isEslintConfigSupported)(host, options.root)) {
|
|
106
124
|
const lookup = (o) => Object.keys(o.rules ?? {}).includes('@nx/nx-plugin-checks') ||
|
|
107
125
|
Object.keys(o.rules ?? {}).includes('@nrwl/nx/nx-plugin-checks');
|
|
108
126
|
const files = [
|
|
@@ -113,12 +131,12 @@ function updateProjectEslintConfig(host, options, packageJson) {
|
|
|
113
131
|
packageJson.builders,
|
|
114
132
|
(0, package_json_1.readNxMigrateConfig)(packageJson).migrations,
|
|
115
133
|
].filter((f) => !!f);
|
|
116
|
-
const parser = (0,
|
|
134
|
+
const parser = (0, internal_1.useFlatConfig)(host)
|
|
117
135
|
? { languageOptions: { parser: 'jsonc-eslint-parser' } }
|
|
118
136
|
: { parser: 'jsonc-eslint-parser' };
|
|
119
|
-
if ((0,
|
|
137
|
+
if ((0, internal_1.lintConfigHasOverride)(host, options.root, lookup)) {
|
|
120
138
|
// update it
|
|
121
|
-
(0,
|
|
139
|
+
(0, internal_1.updateOverrideInLintConfig)(host, options.root, lookup, (o) => ({
|
|
122
140
|
...o,
|
|
123
141
|
files: formatFilesEntries(host, [
|
|
124
142
|
...new Set([
|
|
@@ -135,7 +153,7 @@ function updateProjectEslintConfig(host, options, packageJson) {
|
|
|
135
153
|
}
|
|
136
154
|
else {
|
|
137
155
|
// add it
|
|
138
|
-
(0,
|
|
156
|
+
(0, internal_1.addOverrideToLintConfig)(host, options.root, {
|
|
139
157
|
files: formatFilesEntries(host, files),
|
|
140
158
|
...parser,
|
|
141
159
|
rules: {
|
|
@@ -149,11 +167,11 @@ function updateProjectEslintConfig(host, options, packageJson) {
|
|
|
149
167
|
// This is required, otherwise every json file that is not overriden
|
|
150
168
|
// will display false errors in the IDE
|
|
151
169
|
function updateRootEslintConfig(host) {
|
|
152
|
-
if ((0,
|
|
153
|
-
if (!(0,
|
|
170
|
+
if ((0, internal_1.isEslintConfigSupported)(host)) {
|
|
171
|
+
if (!(0, internal_1.lintConfigHasOverride)(host, '', (o) => Array.isArray(o.files)
|
|
154
172
|
? o.files.some((f) => f.match(/\.json$/))
|
|
155
173
|
: !!o.files?.match(/\.json$/), true)) {
|
|
156
|
-
(0,
|
|
174
|
+
(0, internal_1.addOverrideToLintConfig)(host, '', {
|
|
157
175
|
files: '*.json',
|
|
158
176
|
parser: 'jsonc-eslint-parser',
|
|
159
177
|
rules: {},
|
|
@@ -187,7 +205,7 @@ function setupVsCodeLintingForJsonFiles(host) {
|
|
|
187
205
|
(0, devkit_1.writeJson)(host, '.vscode/settings.json', existing);
|
|
188
206
|
}
|
|
189
207
|
function projectIsEsLintEnabled(tree, project) {
|
|
190
|
-
return !!(0,
|
|
208
|
+
return !!(0, internal_1.findEslintFile)(tree, project.root);
|
|
191
209
|
}
|
|
192
210
|
function getEsLintOptions(project) {
|
|
193
211
|
return Object.entries(project.targets || {}).find(([, x]) => x.executor === '@nx/eslint:lint' ||
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"migration.d.ts","sourceRoot":"","sources":["../../../../../../packages/plugin/src/generators/migration/migration.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"migration.d.ts","sourceRoot":"","sources":["../../../../../../packages/plugin/src/generators/migration/migration.ts"],"names":[],"mappings":"AACA,OAAO,EASL,KAAK,IAAI,EACV,MAAM,YAAY,CAAC;AAOpB,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAiKvC,wBAAsB,kBAAkB,CAAC,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,iBAuBlE;AAED,eAAe,kBAAkB,CAAC"}
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.migrationGenerator = migrationGenerator;
|
|
4
|
+
const internal_1 = require("@nx/devkit/internal");
|
|
4
5
|
const devkit_1 = require("@nx/devkit");
|
|
5
|
-
const
|
|
6
|
-
const ts_solution_setup_1 = require("@nx/js/src/utils/typescript/ts-solution-setup");
|
|
6
|
+
const internal_2 = require("@nx/js/internal");
|
|
7
7
|
const node_path_1 = require("node:path");
|
|
8
8
|
const package_json_1 = require("nx/src/utils/package-json");
|
|
9
9
|
const paths_1 = require("../../utils/paths");
|
|
10
10
|
const versions_1 = require("../../utils/versions");
|
|
11
11
|
const generator_1 = require("../lint-checks/generator");
|
|
12
12
|
async function normalizeOptions(tree, options) {
|
|
13
|
-
const { artifactName: name, directory, fileName, project, } = await (0,
|
|
13
|
+
const { artifactName: name, directory, fileName, project, } = await (0, internal_1.determineArtifactNameAndDirectoryOptions)(tree, {
|
|
14
14
|
path: options.path,
|
|
15
15
|
name: options.name,
|
|
16
16
|
allowedFileExtensions: ['ts'],
|
|
@@ -27,7 +27,7 @@ async function normalizeOptions(tree, options) {
|
|
|
27
27
|
description,
|
|
28
28
|
projectRoot,
|
|
29
29
|
projectSourceRoot: projectSourceRoot ?? (0, node_path_1.join)(projectRoot, 'src'),
|
|
30
|
-
isTsSolutionSetup: (0,
|
|
30
|
+
isTsSolutionSetup: (0, internal_2.isUsingTsSolutionSetup)(tree),
|
|
31
31
|
};
|
|
32
32
|
return normalized;
|
|
33
33
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../../../../../../packages/plugin/src/generators/plugin/plugin.ts"],"names":[],"mappings":"AAAA,OAAO,EAIL,iBAAiB,EAKjB,IAAI,EAGL,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../../../../../../packages/plugin/src/generators/plugin/plugin.ts"],"names":[],"mappings":"AAAA,OAAO,EAIL,iBAAiB,EAKjB,IAAI,EAGL,MAAM,YAAY,CAAC;AAapB,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAuDvC,wBAAsB,eAAe,CAAC,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,8BAM/D;AAED,wBAAsB,uBAAuB,CAAC,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,8BA+FvE;AAED,eAAe,eAAe,CAAC"}
|
|
@@ -5,9 +5,7 @@ exports.pluginGeneratorInternal = pluginGeneratorInternal;
|
|
|
5
5
|
const tslib_1 = require("tslib");
|
|
6
6
|
const devkit_1 = require("@nx/devkit");
|
|
7
7
|
const js_1 = require("@nx/js");
|
|
8
|
-
const
|
|
9
|
-
const add_tslib_dependencies_1 = require("@nx/js/src/utils/typescript/add-tslib-dependencies");
|
|
10
|
-
const ts_solution_setup_1 = require("@nx/js/src/utils/typescript/ts-solution-setup");
|
|
8
|
+
const internal_1 = require("@nx/js/internal");
|
|
11
9
|
const path = tslib_1.__importStar(require("path"));
|
|
12
10
|
const e2e_1 = require("../e2e-project/e2e");
|
|
13
11
|
const generator_1 = tslib_1.__importDefault(require("../lint-checks/generator"));
|
|
@@ -24,7 +22,7 @@ function updatePluginConfig(host, options) {
|
|
|
24
22
|
const project = (0, devkit_1.readProjectConfiguration)(host, options.projectName);
|
|
25
23
|
if (project.targets.build) {
|
|
26
24
|
if (options.isTsSolutionSetup && options.bundler === 'tsc') {
|
|
27
|
-
project.targets.build.options.rootDir = (0,
|
|
25
|
+
project.targets.build.options.rootDir = (0, internal_1.getProjectSourceRoot)(project, host);
|
|
28
26
|
project.targets.build.options.generatePackageJson = false;
|
|
29
27
|
}
|
|
30
28
|
project.targets.build.options.assets = [
|
|
@@ -67,12 +65,19 @@ async function pluginGeneratorInternal(host, schema) {
|
|
|
67
65
|
}));
|
|
68
66
|
if (options.isTsSolutionSetup) {
|
|
69
67
|
(0, devkit_1.updateJson)(host, (0, devkit_1.joinPathFragments)(options.projectRoot, 'package.json'), (json) => {
|
|
70
|
-
|
|
68
|
+
// Force CommonJS for the plugin package. `jsLibraryGenerator` sets
|
|
69
|
+
// `type: "module"` for TS-solution libs, but Nx-plugin generators
|
|
70
|
+
// and executors that get loaded by `nx generate` / `nx run` rely on
|
|
71
|
+
// CJS globals like `__dirname` (e.g. `path.join(__dirname, 'files')`
|
|
72
|
+
// in generator factories). Setting `type: "commonjs"` explicitly
|
|
73
|
+
// overrides Node's content-based ESM detection so the source TS
|
|
74
|
+
// files load as CJS at runtime.
|
|
75
|
+
json.type = 'commonjs';
|
|
71
76
|
return json;
|
|
72
77
|
});
|
|
73
78
|
}
|
|
74
79
|
if (options.bundler === 'tsc') {
|
|
75
|
-
tasks.push((0,
|
|
80
|
+
tasks.push((0, js_1.addTsLibDependencies)(host));
|
|
76
81
|
}
|
|
77
82
|
tasks.push((0, devkit_1.addDependenciesToPackageJson)(host, {
|
|
78
83
|
'@nx/devkit': nxVersion,
|
|
@@ -83,8 +88,8 @@ async function pluginGeneratorInternal(host, schema) {
|
|
|
83
88
|
}));
|
|
84
89
|
// Ensures Swc Deps are installed to handle running
|
|
85
90
|
// local plugin generators and executors
|
|
86
|
-
tasks.push((0,
|
|
87
|
-
tasks.push((0,
|
|
91
|
+
tasks.push((0, internal_1.addSwcDependencies)(host));
|
|
92
|
+
tasks.push((0, internal_1.addSwcRegisterDependencies)(host));
|
|
88
93
|
await addFiles(host, options);
|
|
89
94
|
updatePluginConfig(host, options);
|
|
90
95
|
if (options.e2eTestRunner !== 'none') {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"normalize-schema.d.ts","sourceRoot":"","sources":["../../../../../../../packages/plugin/src/generators/plugin/utils/normalize-schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAc,KAAK,IAAI,EAAE,MAAM,YAAY,CAAC;AAKnD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"normalize-schema.d.ts","sourceRoot":"","sources":["../../../../../../../packages/plugin/src/generators/plugin/utils/normalize-schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAc,KAAK,IAAI,EAAE,MAAM,YAAY,CAAC;AAKnD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAO7C,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AAExC,MAAM,WAAW,gBAAiB,SAAQ,MAAM;IAC9C,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,MAAM,CAAC;IACjB,WAAW,EAAE,MAAM,CAAC;IACpB,gBAAgB,EAAE,MAAM,CAAC;IACzB,mBAAmB,EAAE,MAAM,CAAC;IAC5B,UAAU,EAAE,MAAM,EAAE,CAAC;IACrB,UAAU,EAAE,MAAM,CAAC;IACnB,OAAO,EAAE,KAAK,GAAG,KAAK,CAAC;IACvB,WAAW,EAAE,OAAO,CAAC;IACrB,cAAc,EAAE,MAAM,GAAG,QAAQ,GAAG,MAAM,CAAC;IAC3C,MAAM,EAAE,UAAU,CAAC;IACnB,cAAc,EAAE,OAAO,CAAC;IACxB,SAAS,EAAE,OAAO,CAAC;IACnB,iBAAiB,EAAE,OAAO,CAAC;CAC5B;AAED,wBAAsB,gBAAgB,CACpC,IAAI,EAAE,IAAI,EACV,OAAO,EAAE,MAAM,GACd,OAAO,CAAC,gBAAgB,CAAC,CAwD3B"}
|
|
@@ -2,24 +2,23 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.normalizeOptions = normalizeOptions;
|
|
4
4
|
const devkit_1 = require("@nx/devkit");
|
|
5
|
-
const
|
|
6
|
-
const
|
|
7
|
-
const ts_solution_setup_1 = require("@nx/js/src/utils/typescript/ts-solution-setup");
|
|
5
|
+
const internal_1 = require("@nx/devkit/internal");
|
|
6
|
+
const internal_2 = require("@nx/js/internal");
|
|
8
7
|
async function normalizeOptions(host, options) {
|
|
9
|
-
const linter = await (0,
|
|
10
|
-
const unitTestRunner = await (0,
|
|
8
|
+
const linter = await (0, internal_2.normalizeLinterOption)(host, options.linter);
|
|
9
|
+
const unitTestRunner = await (0, internal_2.normalizeUnitTestRunnerOption)(host, options.unitTestRunner, ['jest', 'vitest']);
|
|
11
10
|
// this helper is called before the jsLibraryGenerator is called, so, if the
|
|
12
11
|
// TS solution setup is not configured, we additionally check if the TS
|
|
13
12
|
// solution setup will be configured by the jsLibraryGenerator
|
|
14
|
-
const isTsSolutionSetup = (0,
|
|
15
|
-
(0,
|
|
13
|
+
const isTsSolutionSetup = (0, internal_2.isUsingTsSolutionSetup)(host) ||
|
|
14
|
+
(0, internal_2.shouldConfigureTsSolutionSetup)(host, options.addPlugin);
|
|
16
15
|
const nxJson = (0, devkit_1.readNxJson)(host);
|
|
17
16
|
const addPlugin = options.addPlugin ??
|
|
18
17
|
(isTsSolutionSetup &&
|
|
19
18
|
process.env.NX_ADD_PLUGINS !== 'false' &&
|
|
20
19
|
nxJson.useInferencePlugins !== false);
|
|
21
|
-
await (0,
|
|
22
|
-
const { projectName, projectRoot, importPath } = await (0,
|
|
20
|
+
await (0, internal_1.ensureRootProjectName)(options, 'library');
|
|
21
|
+
const { projectName, projectRoot, importPath } = await (0, internal_1.determineProjectNameAndRootOptions)(host, {
|
|
23
22
|
name: options.name,
|
|
24
23
|
projectType: 'library',
|
|
25
24
|
directory: options.directory,
|
package/src/utils/paths.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.getArtifactMetadataDirectory = getArtifactMetadataDirectory;
|
|
4
4
|
const devkit_1 = require("@nx/devkit");
|
|
5
|
-
const
|
|
5
|
+
const internal_1 = require("@nx/js/internal");
|
|
6
6
|
const posix_1 = require("node:path/posix");
|
|
7
7
|
function getArtifactMetadataDirectory(tree, projectName, sourceDirectory, isTsSolutionSetup) {
|
|
8
8
|
const project = (0, devkit_1.readProjectConfiguration)(tree, projectName);
|
|
@@ -24,6 +24,6 @@ function getArtifactMetadataDirectory(tree, projectName, sourceDirectory, isTsSo
|
|
|
24
24
|
// unless the user manually changed the build process. In that case, we can't
|
|
25
25
|
// reliably determine the output directory because it depends on the build
|
|
26
26
|
// tool, so we'll just assume some defaults.
|
|
27
|
-
const baseDir = (0,
|
|
27
|
+
const baseDir = (0, internal_1.getProjectSourceRoot)(project, tree);
|
|
28
28
|
return `./${(0, posix_1.join)('dist', (0, posix_1.relative)(baseDir, sourceDirectory))}`;
|
|
29
29
|
}
|