@xylabs/ts-scripts-yarn3 2.7.0-rc.35 → 2.7.0-rc.36

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/lib/xy.ts CHANGED
@@ -63,14 +63,12 @@ export const parseOptions = async () => {
63
63
  description: 'Profile action',
64
64
  type: 'boolean',
65
65
  })
66
- .parse()
67
66
  }
68
67
 
69
68
  export const xy = async (extend: (yargs: Argv) => Promise<Argv> | Argv = (yargs) => yargs) => {
70
- const yargsInstance = yargs(hideBin(process.argv))
71
69
  const options = await parseOptions()
72
70
  const x = await extend(
73
- yargsInstance
71
+ options
74
72
  .command(
75
73
  'build [package]',
76
74
  'Build - Compile & Lint',
@@ -80,8 +78,8 @@ export const xy = async (extend: (yargs: Argv) => Promise<Argv> | Argv = (yargs)
80
78
  })
81
79
  },
82
80
  (argv) => {
83
- if (options.verbose) console.info(`Building: ${argv.package ?? 'all'}`)
84
- process.exitCode = build({ target: options.target as 'esm' | 'cjs' })
81
+ if (argv.verbose) console.info(`Building: ${argv.package ?? 'all'}`)
82
+ process.exitCode = build({ target: argv.target as 'esm' | 'cjs' })
85
83
  },
86
84
  )
87
85
  .command(
@@ -93,8 +91,8 @@ export const xy = async (extend: (yargs: Argv) => Promise<Argv> | Argv = (yargs)
93
91
  })
94
92
  },
95
93
  async (argv) => {
96
- if (options.verbose) console.info(`Compiling: ${argv.package ?? 'all'}`)
97
- process.exitCode = await compile({ target: options.target as 'esm' | 'cjs' })
94
+ if (argv.verbose) console.info(`Compiling: ${argv.package ?? 'all'}`)
95
+ process.exitCode = await compile({ target: argv.target as 'esm' | 'cjs' })
98
96
  },
99
97
  )
100
98
  .command(
@@ -106,7 +104,7 @@ export const xy = async (extend: (yargs: Argv) => Promise<Argv> | Argv = (yargs)
106
104
  })
107
105
  },
108
106
  (argv) => {
109
- if (options.verbose) console.info(`Cleaning: ${argv.package ?? 'all'}`)
107
+ if (argv.verbose) console.info(`Cleaning: ${argv.package ?? 'all'}`)
110
108
  process.exitCode = clean()
111
109
  },
112
110
  )
@@ -119,7 +117,7 @@ export const xy = async (extend: (yargs: Argv) => Promise<Argv> | Argv = (yargs)
119
117
  })
120
118
  },
121
119
  (argv) => {
122
- if (options.verbose) console.info(`License: ${argv.package ?? 'all'}`)
120
+ if (argv.verbose) console.info(`License: ${argv.package ?? 'all'}`)
123
121
  process.exitCode = license()
124
122
  },
125
123
  )
@@ -132,8 +130,8 @@ export const xy = async (extend: (yargs: Argv) => Promise<Argv> | Argv = (yargs)
132
130
  })
133
131
  },
134
132
  (argv) => {
135
- if (options.verbose) console.info(`Copying Assets: ${argv.package ?? 'all'}`)
136
- process.exitCode = copyAssets({ target: options.target as 'esm' | 'cjs' })
133
+ if (argv.verbose) console.info(`Copying Assets: ${argv.package ?? 'all'}`)
134
+ process.exitCode = copyAssets({ target: argv.target as 'esm' | 'cjs' })
137
135
  },
138
136
  )
139
137
  .command(
@@ -144,8 +142,8 @@ export const xy = async (extend: (yargs: Argv) => Promise<Argv> | Argv = (yargs)
144
142
  describe: 'Specific package to check',
145
143
  })
146
144
  },
147
- () => {
148
- if (options.verbose) console.info('Cycle')
145
+ (argv) => {
146
+ if (argv.verbose) console.info('Cycle')
149
147
  process.exitCode = cycle()
150
148
  },
151
149
  )
