@xylabs/ts-scripts-yarn3 3.13.0 → 3.13.1

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 (103) hide show
  1. package/dist/actions/clean-docs.js +1 -1
  2. package/dist/actions/clean-docs.js.map +1 -1
  3. package/dist/actions/clean-docs.mjs +1 -1
  4. package/dist/actions/clean-docs.mjs.map +1 -1
  5. package/dist/actions/compile.js +2 -2
  6. package/dist/actions/compile.js.map +1 -1
  7. package/dist/actions/compile.mjs +2 -2
  8. package/dist/actions/compile.mjs.map +1 -1
  9. package/dist/actions/lint.js +2 -4
  10. package/dist/actions/lint.js.map +1 -1
  11. package/dist/actions/lint.mjs +2 -4
  12. package/dist/actions/lint.mjs.map +1 -1
  13. package/dist/bin/package/clean-outputs.js +1 -1
  14. package/dist/bin/package/clean-outputs.js.map +1 -1
  15. package/dist/bin/package/clean-outputs.mjs +1 -1
  16. package/dist/bin/package/clean-outputs.mjs.map +1 -1
  17. package/dist/bin/package/clean-typescript.js +1 -1
  18. package/dist/bin/package/clean-typescript.js.map +1 -1
  19. package/dist/bin/package/clean-typescript.mjs +1 -1
  20. package/dist/bin/package/clean-typescript.mjs.map +1 -1
  21. package/dist/bin/package/clean.js +1 -1
  22. package/dist/bin/package/clean.js.map +1 -1
  23. package/dist/bin/package/clean.mjs +1 -1
  24. package/dist/bin/package/clean.mjs.map +1 -1
  25. package/dist/bin/package/compile-only.js.map +1 -1
  26. package/dist/bin/package/compile-only.mjs.map +1 -1
  27. package/dist/bin/package/compile-tsup.js.map +1 -1
  28. package/dist/bin/package/compile-tsup.mjs.map +1 -1
  29. package/dist/bin/package/compile.js.map +1 -1
  30. package/dist/bin/package/compile.mjs.map +1 -1
  31. package/dist/bin/package/copy-assets-cjs.js.map +1 -1
  32. package/dist/bin/package/copy-assets-cjs.mjs.map +1 -1
  33. package/dist/bin/package/copy-assets-esm.js.map +1 -1
  34. package/dist/bin/package/copy-assets-esm.mjs.map +1 -1
  35. package/dist/bin/package/deps.js.map +1 -1
  36. package/dist/bin/package/deps.mjs.map +1 -1
  37. package/dist/bin/package/gen-docs.js +1 -1
  38. package/dist/bin/package/gen-docs.js.map +1 -1
  39. package/dist/bin/package/gen-docs.mjs +1 -1
  40. package/dist/bin/package/gen-docs.mjs.map +1 -1
  41. package/dist/bin/package/publint.js.map +1 -1
  42. package/dist/bin/package/publint.mjs.map +1 -1
  43. package/dist/bin/package/recompile.js.map +1 -1
  44. package/dist/bin/package/recompile.mjs.map +1 -1
  45. package/dist/index.d.mts +1 -1
  46. package/dist/index.d.ts +1 -1
  47. package/dist/lib/dependencies/DuplicateDetector.js +2 -1
  48. package/dist/lib/dependencies/DuplicateDetector.js.map +1 -1
  49. package/dist/lib/dependencies/DuplicateDetector.mjs +2 -1
  50. package/dist/lib/dependencies/DuplicateDetector.mjs.map +1 -1
  51. package/dist/lib/dependencies/detectDuplicateDependencies.js +0 -2
  52. package/dist/lib/dependencies/detectDuplicateDependencies.js.map +1 -1
  53. package/dist/lib/dependencies/detectDuplicateDependencies.mjs +0 -2
  54. package/dist/lib/dependencies/detectDuplicateDependencies.mjs.map +1 -1
  55. package/dist/lib/loadConfig.js.map +1 -1
  56. package/dist/lib/loadConfig.mjs.map +1 -1
  57. package/dist/lib/runXyWithWarning.js +4 -2
  58. package/dist/lib/runXyWithWarning.js.map +1 -1
  59. package/dist/lib/runXyWithWarning.mjs +4 -2
  60. package/dist/lib/runXyWithWarning.mjs.map +1 -1
  61. package/dist/lib/yarn/workspace/yarnWorkspaces.js +1 -2
  62. package/dist/lib/yarn/workspace/yarnWorkspaces.js.map +1 -1
  63. package/dist/lib/yarn/workspace/yarnWorkspaces.mjs +1 -2
  64. package/dist/lib/yarn/workspace/yarnWorkspaces.mjs.map +1 -1
  65. package/dist/xy/param.js +33 -0
  66. package/dist/xy/param.js.map +1 -0
  67. package/dist/xy/param.mjs +9 -0
  68. package/dist/xy/param.mjs.map +1 -0
  69. package/dist/xy/xyCommonCommands.js +5 -12
  70. package/dist/xy/xyCommonCommands.js.map +1 -1
  71. package/dist/xy/xyCommonCommands.mjs +5 -12
  72. package/dist/xy/xyCommonCommands.mjs.map +1 -1
  73. package/dist/xy/xyLintCommands.js +7 -16
  74. package/dist/xy/xyLintCommands.js.map +1 -1
  75. package/dist/xy/xyLintCommands.mjs +7 -16
  76. package/dist/xy/xyLintCommands.mjs.map +1 -1
  77. package/dist/xy/xyParseOptions.js.map +1 -1
  78. package/dist/xy/xyParseOptions.mjs.map +1 -1
  79. package/package.json +5 -5
  80. package/src/actions/clean-docs.ts +1 -1
  81. package/src/actions/compile.ts +2 -4
  82. package/src/actions/lint.ts +2 -6
  83. package/src/bin/package/clean-outputs.ts +2 -2
  84. package/src/bin/package/clean-typescript.ts +2 -2
  85. package/src/bin/package/clean.ts +2 -2
  86. package/src/bin/package/compile-only.ts +1 -0
  87. package/src/bin/package/compile-tsup.ts +1 -0
  88. package/src/bin/package/compile.ts +1 -0
  89. package/src/bin/package/copy-assets-cjs.ts +1 -0
  90. package/src/bin/package/copy-assets-esm.ts +1 -0
  91. package/src/bin/package/deps.ts +1 -0
  92. package/src/bin/package/gen-docs.ts +2 -2
  93. package/src/bin/package/publint.ts +1 -0
  94. package/src/bin/package/recompile.ts +1 -0
  95. package/src/lib/dependencies/DuplicateDetector.ts +2 -2
  96. package/src/lib/dependencies/detectDuplicateDependencies.ts +0 -2
  97. package/src/lib/loadConfig.ts +0 -1
  98. package/src/lib/runXyWithWarning.ts +4 -2
  99. package/src/lib/yarn/workspace/yarnWorkspaces.ts +11 -10
  100. package/src/xy/param.ts +7 -0
  101. package/src/xy/xyCommonCommands.ts +5 -12
  102. package/src/xy/xyLintCommands.ts +7 -16
  103. package/src/xy/xyParseOptions.ts +0 -1
