@xylabs/ts-scripts-yarn3 2.10.0-rc.8 → 2.10.0

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 (38) hide show
  1. package/dist/cjs/actions/index.d.ts +1 -0
  2. package/dist/cjs/actions/index.d.ts.map +1 -1
  3. package/dist/cjs/actions/index.js +1 -0
  4. package/dist/cjs/actions/index.js.map +1 -1
  5. package/dist/cjs/actions/lint-clean.js +1 -1
  6. package/dist/cjs/actions/lint-clean.js.map +1 -1
  7. package/dist/cjs/actions/reinstall.js +1 -1
  8. package/dist/cjs/actions/reinstall.js.map +1 -1
  9. package/dist/cjs/actions/rimraf.d.ts +1 -1
  10. package/dist/cjs/actions/rimraf.d.ts.map +1 -1
  11. package/dist/cjs/actions/rimraf.js +73 -61
  12. package/dist/cjs/actions/rimraf.js.map +1 -1
  13. package/dist/cjs/bin/rimraf.js +0 -0
  14. package/dist/cjs/lib/xy.js +1 -2
  15. package/dist/cjs/lib/xy.js.map +1 -1
  16. package/dist/esm/actions/index.d.ts +1 -0
  17. package/dist/esm/actions/index.d.ts.map +1 -1
  18. package/dist/esm/actions/index.js +1 -0
  19. package/dist/esm/actions/index.js.map +1 -1
  20. package/dist/esm/actions/lint-clean.js +1 -1
  21. package/dist/esm/actions/lint-clean.js.map +1 -1
  22. package/dist/esm/actions/reinstall.js +1 -1
  23. package/dist/esm/actions/reinstall.js.map +1 -1
  24. package/dist/esm/actions/rimraf.d.ts +1 -1
  25. package/dist/esm/actions/rimraf.d.ts.map +1 -1
  26. package/dist/esm/actions/rimraf.js +71 -61
  27. package/dist/esm/actions/rimraf.js.map +1 -1
  28. package/dist/esm/lib/xy.js +2 -3
  29. package/dist/esm/lib/xy.js.map +1 -1
  30. package/dist/tsconfig.build.cjs.tsbuildinfo +1 -1
  31. package/dist/tsconfig.build.esm.tsbuildinfo +1 -1
  32. package/package.json +10 -8
  33. package/src/actions/index.ts +1 -0
  34. package/src/actions/lint-clean.ts +1 -1
  35. package/src/actions/reinstall.ts +1 -1
  36. package/src/actions/rimraf.ts +60 -51
  37. package/src/lib/xy.ts +2 -2
  38. package/src/bin/rimraf.ts +0 -5
@@ -6,7 +6,7 @@ export const reinstall = () => {
6
6
  console.log('Reinstall [Clear Lock File]')
7
7
  closeSync(openSync('./yarn.lock', 'w'))
8
8
  return runSteps('Reinstall', [
9
- ['yarn', 'rimraf ./node_modules'],
9
+ ['yarn', 'xy rimraf ./node_modules'],
10
10
  ['yarn', 'install --network-timeout 10000'],
11
11
  ])
12
12
  }
@@ -3,57 +3,66 @@
3
3
  import path from 'path'
4
4
  import rimraf from 'rimraf'
5
5
 
