task-script-support-cli 0.2.20 → 0.3.2

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 (102) hide show
  1. package/assets/yargs-template/task-runner/src/commands/verify.ts +3 -2
  2. package/assets/yargs-template/task-runner/src/services/banner-service.ts +13 -9
  3. package/assets/yargs-template/task-runner/src/tasks/banner/print-banner.ts +38 -0
  4. package/assets/yargs-template/task-runner/src/tasks/banner/resolve-banner-font.ts +70 -0
  5. package/assets/yargs-template/task-runner/src/types/state.ts +4 -0
  6. package/{dist/assets/yargs-template/task-runner/src/wrappers → assets/yargs-template/task-runner/src/wrappers/electives}/concurrent-task-group.ts +4 -4
  7. package/assets/yargs-template/task-runner/src/wrappers/electives/resolver-task.ts +87 -0
  8. package/assets/yargs-template/task-runner/src/wrappers/{sequential-task-group.ts → electives/sequential-task-group.ts} +4 -4
  9. package/assets/yargs-template/task-runner/tests/commands/verify.test.ts +14 -21
  10. package/dist/assets/yargs-template/task-runner/src/commands/verify.ts +3 -2
  11. package/dist/assets/yargs-template/task-runner/src/services/banner-service.ts +13 -9
  12. package/dist/assets/yargs-template/task-runner/src/tasks/banner/print-banner.ts +38 -0
  13. package/dist/assets/yargs-template/task-runner/src/tasks/banner/resolve-banner-font.ts +70 -0
  14. package/dist/assets/yargs-template/task-runner/src/types/state.ts +4 -0
  15. package/{assets/yargs-template/task-runner/src/wrappers → dist/assets/yargs-template/task-runner/src/wrappers/electives}/concurrent-task-group.ts +4 -4
  16. package/dist/assets/yargs-template/task-runner/src/wrappers/electives/resolver-task.ts +87 -0
  17. package/dist/assets/yargs-template/task-runner/src/wrappers/{sequential-task-group.ts → electives/sequential-task-group.ts} +4 -4
  18. package/dist/assets/yargs-template/task-runner/tests/commands/verify.test.ts +14 -21
  19. package/dist/package.json +2 -2
  20. package/dist/src/commands/gen.d.ts +2 -1
  21. package/dist/src/commands/gen.d.ts.map +1 -1
  22. package/dist/src/commands/gen.js +2 -0
  23. package/dist/src/commands/gen.js.map +1 -1
  24. package/dist/src/index.js +1 -0
  25. package/dist/src/index.js.map +1 -1
  26. package/dist/src/services/file-service.d.ts.map +1 -1
  27. package/dist/src/services/file-service.js +2 -1
  28. package/dist/src/services/file-service.js.map +1 -1
  29. package/dist/src/services/project-service.d.ts +21 -0
  30. package/dist/src/services/project-service.d.ts.map +1 -1
  31. package/dist/src/services/project-service.js +41 -0
  32. package/dist/src/services/project-service.js.map +1 -1
  33. package/dist/src/services/templater-service.d.ts +1 -0
  34. package/dist/src/services/templater-service.d.ts.map +1 -1
  35. package/dist/src/services/templater-service.js +9 -3
  36. package/dist/src/services/templater-service.js.map +1 -1
  37. package/dist/src/tasks/generate/generate-command.d.ts +6 -14
  38. package/dist/src/tasks/generate/generate-command.d.ts.map +1 -1
  39. package/dist/src/tasks/generate/generate-command.js +15 -52
  40. package/dist/src/tasks/generate/generate-command.js.map +1 -1
  41. package/dist/src/tasks/generate/generate-service.d.ts +6 -6
  42. package/dist/src/tasks/generate/generate-service.d.ts.map +1 -1
  43. package/dist/src/tasks/generate/generate-service.js +17 -16
  44. package/dist/src/tasks/generate/generate-service.js.map +1 -1
  45. package/dist/src/tasks/generate/generate-task.d.ts +6 -6
  46. package/dist/src/tasks/generate/generate-task.d.ts.map +1 -1
  47. package/dist/src/tasks/generate/generate-task.js +17 -16
  48. package/dist/src/tasks/generate/generate-task.js.map +1 -1
  49. package/dist/src/tasks/generate/project-context-guard.d.ts +1 -1
  50. package/dist/src/tasks/generate/project-context-guard.js +1 -1
  51. package/dist/src/tasks/generate/resolve-injectables.d.ts +56 -0
  52. package/dist/src/tasks/generate/resolve-injectables.d.ts.map +1 -0
  53. package/dist/src/tasks/generate/resolve-injectables.js +134 -0
  54. package/dist/src/tasks/generate/resolve-injectables.js.map +1 -0
  55. package/dist/src/tasks/generate/select-gen-target-name.js +4 -4
  56. package/dist/src/tasks/generate/select-gen-target-name.js.map +1 -1
  57. package/dist/src/tasks/generate/select-gen-target.d.ts +1 -1
  58. package/dist/src/tasks/generate/select-gen-target.js +2 -2
  59. package/dist/src/tasks/generate/select-gen-target.js.map +1 -1
  60. package/dist/src/tasks/stdout/print-generated-results.js +2 -2
  61. package/dist/src/tasks/stdout/print-generated-results.js.map +1 -1
  62. package/dist/src/tasks/sync-configuration.d.ts +1 -1
  63. package/dist/src/tasks/sync-configuration.js +6 -6
  64. package/dist/src/tasks/sync-configuration.js.map +1 -1
  65. package/dist/src/templates/command.d.ts.map +1 -1
  66. package/dist/src/templates/command.js +8 -2
  67. package/dist/src/templates/command.js.map +1 -1
  68. package/dist/src/templates/service.d.ts +1 -1
  69. package/dist/src/templates/service.d.ts.map +1 -1
  70. package/dist/src/templates/service.js +29 -1
  71. package/dist/src/templates/service.js.map +1 -1
  72. package/dist/src/templates/task.d.ts +1 -1
  73. package/dist/src/templates/task.d.ts.map +1 -1
  74. package/dist/src/templates/task.js +37 -1
  75. package/dist/src/templates/task.js.map +1 -1
  76. package/dist/src/types/project.d.ts +4 -0
  77. package/dist/src/types/project.d.ts.map +1 -1
  78. package/dist/src/types/state.d.ts +7 -3
  79. package/dist/src/types/state.d.ts.map +1 -1
  80. package/dist/src/types/state.js.map +1 -1
  81. package/package.json +2 -2
  82. package/src/commands/gen.ts +2 -0
  83. package/src/index.ts +1 -0
  84. package/src/services/file-service.ts +2 -1
  85. package/src/services/project-service.ts +54 -0
  86. package/src/services/templater-service.ts +15 -3
  87. package/src/tasks/generate/generate-command.ts +14 -67
  88. package/src/tasks/generate/generate-service.ts +14 -11
  89. package/src/tasks/generate/generate-task.ts +14 -11
  90. package/src/tasks/generate/project-context-guard.ts +1 -1
  91. package/src/tasks/generate/resolve-injectables.ts +154 -0
  92. package/src/tasks/generate/select-gen-target-name.ts +4 -4
  93. package/src/tasks/generate/select-gen-target.ts +2 -2
  94. package/src/tasks/stdout/print-generated-results.ts +2 -2
  95. package/src/tasks/sync-configuration.ts +6 -6
  96. package/src/templates/command.ts +10 -2
  97. package/src/templates/service.ts +34 -2
  98. package/src/templates/task.ts +42 -2
  99. package/src/types/project.ts +5 -0
  100. package/src/types/state.ts +9 -3
  101. package/assets/yargs-template/task-runner/src/tasks/print-banner.ts +0 -73
  102. package/dist/assets/yargs-template/task-runner/src/tasks/print-banner.ts +0 -73
