@ds-sfdc/sfparty 1.3.7 → 1.3.9

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/src/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env node
2
2
  'use strict'
3
- import { exec, spawnSync } from 'child_process'
3
+ import { spawnSync } from 'child_process'
4
4
  import { readFileSync } from 'fs'
5
5
  import path from 'path'
6
6
  import yargs from 'yargs'
@@ -11,7 +11,7 @@ import convertHrtime from 'convert-hrtime'
11
11
  import axios from 'axios'
12
12
  import { marked } from 'marked'
13
13
  import markedTerminal from 'marked-terminal'
14
- import * as pkgObj from '../package.json' assert { type: "json" }
14
+ import pkgObj from './lib/pkgObj.cjs'
15
15
  import * as fileUtils from './lib/fileUtils.js'
16
16
  import * as yargOptions from './meta/yargs.js'
17
17
  import * as metadataSplit from './party/split.js'
@@ -26,638 +26,818 @@ import * as git from './lib/gitUtils.js'
26
26
  const processStartTime = process.hrtime.bigint()
27
27
 
28
28
  marked.setOptions({
29
- // Define custom renderer
30
- renderer: new markedTerminal
29
+ // Define custom renderer
30
+ renderer: new markedTerminal(),
31
31
  })
32
32
 
33
33
  global.__basedir = undefined
34
34
 
35
35
  global.logger = winston.createLogger({
36
- levels: {
37
- error: 0,
38
- warn: 1,
39
- info: 2,
40
- http: 3,
41
- verbose: 4,
42
- debug: 5,
43
- silly: 6
44
- },
45
- format: winston.format.cli(),
46
- defaultMeta: { service: 'sfparty' },
47
- transports: [
48
- new winston.transports.Console(),
49
- ],
36
+ levels: {
37
+ error: 0,
38
+ warn: 1,
39
+ info: 2,
40
+ http: 3,
41
+ verbose: 4,
42
+ debug: 5,
43
+ silly: 6,
44
+ },
45
+ format: winston.format.cli(),
46
+ defaultMeta: { service: 'sfparty' },
47
+ transports: [new winston.transports.Console()],
50
48
  })
51
49
 
52
50
  global.icons = {
53
- "warn": '🔕',
54
- "success": clc.greenBright('✔'),
55
- "fail": '❗',
56
- "working": '⏳',
57
- "party": '🎉',
58
- "delete": '❌💀❌',
51
+ warn: '🔕',
52
+ success: clc.greenBright('✔'),
53
+ fail: '❗',
54
+ working: '⏳',
55
+ party: '🎉',
56
+ delete: '❌💀❌',
59
57
  }
60
58
 
61
59
  global.displayError = (error, quit = false) => {
62
- global.logger.error(error)
63
- console.info(error)
64
- if (quit) process.exit(1)
60
+ global.logger.error(error)
61
+ console.info(error)
62
+ if (quit) process.exit(1)
65
63
  }
66
64
 
67
- const typeArray = [
68
- 'label',
69
- 'profile',
70
- 'permset',
71
- 'workflow',
72
- ]
65
+ const typeArray = ['label', 'profile', 'permset', 'workflow']
73
66
 
74
67
  global.git = {
75
- enabled: false,
76
- last: undefined,
77
- latest: undefined,
78
- append: false,
79
- delta: false,
68
+ enabled: false,
69
+ last: undefined,
70
+ latest: undefined,
71
+ append: false,
72
+ delta: false,
80
73
  }
81
74
 
82
75
  global.metaTypes = {
83
- label: {
84
- type: labelDefinition.metadataDefinition.filetype,
85
- definition: labelDefinition.metadataDefinition,
86
- add: { files: [], directories: [] },
87
- remove: { files: [], directories: [] },
88
- },
89
- profile: {
90
- type: profileDefinition.metadataDefinition.filetype,
91
- definition: profileDefinition.metadataDefinition,
92
- add: { files: [], directories: [] },
93
- remove: { files: [], directories: [] },
94
- },
95
- permset: {
96
- type: permsetDefinition.metadataDefinition.filetype,
97
- definition: permsetDefinition.metadataDefinition,
98
- add: { files: [], directories: [] },
99
- remove: { files: [], directories: [] },
100
- },
101
- workflow: {
102
- type: workflowDefinition.metadataDefinition.filetype,
103
- definition: workflowDefinition.metadataDefinition,
104
- add: { files: [], directories: [] },
105
- remove: { files: [], directories: [] },
106
- },
76
+ label: {
77
+ type: labelDefinition.metadataDefinition.filetype,
78
+ definition: labelDefinition.metadataDefinition,
79
+ add: { files: [], directories: [] },
80
+ remove: { files: [], directories: [] },
81
+ },
82
+ profile: {
83
+ type: profileDefinition.metadataDefinition.filetype,
84
+ definition: profileDefinition.metadataDefinition,
85
+ add: { files: [], directories: [] },
86
+ remove: { files: [], directories: [] },
87
+ },
88
+ permset: {
89
+ type: permsetDefinition.metadataDefinition.filetype,
90
+ definition: permsetDefinition.metadataDefinition,
91
+ add: { files: [], directories: [] },
92
+ remove: { files: [], directories: [] },
93
+ },
94
+ workflow: {
95
+ type: workflowDefinition.metadataDefinition.filetype,
96
+ definition: workflowDefinition.metadataDefinition,
97
+ add: { files: [], directories: [] },
98
+ remove: { files: [], directories: [] },
99
+ },
107
100
  }
108
101
 
109
-
110
102
  let types = []
111
103
  const packageDir = getRootPath()
112
104
 
113
- let errorMessage = clc.red('Please specify the action of ' + clc.whiteBright.bgRedBright('split') + ' or ' + clc.whiteBright.bgRedBright('combine') + '.')
105
+ let errorMessage = clc.red(
106
+ 'Please specify the action of ' +
107
+ clc.whiteBright.bgRedBright('split') +
108
+ ' or ' +
109
+ clc.whiteBright.bgRedBright('combine') +
110
+ '.',
111
+ )
114
112
 
115
113
  displayHeader() // display header mast
116
114
 
117
115
  yargs(hideBin(process.argv))
