@xylabs/ts-scripts-yarn3 4.0.0-rc.25 → 4.0.0-rc.26

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 (150) hide show
  1. package/dist/actions/build.mjs.map +1 -1
  2. package/dist/actions/clean-docs.mjs.map +1 -1
  3. package/dist/actions/clean-eslint.mjs.map +1 -1
  4. package/dist/actions/clean-jest.mjs.map +1 -1
  5. package/dist/actions/clean.mjs.map +1 -1
  6. package/dist/actions/compile.mjs.map +1 -1
  7. package/dist/actions/copy-assets.mjs.map +1 -1
  8. package/dist/actions/cycle.mjs.map +1 -1
  9. package/dist/actions/dead.mjs.map +1 -1
  10. package/dist/actions/deploy-major.mjs.map +1 -1
  11. package/dist/actions/deploy-minor.mjs.map +1 -1
  12. package/dist/actions/deploy-next.mjs.map +1 -1
  13. package/dist/actions/deploy.mjs.map +1 -1
  14. package/dist/actions/deps.mjs.map +1 -1
  15. package/dist/actions/dupdeps.mjs.map +1 -1
  16. package/dist/actions/fix.mjs.map +1 -1
  17. package/dist/actions/gen-docs.mjs.map +1 -1
  18. package/dist/actions/gitignore-gen.mjs.map +1 -1
  19. package/dist/actions/index.mjs.map +1 -1
  20. package/dist/actions/license.mjs.map +1 -1
  21. package/dist/actions/lint-clean.mjs.map +1 -1
  22. package/dist/actions/lint-profile.mjs.map +1 -1
  23. package/dist/actions/lint.mjs.map +1 -1
  24. package/dist/actions/npmignore-gen.mjs.map +1 -1
  25. package/dist/actions/package/clean-outputs.mjs.map +1 -1
  26. package/dist/actions/package/clean-typescript.mjs.map +1 -1
  27. package/dist/actions/package/clean.mjs.map +1 -1
  28. package/dist/actions/package/compile/buildEntries.mjs.map +1 -1
  29. package/dist/actions/package/compile/compile.mjs.map +1 -1
  30. package/dist/actions/package/compile/copyTypeFiles.mjs.map +1 -1
  31. package/dist/actions/package/compile/getCompilerOptions.mjs.map +1 -1
  32. package/dist/actions/package/compile/index.mjs.map +1 -1
  33. package/dist/actions/package/compile/inputs.mjs.map +1 -1
  34. package/dist/actions/package/compile/packageCompileTsc.mjs.map +1 -1
  35. package/dist/actions/package/compile/packageCompileTscTypes.mjs.map +1 -1
  36. package/dist/actions/package/compile/packageCompileTsup.mjs.map +1 -1
  37. package/dist/actions/package/copy-assets.mjs.map +1 -1
  38. package/dist/actions/package/deps.mjs.map +1 -1
  39. package/dist/actions/package/gen-docs.mjs.map +1 -1
  40. package/dist/actions/package/index.mjs.map +1 -1
  41. package/dist/actions/package/publint.mjs.map +1 -1
  42. package/dist/actions/package/recompile.mjs.map +1 -1
  43. package/dist/actions/publint.mjs.map +1 -1
  44. package/dist/actions/rebuild.mjs.map +1 -1
  45. package/dist/actions/recompile.mjs.map +1 -1
  46. package/dist/actions/reinstall.mjs.map +1 -1
  47. package/dist/actions/relint.mjs.map +1 -1
  48. package/dist/actions/retest.mjs.map +1 -1
  49. package/dist/actions/sonar.mjs.map +1 -1
  50. package/dist/actions/statics.mjs.map +1 -1
  51. package/dist/actions/test.mjs.map +1 -1
  52. package/dist/actions/up.mjs.map +1 -1
  53. package/dist/actions/updo.mjs.map +1 -1
  54. package/dist/actions/upplug.mjs.map +1 -1
  55. package/dist/actions/upyarn.mjs.map +1 -1
  56. package/dist/actions/yarn3only.mjs.map +1 -1
  57. package/dist/bin/package/clean-outputs.mjs.map +1 -1
  58. package/dist/bin/package/clean-typescript.mjs.map +1 -1
  59. package/dist/bin/package/clean.mjs.map +1 -1
  60. package/dist/bin/package/compile-only.mjs.map +1 -1
  61. package/dist/bin/package/compile-tsup.mjs.map +1 -1
  62. package/dist/bin/package/compile.mjs.map +1 -1
  63. package/dist/bin/package/copy-assets-cjs.mjs.map +1 -1
  64. package/dist/bin/package/copy-assets-esm.mjs.map +1 -1
  65. package/dist/bin/package/deps.mjs.map +1 -1
  66. package/dist/bin/package/gen-docs.mjs.map +1 -1
  67. package/dist/bin/package/publint.mjs.map +1 -1
  68. package/dist/bin/package/recompile.mjs.map +1 -1
  69. package/dist/bin/xy-ts.mjs.map +1 -1
  70. package/dist/bin/xy.mjs.map +1 -1
  71. package/dist/index.d.ts +13 -13
  72. package/dist/index.mjs.map +1 -1
  73. package/dist/lib/deleteGlob.mjs.map +1 -1
  74. package/dist/lib/dependencies/DuplicateDetector.mjs.map +1 -1
  75. package/dist/lib/dependencies/detectDuplicateDependencies.mjs.map +1 -1
  76. package/dist/lib/dependencies/index.mjs.map +1 -1
  77. package/dist/lib/file/ReadFileSyncOptions.mjs.map +1 -1
  78. package/dist/lib/file/fileLines.mjs.map +1 -1
  79. package/dist/lib/file/index.mjs.map +1 -1
  80. package/dist/lib/file/tryReadFileSync.mjs.map +1 -1
  81. package/dist/lib/generateIgnoreFiles.mjs.map +1 -1
  82. package/dist/lib/index.mjs.map +1 -1
  83. package/dist/lib/runSteps.mjs.map +1 -1
  84. package/dist/lib/runStepsAsync.mjs.map +1 -1
  85. package/dist/lib/runXy.mjs.map +1 -1
  86. package/dist/lib/safeExit.mjs.map +1 -1
  87. package/dist/lib/yarn/index.mjs.map +1 -1
  88. package/dist/lib/yarn/isYarnVersionOrGreater.mjs.map +1 -1
  89. package/dist/lib/yarn/workspace/index.mjs.map +1 -1
  90. package/dist/lib/yarn/workspace/yarnWorkspace.mjs.map +1 -1
  91. package/dist/lib/yarn/workspace/yarnWorkspaces.mjs.map +1 -1
  92. package/dist/xy/index.mjs.map +1 -1
  93. package/dist/xy/param.mjs.map +1 -1
  94. package/dist/xy/xy.mjs.map +1 -1
  95. package/dist/xy/xyBuildCommands.mjs.map +1 -1
  96. package/dist/xy/xyCommonCommands.mjs.map +1 -1
  97. package/dist/xy/xyDeployCommands.mjs.map +1 -1
  98. package/dist/xy/xyInstallCommands.mjs.map +1 -1
  99. package/dist/xy/xyLintCommands.mjs.map +1 -1
  100. package/package.json +4 -4
  101. package/src/actions/build.ts +3 -1
  102. package/src/actions/clean-docs.ts +3 -1
  103. package/src/actions/clean.ts +8 -2
  104. package/src/actions/compile.ts +16 -4
  105. package/src/actions/copy-assets.ts +6 -2
  106. package/src/actions/cycle.ts +7 -7
  107. package/src/actions/deps.ts +7 -5
  108. package/src/actions/dupdeps.ts +3 -1
  109. package/src/actions/gen-docs.ts +4 -4
  110. package/src/actions/license.ts +6 -2
  111. package/src/actions/lint-clean.ts +6 -2
  112. package/src/actions/lint-profile.ts +5 -1
  113. package/src/actions/lint.ts +3 -1
  114. package/src/actions/package/compile/XyConfig.ts +4 -12
  115. package/src/actions/package/compile/compile.ts +3 -1
  116. package/src/actions/package/compile/copyTypeFiles.ts +3 -1
  117. package/src/actions/package/compile/getCompilerOptions.ts +3 -1
  118. package/src/actions/package/compile/inputs.ts +6 -2
  119. package/src/actions/package/compile/packageCompileTsc.ts +7 -2
  120. package/src/actions/package/compile/packageCompileTsup.ts +8 -3
  121. package/src/actions/package/copy-assets.ts +1 -3
  122. package/src/actions/package/deps.ts +15 -5
  123. package/src/actions/package/gen-docs.ts +3 -1
  124. package/src/actions/package/publint.ts +1 -3
  125. package/src/actions/publint.ts +11 -3
  126. package/src/actions/recompile.ts +16 -4
  127. package/src/actions/reinstall.ts +12 -4
  128. package/src/actions/relint.ts +9 -3
  129. package/src/actions/statics.ts +3 -1
  130. package/src/actions/yarn3only.ts +3 -1
  131. package/src/bin/package/compile-only.ts +3 -1
  132. package/src/lib/deleteGlob.ts +3 -1
  133. package/src/lib/dependencies/DuplicateDetector.ts +6 -2
  134. package/src/lib/file/ReadFileSyncOptions.ts +4 -1
  135. package/src/lib/file/fileLines.ts +9 -3
  136. package/src/lib/file/tryReadFileSync.ts +3 -1
  137. package/src/lib/generateIgnoreFiles.ts +9 -3
  138. package/src/lib/runSteps.ts +3 -1
  139. package/src/lib/runStepsAsync.ts +3 -1
  140. package/src/lib/safeExit.ts +3 -1
  141. package/src/lib/yarn/isYarnVersionOrGreater.ts +3 -1
  142. package/src/lib/yarn/workspace/yarnWorkspaces.ts +3 -1
  143. package/src/xy/param.ts +1 -3
  144. package/src/xy/xyBuildCommands.ts +9 -19
  145. package/src/xy/xyCommonCommands.ts +6 -2
  146. package/src/xy/xyDeployCommands.ts +3 -1
  147. package/src/xy/xyInstallCommands.ts +4 -4
  148. package/src/xy/xyLintCommands.ts +6 -2
  149. package/tsup.config.ts +2 -6
  150. package/xy.config.ts +1 -5