@@ -13,47 +13,48 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
13
13
  };
14
14
  Object.defineProperty(exports, "__esModule", { value: true });
15
15
  const chalk_1 = __importDefault(require("chalk"));
16
- const app_task_1 = require("../../wrappers/app-task");
17
16
  const tsyringe_1 = require("tsyringe");
18
17
  const state_1 = require("../../types/state");
19
18
  const project_service_1 = require("../../services/project-service");
20
- const util_service_1 = require("../../services/util-service");
21
- const file_service_1 = require("../../services/file-service");
22
19
  const format_1 = require("../../types/format");
23
20
  const path_1 = __importDefault(require("path"));
24
21
  const service_1 = require("../../templates/service");
22
+ const app_task_1 = require("../../wrappers/app-task");
23
+ const file_service_1 = require("../../services/file-service");
24
+ const util_service_1 = require("../../services/util-service");
25
25
  /**
26
26
  * Generates a new service class
27
27
  */
28
28
  let GenerateService = class GenerateService extends app_task_1.AppTask {
29
+ fileService;
29
30
  projectService;
30
31
  utilService;
31
- fileService;
32
32
  loggerName = "Generate Service";
33
- constructor(projectService, utilService, fileService) {
33
+ constructor(fileService, projectService, utilService) {
34
34
  super();
35
+ this.fileService = fileService;
35
36
  this.projectService = projectService;
36
37
  this.utilService = utilService;
37
- this.fileService = fileService;
38
38
  }
39
39
  /**
40
40
  * Generates a new service class file.
41
41
  *
42
- * @returns updated state with outputDestination set to generated result path.
42
+ * @returns updated state with outputDestination set to a generated result path.
43
43
  */
44
44
  async run() {
45
- if (this.state.data.genTargetType !== state_1.GenTargetType.Service) {
45
+ if (this.state.data.genData.targetType !== state_1.GenTargetType.Service) {
46
46
  return;
47
47
  }
48
48
  this.logger.info(chalk_1.default.blueBright("Generating Service"));
49
49
  const { utilService, projectService } = this;
50
- const targetName = this.state.data.genTargetName;
50
+ const targetName = this.state.data.genData.targetName;
51
51
  const targetDirectory = this.state.data.project.serviceDestination;
52
52
  // detect case
53
53
  const convention = projectService.getConvention();
54
54
  this.logger.debug(`Using convention: ${chalk_1.default.magentaBright(convention)}`);
55
55
  const className = utilService.titleizedToCase(targetName, format_1.CaseType.PASCAL_CASE);
56
- const rendered = (0, service_1.getServiceTemplate)(className);
56
+ const injectableMappings = this.projectService.getImportMap(this.state.data.genData);
57
+ const rendered = (0, service_1.getServiceTemplate)(className, injectableMappings);
57
58
  const filename = `${utilService.titleizedToCase(targetName, convention)}${project_service_1.ProjectService.defaults.extention}`;
58
59
  const destination = path_1.default.join(targetDirectory, filename);
59
60
  // write contents
@@ -62,13 +63,13 @@ let GenerateService = class GenerateService extends app_task_1.AppTask {
62
63
  }
63
64
  /**
64
65
  * Checks state for required fields. Executes prior to run method.
65
- * Skips validation if genTargetType is not set to service.
66
+ * Skips validation if genData.targetType is not set to service.
66
67
  */
67
68
  async preRun() {
68
- if (this.state.data.genTargetType !== state_1.GenTargetType.Service) {
69
+ if (this.state.data.genData.targetType !== state_1.GenTargetType.Service) {
69
70
  return; // no validation on no-op flow
70
71
  }
71
- if (!this.state.data.genTargetName) {
72
+ if (!this.state.data.genData.targetName) {
72
73
  throw new Error("Unable to determine targetName");
73
74
  }
74
75
  if (!this.state.data.project) {
@@ -81,9 +82,9 @@ let GenerateService = class GenerateService extends app_task_1.AppTask {
81
82
  };
82
83
  GenerateService = __decorate([
83
84
  (0, tsyringe_1.autoInjectable)(),
84
- __metadata("design:paramtypes", [project_service_1.ProjectService,
85
- util_service_1.UtilService,
86
- file_service_1.FileService])
85
+ __metadata("design:paramtypes", [file_service_1.FileService,
86
+ project_service_1.ProjectService,
87
+ util_service_1.UtilService])
87
88
  ], GenerateService);
88
89
  exports.default = GenerateService;
89
90
  //# sourceMappingURL=generate-service.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"generate-service.js","sourceRoot":"./src/","sources":["src/tasks/generate/generate-service.ts"],"names":[],"mappings":";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CAAc;QACjB,0BAAW;GANf,eAAe,CAiEnC;kBAjEoB,eAAe"}
@@ -1,20 +1,20 @@
1
+ import { ProjectService } from "../../services/project-service";
1
2
  import { AppTask } from "../../wrappers/app-task";
2
- import { UtilService } from "../../services/util-service";
3
3
  import { FileService } from "../../services/file-service";
4
- import { ProjectService } from "../../services/project-service";
4
+ import { UtilService } from "../../services/util-service";
5
5
  /**
6
6
  * Generates a new task class
7
7
  */
8
8
  export default class GenerateTask extends AppTask {
9
- private utilService;
10
9
  private fileService;
11
10
  private projectService;
11
+ private utilService;
12
12
  loggerName: string;
13
- constructor(utilService: UtilService, fileService: FileService, projectService: ProjectService);
13
+ constructor(fileService: FileService, projectService: ProjectService, utilService: UtilService);
14
14
  /**
15
15
  * Generates a new task class file.
16
16
  *
17
- * @returns updated state with outputDestination set to generated result path.
17
+ * @returns updated state with outputDestination set to a generated result path.
18
18
  */
19
19
  run(): Promise<{
20
20
  data: {
@@ -23,7 +23,7 @@ export default class GenerateTask extends AppTask {
23
23
  } | undefined>;
24
24
  /**
25
25
  * Checks state for required fields. Executes prior to run method.
26
- * Skips validation if genTargetType is not set to task.
26
+ * Skips validation if genData.targetType is not set to task.
27
27
  */
28
28
  preRun(): Promise<void>;
29
29
  }
@@ -1 +1 @@
1
- {"version":3,"file":"generate-task.d.ts","sourceRoot":"./src/","sources":["src/tasks/generate/generate-task.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,yBAAyB,CAAC;AAKlD,OAAO,EAAE,WAAW,EAAE,MAAM,6BAA6B,CAAC;AAC1D,OAAO,EAAE,WAAW,EAAE,MAAM,6BAA6B,CAAC;AAC1D,OAAO,EAAE,cAAc,EAAE,MAAM,gCAAgC,CAAC;AAGhE;;GAEG;AAEH,MAAM,CAAC,OAAO,OAAO,YAAa,SAAQ,OAAO;IAI7C,OAAO,CAAC,WAAW;IACnB,OAAO,CAAC,WAAW;IACnB,OAAO,CAAC,cAAc;IALxB,UAAU,SAAmB;gBAGnB,WAAW,EAAE,WAAW,EACxB,WAAW,EAAE,WAAW,EACxB,cAAc,EAAE,cAAc;IAKxC;;;;OAIG;IACG,GAAG;;;;;IA6BT;;;OAGG;IACG,MAAM;CAcb"}
1
+ {"version":3,"file":"generate-task.d.ts","sourceRoot":"./src/","sources":["src/tasks/generate/generate-task.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,cAAc,EAAE,MAAM,gCAAgC,CAAC;AAEhE,OAAO,EAAE,OAAO,EAAE,MAAM,yBAAyB,CAAC;AAClD,OAAO,EAAE,WAAW,EAAE,MAAM,6BAA6B,CAAC;AAC1D,OAAO,EAAE,WAAW,EAAE,MAAM,6BAA6B,CAAC;AAE1D;;GAEG;AAEH,MAAM,CAAC,OAAO,OAAO,YAAa,SAAQ,OAAO;IAI7C,OAAO,CAAC,WAAW;IACnB,OAAO,CAAC,cAAc;IACtB,OAAO,CAAC,WAAW;IALrB,UAAU,SAAmB;gBAGnB,WAAW,EAAE,WAAW,EACxB,cAAc,EAAE,cAAc,EAC9B,WAAW,EAAE,WAAW;IAKlC;;;;OAIG;IACG,GAAG;;;;;IAgCT;;;OAGG;IACG,MAAM;CAcb"}
@@ -13,47 +13,48 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
13
13
  };
14
14
  Object.defineProperty(exports, "__esModule", { value: true });
15
15
  const chalk_1 = __importDefault(require("chalk"));
16
- const app_task_1 = require("../../wrappers/app-task");
17
16
  const tsyringe_1 = require("tsyringe");
18
17
  const state_1 = require("../../types/state");
19
18
  const task_1 = require("../../templates/task");
20
19
  const format_1 = require("../../types/format");
21
- const util_service_1 = require("../../services/util-service");
22
- const file_service_1 = require("../../services/file-service");
23
20
  const project_service_1 = require("../../services/project-service");
24
21
  const path_1 = __importDefault(require("path"));
22
+ const app_task_1 = require("../../wrappers/app-task");
23
+ const file_service_1 = require("../../services/file-service");
24
+ const util_service_1 = require("../../services/util-service");
25
25
  /**
26
26
  * Generates a new task class
27
27
  */
28
28
  let GenerateTask = class GenerateTask extends app_task_1.AppTask {
29
- utilService;
30
29
  fileService;
31
30
  projectService;
31
+ utilService;
32
32
  loggerName = "Generate Task";
33
- constructor(utilService, fileService, projectService) {
33
+ constructor(fileService, projectService, utilService) {
34
34
  super();
35
- this.utilService = utilService;
36
35
  this.fileService = fileService;
37
36
  this.projectService = projectService;
37
+ this.utilService = utilService;
38
38
  }
39
39
  /**
40
40
  * Generates a new task class file.
41
41
  *
42
- * @returns updated state with outputDestination set to generated result path.
42
+ * @returns updated state with outputDestination set to a generated result path.
43
43
  */
44
44
  async run() {
45
- if (this.state.data.genTargetType !== state_1.GenTargetType.Task) {
45
+ if (this.state.data.genData.targetType !== state_1.GenTargetType.Task) {
46
46
  return;
47
47
  }
48
48
  const { utilService } = this;
49
49
  this.logger.info(chalk_1.default.blueBright("Generating Task"));
50
- const targetName = this.state.data.genTargetName;
50
+ const targetName = this.state.data.genData.targetName;
51
51
  const targetDirectory = this.state.data.project.taskDestination;
52
52
  // detect case
53
53
  const convention = this.projectService.getConvention();
54
54
  this.logger.debug(`Using convention: ${chalk_1.default.magentaBright(convention)}`);
55
55
  const className = utilService.titleizedToCase(targetName, format_1.CaseType.PASCAL_CASE);
56
- const rendered = (0, task_1.getTaskTemplate)(className);
56
+ const injectablesMap = this.projectService.getImportMap(this.state.data.genData);
57
+ const rendered = (0, task_1.getTaskTemplate)(className, injectablesMap);
57
58
  const filename = `${utilService.titleizedToCase(targetName, convention)}${project_service_1.ProjectService.defaults.extention}`;
58
59
  const destination = path_1.default.join(targetDirectory, filename);
59
60
  // write contents
@@ -62,13 +63,13 @@ let GenerateTask = class GenerateTask extends app_task_1.AppTask {
62
63
  }
63
64
  /**
64
65
  * Checks state for required fields. Executes prior to run method.
65
- * Skips validation if genTargetType is not set to task.
66
+ * Skips validation if genData.targetType is not set to task.
66
67
  */
67
68
  async preRun() {
68
- if (this.state.data.genTargetType !== state_1.GenTargetType.Task) {
69
+ if (this.state.data.genData.targetType !== state_1.GenTargetType.Task) {
69
70
  return; // no validation on no-op flow
70
71
  }
71
- if (!this.state.data.genTargetName) {
72
+ if (!this.state.data.genData.targetName) {
72
73
  throw new Error("Unable to determine targetName");
73
74
  }
74
75
  if (!this.state.data.project) {
@@ -81,9 +82,9 @@ let GenerateTask = class GenerateTask extends app_task_1.AppTask {
81
82
  };
82
83
  GenerateTask = __decorate([
83
84
  (0, tsyringe_1.autoInjectable)(),
84
- __metadata("design:paramtypes", [util_service_1.UtilService,
85
- file_service_1.FileService,
86
- project_service_1.ProjectService])
85
+ __metadata("design:paramtypes", [file_service_1.FileService,
86
+ project_service_1.ProjectService,
87
+ util_service_1.UtilService])
87
88
  ], GenerateTask);
88
89
  exports.default = GenerateTask;
89
90
  //# sourceMappingURL=generate-task.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"generate-task.js","sourceRoot":"./src/","sources":["src/tasks/generate/generate-task.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,kDAA0B;AAC1B,sDAAkD;AAClD,uCAA0C;AAC1C,6CAAkD;AAClD,+CAAuD;AACvD,+CAA8C;AAC9C,8DAA0D;AAC1D,8DAA0D;AAC1D,oEAAgE;AAChE,gDAAwB;AAExB;;GAEG;AAEY,IAAM,YAAY,GAAlB,MAAM,YAAa,SAAQ,kBAAO;IAIrC;IACA;IACA;IALV,UAAU,GAAG,eAAe,CAAC;IAE7B,YACU,WAAwB,EACxB,WAAwB,EACxB,cAA8B;QAEtC,KAAK,EAAE,CAAC;QAJA,gBAAW,GAAX,WAAW,CAAa;QACxB,gBAAW,GAAX,WAAW,CAAa;QACxB,mBAAc,GAAd,cAAc,CAAgB;IAGxC,CAAC;IAED;;;;OAIG;IACH,KAAK,CAAC,GAAG;QACP,IAAI,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,aAAa,KAAK,qBAAa,CAAC,IAAI,EAAE,CAAC;YACzD,OAAO;QACT,CAAC;QAED,MAAM,EAAE,WAAW,EAAE,GAAG,IAAI,CAAC;QAE7B,IAAI,CA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D,OAAO,CAAC,8BAA8B;QACxC,CAAC;QACD,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,OAAQ,CAAC,UAAU,EAAE,CAAC;YACzC,MAAM,IAAI,KAAK,CAAC,gCAAgC,CAAC,CAAC;QACpD,CAAC;QACD,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC;YAC7B,MAAM,IAAI,KAAK,CAAC,6BAA6B,CAAC,CAAC;QACjD,CAAC;QACD,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,eAAe,EAAE,CAAC;YAC7C,MAAM,IAAI,KAAK,CAAC,qCAAqC,CAAC,CAAC;QACzD,CAAC;IACH,CAAC;CACF,CAAA;AAlEoB,YAAY;IADhC,IAAA,yBAAc,GAAE;qCAKQ,0BAAW;QACR,gCAAc;QACjB,0BAAW;GANf,YAAY,CAkEhC;kBAlEoB,YAAY"}
@@ -1,7 +1,7 @@
1
1
  import { FileService } from "../../services/file-service";
2
2
  import { AppTask } from "../../wrappers/app-task";
3
3
  /**
4
- * Checks so see if we are in the context of a task-script-support
4
+ * Checks to see if we are in the context of a task-script-support
5
5
  * project or not and fails the process with a friendly error message.
6
6
  */
7
7
  export default class ProjectContextGuard extends AppTask {
@@ -17,7 +17,7 @@ const file_service_1 = require("../../services/file-service");
17
17
  const app_task_1 = require("../../wrappers/app-task");
18
18
  const tsyringe_1 = require("tsyringe");
19
19
  /**
20
- * Checks so see if we are in the context of a task-script-support
20
+ * Checks to see if we are in the context of a task-script-support
21
21
  * project or not and fails the process with a friendly error message.
22
22
  */
23
23
  let ProjectContextGuard = class ProjectContextGuard extends app_task_1.AppTask {
@@ -0,0 +1,56 @@
1
+ import { AppTask } from "../../wrappers/app-task";
2
+ import { FileService } from "../../services/file-service";
3
+ import { ProjectService } from "../../services/project-service";
4
+ import { PromptService } from "../../services/prompt-service";
5
+ import { UtilService } from "../../services/util-service";
6
+ import { ProjectImport } from "../../types/project";
7
+ import { AppState } from "../../types/state";
8
+ /**
9
+ * ResolveInjectables
10
+ */
11
+ export default class ResolveInjectables extends AppTask {
12
+ private fileService;
13
+ private projectService;
14
+ private promptService;
15
+ private utilService;
16
+ loggerName: string;
17
+ constructor(fileService: FileService, projectService: ProjectService, promptService: PromptService, utilService: UtilService);
18
+ /**
19
+ * Prompts to select tasks or services to import into the file being generated.
20
+ *
21
+ * @param state the current state of the application. Expects genData to be
22
+ * populated with targetType. Expects the project to be populated with
23
+ * serviceDestination, taskDestination, and commandDestination.
24
+ * @returns updated state with genData imports field set.
25
+ */
26
+ run(state: AppState): Promise<Partial<AppState>>;
27
+ /**
28
+ * Prompt to select tasks to use in the command being generated.
29
+ *
30
+ * @returns the selected task imports
31
+ */
32
+ getTaskImports(): Promise<ProjectImport[]>;
33
+ /**
34
+ * Prompt to select services to use in the command being generated.
35
+ *
36
+ * @param sourcePath the path to the parent directory of the source file being
37
+ * generated to resolve relative paths for imports
38
+ * @returns the selected service imports
39
+ */
40
+ getServiceImports(sourcePath: string): Promise<ProjectImport[]>;
41
+ /**
42
+ * Prompt to select imports to use in the class being generated.
43
+ *
44
+ * @param messagePrompt the prompt message to display
45
+ * @param filePaths the file paths to select from
46
+ * @returns the selected file paths
47
+ */
48
+ private promptForImports;
49
+ /**
50
+ * Determines if the task should skip the prompt for injectables.
51
+ *
52
+ * @returns true if the task should be skipped.
53
+ */
54
+ private shouldSkip;
55
+ }
56
+ //# sourceMappingURL=resolve-injectables.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"resolve-injectables.d.ts","sourceRoot":"./src/","sources":["src/tasks/generate/resolve-injectables.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,yBAAyB,CAAC;AAElD,OAAO,EAAE,WAAW,EAAE,MAAM,6BAA6B,CAAC;AAC1D,OAAO,EAAE,cAAc,EAAE,MAAM,gCAAgC,CAAC;AAChE,OAAO,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAC;AAC9D,OAAO,EAAE,WAAW,EAAE,MAAM,6BAA6B,CAAC;AAC1D,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAEpD,OAAO,EAAE,QAAQ,EAAiB,MAAM,mBAAmB,CAAC;AAE5D;;GAEG;AAEH,MAAM,CAAC,OAAO,OAAO,kBAAmB,SAAQ,OAAO;IAInD,OAAO,CAAC,WAAW;IACnB,OAAO,CAAC,cAAc;IACtB,OAAO,CAAC,aAAa;IACrB,OAAO,CAAC,WAAW;IANrB,UAAU,SAAwB;gBAGxB,WAAW,EAAE,WAAW,EACxB,cAAc,EAAE,cAAc,EAC9B,aAAa,EAAE,aAAa,EAC5B,WAAW,EAAE,WAAW;IAKlC;;;;;;;OAOG;IACG,GAAG,CAAC,KAAK,EAAE,QAAQ,GAAG,OAAO,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;IA2BtD;;;;OAIG;IACG,cAAc,IAAI,OAAO,CAAC,aAAa,EAAE,CAAC;IAsBhD;;;;;;OAMG;IACG,iBAAiB,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,aAAa,EAAE,CAAC;IAsBrE;;;;;;OAMG;YACW,gBAAgB;IAkB9B;;;;OAIG;IACH,OAAO,CAAC,UAAU;CAMnB"}
@@ -0,0 +1,134 @@
1
+ "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
8
+ var __metadata = (this && this.__metadata) || function (k, v) {
9
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ const app_task_1 = require("../../wrappers/app-task");
13
+ const tsyringe_1 = require("tsyringe");
14
+ const file_service_1 = require("../../services/file-service");
15
+ const project_service_1 = require("../../services/project-service");
16
+ const prompt_service_1 = require("../../services/prompt-service");
17
+ const util_service_1 = require("../../services/util-service");
18
+ const format_1 = require("../../types/format");
19
+ const state_1 = require("../../types/state");
20
+ /**
21
+ * ResolveInjectables
22
+ */
23
+ let ResolveInjectables = class ResolveInjectables extends app_task_1.AppTask {
24
+ fileService;
25
+ projectService;
26
+ promptService;
27
+ utilService;
28
+ loggerName = "ResolveInjectables";
29
+ constructor(fileService, projectService, promptService, utilService) {
30
+ super();
31
+ this.fileService = fileService;
32
+ this.projectService = projectService;
33
+ this.promptService = promptService;
34
+ this.utilService = utilService;
35
+ }
36
+ /**
37
+ * Prompts to select tasks or services to import into the file being generated.
38
+ *
39
+ * @param state the current state of the application. Expects genData to be
40
+ * populated with targetType. Expects the project to be populated with
41
+ * serviceDestination, taskDestination, and commandDestination.
42
+ * @returns updated state with genData imports field set.
43
+ */
44
+ async run(state) {
45
+ if (this.shouldSkip())
46
+ return { data: { genData: { imports: [] } } };
47
+ const { genData, project } = state.data;
48
+ // determine the directory we would need to import into
49
+ const sourceDirectory = genData.targetType === state_1.GenTargetType.Service
50
+ ? project.serviceDestination
51
+ : project.taskDestination;
52
+ let injectableImports;
53
+ switch (genData.targetType) {
54
+ case state_1.GenTargetType.Command:
55
+ injectableImports = await this.getTaskImports();
56
+ break;
57
+ case state_1.GenTargetType.Service:
58
+ case state_1.GenTargetType.Task:
59
+ injectableImports = await this.getServiceImports(sourceDirectory);
60
+ break;
61
+ default:
62
+ injectableImports = [];
63
+ }
64
+ return { data: { genData: { imports: injectableImports } } };
65
+ }
66
+ /**
67
+ * Prompt to select tasks to use in the command being generated.
68
+ *
69
+ * @returns the selected task imports
70
+ */
71
+ async getTaskImports() {
72
+ if (!this.state.data.project?.taskDestination) {
73
+ throw new Error("Unable to resolve task destination");
74
+ }
75
+ const taskFiles = this.fileService.getFilesInDir(this.state.data.project.taskDestination);
76
+ this.logger.debug(`Found ${taskFiles.length} task files`);
77
+ const pickedTasks = await this.promptForImports("Include Tasks", taskFiles);
78
+ this.logger.debug(`Selected ${pickedTasks.length} tasks`);
79
+ // add them to the map
80
+ return !pickedTasks.length
81
+ ? []
82
+ : this.projectService.formalizeImports(pickedTasks, this.state.data.project.commandDestination);
83
+ }
84
+ /**
85
+ * Prompt to select services to use in the command being generated.
86
+ *
87
+ * @param sourcePath the path to the parent directory of the source file being
88
+ * generated to resolve relative paths for imports
89
+ * @returns the selected service imports
90
+ */
91
+ async getServiceImports(sourcePath) {
92
+ if (!this.state.data.project?.serviceDestination) {
93
+ throw new Error("Unable to resolve service destination");
94
+ }
95
+ const serviceFiles = this.fileService.getFilesInDir(this.state.data.project.serviceDestination);
96
+ this.logger.debug(`Found ${serviceFiles.length} service files`);
97
+ const pickedServices = await this.promptForImports("Include Services", serviceFiles);
98
+ this.logger.debug(`Selected ${pickedServices.length} services`);
99
+ return !pickedServices.length
100
+ ? []
101
+ : this.projectService.formalizeImports(pickedServices, sourcePath);
102
+ }
103
+ /**
104
+ * Prompt to select imports to use in the class being generated.
105
+ *
106
+ * @param messagePrompt the prompt message to display
107
+ * @param filePaths the file paths to select from
108
+ * @returns the selected file paths
109
+ */
110
+ async promptForImports(messagePrompt, filePaths) {
111
+ return await this.promptService.pickMultiple(messagePrompt, filePaths.map((filePath) => ({
112
+ name: this.utilService.titleizedToCase(this.utilService.titleizeAll(this.fileService.getFilenameNoExt(filePath)), format_1.CaseType.PASCAL_CASE),
113
+ value: filePath,
114
+ })));
115
+ }
116
+ /**
117
+ * Determines if the task should skip the prompt for injectables.
118
+ *
119
+ * @returns true if the task should be skipped.
120
+ */
121
+ shouldSkip() {
122
+ return (!this.argService.hasFlag("inject") &&
123
+ this.state.data.genData?.targetType !== state_1.GenTargetType.Command);
124
+ }
125
+ };
126
+ ResolveInjectables = __decorate([
127
+ (0, tsyringe_1.autoInjectable)(),
128
+ __metadata("design:paramtypes", [file_service_1.FileService,
129
+ project_service_1.ProjectService,
130
+ prompt_service_1.PromptService,
131
+ util_service_1.UtilService])
132
+ ], ResolveInjectables);
133
+ exports.default = ResolveInjectables;
134
+ //# sourceMappingURL=resolve-injectables.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"resolve-injectables.js","sourceRoot":"./src/","sources":["src/tasks/generate/resolve-injectables.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA,sDAAkD;AAClD,uCAA0C;AAC1C,8DAA0D;AAC1D,oEAAgE;AAChE,kEAA8D;AAC9D,8DAA0D;AAE1D,+CAA8C;AAC9C,6CAA4D;AAE5D;;GAEG;AAEY,IAAM,kBAAkB,GAAxB,MAAM,kBAAmB,SAAQ,kBAAO;IAI3C;IACA;IACA;IACA;IANV,UAAU,GAAG,oBAAoB,CAAC;IAElC,YACU,WAAwB,EACxB,cAA8B,EAC9B,aAA4B,EAC5B,WAAwB;QAEhC,KAAK,EAAE,CAAC;QALA,gBAAW,GAAX,WAAW,CAAa;QACxB,mBAAc,GAAd,cAAc,CAAgB;QAC9B,kBAAa,GAAb,aAAa,CAAe;QAC5B,gBAAW,GAAX,WAAW,CAAa;IAGlC,CAAC;IAED;;;;;;;OAOG;IACH,KAAK,CAAC,GAAG,CAAC,KAAe;QACvB,IAAI,IAAI,CAAC,UAAU,EAAE;YAAE,OAAO,EAAE,IAAI,EAAE,EAAE,OAAO,EAAE,EAAE,OAAO,EAAE,EAAE,EAAE,EAAE,EAAE,CAAC;QAErE,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,GAAG,KAAK,CAAC,IAAI,CAAC;QAExC,uDAAuD;QACvD,MAAM,eAAe,GACnB,OAAQ,CAAC,UAAU,KAAK,qBAAa,CAAC,OAAO;YAC3C,CAAC,CAAC,OAAQ,CAAC,kBAAmB;YAC9B,CAAC,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EAAE,QAAQ;SAChB,CAAC,CAAC,CACJ,CAAC;IACJ,CAAC;IAED;;;;OAIG;IACK,UAAU;QAChB,OAAO,CACL,CAAC,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC,QAAQ,CAAC;YAClC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,OAAO,EAAE,UAAU,KAAK,qBAAa,CAAC,OAAO,CAC9D,CAAC;IACJ,CAAC;CACF,CAAA;AA3IoB,kBAAkB;IADtC,IAAA,yBAAc,GAAE;qCAKQ,0BAAW;QACR,gCAAc;QACf,8BAAa;QACf,0BAAW;GAPf,kBAAkB,CA2ItC;kBA3IoB,kBAAkB"}
@@ -35,18 +35,18 @@ let SelectGenTargetName = class SelectGenTargetName extends app_task_1.AppTask {
35
35
  let targetName = this.argService.getTargetName();
36
36
  if (!targetName) {
37
37
  targetName =
38
- (await this.promptService.getInput(`Enter Name for ${chalk_1.default.blueBright(this.utilService.titleize(this.state.data.genTargetType))}`)) || project_service_1.ProjectService.defaults.targetName;
38
+ (await this.promptService.getInput(`Enter Name for ${chalk_1.default.blueBright(this.utilService.titleize(this.state.data.genData.targetType))}`)) || project_service_1.ProjectService.defaults.targetName;
39
39
  }
40
40
  if (!targetName) {
41
41
  throw new Error("Unable to resolve targetName");
42
42
  }
43
43
  this.logger.debug(`Name selected: ${chalk_1.default.magentaBright(targetName)}`);
44
44
  targetName = this.utilService.titleizeAll(targetName);
45
- this.setData({ genTargetName: targetName });
45
+ this.setData({ genData: { targetName: targetName } });
46
46
  }
47
47
  async preRun() {
48
- if (!this.state.data.genTargetType) {
49
- throw new Error("Unable to determine genTargetType");
48
+ if (!this.state.data.genData?.targetType) {
49
+ throw new Error("Unable to determine genData.targetType");
50
50
  }
51
51
  }
52
52
  };
@@ -1 +1 @@
1
- {"version":3,"file":"select-gen-target-name.js","sourceRoot":"./src/","sources":["src/tasks/generate/select-gen-target-name.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,kDAA0B;AAC1B,sDA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,CAAC,CAAC;QAClD,CAAC;QACD,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,kBAAkB,eAAK,CAAC,aAAa,CAAC,UAAU,CAAC,EAAE,CAAC,CAAC;QACvE,UAAU,GAAG,IAAI,CAAC,WAAW,CAAC,WAAW,CAAC,UAAU,CAAC,CAAC;QACtD,IAAI,CAAC,OAAO,CAAC,EAAE,OAAO,EAAE,EAAE,UAAU,EAAE,UAAU,EAAE,EAAE,CAAC,CAAC;IACxD,CAAC;IAED,KAAK,CAAC,MAAM;QACV,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,OAAO,EAAE,UAAU,EAAE,CAAC;YACzC,MAAM,IAAI,KAAK,CAAC,wCAAwC,CAAC,CAAC;QAC5D,CAAC;IACH,CAAC;CACF,CAAA;AAhCoB,mBAAmB;IADvC,IAAA,yBAAc,GAAE;qCAIU,8BAAa;QACf,0BAAW;GAJf,mBAAmB,CAgCvC;kBAhCoB,mBAAmB"}
@@ -2,7 +2,7 @@ import { AppTask } from "../../wrappers/app-task";
2
2
  import { GenTargetType } from "../../types/state";
3
3
  import { PromptService } from "../../services/prompt-service";
4
4
  /**
5
- * Sets the genTargetType based on input
5
+ * Sets the genData.targetType based on input
6
6
  */
7
7
  export default class SelectGenTargetType extends AppTask {
8
8
  private promptService;
@@ -19,7 +19,7 @@ const state_1 = require("../../types/state");
19
19
  const prompt_service_1 = require("../../services/prompt-service");
20
20
  const process_1 = require("../../types/process");
21
21
  /**
22
- * Sets the genTargetType based on input
22
+ * Sets the genData.targetType based on input
23
23
  */
24
24
  let SelectGenTargetType = class SelectGenTargetType extends app_task_1.AppTask {
25
25
  promptService;
@@ -44,7 +44,7 @@ let SelectGenTargetType = class SelectGenTargetType extends app_task_1.AppTask {
44
44
  target = await this.getGenTargetInput();
45
45
  }
46
46
  this.logger.debug(`Target selected: ${chalk_1.default.magentaBright(target)}`);
47
- this.setData({ genTargetType: target });
47
+ this.setData({ genData: { targetType: target } });
48
48
  }
49
49
  async getGenTargetInput() {
50
50
  const targetType = await this.promptService.select(`Select a type of ${chalk_1.default.blueBright("Resource")} to create`, [state_1.GenTargetType.Command, state_1.GenTargetType.Service, state_1.GenTargetType.Task]);
@@ -1 +1 @@
1
- {"version":3,"file":"select-gen-target.js","sourceRoot":"./src/","sources":["src/tasks/generate/select-gen-target.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,kDAA0B;AAC1B,sDAAkD;AAClD,uCAA0C;AAC1C,6CAAkD;AAClD,kEAA8D;AAC9D,iDAAiD;AAEjD;;GAEG;AAEY,IAAM,mBAAmB,GAAzB,MAAM,mBAAoB,SAAQ,kBAAO;IAGlC;IAFpB,UAAU,GAAG,oBAAoB,CAAC;IAElC,YAAoB,aAA4B;QAC9C,KAAK,EAAE,CAAC;QADU,kBAAa,GAAb,aAAa,CAAe;IAEhD,CAAC;IAED,KAAK,CAAC,GAAG;QACP,IAAI,MAAM,GAAkB,qBAAa,CAAC,OAAO,CAAC;QAClD,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,eAAK,CAAC,UAAU,CAAC,iBAAiB,CAAC,CAAC,CAAC;QAEtD,IAAI,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC,oBAAU,CAAC,OAAO,CAAC,EAAE,CAAC;YAChD,MAAM,GAAG,qBAAa,CAAC,OAAO,CAAC;QACjC,CAAC;aAAM,IAAI,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC,oBAAU,CAAC,IAAI,CAAC,EAAE,CAAC;YACpD,MAAM,GAAG,qBAAa,CAAC,IAAI,CAAC;QAC9B,CAAC;aAAM,IAAI,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC,oBAAU,CAAC,OAAO,CAAC,EAAE,CAAC;YACvD,MAAM,GAAG,qBAAa,CAAC,OAAO,CAAC;QACjC,CAAC;aAAM,CAAC;YACN,MAAM,GAAG,MAAM,IAAI,CAAC,iBAAiB,EAAE,CAAC;QAC1C,CAAC;QAED,IAAI,CAAC,MAA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AAC,OAAO,CAAC;QACjC,CAAC;aAAM,IAAI,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC,oBAAU,CAAC,IAAI,CAAC,EAAE,CAAC;YACpD,MAAM,GAAG,qBAAa,CAAC,IAAI,CAAC;QAC9B,CAAC;aAAM,IAAI,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC,oBAAU,CAAC,OAAO,CAAC,EAAE,CAAC;YACvD,MAAM,GAAG,qBAAa,CAAC,OAAO,CAAC;QACjC,CAAC;aAAM,CAAC;YACN,MAAM,GAAG,MAAM,IAAI,CAAC,iBAAiB,EAAE,CAAC;QAC1C,CAAC;QAED,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,oBAAoB,eAAK,CAAC,aAAa,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;QACrE,IAAI,CAAC,OAAO,CAAC,EAAE,OAAO,EAAE,EAAE,UAAU,EAAE,MAAM,EAAE,EAAE,CAAC,CAAC;IACpD,CAAC;IAED,KAAK,CAAC,iBAAiB;QACrB,MAAM,UAAU,GAAkB,MAAM,IAAI,CAAC,aAAa,CAAC,MAAM,CAC/D,oBAAoB,eAAK,CAAC,UAAU,CAAC,UAAU,CAAC,YAAY,EAC5D,CAAC,qBAAa,CAAC,OAAO,EAAE,qBAAa,CAAC,OAAO,EAAE,qBAAa,CAAC,IAAI,CAAC,CACnE,CAAC;QAEF,OAAO,UAAU,CAAC;IACpB,CAAC;CACF,CAAA;AAjCoB,mBAAmB;IADvC,IAAA,yBAAc,GAAE;qCAIoB,8BAAa;GAH7B,mBAAmB,CAiCvC;kBAjCoB,mBAAmB"}
@@ -34,8 +34,8 @@ let PrintGeneratedResults = class PrintGeneratedResults extends app_task_1.AppTa
34
34
  this.fileService = fileService;
35
35
  }
36
36
  async run() {
37
- const genType = this.state.data.genTargetType
38
- ? this.utilService.titleize(this.state.data.genTargetType)
37
+ const genType = this.state.data.genData?.targetType
38
+ ? this.utilService.titleize(this.state.data.genData.targetType)
39
39
  : "Project";
40
40
  this.logger.info(`Generated Results for ${chalk_1.default.blueBright(genType)}`);
41
41
  // wait for logs to flush before mixing in console.log
@@ -1 +1 @@
1
- {"version":3,"file":"print-generated-results.js","sourceRoot":"./src/","sources":["src/tasks/stdout/print-generated-results.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,kDAA0B;AAC1B,sDAAkD;AAClD,uCAA0C;AAC1C,8DAA0D;AAC1D,8DAA0D;AAE1D,MAAM,iBAAiB,GAAG,CAAC,IAAY,EAAE,EAAE,CAAC;;cAE9B,IAAI;CACjB,CAAC;AAEF;;GAEG;AAEY,IAAM,qBAAqB,GAA3B,MAAM,qBAAsB,SAAQ,kBAAO;IAI9C;IACA;IAJV,UAAU,GAAG,eAAe,CAAC;IAE7B,YACU,WAAwB,EACxB,WAAwB;QAEhC,KAAK,EAAE,CAAC;QAHA,gBAAW,GAAX,WAAW,CAAa;QACxB,gBAAW,GAAX,WAAW,CAAa;IAGlC,CAAC;IAED,KAAK,CAAC,GAAG;QACP,MAAM,OAAO,GAAW,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,aAAa;YACnD,CAAC,CAAC,IAAI,CAAC,WAAW,CAAC,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,aAAa,CAAC;YAC1D,CAAC,CAAC,SAAS,CAAC;QAEd,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,yBAAyB,eAAK,CAAC,UAAU,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC;QAEvE,sDAAsD;QACtD,MAAM,IAAI,CAAC,WAAW,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;QAElC,OAAO,CAAC,GAAG,CAAC;;sBAEM,OAAO,KAAK,SAAS,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,SAAS;;UAEtD,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,iBAAiB,IAAI,QAAQ;UAE7C,OAAO,KAAK,SAAS;YACnB,CAAC,CAAC,KAAK,iBAAiB,CACpB,IAAI,CAAC,WAAW,CAAC,cAAc,CAC7B,IAAI,CAAC,WAAW,CAAC,YAAY,EAAE,EAC/B,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,iBAAkB,CACnC,CACF,IAAI;YACP,CAAC,CAAC,EACN;OACD,CAAC,CAAC;IACP,CAAC;CACF,CAAA;AArCoB,qBAAqB;IADzC,IAAA,yBAAc,GAAE;qCAKQ,0BAAW;QACX,0BAAW;GALf,qBAAqB,CAqCzC;kBArCoB,qBAAqB"}
1
+ {"version":3,"file":"print-generated-results.js","sourceRoot":"./src/","sources":["src/tasks/stdout/print-generated-results.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,kDAA0B;AAC1B,sDAAkD;AAClD,uCAA0C;AAC1C,8DAA0D;AAC1D,8DAA0D;AAE1D,MAAM,iBAAiB,GAAG,CAAC,IAAY,EAAE,EAAE,CAAC;;cAE9B,IAAI;CACjB,CAAC;AAEF;;GAEG;AAEY,IAAM,qBAAqB,GAA3B,MAAM,qBAAsB,SAAQ,kBAAO;IAI9C;IACA;IAJV,UAAU,GAAG,eAAe,CAAC;IAE7B,YACU,WAAwB,EACxB,WAAwB;QAEhC,KAAK,EAAE,CAAC;QAHA,gBAAW,GAAX,WAAW,CAAa;QACxB,gBAAW,GAAX,WAAW,CAAa;IAGlC,CAAC;IAED,KAAK,CAAC,GAAG;QACP,MAAM,OAAO,GAAW,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,OAAO,EAAE,UAAU;YACzD,CAAC,CAAC,IAAI,CAAC,WAAW,CAAC,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC;YAC/D,CAAC,CAAC,SAAS,CAAC;QAEd,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,yBAAyB,eAAK,CAAC,UAAU,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC;QAEvE,sDAAsD;QACtD,MAAM,IAAI,CAAC,WAAW,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;QAElC,OAAO,CAAC,GAAG,CAAC;;sBAEM,OAAO,KAAK,SAAS,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,SAAS;;UAEtD,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,iBAAiB,IAAI,QAAQ;UAE7C,OAAO,KAAK,SAAS;YACnB,CAAC,CAAC,KAAK,iBAAiB,CACpB,IAAI,CAAC,WAAW,CAAC,cAAc,CAC7B,IAAI,CAAC,WAAW,CAAC,YAAY,EAAE,EAC/B,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,iBAAkB,CACnC,CACF,IAAI;YACP,CAAC,CAAC,EACN;OACD,CAAC,CAAC;IACP,CAAC;CACF,CAAA;AArCoB,qBAAqB;IADzC,IAAA,yBAAc,GAAE;qCAKQ,0BAAW;QACX,0BAAW;GALf,qBAAqB,CAqCzC;kBArCoB,qBAAqB"}
@@ -22,7 +22,7 @@ export default class SyncConfiguration extends AppTask {
22
22
  logDestination: (dest?: string) => void;
23
23
  /**
24
24
  * Gets the destination path for generating resources by resource type.
25
- * If only one resource destination folder was found it is returned
25
+ * If only one resource destination folder was found, it is returned,
26
26
  * otherwise the user is prompted to select one from the found folders.
27
27
  *
28
28
  * @param keyType the type of destination to resolve
@@ -47,14 +47,14 @@ let SyncConfiguration = class SyncConfiguration extends app_task_1.AppTask {
47
47
  project = { ...this.state.data.project, ...cachedProject };
48
48
  }
49
49
  // get target destination if not cached yet
50
- if (this.state.data.genTargetType) {
51
- const targetType = this.state.data.genTargetType;
50
+ if (this.state.data.genData?.targetType) {
51
+ const targetType = this.state.data.genData.targetType;
52
52
  const destinationKey = `${targetType}Destination`;
53
53
  project[destinationKey] =
54
54
  project[destinationKey] || (await this.getDestination(targetType));
55
55
  this.logDestination(project[destinationKey]);
56
56
  }
57
- // attempt to determine others config without prompting
57
+ // attempt to determine other config dirs without prompting
58
58
  const isPassive = true;
59
59
  project.commandDestination =
60
60
  project.commandDestination ||
@@ -78,7 +78,7 @@ let SyncConfiguration = class SyncConfiguration extends app_task_1.AppTask {
78
78
  logDestination = (dest = "") => this.logger.debug(`Destination: ${chalk_1.default.magentaBright(dest)}`);
79
79
  /**
80
80
  * Gets the destination path for generating resources by resource type.
81
- * If only one resource destination folder was found it is returned
81
+ * If only one resource destination folder was found, it is returned,
82
82
  * otherwise the user is prompted to select one from the found folders.
83
83
  *
84
84
  * @param keyType the type of destination to resolve
@@ -107,8 +107,8 @@ let SyncConfiguration = class SyncConfiguration extends app_task_1.AppTask {
107
107
  if (!this.state.data.project || !this.state.data.project.rootDir) {
108
108
  throw new Error(`Missing project rootDir! SyncConfiguration requires the CheckEnvironment task to be ran first.`);
109
109
  }
110
- if (!this.state.data.genTargetType) {
111
- throw new Error(`Missing genTargetType! SyncConfiguration requires the SelectGenTarget task to be ran first.`);
110
+ if (!this.state.data.genData?.targetType) {
111
+ throw new Error(`Missing genData.targetType! SyncConfiguration requires the SelectGenTarget task to be ran first.`);
112
112
  }
113
113
  }
114
114
  };