@@ -157,8 +155,8 @@ export const xy = async (extend: (yargs: Argv) => Promise<Argv> | Argv = (yargs)
157
155
  describe: 'Specific package to check',
158
156
  })
159
157
  },
160
- () => {
161
- if (options.verbose) console.info('Dead')
158
+ (argv) => {
159
+ if (argv.verbose) console.info('Dead')
162
160
  process.exitCode = dead()
163
161
  },
164
162
  )
@@ -170,9 +168,9 @@ export const xy = async (extend: (yargs: Argv) => Promise<Argv> | Argv = (yargs)
170
168
  describe: 'Specific package to check',
171
169
  })
172
170
  },
173
- () => {
174
- if (options.verbose) console.info('Lint')
175
- process.exitCode = options.fix ? fix() : options.profile ? lintProfile() : options.cache ? lintFast() : lint()
171
+ (argv) => {
172
+ if (argv.verbose) console.info('Lint')
173
+ process.exitCode = argv.fix ? fix() : argv.profile ? lintProfile() : argv.cache ? lintFast() : lint()
176
174
  },
177
175
  )
178
176
  .command(
@@ -183,8 +181,8 @@ export const xy = async (extend: (yargs: Argv) => Promise<Argv> | Argv = (yargs)
183
181
  describe: 'Specific package to check',
184
182
  })
185
183
  },
186
- () => {
187
- if (options.verbose) console.info('Fix')
184
+ (argv) => {
185
+ if (argv.verbose) console.info('Fix')
188
186
  process.exitCode = fix()
189
187
  },
190
188
  )
@@ -196,8 +194,8 @@ export const xy = async (extend: (yargs: Argv) => Promise<Argv> | Argv = (yargs)
196
194
  describe: 'Specific package to check',
197
195
  })
198
196
  },
199
- () => {
200
- if (options.verbose) console.info('Deps')
197
+ (argv) => {
198
+ if (argv.verbose) console.info('Deps')
201
199
  process.exitCode = deps()
202
200
  },
203
201
  )
@@ -209,8 +207,8 @@ export const xy = async (extend: (yargs: Argv) => Promise<Argv> | Argv = (yargs)
209
207
  describe: 'Specific package to generate docs for',
210
208
  })
211
209
  },
212
- () => {
213
- if (options.verbose) console.info('Deps')
210
+ (argv) => {
211
+ if (argv.verbose) console.info('Deps')
214
212
  process.exitCode = genDocs()
215
213
  },
216
214
  )
@@ -220,9 +218,9 @@ export const xy = async (extend: (yargs: Argv) => Promise<Argv> | Argv = (yargs)
220
218
  (yargs) => {
221
219
  return yargs
222
220
  },
223
- () => {
224
- if (options.verbose) console.info('Gitlint')
225
- process.exitCode = options.fix ? gitlintFix() : gitlint()
221
+ (argv) => {
222
+ if (argv.verbose) console.info('Gitlint')
223
+ process.exitCode = argv.fix ? gitlintFix() : gitlint()
226
224
  },
227
225
  )
228
226
  .command(
@@ -233,9 +231,9 @@ export const xy = async (extend: (yargs: Argv) => Promise<Argv> | Argv = (yargs)
233
231
  describe: 'Specific package to rebuild',
234
232
  })
235
233
  },
236
- () => {
237
- if (options.verbose) console.info(`Rebuilding: ${options.package ?? 'all'}`)
238
- process.exitCode = rebuild({ target: options.target as 'esm' | 'cjs' })
234
+ (argv) => {
235
+ if (argv.verbose) console.info(`Rebuilding: ${argv.package ?? 'all'}`)
236
+ process.exitCode = rebuild({ target: argv.target as 'esm' | 'cjs' })
239
237
  },
240
238
  )
241
239
  .command(
@@ -246,8 +244,8 @@ export const xy = async (extend: (yargs: Argv) => Promise<Argv> | Argv = (yargs)
246
244
  describe: 'Specific package to relint',
247
245
  })
248
246
  },
