@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.
Files changed (71) hide show
  1. package/build/package.json +2 -1
  2. package/build/src/cli/generate/github/workflows-blueprint-variables.d.ts.map +1 -1
  3. package/build/src/cli/generate/github/workflows-blueprint-variables.js +7 -7
  4. package/build/src/cli/generate/github/workflows-blueprint-variables.js.map +1 -1
  5. package/build/src/cli/generate/github/workflows-blueprint.d.ts.map +1 -1
  6. package/build/src/cli/generate/github/workflows-blueprint.js +71 -37
  7. package/build/src/cli/generate/github/workflows-blueprint.js.map +1 -1
  8. package/build/src/cli/generate/must-haves/dotenv.d.ts.map +1 -1
  9. package/build/src/cli/generate/must-haves/dotenv.js +9 -8
  10. package/build/src/cli/generate/must-haves/dotenv.js.map +1 -1
  11. package/build/src/cli/recipe/package-json/normalize-dependencies.js +1 -1
  12. package/build/src/cli/recipe/package-json/normalize-dependencies.js.map +1 -1
  13. package/build/src/cli/recipe/package-json/sync-identity.d.ts.map +1 -1
  14. package/build/src/cli/recipe/package-json/sync-identity.js +45 -0
  15. package/build/src/cli/recipe/package-json/sync-identity.js.map +1 -1
  16. package/build/src/cli/utility/changelog.d.ts.map +1 -1
  17. package/build/src/cli/utility/changelog.js +93 -19
  18. package/build/src/cli/utility/changelog.js.map +1 -1
  19. package/build/src/cli/utility/initialize.d.ts.map +1 -1
  20. package/build/src/cli/utility/initialize.js +123 -79
  21. package/build/src/cli/utility/initialize.js.map +1 -1
  22. package/build/src/cli/utility/run-scripts.d.ts.map +1 -1
  23. package/build/src/cli/utility/run-scripts.js +12 -4
  24. package/build/src/cli/utility/run-scripts.js.map +1 -1
  25. package/build/src/cli/utility/transpile.d.ts.map +1 -1
  26. package/build/src/cli/utility/transpile.js +1 -0
  27. package/build/src/cli/utility/transpile.js.map +1 -1
  28. package/build/src/cli/utility/type-check.d.ts.map +1 -1
  29. package/build/src/cli/utility/type-check.js +1 -0
  30. package/build/src/cli/utility/type-check.js.map +1 -1
  31. package/build/src/lib/env-github.d.ts +2 -1
  32. package/build/src/lib/env-github.d.ts.map +1 -1
  33. package/build/src/lib/env-github.js +20 -0
  34. package/build/src/lib/env-github.js.map +1 -1
  35. package/build/src/lib/env-managed-set.d.ts.map +1 -1
  36. package/build/src/lib/env-managed-set.js +28 -22
  37. package/build/src/lib/env-managed-set.js.map +1 -1
  38. package/build/src/lib/env-status.d.ts.map +1 -1
  39. package/build/src/lib/env-status.js +25 -22
  40. package/build/src/lib/env-status.js.map +1 -1
  41. package/build/src/lib/nova-config.d.ts +2 -0
  42. package/build/src/lib/nova-config.d.ts.map +1 -1
  43. package/build/src/lib/nova-config.js +170 -125
  44. package/build/src/lib/nova-config.js.map +1 -1
  45. package/build/src/toolkit/nova-identity.d.ts +4 -2
  46. package/build/src/toolkit/nova-identity.d.ts.map +1 -1
  47. package/build/src/toolkit/nova-identity.js +25 -6
  48. package/build/src/toolkit/nova-identity.js.map +1 -1
  49. package/build/src/types/cli/generate/github/workflows-blueprint-variables.d.ts +6 -6
  50. package/build/src/types/cli/generate/github/workflows-blueprint.d.ts +29 -17
  51. package/build/src/types/cli/generate/must-haves/dotenv.d.ts +11 -9
  52. package/build/src/types/cli/recipe/package-json/sync-identity.d.ts +22 -0
  53. package/build/src/types/cli/utility/changelog.d.ts +32 -0
  54. package/build/src/types/cli/utility/initialize.d.ts +43 -47
  55. package/build/src/types/cli/utility/run-scripts.d.ts +2 -0
  56. package/build/src/types/lib/env-github.d.ts +34 -1
  57. package/build/src/types/lib/env-managed-set.d.ts +9 -9
  58. package/build/src/types/lib/env-status.d.ts +12 -14
  59. package/build/src/types/lib/nova-config.d.ts +110 -69
  60. package/build/src/types/shared.d.ts +167 -57
  61. package/build/src/types/tests/bin-git-tracked.test.d.ts +52 -0
  62. package/build/src/types/tests/cli/generate/github/workflows-blueprint.test.d.ts +10 -10
  63. package/build/src/types/tests/cli/generate/must-haves/dotenv.test.d.ts +40 -0
  64. package/build/src/types/tests/cli/recipe/package-json/sync-identity.test.d.ts +133 -0
  65. package/build/src/types/tests/cli/utility/initialize.test.d.ts +74 -138
  66. package/build/src/types/tests/lib/nova-config.test.d.ts +83 -57
  67. package/build/src/types/tests/toolkit/nova-identity.test.d.ts +102 -0
  68. package/build/src/types/toolkit/nova-identity.d.ts +47 -5
  69. package/build/templates/generators/must-haves/agent-conventions/conventions/typescript.md +12 -12
  70. package/build/templates/scaffold/docs/docusaurus/package.json +2 -2
  71. 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['suffix']) : [];
