@salesforce/plugin-templates 55.5.19 → 56.0.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.
- package/bin/dev.cmd +1 -1
- package/bin/dev.js +8 -0
- package/bin/run.js +9 -0
- package/lib/commands/analytics/generate/template.d.ts +4 -4
- package/lib/commands/analytics/generate/template.js +31 -32
- package/lib/commands/analytics/generate/template.js.map +1 -1
- package/lib/commands/apex/generate/class.d.ts +5 -5
- package/lib/commands/apex/generate/class.js +41 -42
- package/lib/commands/apex/generate/class.js.map +1 -1
- package/lib/commands/apex/generate/trigger.d.ts +7 -7
- package/lib/commands/apex/generate/trigger.js +62 -63
- package/lib/commands/apex/generate/trigger.js.map +1 -1
- package/lib/commands/lightning/generate/app.d.ts +6 -6
- package/lib/commands/lightning/generate/app.js +42 -43
- package/lib/commands/lightning/generate/app.js.map +1 -1
- package/lib/commands/lightning/generate/component.d.ts +7 -7
- package/lib/commands/lightning/generate/component.js +48 -49
- package/lib/commands/lightning/generate/component.js.map +1 -1
- package/lib/commands/lightning/generate/event.d.ts +6 -6
- package/lib/commands/lightning/generate/event.js +42 -43
- package/lib/commands/lightning/generate/event.js.map +1 -1
- package/lib/commands/lightning/generate/interface.d.ts +6 -6
- package/lib/commands/lightning/generate/interface.js +42 -43
- package/lib/commands/lightning/generate/interface.js.map +1 -1
- package/lib/commands/lightning/generate/test.d.ts +6 -6
- package/lib/commands/lightning/generate/test.js +42 -43
- package/lib/commands/lightning/generate/test.js.map +1 -1
- package/lib/commands/project/generate.d.ts +9 -9
- package/lib/commands/project/generate.js +68 -69
- package/lib/commands/project/generate.js.map +1 -1
- package/lib/commands/static-resource/generate.d.ts +5 -5
- package/lib/commands/static-resource/generate.js +39 -40
- package/lib/commands/static-resource/generate.js.map +1 -1
- package/lib/commands/visualforce/generate/component.d.ts +6 -6
- package/lib/commands/visualforce/generate/component.js +46 -47
- package/lib/commands/visualforce/generate/component.js.map +1 -1
- package/lib/commands/visualforce/generate/page.d.ts +6 -6
- package/lib/commands/visualforce/generate/page.js +48 -49
- package/lib/commands/visualforce/generate/page.js.map +1 -1
- package/lib/index.js +1 -3
- package/lib/index.js.map +1 -1
- package/lib/utils/flags.d.ts +3 -3
- package/lib/utils/flags.js +10 -11
- package/lib/utils/flags.js.map +1 -1
- package/lib/utils/templateCommand.d.ts +25 -25
- package/lib/utils/templateCommand.js +18 -24
- package/lib/utils/templateCommand.js.map +1 -1
- package/oclif.lock +8312 -0
- package/oclif.manifest.json +1108 -581
- package/package.json +31 -31
- package/bin/dev +0 -21
- package/bin/run +0 -5
- package/lib/tsconfig.tsbuildinfo +0 -1
|
@@ -1,23 +1,55 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
1
|
/*
|
|
4
2
|
* Copyright (c) 2019, salesforce.com, inc.
|
|
5
3
|
* All rights reserved.
|
|
6
4
|
* Licensed under the BSD 3-Clause license.
|
|
7
5
|
* For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
|
|
8
6
|
*/
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
7
|
+
import { dirname } from 'node:path';
|
|
8
|
+
import { fileURLToPath } from 'node:url';
|
|
9
|
+
import { Flags, loglevel, orgApiVersionFlagWithDeprecations, SfCommand, Ux } from '@salesforce/sf-plugins-core';
|
|
10
|
+
import VisualforcePageGenerator from '@salesforce/templates/lib/generators/visualforcePageGenerator.js';
|
|
11
|
+
import { CreateUtil } from '@salesforce/templates';
|
|
12
|
+
import { Messages } from '@salesforce/core';
|
|
13
|
+
import { getCustomTemplates, runGenerator } from '../../../utils/templateCommand.js';
|
|
14
|
+
import { outputDirFlag } from '../../../utils/flags.js';
|
|
15
15
|
const visualforcePageFileSuffix = /.page$/;
|
|
16
16
|
const VF_TYPE = 'Page';
|
|
17
|
-
|
|
18
|
-
const commonMessages =
|
|
19
|
-
const messages =
|
|
20
|
-
class VisualforcePage extends
|
|
17
|
+
Messages.importMessagesDirectory(dirname(fileURLToPath(import.meta.url)));
|
|
18
|
+
const commonMessages = Messages.loadMessages('@salesforce/plugin-templates', 'messages');
|
|
19
|
+
const messages = Messages.loadMessages('@salesforce/plugin-templates', 'vf');
|
|
20
|
+
export default class VisualforcePage extends SfCommand {
|
|
21
|
+
static summary = messages.getMessage('summary', [VF_TYPE]);
|
|
22
|
+
static description = messages.getMessage('description', [VF_TYPE]);
|
|
23
|
+
static examples = messages.getMessages('examples.page');
|
|
24
|
+
static aliases = ['force:visualforce:page:create'];
|
|
25
|
+
static deprecateAliases = true;
|
|
26
|
+
static flags = {
|
|
27
|
+
name: Flags.string({
|
|
28
|
+
char: 'n',
|
|
29
|
+
summary: messages.getMessage('flags.name.summary', [VF_TYPE]),
|
|
30
|
+
description: messages.getMessage('flags.name.description'),
|
|
31
|
+
required: true,
|
|
32
|
+
aliases: ['pagename'],
|
|
33
|
+
deprecateAliases: true,
|
|
34
|
+
}),
|
|
35
|
+
// there is only one valid template in the interface for VisualforcePageOptions
|
|
36
|
+
template: Flags.string({
|
|
37
|
+
char: 't',
|
|
38
|
+
summary: commonMessages.getMessage('flags.template.summary'),
|
|
39
|
+
description: commonMessages.getMessage('flags.template.description'),
|
|
40
|
+
default: 'DefaultVFPage',
|
|
41
|
+
hidden: true,
|
|
42
|
+
options: CreateUtil.getCommandTemplatesForFiletype(visualforcePageFileSuffix, 'visualforcepage'),
|
|
43
|
+
}),
|
|
44
|
+
'output-dir': outputDirFlag,
|
|
45
|
+
'api-version': orgApiVersionFlagWithDeprecations,
|
|
46
|
+
label: Flags.string({
|
|
47
|
+
char: 'l',
|
|
48
|
+
summary: messages.getMessage('flags.label.summary', [VF_TYPE]),
|
|
49
|
+
required: true,
|
|
50
|
+
}),
|
|
51
|
+
loglevel,
|
|
52
|
+
};
|
|
21
53
|
async run() {
|
|
22
54
|
const { flags } = await this.parse(VisualforcePage);
|
|
23
55
|
// translate the new flags to the old ones the generator expects
|
|
@@ -28,45 +60,12 @@ class VisualforcePage extends sf_plugins_core_1.SfCommand {
|
|
|
28
60
|
outputdir: flags['output-dir'],
|
|
29
61
|
apiversion: flags['api-version'],
|
|
30
62
|
};
|
|
31
|
-
return
|
|
32
|
-
generator:
|
|
63
|
+
return runGenerator({
|
|
64
|
+
generator: VisualforcePageGenerator,
|
|
33
65
|
opts: flagsAsOptions,
|
|
34
|
-
ux: new
|
|
35
|
-
templates:
|
|
66
|
+
ux: new Ux({ jsonEnabled: this.jsonEnabled() }),
|
|
67
|
+
templates: getCustomTemplates(this.configAggregator),
|
|
36
68
|
});
|
|
37
69
|
}
|
|
38
70
|
}
|
|
39
|
-
VisualforcePage.summary = messages.getMessage('summary', [VF_TYPE]);
|
|
40
|
-
VisualforcePage.description = messages.getMessage('description', [VF_TYPE]);
|
|
41
|
-
VisualforcePage.examples = messages.getMessages('examples.page');
|
|
42
|
-
VisualforcePage.aliases = ['force:visualforce:page:create'];
|
|
43
|
-
VisualforcePage.deprecateAliases = true;
|
|
44
|
-
VisualforcePage.flags = {
|
|
45
|
-
name: sf_plugins_core_1.Flags.string({
|
|
46
|
-
char: 'n',
|
|
47
|
-
summary: messages.getMessage('flags.name.summary', [VF_TYPE]),
|
|
48
|
-
description: messages.getMessage('flags.name.description'),
|
|
49
|
-
required: true,
|
|
50
|
-
aliases: ['pagename'],
|
|
51
|
-
deprecateAliases: true,
|
|
52
|
-
}),
|
|
53
|
-
// there is only one valid template in the interface for VisualforcePageOptions
|
|
54
|
-
template: sf_plugins_core_1.Flags.string({
|
|
55
|
-
char: 't',
|
|
56
|
-
summary: commonMessages.getMessage('flags.template.summary'),
|
|
57
|
-
description: commonMessages.getMessage('flags.template.description'),
|
|
58
|
-
default: 'DefaultVFPage',
|
|
59
|
-
hidden: true,
|
|
60
|
-
options: templates_1.CreateUtil.getCommandTemplatesForFiletype(visualforcePageFileSuffix, 'visualforcepage'),
|
|
61
|
-
}),
|
|
62
|
-
'output-dir': flags_1.outputDirFlag,
|
|
63
|
-
'api-version': sf_plugins_core_1.orgApiVersionFlagWithDeprecations,
|
|
64
|
-
label: sf_plugins_core_1.Flags.string({
|
|
65
|
-
char: 'l',
|
|
66
|
-
summary: messages.getMessage('flags.label.summary', [VF_TYPE]),
|
|
67
|
-
required: true,
|
|
68
|
-
}),
|
|
69
|
-
loglevel: sf_plugins_core_1.loglevel,
|
|
70
|
-
};
|
|
71
|
-
exports.default = VisualforcePage;
|
|
72
71
|
//# sourceMappingURL=page.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"page.js","sourceRoot":"","sources":["../../../../src/commands/visualforce/generate/page.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"page.js","sourceRoot":"","sources":["../../../../src/commands/visualforce/generate/page.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,iCAAiC,EAAE,SAAS,EAAE,EAAE,EAAE,MAAM,6BAA6B,CAAC;AAChH,OAAO,wBAAwB,MAAM,kEAAkE,CAAC;AACxG,OAAO,EAAgB,UAAU,EAA0B,MAAM,uBAAuB,CAAC;AACzF,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAE,kBAAkB,EAAE,YAAY,EAAE,MAAM,mCAAmC,CAAC;AACrF,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AACxD,MAAM,yBAAyB,GAAG,QAAQ,CAAC;AAC3C,MAAM,OAAO,GAAG,MAAM,CAAC;AAEvB,QAAQ,CAAC,uBAAuB,CAAC,OAAO,CAAC,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;AAC1E,MAAM,cAAc,GAAG,Q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QACF,YAAY,EAAE,aAAa;QAE3B,aAAa,EAAE,iCAAiC;QAChD,KAAK,EAAE,KAAK,CAAC,MAAM,CAAC;YAClB,IAAI,EAAE,GAAG;YACT,OAAO,EAAE,QAAQ,CAAC,UAAU,CAAC,qBAAqB,EAAE,CAAC,OAAO,CAAC,CAAC;YAC9D,QAAQ,EAAE,IAAI;SACf,CAAC;QACF,QAAQ;KACT,CAAC;IAEK,KAAK,CAAC,GAAG;QACd,MAAM,EAAE,KAAK,EAAE,GAAG,MAAM,IAAI,CAAC,KAAK,CAAC,eAAe,CAAC,CAAC;QAEpD,gEAAgE;QAChE,MAAM,cAAc,GAA2B;YAC7C,QAAQ,EAAE,KAAK,CAAC,IAAI;YACpB,KAAK,EAAE,KAAK,CAAC,KAAK;YAClB,QAAQ,EAAE,eAAqD;YAC/D,SAAS,EAAE,KAAK,CAAC,YAAY,CAAC;YAC9B,UAAU,EAAE,KAAK,CAAC,aAAa,CAAC;SACjC,CAAC;QACF,OAAO,YAAY,CAAC;YAClB,SAAS,EAAE,wBAAwB;YACnC,IAAI,EAAE,cAAc;YACpB,EAAE,EAAE,IAAI,EAAE,CAAC,EAAE,WAAW,EAAE,IAAI,CAAC,WAAW,EAAE,EAAE,CAAC;YAC/C,SAAS,EAAE,kBAAkB,CAAC,IAAI,CAAC,gBAAgB,CAAC;SACrD,CAAC,CAAC;IACL,CAAC"}
|
package/lib/index.js
CHANGED
|
@@ -1,10 +1,8 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
1
|
/*
|
|
4
2
|
* Copyright (c) 2022, salesforce.com, inc.
|
|
5
3
|
* All rights reserved.
|
|
6
4
|
* Licensed under the BSD 3-Clause license.
|
|
7
5
|
* For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
|
|
8
6
|
*/
|
|
9
|
-
|
|
7
|
+
export default {};
|
|
10
8
|
//# sourceMappingURL=index.js.map
|
package/lib/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,eAAe,EAAE,CAAC"}
|
package/lib/utils/flags.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export declare const outputDirFlag: import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
|
|
2
|
-
export declare const outputDirFlagLightning: import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
|
|
3
|
-
export declare const internalFlag: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
1
|
+
export declare const outputDirFlag: import("@oclif/core/lib/interfaces/parser.js").OptionFlag<string, import("@oclif/core/lib/interfaces/parser.js").CustomOptions>;
|
|
2
|
+
export declare const outputDirFlagLightning: import("@oclif/core/lib/interfaces/parser.js").OptionFlag<string, import("@oclif/core/lib/interfaces/parser.js").CustomOptions>;
|
|
3
|
+
export declare const internalFlag: import("@oclif/core/lib/interfaces/parser.js").BooleanFlag<boolean>;
|
package/lib/utils/flags.js
CHANGED
|
@@ -1,18 +1,17 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.internalFlag = exports.outputDirFlagLightning = exports.outputDirFlag = void 0;
|
|
4
1
|
/*
|
|
5
2
|
* Copyright (c) 2022, salesforce.com, inc.
|
|
6
3
|
* All rights reserved.
|
|
7
4
|
* Licensed under the BSD 3-Clause license.
|
|
8
5
|
* For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
|
|
9
6
|
*/
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
7
|
+
import path from 'node:path';
|
|
8
|
+
import url from 'node:url';
|
|
9
|
+
import { Flags } from '@salesforce/sf-plugins-core';
|
|
10
|
+
import { Messages } from '@salesforce/core';
|
|
11
|
+
Messages.importMessagesDirectory(path.dirname(url.fileURLToPath(import.meta.url)));
|
|
12
|
+
const messages = Messages.loadMessages('@salesforce/plugin-templates', 'messages');
|
|
13
|
+
const lightningMessages = Messages.loadMessages('@salesforce/plugin-templates', 'lightning');
|
|
14
|
+
export const outputDirFlag = Flags.string({
|
|
16
15
|
char: 'd',
|
|
17
16
|
summary: messages.getMessage('flags.outputdir.summary'),
|
|
18
17
|
description: messages.getMessage('flags.outputdir.description'),
|
|
@@ -20,7 +19,7 @@ exports.outputDirFlag = sf_plugins_core_1.Flags.string({
|
|
|
20
19
|
deprecateAliases: true,
|
|
21
20
|
aliases: ['outputdir'],
|
|
22
21
|
});
|
|
23
|
-
|
|
22
|
+
export const outputDirFlagLightning = Flags.string({
|
|
24
23
|
char: 'd',
|
|
25
24
|
summary: messages.getMessage('flags.outputdir.summary'),
|
|
26
25
|
description: messages.getMessage('flags.outputdir.description'),
|
|
@@ -28,7 +27,7 @@ exports.outputDirFlagLightning = sf_plugins_core_1.Flags.string({
|
|
|
28
27
|
deprecateAliases: true,
|
|
29
28
|
aliases: ['outputdir'],
|
|
30
29
|
});
|
|
31
|
-
|
|
30
|
+
export const internalFlag = Flags.boolean({
|
|
32
31
|
char: 'i',
|
|
33
32
|
summary: lightningMessages.getMessage('flags.internal.summary'),
|
|
34
33
|
hidden: true,
|
package/lib/utils/flags.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"flags.js","sourceRoot":"","sources":["../../src/utils/flags.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"flags.js","sourceRoot":"","sources":["../../src/utils/flags.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,GAAG,MAAM,UAAU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,58 @@
|
|
|
1
1
|
import { Ux } from '@salesforce/sf-plugins-core';
|
|
2
2
|
import { ConfigAggregator } from '@salesforce/core';
|
|
3
3
|
import { CreateOutput } from '@salesforce/templates';
|
|
4
|
-
import { ForceGeneratorAdapter } from '@salesforce/templates/lib/utils';
|
|
5
|
-
import VisualforceComponentGenerator from '@salesforce/templates/lib/generators/visualforceComponentGenerator';
|
|
6
|
-
import VisualforcePageGenerator from '@salesforce/templates/lib/generators/visualforcePageGenerator';
|
|
7
|
-
import ApexClassGenerator from '@salesforce/templates/lib/generators/apexClassGenerator';
|
|
8
|
-
import LightningTestGenerator from '@salesforce/templates/lib/generators/lightningTestGenerator';
|
|
9
|
-
import StaticResourceGenerator from '@salesforce/templates/lib/generators/staticResourceGenerator';
|
|
10
|
-
import ProjectGenerator from '@salesforce/templates/lib/generators/projectGenerator';
|
|
11
|
-
import LightningInterfaceGenerator from '@salesforce/templates/lib/generators/lightningInterfaceGenerator';
|
|
12
|
-
import LightningAppGenerator from '@salesforce/templates/lib/generators/lightningAppGenerator';
|
|
13
|
-
import LightningEventGenerator from '@salesforce/templates/lib/generators/lightningEventGenerator';
|
|
14
|
-
import AnalyticsTemplateGenerator from '@salesforce/templates/lib/generators/analyticsTemplateGenerator';
|
|
15
|
-
import LightningComponentGenerator from '@salesforce/templates/lib/generators/lightningComponentGenerator';
|
|
16
|
-
import ApexTriggerGenerator from '@salesforce/templates/lib/generators/apexTriggerGenerator';
|
|
4
|
+
import { ForceGeneratorAdapter } from '@salesforce/templates/lib/utils/index.js';
|
|
5
|
+
import VisualforceComponentGenerator from '@salesforce/templates/lib/generators/visualforceComponentGenerator.js';
|
|
6
|
+
import VisualforcePageGenerator from '@salesforce/templates/lib/generators/visualforcePageGenerator.js';
|
|
7
|
+
import ApexClassGenerator from '@salesforce/templates/lib/generators/apexClassGenerator.js';
|
|
8
|
+
import LightningTestGenerator from '@salesforce/templates/lib/generators/lightningTestGenerator.js';
|
|
9
|
+
import StaticResourceGenerator from '@salesforce/templates/lib/generators/staticResourceGenerator.js';
|
|
10
|
+
import ProjectGenerator from '@salesforce/templates/lib/generators/projectGenerator.js';
|
|
11
|
+
import LightningInterfaceGenerator from '@salesforce/templates/lib/generators/lightningInterfaceGenerator.js';
|
|
12
|
+
import LightningAppGenerator from '@salesforce/templates/lib/generators/lightningAppGenerator.js';
|
|
13
|
+
import LightningEventGenerator from '@salesforce/templates/lib/generators/lightningEventGenerator.js';
|
|
14
|
+
import AnalyticsTemplateGenerator from '@salesforce/templates/lib/generators/analyticsTemplateGenerator.js';
|
|
15
|
+
import LightningComponentGenerator from '@salesforce/templates/lib/generators/lightningComponentGenerator.js';
|
|
16
|
+
import ApexTriggerGenerator from '@salesforce/templates/lib/generators/apexTriggerGenerator.js';
|
|
17
17
|
export type generatorInputs = {
|
|
18
18
|
ux: Ux;
|
|
19
19
|
templates?: string;
|
|
20
20
|
} & ({
|
|
21
21
|
generator: typeof VisualforcePageGenerator;
|
|
22
|
-
opts: typeof VisualforcePageGenerator.prototype.options;
|
|
22
|
+
opts: typeof VisualforcePageGenerator.default.prototype.options;
|
|
23
23
|
} | {
|
|
24
24
|
generator: typeof ApexClassGenerator;
|
|
25
|
-
opts: typeof ApexClassGenerator.prototype.options;
|
|
25
|
+
opts: typeof ApexClassGenerator.default.prototype.options;
|
|
26
26
|
} | {
|
|
27
27
|
generator: typeof ApexTriggerGenerator;
|
|
28
|
-
opts: typeof ApexTriggerGenerator.prototype.options;
|
|
28
|
+
opts: typeof ApexTriggerGenerator.default.prototype.options;
|
|
29
29
|
} | {
|
|
30
30
|
generator: typeof VisualforceComponentGenerator;
|
|
31
|
-
opts: typeof VisualforceComponentGenerator.prototype.options;
|
|
31
|
+
opts: typeof VisualforceComponentGenerator.default.prototype.options;
|
|
32
32
|
} | {
|
|
33
33
|
generator: typeof LightningTestGenerator;
|
|
34
|
-
opts: typeof LightningTestGenerator.prototype.options;
|
|
34
|
+
opts: typeof LightningTestGenerator.default.prototype.options;
|
|
35
35
|
} | {
|
|
36
36
|
generator: typeof StaticResourceGenerator;
|
|
37
|
-
opts: typeof StaticResourceGenerator.prototype.options;
|
|
37
|
+
opts: typeof StaticResourceGenerator.default.prototype.options;
|
|
38
38
|
} | {
|
|
39
39
|
generator: typeof ProjectGenerator;
|
|
40
|
-
opts: typeof ProjectGenerator.prototype.options;
|
|
40
|
+
opts: typeof ProjectGenerator.default.prototype.options;
|
|
41
41
|
} | {
|
|
42
42
|
generator: typeof LightningInterfaceGenerator;
|
|
43
|
-
opts: typeof LightningInterfaceGenerator.prototype.options;
|
|
43
|
+
opts: typeof LightningInterfaceGenerator.default.prototype.options;
|
|
44
44
|
} | {
|
|
45
45
|
generator: typeof LightningAppGenerator;
|
|
46
|
-
opts: typeof LightningAppGenerator.prototype.options;
|
|
46
|
+
opts: typeof LightningAppGenerator.default.prototype.options;
|
|
47
47
|
} | {
|
|
48
48
|
generator: typeof LightningEventGenerator;
|
|
49
|
-
opts: typeof LightningEventGenerator.prototype.options;
|
|
49
|
+
opts: typeof LightningEventGenerator.default.prototype.options;
|
|
50
50
|
} | {
|
|
51
51
|
generator: typeof AnalyticsTemplateGenerator;
|
|
52
|
-
opts: typeof AnalyticsTemplateGenerator.prototype.options;
|
|
52
|
+
opts: typeof AnalyticsTemplateGenerator.default.prototype.options;
|
|
53
53
|
} | {
|
|
54
54
|
generator: typeof LightningComponentGenerator;
|
|
55
|
-
opts: typeof LightningComponentGenerator.prototype.options;
|
|
55
|
+
opts: typeof LightningComponentGenerator.default.prototype.options;
|
|
56
56
|
});
|
|
57
57
|
export declare function runGenerator({ ux, templates, generator, opts }: generatorInputs): Promise<CreateOutput>;
|
|
58
58
|
export declare const getCustomTemplates: (configAggregator: ConfigAggregator) => string | undefined;
|
|
@@ -1,55 +1,49 @@
|
|
|
1
|
-
"use strict";
|
|
2
1
|
/*
|
|
3
2
|
* Copyright (c) 2019, salesforce.com, inc.
|
|
4
3
|
* All rights reserved.
|
|
5
4
|
* Licensed under the BSD 3-Clause license.
|
|
6
5
|
* For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
|
|
7
6
|
*/
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
async function runGenerator({ ux, templates, generator, opts }) {
|
|
7
|
+
import path from 'node:path';
|
|
8
|
+
import { fileURLToPath } from 'node:url';
|
|
9
|
+
import { Messages, OrgConfigProperties } from '@salesforce/core';
|
|
10
|
+
import { TemplateService } from '@salesforce/templates';
|
|
11
|
+
import yeoman from 'yeoman-environment';
|
|
12
|
+
import { ForceGeneratorAdapter } from '@salesforce/templates/lib/utils/index.js';
|
|
13
|
+
Messages.importMessagesDirectory(path.dirname(fileURLToPath(import.meta.url)));
|
|
14
|
+
const messages = Messages.loadMessages('@salesforce/plugin-templates', 'messages');
|
|
15
|
+
export async function runGenerator({ ux, templates, generator, opts }) {
|
|
18
16
|
if (templates) {
|
|
19
|
-
await
|
|
17
|
+
await TemplateService.getInstance().setCustomTemplatesRootPathOrGitRepo(templates);
|
|
20
18
|
}
|
|
21
|
-
const adapter = new
|
|
19
|
+
const adapter = new ForceGeneratorAdapter();
|
|
22
20
|
// @ts-expect-error the adapter doesn't fully implement the yeoman adapter interface
|
|
23
21
|
const env = yeoman.createEnv(undefined, undefined, adapter);
|
|
24
|
-
|
|
22
|
+
// @ts-ignore - access the default via the .default because of how we have to import everything above
|
|
23
|
+
env.registerStub(generator.default, 'generator');
|
|
25
24
|
await env.run('generator', opts);
|
|
26
25
|
const targetDir = path.resolve(opts.outputdir ?? '.');
|
|
27
26
|
ux.log(messages.getMessage('TargetDirOutput', [targetDir]));
|
|
28
27
|
ux.log(adapter.log.getOutput());
|
|
29
|
-
return
|
|
28
|
+
return buildJson(adapter, targetDir);
|
|
30
29
|
}
|
|
31
|
-
|
|
32
|
-
const getCustomTemplates = (configAggregator) => {
|
|
30
|
+
export const getCustomTemplates = (configAggregator) => {
|
|
33
31
|
try {
|
|
34
32
|
// we're still accessing the old `customOrgMetadataTemplates` key, but this is deprecated and we'll use the new key to access the value
|
|
35
|
-
|
|
36
|
-
return customTemplatesFromConfig;
|
|
33
|
+
return configAggregator.getPropertyValue(OrgConfigProperties.ORG_CUSTOM_METADATA_TEMPLATES);
|
|
37
34
|
}
|
|
38
35
|
catch (err) {
|
|
39
36
|
return undefined;
|
|
40
37
|
}
|
|
41
38
|
};
|
|
42
|
-
exports.getCustomTemplates = getCustomTemplates;
|
|
43
39
|
// exported for test
|
|
44
|
-
const buildJson = (adapter, targetDir) => {
|
|
40
|
+
export const buildJson = (adapter, targetDir) => {
|
|
45
41
|
const cleanOutput = adapter.log.getCleanOutput();
|
|
46
42
|
const rawOutput = `target dir = ${targetDir}\n${adapter.log.getOutput()}`;
|
|
47
|
-
|
|
43
|
+
return {
|
|
48
44
|
outputDir: targetDir,
|
|
49
45
|
created: cleanOutput,
|
|
50
46
|
rawOutput,
|
|
51
47
|
};
|
|
52
|
-
return output;
|
|
53
48
|
};
|
|
54
|
-
exports.buildJson = buildJson;
|
|
55
49
|
//# sourceMappingURL=templateCommand.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"templateCommand.js","sourceRoot":"","sources":["../../src/utils/templateCommand.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"templateCommand.js","sourceRoot":"","sources":["../../src/utils/templateCommand.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAEzC,OAAO,EAAoB,QAAQ,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AACnF,OAAO,EAAgB,eAAe,EAAE,MAAM,uBAAuB,CAAC;AACtE,OAAO,MAAM,MAAM,oBAAoB,CAAC;AAExC,OAAO,EAAE,qBAAqB,EAAE,MAAM,0CAA0C,C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