@xylabs/ts-scripts-yarn3 2.7.6 → 2.7.7

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.
Files changed (48) hide show
  1. package/dist/cjs/actions/deploy-major.d.ts +1 -1
  2. package/dist/cjs/actions/deploy-major.d.ts.map +1 -1
  3. package/dist/cjs/actions/deploy-major.js +1 -1
  4. package/dist/cjs/actions/deploy-major.js.map +1 -1
  5. package/dist/cjs/actions/deploy-minor.d.ts +1 -1
  6. package/dist/cjs/actions/deploy-minor.d.ts.map +1 -1
  7. package/dist/cjs/actions/deploy-minor.js +1 -1
  8. package/dist/cjs/actions/deploy-minor.js.map +1 -1
  9. package/dist/cjs/actions/deploy-next.d.ts +1 -1
  10. package/dist/cjs/actions/deploy-next.d.ts.map +1 -1
  11. package/dist/cjs/actions/deploy-next.js +1 -1
  12. package/dist/cjs/actions/deploy-next.js.map +1 -1
  13. package/dist/cjs/actions/deploy.d.ts +1 -1
  14. package/dist/cjs/actions/deploy.d.ts.map +1 -1
  15. package/dist/cjs/actions/deploy.js +1 -1
  16. package/dist/cjs/actions/deploy.js.map +1 -1
  17. package/dist/cjs/lib/xy.d.ts +24 -4
  18. package/dist/cjs/lib/xy.d.ts.map +1 -1
  19. package/dist/cjs/lib/xy.js +37 -11
  20. package/dist/cjs/lib/xy.js.map +1 -1
  21. package/dist/esm/actions/deploy-major.d.ts +1 -1
  22. package/dist/esm/actions/deploy-major.d.ts.map +1 -1
  23. package/dist/esm/actions/deploy-major.js +1 -1
  24. package/dist/esm/actions/deploy-major.js.map +1 -1
  25. package/dist/esm/actions/deploy-minor.d.ts +1 -1
  26. package/dist/esm/actions/deploy-minor.d.ts.map +1 -1
  27. package/dist/esm/actions/deploy-minor.js +1 -1
  28. package/dist/esm/actions/deploy-minor.js.map +1 -1
  29. package/dist/esm/actions/deploy-next.d.ts +1 -1
  30. package/dist/esm/actions/deploy-next.d.ts.map +1 -1
  31. package/dist/esm/actions/deploy-next.js +1 -1
  32. package/dist/esm/actions/deploy-next.js.map +1 -1
  33. package/dist/esm/actions/deploy.d.ts +1 -1
  34. package/dist/esm/actions/deploy.d.ts.map +1 -1
  35. package/dist/esm/actions/deploy.js +1 -1
  36. package/dist/esm/actions/deploy.js.map +1 -1
  37. package/dist/esm/lib/xy.d.ts +24 -4
  38. package/dist/esm/lib/xy.d.ts.map +1 -1
  39. package/dist/esm/lib/xy.js +36 -10
  40. package/dist/esm/lib/xy.js.map +1 -1
  41. package/dist/tsconfig.build.cjs.tsbuildinfo +1 -1
  42. package/dist/tsconfig.build.esm.tsbuildinfo +1 -1
  43. package/package.json +3 -3
  44. package/src/actions/deploy-major.ts +1 -1
  45. package/src/actions/deploy-minor.ts +1 -1
  46. package/src/actions/deploy-next.ts +1 -1
  47. package/src/actions/deploy.ts +1 -1
  48. package/src/lib/xy.ts +324 -280
package/src/lib/xy.ts CHANGED
@@ -1,4 +1,4 @@
1
- import yargs, { Argv } from 'yargs'
1
+ import yargs from 'yargs'
2
2
  // eslint-disable-next-line import/no-internal-modules
3
3
  import { hideBin } from 'yargs/helpers'
4
4
 