118
- .command({
119
- command: 'help',
120
- alias: 'h',
121
- handler: (argv) => {
122
- const data = readFileSync(path.join(process.cwd(), 'README.md'), "utf8")
123
- console.log(marked(data))
124
- }
125
- })
126
- .command({
127
- command: '[test]',
128
- alias: 'test',
129
- handler: (argv) => {
130
- // THIS IS A PLACE TO TEST NEW CODE
131
- global.logger.info(clc.magentaBright(`${global.icons.party} TEST ${global.icons.party}`))
132
- }
133
- })
134
- .command({
135
- command: '[update]',
136
- alias: 'update',
137
- builder: (yargs) => {
138
- yargs
139
- .check(yargCheck)
140
- },
141
- handler: (argv) => {
142
- checkVersion({axios, spawnSync, currentVersion: pkgObj.default.version, update: true})
143
- }
144
- })
145
- .command({
146
- command: '[version]',
147
- alias: 'version',
148
- builder: (yargs) => {
149
- yargs
150
- .check(yargCheck)
151
- },
152
- })
153
- .command({
154
- command: '[split]',
155
- alias: 'split',
156
- description: 'splits metadata xml to yaml/json files',
157
- builder: (yargs) => {
158
- yargs
159
- .example(yargOptions.splitExamples)
160
- .options(yargOptions.splitOptions)
161
- .choices('format', ['json', 'yaml'])
162
- .check(yargCheck)
163
- },
164
- handler: (argv) => {
165
- checkVersion({axios, spawnSync, currentVersion: pkgObj.default.version})
166
- global.format = argv.format
167
- splitHandler(argv, processStartTime)
168
- }
169
- })
170
- .command({
171
- command: '[combine]',
172
- alias: 'combine',
173
- description: 'combines yaml/json files into metadata xml',
174
- builder: (yargs) => {
175
- yargs
176
- .example(yargOptions.combineExamples)
177
- .options(yargOptions.combineOptions)
178
- .choices('format', ['json', 'yaml'])
179
- .check(yargCheck)
180
- },
181
- handler: (argv) => {
182
- checkVersion({axios, spawnSync, currentVersion: pkgObj.default.version})
183
- global.format = argv.format
184
- const startProm = new Promise((resolve, reject) => {
185
- if (argv.git !== undefined) {
186
- let gitRef = argv.git.trim()
187
- global.git.append = argv.append || global.git.append
188
- global.git.delta = argv.delta || global.git.delta
189
- if (argv.git === '') {
190
- const commit = git.lastCommit(global.__basedir, "-1")
191
- commit
192
- .then((data, error) => {
193
- global.git.latest = data.latestCommit
194
- global.git.last = data.lastCommit
195
- if (data.last === undefined) {
196
- console.log(`${clc.yellowBright('git mode')} ${clc.bgMagentaBright('not active:')} no prior commit - processing all`)
197
- resolve(false)
198
- } else {
199
- console.log(`${clc.yellowBright('git mode')} ${clc.magentaBright('active:')} ${clc.bgBlackBright(data.lastCommit) + '..' + clc.bgBlackBright(data.latestCommit)}`)
200
- console.log()
201
- const diff = git.diff(global.__basedir, `${data.lastCommit}..${data.latestCommit}`)
202
- diff
203
- .then((data, error) => {
204
- gitFiles(data)
205
- resolve(true)
206
- })
207
- .catch((error) => {
208
- global.logger.error(error)
209
- reject(error)
210
- })
211
- }
212
- })
213
- .catch((error) => {
214
- global.logger.error(error)
215
- throw error
216
- })
217
- } else {
218
- console.log(`${clc.yellowBright('git mode')} ${clc.magentaBright('active:')} ${clc.bgBlackBright(gitRef)}`)
219
- console.log()
220
- const diff = git.diff(global.__basedir, gitRef)
221
- diff
222
- .then((data, error) => {
223
- gitFiles(data)
224
- resolve(true)
225
- })
226
- .catch((error) => {
227
- global.logger.error(error)
228
- reject(error)
229
- })
230
- }
231
- } else {
232
- resolve(false)
233
- }
234
- })
235
- startProm.then((result) => {
236
- global.git.enabled = result
237
- combineHandler(argv, processStartTime)
238
- })
239
- startProm.catch((error) => {
240
- global.displayError(error, true)
241
- })
242
- }
243
- })
244
- .demandCommand(1, errorMessage)
245
- .example([
246
- ['$0 split --type=profile --all'],
247
- ['$0 split --type=profile --name="Profile Name"'],
248
- ['$0 combine --type=permset --all'],
249
- ['$0 combine --type=permset --name="Permission Set Name"'],
250
- ])
251
- .help(false)
252
- .argv
253
- .parse
116
+ .command({
117
+ command: 'help',
118
+ alias: 'h',
119
+ handler: (argv) => {
120
+ const data = readFileSync(
121
+ path.join(process.cwd(), 'README.md'),
122
+ 'utf8',
123
+ )
124
+ console.log(marked(data))
125
+ },
126
+ })
127
+ .command({
128
+ command: '[test]',
129
+ alias: 'test',
130
+ handler: (argv) => {
131
+ // THIS IS A PLACE TO TEST NEW CODE
132
+ global.logger.info(
133
+ clc.magentaBright(
134
+ `${global.icons.party} TEST ${global.icons.party}`,
135
+ ),
136
+ )
137
+ },
138
+ })
139
+ .command({
140
+ command: '[update]',
141
+ alias: 'update',
142
+ builder: (yargs) => {
143
+ yargs.check(yargCheck)
144
+ },
145
+ handler: (argv) => {
146
+ checkVersion({
147
+ axios,
148
+ spawnSync,
149
+ currentVersion: pkgObj.version,
150
+ update: true,
151
+ })
152
+ },
153
+ })
154
+ .command({
155
+ command: '[version]',
156
+ alias: 'version',
157
+ builder: (yargs) => {
158
+ yargs.check(yargCheck)
159
+ },
160
+ })
161
+ .command({
162
+ command: '[split]',
163
+ alias: 'split',
164
+ description: 'splits metadata xml to yaml/json files',
165
+ builder: (yargs) => {
166
+ yargs
167
+ .example(yargOptions.splitExamples)
168
+ .options(yargOptions.splitOptions)
169
+ .choices('format', ['json', 'yaml'])
170
+ .check(yargCheck)
171
+ },
172
+ handler: (argv) => {
173
+ global.format = argv.format
174
+ splitHandler(argv, processStartTime)
175
+ },
176
+ })
177
+ .command({
178
+ command: '[combine]',
179
+ alias: 'combine',
180
+ description: 'combines yaml/json files into metadata xml',
181
+ builder: (yargs) => {
182
+ yargs
183
+ .example(yargOptions.combineExamples)
184
+ .options(yargOptions.combineOptions)
185
+ .choices('format', ['json', 'yaml'])
186
+ .check(yargCheck)
187
+ },
188
+ handler: (argv) => {
189
+ global.format = argv.format
190
+ const startProm = new Promise((resolve, reject) => {
191
+ if (argv.git !== undefined) {
192
+ let gitRef = argv.git.trim()
193
+ global.git.append = argv.append || global.git.append
194
+ global.git.delta = argv.delta || global.git.delta
195
+ if (argv.git === '') {
196
+ const commit = git.lastCommit(global.__basedir, '-1')
197
+ commit
198
+ .then((data, error) => {
199
+ global.git.latest = data.latestCommit
200
+ global.git.last = data.lastCommit
201
+ if (data.last === undefined) {
202
+ gitMode({ status: 'not active' })
203
+ resolve(false)
204
+ } else {
205
+ gitMode({
206
+ status: 'active',
207
+ lastCommit: data.lastCommit,
208
+ latestCommit: data.latestCommit,
209
+ })
210
+ const diff = git.diff(
211
+ global.__basedir,
212
+ `${data.lastCommit}..${data.latestCommit}`,
213
+ )
214
+ diff.then((data, error) => {
215
+ gitFiles(data)
216
+ resolve(true)
217
+ }).catch((error) => {
218
+ global.logger.error(error)
219
+ reject(error)
220
+ })
221
+ }
222
+ })
223
+ .catch((error) => {
224
+ global.logger.error(error)
225
+ throw error
226
+ })
227
+ } else {
228
+ gitMode({ status: 'active', gitRef })
229
+ const diff = git.diff(global.__basedir, gitRef)
230
+ diff.then((data, error) => {
231
+ gitFiles(data)
232
+ resolve(true)
233
+ }).catch((error) => {
234
+ global.logger.error(error)
235
+ reject(error)
236
+ })
237
+ }
238
+ } else {
239
+ resolve(false)
240
+ }
241
+ })
242
+ startProm.then((result) => {
243
+ global.git.enabled = result
244
+ combineHandler(argv, processStartTime)
245
+ })
246
+ startProm.catch((error) => {
247
+ global.displayError(error, true)
248
+ })
249
+ },
250
+ })
251
+ .demandCommand(1, errorMessage)
252
+ .example([
253
+ ['$0 split --type=profile --all'],
254
+ ['$0 split --type=profile --name="Profile Name"'],
255
+ ['$0 combine --type=permset --all'],
256
+ ['$0 combine --type=permset --name="Permission Set Name"'],
257
+ ])
258
+ .help(false).argv.parse
259
+
260
+ function gitMode({ status, gitRef, lastCommit, latestCommit }) {
261
+ let statusMessage
262
+ let displayMessage
263
+ if (status == 'not active') {
264
+ statusMessage = clc.bgMagentaBright('not active:')
265
+ displayMessage = `no prior commit - processing all`
266
+ } else {
267
+ statusMessage = clc.magentaBright('active:')
268
+ if (gitRef === undefined) {
269
+ displayMessage = `${clc.bgBlackBright(lastCommit) +
270
+ '..' +
271
+ clc.bgBlackBright(latestCommit)
272
+ }`
273
+ } else {
274
+ let delimiter = '..'
275
+
276
+ if (/\s/.test(gitRef)) {
277
+ delimiter = ' '
278
+ }
279
+
280
+ const refArray = gitRef.split(delimiter)
281
+ const updatedArray = refArray.map((item) => clc.bgBlackBright(item))
282
+ displayMessage = updatedArray.join(delimiter)
283
+ }
284
+ }
285
+ console.log(
286
+ `${clc.yellowBright('git mode')} ${statusMessage} ${displayMessage}`,
287
+ )
288
+ console.log()
289
+ }
254
290
 
