hereya-cli 0.79.6 → 0.81.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/README.md +57 -57
- package/dist/backend/cloud/cloud-backend.js +11 -0
- package/dist/backend/common.d.ts +18 -0
- package/dist/backend/common.js +6 -0
- package/dist/backend/file.d.ts +1 -0
- package/dist/backend/file.js +56 -42
- package/dist/commands/add/index.js +5 -3
- package/dist/commands/deploy/index.js +10 -6
- package/dist/commands/devenv/install/index.js +0 -3
- package/dist/commands/docker/run/index.js +1 -1
- package/dist/commands/down/index.js +5 -3
- package/dist/commands/env/index.js +1 -1
- package/dist/commands/import/index.js +2 -1
- package/dist/commands/remove/index.js +6 -4
- package/dist/commands/run/index.js +1 -1
- package/dist/commands/undeploy/index.js +5 -3
- package/dist/commands/up/index.js +7 -4
- package/dist/commands/workspace/install/index.js +0 -3
- package/dist/commands/workspace/uninstall/index.js +1 -4
- package/dist/lib/parameter/index.d.ts +1 -0
- package/dist/lib/parameter/index.js +17 -6
- package/dist/lib/profile-utils.d.ts +5 -1
- package/dist/lib/profile-utils.js +9 -3
- package/oclif.manifest.json +116 -116
- package/package.json +1 -1
package/dist/backend/file.js
CHANGED
|
@@ -9,7 +9,7 @@ export class FileBackend {
|
|
|
9
9
|
this.fileStorage = fileStorage;
|
|
10
10
|
}
|
|
11
11
|
async addPackageToWorkspace(input) {
|
|
12
|
-
const workspace$ = await this.
|
|
12
|
+
const workspace$ = await this.getOwnWorkspace(input.workspace);
|
|
13
13
|
if (!workspace$.found) {
|
|
14
14
|
return {
|
|
15
15
|
reason: `Workspace ${input.workspace} not found`,
|
|
@@ -23,12 +23,6 @@ export class FileBackend {
|
|
|
23
23
|
};
|
|
24
24
|
}
|
|
25
25
|
const { workspace } = workspace$;
|
|
26
|
-
if (workspace.mirrorOf) {
|
|
27
|
-
return {
|
|
28
|
-
reason: `Cannot add package to mirroring workspace ${input.workspace}`,
|
|
29
|
-
success: false,
|
|
30
|
-
};
|
|
31
|
-
}
|
|
32
26
|
workspace.packages = {
|
|
33
27
|
...workspace.packages,
|
|
34
28
|
[input.package]: {
|
|
@@ -155,7 +149,7 @@ export class FileBackend {
|
|
|
155
149
|
success: false,
|
|
156
150
|
};
|
|
157
151
|
}
|
|
158
|
-
if (
|
|
152
|
+
if (Object.keys(workspace.ownPackages ?? {}).length > 0) {
|
|
159
153
|
return {
|
|
160
154
|
reason: `Cannot delete workspace ${input.name} because it has packages`,
|
|
161
155
|
success: false,
|
|
@@ -180,6 +174,39 @@ export class FileBackend {
|
|
|
180
174
|
success: false,
|
|
181
175
|
};
|
|
182
176
|
}
|
|
177
|
+
async getOwnWorkspace(workspace) {
|
|
178
|
+
const paths = [
|
|
179
|
+
['state', 'workspaces', `${workspace}.yaml`].join('/'),
|
|
180
|
+
['state', 'workspaces', `${workspace}.yml`].join('/'),
|
|
181
|
+
];
|
|
182
|
+
const result = await this.fileStorage.getFileContent({ paths });
|
|
183
|
+
if (!result.found) {
|
|
184
|
+
return {
|
|
185
|
+
found: false,
|
|
186
|
+
};
|
|
187
|
+
}
|
|
188
|
+
const { data, error } = await parseYaml(result.content);
|
|
189
|
+
if (error) {
|
|
190
|
+
return {
|
|
191
|
+
error,
|
|
192
|
+
found: true,
|
|
193
|
+
hasError: true,
|
|
194
|
+
};
|
|
195
|
+
}
|
|
196
|
+
const workspace$ = WorkspaceSchema.safeParse(data);
|
|
197
|
+
if (!workspace$.success) {
|
|
198
|
+
return {
|
|
199
|
+
error: workspace$.error.message,
|
|
200
|
+
found: true,
|
|
201
|
+
hasError: true,
|
|
202
|
+
};
|
|
203
|
+
}
|
|
204
|
+
return {
|
|
205
|
+
found: true,
|
|
206
|
+
hasError: false,
|
|
207
|
+
workspace: workspace$.data,
|
|
208
|
+
};
|
|
209
|
+
}
|
|
183
210
|
async getPackageByVersion(_, __) {
|
|
184
211
|
return {
|
|
185
212
|
reason: 'Package registry operations are only supported with the cloud backend. Please run `hereya login` to use cloud backend.',
|
|
@@ -240,38 +267,22 @@ export class FileBackend {
|
|
|
240
267
|
};
|
|
241
268
|
}
|
|
242
269
|
async getWorkspace(workspace) {
|
|
243
|
-
const
|
|
244
|
-
|
|
245
|
-
['state', 'workspaces', `${workspace}.yml`].join('/'),
|
|
246
|
-
];
|
|
247
|
-
const result = await this.fileStorage.getFileContent({ paths });
|
|
248
|
-
if (!result.found) {
|
|
270
|
+
const ownWorkspace$ = await this.getOwnWorkspace(workspace);
|
|
271
|
+
if (!ownWorkspace$.found) {
|
|
249
272
|
return {
|
|
250
273
|
found: false,
|
|
251
274
|
};
|
|
252
275
|
}
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
return {
|
|
256
|
-
error,
|
|
257
|
-
found: true,
|
|
258
|
-
hasError: true,
|
|
259
|
-
};
|
|
260
|
-
}
|
|
261
|
-
const workspace$ = WorkspaceSchema.safeParse(data);
|
|
262
|
-
if (!workspace$.success) {
|
|
263
|
-
return {
|
|
264
|
-
error: workspace$.error.message,
|
|
265
|
-
found: true,
|
|
266
|
-
hasError: true,
|
|
267
|
-
};
|
|
276
|
+
if (ownWorkspace$.hasError) {
|
|
277
|
+
return ownWorkspace$;
|
|
268
278
|
}
|
|
279
|
+
const ownData = ownWorkspace$.workspace;
|
|
269
280
|
let mirroredWorkspace;
|
|
270
|
-
if (
|
|
271
|
-
const mirroredWorkspace$ = await this.getWorkspace(
|
|
281
|
+
if (ownData.mirrorOf) {
|
|
282
|
+
const mirroredWorkspace$ = await this.getWorkspace(ownData.mirrorOf);
|
|
272
283
|
if (!mirroredWorkspace$.found) {
|
|
273
284
|
return {
|
|
274
|
-
error: `Mirrored workspace ${
|
|
285
|
+
error: `Mirrored workspace ${ownData.mirrorOf} not found`,
|
|
275
286
|
found: true,
|
|
276
287
|
hasError: true,
|
|
277
288
|
};
|
|
@@ -290,19 +301,22 @@ export class FileBackend {
|
|
|
290
301
|
hasError: false,
|
|
291
302
|
workspace: mirroredWorkspace
|
|
292
303
|
? {
|
|
293
|
-
...
|
|
304
|
+
...ownData,
|
|
294
305
|
env: {
|
|
295
306
|
...mirroredWorkspace.env,
|
|
296
|
-
...
|
|
307
|
+
...ownData.env,
|
|
297
308
|
},
|
|
309
|
+
ownPackages: ownData.packages ?? {},
|
|
298
310
|
packages: {
|
|
299
311
|
...mirroredWorkspace.packages,
|
|
312
|
+
...ownData.packages,
|
|
300
313
|
},
|
|
301
314
|
}
|
|
302
315
|
: {
|
|
303
|
-
...
|
|
316
|
+
...ownData,
|
|
317
|
+
ownPackages: ownData.packages ?? {},
|
|
304
318
|
packages: {
|
|
305
|
-
...
|
|
319
|
+
...ownData.packages,
|
|
306
320
|
},
|
|
307
321
|
},
|
|
308
322
|
};
|
|
@@ -369,7 +383,7 @@ export class FileBackend {
|
|
|
369
383
|
};
|
|
370
384
|
}
|
|
371
385
|
async removePackageFromWorkspace(input) {
|
|
372
|
-
const workspace$ = await this.
|
|
386
|
+
const workspace$ = await this.getOwnWorkspace(input.workspace);
|
|
373
387
|
if (!workspace$.found) {
|
|
374
388
|
return {
|
|
375
389
|
reason: `Workspace ${input.workspace} not found`,
|
|
@@ -383,9 +397,9 @@ export class FileBackend {
|
|
|
383
397
|
};
|
|
384
398
|
}
|
|
385
399
|
const { workspace } = workspace$;
|
|
386
|
-
if (workspace.
|
|
400
|
+
if (!workspace.packages || !(input.package in workspace.packages)) {
|
|
387
401
|
return {
|
|
388
|
-
reason: `
|
|
402
|
+
reason: `Package ${input.package} not found in workspace ${input.workspace}`,
|
|
389
403
|
success: false,
|
|
390
404
|
};
|
|
391
405
|
}
|
|
@@ -423,7 +437,7 @@ export class FileBackend {
|
|
|
423
437
|
await this.fileStorage.saveFileContent({ content: stringify(object), paths });
|
|
424
438
|
}
|
|
425
439
|
async setEnvVar(input) {
|
|
426
|
-
const workspace$ = await this.
|
|
440
|
+
const workspace$ = await this.getOwnWorkspace(input.workspace);
|
|
427
441
|
if (!workspace$.found) {
|
|
428
442
|
return {
|
|
429
443
|
reason: `Workspace ${input.workspace} not found`,
|
|
@@ -447,7 +461,7 @@ export class FileBackend {
|
|
|
447
461
|
};
|
|
448
462
|
}
|
|
449
463
|
async unsetEnvVar(input) {
|
|
450
|
-
const workspace$ = await this.
|
|
464
|
+
const workspace$ = await this.getOwnWorkspace(input.workspace);
|
|
451
465
|
if (!workspace$.found) {
|
|
452
466
|
return {
|
|
453
467
|
reason: `Workspace ${input.workspace} not found`,
|
|
@@ -475,7 +489,7 @@ export class FileBackend {
|
|
|
475
489
|
}
|
|
476
490
|
async updateWorkspace(input) {
|
|
477
491
|
// Load existing workspace
|
|
478
|
-
const workspace$ = await this.
|
|
492
|
+
const workspace$ = await this.getOwnWorkspace(input.name);
|
|
479
493
|
if (!workspace$.found) {
|
|
480
494
|
return {
|
|
481
495
|
reason: `Workspace ${input.name} not found`,
|
|
@@ -90,12 +90,13 @@ export default class Add extends Command {
|
|
|
90
90
|
const userSpecifiedParameters = arrayOfStringToObject(ctx.userSpecifiedParameters);
|
|
91
91
|
const parameterManager = getParameterManager();
|
|
92
92
|
const backend = await getBackend();
|
|
93
|
-
const profile = await getProfileFromWorkspace(backend, ctx.workspace, ctx.configOutput.config.project);
|
|
93
|
+
const { profile, workspaceName } = await getProfileFromWorkspace(backend, ctx.workspace, ctx.configOutput.config.project);
|
|
94
94
|
const parametersOutput = await parameterManager.getPackageParameters({
|
|
95
95
|
package: ctx.package,
|
|
96
96
|
profile,
|
|
97
97
|
projectRootDir,
|
|
98
98
|
userSpecifiedParameters,
|
|
99
|
+
workspaceName,
|
|
99
100
|
});
|
|
100
101
|
ctx.parametersOutput = parametersOutput;
|
|
101
102
|
await delay(500);
|
|
@@ -187,7 +188,7 @@ export default class Add extends Command {
|
|
|
187
188
|
return;
|
|
188
189
|
}
|
|
189
190
|
const backend = await getBackend();
|
|
190
|
-
const profile = await getProfileFromWorkspace(backend, ctx.workspace, ctx.configOutput.config.project);
|
|
191
|
+
const { profile } = await getProfileFromWorkspace(backend, ctx.workspace, ctx.configOutput.config.project);
|
|
191
192
|
const envManager = getEnvManager();
|
|
192
193
|
const getProjectEnvOutput = await envManager.getProjectEnv({
|
|
193
194
|
excludeDevDeploy: true,
|
|
@@ -228,11 +229,12 @@ export default class Add extends Command {
|
|
|
228
229
|
async task(_, task) {
|
|
229
230
|
const parameterManager = getParameterManager();
|
|
230
231
|
const backend = await getBackend();
|
|
231
|
-
const profile = await getProfileFromWorkspace(backend, ctx.workspace, ctx.configOutput.config.project);
|
|
232
|
+
const { profile, workspaceName } = await getProfileFromWorkspace(backend, ctx.workspace, ctx.configOutput.config.project);
|
|
232
233
|
const { parameters } = await parameterManager.getPackageParameters({
|
|
233
234
|
package: pkg.name,
|
|
234
235
|
profile,
|
|
235
236
|
projectRootDir,
|
|
237
|
+
workspaceName,
|
|
236
238
|
});
|
|
237
239
|
const executor$ = await getExecutorForWorkspace(ctx.workspace, ctx.configOutput.config.project);
|
|
238
240
|
if (!executor$.success) {
|
|
@@ -111,7 +111,7 @@ export default class Deploy extends Command {
|
|
|
111
111
|
{
|
|
112
112
|
async task(ctx) {
|
|
113
113
|
const backend = await getBackend();
|
|
114
|
-
const profile = await getProfileFromWorkspace(backend, ctx.workspace, ctx.configOutput.config.project);
|
|
114
|
+
const { profile } = await getProfileFromWorkspace(backend, ctx.workspace, ctx.configOutput.config.project);
|
|
115
115
|
const envManager = getEnvManager();
|
|
116
116
|
const getProjectEnvOutput = await envManager.getProjectEnv({
|
|
117
117
|
markSecret: true,
|
|
@@ -177,11 +177,12 @@ export default class Deploy extends Command {
|
|
|
177
177
|
async task(_, task) {
|
|
178
178
|
const parameterManager = getParameterManager();
|
|
179
179
|
const backend = await getBackend();
|
|
180
|
-
const profile = await getProfileFromWorkspace(backend, ctx.workspace, ctx.configOutput.config.project);
|
|
180
|
+
const { profile, workspaceName } = await getProfileFromWorkspace(backend, ctx.workspace, ctx.configOutput.config.project);
|
|
181
181
|
const { parameters } = await parameterManager.getPackageParameters({
|
|
182
182
|
package: pkg.name,
|
|
183
183
|
profile,
|
|
184
184
|
projectRootDir,
|
|
185
|
+
workspaceName,
|
|
185
186
|
});
|
|
186
187
|
const executor$ = getExecutor();
|
|
187
188
|
if (!executor$.success) {
|
|
@@ -225,11 +226,12 @@ export default class Deploy extends Command {
|
|
|
225
226
|
async task(_, task) {
|
|
226
227
|
const parameterManager = getParameterManager();
|
|
227
228
|
const backend = await getBackend();
|
|
228
|
-
const profile = await getProfileFromWorkspace(backend, ctx.workspace, ctx.configOutput.config.project);
|
|
229
|
+
const { profile, workspaceName } = await getProfileFromWorkspace(backend, ctx.workspace, ctx.configOutput.config.project);
|
|
229
230
|
const { parameters } = await parameterManager.getPackageParameters({
|
|
230
231
|
package: pkg.name,
|
|
231
232
|
profile,
|
|
232
233
|
projectRootDir,
|
|
234
|
+
workspaceName,
|
|
233
235
|
});
|
|
234
236
|
const executor$ = getExecutor();
|
|
235
237
|
if (!executor$.success) {
|
|
@@ -279,11 +281,12 @@ export default class Deploy extends Command {
|
|
|
279
281
|
async task(_, task) {
|
|
280
282
|
const parameterManager = getParameterManager();
|
|
281
283
|
const backend = await getBackend();
|
|
282
|
-
const profile = await getProfileFromWorkspace(backend, ctx.workspace, ctx.configOutput.config.project);
|
|
284
|
+
const { profile, workspaceName } = await getProfileFromWorkspace(backend, ctx.workspace, ctx.configOutput.config.project);
|
|
283
285
|
const { parameters } = await parameterManager.getPackageParameters({
|
|
284
286
|
package: pkg.name,
|
|
285
287
|
profile,
|
|
286
288
|
projectRootDir,
|
|
289
|
+
workspaceName,
|
|
287
290
|
});
|
|
288
291
|
const executor$ = getExecutor();
|
|
289
292
|
if (!executor$.success) {
|
|
@@ -378,7 +381,7 @@ export default class Deploy extends Command {
|
|
|
378
381
|
skip: (ctx) => ctx.deployPackages.length === 0,
|
|
379
382
|
async task(ctx, task) {
|
|
380
383
|
const backend = await getBackend();
|
|
381
|
-
const profile = await getProfileFromWorkspace(backend, ctx.workspace, ctx.configOutput.config.project);
|
|
384
|
+
const { profile } = await getProfileFromWorkspace(backend, ctx.workspace, ctx.configOutput.config.project);
|
|
382
385
|
const envManager = getEnvManager();
|
|
383
386
|
const getProjectEnvOutput = await envManager.getProjectEnv({
|
|
384
387
|
markSecret: true,
|
|
@@ -398,11 +401,12 @@ export default class Deploy extends Command {
|
|
|
398
401
|
async task(_, task) {
|
|
399
402
|
const parameterManager = getParameterManager();
|
|
400
403
|
const backend = await getBackend();
|
|
401
|
-
const profile = await getProfileFromWorkspace(backend, ctx.workspace, ctx.configOutput.config.project);
|
|
404
|
+
const { profile, workspaceName } = await getProfileFromWorkspace(backend, ctx.workspace, ctx.configOutput.config.project);
|
|
402
405
|
const { parameters } = await parameterManager.getPackageParameters({
|
|
403
406
|
package: pkg.name,
|
|
404
407
|
profile,
|
|
405
408
|
projectRootDir,
|
|
409
|
+
workspaceName,
|
|
406
410
|
});
|
|
407
411
|
const executor$ = getExecutor();
|
|
408
412
|
if (!executor$.success) {
|
|
@@ -51,9 +51,6 @@ export default class DevenvInstall extends Command {
|
|
|
51
51
|
if (!loadWorkspaceOutput.found || loadWorkspaceOutput.hasError) {
|
|
52
52
|
throw new Error(`Workspace ${flags.workspace} not found`);
|
|
53
53
|
}
|
|
54
|
-
if (loadWorkspaceOutput.workspace.mirrorOf) {
|
|
55
|
-
throw new Error(`Workspace ${flags.workspace} is a mirror of ${loadWorkspaceOutput.workspace.mirrorOf}`);
|
|
56
|
-
}
|
|
57
54
|
ctx.workspace = loadWorkspaceOutput;
|
|
58
55
|
await delay(500);
|
|
59
56
|
},
|
|
@@ -58,7 +58,7 @@ export default class DockerRun extends Command {
|
|
|
58
58
|
if (!validation.isValid) {
|
|
59
59
|
this.error(validation.message);
|
|
60
60
|
}
|
|
61
|
-
const profile = await getProfileFromWorkspace(backend, workspace, config.project);
|
|
61
|
+
const { profile } = await getProfileFromWorkspace(backend, workspace, config.project);
|
|
62
62
|
const envManager = getEnvManager();
|
|
63
63
|
const getProjectEnvOutput = await envManager.getProjectEnv({
|
|
64
64
|
profile,
|
|
@@ -148,7 +148,7 @@ export default class Down extends Command {
|
|
|
148
148
|
async task(ctx) {
|
|
149
149
|
// Load project env for devDeploy destroy
|
|
150
150
|
const backend = await getBackend();
|
|
151
|
-
const profile = await getProfileFromWorkspace(backend, ctx.workspace, ctx.configOutput.config.project);
|
|
151
|
+
const { profile } = await getProfileFromWorkspace(backend, ctx.workspace, ctx.configOutput.config.project);
|
|
152
152
|
const envManager = getEnvManager();
|
|
153
153
|
const getProjectEnvOutput = await envManager.getProjectEnv({
|
|
154
154
|
excludeDevDeploy: true,
|
|
@@ -176,11 +176,12 @@ export default class Down extends Command {
|
|
|
176
176
|
async task(_, task) {
|
|
177
177
|
const parameterManager = getParameterManager();
|
|
178
178
|
const backend = await getBackend();
|
|
179
|
-
const profile = await getProfileFromWorkspace(backend, ctx.workspace, ctx.configOutput.config.project);
|
|
179
|
+
const { profile, workspaceName } = await getProfileFromWorkspace(backend, ctx.workspace, ctx.configOutput.config.project);
|
|
180
180
|
const { parameters } = await parameterManager.getPackageParameters({
|
|
181
181
|
package: pkg.name,
|
|
182
182
|
profile,
|
|
183
183
|
projectRootDir,
|
|
184
|
+
workspaceName,
|
|
184
185
|
});
|
|
185
186
|
const executor$ = await getExecutorForWorkspace(ctx.workspace, ctx.configOutput.config.project);
|
|
186
187
|
if (!executor$.success) {
|
|
@@ -251,11 +252,12 @@ export default class Down extends Command {
|
|
|
251
252
|
async task(_, task) {
|
|
252
253
|
const parameterManager = getParameterManager();
|
|
253
254
|
const backend = await getBackend();
|
|
254
|
-
const profile = await getProfileFromWorkspace(backend, ctx.workspace, ctx.configOutput.config.project);
|
|
255
|
+
const { profile, workspaceName } = await getProfileFromWorkspace(backend, ctx.workspace, ctx.configOutput.config.project);
|
|
255
256
|
const { parameters } = await parameterManager.getPackageParameters({
|
|
256
257
|
package: pkg.name,
|
|
257
258
|
profile,
|
|
258
259
|
projectRootDir,
|
|
260
|
+
workspaceName,
|
|
259
261
|
});
|
|
260
262
|
const executor$ = await getExecutorForWorkspace(ctx.workspace, ctx.configOutput.config.project);
|
|
261
263
|
if (!executor$.success) {
|
|
@@ -49,7 +49,7 @@ export default class Env extends Command {
|
|
|
49
49
|
this.error('you must specify a workspace to print the env vars for');
|
|
50
50
|
}
|
|
51
51
|
const backend = await getBackend();
|
|
52
|
-
const profile = await getProfileFromWorkspace(backend, workspace, config.project);
|
|
52
|
+
const { profile } = await getProfileFromWorkspace(backend, workspace, config.project);
|
|
53
53
|
const envManager = getEnvManager();
|
|
54
54
|
const getProjectEnvOutput = await envManager.getProjectEnv({
|
|
55
55
|
profile,
|
|
@@ -97,12 +97,13 @@ export default class Import extends Command {
|
|
|
97
97
|
const userSpecifiedParameters = arrayOfStringToObject(ctx.userSpecifiedParameters);
|
|
98
98
|
const parameterManager = getParameterManager();
|
|
99
99
|
const backend = await getBackend();
|
|
100
|
-
const profile = await getProfileFromWorkspace(backend, ctx.workspace, ctx.configOutput.config.project);
|
|
100
|
+
const { profile, workspaceName } = await getProfileFromWorkspace(backend, ctx.workspace, ctx.configOutput.config.project);
|
|
101
101
|
const parametersOutput = await parameterManager.getPackageParameters({
|
|
102
102
|
package: ctx.package,
|
|
103
103
|
profile,
|
|
104
104
|
projectRootDir,
|
|
105
105
|
userSpecifiedParameters,
|
|
106
|
+
workspaceName,
|
|
106
107
|
});
|
|
107
108
|
ctx.parametersOutput = parametersOutput;
|
|
108
109
|
await delay(500);
|
|
@@ -92,11 +92,12 @@ export default class Remove extends Command {
|
|
|
92
92
|
async task(ctx) {
|
|
93
93
|
const parameterManager = getParameterManager();
|
|
94
94
|
const backend = await getBackend();
|
|
95
|
-
const profile = await getProfileFromWorkspace(backend, ctx.workspace, ctx.configOutput.config.project);
|
|
95
|
+
const { profile, workspaceName } = await getProfileFromWorkspace(backend, ctx.workspace, ctx.configOutput.config.project);
|
|
96
96
|
const parametersOutput = await parameterManager.getPackageParameters({
|
|
97
97
|
package: ctx.package,
|
|
98
98
|
profile,
|
|
99
99
|
projectRootDir,
|
|
100
|
+
workspaceName,
|
|
100
101
|
});
|
|
101
102
|
ctx.parametersOutput = parametersOutput;
|
|
102
103
|
await delay(500);
|
|
@@ -107,7 +108,7 @@ export default class Remove extends Command {
|
|
|
107
108
|
skip: (ctx) => !ctx.isDevDeploy,
|
|
108
109
|
async task(ctx) {
|
|
109
110
|
const backend = await getBackend();
|
|
110
|
-
const profile = await getProfileFromWorkspace(backend, ctx.workspace, ctx.configOutput.config.project);
|
|
111
|
+
const { profile } = await getProfileFromWorkspace(backend, ctx.workspace, ctx.configOutput.config.project);
|
|
111
112
|
const envManager = getEnvManager();
|
|
112
113
|
const getProjectEnvOutput = await envManager.getProjectEnv({
|
|
113
114
|
excludeDevDeploy: true,
|
|
@@ -202,7 +203,7 @@ export default class Remove extends Command {
|
|
|
202
203
|
return;
|
|
203
204
|
}
|
|
204
205
|
const backend = await getBackend();
|
|
205
|
-
const profile = await getProfileFromWorkspace(backend, ctx.workspace, ctx.configOutput.config.project);
|
|
206
|
+
const { profile } = await getProfileFromWorkspace(backend, ctx.workspace, ctx.configOutput.config.project);
|
|
206
207
|
const envManager = getEnvManager();
|
|
207
208
|
const getProjectEnvOutput = await envManager.getProjectEnv({
|
|
208
209
|
excludeDevDeploy: true,
|
|
@@ -242,11 +243,12 @@ export default class Remove extends Command {
|
|
|
242
243
|
async task(_, task) {
|
|
243
244
|
const parameterManager = getParameterManager();
|
|
244
245
|
const backend = await getBackend();
|
|
245
|
-
const profile = await getProfileFromWorkspace(backend, ctx.workspace, ctx.configOutput.config.project);
|
|
246
|
+
const { profile, workspaceName } = await getProfileFromWorkspace(backend, ctx.workspace, ctx.configOutput.config.project);
|
|
246
247
|
const { parameters } = await parameterManager.getPackageParameters({
|
|
247
248
|
package: pkg.name,
|
|
248
249
|
profile,
|
|
249
250
|
projectRootDir,
|
|
251
|
+
workspaceName,
|
|
250
252
|
});
|
|
251
253
|
const executor$ = await getExecutorForWorkspace(ctx.workspace, ctx.configOutput.config.project);
|
|
252
254
|
if (!executor$.success) {
|
|
@@ -49,7 +49,7 @@ export default class Run extends Command {
|
|
|
49
49
|
if (!validation.isValid) {
|
|
50
50
|
this.error(validation.message);
|
|
51
51
|
}
|
|
52
|
-
const profile = await getProfileFromWorkspace(backend, workspace, config.project);
|
|
52
|
+
const { profile } = await getProfileFromWorkspace(backend, workspace, config.project);
|
|
53
53
|
const envManager = getEnvManager();
|
|
54
54
|
const getProjectEnvOutput = await envManager.getProjectEnv({
|
|
55
55
|
profile,
|
|
@@ -100,7 +100,7 @@ export default class Undeploy extends Command {
|
|
|
100
100
|
{
|
|
101
101
|
async task(ctx) {
|
|
102
102
|
const backend = await getBackend();
|
|
103
|
-
const profile = await getProfileFromWorkspace(backend, ctx.workspace, ctx.configOutput.config.project);
|
|
103
|
+
const { profile } = await getProfileFromWorkspace(backend, ctx.workspace, ctx.configOutput.config.project);
|
|
104
104
|
const envManager = getEnvManager();
|
|
105
105
|
const getProjectEnvOutput = await envManager.getProjectEnv({
|
|
106
106
|
markSecret: true,
|
|
@@ -184,11 +184,12 @@ export default class Undeploy extends Command {
|
|
|
184
184
|
async task(_, task) {
|
|
185
185
|
const parameterManager = getParameterManager();
|
|
186
186
|
const backend = await getBackend();
|
|
187
|
-
const profile = await getProfileFromWorkspace(backend, ctx.workspace, ctx.configOutput.config.project);
|
|
187
|
+
const { profile, workspaceName } = await getProfileFromWorkspace(backend, ctx.workspace, ctx.configOutput.config.project);
|
|
188
188
|
const { parameters } = await parameterManager.getPackageParameters({
|
|
189
189
|
package: pkg.name,
|
|
190
190
|
profile,
|
|
191
191
|
projectRootDir,
|
|
192
|
+
workspaceName,
|
|
192
193
|
});
|
|
193
194
|
const executor$ = getExecutor();
|
|
194
195
|
if (!executor$.success) {
|
|
@@ -224,11 +225,12 @@ export default class Undeploy extends Command {
|
|
|
224
225
|
async task(_, task) {
|
|
225
226
|
const parameterManager = getParameterManager();
|
|
226
227
|
const backend = await getBackend();
|
|
227
|
-
const profile = await getProfileFromWorkspace(backend, ctx.workspace, ctx.configOutput.config.project);
|
|
228
|
+
const { profile, workspaceName } = await getProfileFromWorkspace(backend, ctx.workspace, ctx.configOutput.config.project);
|
|
228
229
|
const { parameters } = await parameterManager.getPackageParameters({
|
|
229
230
|
package: pkg.name,
|
|
230
231
|
profile,
|
|
231
232
|
projectRootDir,
|
|
233
|
+
workspaceName,
|
|
232
234
|
});
|
|
233
235
|
const executor$ = getExecutor();
|
|
234
236
|
if (!executor$.success) {
|
|
@@ -137,11 +137,12 @@ export default class Up extends Command {
|
|
|
137
137
|
async task(_, task) {
|
|
138
138
|
const parameterManager = getParameterManager();
|
|
139
139
|
const backend = await getBackend();
|
|
140
|
-
const profile = await getProfileFromWorkspace(backend, workspace, ctx.configOutput.config.project);
|
|
140
|
+
const { profile, workspaceName } = await getProfileFromWorkspace(backend, workspace, ctx.configOutput.config.project);
|
|
141
141
|
const { parameters } = await parameterManager.getPackageParameters({
|
|
142
142
|
package: packageName,
|
|
143
143
|
profile,
|
|
144
144
|
projectRootDir,
|
|
145
|
+
workspaceName,
|
|
145
146
|
});
|
|
146
147
|
const executor$ = await getExecutorForWorkspace(ctx.workspace, ctx.configOutput.config.project);
|
|
147
148
|
if (!executor$.success) {
|
|
@@ -191,11 +192,12 @@ export default class Up extends Command {
|
|
|
191
192
|
async task(_, task) {
|
|
192
193
|
const parameterManager = getParameterManager();
|
|
193
194
|
const backend = await getBackend();
|
|
194
|
-
const profile = await getProfileFromWorkspace(backend, ctx.workspace, ctx.configOutput.config.project);
|
|
195
|
+
const { profile, workspaceName } = await getProfileFromWorkspace(backend, ctx.workspace, ctx.configOutput.config.project);
|
|
195
196
|
const { parameters } = await parameterManager.getPackageParameters({
|
|
196
197
|
package: pkg.name,
|
|
197
198
|
profile,
|
|
198
199
|
projectRootDir,
|
|
200
|
+
workspaceName,
|
|
199
201
|
});
|
|
200
202
|
const executor$ = await getExecutorForWorkspace(ctx.workspace, ctx.configOutput.config.project);
|
|
201
203
|
if (!executor$.success) {
|
|
@@ -281,7 +283,7 @@ export default class Up extends Command {
|
|
|
281
283
|
skip: (ctx) => !ctx.configOutput.config.devDeploy || Object.keys(ctx.configOutput.config.devDeploy).length === 0,
|
|
282
284
|
async task(ctx) {
|
|
283
285
|
const backend = await getBackend();
|
|
284
|
-
const profile = await getProfileFromWorkspace(backend, ctx.workspace, ctx.configOutput.config.project);
|
|
286
|
+
const { profile } = await getProfileFromWorkspace(backend, ctx.workspace, ctx.configOutput.config.project);
|
|
285
287
|
const envManager = getEnvManager();
|
|
286
288
|
const getProjectEnvOutput = await envManager.getProjectEnv({
|
|
287
289
|
excludeDevDeploy: true,
|
|
@@ -321,11 +323,12 @@ export default class Up extends Command {
|
|
|
321
323
|
async task(_, task) {
|
|
322
324
|
const parameterManager = getParameterManager();
|
|
323
325
|
const backend = await getBackend();
|
|
324
|
-
const profile = await getProfileFromWorkspace(backend, ctx.workspace, ctx.configOutput.config.project);
|
|
326
|
+
const { profile, workspaceName } = await getProfileFromWorkspace(backend, ctx.workspace, ctx.configOutput.config.project);
|
|
325
327
|
const { parameters } = await parameterManager.getPackageParameters({
|
|
326
328
|
package: pkg.name,
|
|
327
329
|
profile,
|
|
328
330
|
projectRootDir,
|
|
331
|
+
workspaceName,
|
|
329
332
|
});
|
|
330
333
|
const executor$ = await getExecutorForWorkspace(ctx.workspace, ctx.configOutput.config.project);
|
|
331
334
|
if (!executor$.success) {
|
|
@@ -51,9 +51,6 @@ export default class WorkspaceInstall extends Command {
|
|
|
51
51
|
if (!loadWorkspaceOutput.found || loadWorkspaceOutput.hasError) {
|
|
52
52
|
throw new Error(`Workspace ${flags.workspace} not found`);
|
|
53
53
|
}
|
|
54
|
-
if (loadWorkspaceOutput.workspace.mirrorOf) {
|
|
55
|
-
throw new Error(`Workspace ${flags.workspace} is a mirror of ${loadWorkspaceOutput.workspace.mirrorOf}`);
|
|
56
|
-
}
|
|
57
54
|
ctx.workspace = loadWorkspaceOutput;
|
|
58
55
|
await delay(500);
|
|
59
56
|
},
|
|
@@ -51,12 +51,9 @@ export default class WorkspaceUninstall extends Command {
|
|
|
51
51
|
if (!loadWorkspaceOutput.found || loadWorkspaceOutput.hasError) {
|
|
52
52
|
throw new Error(`Workspace ${flags.workspace} not found`);
|
|
53
53
|
}
|
|
54
|
-
if (loadWorkspaceOutput.workspace.mirrorOf) {
|
|
55
|
-
throw new Error(`Workspace ${flags.workspace} is a mirror of ${loadWorkspaceOutput.workspace.mirrorOf}`);
|
|
56
|
-
}
|
|
57
54
|
// Parse package name to extract name and version
|
|
58
55
|
const [packageNameWithoutVersion, userSpecifiedVersion] = args.package.split('@');
|
|
59
|
-
const packageInfo = loadWorkspaceOutput.workspace.
|
|
56
|
+
const packageInfo = loadWorkspaceOutput.workspace.ownPackages?.[packageNameWithoutVersion];
|
|
60
57
|
if (!packageInfo) {
|
|
61
58
|
throw new Error(`Package ${packageNameWithoutVersion} not found in workspace ${flags.workspace}`);
|
|
62
59
|
}
|
|
@@ -27,12 +27,23 @@ export class ParameterManager {
|
|
|
27
27
|
const profileFilePath = await getAnyPath(path.join(paramsFolder, `${pkgName}.${input.profile}.yaml`), path.join(paramsFolder, `${pkgName}.${input.profile}.yml`));
|
|
28
28
|
const { data: profileParams } = await load(profileFilePath);
|
|
29
29
|
// Extract profile sections from base file
|
|
30
|
-
const profileSections = await this.extractProfileSections(baseFilePath, input.profile);
|
|
30
|
+
const profileSections = await this.extractProfileSections(baseFilePath, 'profile', input.profile);
|
|
31
|
+
// Load workspace-name-specific overrides (only if workspace name differs from profile)
|
|
32
|
+
let workspaceParams = null;
|
|
33
|
+
let workspaceSections = null;
|
|
34
|
+
if (input.workspaceName && input.workspaceName !== input.profile) {
|
|
35
|
+
const wsFilePath = await getAnyPath(path.join(paramsFolder, `${pkgName}.${input.workspaceName}.yaml`), path.join(paramsFolder, `${pkgName}.${input.workspaceName}.yml`));
|
|
36
|
+
const { data } = await load(wsFilePath);
|
|
37
|
+
workspaceParams = data;
|
|
38
|
+
workspaceSections = await this.extractProfileSections(baseFilePath, 'workspace', input.workspaceName);
|
|
39
|
+
}
|
|
31
40
|
// Merge all parameters (order matters for precedence)
|
|
32
41
|
const parameters = {
|
|
33
42
|
...baseParams,
|
|
34
43
|
...profileParams,
|
|
35
44
|
...profileSections,
|
|
45
|
+
...workspaceParams,
|
|
46
|
+
...workspaceSections,
|
|
36
47
|
...input.userSpecifiedParameters
|
|
37
48
|
};
|
|
38
49
|
return { parameters };
|
|
@@ -62,7 +73,7 @@ export class ParameterManager {
|
|
|
62
73
|
saved: true,
|
|
63
74
|
};
|
|
64
75
|
}
|
|
65
|
-
async extractProfileSections(filePath,
|
|
76
|
+
async extractProfileSections(filePath, sectionKey, targetValue) {
|
|
66
77
|
if (!filePath)
|
|
67
78
|
return null;
|
|
68
79
|
try {
|
|
@@ -75,12 +86,12 @@ export class ParameterManager {
|
|
|
75
86
|
const { data } = await parseYaml(doc);
|
|
76
87
|
return data;
|
|
77
88
|
}));
|
|
78
|
-
// Find matching
|
|
89
|
+
// Find matching section document
|
|
79
90
|
for (const data of parsedDocs) {
|
|
80
|
-
if (data && data
|
|
81
|
-
// Remove the
|
|
91
|
+
if (data && data[sectionKey] === targetValue) {
|
|
92
|
+
// Remove the section key field and return the rest
|
|
82
93
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
83
|
-
const {
|
|
94
|
+
const { [sectionKey]: _, ...params } = data;
|
|
84
95
|
return params;
|
|
85
96
|
}
|
|
86
97
|
}
|
|
@@ -1,2 +1,6 @@
|
|
|
1
1
|
import { Backend } from '../backend/common.js';
|
|
2
|
-
export
|
|
2
|
+
export type WorkspaceProfileInfo = {
|
|
3
|
+
profile: string;
|
|
4
|
+
workspaceName: string;
|
|
5
|
+
};
|
|
6
|
+
export declare function getProfileFromWorkspace(backend: Backend, workspaceName: string, project?: string): Promise<WorkspaceProfileInfo>;
|