@salesforce/plugin-templates 56.2.14 → 56.3.1

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 (31) hide show
  1. package/README.md +12 -12
  2. package/lib/commands/analytics/generate/template.js +2 -2
  3. package/lib/commands/analytics/generate/template.js.map +1 -1
  4. package/lib/commands/apex/generate/class.js +2 -2
  5. package/lib/commands/apex/generate/class.js.map +1 -1
  6. package/lib/commands/apex/generate/trigger.js +10 -9
  7. package/lib/commands/apex/generate/trigger.js.map +1 -1
  8. package/lib/commands/lightning/generate/app.js +2 -2
  9. package/lib/commands/lightning/generate/app.js.map +1 -1
  10. package/lib/commands/lightning/generate/component.js +2 -2
  11. package/lib/commands/lightning/generate/component.js.map +1 -1
  12. package/lib/commands/lightning/generate/event.js +2 -2
  13. package/lib/commands/lightning/generate/event.js.map +1 -1
  14. package/lib/commands/lightning/generate/interface.js +2 -2
  15. package/lib/commands/lightning/generate/interface.js.map +1 -1
  16. package/lib/commands/lightning/generate/test.js +2 -2
  17. package/lib/commands/lightning/generate/test.js.map +1 -1
  18. package/lib/commands/project/generate.d.ts +1 -1
  19. package/lib/commands/project/generate.js +2 -2
  20. package/lib/commands/project/generate.js.map +1 -1
  21. package/lib/commands/static-resource/generate.js +2 -2
  22. package/lib/commands/static-resource/generate.js.map +1 -1
  23. package/lib/commands/visualforce/generate/component.js +2 -2
  24. package/lib/commands/visualforce/generate/component.js.map +1 -1
  25. package/lib/commands/visualforce/generate/page.js +2 -3
  26. package/lib/commands/visualforce/generate/page.js.map +1 -1
  27. package/lib/utils/templateCommand.d.ts +6 -54
  28. package/lib/utils/templateCommand.js +6 -30
  29. package/lib/utils/templateCommand.js.map +1 -1
  30. package/oclif.manifest.json +374 -374
  31. package/package.json +9 -14
@@ -4,27 +4,13 @@
4
4
  * Licensed under the BSD 3-Clause license.
5
5
  * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
6
6
  */
7
- import path from 'node:path';
8
- import { Messages, OrgConfigProperties } from '@salesforce/core';
7
+ import { OrgConfigProperties } from '@salesforce/core';
9
8
  import { TemplateService } from '@salesforce/templates';
10
- import yeoman from 'yeoman-environment';
11
- import { ForceGeneratorAdapter } from '@salesforce/templates/lib/utils/index.js';
12
- Messages.importMessagesDirectoryFromMetaUrl(import.meta.url);
13
- const messages = Messages.loadMessages('@salesforce/plugin-templates', 'messages');
14
- export async function runGenerator({ ux, templates, generator, opts }) {
15
- if (templates) {
16
- await TemplateService.getInstance().setCustomTemplatesRootPathOrGitRepo(templates);
17
- }
18
- const adapter = new ForceGeneratorAdapter();
19
- // @ts-expect-error the adapter doesn't fully implement the yeoman adapter interface
20
- const env = yeoman.createEnv(undefined, undefined, adapter);
21
- // @ts-ignore - access the default via the .default because of how we have to import everything above
22
- env.registerStub(generator.default, 'generator');
23
- await env.run('generator', opts);
24
- const targetDir = path.resolve(opts.outputdir ?? '.');
25
- ux.log(messages.getMessage('TargetDirOutput', [targetDir]));
26
- ux.log(adapter.log.getOutput());
27
- return buildJson(adapter, targetDir);
9
+ export async function runGenerator({ ux, templates, templateType, opts }) {
10
+ const templateService = TemplateService.getInstance();
11
+ const result = await templateService.create(templateType, opts, templates);
12
+ ux.log(result.rawOutput);
13
+ return result;
28
14
  }
29
15
  export const getCustomTemplates = (configAggregator) => {
30
16
  try {
@@ -35,14 +21,4 @@ export const getCustomTemplates = (configAggregator) => {
35
21
  return undefined;
36
22
  }
37
23
  };
38
- // exported for test
39
- export const buildJson = (adapter, targetDir) => {
40
- const cleanOutput = adapter.log.getCleanOutput();
41
- const rawOutput = `target dir = ${targetDir}\n${adapter.log.getOutput()}`;
42
- return {
43
- outputDir: targetDir,
44
- created: cleanOutput,
45
- rawOutput,
46
- };
47
- };
48
24
  //# sourceMappingURL=templateCommand.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"templateCommand.js","sourceRoot":"","sources":["../../src/utils/templateCommand.ts"],"names":[],"mappings":"AAAA;;;;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