@nx/workspace 17.0.0-beta.6 → 17.0.0-rc.0
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/index.d.ts +0 -8
- package/index.js +1 -18
- package/package.json +4 -6
- package/src/generators/move/lib/extract-base-configs.js +3 -3
- package/src/generators/move/lib/update-eslint-config.js +2 -2
- package/src/generators/new/files-root-app/package.json__tmpl__ +1 -1
- package/src/migrations/update-16-0-0/move-workspace-generators-to-local-plugin.js +1 -1
- package/src/utilities/typescript.d.ts +0 -9
- package/src/utilities/typescript.js +1 -16
- package/src/utilities/run-tasks-in-serial.d.ts +0 -8
- package/src/utilities/run-tasks-in-serial.js +0 -17
- package/src/utilities/version-utils.d.ts +0 -4
- package/src/utilities/version-utils.js +0 -13
- package/src/utils/fileutils.d.ts +0 -24
- package/src/utils/fileutils.js +0 -66
- package/src/utils/rules/add-install-task.d.ts +0 -7
- package/src/utils/rules/add-install-task.js +0 -17
- package/src/utils/rules/deleteFile.d.ts +0 -6
- package/src/utils/rules/deleteFile.js +0 -11
- package/src/utils/rules/format-files.d.ts +0 -7
- package/src/utils/rules/format-files.js +0 -61
- package/src/utils/rules/visit-not-ignored-files.d.ts +0 -6
- package/src/utils/rules/visit-not-ignored-files.js +0 -38
- package/src/utils/strings.d.ts +0 -107
- package/src/utils/strings.js +0 -159
- package/src/utils/testing-utils.d.ts +0 -45
- package/src/utils/testing-utils.js +0 -85
- package/src/utils/version-utils.d.ts +0 -1
- package/src/utils/version-utils.js +0 -4
- package/src/utils/workspace.d.ts +0 -20
- package/src/utils/workspace.js +0 -85
- package/testing.d.ts +0 -1
- package/testing.js +0 -5
package/index.d.ts
CHANGED
|
@@ -5,16 +5,8 @@ export { names } from '@nx/devkit';
|
|
|
5
5
|
export { output } from './src/utilities/output';
|
|
6
6
|
export { readWorkspaceConfig, readPackageJson, } from 'nx/src/project-graph/file-utils';
|
|
7
7
|
export { getWorkspacePath, editTarget, parseTarget, serializeTarget, } from './src/utils/cli-config-utils';
|
|
8
|
-
export { getWorkspace, updateWorkspace, updateBuilderConfig, } from './src/utils/workspace';
|
|
9
8
|
export { Linter } from './src/utils/lint';
|
|
10
|
-
export { addInstallTask } from './src/utils/rules/add-install-task';
|
|
11
|
-
export { formatFiles } from './src/utils/rules/format-files';
|
|
12
|
-
export { deleteFile } from './src/utils/rules/deleteFile';
|
|
13
|
-
export { visitNotIgnoredFiles } from './src/utils/rules/visit-not-ignored-files';
|
|
14
|
-
import * as strings from './src/utils/strings';
|
|
15
|
-
export { checkAndCleanWithSemver } from './src/utils/version-utils';
|
|
16
9
|
export { moveGenerator } from './src/generators/move/move';
|
|
17
10
|
export { removeGenerator } from './src/generators/remove/remove';
|
|
18
11
|
export { runCommandsGenerator } from './src/generators/run-commands/run-commands';
|
|
19
12
|
export { convertToNxProjectGenerator } from './src/generators/convert-to-nx-project/convert-to-nx-project';
|
|
20
|
-
export declare const stringUtils: typeof strings;
|
package/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.convertToNxProjectGenerator = exports.runCommandsGenerator = exports.removeGenerator = exports.moveGenerator = exports.serializeTarget = exports.parseTarget = exports.editTarget = exports.getWorkspacePath = exports.readPackageJson = exports.readWorkspaceConfig = exports.output = exports.names = exports.createDirectory = exports.copyFile = exports.updateJsonFile = exports.renameSync = exports.projectRootDir = exports.ProjectType = exports.readTsConfig = void 0;
|
|
4
4
|
var ts_config_1 = require("./src/utilities/ts-config");
|
|
5
5
|
Object.defineProperty(exports, "readTsConfig", { enumerable: true, get: function () { return ts_config_1.readTsConfig; } });
|
|
6
6
|
var project_type_1 = require("./src/utils/project-type");
|
|
@@ -23,22 +23,6 @@ Object.defineProperty(exports, "getWorkspacePath", { enumerable: true, get: func
|
|
|
23
23
|
Object.defineProperty(exports, "editTarget", { enumerable: true, get: function () { return cli_config_utils_1.editTarget; } });
|
|
24
24
|
Object.defineProperty(exports, "parseTarget", { enumerable: true, get: function () { return cli_config_utils_1.parseTarget; } });
|
|
25
25
|
Object.defineProperty(exports, "serializeTarget", { enumerable: true, get: function () { return cli_config_utils_1.serializeTarget; } });
|
|
26
|
-
var workspace_1 = require("./src/utils/workspace");
|
|
27
|
-
Object.defineProperty(exports, "getWorkspace", { enumerable: true, get: function () { return workspace_1.getWorkspace; } });
|
|
28
|
-
Object.defineProperty(exports, "updateWorkspace", { enumerable: true, get: function () { return workspace_1.updateWorkspace; } });
|
|
29
|
-
Object.defineProperty(exports, "updateBuilderConfig", { enumerable: true, get: function () { return workspace_1.updateBuilderConfig; } });
|
|
30
|
-
var add_install_task_1 = require("./src/utils/rules/add-install-task");
|
|
31
|
-
Object.defineProperty(exports, "addInstallTask", { enumerable: true, get: function () { return add_install_task_1.addInstallTask; } });
|
|
32
|
-
var format_files_1 = require("./src/utils/rules/format-files");
|
|
33
|
-
Object.defineProperty(exports, "formatFiles", { enumerable: true, get: function () { return format_files_1.formatFiles; } });
|
|
34
|
-
var deleteFile_1 = require("./src/utils/rules/deleteFile");
|
|
35
|
-
Object.defineProperty(exports, "deleteFile", { enumerable: true, get: function () { return deleteFile_1.deleteFile; } });
|
|
36
|
-
var visit_not_ignored_files_1 = require("./src/utils/rules/visit-not-ignored-files");
|
|
37
|
-
Object.defineProperty(exports, "visitNotIgnoredFiles", { enumerable: true, get: function () { return visit_not_ignored_files_1.visitNotIgnoredFiles; } });
|
|
38
|
-
const strings = require("./src/utils/strings");
|
|
39
|
-
// TODO(v17): Remove this export.
|
|
40
|
-
var version_utils_1 = require("./src/utils/version-utils");
|
|
41
|
-
Object.defineProperty(exports, "checkAndCleanWithSemver", { enumerable: true, get: function () { return version_utils_1.checkAndCleanWithSemver; } });
|
|
42
26
|
var move_1 = require("./src/generators/move/move");
|
|
43
27
|
Object.defineProperty(exports, "moveGenerator", { enumerable: true, get: function () { return move_1.moveGenerator; } });
|
|
44
28
|
var remove_1 = require("./src/generators/remove/remove");
|
|
@@ -47,4 +31,3 @@ var run_commands_1 = require("./src/generators/run-commands/run-commands");
|
|
|
47
31
|
Object.defineProperty(exports, "runCommandsGenerator", { enumerable: true, get: function () { return run_commands_1.runCommandsGenerator; } });
|
|
48
32
|
var convert_to_nx_project_1 = require("./src/generators/convert-to-nx-project/convert-to-nx-project");
|
|
49
33
|
Object.defineProperty(exports, "convertToNxProjectGenerator", { enumerable: true, get: function () { return convert_to_nx_project_1.convertToNxProjectGenerator; } });
|
|
50
|
-
exports.stringUtils = strings;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nx/workspace",
|
|
3
|
-
"version": "17.0.0-
|
|
3
|
+
"version": "17.0.0-rc.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "The Workspace plugin contains executors and generators that are useful for any Nx workspace. It should be present in every Nx workspace and other plugins build on it.",
|
|
6
6
|
"repository": {
|
|
@@ -61,15 +61,13 @@
|
|
|
61
61
|
}
|
|
62
62
|
},
|
|
63
63
|
"dependencies": {
|
|
64
|
-
"@nx/devkit": "17.0.0-
|
|
64
|
+
"@nx/devkit": "17.0.0-rc.0",
|
|
65
65
|
"chalk": "^4.1.0",
|
|
66
66
|
"enquirer": "~2.3.6",
|
|
67
|
-
"ignore": "^5.0.4",
|
|
68
|
-
"rxjs": "^7.8.0",
|
|
69
67
|
"tslib": "^2.3.0",
|
|
70
68
|
"yargs-parser": "21.1.1",
|
|
71
|
-
"nx": "17.0.0-
|
|
72
|
-
"@nrwl/workspace": "17.0.0-
|
|
69
|
+
"nx": "17.0.0-rc.0",
|
|
70
|
+
"@nrwl/workspace": "17.0.0-rc.0"
|
|
73
71
|
},
|
|
74
72
|
"publishConfig": {
|
|
75
73
|
"access": "public"
|
|
@@ -34,13 +34,13 @@ function maybeExtractEslintConfigIfRootProject(tree, rootProject) {
|
|
|
34
34
|
let migrateConfigToMonorepoStyle;
|
|
35
35
|
try {
|
|
36
36
|
migrateConfigToMonorepoStyle = require('@nx/' +
|
|
37
|
-
'
|
|
37
|
+
'eslint/src/generators/init/init-migration').migrateConfigToMonorepoStyle;
|
|
38
38
|
}
|
|
39
39
|
catch {
|
|
40
|
-
//
|
|
40
|
+
// eslint not installed
|
|
41
41
|
}
|
|
42
42
|
// Only need to handle migrating the root rootProject.
|
|
43
|
-
// If other libs/apps exist, then this migration is already done by `@nx/
|
|
43
|
+
// If other libs/apps exist, then this migration is already done by `@nx/eslint:lint-rootProject` generator.
|
|
44
44
|
migrateConfigToMonorepoStyle?.([rootProject.name], tree, tree.exists((0, devkit_1.joinPathFragments)(rootProject.root, 'jest.config.ts')) ||
|
|
45
45
|
tree.exists((0, devkit_1.joinPathFragments)(rootProject.root, 'jest.config.js'))
|
|
46
46
|
? 'jest'
|
|
@@ -15,14 +15,14 @@ function updateEslintConfig(tree, schema, project) {
|
|
|
15
15
|
try {
|
|
16
16
|
const { updateRelativePathsInConfig,
|
|
17
17
|
// nx-ignore-next-line
|
|
18
|
-
} = require('@nx/
|
|
18
|
+
} = require('@nx/eslint/src/generators/utils/eslint-file');
|
|
19
19
|
updateRelativePathsInConfig(tree, project.root, schema.relativeToRootDestination);
|
|
20
20
|
}
|
|
21
21
|
catch {
|
|
22
22
|
devkit_1.output.warn({
|
|
23
23
|
title: `Could not update the eslint config file.`,
|
|
24
24
|
bodyLines: [
|
|
25
|
-
'The @nx/
|
|
25
|
+
'The @nx/eslint package could not be loaded. Please update the paths in eslint config manually.',
|
|
26
26
|
],
|
|
27
27
|
});
|
|
28
28
|
}
|
|
@@ -113,7 +113,7 @@ async function createNewPlugin(tree) {
|
|
|
113
113
|
// nx-ignore-next-line
|
|
114
114
|
require('@nx/plugin/src/generators/plugin/plugin');
|
|
115
115
|
// nx-ignore-next-line
|
|
116
|
-
const { Linter } = (0, devkit_1.ensurePackage)('@nx/
|
|
116
|
+
const { Linter } = (0, devkit_1.ensurePackage)('@nx/eslint', versions_1.nxVersion);
|
|
117
117
|
const { npmScope } = (0, devkit_1.getWorkspaceLayout)(tree);
|
|
118
118
|
const importPath = npmScope ? `@${npmScope}/${PROJECT_NAME}` : PROJECT_NAME;
|
|
119
119
|
await pluginGenerator(tree, {
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { Tree } from '@nx/devkit';
|
|
2
1
|
import type * as ts from 'typescript';
|
|
3
2
|
export { compileTypeScript } from './typescript/compilation';
|
|
4
3
|
export type { TypeScriptCompilationOptions } from './typescript/compilation';
|
|
@@ -12,11 +11,3 @@ export { getSourceNodes } from './typescript/get-source-nodes';
|
|
|
12
11
|
*/
|
|
13
12
|
export declare function resolveModuleByImport(importExpr: string, filePath: string, tsConfigPath: string): string;
|
|
14
13
|
export declare function ensureTypescript(): typeof ts;
|
|
15
|
-
/**
|
|
16
|
-
* @deprecated Please import this from @nx/js instead. This function will be removed in v17
|
|
17
|
-
*/
|
|
18
|
-
export declare function getRelativePathToRootTsConfig(tree: Tree, targetPath: string): string;
|
|
19
|
-
/**
|
|
20
|
-
* @deprecated Please import this from @nx/js instead. This function will be removed in v17
|
|
21
|
-
*/
|
|
22
|
-
export declare function getRootTsConfigPathInTree(tree: Tree): string;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.ensureTypescript = exports.resolveModuleByImport = exports.getSourceNodes = exports.compileTypeScript = void 0;
|
|
4
4
|
const devkit_1 = require("@nx/devkit");
|
|
5
5
|
const path_1 = require("path");
|
|
6
6
|
const versions_1 = require("../utils/versions");
|
|
@@ -53,18 +53,3 @@ function ensureTypescript() {
|
|
|
53
53
|
return (0, devkit_1.ensurePackage)('typescript', versions_1.typescriptVersion);
|
|
54
54
|
}
|
|
55
55
|
exports.ensureTypescript = ensureTypescript;
|
|
56
|
-
const ts_config_1 = require("./ts-config");
|
|
57
|
-
/**
|
|
58
|
-
* @deprecated Please import this from @nx/js instead. This function will be removed in v17
|
|
59
|
-
*/
|
|
60
|
-
function getRelativePathToRootTsConfig(tree, targetPath) {
|
|
61
|
-
return (0, ts_config_1.getRelativePathToRootTsConfig)(tree, targetPath);
|
|
62
|
-
}
|
|
63
|
-
exports.getRelativePathToRootTsConfig = getRelativePathToRootTsConfig;
|
|
64
|
-
/**
|
|
65
|
-
* @deprecated Please import this from @nx/js instead. This function will be removed in v17
|
|
66
|
-
*/
|
|
67
|
-
function getRootTsConfigPathInTree(tree) {
|
|
68
|
-
return (0, ts_config_1.getRootTsConfigPathInTree)(tree);
|
|
69
|
-
}
|
|
70
|
-
exports.getRootTsConfigPathInTree = getRootTsConfigPathInTree;
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import type { GeneratorCallback } from '@nx/devkit';
|
|
2
|
-
/**
|
|
3
|
-
* Run tasks in serial
|
|
4
|
-
*
|
|
5
|
-
* @deprecated This function will be removed from `@nx/workspace` in version 17. Prefer importing it from `@nx/devkit`.
|
|
6
|
-
* @param tasks The tasks to run in serial.
|
|
7
|
-
*/
|
|
8
|
-
export declare function runTasksInSerial(...tasks: GeneratorCallback[]): GeneratorCallback;
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.runTasksInSerial = void 0;
|
|
4
|
-
/**
|
|
5
|
-
* Run tasks in serial
|
|
6
|
-
*
|
|
7
|
-
* @deprecated This function will be removed from `@nx/workspace` in version 17. Prefer importing it from `@nx/devkit`.
|
|
8
|
-
* @param tasks The tasks to run in serial.
|
|
9
|
-
*/
|
|
10
|
-
function runTasksInSerial(...tasks) {
|
|
11
|
-
return async () => {
|
|
12
|
-
for (const task of tasks) {
|
|
13
|
-
await task();
|
|
14
|
-
}
|
|
15
|
-
};
|
|
16
|
-
}
|
|
17
|
-
exports.runTasksInSerial = runTasksInSerial;
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
/** @deprecated Use checkAndCleanWithSemver from @nx/devkit/src/utils/semver instead.
|
|
2
|
-
* TODO(v17): Remove this function from workspace. Keep it for now since there are projects that use it (e.g. https://github.com/gperdomor/nx-tools).
|
|
3
|
-
*/
|
|
4
|
-
export declare function checkAndCleanWithSemver(pkgName: string, version: string): string;
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.checkAndCleanWithSemver = void 0;
|
|
4
|
-
const semver_1 = require("@nx/devkit/src/utils/semver");
|
|
5
|
-
const devkit_1 = require("@nx/devkit");
|
|
6
|
-
/** @deprecated Use checkAndCleanWithSemver from @nx/devkit/src/utils/semver instead.
|
|
7
|
-
* TODO(v17): Remove this function from workspace. Keep it for now since there are projects that use it (e.g. https://github.com/gperdomor/nx-tools).
|
|
8
|
-
*/
|
|
9
|
-
function checkAndCleanWithSemver(pkgName, version) {
|
|
10
|
-
devkit_1.logger.warn(`checkAndCleanWithSemver has been moved to @nx/devkit/src/utils/semver`);
|
|
11
|
-
return (0, semver_1.checkAndCleanWithSemver)(pkgName, version);
|
|
12
|
-
}
|
|
13
|
-
exports.checkAndCleanWithSemver = checkAndCleanWithSemver;
|
package/src/utils/fileutils.d.ts
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import { createDirectory, directoryExists, fileExists, isRelativePath } from 'nx/src/utils/fileutils';
|
|
2
|
-
export { fileExists, directoryExists, isRelativePath, createDirectory };
|
|
3
|
-
/**
|
|
4
|
-
* @deprecated This will be removed in v17.
|
|
5
|
-
*/
|
|
6
|
-
export declare function writeToFile(filePath: string, str: string): void;
|
|
7
|
-
/**
|
|
8
|
-
* @deprecated This will be removed in v17.
|
|
9
|
-
* This method is specifically for updating a JSON file using the filesystem
|
|
10
|
-
*
|
|
11
|
-
* @remarks
|
|
12
|
-
* If you are looking to update a JSON file in a tree, look for ./ast-utils#updateJsonInTree
|
|
13
|
-
* @param path Path of the JSON file on the filesystem
|
|
14
|
-
* @param callback Manipulation of the JSON data
|
|
15
|
-
*/
|
|
16
|
-
export declare function updateJsonFile(path: string, callback: (a: any) => any): void;
|
|
17
|
-
/**
|
|
18
|
-
* @deprecated This will be removed in v17.
|
|
19
|
-
*/
|
|
20
|
-
export declare function copyFile(file: string, target: string): void;
|
|
21
|
-
/**
|
|
22
|
-
* @deprecated This will be removed in v17.
|
|
23
|
-
*/
|
|
24
|
-
export declare function renameSync(from: string, to: string, cb: (err: Error | null) => void): void;
|
package/src/utils/fileutils.js
DELETED
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.renameSync = exports.copyFile = exports.updateJsonFile = exports.writeToFile = exports.createDirectory = exports.isRelativePath = exports.directoryExists = exports.fileExists = void 0;
|
|
4
|
-
const fs_1 = require("fs");
|
|
5
|
-
const path_1 = require("path");
|
|
6
|
-
const fileutils_1 = require("nx/src/utils/fileutils");
|
|
7
|
-
Object.defineProperty(exports, "createDirectory", { enumerable: true, get: function () { return fileutils_1.createDirectory; } });
|
|
8
|
-
Object.defineProperty(exports, "directoryExists", { enumerable: true, get: function () { return fileutils_1.directoryExists; } });
|
|
9
|
-
Object.defineProperty(exports, "fileExists", { enumerable: true, get: function () { return fileutils_1.fileExists; } });
|
|
10
|
-
Object.defineProperty(exports, "isRelativePath", { enumerable: true, get: function () { return fileutils_1.isRelativePath; } });
|
|
11
|
-
/**
|
|
12
|
-
* @deprecated This will be removed in v17.
|
|
13
|
-
*/
|
|
14
|
-
function writeToFile(filePath, str) {
|
|
15
|
-
(0, fs_1.mkdirSync)((0, path_1.dirname)(filePath), { recursive: true });
|
|
16
|
-
(0, fs_1.writeFileSync)(filePath, str);
|
|
17
|
-
}
|
|
18
|
-
exports.writeToFile = writeToFile;
|
|
19
|
-
/**
|
|
20
|
-
* @deprecated This will be removed in v17.
|
|
21
|
-
* This method is specifically for updating a JSON file using the filesystem
|
|
22
|
-
*
|
|
23
|
-
* @remarks
|
|
24
|
-
* If you are looking to update a JSON file in a tree, look for ./ast-utils#updateJsonInTree
|
|
25
|
-
* @param path Path of the JSON file on the filesystem
|
|
26
|
-
* @param callback Manipulation of the JSON data
|
|
27
|
-
*/
|
|
28
|
-
function updateJsonFile(path, callback) {
|
|
29
|
-
const json = (0, fileutils_1.readJsonFile)(path);
|
|
30
|
-
callback(json);
|
|
31
|
-
(0, fileutils_1.writeJsonFile)(path, json);
|
|
32
|
-
}
|
|
33
|
-
exports.updateJsonFile = updateJsonFile;
|
|
34
|
-
/**
|
|
35
|
-
* @deprecated This will be removed in v17.
|
|
36
|
-
*/
|
|
37
|
-
function copyFile(file, target) {
|
|
38
|
-
const f = (0, path_1.basename)(file);
|
|
39
|
-
const source = (0, fs_1.createReadStream)(file);
|
|
40
|
-
const dest = (0, fs_1.createWriteStream)((0, path_1.resolve)(target, f));
|
|
41
|
-
source.pipe(dest);
|
|
42
|
-
source.on('error', (e) => console.error(e));
|
|
43
|
-
}
|
|
44
|
-
exports.copyFile = copyFile;
|
|
45
|
-
/**
|
|
46
|
-
* @deprecated This will be removed in v17.
|
|
47
|
-
*/
|
|
48
|
-
function renameSync(from, to, cb) {
|
|
49
|
-
try {
|
|
50
|
-
if (!(0, fs_1.existsSync)(from)) {
|
|
51
|
-
throw new Error(`Path: ${from} does not exist`);
|
|
52
|
-
}
|
|
53
|
-
else if ((0, fs_1.existsSync)(to)) {
|
|
54
|
-
throw new Error(`Path: ${to} already exists`);
|
|
55
|
-
}
|
|
56
|
-
// Make sure parent path exists
|
|
57
|
-
const parentPath = (0, path_1.resolve)(to, '..');
|
|
58
|
-
(0, fileutils_1.createDirectory)(parentPath);
|
|
59
|
-
(0, fs_1.renameSync)(from, to);
|
|
60
|
-
cb(null);
|
|
61
|
-
}
|
|
62
|
-
catch (e) {
|
|
63
|
-
cb(e);
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
exports.renameSync = renameSync;
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import type { Rule } from '@angular-devkit/schematics';
|
|
2
|
-
/**
|
|
3
|
-
* @deprecated This will be removed in v17. Prefer writing Nx Generators with @nx/devkit. This function can be replaced with 'addDependenciesToPackageJson' from @nx/devkit.
|
|
4
|
-
*/
|
|
5
|
-
export declare function addInstallTask(options?: {
|
|
6
|
-
skipInstall: boolean;
|
|
7
|
-
}): Rule;
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.addInstallTask = void 0;
|
|
4
|
-
let installAdded = false;
|
|
5
|
-
/**
|
|
6
|
-
* @deprecated This will be removed in v17. Prefer writing Nx Generators with @nx/devkit. This function can be replaced with 'addDependenciesToPackageJson' from @nx/devkit.
|
|
7
|
-
*/
|
|
8
|
-
function addInstallTask(options = { skipInstall: false }) {
|
|
9
|
-
const { NodePackageInstallTask, } = require('@angular-devkit/schematics/tasks');
|
|
10
|
-
return (_, context) => {
|
|
11
|
-
if (!options.skipInstall && !installAdded) {
|
|
12
|
-
context.addTask(new NodePackageInstallTask());
|
|
13
|
-
installAdded = true;
|
|
14
|
-
}
|
|
15
|
-
};
|
|
16
|
-
}
|
|
17
|
-
exports.addInstallTask = addInstallTask;
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import type { Rule } from '@angular-devkit/schematics';
|
|
2
|
-
/**
|
|
3
|
-
* Remove a file from the Virtual Schematic Tree
|
|
4
|
-
* @deprecated This will be removed in v17. Prefer writing Nx Generators with @nx/devkit. This function can be replaced with 'Tree.delete' from @nx/devkit.
|
|
5
|
-
*/
|
|
6
|
-
export declare function deleteFile(from: string): Rule;
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.deleteFile = void 0;
|
|
4
|
-
/**
|
|
5
|
-
* Remove a file from the Virtual Schematic Tree
|
|
6
|
-
* @deprecated This will be removed in v17. Prefer writing Nx Generators with @nx/devkit. This function can be replaced with 'Tree.delete' from @nx/devkit.
|
|
7
|
-
*/
|
|
8
|
-
function deleteFile(from) {
|
|
9
|
-
return (host) => host.delete(from);
|
|
10
|
-
}
|
|
11
|
-
exports.deleteFile = deleteFile;
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { Rule } from '@angular-devkit/schematics';
|
|
2
|
-
/**
|
|
3
|
-
* @deprecated This will be removed in v17. Prefer writing Nx Generators with @nx/devkit. This function can be replaced with 'formatFiles' from @nx/devkit.
|
|
4
|
-
*/
|
|
5
|
-
export declare function formatFiles(options?: {
|
|
6
|
-
skipFormat: boolean;
|
|
7
|
-
}, directory?: string): Rule;
|
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.formatFiles = void 0;
|
|
4
|
-
const schematics_1 = require("@angular-devkit/schematics");
|
|
5
|
-
const rxjs_1 = require("rxjs");
|
|
6
|
-
const operators_1 = require("rxjs/operators");
|
|
7
|
-
const path = require("path");
|
|
8
|
-
const devkit_1 = require("@nx/devkit");
|
|
9
|
-
/**
|
|
10
|
-
* @deprecated This will be removed in v17. Prefer writing Nx Generators with @nx/devkit. This function can be replaced with 'formatFiles' from @nx/devkit.
|
|
11
|
-
*/
|
|
12
|
-
function formatFiles(options = { skipFormat: false }, directory = '') {
|
|
13
|
-
let prettier;
|
|
14
|
-
try {
|
|
15
|
-
prettier = require('prettier');
|
|
16
|
-
}
|
|
17
|
-
catch (e) { }
|
|
18
|
-
if (options.skipFormat) {
|
|
19
|
-
return (0, schematics_1.noop)();
|
|
20
|
-
}
|
|
21
|
-
return (host, context) => {
|
|
22
|
-
if (!prettier) {
|
|
23
|
-
return host;
|
|
24
|
-
}
|
|
25
|
-
const files = new Set(host.actions
|
|
26
|
-
.filter((action) => action.kind !== 'd' && action.kind !== 'r')
|
|
27
|
-
.map((action) => ({
|
|
28
|
-
path: action.path,
|
|
29
|
-
content: action.content.toString(),
|
|
30
|
-
})));
|
|
31
|
-
if (files.size === 0) {
|
|
32
|
-
return host;
|
|
33
|
-
}
|
|
34
|
-
return (0, rxjs_1.from)(files).pipe((0, operators_1.filter)((file) => host.exists(file.path)), (0, operators_1.mergeMap)(async (file) => {
|
|
35
|
-
const systemPath = path.join(devkit_1.workspaceRoot, file.path);
|
|
36
|
-
let options = {
|
|
37
|
-
filepath: systemPath,
|
|
38
|
-
};
|
|
39
|
-
const resolvedOptions = await prettier.resolveConfig(systemPath);
|
|
40
|
-
if (resolvedOptions) {
|
|
41
|
-
options = {
|
|
42
|
-
...options,
|
|
43
|
-
...resolvedOptions,
|
|
44
|
-
};
|
|
45
|
-
}
|
|
46
|
-
const support = await prettier.getFileInfo(systemPath, options);
|
|
47
|
-
if (support.ignored || !support.inferredParser) {
|
|
48
|
-
return;
|
|
49
|
-
}
|
|
50
|
-
try {
|
|
51
|
-
host.overwrite(file.path,
|
|
52
|
-
// In prettier v3 the format result is a promise
|
|
53
|
-
await prettier.format(file.content, options));
|
|
54
|
-
}
|
|
55
|
-
catch (e) {
|
|
56
|
-
context.logger.warn(`Could not format ${file.path} because ${e.message}`);
|
|
57
|
-
}
|
|
58
|
-
}), (0, operators_1.map)(() => host));
|
|
59
|
-
};
|
|
60
|
-
}
|
|
61
|
-
exports.formatFiles = formatFiles;
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import { Path } from '@angular-devkit/core';
|
|
2
|
-
import { Rule, SchematicContext, Tree } from '@angular-devkit/schematics';
|
|
3
|
-
/**
|
|
4
|
-
* @deprecated This will be removed in v17. Prefer writing Nx Generators with @nx/devkit. This function can be replaced with 'visitNotIgnoredFiles' from @nx/devkit.
|
|
5
|
-
*/
|
|
6
|
-
export declare function visitNotIgnoredFiles(visitor: (file: Path, host: Tree, context: SchematicContext) => void | Rule, dir?: Path): Rule;
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.visitNotIgnoredFiles = void 0;
|
|
4
|
-
const core_1 = require("@angular-devkit/core");
|
|
5
|
-
const schematics_1 = require("@angular-devkit/schematics");
|
|
6
|
-
const ignore_1 = require("ignore");
|
|
7
|
-
/**
|
|
8
|
-
* @deprecated This will be removed in v17. Prefer writing Nx Generators with @nx/devkit. This function can be replaced with 'visitNotIgnoredFiles' from @nx/devkit.
|
|
9
|
-
*/
|
|
10
|
-
function visitNotIgnoredFiles(visitor, dir = (0, core_1.normalize)('')) {
|
|
11
|
-
return (host, context) => {
|
|
12
|
-
let ig;
|
|
13
|
-
if (host.exists('.gitignore')) {
|
|
14
|
-
ig = (0, ignore_1.default)();
|
|
15
|
-
ig.add(host.read('.gitignore').toString());
|
|
16
|
-
}
|
|
17
|
-
function visit(_dir) {
|
|
18
|
-
if (_dir && ig?.ignores(_dir)) {
|
|
19
|
-
return;
|
|
20
|
-
}
|
|
21
|
-
const dirEntry = host.getDir(_dir);
|
|
22
|
-
dirEntry.subfiles.forEach((file) => {
|
|
23
|
-
if (ig?.ignores((0, core_1.join)(_dir, file))) {
|
|
24
|
-
return;
|
|
25
|
-
}
|
|
26
|
-
const maybeRule = visitor((0, core_1.join)(_dir, file), host, context);
|
|
27
|
-
if (maybeRule) {
|
|
28
|
-
(0, schematics_1.callRule)(maybeRule, host, context).subscribe();
|
|
29
|
-
}
|
|
30
|
-
});
|
|
31
|
-
dirEntry.subdirs.forEach((subdir) => {
|
|
32
|
-
visit((0, core_1.join)(_dir, subdir));
|
|
33
|
-
});
|
|
34
|
-
}
|
|
35
|
-
visit(dir);
|
|
36
|
-
};
|
|
37
|
-
}
|
|
38
|
-
exports.visitNotIgnoredFiles = visitNotIgnoredFiles;
|
package/src/utils/strings.d.ts
DELETED
|
@@ -1,107 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Converts a camelized string into all lower case separated by underscores.
|
|
3
|
-
*
|
|
4
|
-
```javascript
|
|
5
|
-
decamelize('innerHTML'); // 'inner_html'
|
|
6
|
-
decamelize('action_name'); // 'action_name'
|
|
7
|
-
decamelize('css-class-name'); // 'css-class-name'
|
|
8
|
-
decamelize('my favorite items'); // 'my favorite items'
|
|
9
|
-
```
|
|
10
|
-
|
|
11
|
-
@method decamelize
|
|
12
|
-
@deprecated This will be removed from `@nx/workspace` in version 17. Prefer `@nx/js` when importing.
|
|
13
|
-
@param {String} str The string to decamelize.
|
|
14
|
-
@return {String} the decamelized string.
|
|
15
|
-
*/
|
|
16
|
-
export declare function decamelize(str: string): string;
|
|
17
|
-
/**
|
|
18
|
-
Replaces underscores, spaces, periods, or camelCase with dashes.
|
|
19
|
-
|
|
20
|
-
```javascript
|
|
21
|
-
dasherize('innerHTML'); // 'inner-html'
|
|
22
|
-
dasherize('action_name'); // 'action-name'
|
|
23
|
-
dasherize('css-class-name'); // 'css-class-name'
|
|
24
|
-
dasherize('my favorite items'); // 'my-favorite-items'
|
|
25
|
-
dasherize('nrwl.io'); // 'nrwl-io'
|
|
26
|
-
```
|
|
27
|
-
|
|
28
|
-
@method dasherize
|
|
29
|
-
@deprecated This will be removed from `@nx/workspace` in version 17. Prefer `@nx/js` when importing.
|
|
30
|
-
@param {String} str The string to dasherize.
|
|
31
|
-
@return {String} the dasherized string.
|
|
32
|
-
*/
|
|
33
|
-
export declare function dasherize(str?: string): string;
|
|
34
|
-
/**
|
|
35
|
-
Returns the lowerCamelCase form of a string.
|
|
36
|
-
|
|
37
|
-
```javascript
|
|
38
|
-
camelize('innerHTML'); // 'innerHTML'
|
|
39
|
-
camelize('action_name'); // 'actionName'
|
|
40
|
-
camelize('css-class-name'); // 'cssClassName'
|
|
41
|
-
camelize('my favorite items'); // 'myFavoriteItems'
|
|
42
|
-
camelize('My Favorite Items'); // 'myFavoriteItems'
|
|
43
|
-
```
|
|
44
|
-
|
|
45
|
-
@method camelize
|
|
46
|
-
@deprecated This will be removed from `@nx/workspace` in version 17. Prefer `@nx/js` when importing.
|
|
47
|
-
@param {String} str The string to camelize.
|
|
48
|
-
@return {String} the camelized string.
|
|
49
|
-
*/
|
|
50
|
-
export declare function camelize(str: string): string;
|
|
51
|
-
/**
|
|
52
|
-
Returns the UpperCamelCase form of a string.
|
|
53
|
-
|
|
54
|
-
```javascript
|
|
55
|
-
'innerHTML'.classify(); // 'InnerHTML'
|
|
56
|
-
'action_name'.classify(); // 'ActionName'
|
|
57
|
-
'css-class-name'.classify(); // 'CssClassName'
|
|
58
|
-
'my favorite items'.classify(); // 'MyFavoriteItems'
|
|
59
|
-
```
|
|
60
|
-
|
|
61
|
-
@method classify
|
|
62
|
-
@deprecated This will be removed from `@nx/workspace` in version 17. Prefer `@nx/js` when importing.
|
|
63
|
-
@param {String} str the string to classify
|
|
64
|
-
@return {String} the classified string
|
|
65
|
-
*/
|
|
66
|
-
export declare function classify(str: string): string;
|
|
67
|
-
/**
|
|
68
|
-
More general than decamelize. Returns the lower\_case\_and\_underscored
|
|
69
|
-
form of a string.
|
|
70
|
-
|
|
71
|
-
```javascript
|
|
72
|
-
'innerHTML'.underscore(); // 'inner_html'
|
|
73
|
-
'action_name'.underscore(); // 'action_name'
|
|
74
|
-
'css-class-name'.underscore(); // 'css_class_name'
|
|
75
|
-
'my favorite items'.underscore(); // 'my_favorite_items'
|
|
76
|
-
```
|
|
77
|
-
|
|
78
|
-
@method underscore
|
|
79
|
-
@deprecated This will be removed from `@nx/workspace` in version 17. Prefer `@nx/js` when importing.
|
|
80
|
-
@param {String} str The string to underscore.
|
|
81
|
-
@return {String} the underscored string.
|
|
82
|
-
*/
|
|
83
|
-
export declare function underscore(str: string): string;
|
|
84
|
-
/**
|
|
85
|
-
Returns the Capitalized form of a string
|
|
86
|
-
|
|
87
|
-
```javascript
|
|
88
|
-
'innerHTML'.capitalize() // 'InnerHTML'
|
|
89
|
-
'action_name'.capitalize() // 'Action_name'
|
|
90
|
-
'css-class-name'.capitalize() // 'Css-class-name'
|
|
91
|
-
'my favorite items'.capitalize() // 'My favorite items'
|
|
92
|
-
```
|
|
93
|
-
|
|
94
|
-
@method capitalize
|
|
95
|
-
@deprecated This will be removed from `@nx/workspace` in version 17. Prefer `@nx/js` when importing.
|
|
96
|
-
@param {String} str The string to capitalize.
|
|
97
|
-
@return {String} The capitalized string.
|
|
98
|
-
*/
|
|
99
|
-
export declare function capitalize(str: string): string;
|
|
100
|
-
/**
|
|
101
|
-
* @deprecated This will be removed from `@nx/workspace` in version 17. Prefer `@nx/js` when importing.
|
|
102
|
-
*/
|
|
103
|
-
export declare function group(name: string, group: string | undefined): string;
|
|
104
|
-
/**
|
|
105
|
-
* @deprecated This will be removed from `@nx/workspace` in version 17. Prefer `@nx/js` when importing.
|
|
106
|
-
*/
|
|
107
|
-
export declare function featurePath(group: boolean | undefined, flat: boolean | undefined, path: string, name: string): string;
|
package/src/utils/strings.js
DELETED
|
@@ -1,159 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.featurePath = exports.group = exports.capitalize = exports.underscore = exports.classify = exports.camelize = exports.dasherize = exports.decamelize = void 0;
|
|
4
|
-
/**
|
|
5
|
-
* @license
|
|
6
|
-
* Copyright Google Inc. All Rights Reserved.
|
|
7
|
-
*
|
|
8
|
-
* Use of this source code is governed by an MIT-style license that can be
|
|
9
|
-
* found in the LICENSE file at https://angular.io/license
|
|
10
|
-
*/
|
|
11
|
-
const STRING_DASHERIZE_REGEXP = /[ _.]/g;
|
|
12
|
-
const STRING_DECAMELIZE_REGEXP = /([a-z\d])([A-Z])/g;
|
|
13
|
-
const STRING_CAMELIZE_REGEXP = /(-|_|\.|\s)+(.)?/g;
|
|
14
|
-
const STRING_UNDERSCORE_REGEXP_1 = /([a-z\d])([A-Z]+)/g;
|
|
15
|
-
const STRING_UNDERSCORE_REGEXP_2 = /-|\s+/g;
|
|
16
|
-
/**
|
|
17
|
-
* Converts a camelized string into all lower case separated by underscores.
|
|
18
|
-
*
|
|
19
|
-
```javascript
|
|
20
|
-
decamelize('innerHTML'); // 'inner_html'
|
|
21
|
-
decamelize('action_name'); // 'action_name'
|
|
22
|
-
decamelize('css-class-name'); // 'css-class-name'
|
|
23
|
-
decamelize('my favorite items'); // 'my favorite items'
|
|
24
|
-
```
|
|
25
|
-
|
|
26
|
-
@method decamelize
|
|
27
|
-
@deprecated This will be removed from `@nx/workspace` in version 17. Prefer `@nx/js` when importing.
|
|
28
|
-
@param {String} str The string to decamelize.
|
|
29
|
-
@return {String} the decamelized string.
|
|
30
|
-
*/
|
|
31
|
-
function decamelize(str) {
|
|
32
|
-
return str.replace(STRING_DECAMELIZE_REGEXP, '$1_$2').toLowerCase();
|
|
33
|
-
}
|
|
34
|
-
exports.decamelize = decamelize;
|
|
35
|
-
/**
|
|
36
|
-
Replaces underscores, spaces, periods, or camelCase with dashes.
|
|
37
|
-
|
|
38
|
-
```javascript
|
|
39
|
-
dasherize('innerHTML'); // 'inner-html'
|
|
40
|
-
dasherize('action_name'); // 'action-name'
|
|
41
|
-
dasherize('css-class-name'); // 'css-class-name'
|
|
42
|
-
dasherize('my favorite items'); // 'my-favorite-items'
|
|
43
|
-
dasherize('nrwl.io'); // 'nrwl-io'
|
|
44
|
-
```
|
|
45
|
-
|
|
46
|
-
@method dasherize
|
|
47
|
-
@deprecated This will be removed from `@nx/workspace` in version 17. Prefer `@nx/js` when importing.
|
|
48
|
-
@param {String} str The string to dasherize.
|
|
49
|
-
@return {String} the dasherized string.
|
|
50
|
-
*/
|
|
51
|
-
function dasherize(str) {
|
|
52
|
-
return decamelize(str || '').replace(STRING_DASHERIZE_REGEXP, '-');
|
|
53
|
-
}
|
|
54
|
-
exports.dasherize = dasherize;
|
|
55
|
-
/**
|
|
56
|
-
Returns the lowerCamelCase form of a string.
|
|
57
|
-
|
|
58
|
-
```javascript
|
|
59
|
-
camelize('innerHTML'); // 'innerHTML'
|
|
60
|
-
camelize('action_name'); // 'actionName'
|
|
61
|
-
camelize('css-class-name'); // 'cssClassName'
|
|
62
|
-
camelize('my favorite items'); // 'myFavoriteItems'
|
|
63
|
-
camelize('My Favorite Items'); // 'myFavoriteItems'
|
|
64
|
-
```
|
|
65
|
-
|
|
66
|
-
@method camelize
|
|
67
|
-
@deprecated This will be removed from `@nx/workspace` in version 17. Prefer `@nx/js` when importing.
|
|
68
|
-
@param {String} str The string to camelize.
|
|
69
|
-
@return {String} the camelized string.
|
|
70
|
-
*/
|
|
71
|
-
function camelize(str) {
|
|
72
|
-
return str
|
|
73
|
-
.replace(STRING_CAMELIZE_REGEXP, (_match, _separator, chr) => {
|
|
74
|
-
return chr ? chr.toUpperCase() : '';
|
|
75
|
-
})
|
|
76
|
-
.replace(/^([A-Z])/, (match) => match.toLowerCase());
|
|
77
|
-
}
|
|
78
|
-
exports.camelize = camelize;
|
|
79
|
-
/**
|
|
80
|
-
Returns the UpperCamelCase form of a string.
|
|
81
|
-
|
|
82
|
-
```javascript
|
|
83
|
-
'innerHTML'.classify(); // 'InnerHTML'
|
|
84
|
-
'action_name'.classify(); // 'ActionName'
|
|
85
|
-
'css-class-name'.classify(); // 'CssClassName'
|
|
86
|
-
'my favorite items'.classify(); // 'MyFavoriteItems'
|
|
87
|
-
```
|
|
88
|
-
|
|
89
|
-
@method classify
|
|
90
|
-
@deprecated This will be removed from `@nx/workspace` in version 17. Prefer `@nx/js` when importing.
|
|
91
|
-
@param {String} str the string to classify
|
|
92
|
-
@return {String} the classified string
|
|
93
|
-
*/
|
|
94
|
-
function classify(str) {
|
|
95
|
-
return str
|
|
96
|
-
.split('.')
|
|
97
|
-
.map((part) => capitalize(camelize(part)))
|
|
98
|
-
.join('.');
|
|
99
|
-
}
|
|
100
|
-
exports.classify = classify;
|
|
101
|
-
/**
|
|
102
|
-
More general than decamelize. Returns the lower\_case\_and\_underscored
|
|
103
|
-
form of a string.
|
|
104
|
-
|
|
105
|
-
```javascript
|
|
106
|
-
'innerHTML'.underscore(); // 'inner_html'
|
|
107
|
-
'action_name'.underscore(); // 'action_name'
|
|
108
|
-
'css-class-name'.underscore(); // 'css_class_name'
|
|
109
|
-
'my favorite items'.underscore(); // 'my_favorite_items'
|
|
110
|
-
```
|
|
111
|
-
|
|
112
|
-
@method underscore
|
|
113
|
-
@deprecated This will be removed from `@nx/workspace` in version 17. Prefer `@nx/js` when importing.
|
|
114
|
-
@param {String} str The string to underscore.
|
|
115
|
-
@return {String} the underscored string.
|
|
116
|
-
*/
|
|
117
|
-
function underscore(str) {
|
|
118
|
-
return str
|
|
119
|
-
.replace(STRING_UNDERSCORE_REGEXP_1, '$1_$2')
|
|
120
|
-
.replace(STRING_UNDERSCORE_REGEXP_2, '_')
|
|
121
|
-
.toLowerCase();
|
|
122
|
-
}
|
|
123
|
-
exports.underscore = underscore;
|
|
124
|
-
/**
|
|
125
|
-
Returns the Capitalized form of a string
|
|
126
|
-
|
|
127
|
-
```javascript
|
|
128
|
-
'innerHTML'.capitalize() // 'InnerHTML'
|
|
129
|
-
'action_name'.capitalize() // 'Action_name'
|
|
130
|
-
'css-class-name'.capitalize() // 'Css-class-name'
|
|
131
|
-
'my favorite items'.capitalize() // 'My favorite items'
|
|
132
|
-
```
|
|
133
|
-
|
|
134
|
-
@method capitalize
|
|
135
|
-
@deprecated This will be removed from `@nx/workspace` in version 17. Prefer `@nx/js` when importing.
|
|
136
|
-
@param {String} str The string to capitalize.
|
|
137
|
-
@return {String} The capitalized string.
|
|
138
|
-
*/
|
|
139
|
-
function capitalize(str) {
|
|
140
|
-
return str.charAt(0).toUpperCase() + str.slice(1);
|
|
141
|
-
}
|
|
142
|
-
exports.capitalize = capitalize;
|
|
143
|
-
/**
|
|
144
|
-
* @deprecated This will be removed from `@nx/workspace` in version 17. Prefer `@nx/js` when importing.
|
|
145
|
-
*/
|
|
146
|
-
function group(name, group) {
|
|
147
|
-
return group ? `${group}/${name}` : name;
|
|
148
|
-
}
|
|
149
|
-
exports.group = group;
|
|
150
|
-
/**
|
|
151
|
-
* @deprecated This will be removed from `@nx/workspace` in version 17. Prefer `@nx/js` when importing.
|
|
152
|
-
*/
|
|
153
|
-
function featurePath(group, flat, path, name) {
|
|
154
|
-
if (group && !flat) {
|
|
155
|
-
return `../../${path}/${name}/`;
|
|
156
|
-
}
|
|
157
|
-
return group ? `../${path}/` : './';
|
|
158
|
-
}
|
|
159
|
-
exports.featurePath = featurePath;
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
import { Architect, BuilderContext, Target } from '@angular-devkit/architect';
|
|
2
|
-
import { TestingArchitectHost } from '@angular-devkit/architect/testing';
|
|
3
|
-
import { json, JsonObject } from '@angular-devkit/core';
|
|
4
|
-
import { ScheduleOptions } from '@angular-devkit/architect/src/api';
|
|
5
|
-
import { LoggerApi, LogLevel } from '@angular-devkit/core/src/logger';
|
|
6
|
-
declare class NoopLogger implements LoggerApi {
|
|
7
|
-
private _log;
|
|
8
|
-
createChild(name: string): any;
|
|
9
|
-
includes(substr: string): boolean;
|
|
10
|
-
debug(message: string, metadata?: JsonObject): void;
|
|
11
|
-
error(message: string, metadata?: JsonObject): void;
|
|
12
|
-
fatal(message: string, metadata?: JsonObject): void;
|
|
13
|
-
info(message: string, metadata?: JsonObject): void;
|
|
14
|
-
log(level: LogLevel, message: string, metadata?: JsonObject): void;
|
|
15
|
-
warn(message: string, metadata?: JsonObject): void;
|
|
16
|
-
}
|
|
17
|
-
/**
|
|
18
|
-
* Mock context which makes testing builders easier
|
|
19
|
-
* @deprecated This will be removed in v17. Prefer writing Nx Generators with @nx/devkit.
|
|
20
|
-
*/
|
|
21
|
-
export declare class MockBuilderContext implements BuilderContext {
|
|
22
|
-
private architect;
|
|
23
|
-
private architectHost;
|
|
24
|
-
id: 0;
|
|
25
|
-
builder: any;
|
|
26
|
-
analytics: any;
|
|
27
|
-
target: Target;
|
|
28
|
-
logger: NoopLogger;
|
|
29
|
-
get currentDirectory(): string;
|
|
30
|
-
get workspaceRoot(): string;
|
|
31
|
-
constructor(architect: Architect, architectHost: TestingArchitectHost);
|
|
32
|
-
addBuilderFromPackage(path: string): Promise<void>;
|
|
33
|
-
addTarget(target: Target, builderName: string): Promise<void>;
|
|
34
|
-
getBuilderNameForTarget(target: Target): Promise<string>;
|
|
35
|
-
scheduleTarget(target: Target, overrides?: JsonObject, scheduleOptions?: ScheduleOptions): Promise<import("@angular-devkit/architect").BuilderRun>;
|
|
36
|
-
scheduleBuilder(name: string, overrides?: JsonObject, scheduleOptions?: ScheduleOptions): Promise<import("@angular-devkit/architect").BuilderRun>;
|
|
37
|
-
getTargetOptions(target: Target): Promise<JsonObject>;
|
|
38
|
-
validateOptions<T extends JsonObject = JsonObject>(options: JsonObject, builderName: string): Promise<T>;
|
|
39
|
-
reportRunning(): void;
|
|
40
|
-
reportStatus(status: string): void;
|
|
41
|
-
reportProgress(current: number, total?: number, status?: string): void;
|
|
42
|
-
addTeardown(teardown: () => Promise<void> | void): void;
|
|
43
|
-
getProjectMetadata(target: Target | string): Promise<json.JsonObject | null>;
|
|
44
|
-
}
|
|
45
|
-
export {};
|
|
@@ -1,85 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.MockBuilderContext = void 0;
|
|
4
|
-
class NoopLogger {
|
|
5
|
-
constructor() {
|
|
6
|
-
this._log = '';
|
|
7
|
-
}
|
|
8
|
-
createChild(name) {
|
|
9
|
-
return new NoopLogger();
|
|
10
|
-
}
|
|
11
|
-
includes(substr) {
|
|
12
|
-
return this._log.includes(substr);
|
|
13
|
-
}
|
|
14
|
-
debug(message, metadata) {
|
|
15
|
-
this._log += message;
|
|
16
|
-
}
|
|
17
|
-
error(message, metadata) {
|
|
18
|
-
this._log += message;
|
|
19
|
-
}
|
|
20
|
-
fatal(message, metadata) {
|
|
21
|
-
this._log += message;
|
|
22
|
-
}
|
|
23
|
-
info(message, metadata) {
|
|
24
|
-
this._log += message;
|
|
25
|
-
}
|
|
26
|
-
log(level, message, metadata) {
|
|
27
|
-
this._log += message;
|
|
28
|
-
}
|
|
29
|
-
warn(message, metadata) {
|
|
30
|
-
this._log += message;
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
/**
|
|
34
|
-
* Mock context which makes testing builders easier
|
|
35
|
-
* @deprecated This will be removed in v17. Prefer writing Nx Generators with @nx/devkit.
|
|
36
|
-
*/
|
|
37
|
-
class MockBuilderContext {
|
|
38
|
-
get currentDirectory() {
|
|
39
|
-
return this.architectHost.currentDirectory;
|
|
40
|
-
}
|
|
41
|
-
get workspaceRoot() {
|
|
42
|
-
return this.architectHost.workspaceRoot;
|
|
43
|
-
}
|
|
44
|
-
constructor(architect, architectHost) {
|
|
45
|
-
this.architect = architect;
|
|
46
|
-
this.architectHost = architectHost;
|
|
47
|
-
this.builder = {};
|
|
48
|
-
this.analytics = null;
|
|
49
|
-
this.target = {
|
|
50
|
-
project: null,
|
|
51
|
-
target: null,
|
|
52
|
-
};
|
|
53
|
-
this.logger = new NoopLogger();
|
|
54
|
-
}
|
|
55
|
-
async addBuilderFromPackage(path) {
|
|
56
|
-
return await this.architectHost.addBuilderFromPackage(path);
|
|
57
|
-
}
|
|
58
|
-
async addTarget(target, builderName) {
|
|
59
|
-
return this.architectHost.addTarget(target, builderName);
|
|
60
|
-
}
|
|
61
|
-
getBuilderNameForTarget(target) {
|
|
62
|
-
return this.architectHost.getBuilderNameForTarget(target);
|
|
63
|
-
}
|
|
64
|
-
scheduleTarget(target, overrides, scheduleOptions) {
|
|
65
|
-
return this.architect.scheduleTarget(target, overrides, scheduleOptions);
|
|
66
|
-
}
|
|
67
|
-
scheduleBuilder(name, overrides, scheduleOptions) {
|
|
68
|
-
return this.architect.scheduleBuilder(name, overrides, scheduleOptions);
|
|
69
|
-
}
|
|
70
|
-
getTargetOptions(target) {
|
|
71
|
-
return this.architectHost.getOptionsForTarget(target);
|
|
72
|
-
}
|
|
73
|
-
validateOptions(options, builderName) {
|
|
74
|
-
return Promise.resolve(options);
|
|
75
|
-
}
|
|
76
|
-
reportRunning() { }
|
|
77
|
-
reportStatus(status) { }
|
|
78
|
-
reportProgress(current, total, status) { }
|
|
79
|
-
addTeardown(teardown) { }
|
|
80
|
-
async getProjectMetadata(target) {
|
|
81
|
-
return (this.architectHost &&
|
|
82
|
-
this.architectHost.getProjectMetadata(target));
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
exports.MockBuilderContext = MockBuilderContext;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from '../utilities/version-utils';
|
package/src/utils/workspace.d.ts
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import type { Rule, Tree } from '@angular-devkit/schematics';
|
|
2
|
-
import { JsonArray, JsonObject, workspaces } from '@angular-devkit/core';
|
|
3
|
-
import { ProjectDefinition, TargetDefinition } from '@angular-devkit/core/src/workspace';
|
|
4
|
-
/**
|
|
5
|
-
* @deprecated This will be removed in v17. Prefer writing Nx Generators with @nx/devkit. This function can be replaced with 'getProjects' with Nx Devkit.
|
|
6
|
-
*/
|
|
7
|
-
export declare function getWorkspace(tree: Tree, path?: string): Promise<workspaces.WorkspaceDefinition>;
|
|
8
|
-
/**
|
|
9
|
-
* @deprecated This will be removed in v17. Prefer writing Nx Generators with @nx/devkit. This function can be replaced with 'updateProjectConfiguration' with Nx Devkit.
|
|
10
|
-
*/
|
|
11
|
-
export declare function updateWorkspace(updater: (workspace: workspaces.WorkspaceDefinition) => void | PromiseLike<void>): Rule;
|
|
12
|
-
/**
|
|
13
|
-
* @deprecated This will be removed in v17. Prefer writing Nx Generators with @nx/devkit. This function can be replaced with 'updateProjectConfiguration' with Nx Devkit.
|
|
14
|
-
*/
|
|
15
|
-
export declare function updateWorkspace(workspace: workspaces.WorkspaceDefinition): Rule;
|
|
16
|
-
/**
|
|
17
|
-
* Updates builder options for options and configurations for given builder names
|
|
18
|
-
* @deprecated This will be removed in v17. Prefer writing Nx Generators with @nx/devkit. This function can be replaced with 'forEachExecutorOptions' with Nx Devkit.
|
|
19
|
-
*/
|
|
20
|
-
export declare function updateBuilderConfig(updater: (currentValue: Record<string, string | number | boolean | JsonArray | JsonObject>, target?: TargetDefinition, project?: ProjectDefinition) => Record<string, string | number | boolean | JsonArray | JsonObject>, ...builderNames: string[]): Rule;
|
package/src/utils/workspace.js
DELETED
|
@@ -1,85 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.updateBuilderConfig = exports.updateWorkspace = exports.getWorkspace = void 0;
|
|
4
|
-
const core_1 = require("@angular-devkit/core");
|
|
5
|
-
function createHost(tree) {
|
|
6
|
-
return {
|
|
7
|
-
async readFile(path) {
|
|
8
|
-
const data = tree.read(path);
|
|
9
|
-
if (!data) {
|
|
10
|
-
throw new Error('File not found.');
|
|
11
|
-
}
|
|
12
|
-
return data.toString();
|
|
13
|
-
},
|
|
14
|
-
async writeFile(path, data) {
|
|
15
|
-
return tree.overwrite(path, data);
|
|
16
|
-
},
|
|
17
|
-
async isDirectory(path) {
|
|
18
|
-
// approximate a directory check
|
|
19
|
-
// special case needed when testing wrapped schematics
|
|
20
|
-
if (path === '/')
|
|
21
|
-
return true;
|
|
22
|
-
return !tree.exists(path) && tree.getDir(path).subfiles.length > 0;
|
|
23
|
-
},
|
|
24
|
-
async isFile(path) {
|
|
25
|
-
return tree.exists(path);
|
|
26
|
-
},
|
|
27
|
-
};
|
|
28
|
-
}
|
|
29
|
-
/**
|
|
30
|
-
* @deprecated This will be removed in v17. Prefer writing Nx Generators with @nx/devkit. This function can be replaced with 'getProjects' with Nx Devkit.
|
|
31
|
-
*/
|
|
32
|
-
async function getWorkspace(tree, path = '/') {
|
|
33
|
-
const host = createHost(tree);
|
|
34
|
-
const { workspace } = await core_1.workspaces.readWorkspace(path, host);
|
|
35
|
-
return workspace;
|
|
36
|
-
}
|
|
37
|
-
exports.getWorkspace = getWorkspace;
|
|
38
|
-
/**
|
|
39
|
-
* @deprecated This will be removed in v17. Prefer writing Nx Generators with @nx/devkit. This function can be replaced with 'updateProjectConfiguration' with Nx Devkit.
|
|
40
|
-
*/
|
|
41
|
-
function updateWorkspace(updaterOrWorkspace) {
|
|
42
|
-
return async (tree) => {
|
|
43
|
-
const host = createHost(tree);
|
|
44
|
-
if (typeof updaterOrWorkspace === 'function') {
|
|
45
|
-
const { workspace } = await core_1.workspaces.readWorkspace('/', host);
|
|
46
|
-
const result = updaterOrWorkspace(workspace);
|
|
47
|
-
if (result !== undefined) {
|
|
48
|
-
await result;
|
|
49
|
-
}
|
|
50
|
-
await core_1.workspaces.writeWorkspace(workspace, host);
|
|
51
|
-
}
|
|
52
|
-
else {
|
|
53
|
-
await core_1.workspaces.writeWorkspace(updaterOrWorkspace, host);
|
|
54
|
-
}
|
|
55
|
-
};
|
|
56
|
-
}
|
|
57
|
-
exports.updateWorkspace = updateWorkspace;
|
|
58
|
-
/**
|
|
59
|
-
* Updates builder options for options and configurations for given builder names
|
|
60
|
-
* @deprecated This will be removed in v17. Prefer writing Nx Generators with @nx/devkit. This function can be replaced with 'forEachExecutorOptions' with Nx Devkit.
|
|
61
|
-
*/
|
|
62
|
-
function updateBuilderConfig(updater, ...builderNames) {
|
|
63
|
-
return updateWorkspace((workspace) => {
|
|
64
|
-
if (!workspace.projects) {
|
|
65
|
-
return;
|
|
66
|
-
}
|
|
67
|
-
workspace.projects.forEach((project) => {
|
|
68
|
-
project.targets.forEach((target) => {
|
|
69
|
-
if (!builderNames.includes(target.builder)) {
|
|
70
|
-
return;
|
|
71
|
-
}
|
|
72
|
-
if (target.options) {
|
|
73
|
-
target.options = updater(target.options, target, project);
|
|
74
|
-
}
|
|
75
|
-
if (!target.configurations) {
|
|
76
|
-
return;
|
|
77
|
-
}
|
|
78
|
-
Object.entries(target.configurations).forEach(([configName, options]) => {
|
|
79
|
-
target.configurations[configName] = updater(options, target, project);
|
|
80
|
-
});
|
|
81
|
-
});
|
|
82
|
-
});
|
|
83
|
-
});
|
|
84
|
-
}
|
|
85
|
-
exports.updateBuilderConfig = updateBuilderConfig;
|
package/testing.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { MockBuilderContext } from './src/utils/testing-utils';
|
package/testing.js
DELETED
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.MockBuilderContext = void 0;
|
|
4
|
-
var testing_utils_1 = require("./src/utils/testing-utils");
|
|
5
|
-
Object.defineProperty(exports, "MockBuilderContext", { enumerable: true, get: function () { return testing_utils_1.MockBuilderContext; } });
|