@jayree/sfdx-plugin-org 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +6 -0
- package/LICENSE.txt +12 -0
- package/README.md +107 -0
- package/bin/is-sfdx.js +3 -0
- package/lib/commands/jayree/org/configure/country.d.ts +11 -0
- package/lib/commands/jayree/org/configure/country.js +138 -0
- package/lib/commands/jayree/org/configure/country.js.map +1 -0
- package/lib/commands/jayree/org/configure/index.d.ts +14 -0
- package/lib/commands/jayree/org/configure/index.js +130 -0
- package/lib/commands/jayree/org/configure/index.js.map +1 -0
- package/lib/commands/jayree/org/configure/state.d.ts +15 -0
- package/lib/commands/jayree/org/configure/state.js +242 -0
- package/lib/commands/jayree/org/configure/state.js.map +1 -0
- package/lib/hooks/changelog.d.ts +2 -0
- package/lib/hooks/changelog.js +26 -0
- package/lib/hooks/changelog.js.map +1 -0
- package/lib/index.d.ts +2 -0
- package/lib/index.js +8 -0
- package/lib/index.js.map +1 -0
- package/lib/utils/config.d.ts +22 -0
- package/lib/utils/config.js +72 -0
- package/lib/utils/config.js.map +1 -0
- package/lib/utils/puppeteer/configuretasks.d.ts +50 -0
- package/lib/utils/puppeteer/configuretasks.js +270 -0
- package/lib/utils/puppeteer/configuretasks.js.map +1 -0
- package/lib/utils/puppeteer/countrystateconfig.d.ts +29 -0
- package/lib/utils/puppeteer/countrystateconfig.js +100 -0
- package/lib/utils/puppeteer/countrystateconfig.js.map +1 -0
- package/lib/utils/puppeteer/statetasks.d.ts +58 -0
- package/lib/utils/puppeteer/statetasks.js +302 -0
- package/lib/utils/puppeteer/statetasks.js.map +1 -0
- package/lib/utils/renderer.d.ts +47 -0
- package/lib/utils/renderer.js +499 -0
- package/lib/utils/renderer.js.map +1 -0
- package/messages/configure.md +12 -0
- package/messages/createstatecountry.md +27 -0
- package/oclif.manifest.json +184 -0
- package/package.json +209 -0
|
@@ -0,0 +1,242 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) 2021, jayree
|
|
3
|
+
* All rights reserved.
|
|
4
|
+
* Licensed under the BSD 3-Clause license.
|
|
5
|
+
* For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
|
|
6
|
+
*/
|
|
7
|
+
import { dirname } from 'node:path';
|
|
8
|
+
import { fileURLToPath } from 'node:url';
|
|
9
|
+
import { Flags, SfCommand, requiredOrgFlagWithDeprecations, orgApiVersionFlagWithDeprecations, } from '@salesforce/sf-plugins-core';
|
|
10
|
+
import { Messages } from '@salesforce/core';
|
|
11
|
+
import { ListrLogger, Listr, PRESET_TIMER } from 'listr2';
|
|
12
|
+
import Debug from 'debug';
|
|
13
|
+
import { MyDefaultRenderer } from '../../../../utils/renderer.js';
|
|
14
|
+
import { PuppeteerStateTasks } from '../../../../utils/puppeteer/statetasks.js';
|
|
15
|
+
// eslint-disable-next-line no-underscore-dangle
|
|
16
|
+
const __filename = fileURLToPath(import.meta.url);
|
|
17
|
+
// eslint-disable-next-line no-underscore-dangle
|
|
18
|
+
const __dirname = dirname(__filename);
|
|
19
|
+
Messages.importMessagesDirectory(__dirname);
|
|
20
|
+
const messages = Messages.loadMessages('@jayree/sfdx-plugin-org', 'createstatecountry');
|
|
21
|
+
const logger = new ListrLogger({ useIcons: false });
|
|
22
|
+
const debug = Debug('jayree:x:y');
|
|
23
|
+
// eslint-disable-next-line sf-plugin/command-example
|
|
24
|
+
class ImportState extends SfCommand {
|
|
25
|
+
async run() {
|
|
26
|
+
const { flags } = await this.parse(ImportState);
|
|
27
|
+
const taskRunner = new PuppeteerStateTasks({
|
|
28
|
+
accessToken: flags['target-org'].getConnection(flags['api-version']).accessToken,
|
|
29
|
+
instanceUrl: flags['target-org'].getConnection(flags['api-version']).instanceUrl,
|
|
30
|
+
});
|
|
31
|
+
const mainTasks = new Listr([
|
|
32
|
+
{
|
|
33
|
+
title: 'Get ISO 3166 Data',
|
|
34
|
+
task: async (ctx, task) => {
|
|
35
|
+
ctx.countryCode = await taskRunner.validateParameterCountryCode(flags['country-code']);
|
|
36
|
+
ctx.category = taskRunner.validateParameterCategory(flags.category);
|
|
37
|
+
ctx.language = taskRunner.validateParameterLanguage(flags.language);
|
|
38
|
+
debug(ctx);
|
|
39
|
+
return task.newListr([
|
|
40
|
+
{
|
|
41
|
+
title: 'Country Code: ',
|
|
42
|
+
enabled: () => !this.jsonEnabled() && process.stdout.isTTY,
|
|
43
|
+
// eslint-disable-next-line @typescript-eslint/no-shadow
|
|
44
|
+
task: async (ctx, task) => {
|
|
45
|
+
if (ctx.countryCode.selected === undefined) {
|
|
46
|
+
ctx.countryCode.selected = await task.prompt({
|
|
47
|
+
type: 'AutoComplete',
|
|
48
|
+
message: 'Select Country',
|
|
49
|
+
choices: ctx.countryCode.values.map((v) => {
|
|
50
|
+
return { name: v.value, message: v.name };
|
|
51
|
+
}),
|
|
52
|
+
});
|
|
53
|
+
ctx.countryCode = await taskRunner.validateParameterCountryCode(ctx.countryCode.selected);
|
|
54
|
+
ctx.category = taskRunner.validateParameterCategory(ctx.category.selected);
|
|
55
|
+
ctx.language = taskRunner.validateParameterLanguage(ctx.language.selected);
|
|
56
|
+
}
|
|
57
|
+
debug(ctx);
|
|
58
|
+
task.title = task.title + ctx.countryCode.selected;
|
|
59
|
+
},
|
|
60
|
+
},
|
|
61
|
+
{
|
|
62
|
+
title: 'Category: ',
|
|
63
|
+
enabled: () => !this.jsonEnabled() && process.stdout.isTTY,
|
|
64
|
+
// eslint-disable-next-line @typescript-eslint/no-shadow
|
|
65
|
+
task: async (ctx, task) => {
|
|
66
|
+
if (ctx.category.selected === undefined) {
|
|
67
|
+
ctx.category.selected = await task.prompt({
|
|
68
|
+
type: 'AutoComplete',
|
|
69
|
+
message: 'Select Category',
|
|
70
|
+
choices: ctx.category.values,
|
|
71
|
+
});
|
|
72
|
+
ctx.category = taskRunner.validateParameterCategory(ctx.category.selected);
|
|
73
|
+
ctx.language = taskRunner.validateParameterLanguage(ctx.language.selected);
|
|
74
|
+
}
|
|
75
|
+
debug(ctx);
|
|
76
|
+
task.title = task.title + ctx.category.selected;
|
|
77
|
+
},
|
|
78
|
+
},
|
|
79
|
+
{
|
|
80
|
+
title: 'Language: ',
|
|
81
|
+
enabled: () => !this.jsonEnabled() && process.stdout.isTTY,
|
|
82
|
+
// eslint-disable-next-line @typescript-eslint/no-shadow
|
|
83
|
+
task: async (ctx, task) => {
|
|
84
|
+
if (ctx.language.selected === undefined) {
|
|
85
|
+
ctx.language.selected = await task.prompt({
|
|
86
|
+
type: 'AutoComplete',
|
|
87
|
+
message: 'Select Language',
|
|
88
|
+
choices: ctx.language.values,
|
|
89
|
+
});
|
|
90
|
+
ctx.language = taskRunner.validateParameterLanguage(ctx.language.selected);
|
|
91
|
+
}
|
|
92
|
+
debug(ctx);
|
|
93
|
+
task.title = task.title + ctx.language.selected;
|
|
94
|
+
},
|
|
95
|
+
},
|
|
96
|
+
]);
|
|
97
|
+
},
|
|
98
|
+
},
|
|
99
|
+
{
|
|
100
|
+
task: (ctx) => {
|
|
101
|
+
try {
|
|
102
|
+
ctx.data = taskRunner.validateData();
|
|
103
|
+
ctx.result = [];
|
|
104
|
+
}
|
|
105
|
+
catch (error) {
|
|
106
|
+
ctx.error = error.message;
|
|
107
|
+
throw error;
|
|
108
|
+
}
|
|
109
|
+
},
|
|
110
|
+
},
|
|
111
|
+
{
|
|
112
|
+
title: 'Set Country Integration Value: ',
|
|
113
|
+
enabled: (ctx) => (ctx.data ? true : false),
|
|
114
|
+
task: async (ctx, task) => {
|
|
115
|
+
task.title = task.title + ctx.countryCode.selected;
|
|
116
|
+
if (!(await taskRunner.setCountryIntegrationValue())) {
|
|
117
|
+
task.skip();
|
|
118
|
+
}
|
|
119
|
+
},
|
|
120
|
+
},
|
|
121
|
+
{
|
|
122
|
+
title: 'Deactivate/Hide States',
|
|
123
|
+
enabled: (ctx) => (ctx.data?.deactivate ? ctx.data.deactivate.length > 0 : false),
|
|
124
|
+
task: (ctx, task) =>
|
|
125
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-return
|
|
126
|
+
task.newListr(() => {
|
|
127
|
+
const deactivateTasks = [];
|
|
128
|
+
ctx.data.deactivate.forEach((el) => {
|
|
129
|
+
deactivateTasks.push({
|
|
130
|
+
title: el.toString(),
|
|
131
|
+
// eslint-disable-next-line @typescript-eslint/no-shadow
|
|
132
|
+
skip: (ctx) => !ctx.data.deactivate.includes(el),
|
|
133
|
+
// eslint-disable-next-line @typescript-eslint/no-shadow
|
|
134
|
+
task: async (ctx, task) => {
|
|
135
|
+
const sTask = taskRunner.getNextDeactivate();
|
|
136
|
+
if (!(await sTask.executeDeactivate())) {
|
|
137
|
+
task.skip();
|
|
138
|
+
ctx.result.push({ '3166-2 code': el, status: 'skipped (deactivated)' });
|
|
139
|
+
}
|
|
140
|
+
else {
|
|
141
|
+
ctx.result.push({ '3166-2 code': el, status: 'updated (deactivated)' });
|
|
142
|
+
}
|
|
143
|
+
},
|
|
144
|
+
options: { persistentOutput: true },
|
|
145
|
+
});
|
|
146
|
+
});
|
|
147
|
+
return deactivateTasks;
|
|
148
|
+
}, { concurrent: flags.concurrent, exitOnError: false }),
|
|
149
|
+
},
|
|
150
|
+
{
|
|
151
|
+
title: 'Add States',
|
|
152
|
+
enabled: (ctx) => (ctx.data?.add ? ctx.data.add.length > 0 : false),
|
|
153
|
+
task: (ctx, task) =>
|
|
154
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-return
|
|
155
|
+
task.newListr(() => {
|
|
156
|
+
const addTasks = [];
|
|
157
|
+
ctx.data.add.forEach((el) => {
|
|
158
|
+
addTasks.push({
|
|
159
|
+
title: `${el['Subdivision name']} (${el['3166-2 code']})`,
|
|
160
|
+
// eslint-disable-next-line @typescript-eslint/no-shadow
|
|
161
|
+
skip: (ctx) => !ctx.data.add.includes(el),
|
|
162
|
+
// eslint-disable-next-line @typescript-eslint/no-shadow
|
|
163
|
+
task: async (ctx, task) => {
|
|
164
|
+
const sTask = taskRunner.getNextAdd();
|
|
165
|
+
const result = await sTask.executeAdd();
|
|
166
|
+
ctx.result.push({ ...el, status: result });
|
|
167
|
+
if (result === 'skipped') {
|
|
168
|
+
task.skip();
|
|
169
|
+
}
|
|
170
|
+
},
|
|
171
|
+
options: { persistentOutput: true },
|
|
172
|
+
});
|
|
173
|
+
});
|
|
174
|
+
return addTasks;
|
|
175
|
+
}, { concurrent: flags.concurrent, exitOnError: false }),
|
|
176
|
+
},
|
|
177
|
+
], {
|
|
178
|
+
renderer: MyDefaultRenderer,
|
|
179
|
+
rendererOptions: {
|
|
180
|
+
timer: {
|
|
181
|
+
...PRESET_TIMER,
|
|
182
|
+
condition: (duration) => duration > 250,
|
|
183
|
+
},
|
|
184
|
+
collapseErrors: false,
|
|
185
|
+
collapseSubtasks: false,
|
|
186
|
+
maxSubTasks: flags.concurrent >= 10 ? flags.concurrent : 10,
|
|
187
|
+
},
|
|
188
|
+
silentRendererCondition: this.jsonEnabled(),
|
|
189
|
+
fallbackRendererCondition: debug.enabled,
|
|
190
|
+
exitOnError: true,
|
|
191
|
+
});
|
|
192
|
+
try {
|
|
193
|
+
await taskRunner.open();
|
|
194
|
+
const context = await mainTasks.run();
|
|
195
|
+
if (context.error) {
|
|
196
|
+
throw new Error(context.error);
|
|
197
|
+
}
|
|
198
|
+
context.result = context.result?.sort((a, b) => a['3166-2 code'] < b['3166-2 code'] ? -1 : a['3166-2 code'] > b['3166-2 code'] ? 1 : 0);
|
|
199
|
+
if (debug.enabled) {
|
|
200
|
+
if (!this.jsonEnabled()) {
|
|
201
|
+
logger.toStderr(`Context: ${JSON.stringify(context, null, 2)}`);
|
|
202
|
+
}
|
|
203
|
+
return context;
|
|
204
|
+
}
|
|
205
|
+
return context.result;
|
|
206
|
+
}
|
|
207
|
+
catch (e) {
|
|
208
|
+
if (debug.enabled) {
|
|
209
|
+
if (!this.jsonEnabled()) {
|
|
210
|
+
logger.toStderr(e.message);
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
throw e;
|
|
214
|
+
}
|
|
215
|
+
finally {
|
|
216
|
+
await taskRunner.close();
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
ImportState.summary = messages.getMessage('commandStateDescription');
|
|
221
|
+
ImportState.description = messages.getMessage('commandStateDescription');
|
|
222
|
+
ImportState.flags = {
|
|
223
|
+
'target-org': requiredOrgFlagWithDeprecations,
|
|
224
|
+
'api-version': orgApiVersionFlagWithDeprecations,
|
|
225
|
+
'country-code': Flags.string({
|
|
226
|
+
summary: messages.getMessage('countrycodeFlagDescription'),
|
|
227
|
+
deprecateAliases: true,
|
|
228
|
+
aliases: ['countrycode'],
|
|
229
|
+
}),
|
|
230
|
+
category: Flags.string({
|
|
231
|
+
summary: messages.getMessage('categoryFlagDescription'),
|
|
232
|
+
}),
|
|
233
|
+
language: Flags.string({
|
|
234
|
+
summary: messages.getMessage('languageFlagDescription'),
|
|
235
|
+
}),
|
|
236
|
+
concurrent: Flags.integer({
|
|
237
|
+
summary: messages.getMessage('concurrentFlagDescription'),
|
|
238
|
+
default: 1,
|
|
239
|
+
}),
|
|
240
|
+
};
|
|
241
|
+
export default ImportState;
|
|
242
|
+
//# sourceMappingURL=state.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"state.js","sourceRoot":"","sources":["../../../../../src/commands/jayree/org/configure/state.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,EACL,KAAK,EACL,SAAS,EACT,+BAA+B,EAC/B,iCAAiC,GAClC,MAAM,6BAA6B,CAAC;AACrC,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAE5C,OAAO,EAAE,WAAW,EAAE,KAAK,EAAE,YAAY,EAAiC,MAAM,QAAQ,CAAC;AACzF,OAAO,KAAK,MAAM,O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E,QAAQ,CAAC,UAAU,CAAC,2BAA2B,CAAC;QACzD,OAAO,EAAE,CAAC;KACX,CAAC;CACH,CAAC;eAtBiB,WAAW"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) 2022, jayree
|
|
3
|
+
* All rights reserved.
|
|
4
|
+
* Licensed under the BSD 3-Clause license.
|
|
5
|
+
* For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
|
|
6
|
+
*/
|
|
7
|
+
/* istanbul ignore file */
|
|
8
|
+
import { join, dirname } from 'node:path';
|
|
9
|
+
import { fileURLToPath } from 'node:url';
|
|
10
|
+
import printChangeLog from '@jayree/changelog';
|
|
11
|
+
import Debug from 'debug';
|
|
12
|
+
// eslint-disable-next-line no-underscore-dangle
|
|
13
|
+
const __filename = fileURLToPath(import.meta.url);
|
|
14
|
+
// eslint-disable-next-line no-underscore-dangle
|
|
15
|
+
const __dirname = dirname(__filename);
|
|
16
|
+
// eslint-disable-next-line @typescript-eslint/require-await
|
|
17
|
+
export const changelog = async function () {
|
|
18
|
+
const debug = Debug([this.config.bin, '@jayree/sfdx-plugin-org', 'hooks', 'update'].join(':'));
|
|
19
|
+
// eslint-disable-next-line @typescript-eslint/no-misused-promises
|
|
20
|
+
process.once('beforeExit', async () => {
|
|
21
|
+
const changes = await printChangeLog(this.config.cacheDir, join(__dirname, '..', '..'), debug);
|
|
22
|
+
if (changes)
|
|
23
|
+
this.log(changes);
|
|
24
|
+
});
|
|
25
|
+
};
|
|
26
|
+
//# sourceMappingURL=changelog.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"changelog.js","sourceRoot":"","sources":["../../src/hooks/changelog.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,0BAA0B;AAC1B,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAEzC,OAAO,cAAc,MAAM,mBAAmB,CAAC;AAC/C,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,gDAAgD;AAChD,MAAM,UAAU,GAAG,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAClD,gDAAgD;AAChD,MAAM,SAAS,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC;AAEtC,4DAA4D;AAC5D,MAAM,CAAC,MAAM,SAAS,GAAmB,KAAK;IAC5C,MAAM,KAAK,GAAG,KAAK,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,GAAG,EAAE,yBAAyB,EAAE,OAAO,EAAE,QAAQ,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;IAE/F,kEAAkE;IAClE,OAAO,CAAC,IAAI,CAAC,YAAY,EAAE,KAAK,IAAI,EAAE;QACpC,MAAM,OAAO,GAAG,MAAM,cAAc,CAAC,IAAI,CAAC,MAAM,CAAC,QAAQ,EAAE,IAAI,CAAC,SAAS,EAAE,IAAI,EAAE,IAAI,CAAC,EAAE,KAAK,CAAC,CAAC;QAC/F,IAAI,OAAO;YAAE,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;IACjC,CAAC,CAAC,CAAC;AACL,CAAC,CAAC"}
|
package/lib/index.d.ts
ADDED
package/lib/index.js
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) 2022, jayree
|
|
3
|
+
* All rights reserved.
|
|
4
|
+
* Licensed under the BSD 3-Clause license.
|
|
5
|
+
* For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
|
|
6
|
+
*/
|
|
7
|
+
export default {};
|
|
8
|
+
//# sourceMappingURL=index.js.map
|
package/lib/index.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,eAAe,EAAE,CAAC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { Task } from './puppeteer/configuretasks.js';
|
|
2
|
+
type Config = {
|
|
3
|
+
ensureUserPermissions: string[];
|
|
4
|
+
ensureObjectPermissions: string[];
|
|
5
|
+
moveSourceFolders: string[];
|
|
6
|
+
applySourceFixes: string[];
|
|
7
|
+
runHooks: boolean;
|
|
8
|
+
puppeteerDocker: {
|
|
9
|
+
headless: boolean;
|
|
10
|
+
args: string[];
|
|
11
|
+
};
|
|
12
|
+
puppeteerWSL: {
|
|
13
|
+
headless: boolean;
|
|
14
|
+
executablePath: string;
|
|
15
|
+
};
|
|
16
|
+
puppeteer: {
|
|
17
|
+
headless: boolean;
|
|
18
|
+
};
|
|
19
|
+
setupTasks?: Task[];
|
|
20
|
+
};
|
|
21
|
+
declare const _default: (path?: string) => Config;
|
|
22
|
+
export default _default;
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) 2021, jayree
|
|
3
|
+
* All rights reserved.
|
|
4
|
+
* Licensed under the BSD 3-Clause license.
|
|
5
|
+
* For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
|
|
6
|
+
*/
|
|
7
|
+
/* istanbul ignore file */
|
|
8
|
+
import { join } from 'path';
|
|
9
|
+
import fs from 'fs-extra';
|
|
10
|
+
import isDocker from 'is-docker';
|
|
11
|
+
import isWsl from 'is-wsl';
|
|
12
|
+
import { SfProject } from '@salesforce/core';
|
|
13
|
+
const CONFIG_DEFAULTS = {
|
|
14
|
+
ensureUserPermissions: [],
|
|
15
|
+
ensureObjectPermissions: [],
|
|
16
|
+
moveSourceFolders: [],
|
|
17
|
+
applySourceFixes: ['source:retrieve:full', 'source:retrieve:all'],
|
|
18
|
+
runHooks: false,
|
|
19
|
+
puppeteerDocker: {
|
|
20
|
+
headless: true,
|
|
21
|
+
args: ['--no-sandbox', '--disable-setuid-sandbox', '--disable-features=site-per-process'],
|
|
22
|
+
},
|
|
23
|
+
puppeteerWSL: {
|
|
24
|
+
headless: true,
|
|
25
|
+
executablePath: '/bin/google-chrome',
|
|
26
|
+
},
|
|
27
|
+
puppeteer: {
|
|
28
|
+
headless: true,
|
|
29
|
+
},
|
|
30
|
+
};
|
|
31
|
+
const resolvedConfigs = {};
|
|
32
|
+
// eslint-disable-next-line complexity
|
|
33
|
+
export default (path = SfProject.resolveProjectPathSync()) => {
|
|
34
|
+
if (path && resolvedConfigs[path]) {
|
|
35
|
+
return resolvedConfigs[path];
|
|
36
|
+
}
|
|
37
|
+
const defaults = CONFIG_DEFAULTS;
|
|
38
|
+
let configFromFile;
|
|
39
|
+
try {
|
|
40
|
+
configFromFile = fs.readJsonSync(join(path, '.sfdx-jayree.json'));
|
|
41
|
+
}
|
|
42
|
+
catch (error) {
|
|
43
|
+
if (error.code === 'ENOENT') {
|
|
44
|
+
configFromFile = undefined;
|
|
45
|
+
}
|
|
46
|
+
else {
|
|
47
|
+
throw error;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
if (configFromFile?.puppeteer && isDocker()) {
|
|
51
|
+
configFromFile.puppeteer = { ...defaults.puppeteerDocker, ...configFromFile.puppeteer };
|
|
52
|
+
}
|
|
53
|
+
if (configFromFile?.puppeteer && isWsl) {
|
|
54
|
+
configFromFile.puppeteer = { ...defaults.puppeteerWSL, ...configFromFile.puppeteer };
|
|
55
|
+
}
|
|
56
|
+
const config = {
|
|
57
|
+
ensureUserPermissions: configFromFile?.ensureUserPermissions ?? defaults.ensureUserPermissions,
|
|
58
|
+
ensureObjectPermissions: configFromFile?.ensureObjectPermissions ?? defaults.ensureObjectPermissions,
|
|
59
|
+
moveSourceFolders: configFromFile?.moveSourceFolders ?? defaults.moveSourceFolders,
|
|
60
|
+
applySourceFixes: configFromFile?.applySourceFixes ?? defaults.applySourceFixes,
|
|
61
|
+
runHooks: configFromFile?.runHooks ?? defaults.runHooks,
|
|
62
|
+
puppeteerDocker: configFromFile?.puppeteerDocker ?? defaults.puppeteerDocker,
|
|
63
|
+
puppeteerWSL: configFromFile?.puppeteerWSL ?? defaults.puppeteerWSL,
|
|
64
|
+
puppeteer: configFromFile?.puppeteer ||
|
|
65
|
+
(isWsl && defaults.puppeteerWSL) ||
|
|
66
|
+
(isDocker() && defaults.puppeteerDocker) ||
|
|
67
|
+
defaults.puppeteer,
|
|
68
|
+
};
|
|
69
|
+
resolvedConfigs[path] = config;
|
|
70
|
+
return config;
|
|
71
|
+
};
|
|
72
|
+
//# sourceMappingURL=config.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.js","sourceRoot":"","sources":["../../src/utils/config.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,0BAA0B;AAC1B,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAC5B,OAAO,EAAE,MAAM,UAAU,CAAC;AAC1B,OAAO,QAAQ,MAAM,WAAW,CAAC;AACjC,OAAO,KAAK,MAAM,QAAQ,CAAC;AAC3B,OAAO,EAAE,SAAS,EAAW,MAAM,kBAAkB,CAAC;AAuBtD,MAAM,eAAe,GAAG;IACtB,qBAAqB,EAAE,EAAE;IACzB,uBAAuB,EAAE,EAAE;IAC3B,iBAAiB,EAAE,EAAE;IACrB,gBAAgB,EAAE,CAAC,sBAAsB,EAAE,qBAAqB,CAAC;IACjE,QAAQ,EAAE,KAAK;IACf,eAAe,EAAE;QACf,QAAQ,EAAE,IAAI;QACd,IAAI,EAAE,CAAC,cAAc,EAAE,0BAA0B,EAAE,qCAAqC,CAAC;KAC1F;IACD,YAAY,EAAE;QACZ,QAAQ,EAAE,IAAI;QACd,cAAc,EAAE,oBAAoB;KACrC;IACD,SAAS,EAAE;QACT,QAAQ,EAAE,IAAI;KACf;CACF,CAAC;AAEF,MAAM,eAAe,GAA+B,EAAE,CAAC;AAEvD,sCAAsC;AACtC,eAAe,CAAC,IAAI,GAAG,SAAS,CAAC,sBAAsB,EAAE,EAAU,EAAE;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;QACnE,SAAS,EACP,cAAc,EAAE,SAAS;YACzB,CAAC,KAAK,IAAI,QAAQ,CAAC,YAAY,CAAC;YAChC,CAAC,QAAQ,EAAE,IAAI,QAAQ,CAAC,eAAe,CAAC;YACxC,QAAQ,CAAC,SAAS;KACrB,CAAC;IAEF,eAAe,CAAC,IAAI,CAAC,GAAG,MAAM,CAAC;IAC/B,OAAO,MAAM,CAAC;AAChB,CAAC,CAAC"}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
type TaskEvaluate = Array<{
|
|
2
|
+
action: string;
|
|
3
|
+
value: string;
|
|
4
|
+
waitFor: string | {
|
|
5
|
+
querySelector: string;
|
|
6
|
+
property: string;
|
|
7
|
+
value: string;
|
|
8
|
+
};
|
|
9
|
+
querySelector: string;
|
|
10
|
+
querySelectorAll: string;
|
|
11
|
+
type: {
|
|
12
|
+
checkbox: {
|
|
13
|
+
checked: boolean;
|
|
14
|
+
};
|
|
15
|
+
list: {
|
|
16
|
+
selection: string;
|
|
17
|
+
};
|
|
18
|
+
};
|
|
19
|
+
}>;
|
|
20
|
+
export type Task = {
|
|
21
|
+
title?: string;
|
|
22
|
+
isactive?: boolean;
|
|
23
|
+
url?: string;
|
|
24
|
+
iframe?: number;
|
|
25
|
+
evaluate: TaskEvaluate;
|
|
26
|
+
tasks?: Array<{
|
|
27
|
+
title?: string;
|
|
28
|
+
evaluate: TaskEvaluate;
|
|
29
|
+
}>;
|
|
30
|
+
};
|
|
31
|
+
export declare class PuppeteerConfigureTasks {
|
|
32
|
+
currenTask: Task;
|
|
33
|
+
private tasks;
|
|
34
|
+
private nextTaskIndex;
|
|
35
|
+
private browser;
|
|
36
|
+
private context;
|
|
37
|
+
private auth;
|
|
38
|
+
constructor(auth: {
|
|
39
|
+
instanceUrl: string;
|
|
40
|
+
accessToken: string;
|
|
41
|
+
}, tasks: Task[]);
|
|
42
|
+
private static subExec;
|
|
43
|
+
getNext(): this;
|
|
44
|
+
close(): Promise<void>;
|
|
45
|
+
open(): Promise<void>;
|
|
46
|
+
execute(listrTask: {
|
|
47
|
+
output: string;
|
|
48
|
+
}): Promise<boolean>;
|
|
49
|
+
}
|
|
50
|
+
export {};
|