@xylabs/ts-scripts-yarn3 2.8.0-rc.3 → 2.8.0-rc.6

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 (53) hide show
  1. package/dist/cjs/actions/build.d.ts.map +1 -1
  2. package/dist/cjs/actions/build.js +1 -0
  3. package/dist/cjs/actions/build.js.map +1 -1
  4. package/dist/cjs/actions/compile.d.ts +7 -1
  5. package/dist/cjs/actions/compile.d.ts.map +1 -1
  6. package/dist/cjs/actions/compile.js +28 -6
  7. package/dist/cjs/actions/compile.js.map +1 -1
  8. package/dist/cjs/actions/index.d.ts +1 -0
  9. package/dist/cjs/actions/index.d.ts.map +1 -1
  10. package/dist/cjs/actions/index.js +1 -0
  11. package/dist/cjs/actions/index.js.map +1 -1
  12. package/dist/cjs/actions/upplug.d.ts +2 -0
  13. package/dist/cjs/actions/upplug.d.ts.map +1 -0
  14. package/dist/cjs/actions/upplug.js +14 -0
  15. package/dist/cjs/actions/upplug.js.map +1 -0
  16. package/dist/cjs/bin/upplug.d.ts +3 -0
  17. package/dist/cjs/bin/upplug.d.ts.map +1 -0
  18. package/dist/cjs/bin/upplug.js +6 -0
  19. package/dist/cjs/bin/upplug.js.map +1 -0
  20. package/dist/cjs/lib/xy.d.ts.map +1 -1
  21. package/dist/cjs/lib/xy.js +11 -4
  22. package/dist/cjs/lib/xy.js.map +1 -1
  23. package/dist/esm/actions/build.d.ts.map +1 -1
  24. package/dist/esm/actions/build.js +1 -0
  25. package/dist/esm/actions/build.js.map +1 -1
  26. package/dist/esm/actions/compile.d.ts +7 -1
  27. package/dist/esm/actions/compile.d.ts.map +1 -1
  28. package/dist/esm/actions/compile.js +24 -4
  29. package/dist/esm/actions/compile.js.map +1 -1
  30. package/dist/esm/actions/index.d.ts +1 -0
  31. package/dist/esm/actions/index.d.ts.map +1 -1
  32. package/dist/esm/actions/index.js +1 -0
  33. package/dist/esm/actions/index.js.map +1 -1
  34. package/dist/esm/actions/upplug.d.ts +2 -0
  35. package/dist/esm/actions/upplug.d.ts.map +1 -0
  36. package/dist/esm/actions/upplug.js +10 -0
  37. package/dist/esm/actions/upplug.js.map +1 -0
  38. package/dist/esm/bin/upplug.d.ts +3 -0
  39. package/dist/esm/bin/upplug.d.ts.map +1 -0
  40. package/dist/esm/bin/upplug.js +4 -0
  41. package/dist/esm/bin/upplug.js.map +1 -0
  42. package/dist/esm/lib/xy.d.ts.map +1 -1
  43. package/dist/esm/lib/xy.js +11 -4
  44. package/dist/esm/lib/xy.js.map +1 -1
  45. package/dist/tsconfig.build.cjs.tsbuildinfo +1 -1
  46. package/dist/tsconfig.build.esm.tsbuildinfo +1 -1
  47. package/package.json +12 -33
  48. package/src/actions/build.ts +1 -0
  49. package/src/actions/compile.ts +35 -4
  50. package/src/actions/index.ts +1 -0
  51. package/src/actions/upplug.ts +10 -0
  52. package/src/bin/upplug.ts +5 -0
  53. package/src/lib/xy.ts +15 -3
@@ -5,12 +5,43 @@ export interface CompileParams {
5
5
  pkg?: string
6
6
  }
7
7
 
