@cbnventures/nova 0.21.0 → 0.22.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/build/package.json +2 -1
- package/build/src/cli/generate/github/workflows-blueprint-variables.d.ts.map +1 -1
- package/build/src/cli/generate/github/workflows-blueprint-variables.js +7 -7
- package/build/src/cli/generate/github/workflows-blueprint-variables.js.map +1 -1
- package/build/src/cli/generate/github/workflows-blueprint.d.ts.map +1 -1
- package/build/src/cli/generate/github/workflows-blueprint.js +71 -37
- package/build/src/cli/generate/github/workflows-blueprint.js.map +1 -1
- package/build/src/cli/generate/must-haves/dotenv.d.ts.map +1 -1
- package/build/src/cli/generate/must-haves/dotenv.js +9 -8
- package/build/src/cli/generate/must-haves/dotenv.js.map +1 -1
- package/build/src/cli/recipe/package-json/normalize-dependencies.js +1 -1
- package/build/src/cli/recipe/package-json/normalize-dependencies.js.map +1 -1
- package/build/src/cli/recipe/package-json/sync-identity.d.ts.map +1 -1
- package/build/src/cli/recipe/package-json/sync-identity.js +45 -0
- package/build/src/cli/recipe/package-json/sync-identity.js.map +1 -1
- package/build/src/cli/utility/changelog.d.ts.map +1 -1
- package/build/src/cli/utility/changelog.js +93 -19
- package/build/src/cli/utility/changelog.js.map +1 -1
- package/build/src/cli/utility/initialize.d.ts.map +1 -1
- package/build/src/cli/utility/initialize.js +123 -79
- package/build/src/cli/utility/initialize.js.map +1 -1
- package/build/src/cli/utility/run-scripts.d.ts.map +1 -1
- package/build/src/cli/utility/run-scripts.js +12 -4
- package/build/src/cli/utility/run-scripts.js.map +1 -1
- package/build/src/cli/utility/transpile.d.ts.map +1 -1
- package/build/src/cli/utility/transpile.js +1 -0
- package/build/src/cli/utility/transpile.js.map +1 -1
- package/build/src/cli/utility/type-check.d.ts.map +1 -1
- package/build/src/cli/utility/type-check.js +1 -0
- package/build/src/cli/utility/type-check.js.map +1 -1
- package/build/src/lib/env-github.d.ts +2 -1
- package/build/src/lib/env-github.d.ts.map +1 -1
- package/build/src/lib/env-github.js +20 -0
- package/build/src/lib/env-github.js.map +1 -1
- package/build/src/lib/env-managed-set.d.ts.map +1 -1
- package/build/src/lib/env-managed-set.js +28 -22
- package/build/src/lib/env-managed-set.js.map +1 -1
- package/build/src/lib/env-status.d.ts.map +1 -1
- package/build/src/lib/env-status.js +25 -22
- package/build/src/lib/env-status.js.map +1 -1
- package/build/src/lib/nova-config.d.ts +2 -0
- package/build/src/lib/nova-config.d.ts.map +1 -1
- package/build/src/lib/nova-config.js +170 -125
- package/build/src/lib/nova-config.js.map +1 -1
- package/build/src/toolkit/nova-identity.d.ts +4 -2
- package/build/src/toolkit/nova-identity.d.ts.map +1 -1
- package/build/src/toolkit/nova-identity.js +25 -6
- package/build/src/toolkit/nova-identity.js.map +1 -1
- package/build/src/types/cli/generate/github/workflows-blueprint-variables.d.ts +6 -6
- package/build/src/types/cli/generate/github/workflows-blueprint.d.ts +29 -17
- package/build/src/types/cli/generate/must-haves/dotenv.d.ts +11 -9
- package/build/src/types/cli/recipe/package-json/sync-identity.d.ts +22 -0
- package/build/src/types/cli/utility/changelog.d.ts +32 -0
- package/build/src/types/cli/utility/initialize.d.ts +43 -47
- package/build/src/types/cli/utility/run-scripts.d.ts +2 -0
- package/build/src/types/lib/env-github.d.ts +34 -1
- package/build/src/types/lib/env-managed-set.d.ts +9 -9
- package/build/src/types/lib/env-status.d.ts +12 -14
- package/build/src/types/lib/nova-config.d.ts +110 -69
- package/build/src/types/shared.d.ts +167 -57
- package/build/src/types/tests/bin-git-tracked.test.d.ts +52 -0
- package/build/src/types/tests/cli/generate/github/workflows-blueprint.test.d.ts +10 -10
- package/build/src/types/tests/cli/generate/must-haves/dotenv.test.d.ts +40 -0
- package/build/src/types/tests/cli/recipe/package-json/sync-identity.test.d.ts +133 -0
- package/build/src/types/tests/cli/utility/initialize.test.d.ts +74 -138
- package/build/src/types/tests/lib/nova-config.test.d.ts +83 -57
- package/build/src/types/tests/toolkit/nova-identity.test.d.ts +102 -0
- package/build/src/types/toolkit/nova-identity.d.ts +47 -5
- package/build/templates/generators/must-haves/agent-conventions/conventions/typescript.md +12 -12
- package/build/templates/scaffold/docs/docusaurus/package.json +2 -2
- package/package.json +2 -1
|
@@ -67,6 +67,7 @@ export class Runner {
|
|
|
67
67
|
const agents = this.parseAgents(value['agents']);
|
|
68
68
|
const recipes = this.parseRecipes(value['recipes']);
|
|
69
69
|
const environment = this.parseEnvironment(value['environment'], workspaces, workflows);
|
|
70
|
+
const settings = this.parseSettings(value['settings']);
|
|
70
71
|
this.validateCredContributors(value['workflows'], environment);
|
|
71
72
|
if (project !== undefined) {
|
|
72
73
|
result.project = project;
|
|
@@ -101,6 +102,9 @@ export class Runner {
|
|
|
101
102
|
if (environment !== undefined) {
|
|
102
103
|
result.environment = environment;
|
|
103
104
|
}
|
|
105
|
+
if (settings !== undefined) {
|
|
106
|
+
result.settings = settings;
|
|
107
|
+
}
|
|
104
108
|
return result;
|
|
105
109
|
}
|
|
106
110
|
pushError(name, purpose, message) {
|
|
@@ -346,7 +350,6 @@ export class Runner {
|
|
|
346
350
|
continue;
|
|
347
351
|
}
|
|
348
352
|
const nameCandidate = this.getNonEmptyString(options['name']);
|
|
349
|
-
const displayNameCandidate = this.getNonEmptyString(options['displayName']);
|
|
350
353
|
const roleCandidate = this.getNonEmptyString(options['role']);
|
|
351
354
|
const policyCandidate = this.getNonEmptyString(options['policy']);
|
|
352
355
|
if (nameCandidate === undefined) {
|
|
@@ -398,7 +401,6 @@ export class Runner {
|
|
|
398
401
|
role: matchedRole,
|
|
399
402
|
policy,
|
|
400
403
|
name: nameCandidate,
|
|
401
|
-
...(displayNameCandidate !== undefined) ? { displayName: displayNameCandidate } : {},
|
|
402
404
|
});
|
|
403
405
|
}
|
|
404
406
|
const workspaceKeys = Object.keys(workspaces);
|
|
@@ -418,59 +420,59 @@ export class Runner {
|
|
|
418
420
|
}
|
|
419
421
|
const result = {};
|
|
420
422
|
const workspacePaths = (workspaces !== undefined) ? Object.keys(workspaces) : [];
|
|
421
|
-
const workflowNames = (workflows !== undefined) ? workflows.map((workflow) => workflow['
|
|
423
|
+
const workflowNames = (workflows !== undefined) ? workflows.map((workflow) => workflow['name']) : [];
|
|
422
424
|
const collectedPrefixes = [];
|
|
423
|
-
const
|
|
424
|
-
if (isPlainObject(
|
|
425
|
-
const
|
|
426
|
-
if (
|
|
427
|
-
this.pushError('Runner.parseEnvironment', 'environment', 'Environment "
|
|
425
|
+
const projectValue = value['project'];
|
|
426
|
+
if (isPlainObject(projectValue) === true) {
|
|
427
|
+
const projectPrefix = this.getNonEmptyString(projectValue['prefix']);
|
|
428
|
+
if (projectPrefix === undefined) {
|
|
429
|
+
this.pushError('Runner.parseEnvironment', 'environment', 'Environment "project" has no prefix. Skipping ...');
|
|
428
430
|
}
|
|
429
|
-
else if (libEnvNamespace.isReservedPrefix(
|
|
430
|
-
this.pushError('Runner.parseEnvironment', 'environment', `Environment "
|
|
431
|
+
else if (libEnvNamespace.isReservedPrefix(projectPrefix) === true) {
|
|
432
|
+
this.pushError('Runner.parseEnvironment', 'environment', `Environment "project" prefix "${projectPrefix}" is reserved and cannot be used. Skipping ...`);
|
|
431
433
|
}
|
|
432
434
|
else {
|
|
433
|
-
collectedPrefixes.push(
|
|
434
|
-
const
|
|
435
|
-
const
|
|
436
|
-
if (
|
|
437
|
-
|
|
435
|
+
collectedPrefixes.push(projectPrefix);
|
|
436
|
+
const projectVariables = this.parseEnvironmentValues(projectValue['variables'], projectPrefix, 'project');
|
|
437
|
+
const projectResult = { prefix: projectPrefix };
|
|
438
|
+
if (projectVariables !== undefined) {
|
|
439
|
+
projectResult.variables = projectVariables;
|
|
438
440
|
}
|
|
439
|
-
result.
|
|
441
|
+
result.project = projectResult;
|
|
440
442
|
}
|
|
441
443
|
}
|
|
442
|
-
const
|
|
443
|
-
if (isPlainObject(
|
|
444
|
-
const
|
|
445
|
-
for (const
|
|
446
|
-
const
|
|
447
|
-
const
|
|
448
|
-
if (isPlainObject(
|
|
444
|
+
const workspacesValue = value['workspaces'];
|
|
445
|
+
if (isPlainObject(workspacesValue) === true) {
|
|
446
|
+
const workspacesResult = {};
|
|
447
|
+
for (const workspaceEntry of Object.entries(workspacesValue)) {
|
|
448
|
+
const workspacePath = workspaceEntry[0];
|
|
449
|
+
const workspaceOptions = workspaceEntry[1];
|
|
450
|
+
if (isPlainObject(workspaceOptions) === false) {
|
|
449
451
|
continue;
|
|
450
452
|
}
|
|
451
|
-
if (workspacePaths.includes(
|
|
452
|
-
this.pushError('Runner.parseEnvironment', 'environment', `Environment
|
|
453
|
+
if (workspacePaths.includes(workspacePath) === false) {
|
|
454
|
+
this.pushError('Runner.parseEnvironment', 'environment', `Environment workspace "${workspacePath}" does not match a configured workspace. Skipping ...`);
|
|
453
455
|
continue;
|
|
454
456
|
}
|
|
455
|
-
const
|
|
456
|
-
if (
|
|
457
|
-
this.pushError('Runner.parseEnvironment', 'environment', `Environment
|
|
457
|
+
const workspacePrefix = this.getNonEmptyString(workspaceOptions['prefix']);
|
|
458
|
+
if (workspacePrefix === undefined) {
|
|
459
|
+
this.pushError('Runner.parseEnvironment', 'environment', `Environment workspace "${workspacePath}" has no prefix. Skipping ...`);
|
|
458
460
|
continue;
|
|
459
461
|
}
|
|
460
|
-
if (libEnvNamespace.isReservedPrefix(
|
|
461
|
-
this.pushError('Runner.parseEnvironment', 'environment', `Environment
|
|
462
|
+
if (libEnvNamespace.isReservedPrefix(workspacePrefix) === true) {
|
|
463
|
+
this.pushError('Runner.parseEnvironment', 'environment', `Environment workspace "${workspacePath}" prefix "${workspacePrefix}" is reserved and cannot be used. Skipping ...`);
|
|
462
464
|
continue;
|
|
463
465
|
}
|
|
464
|
-
collectedPrefixes.push(
|
|
465
|
-
const
|
|
466
|
-
const
|
|
467
|
-
if (
|
|
468
|
-
|
|
466
|
+
collectedPrefixes.push(workspacePrefix);
|
|
467
|
+
const workspaceVariables = this.parseEnvironmentValues(workspaceOptions['variables'], workspacePrefix, `workspace "${workspacePath}"`);
|
|
468
|
+
const workspaceResult = { prefix: workspacePrefix };
|
|
469
|
+
if (workspaceVariables !== undefined) {
|
|
470
|
+
workspaceResult.variables = workspaceVariables;
|
|
469
471
|
}
|
|
470
|
-
Reflect.set(
|
|
472
|
+
Reflect.set(workspacesResult, workspacePath, workspaceResult);
|
|
471
473
|
}
|
|
472
|
-
if (Object.keys(
|
|
473
|
-
result.
|
|
474
|
+
if (Object.keys(workspacesResult).length > 0) {
|
|
475
|
+
result.workspaces = workspacesResult;
|
|
474
476
|
}
|
|
475
477
|
}
|
|
476
478
|
const workflowsValue = value['workflows'];
|
|
@@ -521,7 +523,7 @@ export class Runner {
|
|
|
521
523
|
}
|
|
522
524
|
return result;
|
|
523
525
|
}
|
|
524
|
-
parseEnvironmentValues(rawVariables, prefix, context
|
|
526
|
+
parseEnvironmentValues(rawVariables, prefix, context) {
|
|
525
527
|
if (Array.isArray(rawVariables) === false) {
|
|
526
528
|
return undefined;
|
|
527
529
|
}
|
|
@@ -537,8 +539,20 @@ export class Runner {
|
|
|
537
539
|
this.pushError('Runner.parseEnvironmentValues', 'environment', `Environment ${context} has a value with no valid key. Skipping ...`);
|
|
538
540
|
continue;
|
|
539
541
|
}
|
|
542
|
+
const reachValues = [
|
|
543
|
+
'local',
|
|
544
|
+
'managed',
|
|
545
|
+
'build',
|
|
546
|
+
'runtime',
|
|
547
|
+
];
|
|
548
|
+
const reachCandidate = reachValues.find((reachValue) => reachValue === raw['reach']);
|
|
549
|
+
if (reachCandidate === undefined) {
|
|
550
|
+
this.pushError('Runner.parseEnvironmentValues', 'environment', `Environment ${context} value "${key}" has no valid "reach" (local | managed | build | runtime). Skipping ...`);
|
|
551
|
+
continue;
|
|
552
|
+
}
|
|
553
|
+
const isLocal = reachCandidate === 'local';
|
|
540
554
|
const secretCandidate = (typeof raw['secret'] === 'boolean') ? raw['secret'] : undefined;
|
|
541
|
-
if (secretCandidate === undefined) {
|
|
555
|
+
if (isLocal === false && secretCandidate === undefined) {
|
|
542
556
|
this.pushError('Runner.parseEnvironmentValues', 'environment', `Environment ${context} value "${key}" has no boolean "secret" flag. Skipping ...`);
|
|
543
557
|
continue;
|
|
544
558
|
}
|
|
@@ -548,43 +562,50 @@ export class Runner {
|
|
|
548
562
|
this.pushWarning('Runner.parseEnvironmentValues', 'environment', `Environment ${context} value "${key}" is a browser-exposed key marked secret and would leak if inlined into client output.`);
|
|
549
563
|
}
|
|
550
564
|
let hasError = false;
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
this.pushError('Runner.parseEnvironmentValues', 'environment', `Environment ${context} value "${key}" has no boolean "buildOnly" flag. Skipping ...`);
|
|
565
|
+
if (isLocal === true && secretCandidate !== undefined) {
|
|
566
|
+
this.pushError('Runner.parseEnvironmentValues', 'environment', `Environment ${context} value "${key}" is reach "local" and cannot declare "secret". Skipping ...`);
|
|
554
567
|
hasError = true;
|
|
555
568
|
}
|
|
556
569
|
const defaultValueCandidate = (typeof raw['defaultValue'] === 'string') ? raw['defaultValue'] : undefined;
|
|
557
|
-
if (
|
|
558
|
-
this.pushError('Runner.parseEnvironmentValues', 'environment', `Environment ${context} value "${key}" is
|
|
570
|
+
if (reachCandidate === 'managed' && defaultValueCandidate !== undefined) {
|
|
571
|
+
this.pushError('Runner.parseEnvironmentValues', 'environment', `Environment ${context} value "${key}" is reach "managed" and cannot declare a "defaultValue". Skipping ...`);
|
|
559
572
|
hasError = true;
|
|
560
573
|
}
|
|
561
|
-
if (
|
|
562
|
-
this.pushError('Runner.parseEnvironmentValues', 'environment', `Environment ${context} value "${key}"
|
|
563
|
-
hasError = true;
|
|
564
|
-
}
|
|
565
|
-
const name = libEnvNamespace.githubName(prefix, key);
|
|
566
|
-
if (libEnvNamespace.isGithubLegalName(name) === false) {
|
|
567
|
-
this.pushError('Runner.parseEnvironmentValues', 'environment', `Environment ${context} value "${key}" resolves to GitHub name "${name}" which is not a valid GitHub variable or secret name. Skipping ...`);
|
|
574
|
+
if (secretCandidate === true && defaultValueCandidate !== undefined) {
|
|
575
|
+
this.pushError('Runner.parseEnvironmentValues', 'environment', `Environment ${context} value "${key}" is a secret and cannot declare a "defaultValue". Skipping ...`);
|
|
568
576
|
hasError = true;
|
|
569
577
|
}
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
578
|
+
if (isLocal === false) {
|
|
579
|
+
if (libEnvNamespace.startsWithPrefix(key, prefix) === true) {
|
|
580
|
+
this.pushError('Runner.parseEnvironmentValues', 'environment', `Environment ${context} value "${key}" starts with its own prefix "${prefix}". Skipping ...`);
|
|
581
|
+
hasError = true;
|
|
582
|
+
}
|
|
583
|
+
const name = libEnvNamespace.githubName(prefix, key);
|
|
584
|
+
if (libEnvNamespace.isGithubLegalName(name) === false) {
|
|
585
|
+
this.pushError('Runner.parseEnvironmentValues', 'environment', `Environment ${context} value "${key}" resolves to GitHub name "${name}" which is not a valid GitHub variable or secret name. Skipping ...`);
|
|
586
|
+
hasError = true;
|
|
587
|
+
}
|
|
588
|
+
const foldedName = name.toUpperCase();
|
|
589
|
+
if (seenNames.has(foldedName) === true) {
|
|
590
|
+
this.pushError('Runner.parseEnvironmentValues', 'environment', `Environment ${context} value "${key}" resolves to GitHub name "${name}" which duplicates another value in the same namespace. Skipping ...`);
|
|
591
|
+
hasError = true;
|
|
592
|
+
}
|
|
593
|
+
if (hasError === false) {
|
|
594
|
+
seenNames.add(foldedName);
|
|
595
|
+
}
|
|
574
596
|
}
|
|
575
597
|
if (hasError === true) {
|
|
576
598
|
continue;
|
|
577
599
|
}
|
|
578
|
-
seenNames.add(foldedName);
|
|
579
600
|
const value = {
|
|
580
601
|
key,
|
|
581
|
-
|
|
602
|
+
reach: reachCandidate,
|
|
582
603
|
};
|
|
583
|
-
if (
|
|
584
|
-
value
|
|
604
|
+
if (isLocal === false) {
|
|
605
|
+
Reflect.set(value, 'secret', secretCandidate);
|
|
585
606
|
}
|
|
586
|
-
if (defaultValueCandidate !== undefined) {
|
|
587
|
-
value
|
|
607
|
+
if (reachCandidate !== 'managed' && defaultValueCandidate !== undefined) {
|
|
608
|
+
Reflect.set(value, 'defaultValue', defaultValueCandidate);
|
|
588
609
|
}
|
|
589
610
|
values.push(value);
|
|
590
611
|
}
|
|
@@ -597,12 +618,12 @@ export class Runner {
|
|
|
597
618
|
if (environment === undefined) {
|
|
598
619
|
return;
|
|
599
620
|
}
|
|
600
|
-
const
|
|
601
|
-
const
|
|
602
|
-
const
|
|
621
|
+
const projectGroup = (environment !== undefined) ? environment['project'] : undefined;
|
|
622
|
+
const hasProjectPrefix = projectGroup !== undefined;
|
|
623
|
+
const workspacesGroup = (environment !== undefined) ? environment['workspaces'] : undefined;
|
|
603
624
|
const workflowsGroup = (environment !== undefined) ? environment['workflows'] : undefined;
|
|
604
625
|
const reported = new Set();
|
|
605
|
-
const
|
|
626
|
+
const serverBearingWorkspaces = new Set();
|
|
606
627
|
for (const rawWorkflowItem of rawWorkflows) {
|
|
607
628
|
const rawWorkflow = rawWorkflowItem;
|
|
608
629
|
if (isPlainObject(rawWorkflow) === false) {
|
|
@@ -673,40 +694,40 @@ export class Runner {
|
|
|
673
694
|
continue;
|
|
674
695
|
}
|
|
675
696
|
if (targetMeta['supportsRuntimeSecretSync'] === true) {
|
|
676
|
-
|
|
697
|
+
serverBearingWorkspaces.add(deployTarget['appPath']);
|
|
677
698
|
}
|
|
678
699
|
const targetVariables = targetMeta['variables'];
|
|
679
700
|
for (const variableEntry of Object.entries(targetVariables)) {
|
|
680
701
|
const variableName = variableEntry[0];
|
|
681
702
|
const variableMeta = variableEntry[1];
|
|
682
703
|
const scope = variableMeta['scope'];
|
|
683
|
-
if (scope === 'account' &&
|
|
684
|
-
const message = `Environment deploy target "${deployTarget['targetType']}" needs the account credential "${variableName}", but "
|
|
704
|
+
if (scope === 'account' && hasProjectPrefix === false) {
|
|
705
|
+
const message = `Environment deploy target "${deployTarget['targetType']}" needs the account credential "${variableName}", but "project" has no prefix. Skipping ...`;
|
|
685
706
|
if (reported.has(message) === false) {
|
|
686
707
|
reported.add(message);
|
|
687
708
|
this.pushError('Runner.validateCredContributors', 'environment', message);
|
|
688
709
|
}
|
|
689
710
|
}
|
|
690
711
|
else if (scope === 'app') {
|
|
691
|
-
const
|
|
692
|
-
if (
|
|
693
|
-
const
|
|
694
|
-
if (reported.has(
|
|
695
|
-
reported.add(
|
|
696
|
-
this.pushError('Runner.validateCredContributors', 'environment',
|
|
712
|
+
const workspace = (workspacesGroup !== undefined) ? workspacesGroup[deployTarget['appPath']] : undefined;
|
|
713
|
+
if (workspace === undefined) {
|
|
714
|
+
const workspaceMessage = `Environment deploy target "${deployTarget['targetType']}" needs the app credential "${variableName}" for "${deployTarget['appPath']}", but that workspace has no prefix. Skipping ...`;
|
|
715
|
+
if (reported.has(workspaceMessage) === false) {
|
|
716
|
+
reported.add(workspaceMessage);
|
|
717
|
+
this.pushError('Runner.validateCredContributors', 'environment', workspaceMessage);
|
|
697
718
|
}
|
|
698
719
|
}
|
|
699
720
|
}
|
|
700
721
|
}
|
|
701
722
|
}
|
|
702
723
|
}
|
|
703
|
-
if (
|
|
704
|
-
for (const
|
|
705
|
-
const
|
|
706
|
-
const
|
|
707
|
-
const hasRuntimeValue = (
|
|
708
|
-
if (hasRuntimeValue === true &&
|
|
709
|
-
this.pushError('Runner.validateCredContributors', 'environment', `Environment
|
|
724
|
+
if (workspacesGroup !== undefined) {
|
|
725
|
+
for (const workspaceEntry of Object.entries(workspacesGroup)) {
|
|
726
|
+
const runtimeWorkspacePath = workspaceEntry[0];
|
|
727
|
+
const runtimeWorkspace = workspaceEntry[1];
|
|
728
|
+
const hasRuntimeValue = (runtimeWorkspace['variables'] ?? []).some((variable) => variable['reach'] === 'runtime');
|
|
729
|
+
if (hasRuntimeValue === true && serverBearingWorkspaces.has(runtimeWorkspacePath) === false) {
|
|
730
|
+
this.pushError('Runner.validateCredContributors', 'environment', `Environment workspace "${runtimeWorkspacePath}" declares a reach "runtime" value, but deploys to no server-bearing target. Skipping ...`);
|
|
710
731
|
}
|
|
711
732
|
}
|
|
712
733
|
}
|
|
@@ -726,8 +747,8 @@ export class Runner {
|
|
|
726
747
|
if (template === undefined) {
|
|
727
748
|
continue;
|
|
728
749
|
}
|
|
729
|
-
const
|
|
730
|
-
if (
|
|
750
|
+
const name = this.getNonEmptyString(castItem['name']);
|
|
751
|
+
if (name === undefined) {
|
|
731
752
|
continue;
|
|
732
753
|
}
|
|
733
754
|
const rawTriggers = castItem['triggers'];
|
|
@@ -743,61 +764,56 @@ export class Runner {
|
|
|
743
764
|
}
|
|
744
765
|
const rawDependsOn = castItem['depends-on'];
|
|
745
766
|
const dependsOn = (Array.isArray(rawDependsOn) === true) ? rawDependsOn.filter((entry) => typeof entry === 'string' && entry.trim() !== '') : [];
|
|
746
|
-
const
|
|
747
|
-
const
|
|
748
|
-
const
|
|
749
|
-
const
|
|
750
|
-
if (Array.isArray(
|
|
751
|
-
for (const
|
|
752
|
-
const
|
|
753
|
-
if (isPlainObject(
|
|
767
|
+
const rawBuild = castItem['build'];
|
|
768
|
+
const build = (Array.isArray(rawBuild) === true) ? rawBuild.filter((entry) => typeof entry === 'string' && entry.trim() !== '') : [];
|
|
769
|
+
const rawDeploy = castItem['deploy'];
|
|
770
|
+
const deploy = [];
|
|
771
|
+
if (Array.isArray(rawDeploy) === true) {
|
|
772
|
+
for (const rawDeployEntry of rawDeploy) {
|
|
773
|
+
const rawDeployValue = rawDeployEntry;
|
|
774
|
+
if (isPlainObject(rawDeployValue) === false) {
|
|
754
775
|
continue;
|
|
755
776
|
}
|
|
756
|
-
const
|
|
757
|
-
const
|
|
758
|
-
if (
|
|
777
|
+
const deployTo = this.getNonEmptyString(rawDeployValue['to']);
|
|
778
|
+
const deployPath = this.getNonEmptyString(rawDeployValue['path']);
|
|
779
|
+
if (deployTo === undefined || deployPath === undefined) {
|
|
759
780
|
continue;
|
|
760
781
|
}
|
|
761
|
-
const
|
|
762
|
-
const
|
|
763
|
-
const
|
|
764
|
-
|
|
765
|
-
|
|
782
|
+
const rawDeployAfter = rawDeployValue['after'];
|
|
783
|
+
const deployAfter = (Array.isArray(rawDeployAfter) === true) ? rawDeployAfter.filter((entry) => typeof entry === 'string' && entry.trim() !== '') : [];
|
|
784
|
+
const deployTarget = {
|
|
785
|
+
to: deployTo,
|
|
786
|
+
path: deployPath,
|
|
766
787
|
};
|
|
767
|
-
if (
|
|
768
|
-
Reflect.set(
|
|
788
|
+
if (deployAfter.length > 0) {
|
|
789
|
+
Reflect.set(deployTarget, 'after', deployAfter);
|
|
769
790
|
}
|
|
770
|
-
|
|
791
|
+
const deployWith = rawDeployValue['with'];
|
|
792
|
+
const parsedDeployWith = this.parseWorkflowWith(deployWith);
|
|
793
|
+
if (parsedDeployWith !== undefined) {
|
|
794
|
+
Reflect.set(deployTarget, 'with', parsedDeployWith);
|
|
795
|
+
}
|
|
796
|
+
deploy.push(deployTarget);
|
|
771
797
|
}
|
|
772
798
|
}
|
|
773
|
-
const
|
|
799
|
+
const withMap = castItem['with'];
|
|
774
800
|
const workflow = {
|
|
775
801
|
template,
|
|
776
|
-
|
|
802
|
+
name,
|
|
777
803
|
triggers,
|
|
778
804
|
};
|
|
779
805
|
if (dependsOn.length > 0) {
|
|
780
806
|
Reflect.set(workflow, 'depends-on', dependsOn);
|
|
781
807
|
}
|
|
782
|
-
if (
|
|
783
|
-
Reflect.set(workflow, '
|
|
808
|
+
if (build.length > 0) {
|
|
809
|
+
Reflect.set(workflow, 'build', build);
|
|
784
810
|
}
|
|
785
|
-
if (
|
|
786
|
-
Reflect.set(workflow, '
|
|
811
|
+
if (deploy.length > 0) {
|
|
812
|
+
Reflect.set(workflow, 'deploy', deploy);
|
|
787
813
|
}
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
for (const settingsEntry of sortedSettingsEntries) {
|
|
792
|
-
const settingsKey = settingsEntry[0];
|
|
793
|
-
const settingsValue = settingsEntry[1];
|
|
794
|
-
if (typeof settingsValue === 'string') {
|
|
795
|
-
Reflect.set(parsedSettings, settingsKey, settingsValue);
|
|
796
|
-
}
|
|
797
|
-
}
|
|
798
|
-
if (Object.keys(parsedSettings).length > 0) {
|
|
799
|
-
workflow.settings = parsedSettings;
|
|
800
|
-
}
|
|
814
|
+
const parsedWith = this.parseWorkflowWith(withMap);
|
|
815
|
+
if (parsedWith !== undefined) {
|
|
816
|
+
workflow.with = parsedWith;
|
|
801
817
|
}
|
|
802
818
|
workflows.push(workflow);
|
|
803
819
|
}
|
|
@@ -809,12 +825,30 @@ export class Runner {
|
|
|
809
825
|
if (templateCompare !== 0) {
|
|
810
826
|
return templateCompare;
|
|
811
827
|
}
|
|
812
|
-
const
|
|
813
|
-
const
|
|
814
|
-
return
|
|
828
|
+
const nameA = a['name'] ?? '';
|
|
829
|
+
const nameB = b['name'] ?? '';
|
|
830
|
+
return nameA.localeCompare(nameB);
|
|
815
831
|
});
|
|
816
832
|
return workflows;
|
|
817
833
|
}
|
|
834
|
+
parseWorkflowWith(value) {
|
|
835
|
+
if (isPlainObject(value) === false) {
|
|
836
|
+
return undefined;
|
|
837
|
+
}
|
|
838
|
+
const parsed = {};
|
|
839
|
+
const sortedEntries = Object.entries(value).sort((a, b) => a[0].localeCompare(b[0]));
|
|
840
|
+
for (const entry of sortedEntries) {
|
|
841
|
+
const entryKey = entry[0];
|
|
842
|
+
const entryValue = entry[1];
|
|
843
|
+
if (typeof entryValue === 'string') {
|
|
844
|
+
Reflect.set(parsed, entryKey, entryValue);
|
|
845
|
+
}
|
|
846
|
+
}
|
|
847
|
+
if (Object.keys(parsed).length === 0) {
|
|
848
|
+
return undefined;
|
|
849
|
+
}
|
|
850
|
+
return parsed;
|
|
851
|
+
}
|
|
818
852
|
parseGithub(value) {
|
|
819
853
|
if (isPlainObject(value) === false) {
|
|
820
854
|
return undefined;
|
|
@@ -937,6 +971,17 @@ export class Runner {
|
|
|
937
971
|
}
|
|
938
972
|
return (Object.keys(result).length > 0) ? result : undefined;
|
|
939
973
|
}
|
|
974
|
+
parseSettings(value) {
|
|
975
|
+
if (isPlainObject(value) === false) {
|
|
976
|
+
return undefined;
|
|
977
|
+
}
|
|
978
|
+
const result = {};
|
|
979
|
+
const lockStepVersioning = (value['lockStepVersioning'] === true) ? true : undefined;
|
|
980
|
+
if (lockStepVersioning !== undefined) {
|
|
981
|
+
result.lockStepVersioning = lockStepVersioning;
|
|
982
|
+
}
|
|
983
|
+
return (Object.keys(result).length > 0) ? result : undefined;
|
|
984
|
+
}
|
|
940
985
|
parseAgents(value) {
|
|
941
986
|
if (Array.isArray(value) === false) {
|
|
942
987
|
return undefined;
|