nx 19.6.0-canary.20240724-684d2a9 → 19.6.0-canary.20240725-3890edc
Sign up to get free protection for your applications and to get access to all the features.
- package/bin/nx-cloud.d.ts +2 -1
- package/bin/nx-cloud.js +9 -17
- package/package.json +12 -12
- package/src/command-line/list/list.js +10 -14
- package/src/command-line/release/command-object.js +5 -21
- package/src/command-line/reset/command-object.d.ts +1 -0
- package/src/command-line/reset/command-object.js +4 -0
- package/src/command-line/reset/reset.js +13 -0
- package/src/command-line/run/run.js +2 -14
- package/src/daemon/socket-utils.js +1 -1
- package/src/daemon/tmp-dir.d.ts +1 -1
- package/src/daemon/tmp-dir.js +3 -2
- package/src/migrations/update-16-0-0/update-nx-cloud-runner.js +2 -0
- package/src/migrations/update-18-0-0/disable-crystal-for-existing-workspaces.d.ts +1 -1
- package/src/migrations/update-18-0-0/disable-crystal-for-existing-workspaces.js +3 -1
- package/src/native/nx.wasm32-wasi.wasm +0 -0
- package/src/nx-cloud/generators/connect-to-nx-cloud/connect-to-nx-cloud.js +2 -10
- package/src/nx-cloud/utilities/client.d.ts +10 -0
- package/src/nx-cloud/utilities/client.js +35 -0
- package/src/nx-cloud/utilities/url-shorten.d.ts +2 -2
- package/src/nx-cloud/utilities/url-shorten.js +13 -6
- package/src/tasks-runner/utils.js +9 -5
- package/src/utils/chunkify.d.ts +10 -0
- package/src/utils/chunkify.js +19 -12
- package/src/utils/command-line-utils.d.ts +3 -0
- package/src/utils/command-line-utils.js +11 -7
- package/src/utils/git-utils.js +14 -4
- package/src/utils/plugins/core-plugins.d.ts +6 -3
- package/src/utils/plugins/core-plugins.js +107 -115
- package/src/utils/plugins/index.d.ts +4 -4
- package/src/utils/plugins/index.js +7 -8
- package/src/utils/plugins/installed-plugins.d.ts +2 -3
- package/src/utils/plugins/installed-plugins.js +4 -31
- package/src/utils/plugins/local-plugins.d.ts +2 -3
- package/src/utils/plugins/local-plugins.js +2 -29
- package/src/utils/plugins/output.d.ts +5 -0
- package/src/utils/plugins/output.js +104 -0
- package/src/utils/plugins/plugin-capabilities.d.ts +12 -2
- package/src/utils/plugins/plugin-capabilities.js +2 -87
- package/src/utils/plugins/community-plugins.d.ts +0 -2
- package/src/utils/plugins/community-plugins.js +0 -28
- package/src/utils/plugins/models.d.ts +0 -22
- package/src/utils/plugins/models.js +0 -2
- package/src/utils/plugins/shared.d.ts +0 -1
- package/src/utils/plugins/shared.js +0 -7
package/src/utils/git-utils.js
CHANGED
@@ -9,26 +9,36 @@ const devkit_exports_1 = require("../devkit-exports");
|
|
9
9
|
function getGithubSlugOrNull() {
|
10
10
|
try {
|
11
11
|
const gitRemote = (0, child_process_1.execSync)('git remote -v').toString();
|
12
|
+
// If there are no remotes, we default to github
|
13
|
+
if (!gitRemote || gitRemote.length === 0) {
|
14
|
+
return 'github';
|
15
|
+
}
|
12
16
|
return extractUserAndRepoFromGitHubUrl(gitRemote);
|
13
17
|
}
|
14
18
|
catch (e) {
|
15
|
-
|
19
|
+
// Probably git is not set up, so we default to github
|
20
|
+
return 'github';
|
16
21
|
}
|
17
22
|
}
|
18
23
|
function extractUserAndRepoFromGitHubUrl(gitRemotes) {
|
19
24
|
const regex = /^\s*(\w+)\s+(git@github\.com:|https:\/\/github\.com\/)([A-Za-z0-9_.-]+)\/([A-Za-z0-9_.-]+)\.git/gm;
|
25
|
+
const remotesPriority = ['origin', 'upstream', 'base'];
|
26
|
+
const foundRemotes = {};
|
20
27
|
let firstGitHubUrl = null;
|
21
28
|
let match;
|
22
29
|
while ((match = regex.exec(gitRemotes)) !== null) {
|
23
30
|
const remoteName = match[1];
|
24
31
|
const url = match[2] + match[3] + '/' + match[4] + '.git';
|
25
|
-
|
26
|
-
return parseGitHubUrl(url);
|
27
|
-
}
|
32
|
+
foundRemotes[remoteName] = url;
|
28
33
|
if (!firstGitHubUrl) {
|
29
34
|
firstGitHubUrl = url;
|
30
35
|
}
|
31
36
|
}
|
37
|
+
for (const remote of remotesPriority) {
|
38
|
+
if (foundRemotes[remote]) {
|
39
|
+
return parseGitHubUrl(foundRemotes[remote]);
|
40
|
+
}
|
41
|
+
}
|
32
42
|
return firstGitHubUrl ? parseGitHubUrl(firstGitHubUrl) : null;
|
33
43
|
}
|
34
44
|
function parseGitHubUrl(url) {
|
@@ -1,3 +1,6 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
1
|
+
export interface CorePlugin {
|
2
|
+
name: string;
|
3
|
+
capabilities: 'executors' | 'generators' | 'executors,generators' | 'graph';
|
4
|
+
link?: string;
|
5
|
+
}
|
6
|
+
export declare const CORE_PLUGINS: CorePlugin[];
|
@@ -1,117 +1,109 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.
|
4
|
-
exports.
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
output_1.output.log({
|
111
|
-
title: `Also available:`,
|
112
|
-
bodyLines: alsoAvailable.map((p) => {
|
113
|
-
return `${chalk.bold(p.name)} (${p.capabilities})`;
|
114
|
-
}),
|
115
|
-
});
|
116
|
-
}
|
117
|
-
}
|
3
|
+
exports.CORE_PLUGINS = void 0;
|
4
|
+
exports.CORE_PLUGINS = [
|
5
|
+
{
|
6
|
+
name: '@nx/angular',
|
7
|
+
capabilities: 'executors,generators',
|
8
|
+
},
|
9
|
+
{
|
10
|
+
name: '@nx/cypress',
|
11
|
+
capabilities: 'executors,generators',
|
12
|
+
},
|
13
|
+
{
|
14
|
+
name: '@nx/detox',
|
15
|
+
capabilities: 'executors,generators',
|
16
|
+
},
|
17
|
+
{
|
18
|
+
name: '@nx/esbuild',
|
19
|
+
capabilities: 'executors,generators',
|
20
|
+
},
|
21
|
+
{
|
22
|
+
name: '@nx/expo',
|
23
|
+
capabilities: 'executors,generators',
|
24
|
+
},
|
25
|
+
{
|
26
|
+
name: '@nx/express',
|
27
|
+
capabilities: 'generators',
|
28
|
+
},
|
29
|
+
{
|
30
|
+
name: '@nx/gradle',
|
31
|
+
capabilities: 'graph',
|
32
|
+
},
|
33
|
+
{
|
34
|
+
name: '@nx/jest',
|
35
|
+
capabilities: 'executors,generators',
|
36
|
+
},
|
37
|
+
{
|
38
|
+
name: '@nx/js',
|
39
|
+
capabilities: 'executors,generators',
|
40
|
+
},
|
41
|
+
{
|
42
|
+
name: '@nx/eslint',
|
43
|
+
capabilities: 'executors,generators',
|
44
|
+
},
|
45
|
+
{
|
46
|
+
name: '@nx/nest',
|
47
|
+
capabilities: 'generators',
|
48
|
+
},
|
49
|
+
{
|
50
|
+
name: '@nx/next',
|
51
|
+
capabilities: 'executors,generators',
|
52
|
+
},
|
53
|
+
{
|
54
|
+
name: '@nx/node',
|
55
|
+
capabilities: 'executors,generators',
|
56
|
+
},
|
57
|
+
{
|
58
|
+
name: '@nx/nuxt',
|
59
|
+
capabilities: 'generators',
|
60
|
+
},
|
61
|
+
{
|
62
|
+
name: 'nx',
|
63
|
+
capabilities: 'executors',
|
64
|
+
},
|
65
|
+
{
|
66
|
+
name: '@nx/plugin',
|
67
|
+
capabilities: 'executors,generators',
|
68
|
+
},
|
69
|
+
{
|
70
|
+
name: '@nx/react',
|
71
|
+
capabilities: 'executors,generators',
|
72
|
+
},
|
73
|
+
{
|
74
|
+
name: '@nx/react-native',
|
75
|
+
capabilities: 'executors,generators',
|
76
|
+
},
|
77
|
+
{
|
78
|
+
name: '@nx/remix',
|
79
|
+
capabilities: 'executors,generators',
|
80
|
+
},
|
81
|
+
{
|
82
|
+
name: '@nx/rollup',
|
83
|
+
capabilities: 'executors,generators',
|
84
|
+
},
|
85
|
+
{
|
86
|
+
name: '@nx/storybook',
|
87
|
+
capabilities: 'executors,generators',
|
88
|
+
},
|
89
|
+
{
|
90
|
+
name: '@nx/vite',
|
91
|
+
capabilities: 'executors,generators',
|
92
|
+
},
|
93
|
+
{
|
94
|
+
name: '@nx/vue',
|
95
|
+
capabilities: 'generators',
|
96
|
+
},
|
97
|
+
{
|
98
|
+
name: '@nx/web',
|
99
|
+
capabilities: 'executors,generators',
|
100
|
+
},
|
101
|
+
{
|
102
|
+
name: '@nx/webpack',
|
103
|
+
capabilities: 'executors,generators',
|
104
|
+
},
|
105
|
+
{
|
106
|
+
name: '@nx/workspace',
|
107
|
+
capabilities: 'executors,generators',
|
108
|
+
},
|
109
|
+
];
|
@@ -1,4 +1,4 @@
|
|
1
|
-
export {
|
2
|
-
export {
|
3
|
-
export {
|
4
|
-
export { getPluginCapabilities
|
1
|
+
export { getInstalledPluginsAndCapabilities } from './installed-plugins';
|
2
|
+
export { getLocalWorkspacePlugins } from './local-plugins';
|
3
|
+
export { listPlugins, listAlsoAvailableCorePlugins, listPluginCapabilities, } from './output';
|
4
|
+
export { getPluginCapabilities } from './plugin-capabilities';
|
@@ -1,14 +1,13 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.
|
4
|
-
var community_plugins_1 = require("./community-plugins");
|
5
|
-
Object.defineProperty(exports, "fetchCommunityPlugins", { enumerable: true, get: function () { return community_plugins_1.fetchCommunityPlugins; } });
|
6
|
-
var core_plugins_1 = require("./core-plugins");
|
7
|
-
Object.defineProperty(exports, "fetchCorePlugins", { enumerable: true, get: function () { return core_plugins_1.fetchCorePlugins; } });
|
8
|
-
Object.defineProperty(exports, "listCorePlugins", { enumerable: true, get: function () { return core_plugins_1.listCorePlugins; } });
|
3
|
+
exports.getPluginCapabilities = exports.listPluginCapabilities = exports.listAlsoAvailableCorePlugins = exports.listPlugins = exports.getLocalWorkspacePlugins = exports.getInstalledPluginsAndCapabilities = void 0;
|
9
4
|
var installed_plugins_1 = require("./installed-plugins");
|
10
5
|
Object.defineProperty(exports, "getInstalledPluginsAndCapabilities", { enumerable: true, get: function () { return installed_plugins_1.getInstalledPluginsAndCapabilities; } });
|
11
|
-
|
6
|
+
var local_plugins_1 = require("./local-plugins");
|
7
|
+
Object.defineProperty(exports, "getLocalWorkspacePlugins", { enumerable: true, get: function () { return local_plugins_1.getLocalWorkspacePlugins; } });
|
8
|
+
var output_1 = require("./output");
|
9
|
+
Object.defineProperty(exports, "listPlugins", { enumerable: true, get: function () { return output_1.listPlugins; } });
|
10
|
+
Object.defineProperty(exports, "listAlsoAvailableCorePlugins", { enumerable: true, get: function () { return output_1.listAlsoAvailableCorePlugins; } });
|
11
|
+
Object.defineProperty(exports, "listPluginCapabilities", { enumerable: true, get: function () { return output_1.listPluginCapabilities; } });
|
12
12
|
var plugin_capabilities_1 = require("./plugin-capabilities");
|
13
13
|
Object.defineProperty(exports, "getPluginCapabilities", { enumerable: true, get: function () { return plugin_capabilities_1.getPluginCapabilities; } });
|
14
|
-
Object.defineProperty(exports, "listPluginCapabilities", { enumerable: true, get: function () { return plugin_capabilities_1.listPluginCapabilities; } });
|
@@ -1,6 +1,5 @@
|
|
1
|
-
import type { PluginCapabilities } from './models';
|
2
|
-
import { PackageJson } from '../package-json';
|
3
1
|
import { ProjectConfiguration } from '../../config/workspace-json-project-json';
|
2
|
+
import { PackageJson } from '../package-json';
|
3
|
+
import { PluginCapabilities } from './plugin-capabilities';
|
4
4
|
export declare function findInstalledPlugins(): PackageJson[];
|
5
5
|
export declare function getInstalledPluginsAndCapabilities(workspaceRoot: string, projects: Record<string, ProjectConfiguration>): Promise<Map<string, PluginCapabilities>>;
|
6
|
-
export declare function listInstalledPlugins(installedPlugins: Map<string, PluginCapabilities>): void;
|
@@ -2,17 +2,13 @@
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
3
|
exports.findInstalledPlugins = findInstalledPlugins;
|
4
4
|
exports.getInstalledPluginsAndCapabilities = getInstalledPluginsAndCapabilities;
|
5
|
-
exports.listInstalledPlugins = listInstalledPlugins;
|
6
|
-
const chalk = require("chalk");
|
7
|
-
const output_1 = require("../output");
|
8
|
-
const plugin_capabilities_1 = require("./plugin-capabilities");
|
9
|
-
const shared_1 = require("./shared");
|
10
|
-
const fileutils_1 = require("../fileutils");
|
11
|
-
const package_json_1 = require("../package-json");
|
12
|
-
const workspace_root_1 = require("../workspace-root");
|
13
5
|
const path_1 = require("path");
|
14
6
|
const nx_json_1 = require("../../config/nx-json");
|
7
|
+
const fileutils_1 = require("../fileutils");
|
15
8
|
const installation_directory_1 = require("../installation-directory");
|
9
|
+
const package_json_1 = require("../package-json");
|
10
|
+
const workspace_root_1 = require("../workspace-root");
|
11
|
+
const plugin_capabilities_1 = require("./plugin-capabilities");
|
16
12
|
function findInstalledPlugins() {
|
17
13
|
const packageJsonDeps = getDependenciesFromPackageJson();
|
18
14
|
const nxJsonDeps = getDependenciesFromNxJson();
|
@@ -78,26 +74,3 @@ async function getInstalledPluginsAndCapabilities(workspaceRoot, projects) {
|
|
78
74
|
}
|
79
75
|
return result;
|
80
76
|
}
|
81
|
-
function listInstalledPlugins(installedPlugins) {
|
82
|
-
const bodyLines = [];
|
83
|
-
for (const [, p] of installedPlugins) {
|
84
|
-
const capabilities = [];
|
85
|
-
if ((0, shared_1.hasElements)(p.executors)) {
|
86
|
-
capabilities.push('executors');
|
87
|
-
}
|
88
|
-
if ((0, shared_1.hasElements)(p.generators)) {
|
89
|
-
capabilities.push('generators');
|
90
|
-
}
|
91
|
-
if (p.projectGraphExtension) {
|
92
|
-
capabilities.push('graph-extensions');
|
93
|
-
}
|
94
|
-
if (p.projectInference) {
|
95
|
-
capabilities.push('project-inference');
|
96
|
-
}
|
97
|
-
bodyLines.push(`${chalk.bold(p.name)} (${capabilities.join()})`);
|
98
|
-
}
|
99
|
-
output_1.output.log({
|
100
|
-
title: `Installed plugins:`,
|
101
|
-
bodyLines: bodyLines,
|
102
|
-
});
|
103
|
-
}
|
@@ -1,5 +1,4 @@
|
|
1
|
-
import type { PluginCapabilities } from './models';
|
2
|
-
import { ProjectsConfigurations } from '../../config/workspace-json-project-json';
|
3
1
|
import { NxJsonConfiguration } from '../../config/nx-json';
|
2
|
+
import { ProjectsConfigurations } from '../../config/workspace-json-project-json';
|
3
|
+
import { PluginCapabilities } from './plugin-capabilities';
|
4
4
|
export declare function getLocalWorkspacePlugins(projectsConfiguration: ProjectsConfigurations, nxJson: NxJsonConfiguration): Promise<Map<string, PluginCapabilities>>;
|
5
|
-
export declare function listLocalWorkspacePlugins(installedPlugins: Map<string, PluginCapabilities>): void;
|
@@ -1,14 +1,10 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
3
|
exports.getLocalWorkspacePlugins = getLocalWorkspacePlugins;
|
4
|
-
|
5
|
-
const chalk = require("chalk");
|
6
|
-
const output_1 = require("../output");
|
7
|
-
const shared_1 = require("./shared");
|
8
|
-
const fileutils_1 = require("../fileutils");
|
4
|
+
const fs_1 = require("fs");
|
9
5
|
const path_1 = require("path");
|
6
|
+
const fileutils_1 = require("../fileutils");
|
10
7
|
const workspace_root_1 = require("../workspace-root");
|
11
|
-
const fs_1 = require("fs");
|
12
8
|
const plugin_capabilities_1 = require("./plugin-capabilities");
|
13
9
|
async function getLocalWorkspacePlugins(projectsConfiguration, nxJson) {
|
14
10
|
const plugins = new Map();
|
@@ -32,26 +28,3 @@ async function getLocalWorkspacePlugins(projectsConfiguration, nxJson) {
|
|
32
28
|
}
|
33
29
|
return plugins;
|
34
30
|
}
|
35
|
-
function listLocalWorkspacePlugins(installedPlugins) {
|
36
|
-
const bodyLines = [];
|
37
|
-
for (const [, p] of installedPlugins) {
|
38
|
-
const capabilities = [];
|
39
|
-
if ((0, shared_1.hasElements)(p.executors)) {
|
40
|
-
capabilities.push('executors');
|
41
|
-
}
|
42
|
-
if ((0, shared_1.hasElements)(p.generators)) {
|
43
|
-
capabilities.push('generators');
|
44
|
-
}
|
45
|
-
if (p.projectGraphExtension) {
|
46
|
-
capabilities.push('graph-extension');
|
47
|
-
}
|
48
|
-
if (p.projectInference) {
|
49
|
-
capabilities.push('project-inference');
|
50
|
-
}
|
51
|
-
bodyLines.push(`${chalk.bold(p.name)} (${capabilities.join()})`);
|
52
|
-
}
|
53
|
-
output_1.output.log({
|
54
|
-
title: `Local workspace plugins:`,
|
55
|
-
bodyLines: bodyLines,
|
56
|
-
});
|
57
|
-
}
|
@@ -0,0 +1,5 @@
|
|
1
|
+
import { ProjectConfiguration } from '../../config/workspace-json-project-json';
|
2
|
+
import { PluginCapabilities } from './plugin-capabilities';
|
3
|
+
export declare function listPlugins(plugins: Map<string, PluginCapabilities>, title: string): void;
|
4
|
+
export declare function listAlsoAvailableCorePlugins(installedPlugins: Map<string, PluginCapabilities>): void;
|
5
|
+
export declare function listPluginCapabilities(pluginName: string, projects: Record<string, ProjectConfiguration>): Promise<void>;
|
@@ -0,0 +1,104 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.listPlugins = listPlugins;
|
4
|
+
exports.listAlsoAvailableCorePlugins = listAlsoAvailableCorePlugins;
|
5
|
+
exports.listPluginCapabilities = listPluginCapabilities;
|
6
|
+
const chalk = require("chalk");
|
7
|
+
const output_1 = require("../output");
|
8
|
+
const package_manager_1 = require("../package-manager");
|
9
|
+
const workspace_root_1 = require("../workspace-root");
|
10
|
+
const core_plugins_1 = require("./core-plugins");
|
11
|
+
const plugin_capabilities_1 = require("./plugin-capabilities");
|
12
|
+
const package_json_1 = require("../package-json");
|
13
|
+
function listPlugins(plugins, title) {
|
14
|
+
package_json_1.readModulePackageJson;
|
15
|
+
const bodyLines = [];
|
16
|
+
for (const [, p] of plugins) {
|
17
|
+
const capabilities = [];
|
18
|
+
if (hasElements(p.executors)) {
|
19
|
+
capabilities.push('executors');
|
20
|
+
}
|
21
|
+
if (hasElements(p.generators)) {
|
22
|
+
capabilities.push('generators');
|
23
|
+
}
|
24
|
+
if (p.projectGraphExtension) {
|
25
|
+
capabilities.push('graph-extension');
|
26
|
+
}
|
27
|
+
if (p.projectInference) {
|
28
|
+
capabilities.push('project-inference');
|
29
|
+
}
|
30
|
+
bodyLines.push(`${chalk.bold(p.name)} (${capabilities.join()})`);
|
31
|
+
}
|
32
|
+
output_1.output.log({
|
33
|
+
title: title,
|
34
|
+
bodyLines: bodyLines,
|
35
|
+
});
|
36
|
+
}
|
37
|
+
function listAlsoAvailableCorePlugins(installedPlugins) {
|
38
|
+
const alsoAvailable = core_plugins_1.CORE_PLUGINS.filter((p) => !installedPlugins.has(p.name));
|
39
|
+
if (alsoAvailable.length) {
|
40
|
+
output_1.output.log({
|
41
|
+
title: `Also available:`,
|
42
|
+
bodyLines: alsoAvailable.map((p) => {
|
43
|
+
return `${chalk.bold(p.name)} (${p.capabilities})`;
|
44
|
+
}),
|
45
|
+
});
|
46
|
+
}
|
47
|
+
}
|
48
|
+
async function listPluginCapabilities(pluginName, projects) {
|
49
|
+
const plugin = await (0, plugin_capabilities_1.getPluginCapabilities)(workspace_root_1.workspaceRoot, pluginName, projects);
|
50
|
+
if (!plugin) {
|
51
|
+
const pmc = (0, package_manager_1.getPackageManagerCommand)();
|
52
|
+
output_1.output.note({
|
53
|
+
title: `${pluginName} is not currently installed`,
|
54
|
+
bodyLines: [
|
55
|
+
`Use "${pmc.addDev} ${pluginName}" to install the plugin.`,
|
56
|
+
`After that, use "${pmc.exec} nx g ${pluginName}:init" to add the required peer deps and initialize the plugin.`,
|
57
|
+
],
|
58
|
+
});
|
59
|
+
return;
|
60
|
+
}
|
61
|
+
const hasBuilders = hasElements(plugin.executors);
|
62
|
+
const hasGenerators = hasElements(plugin.generators);
|
63
|
+
const hasProjectGraphExtension = !!plugin.projectGraphExtension;
|
64
|
+
const hasProjectInference = !!plugin.projectInference;
|
65
|
+
if (!hasBuilders &&
|
66
|
+
!hasGenerators &&
|
67
|
+
!hasProjectGraphExtension &&
|
68
|
+
!hasProjectInference) {
|
69
|
+
output_1.output.warn({ title: `No capabilities found in ${pluginName}` });
|
70
|
+
return;
|
71
|
+
}
|
72
|
+
const bodyLines = [];
|
73
|
+
if (hasGenerators) {
|
74
|
+
bodyLines.push(chalk.bold(chalk.green('GENERATORS')));
|
75
|
+
bodyLines.push('');
|
76
|
+
bodyLines.push(...Object.keys(plugin.generators).map((name) => `${chalk.bold(name)} : ${plugin.generators[name].description}`));
|
77
|
+
if (hasBuilders) {
|
78
|
+
bodyLines.push('');
|
79
|
+
}
|
80
|
+
}
|
81
|
+
if (hasBuilders) {
|
82
|
+
bodyLines.push(chalk.bold(chalk.green('EXECUTORS/BUILDERS')));
|
83
|
+
bodyLines.push('');
|
84
|
+
bodyLines.push(...Object.keys(plugin.executors).map((name) => {
|
85
|
+
const definition = plugin.executors[name];
|
86
|
+
return typeof definition === 'string'
|
87
|
+
? chalk.bold(name)
|
88
|
+
: `${chalk.bold(name)} : ${definition.description}`;
|
89
|
+
}));
|
90
|
+
}
|
91
|
+
if (hasProjectGraphExtension) {
|
92
|
+
bodyLines.push(`✔️ Project Graph Extension`);
|
93
|
+
}
|
94
|
+
if (hasProjectInference) {
|
95
|
+
bodyLines.push(`✔️ Project Inference`);
|
96
|
+
}
|
97
|
+
output_1.output.log({
|
98
|
+
title: `Capabilities in ${plugin.name}:`,
|
99
|
+
bodyLines,
|
100
|
+
});
|
101
|
+
}
|
102
|
+
function hasElements(obj) {
|
103
|
+
return obj && Object.values(obj).length > 0;
|
104
|
+
}
|
@@ -1,4 +1,14 @@
|
|
1
|
+
import { ExecutorsJsonEntry, GeneratorsJsonEntry } from '../../config/misc-interfaces';
|
1
2
|
import { ProjectConfiguration } from '../../config/workspace-json-project-json';
|
2
|
-
|
3
|
+
export interface PluginCapabilities {
|
4
|
+
name: string;
|
5
|
+
executors?: {
|
6
|
+
[name: string]: ExecutorsJsonEntry;
|
7
|
+
};
|
8
|
+
generators?: {
|
9
|
+
[name: string]: GeneratorsJsonEntry;
|
10
|
+
};
|
11
|
+
projectInference?: boolean;
|
12
|
+
projectGraphExtension?: boolean;
|
13
|
+
}
|
3
14
|
export declare function getPluginCapabilities(workspaceRoot: string, pluginName: string, projects: Record<string, ProjectConfiguration>, includeRuntimeCapabilities?: boolean): Promise<PluginCapabilities | null>;
|
4
|
-
export declare function listPluginCapabilities(pluginName: string, projects: Record<string, ProjectConfiguration>): Promise<void>;
|
@@ -1,17 +1,11 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
3
|
exports.getPluginCapabilities = getPluginCapabilities;
|
4
|
-
exports.listPluginCapabilities = listPluginCapabilities;
|
5
|
-
const chalk = require("chalk");
|
6
4
|
const path_1 = require("path");
|
7
|
-
const plugins_1 = require("../../project-graph/plugins");
|
8
|
-
const loader_1 = require("../../project-graph/plugins/loader");
|
9
5
|
const fileutils_1 = require("../fileutils");
|
10
6
|
const installation_directory_1 = require("../installation-directory");
|
11
|
-
const
|
12
|
-
const
|
13
|
-
const workspace_root_1 = require("../workspace-root");
|
14
|
-
const shared_1 = require("./shared");
|
7
|
+
const plugins_1 = require("../../project-graph/plugins");
|
8
|
+
const loader_1 = require("../../project-graph/plugins/loader");
|
15
9
|
function tryGetCollection(packageJsonPath, collectionFile, propName) {
|
16
10
|
if (!collectionFile) {
|
17
11
|
return null;
|
@@ -78,82 +72,3 @@ async function tryGetModule(packageJson, workspaceRoot) {
|
|
78
72
|
return null;
|
79
73
|
}
|
80
74
|
}
|
81
|
-
async function listPluginCapabilities(pluginName, projects) {
|
82
|
-
const plugin = await getPluginCapabilities(workspace_root_1.workspaceRoot, pluginName, projects);
|
83
|
-
if (!plugin) {
|
84
|
-
const pmc = (0, package_manager_1.getPackageManagerCommand)();
|
85
|
-
output_1.output.note({
|
86
|
-
title: `${pluginName} is not currently installed`,
|
87
|
-
bodyLines: [
|
88
|
-
`Use "${pmc.addDev} ${pluginName}" to install the plugin.`,
|
89
|
-
`After that, use "${pmc.exec} nx g ${pluginName}:init" to add the required peer deps and initialize the plugin.`,
|
90
|
-
],
|
91
|
-
});
|
92
|
-
return;
|
93
|
-
}
|
94
|
-
const hasBuilders = (0, shared_1.hasElements)(plugin.executors);
|
95
|
-
const hasGenerators = (0, shared_1.hasElements)(plugin.generators);
|
96
|
-
const hasProjectGraphExtension = !!plugin.projectGraphExtension;
|
97
|
-
const hasProjectInference = !!plugin.projectInference;
|
98
|
-
if (!hasBuilders &&
|
99
|
-
!hasGenerators &&
|
100
|
-
!hasProjectGraphExtension &&
|
101
|
-
!hasProjectInference) {
|
102
|
-
output_1.output.warn({ title: `No capabilities found in ${pluginName}` });
|
103
|
-
return;
|
104
|
-
}
|
105
|
-
const bodyLines = [];
|
106
|
-
if (hasGenerators) {
|
107
|
-
bodyLines.push(chalk.bold(chalk.green('GENERATORS')));
|
108
|
-
bodyLines.push('');
|
109
|
-
bodyLines.push(...Object.keys(plugin.generators).map((name) => `${chalk.bold(name)} : ${plugin.generators[name].description}`));
|
110
|
-
if (hasBuilders) {
|
111
|
-
bodyLines.push('');
|
112
|
-
}
|
113
|
-
}
|
114
|
-
if (hasBuilders) {
|
115
|
-
bodyLines.push(chalk.bold(chalk.green('EXECUTORS/BUILDERS')));
|
116
|
-
bodyLines.push('');
|
117
|
-
bodyLines.push(...Object.keys(plugin.executors).map((name) => `${chalk.bold(name)} : ${resolveExecutorDescription(pluginName, plugin.executors[name], projects)}`));
|
118
|
-
}
|
119
|
-
if (hasProjectGraphExtension) {
|
120
|
-
bodyLines.push(`✔️ Project Graph Extension`);
|
121
|
-
}
|
122
|
-
if (hasProjectInference) {
|
123
|
-
bodyLines.push(`✔️ Project Inference`);
|
124
|
-
}
|
125
|
-
output_1.output.log({
|
126
|
-
title: `Capabilities in ${plugin.name}:`,
|
127
|
-
bodyLines,
|
128
|
-
});
|
129
|
-
}
|
130
|
-
function resolveExecutorDescription(pluginName, executorJsonEntry, projects, requirePaths = (0, installation_directory_1.getNxRequirePaths)(workspace_root_1.workspaceRoot)) {
|
131
|
-
try {
|
132
|
-
if (typeof executorJsonEntry === 'string') {
|
133
|
-
// it points to another executor, resolve it
|
134
|
-
const [pkgName, executor] = executorJsonEntry.split(':');
|
135
|
-
// read the package.json of the parent plugin
|
136
|
-
const { path: packageJsonPath } = (0, plugins_1.readPluginPackageJson)(pluginName, projects, requirePaths);
|
137
|
-
// accumulate the require paths to resolve nested packages
|
138
|
-
const cummulativeRequirePaths = [
|
139
|
-
...requirePaths,
|
140
|
-
(0, path_1.dirname)(packageJsonPath),
|
141
|
-
];
|
142
|
-
const collection = loadExecutorsCollection(pkgName, projects, cummulativeRequirePaths);
|
143
|
-
return resolveExecutorDescription(pkgName, collection[executor], projects, cummulativeRequirePaths);
|
144
|
-
}
|
145
|
-
return executorJsonEntry.description;
|
146
|
-
}
|
147
|
-
catch {
|
148
|
-
return 'No description available';
|
149
|
-
}
|
150
|
-
}
|
151
|
-
function loadExecutorsCollection(pluginName, projects, requirePaths) {
|
152
|
-
const { json: packageJson, path: packageJsonPath } = (0, plugins_1.readPluginPackageJson)(pluginName, projects, requirePaths);
|
153
|
-
return {
|
154
|
-
...tryGetCollection(packageJsonPath, packageJson.builders, 'builders'),
|
155
|
-
...tryGetCollection(packageJsonPath, packageJson.executors, 'builders'),
|
156
|
-
...tryGetCollection(packageJsonPath, packageJson.builders, 'executors'),
|
157
|
-
...tryGetCollection(packageJsonPath, packageJson.executors, 'executors'),
|
158
|
-
};
|
159
|
-
}
|