@nx/workspace 21.6.1-beta.4 → 21.6.1-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/package.json +4 -4
- package/src/generators/new/generate-workspace-files.d.ts +4 -1
- package/src/generators/new/generate-workspace-files.d.ts.map +1 -1
- package/src/generators/new/generate-workspace-files.js +10 -6
- package/src/generators/new/new.d.ts +3 -0
- package/src/generators/new/new.d.ts.map +1 -1
- package/src/generators/new/new.js +11 -1
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@nx/workspace",
|
3
|
-
"version": "21.6.1-
|
3
|
+
"version": "21.6.1-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": {
|
@@ -38,7 +38,7 @@
|
|
38
38
|
}
|
39
39
|
},
|
40
40
|
"dependencies": {
|
41
|
-
"@nx/devkit": "21.6.1-
|
41
|
+
"@nx/devkit": "21.6.1-rc.0",
|
42
42
|
"@zkochan/js-yaml": "0.0.7",
|
43
43
|
"chalk": "^4.1.0",
|
44
44
|
"enquirer": "~2.3.6",
|
@@ -46,10 +46,10 @@
|
|
46
46
|
"semver": "^7.6.3",
|
47
47
|
"tslib": "^2.3.0",
|
48
48
|
"yargs-parser": "21.1.1",
|
49
|
-
"nx": "21.6.1-
|
49
|
+
"nx": "21.6.1-rc.0"
|
50
50
|
},
|
51
51
|
"devDependencies": {
|
52
|
-
"nx": "21.6.1-
|
52
|
+
"nx": "21.6.1-rc.0"
|
53
53
|
},
|
54
54
|
"publishConfig": {
|
55
55
|
"access": "public"
|
@@ -1,4 +1,7 @@
|
|
1
1
|
import { type Tree } from '@nx/devkit';
|
2
2
|
import type { NormalizedSchema } from './new';
|
3
|
-
export declare function generateWorkspaceFiles(tree: Tree, options: NormalizedSchema): Promise<
|
3
|
+
export declare function generateWorkspaceFiles(tree: Tree, options: NormalizedSchema): Promise<{
|
4
|
+
token: string;
|
5
|
+
aiAgentsCallback: () => unknown | undefined;
|
6
|
+
}>;
|
4
7
|
//# sourceMappingURL=generate-workspace-files.d.ts.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"generate-workspace-files.d.ts","sourceRoot":"","sources":["../../../../../../packages/workspace/src/generators/new/generate-workspace-files.ts"],"names":[],"mappings":"AAAA,OAAO,EAML,KAAK,IAAI,EAGV,MAAM,YAAY,CAAC;AAQpB,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,OAAO,CAAC;AA0I9C,wBAAsB,sBAAsB,CAC1C,IAAI,EAAE,IAAI,EACV,OAAO,EAAE,gBAAgB,
|
1
|
+
{"version":3,"file":"generate-workspace-files.d.ts","sourceRoot":"","sources":["../../../../../../packages/workspace/src/generators/new/generate-workspace-files.ts"],"names":[],"mappings":"AAAA,OAAO,EAML,KAAK,IAAI,EAGV,MAAM,YAAY,CAAC;AAQpB,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,OAAO,CAAC;AA0I9C,wBAAsB,sBAAsB,CAC1C,IAAI,EAAE,IAAI,EACV,OAAO,EAAE,gBAAgB;;4BA8BG,OAAO,GAAG,SAAS;GA6BhD"}
|
@@ -134,11 +134,15 @@ async function generateWorkspaceFiles(tree, options) {
|
|
134
134
|
}, nxJson)
|
135
135
|
: null;
|
136
136
|
await createReadme(tree, options, token);
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
137
|
+
let aiAgentsCallback = undefined;
|
138
|
+
if (options.aiAgents && options.aiAgents.length > 0) {
|
139
|
+
aiAgentsCallback = await (0, set_up_ai_agents_1.setupAiAgentsGenerator)(tree, {
|
140
|
+
directory: options.directory,
|
141
|
+
writeNxCloudRules: options.nxCloud !== 'skip',
|
142
|
+
packageVersion: 'latest',
|
143
|
+
agents: [...options.aiAgents],
|
144
|
+
});
|
145
|
+
}
|
142
146
|
const [packageMajor] = packageManagerVersion.split('.');
|
143
147
|
if (options.packageManager === 'pnpm' && +packageMajor >= 7) {
|
144
148
|
if ((0, semver_1.gte)(packageManagerVersion, '10.6.0')) {
|
@@ -158,7 +162,7 @@ async function generateWorkspaceFiles(tree, options) {
|
|
158
162
|
setPresetProperty(tree, options);
|
159
163
|
addNpmScripts(tree, options);
|
160
164
|
setUpWorkspacesInPackageJson(tree, options);
|
161
|
-
return token;
|
165
|
+
return { token, aiAgentsCallback };
|
162
166
|
}
|
163
167
|
function setPresetProperty(tree, options) {
|
164
168
|
if (options.preset === presets_1.Preset.NPM) {
|
@@ -1,5 +1,6 @@
|
|
1
1
|
import { Tree } from '@nx/devkit';
|
2
2
|
import { Linter, LinterType } from '../../utils/lint';
|
3
|
+
import { Agent } from 'nx/src/ai/utils';
|
3
4
|
interface Schema {
|
4
5
|
directory: string;
|
5
6
|
name: string;
|
@@ -29,12 +30,14 @@ interface Schema {
|
|
29
30
|
workspaces?: boolean;
|
30
31
|
workspaceGlobs?: string | string[];
|
31
32
|
useProjectJson?: boolean;
|
33
|
+
aiAgents?: Agent[] | Agent;
|
32
34
|
}
|
33
35
|
export interface NormalizedSchema extends Schema {
|
34
36
|
presetVersion?: string;
|
35
37
|
isCustomPreset: boolean;
|
36
38
|
nxCloudToken?: string;
|
37
39
|
workspaceGlobs?: string[];
|
40
|
+
aiAgents?: Agent[];
|
38
41
|
}
|
39
42
|
export declare function newGenerator(tree: Tree, opts: Schema): Promise<() => Promise<void>>;
|
40
43
|
export default newGenerator;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"new.d.ts","sourceRoot":"","sources":["../../../../../../packages/workspace/src/generators/new/new.ts"],"names":[],"mappings":"AAAA,OAAO,EAML,IAAI,EACL,MAAM,YAAY,CAAC;AAIpB,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;
|
1
|
+
{"version":3,"file":"new.d.ts","sourceRoot":"","sources":["../../../../../../packages/workspace/src/generators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EAAE,OAAO,CAAC;IACzB,QAAQ,CAAC,EAAE,KAAK,EAAE,GAAG,KAAK,CAAC;CAC5B;AAED,MAAM,WAAW,gBAAiB,SAAQ,MAAM;IAC9C,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,cAAc,EAAE,OAAO,CAAC;IACxB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,cAAc,CAAC,EAAE,MAAM,EAAE,CAAC;IAC1B,QAAQ,CAAC,EAAE,KAAK,EAAE,CAAC;CACpB;AAED,wBAAsB,YAAY,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,gCA4C1D;AAED,eAAe,YAAY,CAAC"}
|
@@ -10,7 +10,8 @@ const child_process_1 = require("child_process");
|
|
10
10
|
async function newGenerator(tree, opts) {
|
11
11
|
const options = normalizeOptions(opts);
|
12
12
|
validateOptions(options, tree);
|
13
|
-
|
13
|
+
const { token, aiAgentsCallback } = await (0, generate_workspace_files_1.generateWorkspaceFiles)(tree, options);
|
14
|
+
options.nxCloudToken = token;
|
14
15
|
(0, generate_preset_1.addPresetDependencies)(tree, options);
|
15
16
|
await (0, devkit_1.formatFiles)(tree);
|
16
17
|
return async () => {
|
@@ -29,6 +30,10 @@ async function newGenerator(tree, opts) {
|
|
29
30
|
if (options.preset !== presets_1.Preset.NPM && !options.isCustomPreset) {
|
30
31
|
await (0, generate_preset_1.generatePreset)(tree, options);
|
31
32
|
}
|
33
|
+
// if we move this into create-nx-workspace, we can also easily log things out like nx console install success
|
34
|
+
if (aiAgentsCallback) {
|
35
|
+
await aiAgentsCallback();
|
36
|
+
}
|
32
37
|
};
|
33
38
|
}
|
34
39
|
exports.default = newGenerator;
|
@@ -76,6 +81,11 @@ function normalizeOptions(options) {
|
|
76
81
|
: options.workspaceGlobs
|
77
82
|
? [options.workspaceGlobs]
|
78
83
|
: undefined,
|
84
|
+
aiAgents: Array.isArray(options.aiAgents)
|
85
|
+
? options.aiAgents
|
86
|
+
: options.aiAgents
|
87
|
+
? [options.aiAgents]
|
88
|
+
: undefined,
|
79
89
|
};
|
80
90
|
if (!options.directory) {
|
81
91
|
normalized.directory = normalized.name;
|