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