255
291
  function yargCheck(argv, options) {
256
- const argvKeys = Object.keys(argv)
257
- const invalidKeys = argvKeys.filter(key =>
258
- !['_', '$0'].includes(key) &&
259
- !options.string.includes(key) &&
260
- !options.boolean.includes(key) &&
261
- !options.array.includes(key)
262
- )
263
-
264
- if (!argv._.includes('update')) {
265
- checkVersion({axios, spawnSync, currentVersion: pkgObj.default.version, update: false})
266
- }
267
-
268
- if (invalidKeys.length > 0) {
269
- const invalidKeysWithColor = invalidKeys.map(key => clc.redBright(key))
270
- throw new Error(`Invalid options specified: ${invalidKeysWithColor.join(', ')}`)
271
- }
272
-
273
- const name = argv.name
274
- types = (argv.type !== undefined) ? argv.type.split(',') : typeArray
275
- types.forEach(type => {
276
- type = type.trim()
277
- if (!typeArray.includes(type)) {
278
- throw new Error(`Invalid type: ${type}`)
279
- }
280
- })
281
-
282
- if (types.length > 1) {
283
- // if using multiple types you cannot specify name
284
- if ((typeof name != 'undefined' && name != '')) {
285
- throw new Error(clc.redBright('You cannot specify ' + clc.whiteBright.bgRedBright('--name') + ' when using multiple types.'))
286
- }
287
- } else {
288
- switch (argv.type) {
289
- case 'label':
290
- if ((typeof name != 'undefined' && name != '')) {
291
- throw new Error(clc.redBright('You cannot specify ' + clc.whiteBright.bgRedBright('--name') + ' when using label.'))
292
- }
293
- break
294
- }
295
- }
296
- return true
292
+ const argvKeys = Object.keys(argv)
293
+ const invalidKeys = argvKeys.filter(
294
+ (key) =>
295
+ !['_', '$0'].includes(key) &&
296
+ !options.string.includes(key) &&
297
+ !options.boolean.includes(key) &&
298
+ !options.array.includes(key),
299
+ )
300
+
301
+ if (!argv._.includes('update')) {
302
+ checkVersion({
303
+ axios,
304
+ spawnSync,
305
+ currentVersion: pkgObj.version,
306
+ update: false,
307
+ })
308
+ }
309
+
310
+ if (invalidKeys.length > 0) {
311
+ const invalidKeysWithColor = invalidKeys.map((key) =>
312
+ clc.redBright(key),
313
+ )
314
+ throw new Error(
315
+ `Invalid options specified: ${invalidKeysWithColor.join(', ')}`,
316
+ )
317
+ }
318
+
319
+ const name = argv.name
320
+ types = argv.type !== undefined ? argv.type.split(',') : typeArray
321
+ types.forEach((type) => {
322
+ type = type.trim()
323
+ if (!typeArray.includes(type)) {
324
+ throw new Error(`Invalid type: ${type}`)
325
+ }
326
+ })
327
+
328
+ if (types.length > 1) {
329
+ // if using multiple types you cannot specify name
330
+ if (typeof name != 'undefined' && name != '') {
331
+ throw new Error(
332
+ clc.redBright(
333
+ 'You cannot specify ' +
334
+ clc.whiteBright.bgRedBright('--name') +
335
+ ' when using multiple types.',
336
+ ),
337
+ )
338
+ }
339
+ } else {
340
+ switch (argv.type) {
341
+ case 'label':
342
+ if (typeof name != 'undefined' && name != '') {
343
+ throw new Error(
344
+ clc.redBright(
345
+ 'You cannot specify ' +
346
+ clc.whiteBright.bgRedBright('--name') +
347
+ ' when using label.',
348
+ ),
349
+ )
350
+ }
351
+ break
352
+ }
353
+ }
354
+ return true
297
355
  }
