@suitegeezus/suitecloud-stacker 25.2.127
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/.idea/compiler.xml +6 -0
- package/.idea/git_toolbox_blame.xml +6 -0
- package/.idea/git_toolbox_prj.xml +15 -0
- package/.idea/misc.xml +6 -0
- package/.idea/modules.xml +8 -0
- package/.idea/suitecloud-stacker.iml +9 -0
- package/.idea/vcs.xml +6 -0
- package/CONTRIBUTING.md +72 -0
- package/README.md +242 -0
- package/bin/updateModule.d.ts +6 -0
- package/bin/updateModule.js +12 -0
- package/commands/CONTRIBUTING.md +7 -0
- package/commands/accountManageauth.d.ts +93 -0
- package/commands/accountManageauth.js +228 -0
- package/commands/accountSetup.d.ts +56 -0
- package/commands/accountSetup.js +218 -0
- package/commands/customhook/compiless.d.ts +10 -0
- package/commands/customhook/compiless.js +46 -0
- package/commands/customhook/watchss.d.ts +14 -0
- package/commands/customhook/watchss.js +77 -0
- package/commands/fileImport.d.ts +31 -0
- package/commands/fileImport.js +503 -0
- package/commands/fileList.d.ts +19 -0
- package/commands/fileList.js +40 -0
- package/commands/fileUpload.d.ts +52 -0
- package/commands/fileUpload.js +355 -0
- package/commands/generic.d.ts +5 -0
- package/commands/generic.js +13 -0
- package/commands/objectImport.d.ts +32 -0
- package/commands/objectImport.js +287 -0
- package/commands/objectList.d.ts +13 -0
- package/commands/objectList.js +78 -0
- package/commands/projectCreate.d.ts +31 -0
- package/commands/projectCreate.js +506 -0
- package/commands/projectDeploy.d.ts +25 -0
- package/commands/projectDeploy.js +371 -0
- package/commands/projectPackage.d.ts +10 -0
- package/commands/projectPackage.js +32 -0
- package/commands/projectValidate.d.ts +21 -0
- package/commands/projectValidate.js +112 -0
- package/commands/sdfAcs_authmap.d.ts +15 -0
- package/commands/sdfAcs_authmap.js +26 -0
- package/commands/sdfAcs_clean.d.ts +20 -0
- package/commands/sdfAcs_clean.js +22 -0
- package/deleteManifest.cjs +11 -0
- package/demo.md +26 -0
- package/index.d.ts +284 -0
- package/lib/MakeJestTestsFromDeploy.d.ts +13 -0
- package/lib/MakeJestTestsFromDeploy.js +60 -0
- package/lib/addGitKeep.d.ts +5 -0
- package/lib/addGitKeep.js +40 -0
- package/lib/addSdfObjectDirs.d.ts +5 -0
- package/lib/addSdfObjectDirs.js +16 -0
- package/lib/callCli.d.ts +7 -0
- package/lib/callCli.js +26 -0
- package/lib/compileHelper.d.ts +44 -0
- package/lib/compileHelper.js +196 -0
- package/lib/deleteProjectJson.d.ts +6 -0
- package/lib/deleteProjectJson.js +16 -0
- package/lib/deployFileHelper.d.ts +77 -0
- package/lib/deployFileHelper.js +249 -0
- package/lib/handleRootProjectJson.d.ts +10 -0
- package/lib/handleRootProjectJson.js +30 -0
- package/lib/isProd.d.ts +9 -0
- package/lib/isProd.js +13 -0
- package/lib/logHelper.d.ts +5 -0
- package/lib/logHelper.js +13 -0
- package/lib/logger.d.ts +6 -0
- package/lib/logger.js +10 -0
- package/lib/makeDeployXml.d.ts +6 -0
- package/lib/makeDeployXml.js +30 -0
- package/lib/makeJest.d.ts +12 -0
- package/lib/makeJest.js +58 -0
- package/lib/makeManifestXml.d.ts +6 -0
- package/lib/makeManifestXml.js +21 -0
- package/lib/makeProjectJson.d.ts +6 -0
- package/lib/makeProjectJson.js +16 -0
- package/lib/onErrorHelper.d.ts +31 -0
- package/lib/onErrorHelper.js +93 -0
- package/lib/pathHelpers.d.ts +133 -0
- package/lib/pathHelpers.js +428 -0
- package/lib/pause.d.ts +6 -0
- package/lib/pause.js +10 -0
- package/lib/projectJsonHelpers.d.ts +29 -0
- package/lib/projectJsonHelpers.js +92 -0
- package/lib/promptHelpers.d.ts +77 -0
- package/lib/promptHelpers.js +195 -0
- package/lib/removeFiles.d.ts +20 -0
- package/lib/removeFiles.js +46 -0
- package/lib/sdf.d.ts +11 -0
- package/lib/sdf.js +158 -0
- package/lib/spawnSuitecloudChild.d.ts +30 -0
- package/lib/spawnSuitecloudChild.js +88 -0
- package/lib/switchAuth.d.ts +17 -0
- package/lib/switchAuth.js +23 -0
- package/lib/tempFileHelper.d.ts +29 -0
- package/lib/tempFileHelper.js +70 -0
- package/lib/updateModule.d.ts +10 -0
- package/lib/updateModule.js +79 -0
- package/lib/validators.d.ts +12 -0
- package/lib/validators.js +25 -0
- package/package.json +38 -0
- package/safeCommands.d.ts +95 -0
- package/safeCommands.js +959 -0
- package/sdf.config.js +15 -0
- package/sdf.exe.js +16 -0
- package/templates/customizations.projectroot.d.ts +74 -0
- package/templates/makeModuleTypeDef.d.ts +5 -0
- package/templates/makeModuleTypeDef.js +29 -0
- package/templates/sdfGitIgnore.txt +42 -0
- package/templates/suitecloud.config.js +17 -0
- package/templates/tsconfig.ss21.projectroot.json +64 -0
- package/types/colors.d.ts +43 -0
|
@@ -0,0 +1,287 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* @file /Users/geraldgillespie/code/nsaccounts/sdf/commands/objectImport
|
|
4
|
+
* @author Gerald Gillespie <gerald.gillespie@fullscript.com>
|
|
5
|
+
*/
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
exports.createObjectsDir = exports.importGlobOrXml = exports.fixObjectImportPaths = exports.forceTypeAll = exports.forceDestination = void 0;
|
|
8
|
+
const fs = require("node:fs/promises");
|
|
9
|
+
const nodePath = require("node:path");
|
|
10
|
+
const promptHelpers_1 = require("../lib/promptHelpers");
|
|
11
|
+
const onErrorHelper = require("../lib/onErrorHelper");
|
|
12
|
+
const spawnSuitecloud = require("../lib/spawnSuitecloudChild");
|
|
13
|
+
const tempFileHelper = require("../lib/tempFileHelper");
|
|
14
|
+
const minimatch_1 = require("minimatch");
|
|
15
|
+
/**
|
|
16
|
+
* @description - the createObjectsDir job can organize them automatically and compliments this well
|
|
17
|
+
* @requires createObjectsDir
|
|
18
|
+
*/
|
|
19
|
+
const forceDestination = () => {
|
|
20
|
+
const origin = 'forceDestination';
|
|
21
|
+
return {
|
|
22
|
+
_origin: origin,
|
|
23
|
+
isStackable: true,
|
|
24
|
+
beforeExecuting: async (options) => {
|
|
25
|
+
options.arguments.destinationfolder = '/Objects';
|
|
26
|
+
return options;
|
|
27
|
+
}
|
|
28
|
+
};
|
|
29
|
+
};
|
|
30
|
+
exports.forceDestination = forceDestination;
|
|
31
|
+
/**
|
|
32
|
+
* @description -
|
|
33
|
+
*/
|
|
34
|
+
const forceTypeAll = () => {
|
|
35
|
+
const origin = 'forceTypeAll';
|
|
36
|
+
return {
|
|
37
|
+
_origin: origin,
|
|
38
|
+
isStackable: true,
|
|
39
|
+
beforeExecuting: async (options) => {
|
|
40
|
+
options.arguments.type = options.arguments?.type || 'ALL';
|
|
41
|
+
// change this to a wildcard
|
|
42
|
+
if (typeof options.arguments.scriptid === 'undefined')
|
|
43
|
+
options.arguments.scriptid = [];
|
|
44
|
+
if (options.arguments.scriptid.includes('ALL'))
|
|
45
|
+
options.arguments.scriptid = ['*'];
|
|
46
|
+
return options;
|
|
47
|
+
}
|
|
48
|
+
};
|
|
49
|
+
};
|
|
50
|
+
exports.forceTypeAll = forceTypeAll;
|
|
51
|
+
/**
|
|
52
|
+
* @description - similar tothe fixFileUploadPaths. we need to compare against netsuite
|
|
53
|
+
* Also we don't filter out any files
|
|
54
|
+
*/
|
|
55
|
+
const fixObjectImportPaths = () => {
|
|
56
|
+
const origin = 'fileObjectImportPaths';
|
|
57
|
+
return {
|
|
58
|
+
_origin: origin,
|
|
59
|
+
isStackable: true,
|
|
60
|
+
beforeExecuting: async (options) => {
|
|
61
|
+
if (!Array.isArray(options?.arguments?.scriptid))
|
|
62
|
+
options.arguments.scriptid = [];
|
|
63
|
+
// it is expected that parents will fix any paths before calling
|
|
64
|
+
if (spawnSuitecloud.isChildProcess())
|
|
65
|
+
return options;
|
|
66
|
+
const { projectPath } = options;
|
|
67
|
+
// deal with relative paths, etc 1️⃣
|
|
68
|
+
const objectsAsGlobs = options.arguments.scriptid.map((combo) => {
|
|
69
|
+
const [type, scriptid] = /:/.test(combo)
|
|
70
|
+
? combo.split(':')
|
|
71
|
+
: [
|
|
72
|
+
(options.arguments.type === 'ALL' ? '*' : options.arguments.type),
|
|
73
|
+
combo
|
|
74
|
+
];
|
|
75
|
+
if (typeof scriptid !== 'string')
|
|
76
|
+
throw onErrorHelper.makeError(origin, new Error('You need to specify a type'));
|
|
77
|
+
return [
|
|
78
|
+
type,
|
|
79
|
+
// e.g. ~/Objects/customrecord/custrecord_gg.xml
|
|
80
|
+
scriptid.replace(/^.*?([\*\w]+)(\.xml)?$/, '$1')
|
|
81
|
+
].join('/');
|
|
82
|
+
// TODO: any other patterns?
|
|
83
|
+
}).filter(Boolean);
|
|
84
|
+
// globbing has to be done here before we clean 2️⃣
|
|
85
|
+
const exitCode = await spawnSuitecloud.createAsync({
|
|
86
|
+
command: 'object:list',
|
|
87
|
+
args: [
|
|
88
|
+
// '--scriptid' // no scriptid = all scriptid
|
|
89
|
+
// '--type' // no type = all type
|
|
90
|
+
'--authid', options.arguments.authid
|
|
91
|
+
],
|
|
92
|
+
interact: false,
|
|
93
|
+
});
|
|
94
|
+
if (exitCode !== 0)
|
|
95
|
+
throw onErrorHelper.makeError(origin, new Error('List failed to generate'));
|
|
96
|
+
const jsonList = await tempFileHelper.consumeTempFile(tempFileHelper.FileNames.objectList);
|
|
97
|
+
const { _data: listOfObjects } = JSON.parse(jsonList);
|
|
98
|
+
const tests = objectsAsGlobs.map((glob) => (entry) => {
|
|
99
|
+
// console.log({ entry, glob});
|
|
100
|
+
return (0, minimatch_1.minimatch)(entry, glob);
|
|
101
|
+
});
|
|
102
|
+
const filteredList = new Set();
|
|
103
|
+
await Promise.allSettled(listOfObjects.map(({ type, scriptId }) => {
|
|
104
|
+
const globbed = [type, scriptId].join('/');
|
|
105
|
+
const pass = tests.reduce((answer, test) => (answer || test(globbed)), false);
|
|
106
|
+
if (pass)
|
|
107
|
+
filteredList.add(scriptId);
|
|
108
|
+
}));
|
|
109
|
+
options.arguments.scriptid = [...filteredList];
|
|
110
|
+
// 3️⃣ -- no filtering out here
|
|
111
|
+
return options;
|
|
112
|
+
},
|
|
113
|
+
onError: async (error) => onErrorHelper.detectOriginAndReturn(origin, error, (e) => {
|
|
114
|
+
return e;
|
|
115
|
+
}),
|
|
116
|
+
};
|
|
117
|
+
};
|
|
118
|
+
exports.fixObjectImportPaths = fixObjectImportPaths;
|
|
119
|
+
/**
|
|
120
|
+
* @description - if scriptid is a glob then we need a list so that we can filter it
|
|
121
|
+
* @deprecated - replaced by a better stack
|
|
122
|
+
* @requires saveObjectListToTemp - This requires the object:list task to run this handler
|
|
123
|
+
*
|
|
124
|
+
*/
|
|
125
|
+
const importGlobOrXml = () => {
|
|
126
|
+
const origin = 'importGlobOrXml';
|
|
127
|
+
return {
|
|
128
|
+
_origin: origin,
|
|
129
|
+
isStackable: true,
|
|
130
|
+
beforeExecuting: async (options) => {
|
|
131
|
+
if (options?.arguments?.runhooks === 'quiet')
|
|
132
|
+
return options;
|
|
133
|
+
if (!Array.isArray(options?.arguments?.scriptid))
|
|
134
|
+
options.arguments.scriptid = [];
|
|
135
|
+
const hasRequirements = ['type', 'scriptid', 'destinationfolder'].every((minimum) => {
|
|
136
|
+
return Object.keys(options.arguments).includes(minimum) && !/\*/.test(minimum);
|
|
137
|
+
});
|
|
138
|
+
if (spawnSuitecloud.isChildProcess() || hasRequirements)
|
|
139
|
+
return options;
|
|
140
|
+
const choices = [
|
|
141
|
+
'scriptid / partial scriptid', // deprecated
|
|
142
|
+
'glob of scriptids',
|
|
143
|
+
'a deploy.xml file'
|
|
144
|
+
];
|
|
145
|
+
const nature = /\.xml$/.test(options.arguments.scriptid)
|
|
146
|
+
? choices[2]
|
|
147
|
+
: choices[1];
|
|
148
|
+
if (nature === choices[2]) {
|
|
149
|
+
// prompt for a deploy.xml file choice
|
|
150
|
+
// TODO get this from somewehre else
|
|
151
|
+
// parse the objects out of the xml file
|
|
152
|
+
const filteredObjectsFromXml = [];
|
|
153
|
+
options.arguments.scriptid.push(filteredObjectsFromXml);
|
|
154
|
+
options.arguments.type = 'ALL';
|
|
155
|
+
return options;
|
|
156
|
+
}
|
|
157
|
+
if (nature === choices[0]) {
|
|
158
|
+
let specificId;
|
|
159
|
+
// prompt for clarification
|
|
160
|
+
const nag = async () => {
|
|
161
|
+
specificId = await (0, promptHelpers_1.promptUser)({
|
|
162
|
+
message: 'What Scriptid?'
|
|
163
|
+
});
|
|
164
|
+
};
|
|
165
|
+
while (!specificId || !/^\w+$/.test(specificId)) {
|
|
166
|
+
await nag();
|
|
167
|
+
}
|
|
168
|
+
options.arguments.scriptid.push(specificId);
|
|
169
|
+
options.arguments.type = 'All';
|
|
170
|
+
return options;
|
|
171
|
+
}
|
|
172
|
+
if (nature === choices[1]) {
|
|
173
|
+
const listObjectsAsync = spawnSuitecloud.createAsync({
|
|
174
|
+
command: 'object:list',
|
|
175
|
+
args: [
|
|
176
|
+
/* empty for all */
|
|
177
|
+
'--authid', options.arguments.authid
|
|
178
|
+
],
|
|
179
|
+
interact: false,
|
|
180
|
+
ultraQuiet: true,
|
|
181
|
+
});
|
|
182
|
+
const runGlobJob = async () => {
|
|
183
|
+
let glob;
|
|
184
|
+
glob = [
|
|
185
|
+
(options.arguments.type === 'ALL' ? '*' : options.arguments.type),
|
|
186
|
+
options.arguments.scriptid
|
|
187
|
+
].join('/');
|
|
188
|
+
// wait for it here
|
|
189
|
+
const listJob = await listObjectsAsync;
|
|
190
|
+
// require the temp file
|
|
191
|
+
if (listJob !== 0)
|
|
192
|
+
throw onErrorHelper.makeError(origin, new Error('list failed to run'));
|
|
193
|
+
// pick up the temp file
|
|
194
|
+
const listJson = await tempFileHelper.consumeTempFile(tempFileHelper.FileNames.objectList);
|
|
195
|
+
const { _data: unfilteredList } = JSON.parse(listJson);
|
|
196
|
+
// console.log({listJson, unfilteredList});
|
|
197
|
+
const toDisplay = [];
|
|
198
|
+
unfilteredList.forEach((entry) => {
|
|
199
|
+
if ((0, minimatch_1.minimatch)(entry.scriptId, glob)) {
|
|
200
|
+
options.arguments.type = 'ALL';
|
|
201
|
+
options.arguments.scriptid.push(entry.scriptId);
|
|
202
|
+
toDisplay.push(`${entry.type}:${entry.scriptId}`);
|
|
203
|
+
}
|
|
204
|
+
});
|
|
205
|
+
process.stdout.write((0, promptHelpers_1.goColor)('INFO', '\n', toDisplay.join('\n')));
|
|
206
|
+
const choices = { 'Y': 'Yes', 'N': 'No' };
|
|
207
|
+
let confirm = await (0, promptHelpers_1.promptChoices)({
|
|
208
|
+
choices,
|
|
209
|
+
displayChoices: choices,
|
|
210
|
+
question: 'Are you good with this list?',
|
|
211
|
+
default: 'Y'
|
|
212
|
+
});
|
|
213
|
+
if (confirm === choices['N'])
|
|
214
|
+
options.arguments.scriptid = [];
|
|
215
|
+
// anything other than 'Y' will mean quit
|
|
216
|
+
return options;
|
|
217
|
+
};
|
|
218
|
+
return runGlobJob();
|
|
219
|
+
}
|
|
220
|
+
return options;
|
|
221
|
+
},
|
|
222
|
+
onCompleted: async (options) => {
|
|
223
|
+
console.log({ options });
|
|
224
|
+
return options;
|
|
225
|
+
}
|
|
226
|
+
};
|
|
227
|
+
};
|
|
228
|
+
exports.importGlobOrXml = importGlobOrXml;
|
|
229
|
+
/**
|
|
230
|
+
* @description - Creates an Objects dir. e.g.
|
|
231
|
+
* - check the arguments to import
|
|
232
|
+
* @param {ObjectImportOptions} options
|
|
233
|
+
*/
|
|
234
|
+
const createObjectsDir = () => {
|
|
235
|
+
const origin = 'createObjectsDir';
|
|
236
|
+
return {
|
|
237
|
+
_origin: origin,
|
|
238
|
+
/**
|
|
239
|
+
* @description - creates an objects dir in order to organize the result
|
|
240
|
+
* @param {ObjectImportOptions} options
|
|
241
|
+
* @returns {Promise<ObjectImportOptions>}
|
|
242
|
+
*/
|
|
243
|
+
beforeExecuting: async (options) => {
|
|
244
|
+
if (process.argv.includes('-i'))
|
|
245
|
+
return options;
|
|
246
|
+
if (!Array.isArray(options.arguments.scriptid) && !Array.isArray(options.arguments.type))
|
|
247
|
+
// return immediately which will be an error
|
|
248
|
+
return options;
|
|
249
|
+
console.log((0, promptHelpers_1.goColor)('SUBTLE', { options }, process.argv));
|
|
250
|
+
// a child process will create the dirs
|
|
251
|
+
// const listJob = await spawnSuitecloud.createAsync({
|
|
252
|
+
// command: 'object:list',
|
|
253
|
+
// args: [/* empty for all */],
|
|
254
|
+
// interact: false,
|
|
255
|
+
// })
|
|
256
|
+
// // if success
|
|
257
|
+
// if( listJob !== 0 ) throw onErrorHelper.makeError(origin,new Error('Could not create object folders'));
|
|
258
|
+
return options;
|
|
259
|
+
},
|
|
260
|
+
/**
|
|
261
|
+
* @description -
|
|
262
|
+
* @param options
|
|
263
|
+
*/
|
|
264
|
+
onCompleted: async (options) => {
|
|
265
|
+
console.log({ options });
|
|
266
|
+
const root = JSON.parse(options._commandParameters.project).replace(/^(.*).\bFileCabinet\b.*$/, '$1');
|
|
267
|
+
// now move each
|
|
268
|
+
await Promise.all(options._data.successfulImports.map(async ({ customObject }, i) => {
|
|
269
|
+
const newPaths = ['Objects', customObject.type, `${customObject.id}.xml`];
|
|
270
|
+
if (i === 0)
|
|
271
|
+
process.stdout.write('\nMoving to');
|
|
272
|
+
process.stdout.write((0, promptHelpers_1.goColor)('HIGHLIGHT', `\n~/${newPaths.join('/')}`, false));
|
|
273
|
+
await fs.rename(nodePath.join(root, 'Objects', `${customObject.id}.xml`), nodePath.join(root, ...newPaths)).then(() => console.log('✅'));
|
|
274
|
+
}));
|
|
275
|
+
return options;
|
|
276
|
+
},
|
|
277
|
+
onError: async (error) => {
|
|
278
|
+
return onErrorHelper.detectOriginAndReturn('createObjectDir', error, async (error) => {
|
|
279
|
+
process.stdout.write((0, promptHelpers_1.goColor)('ERROR', '\n', error));
|
|
280
|
+
return error;
|
|
281
|
+
});
|
|
282
|
+
},
|
|
283
|
+
isStackable: true,
|
|
284
|
+
};
|
|
285
|
+
};
|
|
286
|
+
exports.createObjectsDir = createObjectsDir;
|
|
287
|
+
//# sourceMappingURL=objectImport.js.map
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file /Users/geraldgillespie/code/nsaccounts/sdf/commands/objectList
|
|
3
|
+
* @author Gerald Gillespie <gerald.gillespie@fullscript.com>
|
|
4
|
+
*/
|
|
5
|
+
import { SdfCommand } from "#root/index";
|
|
6
|
+
/**
|
|
7
|
+
* @description - create a temp json file with all the objects
|
|
8
|
+
*/
|
|
9
|
+
export declare const saveObjectListToTemp: () => SdfCommand;
|
|
10
|
+
/**
|
|
11
|
+
* @description -
|
|
12
|
+
*/
|
|
13
|
+
export declare const createFoldersForAllTypes: () => SdfCommand;
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createFoldersForAllTypes = exports.saveObjectListToTemp = void 0;
|
|
4
|
+
const promptHelpers = require("../lib/promptHelpers");
|
|
5
|
+
const tempFileHelper = require("../lib/tempFileHelper");
|
|
6
|
+
const fs = require("node:fs/promises");
|
|
7
|
+
const pathHelper = require("../lib/pathHelpers");
|
|
8
|
+
const spawnSuitecloud = require("../lib/spawnSuitecloudChild");
|
|
9
|
+
/**
|
|
10
|
+
* @description - create a temp json file with all the objects
|
|
11
|
+
*/
|
|
12
|
+
const saveObjectListToTemp = () => {
|
|
13
|
+
const origin = 'saveObjectListToTemp';
|
|
14
|
+
return {
|
|
15
|
+
_origin: origin,
|
|
16
|
+
isStackable: true,
|
|
17
|
+
beforeExecuting: async (options) => {
|
|
18
|
+
return options;
|
|
19
|
+
},
|
|
20
|
+
onCompleted: async (options) => {
|
|
21
|
+
// allow both child and parent processes to do this
|
|
22
|
+
process.stdout.write(promptHelpers.goColor('SUBTLE', '\n', origin, ': ', options));
|
|
23
|
+
await tempFileHelper.makeTempFile(tempFileHelper.FileNames.objectList, JSON.stringify(options, null, 2));
|
|
24
|
+
return options;
|
|
25
|
+
}
|
|
26
|
+
};
|
|
27
|
+
};
|
|
28
|
+
exports.saveObjectListToTemp = saveObjectListToTemp;
|
|
29
|
+
/**
|
|
30
|
+
* @description -
|
|
31
|
+
*/
|
|
32
|
+
const createFoldersForAllTypes = () => {
|
|
33
|
+
const origin = 'createFoldersForAllTypes';
|
|
34
|
+
let isQuiet = false;
|
|
35
|
+
return {
|
|
36
|
+
_origin: origin,
|
|
37
|
+
isStackable: true,
|
|
38
|
+
beforeExecuting: async (options) => {
|
|
39
|
+
isQuiet = options?.arguments?.runhooks === 'quiet';
|
|
40
|
+
return options;
|
|
41
|
+
},
|
|
42
|
+
onCompleted: async (options) => {
|
|
43
|
+
// make the folders
|
|
44
|
+
if (Array.isArray(options._data)) {
|
|
45
|
+
let answer = 'Yes';
|
|
46
|
+
if (!spawnSuitecloud.isChildProcess() && !isQuiet) {
|
|
47
|
+
const choices = { 'Y': 'Yes', 'N': 'No' };
|
|
48
|
+
answer = await promptHelpers.promptChoices({
|
|
49
|
+
choices,
|
|
50
|
+
displayChoices: choices,
|
|
51
|
+
default: answer,
|
|
52
|
+
question: `Would you like to create all missing \`Objects\` folders?`
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
console.log({ answer });
|
|
56
|
+
const uniqueTypes = new Set();
|
|
57
|
+
options._data.forEach(({ type }) => uniqueTypes.add(type));
|
|
58
|
+
if (answer === 'Yes')
|
|
59
|
+
await Promise.allSettled([...uniqueTypes].map(async (type) => {
|
|
60
|
+
const pathToCheck = await pathHelper.getAccountDir('Objects', [type]);
|
|
61
|
+
const exists = await fs.access(pathToCheck)
|
|
62
|
+
.then(() => true)
|
|
63
|
+
.catch(() => false);
|
|
64
|
+
if (!exists) {
|
|
65
|
+
await fs.mkdir(pathToCheck, { recursive: true });
|
|
66
|
+
// write empty file
|
|
67
|
+
process.stdout.write(promptHelpers.goColor('INFO', '\nCreating ', pathToCheck.replace(/^.*(\bObjects.*)$/, '~/$1')));
|
|
68
|
+
const writePath = await pathHelper.getAccountDir('Objects', [type, '.gitKeep']);
|
|
69
|
+
await fs.writeFile(writePath, '');
|
|
70
|
+
}
|
|
71
|
+
}));
|
|
72
|
+
}
|
|
73
|
+
return options;
|
|
74
|
+
}
|
|
75
|
+
};
|
|
76
|
+
};
|
|
77
|
+
exports.createFoldersForAllTypes = createFoldersForAllTypes;
|
|
78
|
+
//# sourceMappingURL=objectList.js.map
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file
|
|
3
|
+
* @author
|
|
4
|
+
*/
|
|
5
|
+
import { SdfCommand } from "#root/index";
|
|
6
|
+
/**
|
|
7
|
+
* @description - For an existing mini-project. Use the 'project:create' command as a way to switch accounts
|
|
8
|
+
* Assumes the following:
|
|
9
|
+
* - you have a subdirectory called "deploy"
|
|
10
|
+
* - uses local project.json permuations as a configuration file from that
|
|
11
|
+
* @param {root: string} [opts]
|
|
12
|
+
*/
|
|
13
|
+
export declare const projectJsonPromptAndEscape: (opts?: {
|
|
14
|
+
root?: string;
|
|
15
|
+
}) => SdfCommand;
|
|
16
|
+
/**
|
|
17
|
+
* @description - For setting up a new account on your machine
|
|
18
|
+
* # Restrictions
|
|
19
|
+
* - Account must have a name that matches a certain name format
|
|
20
|
+
*
|
|
21
|
+
* @param opts
|
|
22
|
+
* @returns {any}
|
|
23
|
+
*/
|
|
24
|
+
export declare const newAccount: (opts: {
|
|
25
|
+
root: string;
|
|
26
|
+
}) => any;
|
|
27
|
+
/**
|
|
28
|
+
* @description - hi
|
|
29
|
+
*
|
|
30
|
+
*/
|
|
31
|
+
export declare const rootProjectChoices: () => SdfCommand;
|