@nx/devkit 19.0.0-beta.1 → 19.0.0-beta.11
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 +4 -3
- package/src/executors/parse-target-string.d.ts +1 -3
- package/src/executors/parse-target-string.js +5 -9
- package/src/executors/read-target-options.d.ts +1 -2
- package/src/executors/read-target-options.js +4 -17
- package/src/generators/add-build-target-defaults.d.ts +1 -1
- package/src/generators/add-build-target-defaults.js +3 -4
- package/src/generators/artifact-name-and-directory-utils.d.ts +1 -1
- package/src/generators/artifact-name-and-directory-utils.js +24 -24
- package/src/generators/executor-options-utils.d.ts +1 -2
- package/src/generators/executor-options-utils.js +3 -6
- package/src/generators/format-files.d.ts +1 -1
- package/src/generators/format-files.js +5 -8
- package/src/generators/generate-files.d.ts +1 -1
- package/src/generators/generate-files.js +2 -3
- package/src/generators/plugin-migrations/executor-to-plugin-migrator.d.ts +6 -0
- package/src/generators/plugin-migrations/executor-to-plugin-migrator.js +198 -0
- package/src/generators/plugin-migrations/plugin-migration-utils.d.ts +54 -0
- package/src/generators/plugin-migrations/plugin-migration-utils.js +78 -0
- package/src/generators/project-name-and-root-utils.d.ts +1 -2
- package/src/generators/project-name-and-root-utils.js +16 -17
- package/src/generators/run-tasks-in-serial.d.ts +1 -1
- package/src/generators/to-js.d.ts +1 -1
- package/src/generators/update-ts-configs-to-js.d.ts +1 -1
- package/src/generators/update-ts-configs-to-js.js +3 -4
- package/src/generators/visit-not-ignored-files.d.ts +1 -1
- package/src/migrations/update-16-0-0-add-nx-packages/update-16-0-0-add-nx-packages.d.ts +1 -1
- package/src/migrations/update-16-9-0/migrate-mf-util-usage.d.ts +1 -2
- package/src/migrations/update-16-9-0/migrate-mf-util-usage.js +2 -3
- package/src/tasks/install-packages-task.d.ts +1 -2
- package/src/tasks/install-packages-task.js +5 -6
- package/src/utils/add-plugin.d.ts +1 -1
- package/src/utils/add-plugin.js +12 -10
- package/src/utils/calculate-hash-for-create-nodes.d.ts +1 -1
- package/src/utils/calculate-hash-for-create-nodes.js +5 -5
- package/src/utils/config-utils.d.ts +1 -0
- package/src/utils/config-utils.js +19 -9
- package/src/utils/convert-nx-executor.d.ts +1 -1
- package/src/utils/convert-nx-executor.js +21 -16
- package/src/utils/get-named-inputs.d.ts +1 -1
- package/src/utils/get-named-inputs.js +3 -4
- package/src/utils/get-workspace-layout.d.ts +1 -1
- package/src/utils/get-workspace-layout.js +2 -3
- package/src/utils/invoke-nx-generator.d.ts +1 -1
- package/src/utils/invoke-nx-generator.js +3 -5
- package/src/utils/log-show-project-command.js +2 -3
- package/src/utils/move-dir.d.ts +1 -1
- package/src/utils/move-dir.js +3 -4
- package/src/utils/package-json.d.ts +1 -2
- package/src/utils/package-json.js +13 -13
- package/src/utils/replace-package.d.ts +1 -1
- package/src/utils/replace-package.js +7 -9
- package/src/utils/replace-project-configuration-with-plugin.d.ts +1 -1
- package/src/utils/replace-project-configuration-with-plugin.js +11 -11
- package/nx.d.ts +0 -1
- package/nx.js +0 -19
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { CreateNodesContext } from 'nx/src/devkit-exports';
|
|
2
1
|
import type { InputDefinition } from 'nx/src/config/workspace-json-project-json';
|
|
2
|
+
import { CreateNodesContext } from 'nx/src/devkit-exports';
|
|
3
3
|
/**
|
|
4
4
|
* Get the named inputs available for a directory
|
|
5
5
|
*/
|
|
@@ -3,19 +3,18 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.getNamedInputs = void 0;
|
|
4
4
|
const path_1 = require("path");
|
|
5
5
|
const fs_1 = require("fs");
|
|
6
|
-
const
|
|
7
|
-
const { readJsonFile } = (0, nx_1.requireNx)();
|
|
6
|
+
const devkit_exports_1 = require("nx/src/devkit-exports");
|
|
8
7
|
/**
|
|
9
8
|
* Get the named inputs available for a directory
|
|
10
9
|
*/
|
|
11
10
|
function getNamedInputs(directory, context) {
|
|
12
11
|
const projectJsonPath = (0, path_1.join)(directory, 'project.json');
|
|
13
12
|
const projectJson = (0, fs_1.existsSync)(projectJsonPath)
|
|
14
|
-
? readJsonFile(projectJsonPath)
|
|
13
|
+
? (0, devkit_exports_1.readJsonFile)(projectJsonPath)
|
|
15
14
|
: null;
|
|
16
15
|
const packageJsonPath = (0, path_1.join)(directory, 'package.json');
|
|
17
16
|
const packageJson = (0, fs_1.existsSync)(packageJsonPath)
|
|
18
|
-
? readJsonFile(packageJsonPath)
|
|
17
|
+
? (0, devkit_exports_1.readJsonFile)(packageJsonPath)
|
|
19
18
|
: null;
|
|
20
19
|
return {
|
|
21
20
|
...context.nxJsonConfiguration.namedInputs,
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.extractLayoutDirectory = exports.getWorkspaceLayout = void 0;
|
|
4
|
-
const
|
|
5
|
-
const { readNxJson } = (0, nx_1.requireNx)();
|
|
4
|
+
const devkit_exports_1 = require("nx/src/devkit-exports");
|
|
6
5
|
/**
|
|
7
6
|
* Returns workspace defaults. It includes defaults folders for apps and libs,
|
|
8
7
|
* and the default scope.
|
|
@@ -15,7 +14,7 @@ const { readNxJson } = (0, nx_1.requireNx)();
|
|
|
15
14
|
* @param tree - file system tree
|
|
16
15
|
*/
|
|
17
16
|
function getWorkspaceLayout(tree) {
|
|
18
|
-
const nxJson = readNxJson(tree);
|
|
17
|
+
const nxJson = (0, devkit_exports_1.readNxJson)(tree);
|
|
19
18
|
return {
|
|
20
19
|
appsDir: nxJson?.workspaceLayout?.appsDir ??
|
|
21
20
|
inOrderOfPreference(tree, ['apps', 'packages'], '.'),
|
|
@@ -2,10 +2,8 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.convertNxGenerator = void 0;
|
|
4
4
|
const path_1 = require("path");
|
|
5
|
-
const
|
|
6
|
-
|
|
7
|
-
// TODO: Remove this in Nx 19 when Nx 16.7.0 is no longer supported
|
|
8
|
-
stripIndent = stripIndent ?? require('nx/src/utils/logger').stripIndent;
|
|
5
|
+
const devkit_exports_1 = require("nx/src/devkit-exports");
|
|
6
|
+
const devkit_internals_1 = require("nx/src/devkit-internals");
|
|
9
7
|
class RunCallbackTask {
|
|
10
8
|
constructor(callback) {
|
|
11
9
|
this.callback = callback;
|
|
@@ -166,7 +164,7 @@ class DevkitTreeFromAngularDevkitTree {
|
|
|
166
164
|
this.warnUnsupportedFilePermissionsChange(filePath, mode);
|
|
167
165
|
}
|
|
168
166
|
warnUnsupportedFilePermissionsChange(filePath, mode) {
|
|
169
|
-
logger.warn(stripIndent(`The Angular DevKit tree does not support changing a file permissions.
|
|
167
|
+
devkit_exports_1.logger.warn((0, devkit_internals_1.stripIndent)(`The Angular DevKit tree does not support changing a file permissions.
|
|
170
168
|
Ignoring changing ${filePath} permissions to ${mode}.`));
|
|
171
169
|
}
|
|
172
170
|
}
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.logShowProjectCommand = void 0;
|
|
4
|
-
const
|
|
4
|
+
const devkit_exports_1 = require("nx/src/devkit-exports");
|
|
5
5
|
function logShowProjectCommand(projectName) {
|
|
6
|
-
|
|
7
|
-
output.log({
|
|
6
|
+
devkit_exports_1.output.log({
|
|
8
7
|
title: `👀 View Details of ${projectName}`,
|
|
9
8
|
bodyLines: [
|
|
10
9
|
`Run "nx show project ${projectName} --web" to view details about this project.`,
|
package/src/utils/move-dir.d.ts
CHANGED
package/src/utils/move-dir.js
CHANGED
|
@@ -3,14 +3,13 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.moveFilesToNewDirectory = void 0;
|
|
4
4
|
const path_1 = require("path");
|
|
5
5
|
const visit_not_ignored_files_1 = require("../generators/visit-not-ignored-files");
|
|
6
|
-
const
|
|
7
|
-
const { normalizePath } = (0, nx_1.requireNx)();
|
|
6
|
+
const devkit_exports_1 = require("nx/src/devkit-exports");
|
|
8
7
|
/**
|
|
9
8
|
* Analogous to cp -r oldDir newDir
|
|
10
9
|
*/
|
|
11
10
|
function moveFilesToNewDirectory(tree, oldDir, newDir) {
|
|
12
|
-
oldDir = normalizePath(oldDir);
|
|
13
|
-
newDir = normalizePath(newDir);
|
|
11
|
+
oldDir = (0, devkit_exports_1.normalizePath)(oldDir);
|
|
12
|
+
newDir = (0, devkit_exports_1.normalizePath)(newDir);
|
|
14
13
|
(0, visit_not_ignored_files_1.visitNotIgnoredFiles)(tree, oldDir, (file) => {
|
|
15
14
|
try {
|
|
16
15
|
tree.rename(file, `${newDir}/${(0, path_1.relative)(oldDir, file)}`);
|
|
@@ -5,11 +5,11 @@ const child_process_1 = require("child_process");
|
|
|
5
5
|
const module_1 = require("module");
|
|
6
6
|
const semver_1 = require("semver");
|
|
7
7
|
const install_packages_task_1 = require("../tasks/install-packages-task");
|
|
8
|
-
const nx_1 = require("../../nx");
|
|
9
8
|
const tmp_1 = require("tmp");
|
|
10
9
|
const path_1 = require("path");
|
|
10
|
+
const devkit_exports_1 = require("nx/src/devkit-exports");
|
|
11
|
+
const devkit_internals_1 = require("nx/src/devkit-internals");
|
|
11
12
|
const fs_1 = require("fs");
|
|
12
|
-
const { readJson, updateJson, getPackageManagerCommand, workspaceRoot, detectPackageManager, createTempNpmDirectory, getPackageManagerVersion, } = (0, nx_1.requireNx)();
|
|
13
13
|
const UNIDENTIFIED_VERSION = 'UNIDENTIFIED_VERSION';
|
|
14
14
|
const NON_SEMVER_TAGS = {
|
|
15
15
|
'*': 2,
|
|
@@ -90,7 +90,7 @@ function updateExistingDependenciesVersion(dependencies, existingDependencies =
|
|
|
90
90
|
* @returns Callback to install dependencies only if necessary, no-op otherwise
|
|
91
91
|
*/
|
|
92
92
|
function addDependenciesToPackageJson(tree, dependencies, devDependencies, packageJsonPath = 'package.json', keepExistingVersions) {
|
|
93
|
-
const currentPackageJson = readJson(tree, packageJsonPath);
|
|
93
|
+
const currentPackageJson = (0, devkit_exports_1.readJson)(tree, packageJsonPath);
|
|
94
94
|
/** Dependencies to install that are not met in dev dependencies */
|
|
95
95
|
let filteredDependencies = filterExistingDependencies(dependencies, currentPackageJson.devDependencies);
|
|
96
96
|
/** Dev dependencies to install that are not met in dependencies */
|
|
@@ -117,7 +117,7 @@ function addDependenciesToPackageJson(tree, dependencies, devDependencies, packa
|
|
|
117
117
|
filteredDevDependencies = removeLowerVersions(filteredDevDependencies, currentPackageJson.devDependencies);
|
|
118
118
|
}
|
|
119
119
|
if (requiresAddingOfPackages(currentPackageJson, filteredDependencies, filteredDevDependencies)) {
|
|
120
|
-
updateJson(tree, packageJsonPath, (json) => {
|
|
120
|
+
(0, devkit_exports_1.updateJson)(tree, packageJsonPath, (json) => {
|
|
121
121
|
json.dependencies = {
|
|
122
122
|
...(json.dependencies || {}),
|
|
123
123
|
...filteredDependencies,
|
|
@@ -171,9 +171,9 @@ function removeExistingDependencies(incomingDeps, existingDeps) {
|
|
|
171
171
|
* @returns Callback to uninstall dependencies only if necessary. undefined is returned if changes are not necessary.
|
|
172
172
|
*/
|
|
173
173
|
function removeDependenciesFromPackageJson(tree, dependencies, devDependencies, packageJsonPath = 'package.json') {
|
|
174
|
-
const currentPackageJson = readJson(tree, packageJsonPath);
|
|
174
|
+
const currentPackageJson = (0, devkit_exports_1.readJson)(tree, packageJsonPath);
|
|
175
175
|
if (requiresRemovingOfPackages(currentPackageJson, dependencies, devDependencies)) {
|
|
176
|
-
updateJson(tree, packageJsonPath, (json) => {
|
|
176
|
+
(0, devkit_exports_1.updateJson)(tree, packageJsonPath, (json) => {
|
|
177
177
|
for (const dep of dependencies) {
|
|
178
178
|
delete json.dependencies[dep];
|
|
179
179
|
}
|
|
@@ -291,14 +291,14 @@ function ensurePackage(pkgOrTree, requiredVersionOrPackage, maybeRequiredVersion
|
|
|
291
291
|
if (process.env.NX_DRY_RUN && process.env.NX_DRY_RUN !== 'false') {
|
|
292
292
|
throw new Error('NOTE: This generator does not support --dry-run. If you are running this in Nx Console, it should execute fine once you hit the "Generate" button.\n');
|
|
293
293
|
}
|
|
294
|
-
const { dir: tempDir } = createTempNpmDirectory?.() ?? {
|
|
294
|
+
const { dir: tempDir } = (0, devkit_internals_1.createTempNpmDirectory)?.() ?? {
|
|
295
295
|
dir: (0, tmp_1.dirSync)().name,
|
|
296
296
|
};
|
|
297
297
|
console.log(`Fetching ${pkg}...`);
|
|
298
|
-
const packageManager = detectPackageManager();
|
|
298
|
+
const packageManager = (0, devkit_exports_1.detectPackageManager)();
|
|
299
299
|
const isVerbose = process.env.NX_VERBOSE_LOGGING === 'true';
|
|
300
300
|
generatePackageManagerFiles(tempDir, packageManager);
|
|
301
|
-
const preInstallCommand = getPackageManagerCommand(packageManager).preInstall;
|
|
301
|
+
const preInstallCommand = (0, devkit_exports_1.getPackageManagerCommand)(packageManager).preInstall;
|
|
302
302
|
if (preInstallCommand) {
|
|
303
303
|
// ensure package.json and repo in tmp folder is set to a proper package manager state
|
|
304
304
|
(0, child_process_1.execSync)(preInstallCommand, {
|
|
@@ -306,7 +306,7 @@ function ensurePackage(pkgOrTree, requiredVersionOrPackage, maybeRequiredVersion
|
|
|
306
306
|
stdio: isVerbose ? 'inherit' : 'ignore',
|
|
307
307
|
});
|
|
308
308
|
}
|
|
309
|
-
let addCommand = getPackageManagerCommand(packageManager).addDev;
|
|
309
|
+
let addCommand = (0, devkit_exports_1.getPackageManagerCommand)(packageManager).addDev;
|
|
310
310
|
if (packageManager === 'pnpm') {
|
|
311
311
|
addCommand = 'pnpm add -D'; // we need to ensure that we are not using workspace command
|
|
312
312
|
}
|
|
@@ -314,7 +314,7 @@ function ensurePackage(pkgOrTree, requiredVersionOrPackage, maybeRequiredVersion
|
|
|
314
314
|
cwd: tempDir,
|
|
315
315
|
stdio: isVerbose ? 'inherit' : 'ignore',
|
|
316
316
|
});
|
|
317
|
-
addToNodePath((0, path_1.join)(workspaceRoot, 'node_modules'));
|
|
317
|
+
addToNodePath((0, path_1.join)(devkit_exports_1.workspaceRoot, 'node_modules'));
|
|
318
318
|
addToNodePath((0, path_1.join)(tempDir, 'node_modules'));
|
|
319
319
|
// Re-initialize the added paths into require
|
|
320
320
|
module_1.Module._initPaths();
|
|
@@ -340,8 +340,8 @@ exports.ensurePackage = ensurePackage;
|
|
|
340
340
|
* Generates necessary files needed for the package manager to work
|
|
341
341
|
* and for the node_modules to be accessible.
|
|
342
342
|
*/
|
|
343
|
-
function generatePackageManagerFiles(root, packageManager = detectPackageManager()) {
|
|
344
|
-
const [pmMajor] = getPackageManagerVersion(packageManager).split('.');
|
|
343
|
+
function generatePackageManagerFiles(root, packageManager = (0, devkit_exports_1.detectPackageManager)()) {
|
|
344
|
+
const [pmMajor] = (0, devkit_exports_1.getPackageManagerVersion)(packageManager).split('.');
|
|
345
345
|
switch (packageManager) {
|
|
346
346
|
case 'yarn':
|
|
347
347
|
if (+pmMajor >= 2) {
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { Tree } from 'nx/src/devkit-exports';
|
|
2
2
|
export declare function replaceNrwlPackageWithNxPackage(tree: Tree, oldPackageName: string, newPackageName: string): void;
|
|
@@ -1,12 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.replaceNrwlPackageWithNxPackage = void 0;
|
|
4
|
-
const
|
|
4
|
+
const devkit_exports_1 = require("nx/src/devkit-exports");
|
|
5
5
|
const visit_not_ignored_files_1 = require("../generators/visit-not-ignored-files");
|
|
6
6
|
const path_1 = require("path");
|
|
7
7
|
const binary_extensions_1 = require("./binary-extensions");
|
|
8
|
-
const { logger } = (0, nx_1.requireNx)();
|
|
9
|
-
const { getProjects, updateProjectConfiguration, readNxJson, updateNxJson, updateJson, } = (0, nx_1.requireNx)();
|
|
10
8
|
function replaceNrwlPackageWithNxPackage(tree, oldPackageName, newPackageName) {
|
|
11
9
|
replacePackageInDependencies(tree, oldPackageName, newPackageName);
|
|
12
10
|
replacePackageInProjectConfigurations(tree, oldPackageName, newPackageName);
|
|
@@ -20,7 +18,7 @@ function replacePackageInDependencies(tree, oldPackageName, newPackageName) {
|
|
|
20
18
|
return;
|
|
21
19
|
}
|
|
22
20
|
try {
|
|
23
|
-
updateJson(tree, path, (packageJson) => {
|
|
21
|
+
(0, devkit_exports_1.updateJson)(tree, path, (packageJson) => {
|
|
24
22
|
for (const deps of [
|
|
25
23
|
packageJson.dependencies ?? {},
|
|
26
24
|
packageJson.devDependencies ?? {},
|
|
@@ -41,7 +39,7 @@ function replacePackageInDependencies(tree, oldPackageName, newPackageName) {
|
|
|
41
39
|
});
|
|
42
40
|
}
|
|
43
41
|
function replacePackageInProjectConfigurations(tree, oldPackageName, newPackageName) {
|
|
44
|
-
const projects = getProjects(tree);
|
|
42
|
+
const projects = (0, devkit_exports_1.getProjects)(tree);
|
|
45
43
|
for (const [projectName, projectConfiguration] of projects) {
|
|
46
44
|
let needsUpdate = false;
|
|
47
45
|
for (const [targetName, targetConfig] of Object.entries(projectConfiguration.targets ?? {})) {
|
|
@@ -63,7 +61,7 @@ function replacePackageInProjectConfigurations(tree, oldPackageName, newPackageN
|
|
|
63
61
|
}
|
|
64
62
|
}
|
|
65
63
|
if (needsUpdate) {
|
|
66
|
-
updateProjectConfiguration(tree, projectName, projectConfiguration);
|
|
64
|
+
(0, devkit_exports_1.updateProjectConfiguration)(tree, projectName, projectConfiguration);
|
|
67
65
|
}
|
|
68
66
|
}
|
|
69
67
|
}
|
|
@@ -71,7 +69,7 @@ function replacePackageInNxJson(tree, oldPackageName, newPackageName) {
|
|
|
71
69
|
if (!tree.exists('nx.json')) {
|
|
72
70
|
return;
|
|
73
71
|
}
|
|
74
|
-
const nxJson = readNxJson(tree);
|
|
72
|
+
const nxJson = (0, devkit_exports_1.readNxJson)(tree);
|
|
75
73
|
let needsUpdate = false;
|
|
76
74
|
for (const [targetName, targetConfig] of Object.entries(nxJson.targetDefaults ?? {})) {
|
|
77
75
|
if (!targetConfig.executor) {
|
|
@@ -92,7 +90,7 @@ function replacePackageInNxJson(tree, oldPackageName, newPackageName) {
|
|
|
92
90
|
}
|
|
93
91
|
}
|
|
94
92
|
if (needsUpdate) {
|
|
95
|
-
updateNxJson(tree, nxJson);
|
|
93
|
+
(0, devkit_exports_1.updateNxJson)(tree, nxJson);
|
|
96
94
|
}
|
|
97
95
|
}
|
|
98
96
|
function replaceMentions(tree, oldPackageName, newPackageName) {
|
|
@@ -119,7 +117,7 @@ function replaceMentions(tree, oldPackageName, newPackageName) {
|
|
|
119
117
|
catch {
|
|
120
118
|
// Its **probably** ok, contents can be null if the file is too large or
|
|
121
119
|
// there was an access exception.
|
|
122
|
-
logger.warn(`An error was thrown when trying to update ${path}. If you believe the migration should have updated it, be sure to review the file and open an issue.`);
|
|
120
|
+
devkit_exports_1.logger.warn(`An error was thrown when trying to update ${path}. If you believe the migration should have updated it, be sure to review the file and open an issue.`);
|
|
123
121
|
}
|
|
124
122
|
});
|
|
125
123
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { CreateNodes, Tree } from 'nx/src/devkit-exports';
|
|
2
2
|
export declare function replaceProjectConfigurationsWithPlugin<T = unknown>(tree: Tree, rootMappings: Map<string, string>, pluginPath: string, createNodes: CreateNodes<T>, pluginOptions: T): Promise<void>;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.replaceProjectConfigurationsWithPlugin = void 0;
|
|
4
|
-
const
|
|
5
|
-
const
|
|
4
|
+
const devkit_exports_1 = require("nx/src/devkit-exports");
|
|
5
|
+
const devkit_internals_1 = require("nx/src/devkit-internals");
|
|
6
6
|
async function replaceProjectConfigurationsWithPlugin(tree, rootMappings, pluginPath, createNodes, pluginOptions) {
|
|
7
|
-
const nxJson = readNxJson(tree);
|
|
7
|
+
const nxJson = (0, devkit_exports_1.readNxJson)(tree);
|
|
8
8
|
const hasPlugin = nxJson.plugins?.some((p) => typeof p === 'string' ? p === pluginPath : p.plugin === pluginPath);
|
|
9
9
|
if (hasPlugin) {
|
|
10
10
|
return;
|
|
@@ -14,16 +14,16 @@ async function replaceProjectConfigurationsWithPlugin(tree, rootMappings, plugin
|
|
|
14
14
|
plugin: pluginPath,
|
|
15
15
|
options: pluginOptions,
|
|
16
16
|
});
|
|
17
|
-
updateNxJson(tree, nxJson);
|
|
17
|
+
(0, devkit_exports_1.updateNxJson)(tree, nxJson);
|
|
18
18
|
const [pluginGlob, createNodesFunction] = createNodes;
|
|
19
|
-
const configFiles = glob(tree, [pluginGlob]);
|
|
19
|
+
const configFiles = (0, devkit_exports_1.glob)(tree, [pluginGlob]);
|
|
20
20
|
for (const configFile of configFiles) {
|
|
21
21
|
try {
|
|
22
|
-
const projectName = findProjectForPath(configFile, rootMappings);
|
|
23
|
-
const projectConfig = readProjectConfiguration(tree, projectName);
|
|
22
|
+
const projectName = (0, devkit_internals_1.findProjectForPath)(configFile, rootMappings);
|
|
23
|
+
const projectConfig = (0, devkit_exports_1.readProjectConfiguration)(tree, projectName);
|
|
24
24
|
const nodes = await createNodesFunction(configFile, pluginOptions, {
|
|
25
25
|
workspaceRoot: tree.root,
|
|
26
|
-
nxJsonConfiguration: readNxJson(tree),
|
|
26
|
+
nxJsonConfiguration: (0, devkit_exports_1.readNxJson)(tree),
|
|
27
27
|
configFiles,
|
|
28
28
|
});
|
|
29
29
|
const node = nodes.projects[Object.keys(nodes.projects)[0]];
|
|
@@ -35,7 +35,7 @@ async function replaceProjectConfigurationsWithPlugin(tree, rootMappings, plugin
|
|
|
35
35
|
const targetFromCreateNodes = node.targets[targetName];
|
|
36
36
|
removeConfigurationDefinedByPlugin(targetName, targetFromProjectConfig, targetFromCreateNodes, projectConfig);
|
|
37
37
|
}
|
|
38
|
-
updateProjectConfiguration(tree, projectName, projectConfig);
|
|
38
|
+
(0, devkit_exports_1.updateProjectConfiguration)(tree, projectName, projectConfig);
|
|
39
39
|
}
|
|
40
40
|
catch (e) {
|
|
41
41
|
console.error(e);
|
|
@@ -103,7 +103,7 @@ function equals(a, b) {
|
|
|
103
103
|
return a.length === b.length && a.every((v, i) => v === b[i]);
|
|
104
104
|
}
|
|
105
105
|
if (typeof a === 'object' && typeof b === 'object') {
|
|
106
|
-
return hashObject(a) === hashObject(b);
|
|
106
|
+
return (0, devkit_internals_1.hashObject)(a) === (0, devkit_internals_1.hashObject)(b);
|
|
107
107
|
}
|
|
108
108
|
return a === b;
|
|
109
109
|
}
|
|
@@ -122,7 +122,7 @@ function shouldRemoveArrayProperty(arrayValuesFromProjectConfiguration, arrayVal
|
|
|
122
122
|
else {
|
|
123
123
|
for (const arrayValue of setOfArrayValuesFromProjectConfiguration.values()) {
|
|
124
124
|
if (typeof arrayValue !== 'string' &&
|
|
125
|
-
hashObject(arrayValue) === hashObject(arrayValueFromCreateNodes)) {
|
|
125
|
+
(0, devkit_internals_1.hashObject)(arrayValue) === (0, devkit_internals_1.hashObject)(arrayValueFromCreateNodes)) {
|
|
126
126
|
setOfArrayValuesFromProjectConfiguration.delete(arrayValue);
|
|
127
127
|
// Continue the outer loop, breaking out of this loop
|
|
128
128
|
continue loopThroughArrayValuesFromCreateNodes;
|
package/nx.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function requireNx(): typeof import('nx/src/devkit-exports') & Partial<typeof import('nx/src/devkit-internals')>;
|
package/nx.js
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.requireNx = void 0;
|
|
4
|
-
// After Nx v19, this can be removed and replaced with either:
|
|
5
|
-
// - import {} from 'nx/src/devkit-exports'
|
|
6
|
-
// - import {} from 'nx/src/devkit-internals'
|
|
7
|
-
function requireNx() {
|
|
8
|
-
let result = { ...require('nx/src/devkit-exports') };
|
|
9
|
-
try {
|
|
10
|
-
result = {
|
|
11
|
-
...result,
|
|
12
|
-
// Remove in Nx v19, devkit should not support Nx v16.0.2 at that point.
|
|
13
|
-
...require('nx/src/devkit-internals'),
|
|
14
|
-
};
|
|
15
|
-
}
|
|
16
|
-
catch { }
|
|
17
|
-
return result;
|
|
18
|
-
}
|
|
19
|
-
exports.requireNx = requireNx;
|