@@ -22,12 +22,10 @@ export const compile = ({ verbose, target, pkg, incremental, publint }: CompileP
22
22
  return pkg ? compilePackage({ pkg, publint, target, verbose }) : compileAll({ incremental, publint, target, verbose })
23
23
  }
24
24
 
25
- export const compilePackage = ({ target, pkg, publint = true }: CompilePackageParams) => {
25
+ export const compilePackage = ({ target, pkg }: CompilePackageParams) => {
26
26
  const targetOptions = target ? ['-t', target] : []
27
27
 
28
- return publint ?
29
- runSteps(`Compile [${pkg}]`, [['yarn', ['workspace', pkg, 'run', 'package-compile', ...targetOptions]]])
30
- : runSteps(`Compile [${pkg}]`, [['yarn', ['workspace', pkg, 'run', 'package-compile', ...targetOptions]]])
28
+ return runSteps(`Compile [${pkg}]`, [['yarn', ['workspace', pkg, 'run', 'package-compile', ...targetOptions]]])
31
29
  }
32
30
 
33
31
  export const compileAll = ({ jobs, verbose, target, incremental }: CompileParams) => {
@@ -45,9 +45,7 @@ export const lintPackage = async ({ pkg }: LintParams) => {
45
45
 
46
46
  dumpMessages(lintResults)
47
47
 
48
- const errorCount = lintResults.reduce((prev, lintResult) => prev + lintResult.errorCount, 0)
49
-
50
- return errorCount
48
+ return lintResults.reduce((prev, lintResult) => prev + lintResult.errorCount, 0)
51
49
  }
52
50
 
53
51
  export const lintAll = async () => {
@@ -57,9 +55,7 @@ export const lintAll = async () => {
57
55
 
58
56
  dumpMessages(lintResults)
59
57
 
60
- const errorCount = lintResults.reduce((prev, lintResult) => prev + lintResult.errorCount, 0)
61
-
62
- return errorCount
58
+ return lintResults.reduce((prev, lintResult) => prev + lintResult.errorCount, 0)
63
59
  }
64
60
 
65
61
  export const lint = async ({ pkg }: LintParams = {}) => {
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
 
3
- import { packageCleanOutputs } from '../../actions'
4
-
5
3
  import { forget } from '@xylabs/forget'
6
4
 
5
+ import { packageCleanOutputs } from '../../actions'
6
+
7
7
  forget(packageCleanOutputs())
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
 
3
- import { packageCleanTypescript } from '../../actions'
4
-
5
3
  import { forget } from '@xylabs/forget'
6
4
 
5
+ import { packageCleanTypescript } from '../../actions'
6
+
7
7
  forget(packageCleanTypescript())
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
 
3
- import { packageClean } from '../../actions'
4
-
5
3
  import { forget } from '@xylabs/forget'
6
4
 
5
+ import { packageClean } from '../../actions'
6
+
7
7
  forget(packageClean())
@@ -1,6 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
 
3
3
  import chalk from 'chalk'
4
+
4
5
  import { packageCompile } from '../../actions'
5
6
 
6
7
  packageCompile({ verbose: true, publint: false })
@@ -1,6 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
 
3
3
  import chalk from 'chalk'
4
+
4
5
  import { packageCompileTsup } from '../../actions'
5
6
 
6
7
  packageCompileTsup({ verbose: true })
@@ -1,6 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
 
3
3
  import chalk from 'chalk'
4
+
4
5
  import { packageCompile } from '../../actions'
5
6
 
6
7
  packageCompile({ verbose: false })
@@ -1,6 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
 
3
3
  import chalk from 'chalk'
4
+
4
5
  import { packageCopyAssets } from '../../actions'
5
6
 
6
7
  packageCopyAssets({ target: 'cjs' })
@@ -1,6 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
 
3
3
  import chalk from 'chalk'
4
+
4
5
  import { packageCopyAssets } from '../../actions'
5
6
 
6
7
  packageCopyAssets({ target: 'esm' })
@@ -1,6 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
 
3
3
  import chalk from 'chalk'
4
+
4
5
  import { packageDeps } from '../../actions'
5
6
 
6
7
  packageDeps()
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
 
3
- import { packageGenDocs } from '../../actions'
4
-
5
3
  import { forget } from '@xylabs/forget'
6
4
 
5
+ import { packageGenDocs } from '../../actions'
6
+
7
7
  forget(packageGenDocs())
@@ -1,6 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
 
3
3
  import chalk from 'chalk'
4
+
4
5
  import { packagePublint } from '../../actions'
5
6
 
6
7
  packagePublint()
@@ -1,6 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
 
3
3
  import chalk from 'chalk'
4
+
4
5
  import { packageRecompile } from '../../actions'
5
6
 
6
7
  packageRecompile()
@@ -1,7 +1,6 @@
1
1
  import { EOL } from 'node:os'
2
2
 
3
3
  import chalk from 'chalk'
4
-
5
4
  import uniq from 'lodash/uniq'
6
5
 
7
6
  import { multiLineToJSONArray } from '../jsonFormatters'
@@ -65,7 +64,8 @@ export class DuplicateDetector {
65
64
  const result = this.dependencyEntries.reduce(this.detectReducer, this.resultsFactory(this.dependency))
66
65
  if (result.duplicateVersions.length > 0) {
67
66
  console.log(chalk.yellow(`${EOL}Duplicates found for: ${this.dependency}`))
68
- console.log(chalk.grey(` ${result.duplicateVersions.toString().replaceAll(',', `${EOL} `)}`, EOL))
67
+ const duplicateVersions = result.duplicateVersions.toString().replaceAll(',', `${EOL} `)
68
+ console.log(chalk.grey(` ${duplicateVersions}`, EOL))
69
69
  return 1
70
70
  } else {
71
71
  console.log(`${this.dependency} - OK`)
@@ -26,7 +26,6 @@ export const detectDuplicateDependencies = (depsFromPackageJSON?: string[], Defa
26
26
  if (output) {
27
27
  exitCode = new DuplicateDetector(output, dependency).detect()
28
28
  exitCode
29
- continue
30
29
  } else {
31
30
  console.log(`${dependency} - N/A`)
32
31
  if (depsFromPackageJSON) {
@@ -34,7 +33,6 @@ export const detectDuplicateDependencies = (depsFromPackageJSON?: string[], Defa
34
33
  console.log(`🚨 Library ${dependency} was requested in package.json but not found`)
35
34
  }
36
35
  exitCode
37
- continue
38
36
  }
39
37
  }
40
38
  return exitCode
@@ -1,6 +1,5 @@
1
1
  import chalk from 'chalk'
2
2
  import { cosmiconfig } from 'cosmiconfig'
3
-
4
3
  import merge from 'lodash/merge'
5
4
 
6
5
  let config: Record<string, unknown>
@@ -1,7 +1,9 @@
1
1
  import chalk from 'chalk'
2
2
 
3
3
  export const runXyWithWarning = (command: string) => {
4
- console.warn(chalk.yellow(`WARNING: [${chalk.white(`yarn ${command}`)}] is deprecated for XY Labs Scripts.`))
5
- console.warn(chalk.gray(`Did you mean [${chalk.magenta(`yarn xy ${command}`)}]?`))
4
+ const commandString = `yarn ${command}`
5
+ const commandXyString = `yarn xy ${command}`
6
+ console.warn(chalk.yellow(`WARNING: [${chalk.white(commandString)}] is deprecated for XY Labs Scripts.`))
7
+ console.warn(chalk.gray(`Did you mean [${chalk.magenta(commandXyString)}]?`))
6
8
  return 1
7
9
  }
@@ -7,14 +7,15 @@ export const yarnWorkspaces = (): Workspace[] => {
7
7
  if (result.error) {
8
8
  throw result.error
9
9
  }
10
- const list = result.stdout
11
- .toString()
12
- // NOTE: This probably doesn't work on Windows
13
- // TODO: Replace /r/n with /n first
14
- .split('\n')
15
- .slice(0, -1)
16
- .map((item) => {
17
- return JSON.parse(item)
18
- })
19
- return list
10
+ return (
11
+ result.stdout
12
+ .toString()
13
+ // NOTE: This probably doesn't work on Windows
14
+ // TODO: Replace /r/n with /n first
15
+ .split('\n')
16
+ .slice(0, -1)
17
+ .map((item) => {
18
+ return JSON.parse(item)
19
+ })
20
+ )
20
21
  }
@@ -0,0 +1,7 @@
1
+ import { Argv } from 'yargs'
2
+
3
+ export const packagePositionalParam = (yargs: Argv<unknown>) => {
4
+ return yargs.positional('package', {
5
+ describe: 'Specific package to target',
6
+ })
7
+ }
@@ -16,6 +16,7 @@ import {
16
16
  updateYarnVersion,
17
17
  yarn3Only,
18
18
  } from '../actions'
19
+ import { packagePositionalParam } from './param'
19
20
 
20
21
  export const xyCommonCommands = (args: Argv) => {
21
22
  return args
@@ -24,9 +25,7 @@ export const xyCommonCommands = (args: Argv) => {
24
25
  'license [package]',
25
26
  'License - Check licenses of dependencies',
26
27
  (yargs) => {
27
- return yargs.positional('package', {
28
- describe: 'Specific package to check',
29
- })
28
+ return packagePositionalParam(yargs)
30
29
  },
31
30
  async (argv) => {
32
31
  if (argv.verbose) console.log(`License: ${argv.package ?? 'all'}`)
@@ -37,9 +36,7 @@ export const xyCommonCommands = (args: Argv) => {
37
36
  'dead [package]',
38
37
  'Dead - Check for dead code',
39
38
  (yargs) => {
40
- return yargs.positional('package', {
41
- describe: 'Specific package to check',
42
- })
39
+ return packagePositionalParam(yargs)
43
40
  },
44
41
  (argv) => {
45
42
  if (argv.verbose) console.log('Dead')
@@ -50,9 +47,7 @@ export const xyCommonCommands = (args: Argv) => {
50
47
  'deps [package]',
51
48
  'Deps - Check for unused or missing dependencies',
52
49
  (yargs) => {
53
- return yargs.positional('package', {
54
- describe: 'Specific package to check',
55
- })
50
+ return packagePositionalParam(yargs)
56
51
  },
57
52
  (argv) => {
58
53
  if (argv.verbose) console.log(`Checking Dependencies: ${argv.package ?? 'all'}`)
@@ -63,9 +58,7 @@ export const xyCommonCommands = (args: Argv) => {
63
58
  'gen-docs [package]',
64
59
  'GenDocs - Generate TypeDocs',
65
60
  (yargs) => {
66
- return yargs.positional('package', {
67
- describe: 'Specific package to generate docs for',
68
- })
61
+ return packagePositionalParam(yargs)
69
62
  },
70
63
  (argv) => {
71
64
  if (argv.verbose) console.log(`Generating TypeDocs: ${argv.package ?? 'all'}`)
@@ -2,6 +2,7 @@ import chalk from 'chalk'
2
2
  import { Argv } from 'yargs'
3
3
 
4
4
  import { cycle, fix, lint, lintProfile, publint, relint, sonar } from '../actions'
5
+ import { packagePositionalParam } from './param'
5
6
 
6
7
  export const xyLintCommands = (args: Argv) => {
7
8
  return args
@@ -9,9 +10,7 @@ export const xyLintCommands = (args: Argv) => {
9
10
  'cycle [package]',
10
11
  'Cycle - Check for dependency cycles',
11
12
  (yargs) => {
12
- return yargs.positional('package', {
13
- describe: 'Specific package to check',
14
- })
13
+ return packagePositionalParam(yargs)
15
14
  },
16
15
  (argv) => {
17
16
  const start = Date.now()
@@ -24,9 +23,7 @@ export const xyLintCommands = (args: Argv) => {
24
23
  'lint [package]',
25
24
  'Lint - Run Eslint',
26
25
  (yargs) => {
27
- return yargs.positional('package', {
28
- describe: 'Specific package to check',
29
- })
26
+ return packagePositionalParam(yargs)
30
27
  },
31
28
  async (argv) => {
32
29
  if (argv.verbose) console.log('Lint')
@@ -42,9 +39,7 @@ export const xyLintCommands = (args: Argv) => {
42
39
  'fix [package]',
43
40
  'Fix - Run Eslint w/fix',
44
41
  (yargs) => {
45
- return yargs.positional('package', {
46
- describe: 'Specific package to check',
47
- })
42
+ return packagePositionalParam(yargs)
48
43
  },
49
44
  (argv) => {
50
45
  const start = Date.now()
@@ -57,9 +52,7 @@ export const xyLintCommands = (args: Argv) => {
57
52
  'relint [package]',
58
53
  'Relint - Clean & Lint',
59
54
  (yargs) => {
60
- return yargs.positional('package', {
61
- describe: 'Specific package to relint',
62
- })
55
+ return packagePositionalParam(yargs)
63
56
  },
64
57
  (argv) => {
65
58
  if (argv.verbose) console.log('Relinting')
@@ -72,9 +65,7 @@ export const xyLintCommands = (args: Argv) => {
72
65
  'publint [package]',
73
66
  'Publint - Run Publint',
74
67
  (yargs) => {
75
- return yargs.positional('package', {
76
- describe: 'Specific package to publint',
77
- })
68
+ return packagePositionalParam(yargs)
78
69
  },
79
70
  async (argv) => {
80
71
  if (argv.verbose) console.log('Publint')
@@ -87,7 +78,7 @@ export const xyLintCommands = (args: Argv) => {
87
78
  'sonar',
88
79
  'Sonar - Run Sonar Check',
89
80
  (yargs) => {
90
- return yargs
81
+ return packagePositionalParam(yargs)
91
82
  },
92
83
  (argv) => {
93
84
  const start = Date.now()
@@ -1,5 +1,4 @@
1
1
  import yargs, { Argv } from 'yargs'
2
-
3
2
  import { hideBin } from 'yargs/helpers'
4
3
 
5
4
  export const xyParseOptions = (): Argv => {