298
356
 
299
357
  function displayMessageAndDuration(startTime, message) {
300
- const diff = process.hrtime.bigint() - BigInt(startTime)
301
- let durationMessage
302
- let executionTime = convertHrtime(diff)
303
- let minutes = Math.floor((executionTime.seconds + Math.round(executionTime.milliseconds / 100000)) / 60)
304
- let seconds = Math.round((executionTime.seconds + Math.round(executionTime.milliseconds / 100000)) % 60)
305
- if (minutes == 0 && seconds == 0) {
306
- durationMessage = message + clc.magentaBright(`<1s`)
307
- } else if (minutes > 0) {
308
- durationMessage = message + clc.magentaBright(`${minutes}m ${seconds}s`)
309
- } else {
310
- durationMessage = message + clc.magentaBright(`${seconds}s`)
311
- }
312
- console.log('\n' + durationMessage)
358
+ const diff = process.hrtime.bigint() - BigInt(startTime)
359
+ let durationMessage
360
+ let executionTime = convertHrtime(diff)
361
+ let minutes = Math.floor(
362
+ (executionTime.seconds +
363
+ Math.round(executionTime.milliseconds / 100000)) /
364
+ 60,
365
+ )
366
+ let seconds = Math.round(
367
+ (executionTime.seconds +
368
+ Math.round(executionTime.milliseconds / 100000)) %
369
+ 60,
370
+ )
371
+ if (minutes == 0 && seconds == 0) {
372
+ durationMessage = message + clc.magentaBright(`<1s`)
373
+ } else if (minutes > 0) {
374
+ durationMessage = message + clc.magentaBright(`${minutes}m ${seconds}s`)
375
+ } else {
376
+ durationMessage = message + clc.magentaBright(`${seconds}s`)
377
+ }
378
+ console.log('\n' + durationMessage)
313
379
  }
314
380
 
315
381
  let callAmount = 0
316
382
  process.on('SIGINT', function () {
317
- if (callAmount < 1) {
318
- console.log(`✅ Received abort command`)
319
- process.exit(1)
320
- }
383
+ if (callAmount < 1) {
384
+ console.log(`✅ Received abort command`)
385
+ process.exit(1)
386
+ }
321
387
 
322
- callAmount++
388
+ callAmount++
323
389
  })
324
390
 
325
391
  function splitHandler(argv, startTime) {
326
- const split = processSplit(types[0], argv)
327
- split.then((resolve) => {
328
- types.shift() // remove first item from array
329
- if (types.length > 0) {
330
- console.log()
331
- splitHandler(argv, startTime)
332
- } else {
333
- if (argv.type === undefined || argv.type.split(',').length > 1) {
334
- let message = `Split completed in `
335
- displayMessageAndDuration(startTime, message)
336
- }
337
- }
338
- })
392
+ const split = processSplit(types[0], argv)
393
+ split.then((resolve) => {
394
+ types.shift() // remove first item from array
395
+ if (types.length > 0) {
396
+ console.log()
397
+ splitHandler(argv, startTime)
398
+ } else {
399
+ if (argv.type === undefined || argv.type.split(',').length > 1) {
400
+ let message = `Split completed in `
401
+ displayMessageAndDuration(startTime, message)
402
+ }
403
+ }
404
+ })
339
405
  }
340
406
 
