@xylabs/ts-scripts-yarn3 3.15.4 → 3.15.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 (239) hide show
  1. package/dist/actions/build.cjs.map +1 -1
  2. package/dist/actions/build.mjs.map +1 -1
  3. package/dist/actions/clean-jest.cjs.map +1 -1
  4. package/dist/actions/clean-jest.mjs.map +1 -1
  5. package/dist/actions/clean.cjs.map +1 -1
  6. package/dist/actions/clean.mjs.map +1 -1
  7. package/dist/actions/compile.cjs.map +1 -1
  8. package/dist/actions/compile.mjs.map +1 -1
  9. package/dist/actions/copy-assets.cjs +1 -1
  10. package/dist/actions/copy-assets.cjs.map +1 -1
  11. package/dist/actions/copy-assets.mjs +1 -1
  12. package/dist/actions/copy-assets.mjs.map +1 -1
  13. package/dist/actions/cycle.cjs.map +1 -1
  14. package/dist/actions/cycle.mjs.map +1 -1
  15. package/dist/actions/dead.cjs.map +1 -1
  16. package/dist/actions/dead.mjs.map +1 -1
  17. package/dist/actions/deploy-major.cjs.map +1 -1
  18. package/dist/actions/deploy-major.mjs.map +1 -1
  19. package/dist/actions/deploy-minor.cjs.map +1 -1
  20. package/dist/actions/deploy-minor.mjs.map +1 -1
  21. package/dist/actions/deploy-next.cjs.map +1 -1
  22. package/dist/actions/deploy-next.mjs.map +1 -1
  23. package/dist/actions/deploy.cjs.map +1 -1
  24. package/dist/actions/deploy.mjs.map +1 -1
  25. package/dist/actions/deps.cjs.map +1 -1
  26. package/dist/actions/deps.mjs.map +1 -1
  27. package/dist/actions/dupdeps.cjs +0 -3
  28. package/dist/actions/dupdeps.cjs.map +1 -1
  29. package/dist/actions/dupdeps.mjs +0 -3
  30. package/dist/actions/dupdeps.mjs.map +1 -1
  31. package/dist/actions/fix.cjs.map +1 -1
  32. package/dist/actions/fix.mjs.map +1 -1
  33. package/dist/actions/gen-docs.cjs.map +1 -1
  34. package/dist/actions/gen-docs.mjs.map +1 -1
  35. package/dist/actions/gitignore-gen.cjs.map +1 -1
  36. package/dist/actions/gitignore-gen.mjs.map +1 -1
  37. package/dist/actions/index.cjs +2 -5
  38. package/dist/actions/index.cjs.map +1 -1
  39. package/dist/actions/index.mjs +2 -5
  40. package/dist/actions/index.mjs.map +1 -1
  41. package/dist/actions/license.cjs.map +1 -1
  42. package/dist/actions/license.mjs.map +1 -1
  43. package/dist/actions/lint-clean.cjs.map +1 -1
  44. package/dist/actions/lint-clean.mjs.map +1 -1
  45. package/dist/actions/lint-profile.cjs.map +1 -1
  46. package/dist/actions/lint-profile.mjs.map +1 -1
  47. package/dist/actions/lint.cjs.map +1 -1
  48. package/dist/actions/lint.mjs.map +1 -1
  49. package/dist/actions/npmignore-gen.cjs.map +1 -1
  50. package/dist/actions/npmignore-gen.mjs.map +1 -1
  51. package/dist/actions/package/clean-outputs.cjs.map +1 -1
  52. package/dist/actions/package/clean-outputs.mjs.map +1 -1
  53. package/dist/actions/package/clean-typescript.cjs.map +1 -1
  54. package/dist/actions/package/clean-typescript.mjs.map +1 -1
  55. package/dist/actions/package/clean.cjs.map +1 -1
  56. package/dist/actions/package/clean.mjs.map +1 -1
  57. package/dist/actions/package/compile/XyConfig.cjs.map +1 -1
  58. package/dist/actions/package/compile/buildEntries.cjs.map +1 -1
  59. package/dist/actions/package/compile/buildEntries.mjs.map +1 -1
  60. package/dist/actions/package/compile/compile.cjs.map +1 -1
  61. package/dist/actions/package/compile/compile.mjs.map +1 -1
  62. package/dist/actions/package/compile/copyTypeFiles.cjs.map +1 -1
  63. package/dist/actions/package/compile/copyTypeFiles.mjs.map +1 -1
  64. package/dist/actions/package/compile/index.cjs.map +1 -1
  65. package/dist/actions/package/compile/index.mjs.map +1 -1
  66. package/dist/actions/package/compile/inputs.cjs.map +1 -1
  67. package/dist/actions/package/compile/inputs.mjs.map +1 -1
  68. package/dist/actions/package/compile/packageCompileTsc.cjs.map +1 -1
  69. package/dist/actions/package/compile/packageCompileTsc.mjs.map +1 -1
  70. package/dist/actions/package/compile/packageCompileTscTypes.cjs.map +1 -1
  71. package/dist/actions/package/compile/packageCompileTscTypes.mjs.map +1 -1
  72. package/dist/actions/package/compile/packageCompileTsup.cjs.map +1 -1
  73. package/dist/actions/package/compile/packageCompileTsup.mjs.map +1 -1
  74. package/dist/actions/package/copy-assets.cjs +1 -1
  75. package/dist/actions/package/copy-assets.cjs.map +1 -1
  76. package/dist/actions/package/copy-assets.mjs +1 -1
  77. package/dist/actions/package/copy-assets.mjs.map +1 -1
  78. package/dist/actions/package/deps.cjs.map +1 -1
  79. package/dist/actions/package/deps.mjs.map +1 -1
  80. package/dist/actions/package/index.cjs +1 -1
  81. package/dist/actions/package/index.cjs.map +1 -1
  82. package/dist/actions/package/index.mjs +1 -1
  83. package/dist/actions/package/index.mjs.map +1 -1
  84. package/dist/actions/package/publint.cjs.map +1 -1
  85. package/dist/actions/package/publint.mjs.map +1 -1
  86. package/dist/actions/package/recompile.cjs.map +1 -1
  87. package/dist/actions/package/recompile.mjs.map +1 -1
  88. package/dist/actions/publint.cjs.map +1 -1
  89. package/dist/actions/publint.mjs.map +1 -1
  90. package/dist/actions/rebuild.cjs.map +1 -1
  91. package/dist/actions/rebuild.mjs.map +1 -1
  92. package/dist/actions/recompile.cjs.map +1 -1
  93. package/dist/actions/recompile.mjs.map +1 -1
  94. package/dist/actions/reinstall.cjs.map +1 -1
  95. package/dist/actions/reinstall.mjs.map +1 -1
  96. package/dist/actions/relint.cjs.map +1 -1
  97. package/dist/actions/relint.mjs.map +1 -1
  98. package/dist/actions/retest.cjs.map +1 -1
  99. package/dist/actions/retest.mjs.map +1 -1
  100. package/dist/actions/sonar.cjs.map +1 -1
  101. package/dist/actions/sonar.mjs.map +1 -1
  102. package/dist/actions/statics.cjs +0 -3
  103. package/dist/actions/statics.cjs.map +1 -1
  104. package/dist/actions/statics.mjs +0 -3
  105. package/dist/actions/statics.mjs.map +1 -1
  106. package/dist/actions/test.cjs.map +1 -1
  107. package/dist/actions/test.mjs.map +1 -1
  108. package/dist/actions/up.cjs.map +1 -1
  109. package/dist/actions/up.mjs.map +1 -1
  110. package/dist/actions/updo.cjs.map +1 -1
  111. package/dist/actions/updo.mjs.map +1 -1
  112. package/dist/actions/upplug.cjs.map +1 -1
  113. package/dist/actions/upplug.mjs.map +1 -1
  114. package/dist/actions/upyarn.cjs.map +1 -1
  115. package/dist/actions/upyarn.mjs.map +1 -1
  116. package/dist/actions/yarn3only.cjs.map +1 -1
  117. package/dist/actions/yarn3only.mjs.map +1 -1
  118. package/dist/bin/package/clean-outputs.cjs.map +1 -1
  119. package/dist/bin/package/clean-outputs.mjs.map +1 -1
  120. package/dist/bin/package/clean-typescript.cjs.map +1 -1
  121. package/dist/bin/package/clean-typescript.mjs.map +1 -1
  122. package/dist/bin/package/clean.cjs.map +1 -1
  123. package/dist/bin/package/clean.mjs.map +1 -1
  124. package/dist/bin/package/compile-only.cjs.map +1 -1
  125. package/dist/bin/package/compile-only.mjs.map +1 -1
  126. package/dist/bin/package/compile-tsup.cjs.map +1 -1
  127. package/dist/bin/package/compile-tsup.mjs.map +1 -1
  128. package/dist/bin/package/compile.cjs.map +1 -1
  129. package/dist/bin/package/compile.mjs.map +1 -1
  130. package/dist/bin/package/copy-assets-cjs.cjs +1 -1
  131. package/dist/bin/package/copy-assets-cjs.cjs.map +1 -1
  132. package/dist/bin/package/copy-assets-cjs.mjs +1 -1
  133. package/dist/bin/package/copy-assets-cjs.mjs.map +1 -1
  134. package/dist/bin/package/copy-assets-esm.cjs +1 -1
  135. package/dist/bin/package/copy-assets-esm.cjs.map +1 -1
  136. package/dist/bin/package/copy-assets-esm.mjs +1 -1
  137. package/dist/bin/package/copy-assets-esm.mjs.map +1 -1
  138. package/dist/bin/package/deps.cjs.map +1 -1
  139. package/dist/bin/package/deps.mjs.map +1 -1
  140. package/dist/bin/package/publint.cjs.map +1 -1
  141. package/dist/bin/package/publint.mjs.map +1 -1
  142. package/dist/bin/package/recompile.cjs.map +1 -1
  143. package/dist/bin/package/recompile.mjs.map +1 -1
  144. package/dist/bin/xy-ts.cjs +1 -4
  145. package/dist/bin/xy-ts.cjs.map +1 -1
  146. package/dist/bin/xy-ts.mjs +1 -4
  147. package/dist/bin/xy-ts.mjs.map +1 -1
  148. package/dist/bin/xy.cjs +1 -4
  149. package/dist/bin/xy.cjs.map +1 -1
  150. package/dist/bin/xy.mjs +1 -4
  151. package/dist/bin/xy.mjs.map +1 -1
  152. package/dist/index.cjs +2 -5
  153. package/dist/index.cjs.map +1 -1
  154. package/dist/index.mjs +2 -5
  155. package/dist/index.mjs.map +1 -1
  156. package/dist/lib/dependencies/detectDuplicateDependencies.cjs +0 -3
  157. package/dist/lib/dependencies/detectDuplicateDependencies.cjs.map +1 -1
  158. package/dist/lib/dependencies/detectDuplicateDependencies.mjs +0 -3
  159. package/dist/lib/dependencies/detectDuplicateDependencies.mjs.map +1 -1
  160. package/dist/lib/dependencies/index.cjs +0 -3
  161. package/dist/lib/dependencies/index.cjs.map +1 -1
  162. package/dist/lib/dependencies/index.mjs +0 -3
  163. package/dist/lib/dependencies/index.mjs.map +1 -1
  164. package/dist/lib/generateIgnoreFiles.cjs.map +1 -1
  165. package/dist/lib/generateIgnoreFiles.mjs.map +1 -1
  166. package/dist/lib/index.cjs +0 -3
  167. package/dist/lib/index.cjs.map +1 -1
  168. package/dist/lib/index.mjs +0 -3
  169. package/dist/lib/index.mjs.map +1 -1
  170. package/dist/lib/processEx.cjs.map +1 -1
  171. package/dist/lib/processEx.mjs.map +1 -1
  172. package/dist/lib/runSteps.cjs.map +1 -1
  173. package/dist/lib/runSteps.mjs.map +1 -1
  174. package/dist/lib/runStepsAsync.cjs.map +1 -1
  175. package/dist/lib/runStepsAsync.mjs.map +1 -1
  176. package/dist/lib/runXy.cjs.map +1 -1
  177. package/dist/lib/runXy.mjs.map +1 -1
  178. package/dist/lib/safeExit.cjs.map +1 -1
  179. package/dist/lib/safeExit.mjs.map +1 -1
  180. package/dist/lib/yarn/index.cjs.map +1 -1
  181. package/dist/lib/yarn/index.mjs.map +1 -1
  182. package/dist/lib/yarn/isYarnVersionOrGreater.cjs.map +1 -1
  183. package/dist/lib/yarn/isYarnVersionOrGreater.mjs.map +1 -1
  184. package/dist/xy/index.cjs +1 -4
  185. package/dist/xy/index.cjs.map +1 -1
  186. package/dist/xy/index.mjs +1 -4
  187. package/dist/xy/index.mjs.map +1 -1
  188. package/dist/xy/xy.cjs +1 -4
  189. package/dist/xy/xy.cjs.map +1 -1
  190. package/dist/xy/xy.mjs +1 -4
  191. package/dist/xy/xy.mjs.map +1 -1
  192. package/dist/xy/xyBuildCommands.cjs +1 -1
  193. package/dist/xy/xyBuildCommands.cjs.map +1 -1
  194. package/dist/xy/xyBuildCommands.mjs +1 -1
  195. package/dist/xy/xyBuildCommands.mjs.map +1 -1
  196. package/dist/xy/xyCommonCommands.cjs.map +1 -1
  197. package/dist/xy/xyCommonCommands.mjs.map +1 -1
  198. package/dist/xy/xyDeployCommands.cjs.map +1 -1
  199. package/dist/xy/xyDeployCommands.mjs.map +1 -1
  200. package/dist/xy/xyInstallCommands.cjs +0 -3
  201. package/dist/xy/xyInstallCommands.cjs.map +1 -1
  202. package/dist/xy/xyInstallCommands.mjs +0 -3
  203. package/dist/xy/xyInstallCommands.mjs.map +1 -1
  204. package/dist/xy/xyLintCommands.cjs.map +1 -1
  205. package/dist/xy/xyLintCommands.mjs.map +1 -1
  206. package/package.json +14 -14
  207. package/src/actions/build.ts +1 -1
  208. package/src/actions/copy-assets.ts +2 -2
  209. package/src/actions/cycle.ts +1 -1
  210. package/src/actions/deps.ts +2 -1
  211. package/src/actions/license.ts +2 -2
  212. package/src/actions/lint.ts +1 -1
  213. package/src/actions/package/clean-outputs.ts +1 -1
  214. package/src/actions/package/clean-typescript.ts +1 -1
  215. package/src/actions/package/compile/XyConfig.ts +2 -0
  216. package/src/actions/package/compile/buildEntries.ts +1 -1
  217. package/src/actions/package/compile/copyTypeFiles.ts +4 -4
  218. package/src/actions/package/compile/inputs.ts +4 -4
  219. package/src/actions/package/compile/packageCompileTsc.ts +1 -1
  220. package/src/actions/package/compile/packageCompileTscTypes.ts +1 -1
  221. package/src/actions/package/compile/packageCompileTsup.ts +38 -38
  222. package/src/actions/package/copy-assets.ts +1 -1
  223. package/src/actions/package/deps.ts +5 -5
  224. package/src/actions/package/publint.ts +4 -4
  225. package/src/bin/package/compile-only.ts +1 -1
  226. package/src/bin/package/compile-tsup.ts +1 -1
  227. package/src/bin/package/copy-assets-cjs.ts +1 -1
  228. package/src/bin/package/copy-assets-esm.ts +1 -1
  229. package/src/bin/package/deps.ts +1 -1
  230. package/src/bin/package/publint.ts +1 -1
  231. package/src/bin/package/recompile.ts +1 -1
  232. package/src/lib/dependencies/detectDuplicateDependencies.ts +0 -3
  233. package/src/lib/generateIgnoreFiles.ts +1 -1
  234. package/src/lib/processEx.ts +7 -7
  235. package/src/lib/runSteps.ts +4 -4
  236. package/src/lib/yarn/isYarnVersionOrGreater.ts +1 -1
  237. package/src/xy/xy.ts +1 -1
  238. package/src/xy/xyCommonCommands.ts +1 -1
  239. package/src/xy/xyLintCommands.ts +6 -4