@@ -9,6 +9,10 @@ import {
9
9
  copyAssets,
10
10
  cycle,
11
11
  dead,
12
+ deploy,
13
+ deployMajor,
14
+ deployMinor,
15
+ deployNext,
12
16
  deps,
13
17
  fix,
14
18
  genDocs,
@@ -30,9 +34,8 @@ import {
30
34
  yarn3Only,
31
35
  } from '../actions'
32
36
 
33
- export const parseOptions = async () => {
34
- const yargsInstance = yargs(hideBin(process.argv))
35
- return await yargsInstance
37
+ export const parseOptions = () => {
38
+ return yargs(hideBin(process.argv))
36
39
  .option('verbose', {
37
40
  alias: 'v',
38
41
  default: false,
@@ -65,280 +68,321 @@ export const parseOptions = async () => {
65
68
  })
66
69
  }
67
70
 
68
- export const xy = async (extend: (yargs: Argv) => Promise<Argv> | Argv = (yargs) => yargs) => {
69
- const options = await parseOptions()
70
- const x = await extend(
71
- options
72
- .command(
73
- 'build [package]',
74
- 'Build - Compile & Lint',
75
- (yargs) => {
76
- return yargs.positional('package', {
77
- describe: 'Specific package to build',
78
- })
79
- },
80
- (argv) => {
81
- if (argv.verbose) console.info(`Building: ${argv.package ?? 'all'}`)
82
- process.exitCode = build({ target: argv.target as 'esm' | 'cjs' })
83
- },
84
- )
85
- .command(
86
- 'compile [package]',
87
- 'Compile with Typescript & Copy Images',
88
- (yargs) => {
89
- return yargs.positional('package', {
90
- describe: 'Specific package to compile',
91
- })
92
- },
93
- async (argv) => {
94
- if (argv.verbose) console.info(`Compiling: ${argv.package ?? 'all'}`)
95
- process.exitCode = await compile({ target: argv.target as 'esm' | 'cjs' })
96
- },
97
- )
98
- .command(
99
- 'clean [package]',
100
- 'Clean - Remove intermediate files',
101
- (yargs) => {
102
- return yargs.positional('package', {
103
- describe: 'Specific package to clean',
104
- })
105
- },
106
- (argv) => {
107
- if (argv.verbose) console.info(`Cleaning: ${argv.package ?? 'all'}`)
108
- process.exitCode = clean()
109
- },
110
- )
111
- .command(
112
- 'license [package]',
113
- 'License - Check licenses of dependencies',
114
- (yargs) => {
115
- return yargs.positional('package', {
116
- describe: 'Specific package to check',
117
- })
118
- },
119
- (argv) => {
120
- if (argv.verbose) console.info(`License: ${argv.package ?? 'all'}`)
121
- process.exitCode = license()
122
- },
123
- )
124
- .command(
125
- 'copy-assets [package]',
126
- 'Copy Assets - Copy the assets from src to dist',
127
- (yargs) => {
128
- return yargs.positional('package', {
129
- describe: 'Specific package to copy assets',
130
- })
131
- },
132
- (argv) => {
133
- if (argv.verbose) console.info(`Copying Assets: ${argv.package ?? 'all'}`)
134
- process.exitCode = copyAssets({ target: argv.target as 'esm' | 'cjs' })
135
- },
136
- )
137
- .command(
138
- 'cycle [package]',
139
- 'Cycle - Check for dependency cycles',
140
- (yargs) => {
141
- return yargs.positional('package', {
142
- describe: 'Specific package to check',
143
- })
144
- },
145
- (argv) => {
146
- if (argv.verbose) console.info('Cycle')
147
- process.exitCode = cycle()
148
- },
149
- )
150
- .command(
151
- 'dead [package]',
152
- 'Dead - Check for dead code',
153
- (yargs) => {
154
- return yargs.positional('package', {
155
- describe: 'Specific package to check',
156
- })
157
- },
158
- (argv) => {
159
- if (argv.verbose) console.info('Dead')
160
- process.exitCode = dead()
161
- },
162
- )
163
- .command(
164
- 'lint [package]',
165
- 'Lint - Run Eslint',
166
- (yargs) => {
167
- return yargs.positional('package', {
168
- describe: 'Specific package to check',
169
- })
170
- },
171
- (argv) => {
172
- if (argv.verbose) console.info('Lint')
173
- process.exitCode = argv.fix ? fix() : argv.profile ? lintProfile() : argv.cache ? lintFast() : lint()
174
- },
175
- )
176
- .command(
177
- 'fix [package]',
178
- 'Fix - Run Eslint w/fix',
179
- (yargs) => {
180
- return yargs.positional('package', {
181
- describe: 'Specific package to check',
182
- })
183
- },
184
- (argv) => {
185
- if (argv.verbose) console.info('Fix')
186
- process.exitCode = fix()
187
- },
188
- )
189
- .command(
190
- 'deps [package]',
191
- 'Deps - Check for unused or missing dependencies',
192
- (yargs) => {
193
- return yargs.positional('package', {
194
- describe: 'Specific package to check',
195
- })
196
- },
197
- (argv) => {
198
- if (argv.verbose) console.info('Deps')
199
- process.exitCode = deps()
200
- },
201
- )
202
- .command(
203
- 'gen-docs [package]',
204
- 'GenDocs - Generate TypeDocs',
205
- (yargs) => {
206
- return yargs.positional('package', {
207
- describe: 'Specific package to generate docs for',
208
- })
209
- },
210
- (argv) => {
211
- if (argv.verbose) console.info('Deps')
212
- process.exitCode = genDocs()
213
- },
214
- )
215
- .command(
216
- 'gitlint [package]',
217
- 'Gitlint - Lint your git config',
218
- (yargs) => {
219
- return yargs
220
- },
221
- (argv) => {
222
- if (argv.verbose) console.info('Gitlint')
223
- process.exitCode = argv.fix ? gitlintFix() : gitlint()
224
- },
225
- )
226
- .command(
227
- 'rebuild [package]',
228
- 'Rebuild - Clean, Compile & Lint',
229
- (yargs) => {
230
- return yargs.positional('package', {
231
- describe: 'Specific package to rebuild',
232
- })
233
- },
234
- (argv) => {
235
- if (argv.verbose) console.info(`Rebuilding: ${argv.package ?? 'all'}`)
236
- process.exitCode = rebuild({ target: argv.target as 'esm' | 'cjs' })
237
- },
238
- )
239
- .command(
240
- 'relint [package]',
241
- 'Relint - Clean & Lint',
242
- (yargs) => {
243
- return yargs.positional('package', {
244
- describe: 'Specific package to relint',
245
- })
246
- },
247
- (argv) => {
248
- if (argv.verbose) console.info('Relinting')
249
- process.exitCode = relint()
250
- },
251
- )
252
- .command(
253
- 'reinstall',
254
- 'Reinstall - Clean & Install',
255
- (yargs) => {
256
- return yargs
257
- },
258
- (argv) => {
259
- if (argv.verbose) console.info('Reinstalling')
260
- process.exitCode = reinstall()
261
- },
262
- )
263
- .command(
264
- 'sonar',
265
- 'Sonar - Run Sonar Check',
266
- (yargs) => {
267
- return yargs
268
- },
269
- (argv) => {
270
- if (argv.verbose) console.info('Sonar Check')
271
- process.exitCode = sonar()
272
- },
273
- )
274
- .command(
275
- 'test',
276
- 'Test - Run Jest Tests',
277
- (yargs) => {
278
- return yargs
279
- },
280
- (argv) => {
281
- if (argv.verbose) console.info('Testing')
282
- process.exitCode = test()
283
- },
284
- )
285
- .command(
286
- 'tsconfig-gen [package]',
287
- 'Tsconfig Gen - Generate tsconfog.json file for building',
288
- (yargs) => {
289
- return yargs.positional('package', {
290
- describe: 'Specific package for generation',
291
- })
292
- },
293
- (argv) => {
294
- if (argv.verbose) console.info(`TsconfigGen: ${argv.package ?? 'all'}`)
295
- process.exitCode = tsconfigGen({ target: argv.target as 'esm' | 'cjs' })
296
- },
297
- )
298
- .command(
299
- 'tsconfig-clean',
300
- 'Tsconfig Clean - Remove generated tsconfig.json files',
301
- (yargs) => {
302
- return yargs
303
- },
304
- (argv) => {
305
- if (argv.verbose) console.info('Tsconfig Clean')
306
- process.exitCode = tsconfigGenClean()
307
- },
308
- )
309
- .command(
310
- 'up',
311
- 'Up - Update dependencies',
312
- (yargs) => {
313
- return yargs
314
- },
315
- (argv) => {
316
- if (argv.verbose) console.info('Up')
317
- process.exitCode = up()
318
- },
319
- )
320
- .command(
321
- 'updo',
322
- 'Updo - Update dependencies [Interactive]',
323
- (yargs) => {
324
- return yargs
325
- },
326
- (argv) => {
327
- if (argv.verbose) console.info('Updo')
328
- process.exitCode = updo()
329
- },
330
- )
331
- .command(
332
- 'yarn3only',
333
- 'Yarn3Only - Check if using Yarn v3',
334
- (yargs) => {
335
- return yargs
336
- },
337
- (argv) => {
338
- if (argv.verbose) console.info('Yarn 3 Check')
339
- process.exitCode = yarn3Only()
340
- },
341
- ),
342
- )
343
- await x.help().argv
71
+ export const xy = () => {
72
+ return parseOptions()
73
+ .command(
74
+ 'build [package]',
75
+ 'Build - Compile & Lint',
76
+ (yargs) => {
77
+ return yargs.positional('package', {
78
+ describe: 'Specific package to build',
79
+ })
80
+ },
81
+ (argv) => {
82
+ if (argv.verbose) console.info(`Building: ${argv.package ?? 'all'}`)
83
+ process.exitCode = build({ target: argv.target as 'esm' | 'cjs' })
84
+ },
85
+ )
86
+ .command(
87
+ 'compile [package]',
88
+ 'Compile with Typescript & Copy Images',
89
+ (yargs) => {
90
+ return yargs.positional('package', {
91
+ describe: 'Specific package to compile',
92
+ })
93
+ },
94
+ async (argv) => {
95
+ if (argv.verbose) console.info(`Compiling: ${argv.package ?? 'all'}`)
96
+ process.exitCode = await compile({ target: argv.target as 'esm' | 'cjs' })
97
+ },
98
+ )
99
+ .command(
100
+ 'clean [package]',
101
+ 'Clean - Remove intermediate files',
102
+ (yargs) => {
103
+ return yargs.positional('package', {
104
+ describe: 'Specific package to clean',
105
+ })
106
+ },
107
+ (argv) => {
108
+ if (argv.verbose) console.info(`Cleaning: ${argv.package ?? 'all'}`)
109
+ process.exitCode = clean()
110
+ },
111
+ )
112
+ .command(
113
+ 'license [package]',
114
+ 'License - Check licenses of dependencies',
115
+ (yargs) => {
116
+ return yargs.positional('package', {
117
+ describe: 'Specific package to check',
118
+ })
119
+ },
120
+ (argv) => {
121
+ if (argv.verbose) console.info(`License: ${argv.package ?? 'all'}`)
122
+ process.exitCode = license()
123
+ },
124
+ )
125
+ .command(
126
+ 'copy-assets [package]',
127
+ 'Copy Assets - Copy the assets from src to dist',
128
+ (yargs) => {
129
+ return yargs.positional('package', {
130
+ describe: 'Specific package to copy assets',
131
+ })
132
+ },
133
+ (argv) => {
134
+ if (argv.verbose) console.info(`Copying Assets: ${argv.package ?? 'all'}`)
135
+ process.exitCode = copyAssets({ target: argv.target as 'esm' | 'cjs' })
136
+ },
137
+ )
138
+ .command(
139
+ 'cycle [package]',
140
+ 'Cycle - Check for dependency cycles',
141
+ (yargs) => {
142
+ return yargs.positional('package', {
143
+ describe: 'Specific package to check',
144
+ })
145
+ },
146
+ (argv) => {
147
+ if (argv.verbose) console.info('Cycle')
148
+ process.exitCode = cycle()
149
+ },
150
+ )
151
+ .command(
152
+ 'dead [package]',
153
+ 'Dead - Check for dead code',
154
+ (yargs) => {
155
+ return yargs.positional('package', {
156
+ describe: 'Specific package to check',
157
+ })
158
+ },
159
+ (argv) => {
160
+ if (argv.verbose) console.info('Dead')
161
+ process.exitCode = dead()
162
+ },
163
+ )
164
+ .command(
165
+ 'deploy',
166
+ 'Deploy - Deploy patch',
167
+ (yargs) => {
168
+ return yargs
169
+ },
170
+ (argv) => {
171
+ if (argv.verbose) console.info('Deploy patch')
172
+ process.exitCode = deploy()
173
+ },
174
+ )
175
+ .command(
176
+ 'deploy-minor',
177
+ 'Deploy - Deploy minor',
178
+ (yargs) => {
179
+ return yargs
180
+ },
181
+ (argv) => {
182
+ if (argv.verbose) console.info('Deploy minor')
183
+ process.exitCode = deployMinor()
184
+ },
185
+ )
186
+ .command(
187
+ 'deploy-major',
188
+ 'Deploy - Deploy major',
189
+ (yargs) => {
190
+ return yargs
191
+ },
192
+ (argv) => {
193
+ if (argv.verbose) console.info('Deploy major')
194
+ process.exitCode = deployMajor()
195
+ },
196
+ )
197
+ .command(
198
+ 'deploy-next',
199
+ 'Deploy - Deploy next',
200
+ (yargs) => {
201
+ return yargs
202
+ },
203
+ (argv) => {
204
+ if (argv.verbose) console.info('Deploy next')
205
+ process.exitCode = deployNext()
206
+ },
207
+ )
208
+ .command(
209
+ 'lint [package]',
210
+ 'Lint - Run Eslint',
211
+ (yargs) => {
212
+ return yargs.positional('package', {
213
+ describe: 'Specific package to check',
214
+ })
215
+ },
216
+ (argv) => {
217
+ if (argv.verbose) console.info('Lint')
218
+ process.exitCode = argv.fix ? fix() : argv.profile ? lintProfile() : argv.cache ? lintFast() : lint()
219
+ },
220
+ )
221
+ .command(
222
+ 'fix [package]',
223
+ 'Fix - Run Eslint w/fix',
224
+ (yargs) => {
225
+ return yargs.positional('package', {
226
+ describe: 'Specific package to check',
227
+ })
228
+ },
229
+ (argv) => {
230
+ if (argv.verbose) console.info('Fix')
231
+ process.exitCode = fix()
232
+ },
233
+ )
234
+ .command(
235
+ 'deps [package]',
236
+ 'Deps - Check for unused or missing dependencies',
237
+ (yargs) => {
238
+ return yargs.positional('package', {
239
+ describe: 'Specific package to check',
240
+ })
241
+ },
242
+ (argv) => {
243
+ if (argv.verbose) console.info('Deps')
244
+ process.exitCode = deps()
245
+ },
246
+ )
247
+ .command(
248
+ 'gen-docs [package]',
249
+ 'GenDocs - Generate TypeDocs',
250
+ (yargs) => {
251
+ return yargs.positional('package', {
252
+ describe: 'Specific package to generate docs for',
253
+ })
254
+ },
255
+ (argv) => {
256
+ if (argv.verbose) console.info('GenDocs')
257
+ process.exitCode = genDocs()
258
+ },
259
+ )
260
+ .command(
261
+ 'gitlint [package]',
262
+ 'Gitlint - Lint your git config',
263
+ (yargs) => {
264
+ return yargs
265
+ },
266
+ (argv) => {
267
+ if (argv.verbose) console.info('Gitlint')
268
+ process.exitCode = argv.fix ? gitlintFix() : gitlint()
269
+ },
270
+ )
271
+ .command(
272
+ 'rebuild [package]',
273
+ 'Rebuild - Clean, Compile & Lint',
274
+ (yargs) => {
275
+ return yargs.positional('package', {
276
+ describe: 'Specific package to rebuild',
277
+ })
278
+ },
279
+ (argv) => {
280
+ if (argv.verbose) console.info(`Rebuilding: ${argv.package ?? 'all'}`)
281
+ process.exitCode = rebuild({ target: argv.target as 'esm' | 'cjs' })
282
+ },
283
+ )
284
+ .command(
285
+ 'relint [package]',
286
+ 'Relint - Clean & Lint',
287
+ (yargs) => {
288
+ return yargs.positional('package', {
289
+ describe: 'Specific package to relint',
290
+ })
291
+ },
292
+ (argv) => {
293
+ if (argv.verbose) console.info('Relinting')
294
+ process.exitCode = relint()
295
+ },
296
+ )
297
+ .command(
298
+ 'reinstall',
299
+ 'Reinstall - Clean & Install',
300
+ (yargs) => {
301
+ return yargs
302
+ },
303
+ (argv) => {
304
+ if (argv.verbose) console.info('Reinstalling')
305
+ process.exitCode = reinstall()
306
+ },
307
+ )
308
+ .command(
309
+ 'sonar',
310
+ 'Sonar - Run Sonar Check',
311
+ (yargs) => {
312
+ return yargs
313
+ },
314
+ (argv) => {
315
+ if (argv.verbose) console.info('Sonar Check')
316
+ process.exitCode = sonar()
317
+ },
318
+ )
319
+ .command(
320
+ 'test',
321
+ 'Test - Run Jest Tests',
322
+ (yargs) => {
323
+ return yargs
324
+ },
325
+ (argv) => {
326
+ if (argv.verbose) console.info('Testing')
327
+ process.exitCode = test()
328
+ },
329
+ )
330
+ .command(
331
+ 'tsconfig-gen [package]',
332
+ 'Tsconfig Gen - Generate tsconfog.json file for building',
333
+ (yargs) => {
334
+ return yargs.positional('package', {
335
+ describe: 'Specific package for generation',
336
+ })
337
+ },
338
+ (argv) => {
339
+ if (argv.verbose) console.info(`TsconfigGen: ${argv.package ?? 'all'}`)
340
+ process.exitCode = tsconfigGen({ target: argv.target as 'esm' | 'cjs' })
341
+ },
342
+ )
343
+ .command(
344
+ 'tsconfig-clean',
345
+ 'Tsconfig Clean - Remove generated tsconfig.json files',
346
+ (yargs) => {
347
+ return yargs
348
+ },
349
+ (argv) => {
350
+ if (argv.verbose) console.info('Tsconfig Clean')
351
+ process.exitCode = tsconfigGenClean()
352
+ },
353
+ )
354
+ .command(
355
+ 'up',
356
+ 'Up - Update dependencies',
357
+ (yargs) => {
358
+ return yargs
359
+ },
360
+ (argv) => {
361
+ if (argv.verbose) console.info('Up')
362
+ process.exitCode = up()
363
+ },
364
+ )
365
+ .command(
366
+ 'updo',
367
+ 'Updo - Update dependencies [Interactive]',
368
+ (yargs) => {
369
+ return yargs
370
+ },
371
+ (argv) => {
372
+ if (argv.verbose) console.info('Updo')
373
+ process.exitCode = updo()
374
+ },
375
+ )
376
+ .command(
377
+ 'yarn3only',
378
+ 'Yarn3Only - Check if using Yarn v3',
379
+ (yargs) => {
380
+ return yargs
381
+ },
382
+ (argv) => {
383
+ if (argv.verbose) console.info('Yarn 3 Check')
384
+ process.exitCode = yarn3Only()
385
+ },
386
+ )
387
+ .help().argv
344
388
  }