@xylabs/ts-scripts-yarn3 5.1.13 → 6.0.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 (164) hide show
  1. package/dist/actions/compile-types.mjs +176 -0
  2. package/dist/actions/compile-types.mjs.map +1 -0
  3. package/dist/actions/fix.mjs +2 -2
  4. package/dist/actions/fix.mjs.map +1 -1
  5. package/dist/actions/index.mjs +251 -139
  6. package/dist/actions/index.mjs.map +1 -1
  7. package/dist/actions/lint-clean.mjs +2 -2
  8. package/dist/actions/lint-clean.mjs.map +1 -1
  9. package/dist/actions/lint.mjs +2 -2
  10. package/dist/actions/lint.mjs.map +1 -1
  11. package/dist/actions/package/compile/compile.mjs +88 -64
  12. package/dist/actions/package/compile/compile.mjs.map +1 -1
  13. package/dist/actions/package/compile/compileTypes.mjs +164 -0
  14. package/dist/actions/package/compile/compileTypes.mjs.map +1 -0
  15. package/dist/actions/package/compile/deepMerge.mjs +31 -0
  16. package/dist/actions/package/compile/deepMerge.mjs.map +1 -0
  17. package/dist/actions/package/compile/index.mjs +101 -65
  18. package/dist/actions/package/compile/index.mjs.map +1 -1
  19. package/dist/actions/package/compile/packageCompileTscTypes.mjs +3 -2
  20. package/dist/actions/package/compile/packageCompileTscTypes.mjs.map +1 -1
  21. package/dist/actions/package/compile/packageCompileTsup.mjs +90 -65
  22. package/dist/actions/package/compile/packageCompileTsup.mjs.map +1 -1
  23. package/dist/actions/package/index.mjs +116 -80
  24. package/dist/actions/package/index.mjs.map +1 -1
  25. package/dist/actions/package/recompile.mjs +88 -64
  26. package/dist/actions/package/recompile.mjs.map +1 -1
  27. package/dist/bin/package/build-only.mjs +88 -64
  28. package/dist/bin/package/build-only.mjs.map +1 -1
  29. package/dist/bin/package/build.mjs +88 -64
  30. package/dist/bin/package/build.mjs.map +1 -1
  31. package/dist/bin/package/compile-only.mjs +88 -64
  32. package/dist/bin/package/compile-only.mjs.map +1 -1
  33. package/dist/bin/package/compile-tsup.mjs +88 -64
  34. package/dist/bin/package/compile-tsup.mjs.map +1 -1
  35. package/dist/bin/package/compile-types.mjs +173 -0
  36. package/dist/bin/package/compile-types.mjs.map +1 -0
  37. package/dist/bin/package/compile.mjs +88 -64
  38. package/dist/bin/package/compile.mjs.map +1 -1
  39. package/dist/bin/package/recompile.mjs +88 -64
  40. package/dist/bin/package/recompile.mjs.map +1 -1
  41. package/dist/bin/xy.mjs +132 -45
  42. package/dist/bin/xy.mjs.map +1 -1
  43. package/dist/index.d.ts +21 -1
  44. package/dist/index.mjs +275 -149
  45. package/dist/index.mjs.map +1 -1
  46. package/dist/xy/index.mjs +132 -45
  47. package/dist/xy/index.mjs.map +1 -1
  48. package/dist/xy/xy.mjs +132 -45
  49. package/dist/xy/xy.mjs.map +1 -1
  50. package/dist/xy/xyBuildCommands.mjs +92 -5
  51. package/dist/xy/xyBuildCommands.mjs.map +1 -1
  52. package/dist/xy/xyLintCommands.mjs +2 -2
  53. package/dist/xy/xyLintCommands.mjs.map +1 -1
  54. package/package.json +18 -49
  55. package/src/actions/compile-types.ts +67 -0
  56. package/src/actions/index.ts +1 -0
  57. package/src/actions/lint.ts +1 -1
  58. package/src/actions/package/compile/compileTypes.ts +13 -0
  59. package/src/actions/package/compile/deepMerge.ts +33 -0
  60. package/src/actions/package/compile/index.ts +2 -0
  61. package/src/actions/package/compile/packageCompileTscTypes.ts +3 -2
  62. package/src/actions/package/compile/packageCompileTsup.ts +39 -53
  63. package/src/bin/package/compile-types.ts +16 -0
  64. package/src/bin/xy.ts +1 -1
  65. package/src/xy/xyBuildCommands.ts +19 -1
  66. package/dist/bin/build.mjs +0 -17
  67. package/dist/bin/build.mjs.map +0 -1
  68. package/dist/bin/clean.mjs +0 -17
  69. package/dist/bin/clean.mjs.map +0 -1
  70. package/dist/bin/compile-only.mjs +0 -17
  71. package/dist/bin/compile-only.mjs.map +0 -1
  72. package/dist/bin/compile.mjs +0 -17
  73. package/dist/bin/compile.mjs.map +0 -1
  74. package/dist/bin/cycle.mjs +0 -17
  75. package/dist/bin/cycle.mjs.map +0 -1
  76. package/dist/bin/dead.mjs +0 -17
  77. package/dist/bin/dead.mjs.map +0 -1
  78. package/dist/bin/deploy-major.mjs +0 -17
  79. package/dist/bin/deploy-major.mjs.map +0 -1
  80. package/dist/bin/deploy-minor.mjs +0 -17
  81. package/dist/bin/deploy-minor.mjs.map +0 -1
  82. package/dist/bin/deploy-next.mjs +0 -17
  83. package/dist/bin/deploy-next.mjs.map +0 -1
  84. package/dist/bin/deploy.mjs +0 -17
  85. package/dist/bin/deploy.mjs.map +0 -1
  86. package/dist/bin/deps.mjs +0 -17
  87. package/dist/bin/deps.mjs.map +0 -1
  88. package/dist/bin/fix.mjs +0 -17
  89. package/dist/bin/fix.mjs.map +0 -1
  90. package/dist/bin/gen-docs.mjs +0 -17
  91. package/dist/bin/gen-docs.mjs.map +0 -1
  92. package/dist/bin/gitlint-fix.mjs +0 -17
  93. package/dist/bin/gitlint-fix.mjs.map +0 -1
  94. package/dist/bin/gitlint.mjs +0 -17
  95. package/dist/bin/gitlint.mjs.map +0 -1
  96. package/dist/bin/license.mjs +0 -17
  97. package/dist/bin/license.mjs.map +0 -1
  98. package/dist/bin/lint-clean.mjs +0 -17
  99. package/dist/bin/lint-clean.mjs.map +0 -1
  100. package/dist/bin/lint-fast.mjs +0 -17
  101. package/dist/bin/lint-fast.mjs.map +0 -1
  102. package/dist/bin/lint-profile.mjs +0 -17
  103. package/dist/bin/lint-profile.mjs.map +0 -1
  104. package/dist/bin/lint.mjs +0 -17
  105. package/dist/bin/lint.mjs.map +0 -1
  106. package/dist/bin/publint.mjs +0 -17
  107. package/dist/bin/publint.mjs.map +0 -1
  108. package/dist/bin/rebuild.mjs +0 -17
  109. package/dist/bin/rebuild.mjs.map +0 -1
  110. package/dist/bin/recompile.mjs +0 -17
  111. package/dist/bin/recompile.mjs.map +0 -1
  112. package/dist/bin/reinstall.mjs +0 -17
  113. package/dist/bin/reinstall.mjs.map +0 -1
  114. package/dist/bin/relint.mjs +0 -17
  115. package/dist/bin/relint.mjs.map +0 -1
  116. package/dist/bin/sonar.mjs +0 -17
  117. package/dist/bin/sonar.mjs.map +0 -1
  118. package/dist/bin/test.mjs +0 -17
  119. package/dist/bin/test.mjs.map +0 -1
  120. package/dist/bin/up.mjs +0 -17
  121. package/dist/bin/up.mjs.map +0 -1
  122. package/dist/bin/updo.mjs +0 -17
  123. package/dist/bin/updo.mjs.map +0 -1
  124. package/dist/bin/upplug.mjs +0 -17
  125. package/dist/bin/upplug.mjs.map +0 -1
  126. package/dist/bin/upyarn.mjs +0 -17
  127. package/dist/bin/upyarn.mjs.map +0 -1
  128. package/dist/bin/xy-ts.mjs +0 -1930
  129. package/dist/bin/xy-ts.mjs.map +0 -1
  130. package/dist/bin/yarn3only.mjs +0 -17
  131. package/dist/bin/yarn3only.mjs.map +0 -1
  132. package/src/bin/build.ts +0 -5
  133. package/src/bin/clean.ts +0 -5
  134. package/src/bin/compile-only.ts +0 -5
  135. package/src/bin/compile.ts +0 -5
  136. package/src/bin/cycle.ts +0 -5
  137. package/src/bin/dead.ts +0 -5
  138. package/src/bin/deploy-major.ts +0 -5
  139. package/src/bin/deploy-minor.ts +0 -5
  140. package/src/bin/deploy-next.ts +0 -5
  141. package/src/bin/deploy.ts +0 -5
  142. package/src/bin/deps.ts +0 -5
  143. package/src/bin/fix.ts +0 -5
  144. package/src/bin/gen-docs.ts +0 -5
  145. package/src/bin/gitlint-fix.ts +0 -5
  146. package/src/bin/gitlint.ts +0 -5
  147. package/src/bin/license.ts +0 -5
  148. package/src/bin/lint-clean.ts +0 -5
  149. package/src/bin/lint-fast.ts +0 -5
  150. package/src/bin/lint-profile.ts +0 -5
  151. package/src/bin/lint.ts +0 -5
  152. package/src/bin/publint.ts +0 -5
  153. package/src/bin/rebuild.ts +0 -5
  154. package/src/bin/recompile.ts +0 -5
  155. package/src/bin/reinstall.ts +0 -5
  156. package/src/bin/relint.ts +0 -5
  157. package/src/bin/sonar.ts +0 -5
  158. package/src/bin/test.ts +0 -5
  159. package/src/bin/up.ts +0 -5
  160. package/src/bin/updo.ts +0 -5
  161. package/src/bin/upplug.ts +0 -5
  162. package/src/bin/upyarn.ts +0 -5
  163. package/src/bin/xy-ts.ts +0 -12
  164. package/src/bin/yarn3only.ts +0 -5
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xylabs/ts-scripts-yarn3",
3
- "version": "5.1.13",
3
+ "version": "6.0.0",
4
4
  "description": "TypeScript project scripts",