341
407
  function processSplit(typeItem, argv) {
342
- return new Promise((resolve, reject) => {
343
- const processed = {
344
- total: 0,
345
- errors: 0,
346
- current: 1,
347
- }
348
- const startTime = process.hrtime.bigint()
349
-
350
- if (!typeArray.includes(typeItem)) {
351
- global.logger.error('Metadata type not supported: ' + typeItem)
352
- process.exit(1)
353
- }
354
-
355
- const fileList = []
356
- const typeObj = global.metaTypes[typeItem]
357
- const type = typeObj.type
358
- const metaExtension = `.${type}-meta.xml`
359
-
360
- let sourceDir = argv.source || ''
361
- let targetDir = argv.target || ''
362
- let name = argv.name
363
- let all = (argv.type === undefined || argv.type.split(',').length > 1) ? true : argv.all
364
-
365
- if (type == global.metaTypes.label.type) {
366
- name = global.metaTypes.label.definition.root
367
- }
368
- sourceDir = path.join(global.__basedir, packageDir, 'main', 'default', typeObj.definition.directory)
369
- if (targetDir == '') {
370
- targetDir = path.join(global.__basedir, packageDir + '-party', 'main', 'default', typeObj.definition.directory)
371
- } else {
372
- targetDir = path.join(targetDir, 'main', 'default', typeObj.definition.directory)
373
- }
374
- let metaDirPath = sourceDir
375
-
376
- if (!all) {
377
- let metaFilePath = path.join(metaDirPath, name)
378
- if (!fileUtils.fileExists(metaFilePath)) {
379
- name += metaExtension
380
- metaFilePath = path.join(metaDirPath, name)
381
- if (!fileUtils.fileExists(metaFilePath)) {
382
- global.logger.error('File not found: ' + metaFilePath)
383
- process.exit(1)
384
- }
385
- }
386
- fileList.push(name)
387
- } else {
388
- if (fileUtils.directoryExists(sourceDir)) {
389
- fileUtils.getFiles(sourceDir, metaExtension).forEach(file => {
390
- fileList.push(file)
391
- })
392
- }
393
- }
394
-
395
- processed.total = fileList.length
396
-
397
- if (processed.total == 0) resolve(true)
398
-
399
- console.log(`${clc.bgBlackBright('Source path:')} ${sourceDir}`)
400
- console.log(`${clc.bgBlackBright('Target path:')} ${targetDir}`)
401
- console.log()
402
- console.log(`Splitting a total of ${processed.total} file(s)`)
403
- console.log()
404
-
405
- const promList = []
406
- fileList.forEach(metaFile => {
407
- const metadataItem = new metadataSplit.Split({
408
- metadataDefinition: typeObj.definition,
409
- sourceDir: sourceDir,
410
- targetDir: targetDir,
411
- metaFilePath: path.join(sourceDir, metaFile),
412
- sequence: promList.length + 1,
413
- total: processed.total,
414
- })
415
- const metadataItemProm = metadataItem.split()
416
- promList.push(metadataItemProm)
417
- metadataItemProm.then((resolve, reject) => {
418
- if (resolve == false) {
419
- processed.errors++
420
- processed.current--
421
- } else {
422
- processed.current++
423
- }
424
- })
425
- })
426
- Promise.allSettled(promList).then((results) => {
427
- let message = `Split ${clc.bgBlackBright((processed.current > promList.length) ? promList.length : processed.current)} file(s) ${(processed.errors > 0) ? 'with ' + clc.bgBlackBright.red(processed.errors) + ' error(s) ' : ''}in `
428
- displayMessageAndDuration(startTime, message)
429
- resolve(true)
430
- })
431
- })
408
+ return new Promise((resolve, reject) => {
409
+ const processed = {
410
+ total: 0,
411
+ errors: 0,
412
+ current: 1,
413
+ }
414
+ const startTime = process.hrtime.bigint()
415
+
416
+ if (!typeArray.includes(typeItem)) {
417
+ global.logger.error('Metadata type not supported: ' + typeItem)
418
+ process.exit(1)
419
+ }
420
+
421
+ const fileList = []
422
+ const typeObj = global.metaTypes[typeItem]
423
+ const type = typeObj.type
424
+ const metaExtension = `.${type}-meta.xml`
425
+
426
+ let sourceDir = argv.source || ''
427
+ let targetDir = argv.target || ''
428
+ let name = argv.name
429
+ let all =
430
+ argv.type === undefined || name === undefined ? true : argv.all
431
+
432
+ if (type == global.metaTypes.label.type) {
433
+ name = global.metaTypes.label.definition.root
434
+ }
435
+ sourceDir = path.join(
436
+ global.__basedir,
437
+ packageDir,
438
+ 'main',
439
+ 'default',
440
+ typeObj.definition.directory,
441
+ )
442
+ if (targetDir == '') {
443
+ targetDir = path.join(
444
+ global.__basedir,
445
+ packageDir + '-party',
446
+ 'main',
447
+ 'default',
448
+ typeObj.definition.directory,
449
+ )
450
+ } else {
451
+ targetDir = path.join(
452
+ targetDir,
453
+ 'main',
454
+ 'default',
455
+ typeObj.definition.directory,
456
+ )
457
+ }
458
+ let metaDirPath = sourceDir
459
+
460
+ if (!all) {
461
+ let metaFilePath = path.join(metaDirPath, name)
462
+ if (!fileUtils.fileExists(metaFilePath)) {
463
+ name += metaExtension
464
+ metaFilePath = path.join(metaDirPath, name)
465
+ if (!fileUtils.fileExists(metaFilePath)) {
466
+ global.logger.error('File not found: ' + metaFilePath)
467
+ process.exit(1)
468
+ }
469
+ }
470
+ fileList.push(name)
471
+ } else {
472
+ if (fileUtils.directoryExists(sourceDir)) {
473
+ fileUtils.getFiles(sourceDir, metaExtension).forEach((file) => {
474
+ fileList.push(file)
475
+ })
476
+ }
477
+ }
478
+
479
+ processed.total = fileList.length
480
+
481
+ if (processed.total == 0) resolve(true)
482
+
483
+ console.log(`${clc.bgBlackBright('Source path:')} ${sourceDir}`)
484
+ console.log(`${clc.bgBlackBright('Target path:')} ${targetDir}`)
485
+ console.log()
486
+ console.log(`Splitting a total of ${processed.total} file(s)`)
487
+ console.log()
488
+
489
+ const promList = []
490
+ fileList.forEach((metaFile) => {
491
+ const metadataItem = new metadataSplit.Split({
492
+ metadataDefinition: typeObj.definition,
493
+ sourceDir: sourceDir,
494
+ targetDir: targetDir,
495
+ metaFilePath: path.join(sourceDir, metaFile),
496
+ sequence: promList.length + 1,
497
+ total: processed.total,
498
+ })
499
+ const metadataItemProm = metadataItem.split()
500
+ promList.push(metadataItemProm)
501
+ metadataItemProm.then((resolve, reject) => {
502
+ if (resolve == false) {
503
+ processed.errors++
504
+ processed.current--
505
+ } else {
506
+ processed.current++
507
+ }
508
+ })
509
+ })
510
+ Promise.allSettled(promList).then((results) => {
511
+ let message = `Split ${clc.bgBlackBright(
512
+ processed.current > promList.length
513
+ ? promList.length
514
+ : processed.current,
515
+ )} file(s) ${processed.errors > 0
516
+ ? 'with ' +
517
+ clc.bgBlackBright.red(processed.errors) +
518
+ ' error(s) '
519
+ : ''
520
+ }in `
521
+ displayMessageAndDuration(startTime, message)
522
+ resolve(true)
523
+ })
524
+ })
432
525
  }
433
526
 
