@nx/devkit 19.0.0-canary.20240430-458f2cc → 19.0.0-canary.20240502-5ded713
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 +3 -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 +2 -3
- 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 +2 -5
- package/src/generators/plugin-migrations/executor-to-plugin-migrator.js +11 -11
- 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 +9 -9
- 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.js +5 -5
- package/src/utils/convert-nx-executor.d.ts +1 -1
- package/src/utils/convert-nx-executor.js +19 -29
- 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,8 +1,7 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
3
|
exports.updateTsConfigsToJs = void 0;
|
4
|
-
const
|
5
|
-
const { updateJson } = (0, nx_1.requireNx)();
|
4
|
+
const devkit_exports_1 = require("nx/src/devkit-exports");
|
6
5
|
function updateTsConfigsToJs(tree, options) {
|
7
6
|
let updateConfigPath;
|
8
7
|
const paths = {
|
@@ -19,7 +18,7 @@ function updateTsConfigsToJs(tree, options) {
|
|
19
18
|
}
|
20
19
|
throw new Error(`project is missing tsconfig.lib.json or tsconfig.app.json`);
|
21
20
|
};
|
22
|
-
updateJson(tree, paths.tsConfig, (json) => {
|
21
|
+
(0, devkit_exports_1.updateJson)(tree, paths.tsConfig, (json) => {
|
23
22
|
if (json.compilerOptions) {
|
24
23
|
json.compilerOptions.allowJs = true;
|
25
24
|
}
|
@@ -35,7 +34,7 @@ function updateTsConfigsToJs(tree, options) {
|
|
35
34
|
if (projectType === 'application') {
|
36
35
|
updateConfigPath = paths.tsConfigApp;
|
37
36
|
}
|
38
|
-
updateJson(tree, updateConfigPath, (json) => {
|
37
|
+
(0, devkit_exports_1.updateJson)(tree, updateConfigPath, (json) => {
|
39
38
|
json.include = uniq([...json.include, 'src/**/*.js']);
|
40
39
|
json.exclude = uniq([
|
41
40
|
...json.exclude,
|
@@ -1,2 +1,2 @@
|
|
1
|
-
import type { Tree } from 'nx/src/
|
1
|
+
import type { Tree } from 'nx/src/devkit-exports';
|
2
2
|
export default function replacePackage(tree: Tree): Promise<void>;
|
@@ -1,4 +1,3 @@
|
|
1
|
-
import
|
2
|
-
import type { GeneratorCallback } from 'nx/src/config/misc-interfaces';
|
1
|
+
import { GeneratorCallback, Tree } from 'nx/src/devkit-exports';
|
3
2
|
declare const _default: (tree: Tree) => Promise<GeneratorCallback | void>;
|
4
3
|
export default _default;
|
@@ -2,10 +2,9 @@
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
3
|
const visit_not_ignored_files_1 = require("../../generators/visit-not-ignored-files");
|
4
4
|
const format_files_1 = require("../../generators/format-files");
|
5
|
-
const nx_1 = require("../../../nx");
|
6
5
|
const package_json_1 = require("../../utils/package-json");
|
7
6
|
const versions_1 = require("../../utils/versions");
|
8
|
-
const
|
7
|
+
const devkit_exports_1 = require("nx/src/devkit-exports");
|
9
8
|
let tsModule;
|
10
9
|
const MODULE_FEDERATION_PUBLIC_TOKENS = [
|
11
10
|
'AdditionalSharedConfig',
|
@@ -45,7 +44,7 @@ exports.default = async (tree) => {
|
|
45
44
|
});
|
46
45
|
if (hasFileToMigrate) {
|
47
46
|
await (0, format_files_1.formatFiles)(tree);
|
48
|
-
const pkgJson = readJson(tree, 'package.json');
|
47
|
+
const pkgJson = (0, devkit_exports_1.readJson)(tree, 'package.json');
|
49
48
|
const nxVersion = pkgJson.devDependencies?.['nx'] ??
|
50
49
|
pkgJson.dependencies?.['nx'] ??
|
51
50
|
'17.0.0';
|
@@ -1,5 +1,4 @@
|
|
1
|
-
import
|
2
|
-
import type { PackageManager } from 'nx/src/utils/package-manager';
|
1
|
+
import { PackageManager, Tree } from 'nx/src/devkit-exports';
|
3
2
|
/**
|
4
3
|
* Runs `npm install` or `yarn install`. It will skip running the install if
|
5
4
|
* `package.json` hasn't changed at all or it hasn't changed since the last invocation.
|
@@ -3,8 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.installPackagesTask = void 0;
|
4
4
|
const child_process_1 = require("child_process");
|
5
5
|
const path_1 = require("path");
|
6
|
-
const
|
7
|
-
const { detectPackageManager, getPackageManagerCommand, joinPathFragments } = (0, nx_1.requireNx)();
|
6
|
+
const devkit_exports_1 = require("nx/src/devkit-exports");
|
8
7
|
/**
|
9
8
|
* Runs `npm install` or `yarn install`. It will skip running the install if
|
10
9
|
* `package.json` hasn't changed at all or it hasn't changed since the last invocation.
|
@@ -12,19 +11,19 @@ const { detectPackageManager, getPackageManagerCommand, joinPathFragments } = (0
|
|
12
11
|
* @param tree - the file system tree
|
13
12
|
* @param alwaysRun - always run the command even if `package.json` hasn't changed.
|
14
13
|
*/
|
15
|
-
function installPackagesTask(tree, alwaysRun = false, cwd = '', packageManager = detectPackageManager(cwd)) {
|
14
|
+
function installPackagesTask(tree, alwaysRun = false, cwd = '', packageManager = (0, devkit_exports_1.detectPackageManager)(cwd)) {
|
16
15
|
if (!tree
|
17
16
|
.listChanges()
|
18
|
-
.find((f) => f.path === joinPathFragments(cwd, 'package.json')) &&
|
17
|
+
.find((f) => f.path === (0, devkit_exports_1.joinPathFragments)(cwd, 'package.json')) &&
|
19
18
|
!alwaysRun) {
|
20
19
|
return;
|
21
20
|
}
|
22
|
-
const packageJsonValue = tree.read(joinPathFragments(cwd, 'package.json'), 'utf-8');
|
21
|
+
const packageJsonValue = tree.read((0, devkit_exports_1.joinPathFragments)(cwd, 'package.json'), 'utf-8');
|
23
22
|
let storedPackageJsonValue = global['__packageJsonInstallCache__'];
|
24
23
|
// Don't install again if install was already executed with package.json
|
25
24
|
if (storedPackageJsonValue != packageJsonValue || alwaysRun) {
|
26
25
|
global['__packageJsonInstallCache__'] = packageJsonValue;
|
27
|
-
const pmc = getPackageManagerCommand(packageManager);
|
26
|
+
const pmc = (0, devkit_exports_1.getPackageManagerCommand)(packageManager);
|
28
27
|
const execSyncOptions = {
|
29
28
|
cwd: (0, path_1.join)(tree.root, cwd),
|
30
29
|
stdio: process.env.NX_GENERATE_QUIET === 'true' ? 'ignore' : 'inherit',
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import {
|
1
|
+
import { CreateNodes, ProjectGraph, Tree } from 'nx/src/devkit-exports';
|
2
2
|
/**
|
3
3
|
* Iterates through various forms of plugin options to find the one which does not conflict with the current graph
|
4
4
|
|
package/src/utils/add-plugin.js
CHANGED
@@ -2,15 +2,15 @@
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
3
|
exports.generateCombinations = exports.addPlugin = void 0;
|
4
4
|
const yargs = require("yargs-parser");
|
5
|
-
const
|
6
|
-
const
|
5
|
+
const devkit_exports_1 = require("nx/src/devkit-exports");
|
6
|
+
const devkit_internals_1 = require("nx/src/devkit-internals");
|
7
7
|
/**
|
8
8
|
* Iterates through various forms of plugin options to find the one which does not conflict with the current graph
|
9
9
|
|
10
10
|
*/
|
11
11
|
async function addPlugin(tree, graph, pluginName, createNodesTuple, options, shouldUpdatePackageJsonScripts) {
|
12
12
|
const graphNodes = Object.values(graph.nodes);
|
13
|
-
const nxJson = readNxJson(tree);
|
13
|
+
const nxJson = (0, devkit_exports_1.readNxJson)(tree);
|
14
14
|
let pluginOptions;
|
15
15
|
let projConfigs;
|
16
16
|
const combinations = generateCombinations(options);
|
@@ -25,8 +25,8 @@ async function addPlugin(tree, graph, pluginName, createNodesTuple, options, sho
|
|
25
25
|
}
|
26
26
|
global.NX_GRAPH_CREATION = true;
|
27
27
|
try {
|
28
|
-
projConfigs = await retrieveProjectConfigurations([
|
29
|
-
new LoadedNxPlugin({
|
28
|
+
projConfigs = await (0, devkit_internals_1.retrieveProjectConfigurations)([
|
29
|
+
new devkit_internals_1.LoadedNxPlugin({
|
30
30
|
name: pluginName,
|
31
31
|
createNodes: createNodesTuple,
|
32
32
|
}, {
|
@@ -37,7 +37,7 @@ async function addPlugin(tree, graph, pluginName, createNodesTuple, options, sho
|
|
37
37
|
}
|
38
38
|
catch (e) {
|
39
39
|
// Errors are okay for this because we're only running 1 plugin
|
40
|
-
if (e instanceof ProjectConfigurationsError) {
|
40
|
+
if (e instanceof devkit_internals_1.ProjectConfigurationsError) {
|
41
41
|
projConfigs = e.partialProjectConfigurationsResult;
|
42
42
|
}
|
43
43
|
else {
|
@@ -67,7 +67,7 @@ async function addPlugin(tree, graph, pluginName, createNodesTuple, options, sho
|
|
67
67
|
plugin: pluginName,
|
68
68
|
options: pluginOptions,
|
69
69
|
});
|
70
|
-
updateNxJson(tree, nxJson);
|
70
|
+
(0, devkit_exports_1.updateNxJson)(tree, nxJson);
|
71
71
|
if (shouldUpdatePackageJsonScripts) {
|
72
72
|
updatePackageScripts(tree, projConfigs);
|
73
73
|
}
|
@@ -84,7 +84,7 @@ function processProject(tree, projectRoot, projectConfiguration) {
|
|
84
84
|
if (!tree.exists(packageJsonPath)) {
|
85
85
|
return;
|
86
86
|
}
|
87
|
-
const packageJson = readJson(tree, packageJsonPath);
|
87
|
+
const packageJson = (0, devkit_exports_1.readJson)(tree, packageJsonPath);
|
88
88
|
if (!packageJson.scripts || !Object.keys(packageJson.scripts).length) {
|
89
89
|
return;
|
90
90
|
}
|
@@ -175,7 +175,7 @@ function processProject(tree, projectRoot, projectConfiguration) {
|
|
175
175
|
}
|
176
176
|
}
|
177
177
|
}
|
178
|
-
writeJson(tree, packageJsonPath, packageJson);
|
178
|
+
(0, devkit_exports_1.writeJson)(tree, packageJsonPath, packageJson);
|
179
179
|
}
|
180
180
|
function getInferredTargetCommands(project) {
|
181
181
|
const targetCommands = [];
|
@@ -1,2 +1,2 @@
|
|
1
|
-
import
|
1
|
+
import { CreateNodesContext } from 'nx/src/devkit-exports';
|
2
2
|
export declare function calculateHashForCreateNodes(projectRoot: string, options: object, context: CreateNodesContext, additionalGlobs?: string[]): string;
|
@@ -1,16 +1,16 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
3
|
exports.calculateHashForCreateNodes = void 0;
|
4
|
-
const nx_1 = require("../../nx");
|
5
4
|
const path_1 = require("path");
|
6
|
-
const
|
5
|
+
const devkit_exports_1 = require("nx/src/devkit-exports");
|
6
|
+
const devkit_internals_1 = require("nx/src/devkit-internals");
|
7
7
|
function calculateHashForCreateNodes(projectRoot, options, context, additionalGlobs = []) {
|
8
|
-
return hashArray([
|
9
|
-
hashWithWorkspaceContext(context.workspaceRoot, [
|
8
|
+
return (0, devkit_exports_1.hashArray)([
|
9
|
+
(0, devkit_internals_1.hashWithWorkspaceContext)(context.workspaceRoot, [
|
10
10
|
(0, path_1.join)(projectRoot, '**/*'),
|
11
11
|
...additionalGlobs,
|
12
12
|
]),
|
13
|
-
hashObject(options),
|
13
|
+
(0, devkit_internals_1.hashObject)(options),
|
14
14
|
]);
|
15
15
|
}
|
16
16
|
exports.calculateHashForCreateNodes = calculateHashForCreateNodes;
|
@@ -3,9 +3,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.clearRequireCache = exports.getRootTsConfigFileName = exports.getRootTsConfigPath = exports.loadConfigFile = exports.dynamicImport = void 0;
|
4
4
|
const path_1 = require("path");
|
5
5
|
const fs_1 = require("fs");
|
6
|
-
const nx_1 = require("../../nx");
|
7
6
|
const node_url_1 = require("node:url");
|
8
|
-
const
|
7
|
+
const devkit_exports_1 = require("nx/src/devkit-exports");
|
8
|
+
const devkit_internals_1 = require("nx/src/devkit-internals");
|
9
9
|
exports.dynamicImport = new Function('modulePath', 'return import(modulePath);');
|
10
10
|
async function loadConfigFile(configFilePath) {
|
11
11
|
{
|
@@ -16,7 +16,7 @@ async function loadConfigFile(configFilePath) {
|
|
16
16
|
? (0, path_1.join)((0, path_1.dirname)(configFilePath), 'tsconfig.json')
|
17
17
|
: getRootTsConfigPath();
|
18
18
|
if (tsConfigPath) {
|
19
|
-
const unregisterTsProject = registerTsProject(tsConfigPath);
|
19
|
+
const unregisterTsProject = (0, devkit_internals_1.registerTsProject)(tsConfigPath);
|
20
20
|
try {
|
21
21
|
module = await load(configFilePath);
|
22
22
|
}
|
@@ -37,12 +37,12 @@ async function loadConfigFile(configFilePath) {
|
|
37
37
|
exports.loadConfigFile = loadConfigFile;
|
38
38
|
function getRootTsConfigPath() {
|
39
39
|
const tsConfigFileName = getRootTsConfigFileName();
|
40
|
-
return tsConfigFileName ? (0, path_1.join)(workspaceRoot, tsConfigFileName) : null;
|
40
|
+
return tsConfigFileName ? (0, path_1.join)(devkit_exports_1.workspaceRoot, tsConfigFileName) : null;
|
41
41
|
}
|
42
42
|
exports.getRootTsConfigPath = getRootTsConfigPath;
|
43
43
|
function getRootTsConfigFileName() {
|
44
44
|
for (const tsConfigName of ['tsconfig.base.json', 'tsconfig.json']) {
|
45
|
-
const pathExists = (0, fs_1.existsSync)((0, path_1.join)(workspaceRoot, tsConfigName));
|
45
|
+
const pathExists = (0, fs_1.existsSync)((0, path_1.join)(devkit_exports_1.workspaceRoot, tsConfigName));
|
46
46
|
if (pathExists) {
|
47
47
|
return tsConfigName;
|
48
48
|
}
|
@@ -1,10 +1,9 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
3
|
exports.convertNxExecutor = void 0;
|
4
|
-
const nx_1 = require("../../nx");
|
5
4
|
const package_json_1 = require("./package-json");
|
6
5
|
const semver_1 = require("semver");
|
7
|
-
const
|
6
|
+
const devkit_internals_1 = require("nx/src/devkit-internals");
|
8
7
|
/**
|
9
8
|
* Convert an Nx Executor into an Angular Devkit Builder
|
10
9
|
*
|
@@ -13,34 +12,25 @@ const { Workspaces, readNxJsonFromDisk, retrieveProjectConfigurationsWithAngular
|
|
13
12
|
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
|
14
13
|
function convertNxExecutor(executor) {
|
15
14
|
const builderFunction = (options, builderContext) => {
|
16
|
-
const
|
17
|
-
const nxJsonConfiguration = readNxJsonFromDisk
|
18
|
-
? readNxJsonFromDisk(builderContext.workspaceRoot)
|
19
|
-
: // TODO(v19): remove readNxJson. This is to be backwards compatible with Nx 16.5 and below.
|
20
|
-
workspaces.readNxJson();
|
15
|
+
const nxJsonConfiguration = (0, devkit_internals_1.readNxJsonFromDisk)(builderContext.workspaceRoot);
|
21
16
|
const promise = async () => {
|
22
|
-
const projectsConfigurations =
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
}
|
40
|
-
: // TODO(v19): remove retrieveProjectConfigurations. This is to be backwards compatible with Nx 16.5 and below.
|
41
|
-
workspaces.readProjectsConfigurations({
|
42
|
-
_includeProjectsFromAngularJson: true,
|
43
|
-
});
|
17
|
+
const projectsConfigurations = {
|
18
|
+
version: 2,
|
19
|
+
projects: await (0, devkit_internals_1.retrieveProjectConfigurationsWithAngularProjects)(builderContext.workspaceRoot, nxJsonConfiguration).then((p) => {
|
20
|
+
if (p.projectNodes) {
|
21
|
+
return p.projectNodes;
|
22
|
+
}
|
23
|
+
// v18.3.4 changed projects to be keyed by root
|
24
|
+
// rather than project name
|
25
|
+
if ((0, semver_1.lt)(package_json_1.NX_VERSION, '18.3.4')) {
|
26
|
+
return p.projects;
|
27
|
+
}
|
28
|
+
if (devkit_internals_1.readProjectConfigurationsFromRootMap) {
|
29
|
+
return (0, devkit_internals_1.readProjectConfigurationsFromRootMap)(p.projects);
|
30
|
+
}
|
31
|
+
throw new Error('Unable to successfully map Nx executor -> Angular Builder');
|
32
|
+
}),
|
33
|
+
};
|
44
34
|
const context = {
|
45
35
|
root: builderContext.workspaceRoot,
|
46
36
|
projectName: builderContext.target.project,
|
@@ -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;
|