@@ -33,7 +33,7 @@ const dumpMessages = (lintResults: ESLint.LintResult[]) => {
33
33
  }
34
34
 
35
35
  export const lintPackage = async ({ pkg }: LintParams) => {
36
- const workspace = yarnWorkspaces().find((workspace) => workspace.name === pkg)
36
+ const workspace = yarnWorkspaces().find(workspace => workspace.name === pkg)
37
37
  if (!workspace) {
38
38
  console.error(chalk.red(`Unable to locate package [${chalk.magenta(pkg)}]`))
39
39
  process.exit(1)
@@ -9,7 +9,7 @@ export const packageCleanOutputs = async () => {
9
9
  const folders: string[] = [path.join(pkg, 'dist'), path.join(pkg, 'build'), path.join(pkg, 'docs')]
10
10
  console.log(chalk.green(`Cleaning Outputs [${pkgName}]`))
11
11
 
12
- await Promise.all(folders.map((folder) => rimraf(folder)))
12
+ await Promise.all(folders.map(folder => rimraf(folder)))
13
13
 
14
14
  return 0
15
15
  }
@@ -9,7 +9,7 @@ export const packageCleanTypescript = async () => {
9
9
  console.log(chalk.green(`Cleaning Typescript [${pkgName}]`))
10
10
  const files: string[] = [path.join(pkg, '*.tsbuildinfo'), path.join(pkg, '.tsconfig.*'), path.join(pkg, '.eslintcache')]
11
11
 
12
- await Promise.all(files.map((file) => rimraf(file)))
12
+ await Promise.all(files.map(file => rimraf(file)))
13
13
 
14
14
  return 0
15
15
  }
@@ -21,11 +21,13 @@ export interface PathConfig {
21
21
  /**
22
22
  * Configuration for Dynamic Share.
23
23
  */
24
+ // eslint-disable-next-line @typescript-eslint/no-empty-object-type
24
25
  export interface DynamicShareConfig extends PathConfig {}
25
26
 
26
27
  /**
27
28
  * Configuration for Live Share.
28
29
  */
30
+ // eslint-disable-next-line @typescript-eslint/no-empty-object-type
29
31
  export interface LiveShareConfig extends PathConfig {}
30
32
 
31
33
  export interface CompileConfig {
@@ -9,7 +9,7 @@ export const buildEntries = (folder: string, entryMode?: EntryMode, verbose = fa
9
9
  }
10
10
  case 'all': {
11
11
  if (verbose) console.log('buildEntries [all]')
12
- return getAllInputs2(folder).filter((entry) => !entry.includes('.spec.') && !entry.includes('.story.'))
12
+ return getAllInputs2(folder).filter(entry => !entry.includes('.spec.') && !entry.includes('.story.'))
13
13
  }
14
14
  default: {
15
15
  if (verbose) console.log('buildEntries [single]')
@@ -7,18 +7,18 @@ const copyFileMutex = new Mutex()
7
7
 
8
8
  const getDistTypeFiles = async (compilerOptions: TsConfigCompilerOptions) => {
9
9
  const outDir = compilerOptions.outDir ?? 'dist'
10
- return (await readdir(outDir, { recursive: true })).filter((file) => file.endsWith('d.ts')).map((file) => `${outDir}/${file}`)
10
+ return (await readdir(outDir, { recursive: true })).filter(file => file.endsWith('d.ts')).map(file => `${outDir}/${file}`)
11
11
  }
12
12
 
13
13
  const getDistTypeMapFiles = async (compilerOptions: TsConfigCompilerOptions) => {
14
14
  const outDir = compilerOptions.outDir ?? 'dist'
15
- return (await readdir(outDir, { recursive: true })).filter((file) => file.endsWith('d.ts.map')).map((file) => `${outDir}/${file}`)
15
+ return (await readdir(outDir, { recursive: true })).filter(file => file.endsWith('d.ts.map')).map(file => `${outDir}/${file}`)
16
16
  }
17
17
 
18
18
  export const copyTypeFiles = async (compilerOptions: TsConfigCompilerOptions) => {
19
- //using a mutex since sometimes two compiles are running at once and cause a lock on windows
19
+ // using a mutex since sometimes two compiles are running at once and cause a lock on windows
20
20
  await copyFileMutex.runExclusive(async () => {
21
- //hybrid packages want two copies of the types
21
+ // hybrid packages want two copies of the types
22
22
  const distTypeFiles = await getDistTypeFiles(compilerOptions)
23
23
  await Promise.all(
24
24
  distTypeFiles.map(async (file) => {
@@ -5,9 +5,9 @@ import { glob } from 'glob'
5
5
  export const getInputs = async (subDir?: string) => {
6
6
  return (await readdir(subDir ? `src/${subDir}` : 'src', { recursive: false }))
7
7
  .filter(
8
- (file) => (file.endsWith('.ts') || file.endsWith('.tsx')) && !file.endsWith('d.ts') && !file.includes('.spec.') && !file.includes('.stories.'),
8
+ file => (file.endsWith('.ts') || file.endsWith('.tsx')) && !file.endsWith('d.ts') && !file.includes('.spec.') && !file.includes('.stories.'),
9
9
  )
10
- .map((file) => (subDir ? `${subDir}/${file}` : file))
10
+ .map(file => (subDir ? `${subDir}/${file}` : file))
11
11
  }
12
12
 
13
13
  export const getInputDirs = async (depth: number = 0) => {
@@ -17,7 +17,7 @@ export const getInputDirs = async (depth: number = 0) => {
17
17
  return [
18
18
  '.',
19
19
  ...(await readdir('src', { recursive: true, withFileTypes: true }))
20
- .filter((file) => file.isDirectory())
20
+ .filter(file => file.isDirectory())
21
21
  .map((file) => {
22
22
  const pathParts = file.path?.split('/') ?? []
23
23
  pathParts.shift()
@@ -33,7 +33,7 @@ export const getInputDirs = async (depth: number = 0) => {
33
33
 
34
34
  export const getAllInputs = async (depth = 100) => {
35
35
  const dirs = await getInputDirs(depth)
36
- return (await Promise.all(dirs.map(async (dir) => await getInputs(dir)))).flat()
36
+ return (await Promise.all(dirs.map(async dir => await getInputs(dir)))).flat()
37
37
  }
38
38
 
39
39
  export const getAllInputs2 = (folder: string) => {
@@ -23,7 +23,7 @@ export const packageCompileTsc = async (noEmit?: boolean, config?: XyTscConfig,
23
23
  const verbose = config?.verbose ?? false
24
24
 
25
25
  const formatHost: FormatDiagnosticsHost = {
26
- getCanonicalFileName: (fileName) => fileName,
26
+ getCanonicalFileName: fileName => fileName,
27
27
  getCurrentDirectory: () => pkg,
28
28
  getNewLine: () => '\n',
29
29
  }
@@ -34,7 +34,7 @@ export const packageCompileTscTypes = async (
34
34
  ...compilerOptionsParam,
35
35
  } as TsConfigCompilerOptions
36
36
 
37
- //calling all here since the types do not get rolled up
37
+ // calling all here since the types do not get rolled up
38
38
  const files = buildEntries(folder, 'all')
39
39
 
40
40
  const result = createProgramFromConfig({
@@ -35,7 +35,7 @@ const compileFolder = async (folder: string, entryMode: EntryMode = 'single', op
35
35
  )
36
36
  ).flat()
37
37
 
38
- await Promise.all(optionsList.map((options) => build(options)))
38
+ await Promise.all(optionsList.map(options => build(options)))
39
39
  await packageCompileTscTypes(folder, { verbose }, { outDir })
40
40
 
41
41
  return 0
@@ -55,46 +55,46 @@ export const packageCompileTsup = async (config?: XyTsupConfig) => {
55
55
  const compileForNeutral = compile?.neutral ?? { src: {} }
56
56
 
57
57
  return (
58
- (await packageCompileTsc(true, { publint: false, verbose })) ||
59
- (
58
+ (await packageCompileTsc(true, { publint: false, verbose }))
59
+ || (
60
60
  await Promise.all(
61
61
  Object.entries(compileForNode).map(async ([folder, options]) => {
62
62
  const inEsBuildOptions = typeof compile?.node?.esbuildOptions === 'object' ? compile?.node?.esbuildOptions : {}
63
- return folder ?
64
- await compileFolder(
65
- folder,
66
- compile?.entryMode,
67
- {
68
- bundle: true,
69
- format: ['cjs', 'esm'],
70
- loader: merge(
71
- {},
72
- { '.gif': 'copy', '.html': 'copy', '.jpg': 'copy', '.json': 'json', '.png': 'copy', '.svg': 'copy', '.webp': 'copy' },
73
- inEsBuildOptions?.loader,
74
- ),
75
- // minify: true,
76
- outDir: 'dist/node',
77
- outExtension: ({ format }) => (format === 'esm' ? { js: '.mjs' } : { js: '.cjs' }),
78
- platform: 'node',
79
- skipNodeModulesBundle: true,
80
- sourcemap: true,
81
- target: 'node16',
82
- // terserOptions: { format: { comments: false } },
83
- ...compile?.tsup?.options,
84
- ...(typeof options === 'object' ? options : {}),
85
- },
86
- verbose,
87
- )
63
+ return folder
64
+ ? await compileFolder(
65
+ folder,
66
+ compile?.entryMode,
67
+ {
68
+ bundle: true,
69
+ format: ['cjs', 'esm'],
70
+ loader: merge(
71
+ {},
72
+ { '.gif': 'copy', '.html': 'copy', '.jpg': 'copy', '.json': 'json', '.png': 'copy', '.svg': 'copy', '.webp': 'copy' },
73
+ inEsBuildOptions?.loader,
74
+ ),
75
+ // minify: true,
76
+ outDir: 'dist/node',
77
+ outExtension: ({ format }) => (format === 'esm' ? { js: '.mjs' } : { js: '.cjs' }),
78
+ platform: 'node',
79
+ skipNodeModulesBundle: true,
80
+ sourcemap: true,
81
+ target: 'node16',
82
+ // terserOptions: { format: { comments: false } },
83
+ ...compile?.tsup?.options,
84
+ ...(typeof options === 'object' ? options : {}),
85
+ },
86
+ verbose,
87
+ )
88
88
  : 0
89
89
  }),
90
90
  )
91
- ).reduce((prev, value) => prev + value, 0) ||
92
- (
91
+ ).reduce((prev, value) => prev + value, 0)
92
+ || (
93
93
  await Promise.all(
94
94
  Object.entries(compileForBrowser).map(async ([folder, options]) => {
95
95
  const inEsBuildOptions = typeof compile?.browser?.esbuildOptions === 'object' ? compile?.browser?.esbuildOptions : {}
96
- return folder ?
97
- (
96
+ return folder
97
+ ? (
98
98
  await Promise.all([
99
99
  compileFolder(
100
100
  folder,
@@ -149,13 +149,13 @@ export const packageCompileTsup = async (config?: XyTsupConfig) => {
149
149
  : 0
150
150
  }),
151
151
  )
152
- ).reduce((prev, value) => prev + value, 0) ||
153
- (
152
+ ).reduce((prev, value) => prev + value, 0)
153
+ || (
154
154
  await Promise.all(
155
155
  Object.entries(compileForNeutral).map(async ([folder, options]) => {
156
156
  const inEsBuildOptions = typeof compile?.neutral?.esbuildOptions === 'object' ? compile?.neutral?.esbuildOptions : {}
157
- return folder ?
158
- (
157
+ return folder
158
+ ? (
159
159
  await Promise.all([
160
160
  compileFolder(
161
161
  folder,
@@ -210,7 +210,7 @@ export const packageCompileTsup = async (config?: XyTsupConfig) => {
210
210
  : 0
211
211
  }),
212
212
  )
213
- ).reduce((prev, value) => prev + value, 0) ||
214
- (publint ? await packagePublint() : 0)
213
+ ).reduce((prev, value) => prev + value, 0)
214
+ || (publint ? await packagePublint() : 0)
215
215
  )
216
216
  }
@@ -14,7 +14,7 @@ const copyTargetAssets = async (target: 'esm' | 'cjs', name: string, location: s
14
14
  `../dist/${target}`,
15
15
  {
16
16
  cwd: path.join(location, 'src'),
17
- parents: true,
17
+ flat: false,
18
18
  },
19
19
  )
20
20
  if (values.length > 0) {
@@ -69,8 +69,8 @@ export const packageDeps = async () => {
69
69
 
70
70
  const packageContent = existsSync(`${pkg}/package.json`) ? JSON.parse(readFileSync(`${pkg}/package.json`, { encoding: 'utf8' })) : undefined
71
71
 
72
- const rawIgnore =
73
- existsSync(`${pkg}/.depcheckrc`) ? readFileSync(`${pkg}/.depcheckrc`, { encoding: 'utf8' }).replace('ignores:', '"ignores":') : undefined
72
+ const rawIgnore
73
+ = existsSync(`${pkg}/.depcheckrc`) ? readFileSync(`${pkg}/.depcheckrc`, { encoding: 'utf8' }).replace('ignores:', '"ignores":') : undefined
74
74
  let ignoreMatches: string[] = []
75
75
  try {
76
76
  ignoreMatches = rawIgnore ? (JSON.parse(`{${rawIgnore}}`).ignores as string[]) : []
@@ -86,10 +86,10 @@ export const packageDeps = async () => {
86
86
  const declaredDevDeps = Object.keys(packageContent.devDependencies ?? {})
87
87
 
88
88
  const missingDeps = Object.keys(usedDeps).filter(
89
- (key) => !declaredDeps.includes(key) && !declaredPeerDeps.includes(key) && !key.startsWith('@types/'),
89
+ key => !declaredDeps.includes(key) && !declaredPeerDeps.includes(key) && !key.startsWith('@types/'),
90
90
  )
91
91
 
92
- const missingDevDeps = Object.keys(usedDevDeps).filter((key) => !declaredDevDeps.includes(key) && !declaredDeps.includes(key))
92
+ const missingDevDeps = Object.keys(usedDevDeps).filter(key => !declaredDevDeps.includes(key) && !declaredDeps.includes(key))
93
93
 
94
94
  const missingDepsObject: Record<string, string[]> = {}
95
95
  for (const key of missingDeps) {
@@ -136,6 +136,6 @@ export const packageDeps = async () => {
136
136
 
137
137
  checkResult(`Deps [${pkgName}]`, errorCount, 'warn', false)
138
138
 
139
- //returning 0 here since we never want deps to be fatal
139
+ // returning 0 here since we never want deps to be fatal
140
140
  return 0
141
141
  }
@@ -27,7 +27,7 @@ export const packagePublint = async (params?: PackagePublintParams) => {
27
27
 
28
28
  const validMessage = (_message: Message): boolean => {
29
29
  return true
30
- /*try {
30
+ /* try {
31
31
  const value = getValueFromPath(pkg, message.path)
32
32
  switch (message.code) {
33
33
  case 'FILE_INVALID_FORMAT':
@@ -42,10 +42,10 @@ export const packagePublint = async (params?: PackagePublintParams) => {
42
42
  console.error(chalk.red(`validMessage Excepted: ${error.message}`))
43
43
  console.error(chalk.gray(JSON.stringify(error.stack)))
44
44
  return true
45
- }*/
45
+ } */
46
46
  }
47
47
 
48
- //we filter out invalid file formats for the esm folder since it is intentionally done
48
+ // we filter out invalid file formats for the esm folder since it is intentionally done
49
49
  const validMessages = messages.filter(validMessage)
50
50
  for (const message of validMessages) {
51
51
  switch (message.type) {
@@ -68,5 +68,5 @@ export const packagePublint = async (params?: PackagePublintParams) => {
68
68
  console.log(chalk.gray(`Publint [Finish]: ${pkgDir} [${validMessages.length}]`))
69
69
  }
70
70
 
71
- return validMessages.filter((message) => message.type === 'error').length
71
+ return validMessages.filter(message => message.type === 'error').length
72
72
  }
@@ -5,7 +5,7 @@ import chalk from 'chalk'
5
5
  import { packageCompile } from '../../actions/index.ts'
6
6
 
7
7
  packageCompile({ verbose: true, publint: false })
8
- .then((value) => (process.exitCode = value))
8
+ .then(value => (process.exitCode = value))
9
9
  .catch((reason) => {
10
10
  console.error(chalk.red(reason))
11
11
  process.exitCode = 1
@@ -5,7 +5,7 @@ import chalk from 'chalk'
5
5
  import { packageCompileTsup } from '../../actions/index.ts'
6
6
 
7
7
  packageCompileTsup({ verbose: true })
8
- .then((value) => (process.exitCode = value))
8
+ .then(value => (process.exitCode = value))
9
9
  .catch((reason) => {
10
10
  console.error(chalk.red(reason))
11
11
  process.exitCode = 1
@@ -5,7 +5,7 @@ import chalk from 'chalk'
5
5
  import { packageCopyAssets } from '../../actions/index.ts'
6
6
 
7
7
  packageCopyAssets({ target: 'cjs' })
8
- .then((value) => (process.exitCode = value))
8
+ .then(value => (process.exitCode = value))
9
9
  .catch((reason) => {
10
10
  console.error(chalk.red(reason))
11
11
  process.exitCode = 1
@@ -5,7 +5,7 @@ import chalk from 'chalk'
5
5
  import { packageCopyAssets } from '../../actions/index.ts'
6
6
 
7
7
  packageCopyAssets({ target: 'esm' })
8
- .then((value) => (process.exitCode = value))
8
+ .then(value => (process.exitCode = value))
9
9
  .catch((reason) => {
10
10
  console.error(chalk.red(reason))
11
11
  process.exitCode = 1
@@ -5,7 +5,7 @@ import chalk from 'chalk'
5
5
  import { packageDeps } from '../../actions/index.ts'
6
6
 
7
7
  packageDeps()
8
- .then((value) => (process.exitCode = value))
8
+ .then(value => (process.exitCode = value))
9
9
  .catch((ex: Error) => {
10
10
  console.error(`Deps Failed: ${chalk.red(ex)}`)
11
11
  process.exitCode = 0
@@ -5,7 +5,7 @@ import chalk from 'chalk'
5
5
  import { packagePublint } from '../../actions/index.ts'
6
6
 
7
7
  packagePublint()
8
- .then((value) => (process.exitCode = value))
8
+ .then(value => (process.exitCode = value))
9
9
  .catch((ex: Error) => {
10
10
  console.error(`Publint Failed: ${chalk.red(ex)}`)
11
11
  console.error(chalk.gray(ex.stack))
@@ -5,7 +5,7 @@ import chalk from 'chalk'
5
5
  import { packageRecompile } from '../../actions/index.ts'
6
6
 
7
7
  packageRecompile()
8
- .then((value) => (process.exitCode = value))
8
+ .then(value => (process.exitCode = value))
9
9
  .catch((reason) => {
10
10
  console.error(chalk.red(reason))
11
11
  process.exitCode = 1
@@ -19,20 +19,17 @@ export const detectDuplicateDependencies = (depsFromPackageJSON?: string[], Defa
19
19
  } catch (e) {
20
20
  console.error(`Error running yarn why: ${e}`)
21
21
  exitCode = 1
22
- exitCode
23
22
  continue
24
23
  }
25
24
 
26
25
  if (output) {
27
26
  exitCode = new DuplicateDetector(output, dependency).detect()
28
- exitCode
29
27
  } else {
30
28
  console.log(`${dependency} - N/A`)
31
29
  if (depsFromPackageJSON) {
32
30
  exitCode = 1
33
31
  console.log(`🚨 Library ${dependency} was requested in package.json but not found`)
34
32
  }
35
- exitCode
36
33
  }
37
34
  }
38
35
  return exitCode
@@ -22,6 +22,6 @@ export const generateIgnoreFiles = (filename: string, pkg?: string) => {
22
22
  return 1
23
23
  }
24
24
  })
25
- const succeeded = results.every((result) => result === 0)
25
+ const succeeded = results.every(result => result === 0)
26
26
  return succeeded ? 0 : 1
27
27
  }
@@ -5,23 +5,23 @@ import { withError } from './withError.ts'
5
5
 
6
6
  export const processEx = (ex: unknown) => {
7
7
  const error = typeof ex === 'string' ? new Error(ex) : ex
8
- const exitCode =
9
- withErrnoException(error, (error) => {
8
+ const exitCode
9
+ = withErrnoException(error, (error) => {
10
10
  if (error.code === 'ENOENT') {
11
11
  console.error(chalk.red(`'${error.path}' not found.`))
12
12
  } else {
13
13
  console.error(chalk.red(`Errno: ${error.code}`))
14
14
  }
15
15
  return error.errno ?? -1
16
- }) ??
17
- withError(error, (error) => {
16
+ })
17
+ ?? withError(error, (error) => {
18
18
  console.error(chalk.red(`${error.name}: ${error.message}`))
19
19
  return -1
20
- }) ??
21
- (() => {
20
+ })
21
+ ?? (() => {
22
22
  console.error(chalk.red(`Unexpected Error: ${JSON.stringify(ex, null, 2)}`))
23
23
  return -1
24
24
  })()
25
- //This allows us to use a previously set exit code
25
+ // This allows us to use a previously set exit code
26
26
  process.exit(process.exitCode ?? exitCode)
27
27
  }
@@ -7,8 +7,8 @@ import { checkResult } from './checkResult.ts'
7
7
  import { safeExit } from './safeExit.ts'
8
8
 
9
9
  export type ScriptStep =
10
- | [/*command*/ 'yarn' | 'node' | 'ts-node-script' | 'tsc' | 'jest', /*arg*/ string | string[]]
11
- | [/*command*/ string, /*arg*/ string | string[], /*config*/ SpawnSyncOptionsWithBufferEncoding]
10
+ | [/* command */ 'yarn' | 'node' | 'ts-node-script' | 'tsc' | 'jest', /* arg */ string | string[]]
11
+ | [/* command */ string, /* arg */ string | string[], /* config */ SpawnSyncOptionsWithBufferEncoding]
12
12
 
13
13
  export const runSteps = (name: string, steps: ScriptStep[], exitOnFail = true, messages?: string[]): number => {
14
14
  return safeExit(() => {
@@ -23,8 +23,8 @@ export const runSteps = (name: string, steps: ScriptStep[], exitOnFail = true, m
23
23
  if (command === 'node' && !existsSync(argList[0])) {
24
24
  throw new Error(`File not found [${argList[0]}]`)
25
25
  }
26
- const status =
27
- spawnSync(command, Array.isArray(args) ? args : args.split(' '), {
26
+ const status
27
+ = spawnSync(command, Array.isArray(args) ? args : args.split(' '), {
28
28
  ...config,
29
29
  encoding: 'utf8',
30
30
  env: { FORCE_COLOR: '3', ...process.env },
@@ -3,7 +3,7 @@ import { spawnSync } from 'node:child_process'
3
3
  export const isYarnVersionOrGreater = (major: number, minor?: number, patch?: number): [boolean, string] => {
4
4
  const result = spawnSync('yarn', ['-v'], { encoding: 'utf8', shell: true })
5
5
  const version = result.stdout.toString().replaceAll('\n', '')
6
- const versionNumbers = version.split('.').map((ver) => Number.parseInt(ver))
6
+ const versionNumbers = version.split('.').map(ver => Number.parseInt(ver))
7
7
  const majorDelta = versionNumbers[0] - major
8
8
  const minorDelta = versionNumbers[1] - (minor ?? versionNumbers[1])
9
9
  const patchDelta = versionNumbers[2] - (patch ?? versionNumbers[2])
package/src/xy/xy.ts CHANGED
@@ -13,7 +13,7 @@ export const xy = async () => {
13
13
  .demandCommand(1)
14
14
  .command('*', '', () => {
15
15
  console.error(chalk.yellow(`Command not found [${chalk.magenta(process.argv[2])}]`))
16
- console.log(chalk.gray("Try 'yarn xy --help' for list of commands"))
16
+ console.log(chalk.gray('Try \'yarn xy --help\' for list of commands'))
17
17
  })
18
18
  .version()
19
19
  .help().argv
@@ -68,7 +68,7 @@ export const xyCommonCommands = (args: Argv) => {
68
68
  .command(
69
69
  'clean-docs',
70
70
  'CleanDocs - Clean TypeDocs',
71
- (yargs) => yargs,
71
+ yargs => yargs,
72
72
  (argv) => {
73
73
  if (argv.verbose) console.log('Cleaning TypeDocs: all')
74
74
  process.exitCode = cleanDocs()
@@ -28,10 +28,12 @@ export const xyLintCommands = (args: Argv) => {
28
28
  async (argv) => {
29
29
  if (argv.verbose) console.log('Lint')
30
30
  const start = Date.now()
31
- process.exitCode =
32
- argv.fix ? fix()
33
- : argv.profile ? lintProfile()
34
- : await lint({ pkg: argv.package as string })
31
+ process.exitCode
32
+ = argv.fix
33
+ ? fix()
34
+ : argv.profile
35
+ ? lintProfile()
36
+ : await lint({ pkg: argv.package as string })
35
37
  console.log(chalk.blue(`Finished in ${Date.now() - start}ms`))
36
38
  },
37
39
  )