434
527
  function combineHandler(argv, startTime) {
435
- const combine = processCombine(types[0], argv)
436
- combine.then((resolve) => {
437
- types.shift() // remove first item from array
438
- if (types.length > 0) {
439
- console.log()
440
- combineHandler(argv, startTime)
441
- } else {
442
- if (global.git.latest !== undefined) {
443
- git.updateLastCommit(global.__basedir, global.git.latest)
444
- }
445
- if (argv.type === undefined || argv.type.split(',').length > 1) {
446
- let message = `Split completed in `
447
- displayMessageAndDuration(startTime, message)
448
- }
449
- }
450
- })
451
- combine.catch((error) => {
452
- throw error
453
- })
454
-
528
+ const combine = processCombine(types[0], argv)
529
+ combine.then((resolve) => {
530
+ types.shift() // remove first item from array
531
+ if (types.length > 0) {
532
+ console.log()
533
+ combineHandler(argv, startTime)
534
+ } else {
535
+ if (global.git.latest !== undefined) {
536
+ git.updateLastCommit(global.__basedir, global.git.latest)
537
+ }
538
+ if (argv.type === undefined || argv.type.split(',').length > 1) {
539
+ let message = `Split completed in `
540
+ displayMessageAndDuration(startTime, message)
541
+ }
542
+ }
543
+ })
544
+ combine.catch((error) => {
545
+ throw error
546
+ })
455
547
  }
456
548
 
457
549
  function processCombine(typeItem, argv) {
458
- return new Promise((resolve, reject) => {
459
- const processed = {
460
- total: 0,
461
- errors: 0,
462
- current: 1,
463
- }
464
- const startTime = process.hrtime.bigint()
465
-
466
- if (!typeArray.includes(typeItem)) {
467
- global.logger.error('Metadata type not supported: ' + typeItem)
468
- process.exit(1)
469
- }
470
-
471
- let processList = []
472
- const typeObj = global.metaTypes[typeItem]
473
- const type = typeObj.type
474
-
475
- let sourceDir = argv.source || ''
476
- let targetDir = argv.target || ''
477
- let name = argv.name
478
- let all = (argv.type === undefined || argv.type.split(',').length > 1) ? true : argv.all
479
- let addManifest = argv.package
480
- let desManifest = argv.destructive
481
-
482
- sourceDir = path.join(global.__basedir, packageDir + '-party', 'main', 'default', typeObj.definition.directory)
483
- if (targetDir == '') {
484
- targetDir = path.join(global.__basedir, packageDir, 'main', 'default', typeObj.definition.directory)
485
- } else {
486
- targetDir = path.join(targetDir, 'main', 'default', typeObj.definition.directory)
487
- }
488
-
489
-
490
-
491
- if (type == global.metaTypes.label.type) {
492
- if (!global.git.enabled || [...new Set([...global.metaTypes[typeItem].add.directories, ...global.metaTypes[typeItem].remove.directories])].includes(global.metaTypes[typeItem].definition.root)) {
493
- processList.push(global.metaTypes.label.definition.root)
494
- }
495
- } else if (!all) {
496
- let metaDirPath = path.join(sourceDir, name)
497
- if (!fileUtils.directoryExists(metaDirPath)) {
498
- global.logger.error('Directory not found: ' + metaDirPath)
499
- process.exit(1)
500
- }
501
- processList.push(name)
502
- } else {
503
- if (global.git.enabled) {
504
- processList = [...new Set([...global.metaTypes[typeItem].add.directories, ...global.metaTypes[typeItem].remove.directories])]
505
- } else {
506
- processList = fileUtils.getDirectories(sourceDir)
507
- }
508
- }
509
-
510
- processed.total = processList.length
511
- console.log(`${clc.bgBlackBright(processed.total)} ${typeItem} file(s) to process`)
512
-
513
- // Abort if there are no files to process
514
- if (processed.total == 0) {
515
- resolve(true)
516
- return
517
- }
518
-
519
- console.log()
520
- console.log(`${clc.bgBlackBright('Source path:')} ${sourceDir}`)
521
- console.log(`${clc.bgBlackBright('Target path:')} ${targetDir}`)
522
- console.log()
523
-
524
- const promList = []
525
- processList.forEach(metaDir => {
526
- const metadataItem = new metadataCombine.Combine({
527
- metadataDefinition: typeObj.definition,
528
- sourceDir: sourceDir,
529
- targetDir: targetDir,
530
- metaDir: metaDir,
531
- sequence: promList.length + 1,
532
- total: processed.total,
533
- addManifest: addManifest,
534
- desManifest: desManifest,
535
- })
536
- const metadataItemProm = metadataItem.combine()
537
- promList.push(metadataItemProm)
538
- metadataItemProm.then((resolve, reject) => {
539
- processed.current++
540
- })
541
- })
542
-
543
- Promise.allSettled(promList).then((results) => {
544
- let successes = 0
545
- let errors = processed.errors++
546
- results.forEach(result => {
547
- if (result.value == true) {
548
- successes++
549
- } else if (result.value == false) {
550
- errors++
551
- }
552
- })
553
- let message = `Combined ${clc.bgBlackBright(successes)} file(s) ${(errors > 0) ? 'with ' + clc.bgBlackBright(errors) + 'error(s) ' : ''}in `
554
- displayMessageAndDuration(startTime, message)
555
- resolve(true)
556
- })
557
- })
550
+ return new Promise((resolve, reject) => {
551
+ const processed = {
552
+ total: 0,
553
+ errors: 0,
554
+ current: 1,
555
+ }
556
+ const startTime = process.hrtime.bigint()
557
+
558
+ if (!typeArray.includes(typeItem)) {
559
+ global.logger.error('Metadata type not supported: ' + typeItem)
560
+ process.exit(1)
561
+ }
562
+
563
+ let processList = []
564
+ const typeObj = global.metaTypes[typeItem]
565
+ const type = typeObj.type
566
+
567
+ let sourceDir = argv.source || ''
568
+ let targetDir = argv.target || ''
569
+ let name = argv.name
570
+ let all =
571
+ argv.type === undefined || name === undefined ? true : argv.all
572
+ let addManifest = argv.package
573
+ let desManifest = argv.destructive
574
+
575
+ sourceDir = path.join(
576
+ global.__basedir,
577
+ packageDir + '-party',
578
+ 'main',
579
+ 'default',
580
+ typeObj.definition.directory,
581
+ )
582
+ if (targetDir == '') {
583
+ targetDir = path.join(
584
+ global.__basedir,
585
+ packageDir,
586
+ 'main',
587
+ 'default',
588
+ typeObj.definition.directory,
589
+ )
590
+ } else {
591
+ targetDir = path.join(
592
+ targetDir,
593
+ 'main',
594
+ 'default',
595
+ typeObj.definition.directory,
596
+ )
597
+ }
598
+
599
+ if (type == global.metaTypes.label.type) {
600
+ if (
601
+ !global.git.enabled ||
602
+ [
603
+ ...new Set([
604
+ ...global.metaTypes[typeItem].add.directories,
605
+ ...global.metaTypes[typeItem].remove.directories,
606
+ ]),
607
+ ].includes(global.metaTypes[typeItem].definition.root)
608
+ ) {
609
+ processList.push(global.metaTypes.label.definition.root)
610
+ }
611
+ } else if (!all) {
612
+ let metaDirPath = path.join(sourceDir, name)
613
+ if (!fileUtils.directoryExists(metaDirPath)) {
614
+ global.logger.error('Directory not found: ' + metaDirPath)
615
+ process.exit(1)
616
+ }
617
+ processList.push(name)
618
+ } else {
619
+ if (global.git.enabled) {
620
+ processList = [
621
+ ...new Set([
622
+ ...global.metaTypes[typeItem].add.directories,
623
+ ...global.metaTypes[typeItem].remove.directories,
624
+ ]),
625
+ ]
626
+ } else {
627
+ processList = fileUtils.getDirectories(sourceDir)
628
+ }
629
+ }
630
+
631
+ processed.total = processList.length
632
+ console.log(
633
+ `${clc.bgBlackBright(
634
+ processed.total,
635
+ )} ${typeItem} file(s) to process`,
636
+ )
637
+
638
+ // Abort if there are no files to process
639
+ if (processed.total == 0) {
640
+ resolve(true)
641
+ return
642
+ }
643
+
644
+ console.log()
645
+ console.log(`${clc.bgBlackBright('Source path:')} ${sourceDir}`)
646
+ console.log(`${clc.bgBlackBright('Target path:')} ${targetDir}`)
647
+ console.log()
648
+
649
+ const promList = []
650
+ processList.forEach((metaDir) => {
651
+ const metadataItem = new metadataCombine.Combine({
652
+ metadataDefinition: typeObj.definition,
653
+ sourceDir: sourceDir,
654
+ targetDir: targetDir,
655
+ metaDir: metaDir,
656
+ sequence: promList.length + 1,
657
+ total: processed.total,
658
+ addManifest: addManifest,
659
+ desManifest: desManifest,
660
+ })
661
+ const metadataItemProm = metadataItem.combine()
662
+ promList.push(metadataItemProm)
663
+ metadataItemProm.then((resolve, reject) => {
664
+ processed.current++
665
+ })
666
+ })
667
+
668
+ Promise.allSettled(promList).then((results) => {
669
+ let successes = 0
670
+ let errors = processed.errors++
671
+ results.forEach((result) => {
672
+ if (result.value == true) {
673
+ successes++
674
+ } else if (result.value == false) {
675
+ errors++
676
+ }
677
+ })
678
+ let message = `Combined ${clc.bgBlackBright(successes)} file(s) ${errors > 0
679
+ ? 'with ' + clc.bgBlackBright(errors) + 'error(s) '
680
+ : ''
681
+ }in `
682
+ displayMessageAndDuration(startTime, message)
683
+ resolve(true)
684
+ })
685
+ })
558
686
  }