423
+ const workflowNames = (workflows !== undefined) ? workflows.map((workflow) => workflow['name']) : [];
422
424
  const collectedPrefixes = [];
423
- const globalValue = value['global'];
424
- if (isPlainObject(globalValue) === true) {
425
- const globalPrefix = this.getNonEmptyString(globalValue['prefix']);
426
- if (globalPrefix === undefined) {
427
- this.pushError('Runner.parseEnvironment', 'environment', 'Environment "global" has no prefix. Skipping ...');
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(globalPrefix) === true) {
430
- this.pushError('Runner.parseEnvironment', 'environment', `Environment "global" prefix "${globalPrefix}" is reserved and cannot be used. Skipping ...`);
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(globalPrefix);
434
- const globalVariables = this.parseEnvironmentValues(globalValue['variables'], globalPrefix, 'global', false);
435
- const globalResult = { prefix: globalPrefix };
436
- if (globalVariables !== undefined) {
437
- globalResult.variables = globalVariables;
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.global = globalResult;
441
+ result.project = projectResult;
440
442
  }
441
443
  }
442
- const appsValue = value['apps'];
443
- if (isPlainObject(appsValue) === true) {
444
- const apps = {};
445
- for (const appEntry of Object.entries(appsValue)) {
446
- const appPath = appEntry[0];
447
- const appOptions = appEntry[1];
448
- if (isPlainObject(appOptions) === false) {
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(appPath) === false) {
452
- this.pushError('Runner.parseEnvironment', 'environment', `Environment app "${appPath}" does not match a configured workspace. Skipping ...`);
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 appPrefix = this.getNonEmptyString(appOptions['prefix']);
456
- if (appPrefix === undefined) {
457
- this.pushError('Runner.parseEnvironment', 'environment', `Environment app "${appPath}" has no prefix. Skipping ...`);
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(appPrefix) === true) {
461
- this.pushError('Runner.parseEnvironment', 'environment', `Environment app "${appPath}" prefix "${appPrefix}" is reserved and cannot be used. Skipping ...`);
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(appPrefix);
465
- const appVariables = this.parseEnvironmentValues(appOptions['variables'], appPrefix, `app "${appPath}"`, true);
466
- const appResult = { prefix: appPrefix };
467
- if (appVariables !== undefined) {
468
- appResult.variables = appVariables;
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(apps, appPath, appResult);
472
+ Reflect.set(workspacesResult, workspacePath, workspaceResult);
471
473
  }
472
- if (Object.keys(apps).length > 0) {
473
- result.apps = apps;
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, requireBuildOnly) {
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
- const buildOnlyCandidate = (typeof raw['buildOnly'] === 'boolean') ? raw['buildOnly'] : undefined;
552
- if (requireBuildOnly === true && buildOnlyCandidate === undefined) {
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 (secretCandidate === true && defaultValueCandidate !== undefined) {
558
- this.pushError('Runner.parseEnvironmentValues', 'environment', `Environment ${context} value "${key}" is a secret and cannot declare a "defaultValue". Skipping ...`);
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 (libEnvNamespace.startsWithPrefix(key, prefix) === true) {
562
- this.pushError('Runner.parseEnvironmentValues', 'environment', `Environment ${context} value "${key}" starts with its own prefix "${prefix}". Skipping ...`);
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
- const foldedName = name.toUpperCase();
571
- if (seenNames.has(foldedName) === true) {
572
- this.pushError('Runner.parseEnvironmentValues', 'environment', `Environment ${context} value "${key}" resolves to GitHub name "${name}" which duplicates another value in the same namespace. Skipping ...`);
573
- hasError = true;
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
- secret: secretCandidate,
602
+ reach: reachCandidate,
582
603
  };
583
- if (buildOnlyCandidate !== undefined) {
584
- value.buildOnly = buildOnlyCandidate;
604
+ if (isLocal === false) {
605
+ Reflect.set(value, 'secret', secretCandidate);
585
606
  }
586
- if (defaultValueCandidate !== undefined) {
587
- value.defaultValue = defaultValueCandidate;
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 globalGroup = (environment !== undefined) ? environment['global'] : undefined;
601
- const hasGlobalPrefix = globalGroup !== undefined;
602
- const appsGroup = (environment !== undefined) ? environment['apps'] : undefined;
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 serverBearingApps = new Set();
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
- serverBearingApps.add(deployTarget['appPath']);
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' && hasGlobalPrefix === false) {
684
- const message = `Environment deploy target "${deployTarget['targetType']}" needs the account credential "${variableName}", but "global" has no prefix. Skipping ...`;
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 app = (appsGroup !== undefined) ? appsGroup[deployTarget['appPath']] : undefined;
692
- if (app === undefined) {
693
- const appMessage = `Environment deploy target "${deployTarget['targetType']}" needs the app credential "${variableName}" for "${deployTarget['appPath']}", but that app has no prefix. Skipping ...`;
694
- if (reported.has(appMessage) === false) {
695
- reported.add(appMessage);
696
- this.pushError('Runner.validateCredContributors', 'environment', appMessage);
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 (appsGroup !== undefined) {
704
- for (const appEntry of Object.entries(appsGroup)) {
705
- const runtimeAppPath = appEntry[0];
706
- const runtimeApp = appEntry[1];
707
- const hasRuntimeValue = (runtimeApp['variables'] ?? []).some((variable) => variable['buildOnly'] === false);
708
- if (hasRuntimeValue === true && serverBearingApps.has(runtimeAppPath) === false) {
709
- this.pushError('Runner.validateCredContributors', 'environment', `Environment app "${runtimeAppPath}" declares a runtime value (buildOnly false), but deploys to no server-bearing target. Skipping ...`);
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 suffix = this.getNonEmptyString(castItem['name']);
730
- if (suffix === undefined) {
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 rawScopes = castItem['scopes'];
747
- const scopes = (Array.isArray(rawScopes) === true) ? rawScopes.filter((entry) => typeof entry === 'string' && entry.trim() !== '') : [];
748
- const rawTargets = castItem['targets'];
749
- const targets = [];
750
- if (Array.isArray(rawTargets) === true) {
751
- for (const rawTarget of rawTargets) {
752
- const rawTargetValue = rawTarget;
753
- if (isPlainObject(rawTargetValue) === false) {
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 targetType = this.getNonEmptyString(rawTargetValue['type']);
757
- const targetWorkingDir = this.getNonEmptyString(rawTargetValue['workingDir']);
758
- if (targetType === undefined || targetWorkingDir === undefined) {
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 rawTargetNeeds = rawTargetValue['needs'];
762
- const targetNeeds = (Array.isArray(rawTargetNeeds) === true) ? rawTargetNeeds.filter((entry) => typeof entry === 'string' && entry.trim() !== '') : [];
763
- const target = {
764
- type: targetType,
765
- workingDir: targetWorkingDir,
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 (targetNeeds.length > 0) {
768
- Reflect.set(target, 'needs', targetNeeds);
788
+ if (deployAfter.length > 0) {
789
+ Reflect.set(deployTarget, 'after', deployAfter);
769
790
  }
770
- targets.push(target);
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 settings = castItem['settings'];
799
+ const withMap = castItem['with'];
774
800
  const workflow = {
775
801
  template,
776
- suffix,
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 (scopes.length > 0) {
783
- Reflect.set(workflow, 'scopes', scopes);
808
+ if (build.length > 0) {
809
+ Reflect.set(workflow, 'build', build);
784
810
  }
785
- if (targets.length > 0) {
786
- Reflect.set(workflow, 'targets', targets);
811
+ if (deploy.length > 0) {
812
+ Reflect.set(workflow, 'deploy', deploy);
787
813
  }
788
- if (isPlainObject(settings) === true) {
789
- const parsedSettings = {};
790
- const sortedSettingsEntries = Object.entries(settings).sort((a, b) => a[0].localeCompare(b[0]));
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 suffixA = a['suffix'] ?? '';
813
- const suffixB = b['suffix'] ?? '';
814
- return suffixA.localeCompare(suffixB);
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;