6
- const isRoot = (arg: string) => /^(\/|[a-zA-Z]:\\)$/.test(path.resolve(arg))
7
- const filterOutRoot = (arg: string) => {
8
- const ok = preserveRoot === false || !isRoot(arg)
9
- if (!ok) {
10
- console.error(`refusing to remove ${arg}`)
11
- console.error('Set --no-preserve-root to allow this')
12
- }
13
- return ok
14
- }
6
+ export const runRimraf = () => {
7
+ try {
8
+ const isRoot = (arg: string) => /^(\/|[a-zA-Z]:\\)$/.test(path.resolve(arg))
9
+ const filterOutRoot = (arg: string) => {
10
+ const ok = preserveRoot === false || !isRoot(arg)
11
+ if (!ok) {
12
+ console.error(`refusing to remove ${arg}`)
13
+ console.error('Set --no-preserve-root to allow this')
14
+ }
15
+ return ok
16
+ }
15
17
 
16
- let help = false
17
- let dashdash = false
18
- let noglob = false
19
- let preserveRoot = true
20
- const args = process.argv
21
- .slice(2)
22
- .filter((arg) => {
23
- if (dashdash) return !!arg
24
- else if (arg === '--') dashdash = true
25
- else if (arg === '--no-glob' || arg === '-G') noglob = true
26
- else if (arg === '--glob' || arg === '-g') noglob = false
27
- else if (arg.match(/^(-+|\/)(h(elp)?|\?)$/)) help = true
28
- else if (arg === '--preserve-root') preserveRoot = true
29
- else if (arg === '--no-preserve-root') preserveRoot = false
30
- else return !!arg
31
- })
32
- .filter((arg) => !preserveRoot || filterOutRoot(arg))
18
+ let help = false
19
+ let dashdash = false
20
+ let noglob = false
21
+ let preserveRoot = true
22
+ const args = process.argv
23
+ .slice(2)
24
+ .filter((arg) => {
25
+ if (dashdash) return !!arg
26
+ else if (arg === '--') dashdash = true
27
+ else if (arg === '--no-glob' || arg === '-G') noglob = true
28
+ else if (arg === '--glob' || arg === '-g') noglob = false
29
+ else if (arg.match(/^(-+|\/)(h(elp)?|\?)$/)) help = true
30
+ else if (arg === '--preserve-root') preserveRoot = true
31
+ else if (arg === '--no-preserve-root') preserveRoot = false
32
+ else return !!arg
33
+ })
34
+ .filter((arg) => !preserveRoot || filterOutRoot(arg))
33
35
 
34
- const go = (n: number) => {
35
- if (n >= args.length) return
36
- const options: rimraf.Options = noglob ? { glob: false } : {}
37
- rimraf(args[n], options, (er) => {
38
- if (er) throw er
39
- go(n + 1)
40
- })
41
- }
36
+ const go = (n: number) => {
37
+ if (n >= args.length) return
38
+ const options: rimraf.Options = noglob ? { glob: false } : {}
39
+ rimraf(args[n], options, (er) => {
40
+ if (er) throw er
41
+ go(n + 1)
42
+ })
43
+ }
42
44
 
43
- if (help || args.length === 0) {
44
- // If they didn't ask for help, then this is not a "success"
45
- const log = help ? console.log : console.error
46
- log('Usage: rimraf <path> [<path> ...]')
47
- log('')
48
- log(' Deletes all files and folders at "path" recursively.')
49
- log('')
50
- log('Options:')
51
- log('')
52
- log(' -h, --help Display this usage info')
53
- log(' -G, --no-glob Do not expand glob patterns in arguments')
54
- log(' -g, --glob Expand glob patterns in arguments (default)')
55
- log(" --preserve-root Do not remove '/' (default)")
56
- log(" --no-preserve-root Do not treat '/' specially")
57
- log(' -- Stop parsing flags')
58
- process.exit(help ? 0 : 1)
59
- } else go(0)
45
+ if (help || args.length === 0) {
46
+ // If they didn't ask for help, then this is not a "success"
47
+ const log = help ? console.log : console.error
48
+ log('Usage: rimraf <path> [<path> ...]')
49
+ log('')
50
+ log(' Deletes all files and folders at "path" recursively.')
51
+ log('')
52
+ log('Options:')
53
+ log('')
54
+ log(' -h, --help Display this usage info')
55
+ log(' -G, --no-glob Do not expand glob patterns in arguments')
56
+ log(' -g, --glob Expand glob patterns in arguments (default)')
57
+ log(" --preserve-root Do not remove '/' (default)")
58
+ log(" --no-preserve-root Do not treat '/' specially")
59
+ log(' -- Stop parsing flags')
60
+ return help ? 0 : 1
61
+ } else go(0)
62
+ return 0
63
+ } catch (ex) {
64
+ const error = ex as Error
65
+ console.error(error.message)
66
+ return 1
67
+ }
68
+ }
package/src/lib/xy.ts CHANGED
@@ -25,6 +25,7 @@ import {
25
25
  rebuild,
26
26
  reinstall,
27
27
  relint,
28
+ runRimraf,
28
29
  sonar,
29
30
  test,
30
31
  tsconfigGen,
@@ -34,7 +35,6 @@ import {
34
35
  updo,
35
36
  yarn3Only,
36
37
  } from '../actions'
37
- import { runSteps } from './runSteps'
38
38
 
39
39
  export const parseOptions = () => {
40
40
  return yargs(hideBin(process.argv))
@@ -400,7 +400,7 @@ export const xy = () => {
400
400
  },
401
401
  (argv) => {
402
402
  if (argv.verbose) console.info('Rimraf')
403
- process.exitCode = runSteps('Rimraf', [['yarn', ['rimraf', ...process.argv]]])
403
+ process.exitCode = runRimraf()
404
404
  },
405
405
  )
406
406
  .command(
package/src/bin/rimraf.ts DELETED
@@ -1,5 +0,0 @@
1
- #!/usr/bin/env node
2
-
3
- import { runXy } from "../lib"
4
-
5
- runXy('rimraf')