@@ -4,7 +4,9 @@ import { loadConfig } from '../../../lib/index.ts'
4
4
  import { packagePublint } from '../publint.ts'
5
5
  import { packageCompileTsc } from './packageCompileTsc.ts'
6
6
  import { packageCompileTsup } from './packageCompileTsup.ts'
7
- import type { XyConfig, XyTscConfig, XyTsupConfig } from './XyConfig.ts'
7
+ import type {
8
+ XyConfig, XyTscConfig, XyTsupConfig,
9
+ } from './XyConfig.ts'
8
10
 
9
11
  export const packageCompile = async (inConfig: XyConfig = {}): Promise<number> => {
10
12
  const pkg = process.env.INIT_CWD
@@ -1,4 +1,6 @@
1
- import { copyFile, readdir } from 'node:fs/promises'
1
+ import {
2
+ copyFile, readdir,
3
+ } from 'node:fs/promises'
2
4
 
3
5
  import { Mutex } from 'async-mutex'
4
6
  import type { TsConfigCompilerOptions } from 'tsc-prog'
@@ -3,7 +3,9 @@ import { createRequire } from 'node:module'
3
3
  import deepmerge from 'deepmerge'
4
4
  import type { TsConfig } from 'tsc-prog'
5
5
  import type { CompilerOptions } from 'typescript'
6
- import { findConfigFile, readConfigFile, sys } from 'typescript'
6
+ import {
7
+ findConfigFile, readConfigFile, sys,
8
+ } from 'typescript'
7
9
 
8
10
  const getNested = (config: TsConfig): CompilerOptions => {
9
11
  if (config.extends) {
@@ -16,7 +16,9 @@ export const getInputDirs = async (depth: number = 0) => {
16
16
  }
17
17
  return [
18
18
  '.',
19
- ...(await readdir('src', { recursive: true, withFileTypes: true }))
19
+ ...(await readdir('src', {
20
+ recursive: true, withFileTypes: true,
21
+ }))
20
22
  .filter(file => file.isDirectory())
21
23
  .map((file) => {
22
24
  const pathParts = file.path?.split('/') ?? []
@@ -38,5 +40,7 @@ export const getAllInputs = async (depth = 100) => {
38
40
 
39
41
  export const getAllInputs2 = (folder: string) => {
40
42
  /* tsup wants posix paths */
41
- return glob.sync(`${folder}/**/*.*`, { ignore: ['**/*.spec.*', '**/*.stories.*', '**/spec/**/*'], posix: true })
43
+ return glob.sync(`${folder}/**/*.*`, {
44
+ ignore: ['**/*.spec.*', '**/*.stories.*', '**/spec/**/*'], posix: true,
45
+ })
42
46
  }
@@ -6,7 +6,8 @@ import { createProgramFromConfig } from 'tsc-prog'
6
6
  import type {
7
7
  CompilerOptions,
8
8
  FormatDiagnosticsHost,
9
- LineAndCharacter } from 'typescript'
9
+ LineAndCharacter,
10
+ } from 'typescript'
10
11
  import {
11
12
  DiagnosticCategory,
12
13
  formatDiagnosticsWithColorAndContext,
@@ -54,7 +55,11 @@ export const packageCompileTsc = async (noEmit?: boolean, config?: XyTscConfig,
54
55
  const results = getPreEmitDiagnostics(program)
55
56
 
56
57
  for (const diag of results) {
57
- const lineAndChar: LineAndCharacter = diag.file ? getLineAndCharacterOfPosition(diag.file, diag.start ?? 0) : { character: 0, line: 0 }
58
+ const lineAndChar: LineAndCharacter = diag.file
59
+ ? getLineAndCharacterOfPosition(diag.file, diag.start ?? 0)
60
+ : {
61
+ character: 0, line: 0,
62
+ }
58
63
  console.log(chalk.cyan(`${diag.file?.fileName}:${lineAndChar.line + 1}:${lineAndChar.character + 1}`))
59
64
  console.log(formatDiagnosticsWithColorAndContext([diag], formatHost))
60
65
  }
@@ -1,10 +1,14 @@
1
1
  import type { Loader } from 'esbuild'
2
2
  import type { Options } from 'tsup'
3
- import { build, defineConfig } from 'tsup'
3
+ import {
4
+ build, defineConfig,
5
+ } from 'tsup'
4
6
 
5
7
  import { packagePublint } from '../publint.ts'
6
8
  import { buildEntries } from './buildEntries.ts'
7
- import type { EntryMode, XyTsupConfig } from './XyConfig.ts'
9
+ import type {
10
+ EntryMode, XyTsupConfig,
11
+ } from './XyConfig.ts'
8
12
 
9
13
  const compileFolder = async (folder: string, entryMode: EntryMode = 'single', options?: Options, _verbose?: boolean) => {
10
14
  const outDir = options?.outDir ?? 'dist'
@@ -51,7 +55,8 @@ export const packageCompileTsup = async (config?: XyTsupConfig) => {
51
55
  const compileForNeutral = compile?.neutral ?? { src: {} }
52
56
 
53
57
  const standardLoaders: Record<string, Loader> = {
54
- '.gif': 'copy', '.html': 'copy', '.jpg': 'copy', '.json': 'json', '.png': 'copy', '.svg': 'copy', '.webp': 'copy' }
58
+ '.gif': 'copy', '.html': 'copy', '.jpg': 'copy', '.json': 'json', '.png': 'copy', '.svg': 'copy', '.webp': 'copy',
59
+ }
55
60
  const standardOptions: Options = {
56
61
  bundle: true,
57
62
  format: ['esm'],
@@ -3,9 +3,7 @@ import path from 'node:path/posix'
3
3
  import chalk from 'chalk'
4
4
  import cpy from 'cpy'
5
5
 
6
- export interface PackageCopyAssetsParams {
7
- target?: 'esm' | 'cjs'
8
- }
6
+ export interface PackageCopyAssetsParams { target?: 'esm' | 'cjs' }
9
7
 
10
8
  const copyTargetAssets = async (target: 'esm' | 'cjs', name: string, location: string) => {
11
9
  try {
@@ -1,5 +1,7 @@
1
1
  /* eslint-disable max-statements */
2
- import { existsSync, readFileSync } from 'node:fs'
2
+ import {
3
+ existsSync, readFileSync,
4
+ } from 'node:fs'
3
5
  import { cwd } from 'node:process'
4
6
 
5
7
  import chalk from 'chalk'
@@ -57,10 +59,16 @@ const analyzeDeps = async (pkg: string, ignoreMatches: string[]) => {
57
59
  const unusedDevDeps = allUnused.devDependencies
58
60
  const usedDeps = srcUnused.using
59
61
  const usedDevDeps = allUnused.using
60
- const missing = { ...srcUnused.missing, ...allUnused.missing }
61
- const { invalidDirs, invalidFiles } = allUnused
62
+ const missing = {
63
+ ...srcUnused.missing, ...allUnused.missing,
64
+ }
65
+ const {
66
+ invalidDirs, invalidFiles,
67
+ } = allUnused
62
68
 
63
- return { invalidDirs, invalidFiles, missing, unusedDeps, unusedDevDeps, usedDeps, usedDevDeps }
69
+ return {
70
+ invalidDirs, invalidFiles, missing, unusedDeps, unusedDevDeps, usedDeps, usedDevDeps,
71
+ }
64
72
  }
65
73
 
66
74
  export const packageDeps = async () => {
@@ -79,7 +87,9 @@ export const packageDeps = async () => {
79
87
  console.log(`${pkgName} [${error.message}] Failed to parse .depcheckrc [${rawIgnore}]`)
80
88
  }
81
89
 
82
- const { invalidDirs, invalidFiles, unusedDeps, unusedDevDeps, usedDeps, usedDevDeps, missing } = await analyzeDeps(pkg, ignoreMatches)
90
+ const {
91
+ invalidDirs, invalidFiles, unusedDeps, unusedDevDeps, usedDeps, usedDevDeps, missing,
92
+ } = await analyzeDeps(pkg, ignoreMatches)
83
93
 
84
94
  const declaredDeps = Object.keys(packageContent.dependencies ?? {})
85
95
  const declaredPeerDeps = Object.keys(packageContent.peerDependencies ?? {})
@@ -4,7 +4,9 @@ import { existsSync } from 'node:fs'
4
4
  import path from 'node:path'
5
5
 
6
6
  import chalk from 'chalk'
7
- import { Application, ArgumentsReader, TSConfigReader, TypeDocReader } from 'typedoc'
7
+ import {
8
+ Application, ArgumentsReader, TSConfigReader, TypeDocReader,
9
+ } from 'typedoc'
8
10
 
9
11
  const ExitCodes = {
10
12
  CompileError: 3,
@@ -3,9 +3,7 @@ import { promises as fs } from 'node:fs'
3
3
  import chalk from 'chalk'
4
4
  import type { Message } from 'publint'
5
5
 
6
- export interface PackagePublintParams {
7
- verbose?: boolean
8
- }
6
+ export interface PackagePublintParams { verbose?: boolean }
9
7
 
10
8
  export const packagePublint = async (params?: PackagePublintParams) => {
11
9
  const pkgDir = process.env.INIT_CWD
@@ -1,4 +1,6 @@
1
- import { runSteps, runStepsAsync } from '../lib/index.ts'
1
+ import {
2
+ runSteps, runStepsAsync,
3
+ } from '../lib/index.ts'
2
4
 
3
5
  export interface PublintParams {
4
6
  pkg?: string
@@ -10,8 +12,14 @@ export interface PublintPackageParams {
10
12
  verbose?: boolean
11
13
  }
12
14
 
13
- export const publint = async ({ verbose, pkg }: PublintParams) => {
14
- return pkg ? await publintPackage({ pkg, verbose }) : publintAll({ verbose })
15
+ export const publint = async ({
16
+ verbose, pkg,
17
+ }: PublintParams) => {
18
+ return pkg
19
+ ? await publintPackage({
20
+ pkg, verbose,
21
+ })
22
+ : publintAll({ verbose })
15
23
  }
16
24
 
17
25
  export const publintPackage = ({ pkg }: PublintPackageParams) => {
@@ -16,11 +16,21 @@ export interface RecompilePackageParams {
16
16
  verbose?: boolean
17
17
  }
18
18
 
19
- export const recompile = async ({ verbose, target, pkg, incremental }: RecompileParams) => {
20
- return pkg ? await recompilePackage({ pkg, target, verbose }) : await recompileAll({ incremental, target, verbose })
19
+ export const recompile = async ({
20
+ verbose, target, pkg, incremental,
21
+ }: RecompileParams) => {
22
+ return pkg
23
+ ? await recompilePackage({
24
+ pkg, target, verbose,
25
+ })
26
+ : await recompileAll({
27
+ incremental, target, verbose,
28
+ })
21
29
  }
22
30
 
23
- export const recompilePackage = ({ verbose, target, pkg }: RecompilePackageParams) => {
31
+ export const recompilePackage = ({
32
+ verbose, target, pkg,
33
+ }: RecompilePackageParams) => {
24
34
  const targetOptions = target ? ['-t', target] : []
25
35
  const verboseOptions = verbose ? ['--verbose'] : ['--no-verbose']
26
36
 
@@ -30,7 +40,9 @@ export const recompilePackage = ({ verbose, target, pkg }: RecompilePackageParam
30
40
  )
31
41
  }
32
42
 
33
- export const recompileAll = async ({ jobs, verbose, target, incremental }: RecompileParams) => {
43
+ export const recompileAll = async ({
44
+ jobs, verbose, target, incremental,
45
+ }: RecompileParams) => {
34
46
  const start = Date.now()
35
47
  const verboseOptions = verbose ? ['--verbose'] : ['--no-verbose']
36
48
  const targetOptions = target ? ['-t', target] : []
@@ -1,6 +1,10 @@
1
- import { closeSync, openSync, rmSync } from 'node:fs'
1
+ import {
2
+ closeSync, openSync, rmSync,
3
+ } from 'node:fs'
2
4
 
3
- import { runSteps, yarnWorkspaces } from '../lib/index.ts'
5
+ import {
6
+ runSteps, yarnWorkspaces,
7
+ } from '../lib/index.ts'
4
8
 
5
9
  export const reinstall = () => {
6
10
  console.log('Reinstall [Clear Lock File]')
@@ -9,10 +13,14 @@ export const reinstall = () => {
9
13
  console.log('Reinstall [Clear Node Modules]')
10
14
  const workspaces = yarnWorkspaces()
11
15
  const result = workspaces
12
- .map(({ location, name }) => {
16
+ .map(({
17
+ location, name,
18
+ }) => {
13
19
  const dist = `${location}/node_modules`
14
20
  try {
15
- rmSync(dist, { force: true, recursive: true })
21
+ rmSync(dist, {
22
+ force: true, recursive: true,
23
+ })
16
24
  return 0
17
25
  } catch (ex) {
18
26
  const error = ex as Error
@@ -1,15 +1,21 @@
1
1
  import { rmSync } from 'node:fs'
2
2
 
3
- import { runSteps, yarnWorkspaces } from '../lib/index.ts'
3
+ import {
4
+ runSteps, yarnWorkspaces,
5
+ } from '../lib/index.ts'
4
6
 
5
7
  export const relint = () => {
6
8
  console.log('Relint - Cleaning [.eslintcache]')
7
9
  const workspaces = yarnWorkspaces()
8
10
  const result = workspaces
9
- .map(({ location, name }) => {
11
+ .map(({
12
+ location, name,
13
+ }) => {
10
14
  const dist = `${location}/.eslintcache`
11
15
  try {
12
- rmSync(dist, { force: true, recursive: true })
16
+ rmSync(dist, {
17
+ force: true, recursive: true,
18
+ })
13
19
  return 0
14
20
  } catch (ex) {
15
21
  const error = ex as Error
@@ -1,6 +1,8 @@
1
1
  import chalk from 'chalk'
2
2
 
3
- import { detectDuplicateDependencies, parsedPackageJSON } from '../lib/index.ts'
3
+ import {
4
+ detectDuplicateDependencies, parsedPackageJSON,
5
+ } from '../lib/index.ts'
4
6
 
5
7
  const DefaultDependencies = ['axios', '@xylabs/pixel', 'react', 'graphql', 'react-router', '@mui/material', '@mui/system']
6
8
 
@@ -1,4 +1,6 @@
1
- import { isYarnVersionOrGreater, processEx } from '../lib/index.ts'
1
+ import {
2
+ isYarnVersionOrGreater, processEx,
3
+ } from '../lib/index.ts'
2
4
 
3
5
  export const yarn3Only = () => {
4
6
  const [valid, version] = isYarnVersionOrGreater(3)
@@ -4,7 +4,9 @@ import chalk from 'chalk'
4
4
 
5
5
  import { packageCompile } from '../../actions/index.ts'
6
6
 
7
- packageCompile({ verbose: true, publint: false })
7
+ packageCompile({
8
+ verbose: true, publint: false,
9
+ })
8
10
  .then(value => (process.exitCode = value))
9
11
  .catch((reason) => {
10
12
  console.error(chalk.red(reason))
@@ -8,6 +8,8 @@ export const deleteGlob = (globPath: string) => {
8
8
 
9
9
  // Remove each file or directory
10
10
  for (const file of files) {
11
- fs.rmSync(file, { recursive: true, force: true })
11
+ fs.rmSync(file, {
12
+ recursive: true, force: true,
13
+ })
12
14
  }
13
15
  }
@@ -32,7 +32,9 @@ const trimObjectDependencyVirtualMeta = (obj: Record<string, ChildFields>): Reco
32
32
 
33
33
  const trimDependencyVirtualMeta = (dependencies: DependencyEntries): DependencyEntries => {
34
34
  return dependencies.map((dependency) => {
35
- return { children: trimObjectDependencyVirtualMeta(dependency.children), value: trimVirtualMeta(dependency.value) }
35
+ return {
36
+ children: trimObjectDependencyVirtualMeta(dependency.children), value: trimVirtualMeta(dependency.value),
37
+ }
36
38
  })
37
39
  }
38
40
 
@@ -91,5 +93,7 @@ export class DuplicateDetector {
91
93
  return acc
92
94
  }
93
95
 
94
- private resultsFactory = (dependency: string): Results => ({ currentVersion: undefined, dependency, duplicateVersions: [] })
96
+ private resultsFactory = (dependency: string): Results => ({
97
+ currentVersion: undefined, dependency, duplicateVersions: [],
98
+ })
95
99
  }
@@ -1,3 +1,6 @@
1
- export type ReadFileSyncOptions = BufferEncoding | { encoding: BufferEncoding; flags?: string }
1
+ export type ReadFileSyncOptions = BufferEncoding | {
2
+ encoding: BufferEncoding
3
+ flags?: string
4
+ }
2
5
 
3
6
  export const defaultReadFileSyncOptions: ReadFileSyncOptions = { encoding: 'utf8' }
@@ -1,8 +1,14 @@
1
- import type { PathLike, WriteFileOptions } from 'node:fs'
2
- import { existsSync, readFileSync, writeFileSync } from 'node:fs'
1
+ import type {
2
+ PathLike, WriteFileOptions,
3
+ } from 'node:fs'
4
+ import {
5
+ existsSync, readFileSync, writeFileSync,
6
+ } from 'node:fs'
3
7
 
4
8
  import { notEmpty } from '../string/index.ts'
5
- import { CROSS_PLATFORM_NEWLINE, WINDOWS_NEWLINE_REGEX } from './constants.ts'
9
+ import {
10
+ CROSS_PLATFORM_NEWLINE, WINDOWS_NEWLINE_REGEX,
11
+ } from './constants.ts'
6
12
  import type { ReadFileSyncOptions } from './ReadFileSyncOptions.ts'
7
13
  import { defaultReadFileSyncOptions } from './ReadFileSyncOptions.ts'
8
14
 
@@ -1,5 +1,7 @@
1
1
  import type { PathLike } from 'node:fs'
2
- import { existsSync, readFileSync } from 'node:fs'
2
+ import {
3
+ existsSync, readFileSync,
4
+ } from 'node:fs'
3
5
 
4
6
  import type { ReadFileSyncOptions } from './ReadFileSyncOptions.ts'
5
7
  import { defaultReadFileSyncOptions } from './ReadFileSyncOptions.ts'
@@ -1,8 +1,12 @@
1
1
  import chalk from 'chalk'
2
2
 
3
- import { readNonEmptyLines, writeLines } from './file/index.ts'
3
+ import {
4
+ readNonEmptyLines, writeLines,
5
+ } from './file/index.ts'
4
6
  import { union } from './string/index.ts'
5
- import { INIT_CWD, yarnWorkspace, yarnWorkspaces } from './yarn/index.ts'
7
+ import {
8
+ INIT_CWD, yarnWorkspace, yarnWorkspaces,
9
+ } from './yarn/index.ts'
6
10
 
7
11
  const mergeEntries = (a: string[], b: string[]): string[] => [...union(a, b)].sort()
8
12
 
@@ -12,7 +16,9 @@ export const generateIgnoreFiles = (filename: string, pkg?: string) => {
12
16
  const workspaces = pkg ? [yarnWorkspace(pkg)] : yarnWorkspaces()
13
17
  const readEntries = (location: string): string[] => readNonEmptyLines(`${location}/${filename}`)
14
18
  const writeEntries = (location: string, entries: string[]) => writeLines(`${location}/${filename}`, entries)
15
- const results = workspaces.map(({ location, name }) => {
19
+ const results = workspaces.map(({
20
+ location, name,
21
+ }) => {
16
22
  try {
17
23
  writeEntries(location, mergeEntries(readEntries(cwd), readEntries(location)))
18
24
  return 0
@@ -28,7 +28,9 @@ export const runSteps = (name: string, steps: ScriptStep[], exitOnFail = true, m
28
28
  = spawnSync(command, Array.isArray(args) ? args : args.split(' '), {
29
29
  ...config,
30
30
  encoding: 'utf8',
31
- env: { FORCE_COLOR: '3', ...process.env },
31
+ env: {
32
+ FORCE_COLOR: '3', ...process.env,
33
+ },
32
34
  shell: true,
33
35
  stdio: 'inherit',
34
36
  }).status ?? 0
@@ -19,7 +19,9 @@ export const runStepAsync = (name: string, step: ScriptStep, exitOnFail = true,
19
19
  }
20
20
  spawn(command, Array.isArray(args) ? args : args.split(' '), {
21
21
  ...config,
22
- env: { FORCE_COLOR: '3', ...process.env },
22
+ env: {
23
+ FORCE_COLOR: '3', ...process.env,
24
+ },
23
25
  shell: true,
24
26
  stdio: 'inherit',
25
27
  }).on('close', (code) => {
@@ -26,4 +26,6 @@ const safeExitAsync = async (func: () => Promise<number>, exitOnFail = true): Pr
26
26
  }
27
27
  }
28
28
 
29
- export { safeExit, safeExitAsync }
29
+ export {
30
+ safeExit, safeExitAsync,
31
+ }
@@ -1,7 +1,9 @@
1
1
  import { spawnSync } from 'node:child_process'
2
2
 
3
3
  export const isYarnVersionOrGreater = (major: number, minor?: number, patch?: number): [boolean, string] => {
4
- const result = spawnSync('yarn', ['-v'], { encoding: 'utf8', shell: true })
4
+ const result = spawnSync('yarn', ['-v'], {
5
+ encoding: 'utf8', shell: true,
6
+ })
5
7
  const version = result.stdout.toString().replaceAll('\n', '')
6
8
  const versionNumbers = version.split('.').map(ver => Number.parseInt(ver))
7
9
  const majorDelta = versionNumbers[0] - major
@@ -3,7 +3,9 @@ import { spawnSync } from 'node:child_process'
3
3
  import type { Workspace } from './Workspace.ts'
4
4
 
5
5
  export const yarnWorkspaces = (): Workspace[] => {
6
- const result = spawnSync('yarn', ['workspaces', 'list', '--json', '--recursive'], { encoding: 'utf8', shell: true })
6
+ const result = spawnSync('yarn', ['workspaces', 'list', '--json', '--recursive'], {
7
+ encoding: 'utf8', shell: true,
8
+ })
7
9
  if (result.error) {
8
10
  throw result.error
9
11
  }
package/src/xy/param.ts CHANGED
@@ -1,7 +1,5 @@
1
1
  import type { Argv } from 'yargs'
2
2
 
3
3
  export const packagePositionalParam = (yargs: Argv<unknown>) => {
4
- return yargs.positional('package', {
5
- describe: 'Specific package to target',
6
- })
4
+ return yargs.positional('package', { describe: 'Specific package to target' })
7
5
  }
@@ -1,6 +1,8 @@
1
1
  import type { Argv } from 'yargs'
2
2
 
3
- import { build, compile, copyAssets, rebuild, recompile } from '../actions/index.ts'
3
+ import {
4
+ build, compile, copyAssets, rebuild, recompile,
5
+ } from '../actions/index.ts'
4
6
 
5
7
  export const xyBuildCommands = (args: Argv) => {
6
8
  return args
@@ -8,9 +10,7 @@ export const xyBuildCommands = (args: Argv) => {
8
10
  'build [package]',
9
11
  'Build - Compile & Lint',
10
12
  (yargs) => {
11
- return yargs.positional('package', {
12
- describe: 'Specific package to build',
13
- })
13
+ return yargs.positional('package', { describe: 'Specific package to build' })
14
14
  },
15
15
  async (argv) => {
16
16
  if (argv.verbose) {
@@ -30,9 +30,7 @@ export const xyBuildCommands = (args: Argv) => {
30
30
  'compile [package]',
31
31
  'Compile with Typescript & Copy Images',
32
32
  (yargs) => {
33
- return yargs.positional('package', {
34
- describe: 'Specific package to compile',
35
- })
33
+ return yargs.positional('package', { describe: 'Specific package to compile' })
36
34
  },
37
35
  async (argv) => {
38
36
  if (argv.verbose) {
@@ -51,9 +49,7 @@ export const xyBuildCommands = (args: Argv) => {
51
49
  'compile-only [package]',
52
50
  'Compile with Typescript & Copy Images (No Publint)',
53
51
  (yargs) => {
54
- return yargs.positional('package', {
55
- describe: 'Specific package to compile',
56
- })
52
+ return yargs.positional('package', { describe: 'Specific package to compile' })
57
53
  },
58
54
  async (argv) => {
59
55
  if (argv.verbose) {
@@ -73,9 +69,7 @@ export const xyBuildCommands = (args: Argv) => {
73
69
  'recompile [package]',
74
70
  'Re-compile with Typescript & Copy Images',
75
71
  (yargs) => {
76
- return yargs.positional('package', {
77
- describe: 'Specific package to re-compile',
78
- })
72
+ return yargs.positional('package', { describe: 'Specific package to re-compile' })
79
73
  },
80
74
  async (argv) => {
81
75
  if (argv.verbose) {
@@ -94,9 +88,7 @@ export const xyBuildCommands = (args: Argv) => {
94
88
  'rebuild [package]',
95
89
  'Rebuild - Clean, Compile & Lint',
96
90
  (yargs) => {
97
- return yargs.positional('package', {
98
- describe: 'Specific package to rebuild',
99
- })
91
+ return yargs.positional('package', { describe: 'Specific package to rebuild' })
100
92
  },
101
93
  (argv) => {
102
94
  if (argv.verbose) console.log(`Rebuilding: ${argv.package ?? 'all'}`)
@@ -107,9 +99,7 @@ export const xyBuildCommands = (args: Argv) => {
107
99
  'copy-assets [package]',
108
100
  'Copy Assets - Copy the assets from src to dist',
109
101
  (yargs) => {
110
- return yargs.positional('package', {
111
- describe: 'Specific package to copy assets',
112
- })
102
+ return yargs.positional('package', { describe: 'Specific package to copy assets' })
113
103
  },
114
104
  async (argv) => {
115
105
  if (argv.verbose) console.log(`Copying Assets: ${argv.package ?? 'all'}`)
@@ -51,7 +51,9 @@ export const xyCommonCommands = (args: Argv) => {
51
51
  },
52
52
  (argv) => {
53
53
  if (argv.verbose) console.log(`Checking Dependencies: ${argv.package ?? 'all'}`)
54
- process.exitCode = deps({ incremental: !!argv.incremental, jobs: argv.jobs as number, pkg: argv.package as string })
54
+ process.exitCode = deps({
55
+ incremental: !!argv.incremental, jobs: argv.jobs as number, pkg: argv.package as string,
56
+ })
55
57
  },
56
58
  )
57
59
  .command(
@@ -62,7 +64,9 @@ export const xyCommonCommands = (args: Argv) => {
62
64
  },
63
65
  (argv) => {
64
66
  if (argv.verbose) console.log(`Generating TypeDocs: ${argv.package ?? 'all'}`)
65
- process.exitCode = genDocs({ incremental: !!argv.incremental, pkg: argv.package as string })
67
+ process.exitCode = genDocs({
68
+ incremental: !!argv.incremental, pkg: argv.package as string,
69
+ })
66
70
  },
67
71
  )
68
72
  .command(
@@ -1,6 +1,8 @@
1
1
  import type { Argv } from 'yargs'
2
2
 
3
- import { deploy, deployMajor, deployMinor, deployNext } from '../actions/index.ts'
3
+ import {
4
+ deploy, deployMajor, deployMinor, deployNext,
5
+ } from '../actions/index.ts'
4
6
 
5
7
  export const xyDeployCommands = (args: Argv) => {
6
8
  return args
@@ -1,6 +1,8 @@
1
1
  import type { Argv } from 'yargs'
2
2
 
3
- import { clean, dupdeps, reinstall, statics, up, updo } from '../actions/index.ts'
3
+ import {
4
+ clean, dupdeps, reinstall, statics, up, updo,
5
+ } from '../actions/index.ts'
4
6
 
5
7
  export const xyInstallCommands = (args: Argv) => {
6
8
  return args
@@ -8,9 +10,7 @@ export const xyInstallCommands = (args: Argv) => {
8
10
  'clean [package]',
9
11
  'Clean',
10
12
  (yargs) => {
11
- return yargs.positional('package', {
12
- describe: 'Specific package to clean',
13
- })
13
+ return yargs.positional('package', { describe: 'Specific package to clean' })
14
14
  },
15
15
  async (argv) => {
16
16
  if (argv.verbose) {
@@ -1,7 +1,9 @@
1
1
  import chalk from 'chalk'
2
2
  import type { Argv } from 'yargs'
3
3
 
4
- import { cycle, fix, lint, lintProfile, publint, relint, sonar } from '../actions/index.ts'
4
+ import {
5
+ cycle, fix, lint, lintProfile, publint, relint, sonar,
6
+ } from '../actions/index.ts'
5
7
  import { packagePositionalParam } from './param.ts'
6
8
 
7
9
  export const xyLintCommands = (args: Argv) => {
@@ -72,7 +74,9 @@ export const xyLintCommands = (args: Argv) => {
72
74
  async (argv) => {
73
75
  if (argv.verbose) console.log('Publint')
74
76
  const start = Date.now()
75
- process.exitCode = await publint({ pkg: argv.package as string, verbose: !!argv.verbose })
77
+ process.exitCode = await publint({
78
+ pkg: argv.package as string, verbose: !!argv.verbose,
79
+ })
76
80
  console.log(chalk.blue(`Finished in ${Date.now() - start}ms`))
77
81
  },
78
82
  )