5
5
  "keywords": [
6
6
  "xylabs",
@@ -34,31 +34,12 @@
34
34
  "module": "dist/index.mjs",
35
35
  "types": "dist/index.d.ts",
36
36
  "bin": {
37
- "build": "dist/bin/build.mjs",
38
- "clean": "dist/bin/clean.mjs",
39
- "compile": "dist/bin/compile.mjs",
40
- "compile-only": "dist/bin/compile-only.mjs",
41
- "cycle": "dist/bin/cycle.mjs",
42
- "dead": "dist/bin/dead.mjs",
43
- "deploy": "dist/bin/deploy.mjs",
44
- "deploy-major": "dist/bin/deploy-major.mjs",
45
- "deploy-minor": "dist/bin/deploy-minor.mjs",
46
- "deploy-next": "dist/bin/deploy-next.mjs",
47
- "deps": "dist/bin/deps.mjs",
48
- "fix": "dist/bin/fix.mjs",
49
- "gen-docs": "dist/bin/gen-docs.mjs",
50
- "gitlint": "dist/bin/gitlint.mjs",
51
- "gitlint-fix": "dist/bin/gitlint-fix.mjs",
52
- "license": "dist/bin/license.mjs",
53
- "lint": "dist/bin/lint.mjs",
54
- "lint-clean": "dist/bin/lint-clean.mjs",
55
- "lint-fast": "dist/bin/lint-fast.mjs",
56
- "lint-profile": "dist/bin/lint-profile.mjs",
57
37
  "package-build": "dist/bin/package/build.mjs",
58
38
  "package-build-only": "dist/bin/package/build-only.mjs",
59
39
  "package-clean": "dist/bin/package/clean.mjs",
60
40
  "package-compile": "dist/bin/package/compile.mjs",
61
41
  "package-compile-only": "dist/bin/package/compile-only.mjs",
42
+ "package-compile-types": "dist/bin/package/compile-types.mjs",
62
43
  "package-copy-assets-cjs": "dist/bin/package/copy-assets-cjs.mjs",
63
44
  "package-copy-assets-esm": "dist/bin/package/copy-assets-esm.mjs",
64
45
  "package-deps": "dist/bin/package/deps.mjs",
@@ -67,19 +48,7 @@
67
48
  "package-lint": "dist/bin/package/lint.mjs",
68
49
  "package-publint": "dist/bin/package/publint.mjs",
69
50
  "package-recompile": "dist/bin/package/recompile.mjs",
70
- "rebuild": "dist/bin/rebuild.mjs",
71
- "recompile": "dist/bin/recompile.mjs",
72
- "reinstall": "dist/bin/reinstall.mjs",
73
- "relint": "dist/bin/relint.mjs",
74
- "sonar": "dist/bin/sonar.mjs",
75
- "test": "dist/bin/test.mjs",
76
- "up": "dist/bin/up.mjs",
77
- "updo": "dist/bin/updo.mjs",
78
- "upplug": "dist/bin/upplug.mjs",
79
- "upyarn": "dist/bin/upyarn.mjs",
80
- "xy": "dist/bin/xy.mjs",
81
- "xy-ts": "src/bin/xy-ts.ts",
82
- "yarn3only": "dist/bin/yarn3only.mjs"
51
+ "xy": "dist/bin/xy.mjs"
83
52
  },
84
53
  "scripts": {
85
54
  "package-clean": "echo Not cleaning...",
@@ -87,14 +56,14 @@
87
56
  "package-recompile": "tsup && publint"
88
57
  },
89
58
  "dependencies": {
90
- "@rollup/plugin-commonjs": "^28.0.2",
59
+ "@rollup/plugin-commonjs": "^28.0.3",
91
60
  "@rollup/plugin-json": "^6.1.0",
92
61
  "@rollup/plugin-typescript": "^12.1.2",
93
- "@swc/core": "^1.11.5",
94
- "@types/node": "^22.13.5",
62
+ "@swc/core": "^1.11.8",
63
+ "@types/node": "^22.13.10",
95
64
  "@types/yargs": "^17.0.33",
96
- "@xylabs/tsconfig": "^5.1.13",
97
- "@xylabs/tsconfig-dom": "^5.1.13",
65
+ "@xylabs/tsconfig": "^6.0.0",
66
+ "@xylabs/tsconfig-dom": "^6.0.0",
98
67
  "async-mutex": "^0.5.0",
99
68
  "chalk": "^5.4.1",
100
69
  "cosmiconfig": "^9.0.0",
@@ -102,8 +71,8 @@
102
71
  "cpy": "^11.1.0",
103
72
  "deepmerge": "^4.3.1",
104
73
  "depcheck": "^1.4.7",
105
- "esbuild": "0.24.2",
106
- "eslint": "^9.21.0",
74
+ "esbuild": "0.25.1",
75
+ "eslint": "^9.22.0",
107
76
  "find-up": "^7.0.0",
108
77
  "glob": "^11.0.1",
109
78
  "jsonc-eslint-parser": "^2.4.0",
@@ -114,21 +83,21 @@
114
83
  "npm-package-json-lint-config-default": "^7.0.1",
115
84
  "parse-git-config": "^3.0.0",
116
85
  "picomatch": "^4.0.2",
117
- "publint": "^0.3.7",
86
+ "publint": "^0.3.9",
118
87
  "reflect-metadata": "^0.2.2",
119
- "rollup": "^4.34.8",
88
+ "rollup": "^4.35.0",
120
89
  "rollup-plugin-exclude-dependencies-from-bundle": "^1.1.24",
121
90
  "rollup-plugin-node-externals": "^8.0.0",
122
- "sort-package-json": "^2.15.0",
91
+ "sort-package-json": "^3.0.0",
123
92
  "supertest": "^7.0.0",
124
93
  "ts-node": "^10.9.2",
125
94
  "ts-prune": "^0.10.3",
126
95
  "tsc-prog": "^2.3.0",
127
96
  "tslib": "^2.8.1",
128
- "tsup": "8.3.6",
97
+ "tsup": "8.4.0",
129
98
  "typedoc": "^0.27.9",
130
99
  "types-package-json": "^2.0.39",
131
- "vitest": "^3.0.7",
100
+ "vitest": "^3.0.8",
132
101
  "yargs": "^17.7.2"
133
102
  },
134
103
  "devDependencies": {
@@ -136,10 +105,10 @@
136
105
  "@types/license-checker": "^25.0.6",
137
106
  "@types/parse-git-config": "^3.0.4",
138
107
  "@types/picomatch": "^3.0.2",
139
- "@xylabs/tsconfig": "^5.1.13",
140
- "publint": "^0.3.7",
108
+ "@xylabs/tsconfig": "^6.0.0",
109
+ "publint": "^0.3.9",
141
110
  "rimraf": "^6.0.1",
142
- "typescript": "^5.7.3"
111
+ "typescript": "^5.8.2"
143
112
  },
144
113
  "peerDependencies": {
145
114
  "typescript": "^5"
@@ -0,0 +1,67 @@
1
+ import chalk from 'chalk'
2
+
3
+ import { runSteps } from '../lib/index.ts'
4
+
5
+ export interface CompileTypesParams {
6
+ incremental?: boolean
7
+ jobs?: number
8
+ pkg?: string
9
+ verbose?: boolean
10
+ }
11
+
12
+ interface CompileTypesPackageParams {
13
+ pkg: string
14
+ publint?: boolean
15
+ verbose?: boolean
16
+ }
17
+
18
+ export const compileTypes = ({
19
+ verbose, pkg, incremental, jobs,
20
+ }: CompileTypesParams) => {
21
+ if (verbose) {
22
+ console.log(chalk.gray('Compiling Types'))
23
+ }
24
+ return pkg
25
+ ? compileTypesPackage({ pkg, verbose })
26
+ : compileTypesAll({
27
+ incremental, verbose, jobs,
28
+ })
29
+ }
30
+
31
+ export const compileTypesPackage = ({ verbose, pkg }: CompileTypesPackageParams) => {
32
+ if (verbose) {
33
+ console.log(chalk.gray('Compiling Types [Package]'))
34
+ }
35
+ return runSteps(
36
+ `Compile [${pkg}]`,
37
+ [['yarn', ['workspace', pkg, 'run', 'package-compile-types']]],
38
+ )
39
+ }
40
+
41
+ export const compileTypesAll = ({
42
+ jobs, verbose, incremental,
43
+ }: CompileTypesParams) => {
44
+ if (verbose) {
45
+ console.log(chalk.gray('Compiling Types [All]'))
46
+ }
47
+ const start = Date.now()
48
+ const verboseOptions = verbose ? ['--verbose'] : ['--no-verbose']
49
+ const incrementalOptions = incremental ? ['--since', '-Ap'] : ['--parallel', '-Ap']
50
+ const jobsOptions = jobs ? ['-j', `${jobs}`] : []
51
+ if (jobs) {
52
+ console.log(chalk.blue(`Jobs set to [${jobs}]`))
53
+ }
54
+
55
+ const result = runSteps(`Compile Types ${incremental ? '[Incremental]' : ''} [All]`, [
56
+ ['yarn', ['workspaces',
57
+ 'foreach',
58
+ ...incrementalOptions,
59
+ ...jobsOptions,
60
+ ...verboseOptions,
61
+ 'run',
62
+ 'package-compile-types',
63
+ ]],
64
+ ])
65
+ console.log(`${chalk.gray('Types Compiled in')} [${chalk.magenta(((Date.now() - start) / 1000).toFixed(2))}] ${chalk.gray('seconds')}`)
66
+ return result
67
+ }
@@ -2,6 +2,7 @@ export * from './build.ts'
2
2
  export * from './clean.ts'
3
3
  export * from './clean-docs.ts'
4
4
  export * from './compile.ts'
5
+ export * from './compile-types.ts'
5
6
  export * from './copy-assets.ts'
6
7
  export * from './cycle.ts'
7
8
  export * from './dead.ts'
@@ -72,7 +72,7 @@ export const lintAllPackages = ({
72
72
  console.log(chalk.gray(`${fix ? 'Fix' : 'Lint'} [All-Packages]`))
73
73
  const start = Date.now()
74
74
  const verboseOptions = verbose ? ['--verbose'] : ['--no-verbose']
75
- const incrementalOptions = incremental ? ['--since', '-ApR'] : ['--parallel', '-ApR']
75
+ const incrementalOptions = incremental ? ['--since', '-Ap'] : ['--parallel', '-Ap']
76
76
 
77
77
  const result = runSteps(`${fix ? 'Fix' : 'Lint'} [All-Packages]`, [
78
78
  ['yarn', ['workspaces',
@@ -0,0 +1,13 @@
1
+ import chalk from 'chalk'
2
+
3
+ import { loadConfig } from '../../../lib/index.ts'
4
+ import { packageCompileTscTypes } from './packageCompileTscTypes.ts'
5
+ import type { XyConfig, XyTscConfig } from './XyConfig.ts'
6
+
7
+ export const packageCompileTypes = async (inConfig: XyConfig = {}): Promise<number> => {
8
+ const pkg = process.env.INIT_CWD
9
+ console.log(chalk.green(`Compiling Types ${pkg}`))
10
+ const config = await loadConfig(inConfig)
11
+
12
+ return packageCompileTscTypes(undefined, config as XyTscConfig)
13
+ }
@@ -0,0 +1,33 @@
1
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
2
+ type AnyObject = Record<any, any>
3
+
4
+ function deepMerge<T extends AnyObject>(target: AnyObject, source: AnyObject): T {
5
+ if (!source || typeof source !== 'object') return target
6
+
7
+ for (const key of Object.keys(source)) {
8
+ if (
9
+ typeof source[key] === 'object'
10
+ && source[key] !== null
11
+ && !Array.isArray(source[key])
12
+ ) {
13
+ // Recursively merge nested objects
14
+ if (!target[key] || typeof target[key] !== 'object') {
15
+ target[key] = {} as T[typeof key]
16
+ }
17
+ deepMerge(target[key], source[key])
18
+ } else {
19
+ // Overwrite with non-object values
20
+ target[key] = source[key]
21
+ }
22
+ }
23
+
24
+ return target
25
+ }
26
+
27
+ export function deepMergeObjects<T extends AnyObject>(objects: T[]): T {
28
+ const result = {} as T
29
+ for (const obj of objects) {
30
+ deepMerge(result, obj)
31
+ }
32
+ return result
33
+ }
@@ -1,4 +1,6 @@
1
1
  export * from './compile.ts'
2
+ export * from './compileTypes.ts'
2
3
  export * from './packageCompileTsc.ts'
4
+ export * from './packageCompileTscTypes.ts'
3
5
  export * from './packageCompileTsup.ts'
4
6
  export * from './XyConfig.ts'
@@ -12,10 +12,11 @@ import type { XyConfig } from './XyConfig.ts'
12
12
 
13
13
  export const packageCompileTscTypes = (
14
14
  folder: string = 'src',
15
- { verbose }: XyConfig = {},
15
+ config: XyConfig = {},
16
16
  compilerOptionsParam?: CompilerOptions,
17
17
  ): number => {
18
18
  const pkg = process.env.INIT_CWD ?? cwd()
19
+ const verbose = config?.verbose ?? false
19
20
 
20
21
  if (verbose) {
21
22
  console.log(`Compiling types with TSC [${pkg}]`)
@@ -25,7 +26,7 @@ export const packageCompileTscTypes = (
25
26
  ...(getCompilerOptions({
26
27
  declaration: true,
27
28
  emitDeclarationOnly: true,
28
- outDir: 'dist',
29
+ outDir: 'dist/types',
29
30
  removeComments: false,
30
31
  skipDefaultLibCheck: true,
31
32
  skipLibCheck: true,
@@ -1,8 +1,10 @@
1
+ /* eslint-disable complexity */
1
2
  import type { Loader } from 'esbuild'
2
3
  import type { Options } from 'tsup'
3
4
  import { build, defineConfig } from 'tsup'
4
5
 
5
6
  import { buildEntries } from './buildEntries.ts'
7
+ import { deepMergeObjects } from './deepMerge.ts'
6
8
  import { packageCompileTscTypes } from './packageCompileTscTypes.ts'
7
9
  import type { EntryMode, XyTsupConfig } from './XyConfig.ts'
8
10
 
@@ -53,17 +55,25 @@ const compileFolder = async (
53
55
  console.log(`TSUP:build:stop [${folder}] ${types}`)
54
56
  }
55
57
 
56
- if (types === 'tsc') {
57
- if (verbose) {
58
- console.log(`Calling packageCompileTscTypes [${folder}] ${types}`)
59
- }
60
- const errors = packageCompileTscTypes(folder, { verbose }, { outDir })
61
- if (errors) {
62
- return errors
63
- }
58
+ return 0
59
+ }
60
+
61
+ export const tsupOptions = (options: Options[] = []): Options => {
62
+ const standardLoaders: Record<string, Loader> = {
63
+ '.gif': 'copy', '.html': 'copy', '.jpg': 'copy', '.json': 'json', '.png': 'copy', '.svg': 'copy', '.webp': 'copy',
64
64
  }
65
65
 
66
- return 0
66
+ const standardOptions: Options = {
67
+ bundle: true,
68
+ format: ['esm'],
69
+ loader: standardLoaders,
70
+ outExtension: ({ format }) => (format === 'esm' ? { js: '.mjs' } : { js: '.cjs' }),
71
+ skipNodeModulesBundle: true,
72
+ sourcemap: true,
73
+ target: 'esnext',
74
+ }
75
+
76
+ return deepMergeObjects([standardOptions, ...options])
67
77
  }
68
78
 
69
79
  export const packageCompileTsup = async (config?: XyTsupConfig, types: 'tsc' | 'tsup' = 'tsc') => {
@@ -78,17 +88,14 @@ export const packageCompileTsup = async (config?: XyTsupConfig, types: 'tsc' | '
78
88
  const compileForBrowser = compile?.browser ?? { src: {} }
79
89
  const compileForNeutral = compile?.neutral ?? { src: {} }
80
90
 
81
- const standardLoaders: Record<string, Loader> = {
82
- '.gif': 'copy', '.html': 'copy', '.jpg': 'copy', '.json': 'json', '.png': 'copy', '.svg': 'copy', '.webp': 'copy',
83
- }
84
- const standardOptions: Options = {
85
- bundle: true,
86
- format: ['esm'],
87
- loader: standardLoaders,
88
- outExtension: ({ format }) => (format === 'esm' ? { js: '.mjs' } : { js: '.cjs' }),
89
- skipNodeModulesBundle: true,
90
- sourcemap: true,
91
- target: 'esnext',
91
+ if (types === 'tsc') {
92
+ if (verbose) {
93
+ console.log(`Calling packageCompileTscTypes [${types}`)
94
+ }
95
+ const errors = packageCompileTscTypes('src', { verbose })
96
+ if (errors) {
97
+ return errors
98
+ }
92
99
  }
93
100
 
94
101
  return (
@@ -100,17 +107,10 @@ export const packageCompileTsup = async (config?: XyTsupConfig, types: 'tsc' | '
100
107
  ? await compileFolder(
101
108
  folder,
102
109
  compile?.entryMode,
103
- {
104
- ...standardOptions,
105
- loader: {
106
- ...standardOptions.loader,
107
- ...inEsBuildOptions?.loader,
108
- },
109
- outDir: 'dist/node',
110
- platform: 'node',
111
- ...compile?.tsup?.options,
112
- ...(typeof options === 'object' ? options : {}),
113
- },
110
+ tsupOptions([inEsBuildOptions,
111
+ compile?.tsup?.options ?? {},
112
+ (typeof options === 'object' ? options : {}),
113
+ { platform: 'node', outDir: 'dist/node' }]),
114
114
  types,
115
115
  verbose,
116
116
  )
@@ -126,17 +126,10 @@ export const packageCompileTsup = async (config?: XyTsupConfig, types: 'tsc' | '
126
126
  ? await compileFolder(
127
127
  folder,
128
128
  compile?.entryMode,
129
- {
130
- ...standardOptions,
131
- loader: {
132
- ...standardOptions.loader,
133
- ...inEsBuildOptions?.loader,
134
- },
135
- outDir: 'dist/browser',
136
- platform: 'browser',
137
- ...compile?.tsup?.options,
138
- ...(typeof options === 'object' ? options : {}),
139
- },
129
+ tsupOptions([inEsBuildOptions,
130
+ compile?.tsup?.options ?? {},
131
+ (typeof options === 'object' ? options : {}),
132
+ { platform: 'browser', outDir: 'dist/browser' }]),
140
133
  types,
141
134
  verbose,
142
135
  )
@@ -152,17 +145,10 @@ export const packageCompileTsup = async (config?: XyTsupConfig, types: 'tsc' | '
152
145
  ? await compileFolder(
153
146
  folder,
154
147
  compile?.entryMode,
155
- {
156
- ...standardOptions,
157
- loader: {
158
- ...standardOptions.loader,
159
- ...inEsBuildOptions?.loader,
160
- },
161
- outDir: 'dist/neutral',
162
- platform: 'neutral',
163
- ...compile?.tsup?.options,
164
- ...(typeof options === 'object' ? options : {}),
165
- },
148
+ tsupOptions([inEsBuildOptions,
149
+ compile?.tsup?.options ?? {},
150
+ (typeof options === 'object' ? options : {}),
151
+ { platform: 'neutral', outDir: 'dist/neutral' }]),
166
152
  types,
167
153
  verbose,
168
154
  )
@@ -0,0 +1,16 @@
1
+ #!/usr/bin/env node
2
+
3
+ import chalk from 'chalk'
4
+
5
+ import { packageCompileTypes } from '../../actions/index.ts'
6
+
7
+ packageCompileTypes({ verbose: true })
8
+ .then((value) => {
9
+ if (value) {
10
+ process.exit(value)
11
+ }
12
+ })
13
+ .catch((reason) => {
14
+ console.error(chalk.red(reason))
15
+ process.exit(-1)
16
+ })
package/src/bin/xy.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env node
2
2
 
3
- import { xy } from '../xy'
3
+ import { xy } from '../xy/index.ts'
4
4
 
5
5
  xy()
6
6
  .then(() => {
@@ -1,7 +1,7 @@
1
1
  import type { Argv } from 'yargs'
2
2
 
3
3
  import {
4
- build, compile, copyAssets, rebuild, recompile,
4
+ build, compile, compileTypes, copyAssets, rebuild, recompile,
5
5
  } from '../actions/index.ts'
6
6
 
7
7
  export const xyBuildCommands = (args: Argv) => {
@@ -46,6 +46,24 @@ export const xyBuildCommands = (args: Argv) => {
46
46
  })
47
47
  },
48
48
  )
49
+ .command(
50
+ 'compile-types [package]',
51
+ 'Compile types with Typescript',
52
+ (yargs) => {
53
+ return yargs.positional('package', { describe: 'Specific package to compile' })
54
+ },
55
+ (argv) => {
56
+ if (argv.verbose) {
57
+ console.log(`Compiling: ${argv.package ?? 'all'}`)
58
+ }
59
+ process.exitCode = compileTypes({
60
+ incremental: !!argv.incremental,
61
+ jobs: argv.jobs as number,
62
+ pkg: argv.package as string,
63
+ verbose: !!argv.verbose,
64
+ })
65
+ },
66
+ )
49
67
  .command(
50
68
  'compile-only [package]',
51
69
  'Compile with Typescript & Copy Images (No Publint)',
@@ -1,17 +0,0 @@
1
- #!/usr/bin/env node
2
- var __defProp = Object.defineProperty;
3
- var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
4
-
5
- // src/lib/runXyWithWarning.ts
6
- import chalk from "chalk";
7
- var runXyWithWarning = /* @__PURE__ */ __name((command) => {
8
- const commandString = `yarn ${command}`;
9
- const commandXyString = `yarn xy ${command}`;
10
- console.warn(chalk.yellow(`WARNING: [${chalk.white(commandString)}] is deprecated for XY Labs Scripts.`));
11
- console.warn(chalk.gray(`Did you mean [${chalk.magenta(commandXyString)}]?`));
12
- return 1;
13
- }, "runXyWithWarning");
14
-
15
- // src/bin/build.ts
16
- runXyWithWarning("build");
17
- //# sourceMappingURL=build.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/lib/runXyWithWarning.ts","../../src/bin/build.ts"],"sourcesContent":["import chalk from 'chalk'\n\nexport const runXyWithWarning = (command: string) => {\n const commandString = `yarn ${command}`\n const commandXyString = `yarn xy ${command}`\n console.warn(chalk.yellow(`WARNING: [${chalk.white(commandString)}] is deprecated for XY Labs Scripts.`))\n console.warn(chalk.gray(`Did you mean [${chalk.magenta(commandXyString)}]?`))\n return 1\n}\n","#!/usr/bin/env node\n\nimport { runXyWithWarning } from '../lib/index.ts'\n\nrunXyWithWarning('build')\n"],"mappings":";;;;;AAAA,OAAOA,WAAW;AAEX,IAAMC,mBAAmB,wBAACC,YAAAA;AAC/B,QAAMC,gBAAgB,QAAQD,OAAAA;AAC9B,QAAME,kBAAkB,WAAWF,OAAAA;AACnCG,UAAQC,KAAKC,MAAMC,OAAO,aAAaD,MAAME,MAAMN,aAAAA,CAAAA,sCAAoD,CAAA;AACvGE,UAAQC,KAAKC,MAAMG,KAAK,iBAAiBH,MAAMI,QAAQP,eAAAA,CAAAA,IAAoB,CAAA;AAC3E,SAAO;AACT,GANgC;;;ACEhCQ,iBAAiB,OAAA;","names":["chalk","runXyWithWarning","command","commandString","commandXyString","console","warn","chalk","yellow","white","gray","magenta","runXyWithWarning"]}
@@ -1,17 +0,0 @@
1
- #!/usr/bin/env node
2
- var __defProp = Object.defineProperty;
3
- var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
4
-
5
- // src/lib/runXyWithWarning.ts
6
- import chalk from "chalk";
7
- var runXyWithWarning = /* @__PURE__ */ __name((command) => {
8
- const commandString = `yarn ${command}`;
9
- const commandXyString = `yarn xy ${command}`;
10
- console.warn(chalk.yellow(`WARNING: [${chalk.white(commandString)}] is deprecated for XY Labs Scripts.`));
11
- console.warn(chalk.gray(`Did you mean [${chalk.magenta(commandXyString)}]?`));
12
- return 1;
13
- }, "runXyWithWarning");
14
-
15
- // src/bin/clean.ts
16
- runXyWithWarning("clean");
17
- //# sourceMappingURL=clean.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/lib/runXyWithWarning.ts","../../src/bin/clean.ts"],"sourcesContent":["import chalk from 'chalk'\n\nexport const runXyWithWarning = (command: string) => {\n const commandString = `yarn ${command}`\n const commandXyString = `yarn xy ${command}`\n console.warn(chalk.yellow(`WARNING: [${chalk.white(commandString)}] is deprecated for XY Labs Scripts.`))\n console.warn(chalk.gray(`Did you mean [${chalk.magenta(commandXyString)}]?`))\n return 1\n}\n","#!/usr/bin/env node\n\nimport { runXyWithWarning } from '../lib/index.ts'\n\nrunXyWithWarning('clean')\n"],"mappings":";;;;;AAAA,OAAOA,WAAW;AAEX,IAAMC,mBAAmB,wBAACC,YAAAA;AAC/B,QAAMC,gBAAgB,QAAQD,OAAAA;AAC9B,QAAME,kBAAkB,WAAWF,OAAAA;AACnCG,UAAQC,KAAKC,MAAMC,OAAO,aAAaD,MAAME,MAAMN,aAAAA,CAAAA,sCAAoD,CAAA;AACvGE,UAAQC,KAAKC,MAAMG,KAAK,iBAAiBH,MAAMI,QAAQP,eAAAA,CAAAA,IAAoB,CAAA;AAC3E,SAAO;AACT,GANgC;;;ACEhCQ,iBAAiB,OAAA;","names":["chalk","runXyWithWarning","command","commandString","commandXyString","console","warn","chalk","yellow","white","gray","magenta","runXyWithWarning"]}
@@ -1,17 +0,0 @@
1
- #!/usr/bin/env node
2
- var __defProp = Object.defineProperty;
3
- var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
4
-
5
- // src/lib/runXyWithWarning.ts
6
- import chalk from "chalk";
7
- var runXyWithWarning = /* @__PURE__ */ __name((command) => {
8
- const commandString = `yarn ${command}`;
9
- const commandXyString = `yarn xy ${command}`;
10
- console.warn(chalk.yellow(`WARNING: [${chalk.white(commandString)}] is deprecated for XY Labs Scripts.`));
11
- console.warn(chalk.gray(`Did you mean [${chalk.magenta(commandXyString)}]?`));
12
- return 1;
13
- }, "runXyWithWarning");
14
-
15
- // src/bin/compile-only.ts
16
- runXyWithWarning("compile-only");
17
- //# sourceMappingURL=compile-only.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/lib/runXyWithWarning.ts","../../src/bin/compile-only.ts"],"sourcesContent":["import chalk from 'chalk'\n\nexport const runXyWithWarning = (command: string) => {\n const commandString = `yarn ${command}`\n const commandXyString = `yarn xy ${command}`\n console.warn(chalk.yellow(`WARNING: [${chalk.white(commandString)}] is deprecated for XY Labs Scripts.`))\n console.warn(chalk.gray(`Did you mean [${chalk.magenta(commandXyString)}]?`))\n return 1\n}\n","#!/usr/bin/env node\n\nimport { runXyWithWarning } from '../lib/index.ts'\n\nrunXyWithWarning('compile-only')\n"],"mappings":";;;;;AAAA,OAAOA,WAAW;AAEX,IAAMC,mBAAmB,wBAACC,YAAAA;AAC/B,QAAMC,gBAAgB,QAAQD,OAAAA;AAC9B,QAAME,kBAAkB,WAAWF,OAAAA;AACnCG,UAAQC,KAAKC,MAAMC,OAAO,aAAaD,MAAME,MAAMN,aAAAA,CAAAA,sCAAoD,CAAA;AACvGE,UAAQC,KAAKC,MAAMG,KAAK,iBAAiBH,MAAMI,QAAQP,eAAAA,CAAAA,IAAoB,CAAA;AAC3E,SAAO;AACT,GANgC;;;ACEhCQ,iBAAiB,cAAA;","names":["chalk","runXyWithWarning","command","commandString","commandXyString","console","warn","chalk","yellow","white","gray","magenta","runXyWithWarning"]}
@@ -1,17 +0,0 @@
1
- #!/usr/bin/env node
2
- var __defProp = Object.defineProperty;
3
- var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
4
-
5
- // src/lib/runXyWithWarning.ts
6
- import chalk from "chalk";
7
- var runXyWithWarning = /* @__PURE__ */ __name((command) => {
8
- const commandString = `yarn ${command}`;
9
- const commandXyString = `yarn xy ${command}`;
10
- console.warn(chalk.yellow(`WARNING: [${chalk.white(commandString)}] is deprecated for XY Labs Scripts.`));
11
- console.warn(chalk.gray(`Did you mean [${chalk.magenta(commandXyString)}]?`));
12
- return 1;
13
- }, "runXyWithWarning");
14
-
15
- // src/bin/compile.ts
16
- runXyWithWarning("compile");
17
- //# sourceMappingURL=compile.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/lib/runXyWithWarning.ts","../../src/bin/compile.ts"],"sourcesContent":["import chalk from 'chalk'\n\nexport const runXyWithWarning = (command: string) => {\n const commandString = `yarn ${command}`\n const commandXyString = `yarn xy ${command}`\n console.warn(chalk.yellow(`WARNING: [${chalk.white(commandString)}] is deprecated for XY Labs Scripts.`))\n console.warn(chalk.gray(`Did you mean [${chalk.magenta(commandXyString)}]?`))\n return 1\n}\n","#!/usr/bin/env node\n\nimport { runXyWithWarning } from '../lib/index.ts'\n\nrunXyWithWarning('compile')\n"],"mappings":";;;;;AAAA,OAAOA,WAAW;AAEX,IAAMC,mBAAmB,wBAACC,YAAAA;AAC/B,QAAMC,gBAAgB,QAAQD,OAAAA;AAC9B,QAAME,kBAAkB,WAAWF,OAAAA;AACnCG,UAAQC,KAAKC,MAAMC,OAAO,aAAaD,MAAME,MAAMN,aAAAA,CAAAA,sCAAoD,CAAA;AACvGE,UAAQC,KAAKC,MAAMG,KAAK,iBAAiBH,MAAMI,QAAQP,eAAAA,CAAAA,IAAoB,CAAA;AAC3E,SAAO;AACT,GANgC;;;ACEhCQ,iBAAiB,SAAA;","names":["chalk","runXyWithWarning","command","commandString","commandXyString","console","warn","chalk","yellow","white","gray","magenta","runXyWithWarning"]}
@@ -1,17 +0,0 @@
1
- #!/usr/bin/env node
2
- var __defProp = Object.defineProperty;
3
- var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
4
-
5
- // src/lib/runXyWithWarning.ts
6
- import chalk from "chalk";
7
- var runXyWithWarning = /* @__PURE__ */ __name((command) => {
8
- const commandString = `yarn ${command}`;
9
- const commandXyString = `yarn xy ${command}`;
10
- console.warn(chalk.yellow(`WARNING: [${chalk.white(commandString)}] is deprecated for XY Labs Scripts.`));
11
- console.warn(chalk.gray(`Did you mean [${chalk.magenta(commandXyString)}]?`));
12
- return 1;
13
- }, "runXyWithWarning");
14
-
15
- // src/bin/cycle.ts
16
- runXyWithWarning("cycle");
17
- //# sourceMappingURL=cycle.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/lib/runXyWithWarning.ts","../../src/bin/cycle.ts"],"sourcesContent":["import chalk from 'chalk'\n\nexport const runXyWithWarning = (command: string) => {\n const commandString = `yarn ${command}`\n const commandXyString = `yarn xy ${command}`\n console.warn(chalk.yellow(`WARNING: [${chalk.white(commandString)}] is deprecated for XY Labs Scripts.`))\n console.warn(chalk.gray(`Did you mean [${chalk.magenta(commandXyString)}]?`))\n return 1\n}\n","#!/usr/bin/env node\n\nimport { runXyWithWarning } from '../lib/index.ts'\n\nrunXyWithWarning('cycle')\n"],"mappings":";;;;;AAAA,OAAOA,WAAW;AAEX,IAAMC,mBAAmB,wBAACC,YAAAA;AAC/B,QAAMC,gBAAgB,QAAQD,OAAAA;AAC9B,QAAME,kBAAkB,WAAWF,OAAAA;AACnCG,UAAQC,KAAKC,MAAMC,OAAO,aAAaD,MAAME,MAAMN,aAAAA,CAAAA,sCAAoD,CAAA;AACvGE,UAAQC,KAAKC,MAAMG,KAAK,iBAAiBH,MAAMI,QAAQP,eAAAA,CAAAA,IAAoB,CAAA;AAC3E,SAAO;AACT,GANgC;;;ACEhCQ,iBAAiB,OAAA;","names":["chalk","runXyWithWarning","command","commandString","commandXyString","console","warn","chalk","yellow","white","gray","magenta","runXyWithWarning"]}
package/dist/bin/dead.mjs DELETED
@@ -1,17 +0,0 @@
1
- #!/usr/bin/env node
2
- var __defProp = Object.defineProperty;
3
- var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
4
-
5
- // src/lib/runXyWithWarning.ts
6
- import chalk from "chalk";
7
- var runXyWithWarning = /* @__PURE__ */ __name((command) => {
8
- const commandString = `yarn ${command}`;
9
- const commandXyString = `yarn xy ${command}`;
10
- console.warn(chalk.yellow(`WARNING: [${chalk.white(commandString)}] is deprecated for XY Labs Scripts.`));
11
- console.warn(chalk.gray(`Did you mean [${chalk.magenta(commandXyString)}]?`));
12
- return 1;
13
- }, "runXyWithWarning");
14
-
15
- // src/bin/dead.ts
16
- runXyWithWarning("dead");
17
- //# sourceMappingURL=dead.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/lib/runXyWithWarning.ts","../../src/bin/dead.ts"],"sourcesContent":["import chalk from 'chalk'\n\nexport const runXyWithWarning = (command: string) => {\n const commandString = `yarn ${command}`\n const commandXyString = `yarn xy ${command}`\n console.warn(chalk.yellow(`WARNING: [${chalk.white(commandString)}] is deprecated for XY Labs Scripts.`))\n console.warn(chalk.gray(`Did you mean [${chalk.magenta(commandXyString)}]?`))\n return 1\n}\n","#!/usr/bin/env node\n\nimport { runXyWithWarning } from '../lib/index.ts'\n\nrunXyWithWarning('dead')\n"],"mappings":";;;;;AAAA,OAAOA,WAAW;AAEX,IAAMC,mBAAmB,wBAACC,YAAAA;AAC/B,QAAMC,gBAAgB,QAAQD,OAAAA;AAC9B,QAAME,kBAAkB,WAAWF,OAAAA;AACnCG,UAAQC,KAAKC,MAAMC,OAAO,aAAaD,MAAME,MAAMN,aAAAA,CAAAA,sCAAoD,CAAA;AACvGE,UAAQC,KAAKC,MAAMG,KAAK,iBAAiBH,MAAMI,QAAQP,eAAAA,CAAAA,IAAoB,CAAA;AAC3E,SAAO;AACT,GANgC;;;ACEhCQ,iBAAiB,MAAA;","names":["chalk","runXyWithWarning","command","commandString","commandXyString","console","warn","chalk","yellow","white","gray","magenta","runXyWithWarning"]}