559
687
 
560
688
  function gitFiles(data) {
561
- data.forEach(item => {
562
- if (item.path.indexOf(packageDir + '-party/') == 0) {
563
- const pathArray = item.path.split('/')
564
- if (pathArray.length > 3) {
565
- if (getDirectories().includes(pathArray[3])) {
566
- switch (item.action) {
567
- case 'add':
568
- global.metaTypes[getKey(pathArray[3])].add.files.push(path.join(global.__basedir, item.path))
569
- if (!global.metaTypes[getKey(pathArray[3])].add.directories.includes(pathArray[4])) {
570
- global.metaTypes[getKey(pathArray[3])].add.directories.push(pathArray[4])
571
- }
572
- break
573
- case 'delete':
574
- global.metaTypes[getKey(pathArray[3])].remove.files.push(path.join(global.__basedir, item.path))
575
- if (!global.metaTypes[getKey(pathArray[3])].remove.directories.includes(pathArray[4])) {
576
- global.metaTypes[getKey(pathArray[3])].remove.directories.push(pathArray[4])
577
- }
578
- break
579
- }
580
- }
581
- }
582
- }
583
- })
689
+ data.forEach((item) => {
690
+ if (item.path.indexOf(packageDir + '-party/') == 0) {
691
+ const pathArray = item.path.split('/')
692
+ if (pathArray.length > 3) {
693
+ if (getDirectories().includes(pathArray[3])) {
694
+ switch (item.action) {
695
+ case 'add':
696
+ global.metaTypes[
697
+ getKey(pathArray[3])
698
+ ].add.files.push(
699
+ path.join(global.__basedir, item.path),
700
+ )
701
+ if (
702
+ !global.metaTypes[
703
+ getKey(pathArray[3])
704
+ ].add.directories.includes(pathArray[4])
705
+ ) {
706
+ global.metaTypes[
707
+ getKey(pathArray[3])
708
+ ].add.directories.push(pathArray[4])
709
+ }
710
+ break
711
+ case 'delete':
712
+ global.metaTypes[
713
+ getKey(pathArray[3])
714
+ ].remove.files.push(
715
+ path.join(global.__basedir, item.path),
716
+ )
717
+ if (
718
+ !global.metaTypes[
719
+ getKey(pathArray[3])
720
+ ].remove.directories.includes(pathArray[4])
721
+ ) {
722
+ global.metaTypes[
723
+ getKey(pathArray[3])
724
+ ].remove.directories.push(pathArray[4])
725
+ }
726
+ break
727
+ }
728
+ }
729
+ }
730
+ }
731
+ })
584
732
  }
585
733
 
586
734
  function getKey(directory) {
587
- let key = undefined
588
- Object.keys(global.metaTypes).forEach(type => {
589
- if (global.metaTypes[type].definition.directory == directory) {
590
- key = type
591
- }
592
- })
593
- return key
735
+ let key = undefined
736
+ Object.keys(global.metaTypes).forEach((type) => {
737
+ if (global.metaTypes[type].definition.directory == directory) {
738
+ key = type
739
+ }
740
+ })
741
+ return key
594
742
  }
595
743
 