249
- () => {
250
- if (options.verbose) console.info('Relinting')
247
+ (argv) => {
248
+ if (argv.verbose) console.info('Relinting')
251
249
  process.exitCode = relint()
252
250
  },
253
251
  )
@@ -257,8 +255,8 @@ export const xy = async (extend: (yargs: Argv) => Promise<Argv> | Argv = (yargs)
257
255
  (yargs) => {
258
256
  return yargs
259
257
  },
260
- () => {
261
- if (options.verbose) console.info('Reinstalling')
258
+ (argv) => {
259
+ if (argv.verbose) console.info('Reinstalling')
262
260
  process.exitCode = reinstall()
263
261
  },
264
262
  )
@@ -268,8 +266,8 @@ export const xy = async (extend: (yargs: Argv) => Promise<Argv> | Argv = (yargs)
268
266
  (yargs) => {
269
267
  return yargs
270
268
  },
271
- () => {
272
- if (options.verbose) console.info('Sonar Check')
269
+ (argv) => {
270
+ if (argv.verbose) console.info('Sonar Check')
273
271
  process.exitCode = sonar()
274
272
  },
275
273
  )
@@ -279,8 +277,8 @@ export const xy = async (extend: (yargs: Argv) => Promise<Argv> | Argv = (yargs)
279
277
  (yargs) => {
280
278
  return yargs
281
279
  },
282
- () => {
283
- if (options.verbose) console.info('Testing')
280
+ (argv) => {
281
+ if (argv.verbose) console.info('Testing')
284
282
  process.exitCode = test()
285
283
  },
286
284
  )
@@ -292,9 +290,9 @@ export const xy = async (extend: (yargs: Argv) => Promise<Argv> | Argv = (yargs)
292
290
  describe: 'Specific package for generation',
293
291
  })
294
292
  },
295
- () => {
296
- if (options.verbose) console.info(`TsconfigGen: ${options.package ?? 'all'}`)
297
- process.exitCode = tsconfigGen({ target: options.target as 'esm' | 'cjs' })
293
+ (argv) => {
294
+ if (argv.verbose) console.info(`TsconfigGen: ${argv.package ?? 'all'}`)
295
+ process.exitCode = tsconfigGen({ target: argv.target as 'esm' | 'cjs' })
298
296
  },
299
297
  )
300
298
  .command(
@@ -303,8 +301,8 @@ export const xy = async (extend: (yargs: Argv) => Promise<Argv> | Argv = (yargs)
303
301
  (yargs) => {
304
302
  return yargs
305
303
  },
306
- () => {
307
- if (options.verbose) console.info('Tsconfig Clean')
304
+ (argv) => {
305
+ if (argv.verbose) console.info('Tsconfig Clean')
308
306
  process.exitCode = tsconfigGenClean()
309
307
  },
310
308
  )
@@ -314,8 +312,8 @@ export const xy = async (extend: (yargs: Argv) => Promise<Argv> | Argv = (yargs)
314
312
  (yargs) => {
315
313
  return yargs
316
314
  },
317
- () => {
318
- if (options.verbose) console.info('Up')
315
+ (argv) => {
316
+ if (argv.verbose) console.info('Up')
319
317
  process.exitCode = up()
320
318
  },
321
319
  )
@@ -325,8 +323,8 @@ export const xy = async (extend: (yargs: Argv) => Promise<Argv> | Argv = (yargs)
325
323
  (yargs) => {
326
324
  return yargs
327
325
  },
328
- () => {
329
- if (options.verbose) console.info('Updo')
326
+ (argv) => {
327
+ if (argv.verbose) console.info('Updo')
330
328
  process.exitCode = updo()
331
329
  },
332
330
  )
@@ -336,8 +334,8 @@ export const xy = async (extend: (yargs: Argv) => Promise<Argv> | Argv = (yargs)
336
334
  (yargs) => {
337
335
  return yargs
338
336
  },
339
- () => {
340
- if (options.verbose) console.info('Yarn 3 Check')
337
+ (argv) => {
338
+ if (argv.verbose) console.info('Yarn 3 Check')
341
339
  process.exitCode = yarn3Only()
342
340
  },
343
341
  ),