nx 18.3.0-beta.0 → 18.3.0-beta.2
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/bin/post-install.js +7 -5
- package/package.json +12 -12
- package/src/adapter/angular-json.d.ts +2 -1
- package/src/adapter/angular-json.js +1 -0
- package/src/adapter/ngcli-adapter.d.ts +2 -2
- package/src/adapter/ngcli-adapter.js +13 -13
- package/src/command-line/generate/generator-utils.js +2 -2
- package/src/command-line/init/implementation/add-nx-to-monorepo.js +1 -1
- package/src/command-line/init/implementation/add-nx-to-npm-repo.js +1 -1
- package/src/command-line/init/implementation/react/index.js +1 -1
- package/src/command-line/init/implementation/utils.d.ts +1 -1
- package/src/command-line/init/implementation/utils.js +2 -7
- package/src/command-line/init/init-v2.js +29 -37
- package/src/command-line/release/command-object.js +1 -1
- package/src/command-line/run/executor-utils.js +2 -2
- package/src/config/nx-json.d.ts +2 -1
- package/src/config/schema-utils.js +2 -2
- package/src/core/graph/3rdpartylicenses.txt +23 -26
- package/src/core/graph/main.js +1 -1
- package/src/core/graph/runtime.js +1 -1
- package/src/core/graph/styles.js +1 -1
- package/src/daemon/client/client.js +1 -2
- package/src/daemon/server/plugins.d.ts +3 -0
- package/src/daemon/server/plugins.js +22 -0
- package/src/daemon/server/project-graph-incremental-recomputation.js +11 -10
- package/src/daemon/server/shutdown-utils.js +2 -0
- package/src/devkit-exports.d.ts +3 -2
- package/src/devkit-internals.d.ts +3 -0
- package/src/devkit-internals.js +7 -1
- package/src/executors/run-commands/run-commands.impl.d.ts +4 -1
- package/src/executors/run-commands/run-commands.impl.js +51 -4
- package/src/executors/utils/convert-nx-executor.js +4 -1
- package/src/generators/utils/project-configuration.js +2 -2
- package/src/migrations/update-15-1-0/set-project-names.js +4 -2
- package/src/native/assert-supported-platform.js +1 -1
- package/src/plugins/js/index.d.ts +1 -1
- package/src/plugins/js/lock-file/lock-file.d.ts +1 -1
- package/src/plugins/js/lock-file/npm-parser.d.ts +1 -1
- package/src/plugins/js/lock-file/pnpm-parser.d.ts +1 -1
- package/src/plugins/js/lock-file/yarn-parser.d.ts +1 -1
- package/src/plugins/js/project-graph/build-dependencies/build-dependencies.d.ts +1 -1
- package/src/plugins/js/project-graph/build-dependencies/explicit-package-json-dependencies.d.ts +1 -1
- package/src/plugins/js/project-graph/build-dependencies/explicit-project-dependencies.d.ts +1 -1
- package/src/plugins/package-json-workspaces/create-nodes.d.ts +2 -2
- package/src/plugins/package-json-workspaces/create-nodes.js +24 -31
- package/src/plugins/package-json-workspaces/index.d.ts +1 -0
- package/src/plugins/package-json-workspaces/index.js +2 -0
- package/src/plugins/project-json/build-nodes/package-json-next-to-project-json.d.ts +2 -1
- package/src/plugins/project-json/build-nodes/package-json-next-to-project-json.js +1 -0
- package/src/plugins/project-json/build-nodes/project-json.d.ts +2 -1
- package/src/plugins/project-json/build-nodes/project-json.js +1 -0
- package/src/plugins/target-defaults/symbols.d.ts +17 -0
- package/src/plugins/target-defaults/symbols.js +20 -0
- package/src/plugins/target-defaults/target-defaults-plugin.d.ts +2 -18
- package/src/plugins/target-defaults/target-defaults-plugin.js +5 -20
- package/src/project-graph/affected/locators/project-glob-changes.js +3 -3
- package/src/project-graph/build-project-graph.d.ts +2 -1
- package/src/project-graph/build-project-graph.js +11 -13
- package/src/project-graph/error-types.d.ts +45 -0
- package/src/project-graph/error-types.js +100 -0
- package/src/project-graph/file-utils.js +3 -3
- package/src/project-graph/plugins/index.d.ts +2 -0
- package/src/project-graph/plugins/index.js +8 -0
- package/src/project-graph/plugins/internal-api.d.ts +28 -0
- package/src/project-graph/plugins/internal-api.js +85 -0
- package/src/project-graph/plugins/isolation/index.d.ts +3 -0
- package/src/project-graph/plugins/isolation/index.js +16 -0
- package/src/project-graph/plugins/isolation/messaging.d.ts +94 -0
- package/src/project-graph/plugins/isolation/messaging.js +23 -0
- package/src/project-graph/plugins/isolation/plugin-pool.d.ts +3 -0
- package/src/project-graph/plugins/isolation/plugin-pool.js +189 -0
- package/src/project-graph/plugins/isolation/plugin-worker.d.ts +1 -0
- package/src/project-graph/plugins/isolation/plugin-worker.js +81 -0
- package/src/project-graph/plugins/loader.d.ts +24 -0
- package/src/project-graph/plugins/loader.js +206 -0
- package/src/{utils/nx-plugin.d.ts → project-graph/plugins/public-api.d.ts} +8 -44
- package/src/project-graph/plugins/public-api.js +4 -0
- package/src/project-graph/plugins/utils.d.ts +7 -0
- package/src/project-graph/plugins/utils.js +80 -0
- package/src/project-graph/project-graph-builder.d.ts +1 -1
- package/src/project-graph/project-graph.d.ts +4 -3
- package/src/project-graph/project-graph.js +9 -7
- package/src/project-graph/utils/normalize-project-nodes.d.ts +1 -1
- package/src/project-graph/utils/project-configuration-utils.d.ts +3 -26
- package/src/project-graph/utils/project-configuration-utils.js +54 -109
- package/src/project-graph/utils/retrieve-workspace-files.d.ts +11 -10
- package/src/project-graph/utils/retrieve-workspace-files.js +19 -26
- package/src/tasks-runner/cache.js +1 -1
- package/src/utils/is-ci.js +1 -1
- package/src/utils/logger.d.ts +1 -0
- package/src/utils/logger.js +5 -0
- package/src/utils/nx-plugin.deprecated.d.ts +2 -2
- package/src/utils/nx-plugin.deprecated.js +5 -7
- package/src/utils/plugins/plugin-capabilities.d.ts +1 -1
- package/src/utils/plugins/plugin-capabilities.js +18 -12
- package/src/utils/nx-plugin.js +0 -309
package/bin/post-install.js
CHANGED
@@ -12,10 +12,10 @@ const nx_cloud_utils_1 = require("../src/utils/nx-cloud-utils");
|
|
12
12
|
const nx_json_1 = require("../src/config/nx-json");
|
13
13
|
const workspace_context_1 = require("../src/utils/workspace-context");
|
14
14
|
(async () => {
|
15
|
+
const start = new Date();
|
15
16
|
try {
|
16
17
|
(0, workspace_context_1.setupWorkspaceContext)(workspace_root_1.workspaceRoot);
|
17
18
|
if (isMainNxPackage() && (0, fileutils_1.fileExists)((0, path_1.join)(workspace_root_1.workspaceRoot, 'nx.json'))) {
|
18
|
-
const b = new Date();
|
19
19
|
(0, assert_supported_platform_1.assertSupportedPlatform)();
|
20
20
|
try {
|
21
21
|
await client_1.daemonClient.stop();
|
@@ -34,10 +34,6 @@ const workspace_context_1 = require("../src/utils/workspace-context");
|
|
34
34
|
}
|
35
35
|
});
|
36
36
|
}));
|
37
|
-
if (process.env.NX_VERBOSE_LOGGING === 'true') {
|
38
|
-
const a = new Date();
|
39
|
-
console.log(`Nx postinstall steps took ${a.getTime() - b.getTime()}ms`);
|
40
|
-
}
|
41
37
|
}
|
42
38
|
}
|
43
39
|
catch (e) {
|
@@ -45,6 +41,12 @@ const workspace_context_1 = require("../src/utils/workspace-context");
|
|
45
41
|
console.log(e);
|
46
42
|
}
|
47
43
|
}
|
44
|
+
finally {
|
45
|
+
if (process.env.NX_VERBOSE_LOGGING === 'true') {
|
46
|
+
const end = new Date();
|
47
|
+
console.log(`Nx postinstall steps took ${end.getTime() - start.getTime()}ms`);
|
48
|
+
}
|
49
|
+
}
|
48
50
|
})();
|
49
51
|
function isMainNxPackage() {
|
50
52
|
const mainNxPath = require.resolve('nx', {
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "nx",
|
3
|
-
"version": "18.3.0-beta.
|
3
|
+
"version": "18.3.0-beta.2",
|
4
4
|
"private": false,
|
5
5
|
"description": "The core Nx plugin contains the core functionality of Nx like the project graph, nx commands and task orchestration.",
|
6
6
|
"repository": {
|
@@ -66,7 +66,7 @@
|
|
66
66
|
"yargs-parser": "21.1.1",
|
67
67
|
"node-machine-id": "1.1.12",
|
68
68
|
"ora": "5.3.0",
|
69
|
-
"@nrwl/tao": "18.3.0-beta.
|
69
|
+
"@nrwl/tao": "18.3.0-beta.2"
|
70
70
|
},
|
71
71
|
"peerDependencies": {
|
72
72
|
"@swc-node/register": "^1.8.0",
|
@@ -81,16 +81,16 @@
|
|
81
81
|
}
|
82
82
|
},
|
83
83
|
"optionalDependencies": {
|
84
|
-
"@nx/nx-darwin-x64": "18.3.0-beta.
|
85
|
-
"@nx/nx-darwin-arm64": "18.3.0-beta.
|
86
|
-
"@nx/nx-linux-x64-gnu": "18.3.0-beta.
|
87
|
-
"@nx/nx-linux-x64-musl": "18.3.0-beta.
|
88
|
-
"@nx/nx-win32-x64-msvc": "18.3.0-beta.
|
89
|
-
"@nx/nx-linux-arm64-gnu": "18.3.0-beta.
|
90
|
-
"@nx/nx-linux-arm64-musl": "18.3.0-beta.
|
91
|
-
"@nx/nx-linux-arm-gnueabihf": "18.3.0-beta.
|
92
|
-
"@nx/nx-win32-arm64-msvc": "18.3.0-beta.
|
93
|
-
"@nx/nx-freebsd-x64": "18.3.0-beta.
|
84
|
+
"@nx/nx-darwin-x64": "18.3.0-beta.2",
|
85
|
+
"@nx/nx-darwin-arm64": "18.3.0-beta.2",
|
86
|
+
"@nx/nx-linux-x64-gnu": "18.3.0-beta.2",
|
87
|
+
"@nx/nx-linux-x64-musl": "18.3.0-beta.2",
|
88
|
+
"@nx/nx-win32-x64-msvc": "18.3.0-beta.2",
|
89
|
+
"@nx/nx-linux-arm64-gnu": "18.3.0-beta.2",
|
90
|
+
"@nx/nx-linux-arm64-musl": "18.3.0-beta.2",
|
91
|
+
"@nx/nx-linux-arm-gnueabihf": "18.3.0-beta.2",
|
92
|
+
"@nx/nx-win32-arm64-msvc": "18.3.0-beta.2",
|
93
|
+
"@nx/nx-freebsd-x64": "18.3.0-beta.2"
|
94
94
|
},
|
95
95
|
"nx-migrations": {
|
96
96
|
"migrations": "./migrations.json",
|
@@ -1,7 +1,8 @@
|
|
1
1
|
import { ProjectsConfigurations } from '../config/workspace-json-project-json';
|
2
|
-
import { NxPluginV2 } from '../
|
2
|
+
import { NxPluginV2 } from '../project-graph/plugins';
|
3
3
|
export declare const NX_ANGULAR_JSON_PLUGIN_NAME = "nx-angular-json-plugin";
|
4
4
|
export declare const NxAngularJsonPlugin: NxPluginV2;
|
5
|
+
export default NxAngularJsonPlugin;
|
5
6
|
export declare function shouldMergeAngularProjects(root: string, includeProjectsFromAngularJson: boolean): boolean;
|
6
7
|
export declare function isAngularPluginInstalled(): boolean;
|
7
8
|
export declare function toNewFormat(w: any): ProjectsConfigurations;
|
@@ -14,6 +14,7 @@ exports.NxAngularJsonPlugin = {
|
|
14
14
|
}),
|
15
15
|
],
|
16
16
|
};
|
17
|
+
exports.default = exports.NxAngularJsonPlugin;
|
17
18
|
function shouldMergeAngularProjects(root, includeProjectsFromAngularJson) {
|
18
19
|
if ((0, fs_1.existsSync)(path.join(root, 'angular.json')) &&
|
19
20
|
// Include projects from angular.json if explicitly required.
|
@@ -4,7 +4,7 @@ import { Observable } from 'rxjs';
|
|
4
4
|
import type { GenerateOptions } from '../command-line/generate/generate';
|
5
5
|
import { ProjectConfiguration } from '../config/workspace-json-project-json';
|
6
6
|
import { Tree } from '../generators/tree';
|
7
|
-
import { ExecutorContext } from '../config/misc-interfaces';
|
7
|
+
import { ExecutorContext, GeneratorCallback } from '../config/misc-interfaces';
|
8
8
|
export declare function createBuilderContext(builderInfo: {
|
9
9
|
builderName: string;
|
10
10
|
description: string;
|
@@ -85,6 +85,6 @@ export declare function mockSchematicsForTesting(schematics: {
|
|
85
85
|
}): void;
|
86
86
|
export declare function wrapAngularDevkitSchematic(collectionName: string, generatorName: string): (host: Tree, generatorOptions: {
|
87
87
|
[k: string]: any;
|
88
|
-
}) => Promise<
|
88
|
+
}) => Promise<GeneratorCallback>;
|
89
89
|
export declare const getLogger: (isVerbose?: boolean) => logging.Logger;
|
90
90
|
export {};
|
@@ -19,7 +19,7 @@ const package_json_1 = require("../utils/package-json");
|
|
19
19
|
const package_manager_1 = require("../utils/package-manager");
|
20
20
|
const angular_json_1 = require("./angular-json");
|
21
21
|
const executor_utils_1 = require("../command-line/run/executor-utils");
|
22
|
-
const
|
22
|
+
const plugins_1 = require("../project-graph/plugins");
|
23
23
|
const schema_utils_1 = require("../config/schema-utils");
|
24
24
|
async function createBuilderContext(builderInfo, context) {
|
25
25
|
require('./compat');
|
@@ -146,7 +146,7 @@ function createNodeModulesEngineHost(resolvePaths, projects) {
|
|
146
146
|
collectionFilePath = require.resolve(name, { paths });
|
147
147
|
}
|
148
148
|
else {
|
149
|
-
const { json: { generators, schematics }, path: packageJsonPath, } = (0,
|
149
|
+
const { json: { generators, schematics }, path: packageJsonPath, } = (0, plugins_1.readPluginPackageJson)(name, projects, paths);
|
150
150
|
if (!schematics && !generators) {
|
151
151
|
throw new Error(`The "${name}" package does not support Nx generators or Angular Devkit schematics.`);
|
152
152
|
}
|
@@ -655,15 +655,6 @@ function wrapAngularDevkitSchematic(collectionName, generatorName) {
|
|
655
655
|
mockedSchematics[`${collectionName}:${generatorName}`]) {
|
656
656
|
return await mockedSchematics[`${collectionName}:${generatorName}`](host, generatorOptions);
|
657
657
|
}
|
658
|
-
const emptyLogger = {
|
659
|
-
log: (e) => { },
|
660
|
-
info: (e) => { },
|
661
|
-
warn: (e) => { },
|
662
|
-
debug: () => { },
|
663
|
-
error: (e) => { },
|
664
|
-
fatal: (e) => { },
|
665
|
-
};
|
666
|
-
emptyLogger.createChild = () => emptyLogger;
|
667
658
|
const recorder = (event) => {
|
668
659
|
let eventPath = event.path.startsWith('/')
|
669
660
|
? event.path.slice(1)
|
@@ -690,6 +681,7 @@ function wrapAngularDevkitSchematic(collectionName, generatorName) {
|
|
690
681
|
}
|
691
682
|
};
|
692
683
|
const fsHost = new NxScopeHostUsedForWrappedSchematics(host.root, host);
|
684
|
+
const logger = (0, exports.getLogger)(generatorOptions.verbose);
|
693
685
|
const options = {
|
694
686
|
generatorOptions,
|
695
687
|
dryRun: true,
|
@@ -717,10 +709,18 @@ function wrapAngularDevkitSchematic(collectionName, generatorName) {
|
|
717
709
|
}
|
718
710
|
const collection = getCollection(workflow, collectionName);
|
719
711
|
const schematic = collection.createSchematic(generatorName, true);
|
720
|
-
const res = await runSchematic(fsHost, host.root, workflow,
|
712
|
+
const res = await runSchematic(fsHost, host.root, workflow, logger, options, schematic, false, recorder);
|
721
713
|
if (res.status !== 0) {
|
722
714
|
throw new Error(res.loggingQueue.join('\n'));
|
723
715
|
}
|
716
|
+
const { lastValueFrom } = require('rxjs');
|
717
|
+
const toPromise = (obs) => lastValueFrom ? lastValueFrom(obs) : obs.toPromise();
|
718
|
+
return async () => {
|
719
|
+
// https://github.com/angular/angular-cli/blob/344193f79d880177e421cff85dd3e94338d07420/packages/angular_devkit/schematics/src/workflow/base.ts#L194-L200
|
720
|
+
await toPromise(workflow.engine
|
721
|
+
.executePostTasks()
|
722
|
+
.pipe((0, operators_1.defaultIfEmpty)(undefined), (0, operators_1.last)()));
|
723
|
+
};
|
724
724
|
};
|
725
725
|
}
|
726
726
|
exports.wrapAngularDevkitSchematic = wrapAngularDevkitSchematic;
|
@@ -802,7 +802,7 @@ async function getWrappedWorkspaceNodeModulesArchitectHost(workspace, root, proj
|
|
802
802
|
};
|
803
803
|
}
|
804
804
|
readExecutorsJson(nodeModule, builder) {
|
805
|
-
const { json: packageJson, path: packageJsonPath } = (0,
|
805
|
+
const { json: packageJson, path: packageJsonPath } = (0, plugins_1.readPluginPackageJson)(nodeModule, this.projects, this.root ? [this.root, __dirname] : [__dirname]);
|
806
806
|
const executorsFile = packageJson.executors ?? packageJson.builders;
|
807
807
|
if (!executorsFile) {
|
808
808
|
throw new Error(`The "${nodeModule}" package does not support Nx executors or Angular Devkit Builders.`);
|
@@ -4,7 +4,7 @@ exports.readGeneratorsJson = exports.getGeneratorInformation = void 0;
|
|
4
4
|
const path_1 = require("path");
|
5
5
|
const schema_utils_1 = require("../../config/schema-utils");
|
6
6
|
const fileutils_1 = require("../../utils/fileutils");
|
7
|
-
const
|
7
|
+
const plugins_1 = require("../../project-graph/plugins");
|
8
8
|
function getGeneratorInformation(collectionName, generatorName, root, projects) {
|
9
9
|
try {
|
10
10
|
const { generatorsFilePath, generatorsJson, resolvedCollectionName, normalizedGeneratorName, } = readGeneratorsJson(collectionName, generatorName, root, projects);
|
@@ -48,7 +48,7 @@ function readGeneratorsJson(collectionName, generator, root, projects) {
|
|
48
48
|
});
|
49
49
|
}
|
50
50
|
else {
|
51
|
-
const { json: packageJson, path: packageJsonPath } = (0,
|
51
|
+
const { json: packageJson, path: packageJsonPath } = (0, plugins_1.readPluginPackageJson)(collectionName, projects, root ? [root, __dirname] : [__dirname]);
|
52
52
|
const generatorsFile = packageJson.generators ?? packageJson.schematics;
|
53
53
|
if (!generatorsFile) {
|
54
54
|
throw new Error(`The "${collectionName}" package does not support Nx generators.`);
|
@@ -63,7 +63,7 @@ async function addNxToMonorepo(options) {
|
|
63
63
|
(0, utils_1.createNxJsonFile)(repoRoot, targetDefaults, cacheableOperations, scriptOutputs);
|
64
64
|
if (!options.legacy) {
|
65
65
|
packageJsonFiles.forEach((packageJsonPath) => {
|
66
|
-
(0, utils_1.markPackageJsonAsNxProject)((0, path_1.join)(repoRoot, packageJsonPath)
|
66
|
+
(0, utils_1.markPackageJsonAsNxProject)((0, path_1.join)(repoRoot, packageJsonPath));
|
67
67
|
});
|
68
68
|
}
|
69
69
|
(0, utils_1.updateGitIgnore)(repoRoot);
|
@@ -57,7 +57,7 @@ async function addNxToNpmRepo(options) {
|
|
57
57
|
(0, utils_1.markRootPackageJsonAsNxProjectLegacy)(repoRoot, cacheableOperations, pmc);
|
58
58
|
}
|
59
59
|
else {
|
60
|
-
(0, utils_1.markPackageJsonAsNxProject)((0, path_1.join)(repoRoot, 'package.json')
|
60
|
+
(0, utils_1.markPackageJsonAsNxProject)((0, path_1.join)(repoRoot, 'package.json'));
|
61
61
|
}
|
62
62
|
output_1.output.log({ title: '📦 Installing dependencies' });
|
63
63
|
(0, utils_1.runInstall)(repoRoot, pmc);
|
@@ -100,7 +100,7 @@ async function reorgnizeWorkspaceStructure(options) {
|
|
100
100
|
? `npx nx build ${options.reactAppName}`
|
101
101
|
: 'npm run build';
|
102
102
|
(0, utils_1.printFinalMessage)({
|
103
|
-
learnMoreLink: 'https://nx.dev/recipes/
|
103
|
+
learnMoreLink: 'https://nx.dev/recipes/adopting-nx/adding-to-existing-project',
|
104
104
|
bodyLines: [
|
105
105
|
`- Execute "${buildCommand}" twice to see the computation caching in action.`,
|
106
106
|
],
|
@@ -9,7 +9,7 @@ export declare function runInstall(repoRoot: string, pmc?: PackageManagerCommand
|
|
9
9
|
export declare function initCloud(repoRoot: string, installationSource: 'nx-init-angular' | 'nx-init-cra' | 'nx-init-monorepo' | 'nx-init-nest' | 'nx-init-npm-repo'): void;
|
10
10
|
export declare function addVsCodeRecommendedExtensions(repoRoot: string, extensions: string[]): void;
|
11
11
|
export declare function markRootPackageJsonAsNxProjectLegacy(repoRoot: string, cacheableScripts: string[], pmc: PackageManagerCommands): void;
|
12
|
-
export declare function markPackageJsonAsNxProject(packageJsonPath: string
|
12
|
+
export declare function markPackageJsonAsNxProject(packageJsonPath: string): void;
|
13
13
|
export declare function printFinalMessage({ learnMoreLink, bodyLines, }: {
|
14
14
|
learnMoreLink?: string;
|
15
15
|
bodyLines?: string[];
|
@@ -154,17 +154,12 @@ function markRootPackageJsonAsNxProjectLegacy(repoRoot, cacheableScripts, pmc) {
|
|
154
154
|
(0, fileutils_1.writeJsonFile)(`package.json`, json);
|
155
155
|
}
|
156
156
|
exports.markRootPackageJsonAsNxProjectLegacy = markRootPackageJsonAsNxProjectLegacy;
|
157
|
-
function markPackageJsonAsNxProject(packageJsonPath
|
157
|
+
function markPackageJsonAsNxProject(packageJsonPath) {
|
158
158
|
const json = (0, fileutils_1.readJsonFile)(packageJsonPath);
|
159
159
|
if (!json.scripts) {
|
160
160
|
return;
|
161
161
|
}
|
162
|
-
json.nx = {
|
163
|
-
for (let script of cacheableScripts) {
|
164
|
-
if (json.scripts[script]) {
|
165
|
-
json.nx.includedScripts.push(script);
|
166
|
-
}
|
167
|
-
}
|
162
|
+
json.nx = {};
|
168
163
|
(0, fileutils_1.writeJsonFile)(packageJsonPath, json);
|
169
164
|
}
|
170
165
|
exports.markPackageJsonAsNxProject = markPackageJsonAsNxProject;
|
@@ -17,7 +17,6 @@ const workspace_context_1 = require("../../utils/workspace-context");
|
|
17
17
|
const connect_to_nx_cloud_1 = require("../connect/connect-to-nx-cloud");
|
18
18
|
const add_nx_to_npm_repo_1 = require("./implementation/add-nx-to-npm-repo");
|
19
19
|
const add_nx_to_monorepo_1 = require("./implementation/add-nx-to-monorepo");
|
20
|
-
const path_1 = require("path");
|
21
20
|
async function initHandler(options) {
|
22
21
|
process.env.NX_RUNNING_NX_INIT = 'true';
|
23
22
|
const version = process.env.NX_VERSION ?? ((0, semver_1.prerelease)(versions_1.nxVersion) ? 'next' : 'latest');
|
@@ -52,29 +51,29 @@ async function initHandler(options) {
|
|
52
51
|
}
|
53
52
|
output_1.output.log({ title: '🧐 Checking dependencies' });
|
54
53
|
const { plugins, updatePackageScripts } = await detectPlugins();
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
}
|
62
|
-
else {
|
63
|
-
await (0, add_nx_to_npm_repo_1.addNxToNpmRepo)({ interactive: options.interactive });
|
64
|
-
}
|
54
|
+
const packageJson = (0, fileutils_1.readJsonFile)('package.json');
|
55
|
+
if ((0, utils_1.isMonorepo)(packageJson)) {
|
56
|
+
await (0, add_nx_to_monorepo_1.addNxToMonorepo)({
|
57
|
+
interactive: options.interactive,
|
58
|
+
nxCloud: false,
|
59
|
+
});
|
65
60
|
}
|
66
61
|
else {
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
(0,
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
62
|
+
await (0, add_nx_to_npm_repo_1.addNxToNpmRepo)({
|
63
|
+
interactive: options.interactive,
|
64
|
+
nxCloud: false,
|
65
|
+
});
|
66
|
+
}
|
67
|
+
const useNxCloud = options.nxCloud ??
|
68
|
+
(options.interactive ? await (0, connect_to_nx_cloud_1.connectExistingRepoToNxCloudPrompt)() : false);
|
69
|
+
const repoRoot = process.cwd();
|
70
|
+
const pmc = (0, package_manager_1.getPackageManagerCommand)();
|
71
|
+
(0, utils_1.createNxJsonFile)(repoRoot, [], [], {});
|
72
|
+
(0, utils_1.updateGitIgnore)(repoRoot);
|
73
|
+
(0, utils_1.addDepsToPackageJson)(repoRoot, plugins);
|
74
|
+
output_1.output.log({ title: '📦 Installing Nx' });
|
75
|
+
(0, utils_1.runInstall)(repoRoot, pmc);
|
76
|
+
if (plugins.length > 0) {
|
78
77
|
output_1.output.log({ title: '🔨 Configuring plugins' });
|
79
78
|
for (const plugin of plugins) {
|
80
79
|
(0, child_process_2.execSync)(`${pmc.exec} nx g ${plugin}:init --keepExistingVersions ${updatePackageScripts ? '--updatePackageScripts' : ''} --no-interactive`, {
|
@@ -82,19 +81,13 @@ async function initHandler(options) {
|
|
82
81
|
cwd: repoRoot,
|
83
82
|
});
|
84
83
|
}
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
output_1.output.log({ title: '🛠️ Setting up Nx Cloud' });
|
93
|
-
(0, child_process_2.execSync)(`${pmc.exec} nx g nx:connect-to-nx-cloud --installationSource=nx-init --quiet --hideFormatLogs --no-interactive`, {
|
94
|
-
stdio: [0, 1, 2],
|
95
|
-
cwd: repoRoot,
|
96
|
-
});
|
97
|
-
}
|
84
|
+
}
|
85
|
+
if (useNxCloud) {
|
86
|
+
output_1.output.log({ title: '🛠️ Setting up Nx Cloud' });
|
87
|
+
(0, child_process_2.execSync)(`${pmc.exec} nx g nx:connect-to-nx-cloud --installationSource=nx-init --quiet --hideFormatLogs --no-interactive`, {
|
88
|
+
stdio: [0, 1, 2],
|
89
|
+
cwd: repoRoot,
|
90
|
+
});
|
98
91
|
}
|
99
92
|
output_1.output.log({
|
100
93
|
title: '👀 Explore Your Workspace',
|
@@ -170,9 +163,8 @@ async function detectPlugins() {
|
|
170
163
|
{
|
171
164
|
name: 'plugins',
|
172
165
|
type: 'multiselect',
|
173
|
-
message: `Which plugins would you like to add
|
166
|
+
message: `Which plugins would you like to add? Press <Space> to select and <Enter> to submit.`,
|
174
167
|
choices: plugins.map((p) => ({ name: p, value: p })),
|
175
|
-
initial: plugins.map((_, i) => i), // casting to avoid type error due to bad d.ts file from enquirer
|
176
168
|
},
|
177
169
|
]).then((r) => r.plugins);
|
178
170
|
if (pluginsToInstall?.length === 0)
|
@@ -107,7 +107,7 @@ const versionCommand = {
|
|
107
107
|
})
|
108
108
|
.option('preid', {
|
109
109
|
type: 'string',
|
110
|
-
describe: 'The optional prerelease identifier to apply to the version, in the case that specifier has been set to prerelease
|
110
|
+
describe: 'The optional prerelease identifier to apply to the version, in the case that the specifier argument has been set to `prerelease`.',
|
111
111
|
default: '',
|
112
112
|
})
|
113
113
|
.option('stage-changes', {
|
@@ -2,7 +2,7 @@
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
3
|
exports.getExecutorInformation = exports.normalizeExecutorSchema = void 0;
|
4
4
|
const path_1 = require("path");
|
5
|
-
const
|
5
|
+
const plugins_1 = require("../../project-graph/plugins");
|
6
6
|
const fileutils_1 = require("../../utils/fileutils");
|
7
7
|
const schema_utils_1 = require("../../config/schema-utils");
|
8
8
|
const installation_directory_1 = require("../../utils/installation-directory");
|
@@ -55,7 +55,7 @@ function getExecutorInformation(nodeModule, executor, root, projects) {
|
|
55
55
|
}
|
56
56
|
exports.getExecutorInformation = getExecutorInformation;
|
57
57
|
function readExecutorJson(nodeModule, executor, root, projects) {
|
58
|
-
const { json: packageJson, path: packageJsonPath } = (0,
|
58
|
+
const { json: packageJson, path: packageJsonPath } = (0, plugins_1.readPluginPackageJson)(nodeModule, projects, root
|
59
59
|
? [root, __dirname, process.cwd(), ...(0, installation_directory_1.getNxRequirePaths)()]
|
60
60
|
: [__dirname, process.cwd(), ...(0, installation_directory_1.getNxRequirePaths)()]);
|
61
61
|
const executorsFile = packageJson.executors ?? packageJson.builders;
|
package/src/config/nx-json.d.ts
CHANGED
@@ -394,7 +394,8 @@ export interface NxJsonConfiguration<T = '*' | string[]> {
|
|
394
394
|
*/
|
395
395
|
useInferencePlugins?: boolean;
|
396
396
|
}
|
397
|
-
export type PluginConfiguration = string |
|
397
|
+
export type PluginConfiguration = string | ExpandedPluginConfiguration;
|
398
|
+
export type ExpandedPluginConfiguration = {
|
398
399
|
plugin: string;
|
399
400
|
options?: unknown;
|
400
401
|
include?: string[];
|
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.resolveSchema = exports.resolveImplementation = exports.getImplementationFactory = void 0;
|
4
4
|
const fs_1 = require("fs");
|
5
5
|
const path_1 = require("path");
|
6
|
-
const
|
6
|
+
const plugins_1 = require("../project-graph/plugins");
|
7
7
|
/**
|
8
8
|
* This function is used to get the implementation factory of an executor or generator.
|
9
9
|
* @param implementation path to the implementation
|
@@ -15,7 +15,7 @@ function getImplementationFactory(implementation, directory) {
|
|
15
15
|
return () => {
|
16
16
|
const modulePath = resolveImplementation(implementationModulePath, directory);
|
17
17
|
if ((0, path_1.extname)(modulePath) === '.ts') {
|
18
|
-
(0,
|
18
|
+
(0, plugins_1.registerPluginTSTranspiler)();
|
19
19
|
}
|
20
20
|
const module = require(modulePath);
|
21
21
|
return implementationExportName
|
@@ -212,6 +212,29 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
212
212
|
SOFTWARE.
|
213
213
|
|
214
214
|
|
215
|
+
core-js
|
216
|
+
MIT
|
217
|
+
Copyright (c) 2014-2024 Denis Pushkarev
|
218
|
+
|
219
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
220
|
+
of this software and associated documentation files (the "Software"), to deal
|
221
|
+
in the Software without restriction, including without limitation the rights
|
222
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
223
|
+
copies of the Software, and to permit persons to whom the Software is
|
224
|
+
furnished to do so, subject to the following conditions:
|
225
|
+
|
226
|
+
The above copyright notice and this permission notice shall be included in
|
227
|
+
all copies or substantial portions of the Software.
|
228
|
+
|
229
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
230
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
231
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
232
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
233
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
234
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
235
|
+
THE SOFTWARE.
|
236
|
+
|
237
|
+
|
215
238
|
cytoscape
|
216
239
|
MIT
|
217
240
|
Copyright (c) 2016-2022, The Cytoscape Consortium.
|
@@ -681,32 +704,6 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
681
704
|
SOFTWARE.
|
682
705
|
|
683
706
|
|
684
|
-
tabbable
|
685
|
-
MIT
|
686
|
-
The MIT License (MIT)
|
687
|
-
|
688
|
-
Copyright (c) 2015 David Clark
|
689
|
-
|
690
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
691
|
-
of this software and associated documentation files (the "Software"), to deal
|
692
|
-
in the Software without restriction, including without limitation the rights
|
693
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
694
|
-
copies of the Software, and to permit persons to whom the Software is
|
695
|
-
furnished to do so, subject to the following conditions:
|
696
|
-
|
697
|
-
The above copyright notice and this permission notice shall be included in all
|
698
|
-
copies or substantial portions of the Software.
|
699
|
-
|
700
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
701
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
702
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
703
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
704
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
705
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
706
|
-
SOFTWARE.
|
707
|
-
|
708
|
-
|
709
|
-
|
710
707
|
toggle-selection
|
711
708
|
MIT
|
712
709
|
|