596
744
  function getDirectories() {
597
- const types = []
598
- Object.keys(global.metaTypes).forEach(type => {
599
- try {
600
- types.push(global.metaTypes[type].definition.directory)
601
- } catch (error) {
602
- throw error
603
- }
604
- })
605
- return types
745
+ const types = []
746
+ Object.keys(global.metaTypes).forEach((type) => {
747
+ try {
748
+ types.push(global.metaTypes[type].definition.directory)
749
+ } catch (error) {
750
+ throw error
751
+ }
752
+ })
753
+ return types
606
754
  }
607
755
 
608
756
  function displayHeader() {
609
- const box = {
610
- topLeft: '╭',
611
- topRight: '╮',
612
- bottomLeft: '╰',
613
- bottomRight: '╯',
614
- horizontal: '─',
615
- vertical: '│',
616
- }
617
- let versionString = `sfparty v${pkgObj.default.version}${(process.stdout.columns > pkgObj.default.description.length + 15) ? ' - ' + pkgObj.default.description : ''}`
618
- let titleMessage = `${global.icons.party} ${clc.yellowBright(versionString)} ${global.icons.party}`
619
- titleMessage = titleMessage.padEnd((process.stdout.columns / 2) + versionString.length / 1.65)
620
- titleMessage = titleMessage.padStart(process.stdout.columns)
621
- titleMessage = clc.blackBright(box.vertical) + ' ' + titleMessage + ' ' + clc.blackBright(box.vertical)
622
- console.log(`${clc.blackBright(box.topLeft + box.horizontal.repeat(process.stdout.columns - 2) + box.topRight)}`)
623
- console.log(titleMessage)
624
- console.log(`${clc.blackBright(box.bottomLeft + box.horizontal.repeat(process.stdout.columns - 2) + box.bottomRight)}`)
625
- console.log()
757
+ const box = {
758
+ topLeft: '╭',
759
+ topRight: '╮',
760
+ bottomLeft: '╰',
761
+ bottomRight: '╯',
762
+ horizontal: '─',
763
+ vertical: '│',
764
+ }
765
+ let versionString = `sfparty v${pkgObj.version}${process.stdout.columns > pkgObj.description.length + 15
766
+ ? ' - ' + pkgObj.description
767
+ : ''
768
+ }`
769
+ let titleMessage = `${global.icons.party} ${clc.yellowBright(
770
+ versionString,
771
+ )} ${global.icons.party}`
772
+ titleMessage = titleMessage.padEnd(
773
+ process.stdout.columns / 2 + versionString.length / 1.65,
774
+ )
775
+ titleMessage = titleMessage.padStart(process.stdout.columns)
776
+ titleMessage =
777
+ clc.blackBright(box.vertical) +
778
+ ' ' +
779
+ titleMessage +
780
+ ' ' +
781
+ clc.blackBright(box.vertical)
782
+ console.log(
783
+ `${clc.blackBright(
784
+ box.topLeft +
785
+ box.horizontal.repeat(process.stdout.columns - 2) +
786
+ box.topRight,
787
+ )}`,
788
+ )
789
+ console.log(titleMessage)
790
+ console.log(
791
+ `${clc.blackBright(
792
+ box.bottomLeft +
793
+ box.horizontal.repeat(process.stdout.columns - 2) +
794
+ box.bottomRight,
795
+ )}`,
796
+ )
797
+ console.log()
626
798
  }
627
799
 
628
800
  function getRootPath(packageDir) {
629
- let rootPath = fileUtils.find('sfdx-project.json')
630
- let defaultDir
631
- if (rootPath) {
632
- global.__basedir = fileUtils.fileInfo(rootPath).dirname
633
- let packageJSON
634
- try {
635
- packageJSON = JSON.parse(readFileSync(rootPath))
636
- } catch (error) {
637
- if (error.message.indexOf('JSON at position') > 0) {
638
- global.displayError('sfdx-project.json has invalid JSON', true)
639
- } else {
640
- global.displayError(error, true)
641
- }
642
- }
643
- if (Array.isArray(packageJSON.packageDirectories)) {
644
- packageJSON.packageDirectories.every(directory => {
645
- if (directory.default || packageJSON.packageDirectories.length == 1) defaultDir = directory.path
646
- if (directory == packageDir) {
647
- defaultDir = directory
648
- return false
649
- }
650
- return true
651
- })
652
- }
653
- } else {
654
- global.logger.error('Could not determine base path of Salesforce source directory. No sfdx-project.json found. Please specify a source path or execute from Salesforce project directory.')
655
- process.exit(1)
656
- }
657
- if (packageDir && packageDir != defaultDir) {
658
- global.logger.error('Could not find directory in sfdx-project.json. Please specify a package directory path from the sfdx-project.json file.')
659
- process.exit(1)
660
- }
661
-
662
- return defaultDir
801
+ let rootPath = fileUtils.find('sfdx-project.json')
802
+ let defaultDir
803
+ if (rootPath) {
804
+ global.__basedir = fileUtils.fileInfo(rootPath).dirname
805
+ let packageJSON
806
+ try {
807
+ packageJSON = JSON.parse(readFileSync(rootPath))
808
+ } catch (error) {
809
+ if (error.message.indexOf('JSON at position') > 0) {
810
+ global.displayError('sfdx-project.json has invalid JSON', true)
811
+ } else {
812
+ global.displayError(error, true)
813
+ }
814
+ }
815
+ if (Array.isArray(packageJSON.packageDirectories)) {
816
+ packageJSON.packageDirectories.every((directory) => {
817
+ if (
818
+ directory.default ||
819
+ packageJSON.packageDirectories.length == 1
820
+ )
821
+ defaultDir = directory.path
822
+ if (directory == packageDir) {
823
+ defaultDir = directory
824
+ return false
825
+ }
826
+ return true
827
+ })
828
+ }
829
+ } else {
830
+ global.logger.error(
831
+ 'Could not determine base path of Salesforce source directory. No sfdx-project.json found. Please specify a source path or execute from Salesforce project directory.',
832
+ )
833
+ process.exit(1)
834
+ }
835
+ if (packageDir && packageDir != defaultDir) {
836
+ global.logger.error(
837
+ 'Could not find directory in sfdx-project.json. Please specify a package directory path from the sfdx-project.json file.',
838
+ )
839
+ process.exit(1)
840
+ }
841
+
842
+ return defaultDir
663
843
  }