8
- export const compile = ({ target }: CompileParams) => {
8
+ export interface CompilePackageParams {
9
+ target?: 'esm' | 'cjs'
10
+ pkg: string
11
+ }
12
+
13
+ export const compile = ({ target, pkg }: CompileParams) => {
14
+ return pkg ? compilePackage({ pkg, target }) : compileAll({ target })
15
+ }
16
+
17
+ export const compilePackage = ({ target, pkg }: CompilePackageParams) => {
18
+ const cjsSteps: ScriptStep[] =
19
+ !target || target === 'cjs'
20
+ ? [
21
+ ['yarn', ['tsconfig-gen', '-t', 'cjs']],
22
+ ['yarn', ['workspace', pkg, 'run', 'package-compile-cjs']],
23
+ ['yarn', ['xy', 'copy-assets', '-t', 'cjs']],
24
+ ]
25
+ : []
26
+
27
+ const esmSteps: ScriptStep[] =
28
+ !target || target === 'esm'
29
+ ? [
30
+ ['yarn', ['tsconfig-gen', '-t', 'esm']],
31
+ ['yarn', ['workspace', pkg, 'run', 'package-compile-esm']],
32
+ ['yarn', ['xy', 'copy-assets', '-t', 'esm']],
33
+ ]
34
+ : []
35
+
36
+ return runSteps(`Compile [${pkg}]`, [...esmSteps]) || runSteps('Compile', [...cjsSteps])
37
+ }
38
+
39
+ export const compileAll = ({ target }: CompileParams) => {
9
40
  const cjsSteps: ScriptStep[] =
10
41
  !target || target === 'cjs'
11
42
  ? [
12
43
  ['yarn', ['tsconfig-gen', '-t', 'cjs']],
13
- ['yarn', 'workspaces foreach -ptA exec yarn compile-esm'],
44
+ ['yarn', 'workspaces foreach -ptA run package-compile-cjs'],
14
45
  ['yarn', ['xy', 'copy-assets', '-t', 'cjs']],
15
46
  ]
16
47
  : []
@@ -19,10 +50,10 @@ export const compile = ({ target }: CompileParams) => {
19
50
  !target || target === 'esm'
20
51
  ? [
21
52
  ['yarn', ['tsconfig-gen', '-t', 'esm']],
22
- ['yarn', 'workspaces foreach -ptA exec yarn compile-cjs'],
53
+ ['yarn', 'workspaces foreach -ptA run package-compile-esm'],
23
54
  ['yarn', ['xy', 'copy-assets', '-t', 'esm']],
24
55
  ]
25
56
  : []
26
57
 
27
- return runSteps('Compile', [...esmSteps]) || runSteps('Compile', [...cjsSteps]) || runSteps('Compile', [['yarn', 'deps']])
58
+ return runSteps('Compile [All]', [...esmSteps]) || runSteps('Compile [All]', [...cjsSteps])
28
59
  }
@@ -31,4 +31,5 @@ export * from './tsconfig-gen-esm'
31
31
  export * from './tsconfig-gen-test'
32
32
  export * from './up'
33
33
  export * from './updo'
34
+ export * from './upplug'
34
35
  export * from './yarn3only'
@@ -0,0 +1,10 @@
1
+ import { runSteps } from '../lib'
2
+
3
+ export const updateYarnPlugins = () => {
4
+ return runSteps('Update Yarn Plugins [Outdated]', [
5
+ ['yarn', ['plugin', 'import', '@yarnpkg/plugin-outdated']],
6
+ ['yarn', ['plugin', 'import', '@yarnpkg/plugin-version']],
7
+ ['yarn', ['plugin', 'import', '@yarnpkg/plugin-interactive-tools']],
8
+ ['yarn', ['plugin', 'import', '@yarnpkg/plugin-workspace-tools']],
9
+ ])
10
+ }
@@ -0,0 +1,5 @@
1
+ #!/usr/bin/env node
2
+
3
+ import { runXy } from "../lib"
4
+
5
+ runXy('upplug')
package/src/lib/xy.ts CHANGED
@@ -30,6 +30,7 @@ import {
30
30
  tsconfigGen,
31
31
  tsconfigGenClean,
32
32
  up,
33
+ updateYarnPlugins,
33
34
  updo,
34
35
  yarn3Only,
35
36
  } from '../actions'
@@ -80,7 +81,7 @@ export const xy = () => {
80
81
  },
81
82
  (argv) => {
82
83
  if (argv.verbose) console.info(`Building: ${argv.package ?? 'all'}`)
83
- process.exitCode = build({ target: argv.target as 'esm' | 'cjs' })
84
+ process.exitCode = build({ pkg: argv.package as string, target: argv.target as 'esm' | 'cjs' })
84
85
  },
85
86
  )
86
87
  .command(
@@ -91,9 +92,9 @@ export const xy = () => {
91
92
  describe: 'Specific package to compile',
92
93
  })
93
94
  },
94
- async (argv) => {
95
+ (argv) => {
95
96
  if (argv.verbose) console.info(`Compiling: ${argv.package ?? 'all'}`)
96
- process.exitCode = await compile({ target: argv.target as 'esm' | 'cjs' })
97
+ process.exitCode = compile({ pkg: argv.package as string, target: argv.target as 'esm' | 'cjs' })
97
98
  },
98
99
  )
99
100
  .command(
@@ -373,6 +374,17 @@ export const xy = () => {
373
374
  process.exitCode = updo()
374
375
  },
375
376
  )
377
+ .command(
378
+ 'upplug',
379
+ 'Upplug - Update Yarn Plugins',
380
+ (yargs) => {
381
+ return yargs
382
+ },
383
+ (argv) => {
384
+ if (argv.verbose) console.info('Upplug')
385
+ process.exitCode = updateYarnPlugins()
386
+ },
387
+ )
376
388
  .command(
377
389
  'yarn3only',
378
390
  'Yarn3Only - Check if using Yarn v3',