@xylabs/ts-scripts-yarn3 7.4.18 → 7.4.20

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 (182) hide show
  1. package/README.body.md +86 -0
  2. package/README.md +108 -0
  3. package/dist/actions/claude-commands.mjs +6 -2
  4. package/dist/actions/claude-commands.mjs.map +1 -1
  5. package/dist/actions/claude-rules.mjs +6 -2
  6. package/dist/actions/claude-rules.mjs.map +1 -1
  7. package/dist/actions/claude-skills.mjs +120 -0
  8. package/dist/actions/claude-skills.mjs.map +1 -0
  9. package/dist/actions/compile.mjs.map +1 -1
  10. package/dist/actions/cycle.mjs.map +1 -1
  11. package/dist/actions/dead.mjs.map +1 -1
  12. package/dist/actions/deploy-major.mjs.map +1 -1
  13. package/dist/actions/deploy-minor.mjs.map +1 -1
  14. package/dist/actions/deploy-next.mjs.map +1 -1
  15. package/dist/actions/deploy.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/index.mjs +367 -160
  19. package/dist/actions/index.mjs.map +1 -1
  20. package/dist/actions/knip.mjs.map +1 -1
  21. package/dist/actions/lint.mjs.map +1 -1
  22. package/dist/actions/publint.mjs.map +1 -1
  23. package/dist/actions/publish.mjs.map +1 -1
  24. package/dist/actions/readme-gen.mjs +136 -20
  25. package/dist/actions/readme-gen.mjs.map +1 -1
  26. package/dist/actions/readme-init.mjs +83 -0
  27. package/dist/actions/readme-init.mjs.map +1 -0
  28. package/dist/actions/rebuild.mjs.map +1 -1
  29. package/dist/actions/reinstall.mjs.map +1 -1
  30. package/dist/actions/relint.mjs.map +1 -1
  31. package/dist/actions/retest.mjs +2 -2
  32. package/dist/actions/retest.mjs.map +1 -1
  33. package/dist/actions/sonar.mjs.map +1 -1
  34. package/dist/actions/test.mjs.map +1 -1
  35. package/dist/actions/up.mjs.map +1 -1
  36. package/dist/actions/updo.mjs.map +1 -1
  37. package/dist/actions/upplug.mjs.map +1 -1
  38. package/dist/actions/upyarn.mjs.map +1 -1
  39. package/dist/bin/xy.mjs +982 -642
  40. package/dist/bin/xy.mjs.map +1 -1
  41. package/dist/index.d.ts +46 -13
  42. package/dist/index.mjs +1044 -695
  43. package/dist/index.mjs.map +1 -1
  44. package/dist/lib/claudeMdTemplate.mjs +28 -3
  45. package/dist/lib/claudeMdTemplate.mjs.map +1 -1
  46. package/dist/lib/generateReadmeFiles.mjs +118 -21
  47. package/dist/lib/generateReadmeFiles.mjs.map +1 -1
  48. package/dist/lib/index.mjs +146 -24
  49. package/dist/lib/index.mjs.map +1 -1
  50. package/dist/lib/runSteps.mjs.map +1 -1
  51. package/dist/lib/runXy.mjs.map +1 -1
  52. package/dist/xy/{xyBuildCommands.mjs → build-commands/build.mjs} +107 -94
  53. package/dist/xy/build-commands/build.mjs.map +1 -0
  54. package/dist/xy/build-commands/index.mjs +502 -0
  55. package/dist/xy/build-commands/index.mjs.map +1 -0
  56. package/dist/xy/common/claude/commandsCommand.mjs +111 -0
  57. package/dist/xy/common/claude/commandsCommand.mjs.map +1 -0
  58. package/dist/xy/common/claude/index.mjs +441 -0
  59. package/dist/xy/common/claude/index.mjs.map +1 -0
  60. package/dist/xy/common/claude/initCommand.mjs +393 -0
  61. package/dist/xy/common/claude/initCommand.mjs.map +1 -0
  62. package/dist/xy/common/claude/rulesCommand.mjs +133 -0
  63. package/dist/xy/common/claude/rulesCommand.mjs.map +1 -0
  64. package/dist/xy/common/claude/settingsCommand.mjs +90 -0
  65. package/dist/xy/common/claude/settingsCommand.mjs.map +1 -0
  66. package/dist/xy/common/claude/skillsCommand.mjs +129 -0
  67. package/dist/xy/common/claude/skillsCommand.mjs.map +1 -0
  68. package/dist/xy/common/cleanDocsCommand.mjs +45 -0
  69. package/dist/xy/common/cleanDocsCommand.mjs.map +1 -0
  70. package/dist/xy/common/deadCommand.mjs +116 -0
  71. package/dist/xy/common/deadCommand.mjs.map +1 -0
  72. package/dist/xy/common/genDocsCommand.mjs +125 -0
  73. package/dist/xy/common/genDocsCommand.mjs.map +1 -0
  74. package/dist/xy/common/gitignoreGenCommand.mjs +98 -0
  75. package/dist/xy/common/gitignoreGenCommand.mjs.map +1 -0
  76. package/dist/xy/common/gitlintCommand.mjs +82 -0
  77. package/dist/xy/common/gitlintCommand.mjs.map +1 -0
  78. package/dist/xy/{xyCommonCommands.mjs → common/index.mjs} +561 -242
  79. package/dist/xy/common/index.mjs.map +1 -0
  80. package/dist/xy/common/licenseCommand.mjs +100 -0
  81. package/dist/xy/common/licenseCommand.mjs.map +1 -0
  82. package/dist/xy/common/npmignoreGenCommand.mjs +98 -0
  83. package/dist/xy/common/npmignoreGenCommand.mjs.map +1 -0
  84. package/dist/xy/common/readme/genCommand.mjs +321 -0
  85. package/dist/xy/common/readme/genCommand.mjs.map +1 -0
  86. package/dist/xy/common/readme/index.mjs +361 -0
  87. package/dist/xy/common/readme/index.mjs.map +1 -0
  88. package/dist/xy/common/readme/initCommand.mjs +103 -0
  89. package/dist/xy/common/readme/initCommand.mjs.map +1 -0
  90. package/dist/xy/common/retestCommand.mjs +111 -0
  91. package/dist/xy/common/retestCommand.mjs.map +1 -0
  92. package/dist/xy/common/testCommand.mjs +108 -0
  93. package/dist/xy/common/testCommand.mjs.map +1 -0
  94. package/dist/xy/common/upplugCommand.mjs +113 -0
  95. package/dist/xy/common/upplugCommand.mjs.map +1 -0
  96. package/dist/xy/common/upyarnCommand.mjs +108 -0
  97. package/dist/xy/common/upyarnCommand.mjs.map +1 -0
  98. package/dist/xy/common/yarn3OnlyCommand.mjs +70 -0
  99. package/dist/xy/common/yarn3OnlyCommand.mjs.map +1 -0
  100. package/dist/xy/deploy/deployCommand.mjs +139 -0
  101. package/dist/xy/deploy/deployCommand.mjs.map +1 -0
  102. package/dist/xy/deploy/deployMajorCommand.mjs +139 -0
  103. package/dist/xy/deploy/deployMajorCommand.mjs.map +1 -0
  104. package/dist/xy/deploy/deployMinorCommand.mjs +139 -0
  105. package/dist/xy/deploy/deployMinorCommand.mjs.map +1 -0
  106. package/dist/xy/deploy/deployNextCommand.mjs +139 -0
  107. package/dist/xy/deploy/deployNextCommand.mjs.map +1 -0
  108. package/dist/xy/{xyDeployCommands.mjs → deploy/index.mjs} +53 -53
  109. package/dist/xy/deploy/index.mjs.map +1 -0
  110. package/dist/xy/deploy/publishCommand.mjs +108 -0
  111. package/dist/xy/deploy/publishCommand.mjs.map +1 -0
  112. package/dist/xy/index.mjs +982 -642
  113. package/dist/xy/index.mjs.map +1 -1
  114. package/dist/xy/install/cleanCommand.mjs +140 -0
  115. package/dist/xy/install/cleanCommand.mjs.map +1 -0
  116. package/dist/xy/install/dupdepsCommand.mjs +191 -0
  117. package/dist/xy/install/dupdepsCommand.mjs.map +1 -0
  118. package/dist/xy/{xyInstallCommands.mjs → install/index.mjs} +71 -68
  119. package/dist/xy/install/index.mjs.map +1 -0
  120. package/dist/xy/install/reinstallCommand.mjs +140 -0
  121. package/dist/xy/install/reinstallCommand.mjs.map +1 -0
  122. package/dist/xy/install/staticsCommand.mjs +191 -0
  123. package/dist/xy/install/staticsCommand.mjs.map +1 -0
  124. package/dist/{actions/clean-jest.mjs → xy/install/upCommand.mjs} +15 -6
  125. package/dist/xy/install/upCommand.mjs.map +1 -0
  126. package/dist/xy/install/updoCommand.mjs +112 -0
  127. package/dist/xy/install/updoCommand.mjs.map +1 -0
  128. package/dist/xy/lint/cycleCommand.mjs +163 -0
  129. package/dist/xy/lint/cycleCommand.mjs.map +1 -0
  130. package/dist/xy/lint/deplintCommand.mjs +814 -0
  131. package/dist/xy/lint/deplintCommand.mjs.map +1 -0
  132. package/dist/xy/lint/fixCommand.mjs +168 -0
  133. package/dist/xy/lint/fixCommand.mjs.map +1 -0
  134. package/dist/xy/{xyLintCommands.mjs → lint/index.mjs} +176 -145
  135. package/dist/xy/lint/index.mjs.map +1 -0
  136. package/dist/xy/lint/knipCommand.mjs +121 -0
  137. package/dist/xy/lint/knipCommand.mjs.map +1 -0
  138. package/dist/xy/lint/lintCommand.mjs +186 -0
  139. package/dist/xy/lint/lintCommand.mjs.map +1 -0
  140. package/dist/xy/lint/publintCommand.mjs +187 -0
  141. package/dist/xy/lint/publintCommand.mjs.map +1 -0
  142. package/dist/xy/lint/relintCommand.mjs +163 -0
  143. package/dist/xy/lint/relintCommand.mjs.map +1 -0
  144. package/dist/xy/lint/sonarCommand.mjs +121 -0
  145. package/dist/xy/lint/sonarCommand.mjs.map +1 -0
  146. package/dist/xy/xy.mjs +980 -640
  147. package/dist/xy/xy.mjs.map +1 -1
  148. package/package.json +2 -2
  149. package/templates/claude/skills/xylabs-e2e-setup/SKILL.md +196 -0
  150. package/templates/readme/README.body.md +11 -0
  151. package/templates/readme/README.template.md +22 -0
  152. package/dist/actions/clean-jest.mjs.map +0 -1
  153. package/dist/xy/xyBuildCommands.mjs.map +0 -1
  154. package/dist/xy/xyCommonCommands.mjs.map +0 -1
  155. package/dist/xy/xyDeployCommands.mjs.map +0 -1
  156. package/dist/xy/xyInstallCommands.mjs.map +0 -1
  157. package/dist/xy/xyLintCommands.mjs.map +0 -1
  158. /package/templates/{CLAUDE-project.md → claude/CLAUDE-project.md} +0 -0
  159. /package/templates/{commands → claude/commands}/xylabs-build.md +0 -0
  160. /package/templates/{commands → claude/commands}/xylabs-clean.md +0 -0
  161. /package/templates/{commands → claude/commands}/xylabs-compile.md +0 -0
  162. /package/templates/{commands → claude/commands}/xylabs-cycle.md +0 -0
  163. /package/templates/{commands → claude/commands}/xylabs-deplint.md +0 -0
  164. /package/templates/{commands → claude/commands}/xylabs-deploy-major.md +0 -0
  165. /package/templates/{commands → claude/commands}/xylabs-deploy-minor.md +0 -0
  166. /package/templates/{commands → claude/commands}/xylabs-deploy.md +0 -0
  167. /package/templates/{commands → claude/commands}/xylabs-fix.md +0 -0
  168. /package/templates/{commands → claude/commands}/xylabs-knip.md +0 -0
  169. /package/templates/{commands → claude/commands}/xylabs-lint.md +0 -0
  170. /package/templates/{commands → claude/commands}/xylabs-publint.md +0 -0
  171. /package/templates/{commands → claude/commands}/xylabs-rebuild.md +0 -0
  172. /package/templates/{commands → claude/commands}/xylabs-test.md +0 -0
  173. /package/templates/{rules → claude/rules}/xylabs-architecture.md +0 -0
  174. /package/templates/{rules → claude/rules}/xylabs-build.md +0 -0
  175. /package/templates/{rules → claude/rules}/xylabs-dependencies.md +0 -0
  176. /package/templates/{rules → claude/rules}/xylabs-error-handling.md +0 -0
  177. /package/templates/{rules → claude/rules}/xylabs-frameworks.md +0 -0
  178. /package/templates/{rules → claude/rules}/xylabs-git-workflow.md +0 -0
  179. /package/templates/{rules → claude/rules}/xylabs-linting.md +0 -0
  180. /package/templates/{rules → claude/rules}/xylabs-naming.md +0 -0
  181. /package/templates/{rules → claude/rules}/xylabs-style.md +0 -0
  182. /package/templates/{rules → claude/rules}/xylabs-typescript.md +0 -0
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/lib/checkResult.ts","../../src/lib/claudeMdTemplate.ts","../../src/lib/createBuildConfig.ts","../../src/lib/defaultBuildConfig.ts","../../src/lib/deleteGlob.ts","../../src/lib/dependencies/detectDuplicateDependencies.ts","../../src/lib/processEx.ts","../../src/lib/withError.ts","../../src/lib/withErrnoException.ts","../../src/lib/safeExit.ts","../../src/lib/dependencies/DuplicateDetector.ts","../../src/lib/jsonFormatters.ts","../../src/lib/file/constants.ts","../../src/lib/file/fileLines.ts","../../src/lib/string/empty.ts","../../src/lib/string/union.ts","../../src/lib/file/ReadFileSyncOptions.ts","../../src/lib/file/tryReadFileSync.ts","../../src/lib/generateIgnoreFiles.ts","../../src/lib/yarn/isYarnVersionOrGreater.ts","../../src/lib/yarn/workspace/yarnWorkspaces.ts","../../src/lib/yarn/workspace/yarnWorkspace.ts","../../src/lib/yarn/yarnInitCwd.ts","../../src/lib/generateReadmeFiles.ts","../../src/lib/loadConfig.ts","../../src/lib/parsedPackageJSON.ts","../../src/lib/runSteps.ts","../../src/lib/runStepsAsync.ts","../../src/lib/runXy.ts","../../src/lib/runXyWithWarning.ts"],"sourcesContent":["import chalk from 'chalk'\n\nexport const checkResult = (name: string, result: number, level: 'error' | 'warn' = 'error', exitOnFail = false) => {\n if (result) {\n const exiting = exitOnFail ? '[Exiting Process]' : '[Continuing]'\n const chalkFunc = level === 'error' ? chalk.red : chalk.yellow\n console[level](chalkFunc(`${name} had ${result} failures ${exiting}`))\n if (exitOnFail) {\n process.exit(result)\n }\n }\n}\n","import { readdirSync, readFileSync } from 'node:fs'\nimport { createRequire } from 'node:module'\nimport PATH from 'node:path'\n\nconst require = createRequire(import.meta.url)\nconst packageRoot = PATH.dirname(require.resolve('@xylabs/ts-scripts-yarn3/package.json'))\nconst templatesDir = PATH.resolve(packageRoot, 'templates')\n\nexport const XYLABS_RULES_PREFIX = 'xylabs-'\nexport const XYLABS_COMMANDS_PREFIX = 'xylabs-'\n\nexport const claudeMdRuleTemplates = (): Record<string, string> => {\n const rulesDir = PATH.resolve(templatesDir, 'rules')\n const files = readdirSync(rulesDir).filter(f => f.startsWith(XYLABS_RULES_PREFIX) && f.endsWith('.md'))\n const result: Record<string, string> = {}\n for (const file of files) {\n result[file] = readFileSync(PATH.resolve(rulesDir, file), 'utf8')\n }\n return result\n}\n\nexport const claudeCommandTemplates = (): Record<string, string> => {\n const commandsDir = PATH.resolve(templatesDir, 'commands')\n const files = readdirSync(commandsDir).filter(f => f.startsWith(XYLABS_COMMANDS_PREFIX) && f.endsWith('.md'))\n const result: Record<string, string> = {}\n for (const file of files) {\n result[file] = readFileSync(PATH.resolve(commandsDir, file), 'utf8')\n }\n return result\n}\n\nexport const claudeMdProjectTemplate = (): string =>\n readFileSync(PATH.resolve(templatesDir, 'CLAUDE-project.md'), 'utf8')\n","import { readFileSync } from 'node:fs'\n\nimport { defaultBuildConfig } from './defaultBuildConfig.ts'\n\nconst getGeneralTypescriptConfig = (location: string) => {\n let generalConfig: string | undefined\n try {\n generalConfig = readFileSync(`${location}/tsconfig.json`, { encoding: 'utf8' })\n } catch {\n return false\n }\n return JSON.parse(generalConfig)\n}\n\nexport const createBuildConfig = (\n location: string,\n module: 'ESNext' | 'CommonJS',\n target: 'ESNext' | 'ES6',\n outDirSuffix: string,\n): Record<string, unknown> | undefined => {\n const generalConfigObject = getGeneralTypescriptConfig(location)\n if (generalConfigObject === false) {\n return undefined\n }\n return {\n ...generalConfigObject,\n compilerOptions: {\n ...defaultBuildConfig.compilerOptions,\n ...generalConfigObject.compilerOptions,\n module,\n outDir: `./${generalConfigObject.compilerOptions?.outDir ?? 'dist'}/${outDirSuffix}`,\n target,\n },\n exclude: [...(generalConfigObject.exclude ?? []), ...defaultBuildConfig.exclude],\n include: [...(generalConfigObject.include ?? []), ...defaultBuildConfig.include],\n }\n}\n","export const defaultBuildConfig = {\n compilerOptions: {\n rootDir: 'src',\n rootDirs: ['package.json'],\n },\n exclude: [\n '**/build',\n '**/dist',\n '**/node_modules',\n '**/*.spec.*',\n '**/*.spec',\n '**/*.stories.*',\n '**/*.example.*',\n '**/spec/*',\n '**/stories/*',\n ],\n include: ['src'],\n}\n","import fs from 'node:fs'\n\nimport { glob } from 'glob'\n\nexport const deleteGlob = (globPath: string) => {\n // Find all files matching the glob pattern\n const files = glob.sync(globPath)\n\n // Remove each file or directory\n for (const file of files) {\n fs.rmSync(file, { recursive: true, force: true })\n }\n}\n","import { execSync } from 'node:child_process'\n\nimport { safeExit } from '../safeExit.ts'\nimport { DuplicateDetector } from './DuplicateDetector.ts'\n\nexport const detectDuplicateDependencies = (depsFromPackageJSON?: string[], DefaultDependencies?: string[]) => {\n let exitCode = 0\n\n const dependencies = depsFromPackageJSON?.length ? depsFromPackageJSON : DefaultDependencies\n\n return safeExit(() => {\n if (dependencies) {\n for (const dependency of dependencies) {\n let output: string\n\n try {\n const cmd = `yarn why ${dependency} --json`\n output = execSync(cmd).toString()\n } catch (e) {\n console.error(`Error running yarn why: ${e}`)\n exitCode = 1\n continue\n }\n\n if (output) {\n exitCode = new DuplicateDetector(output, dependency).detect()\n } else {\n console.log(`${dependency} - N/A`)\n if (depsFromPackageJSON) {\n exitCode = 1\n console.log(`🚨 Library ${dependency} was requested in package.json but not found`)\n }\n }\n }\n return exitCode\n } else {\n console.log('🚨 No dependencies where passed')\n return exitCode\n }\n })\n}\n","import chalk from 'chalk'\n\nimport { withErrnoException } from './withErrnoException.ts'\nimport { withError } from './withError.ts'\n\nexport const processEx = (ex: unknown) => {\n const error = typeof ex === 'string' ? new Error(ex) : ex\n const exitCode\n = withErrnoException(error, (error) => {\n if (error.code === 'ENOENT') {\n console.error(chalk.red(`'${error.path}' not found.`))\n } else {\n console.error(chalk.red(`Errno: ${error.code}`))\n }\n return error.errno ?? -1\n })\n ?? withError(error, (error) => {\n console.error(chalk.red(`${error.name}: ${error.message}`))\n return -1\n })\n ?? (() => {\n console.error(chalk.red(`Unexpected Error: ${JSON.stringify(ex, null, 2)}`))\n return -1\n })()\n // This allows us to use a previously set exit code\n process.exit(process.exitCode ?? exitCode)\n}\n","export const withError = <T extends Error = Error>(\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n ex: any,\n closure: (error: T) => number,\n predicate = (ex: T) => (!!ex.name && !!ex.message),\n) => {\n return predicate(ex as T) ? closure(ex as T) : undefined\n}\n","import { withError } from './withError.ts'\n\nexport const withErrnoException = <T extends NodeJS.ErrnoException = NodeJS.ErrnoException>(\n ex: unknown, closure: (error: T) => number,\n) => {\n return withError<T>(ex, closure, (ex: unknown) => (ex as NodeJS.ErrnoException).errno !== undefined)\n}\n","/** Catch child process a crash and returns the code */\n\nimport { processEx } from './processEx.ts'\n\nconst safeExit = (func: () => number, exitOnFail = true): number => {\n try {\n const result = func()\n if (result && exitOnFail) {\n process.exit(result)\n }\n return result\n } catch (ex) {\n return processEx(ex)\n }\n}\n\nconst safeExitAsync = async (func: () => Promise<number>, exitOnFail = true): Promise<number> => {\n try {\n const result = await func()\n if (result && exitOnFail) {\n process.exit(result)\n }\n return result\n } catch (ex) {\n return processEx(ex)\n }\n}\n\nexport { safeExit, safeExitAsync }\n","import { EOL } from 'node:os'\n\nimport chalk from 'chalk'\n\nimport { multiLineToJSONArray } from '../jsonFormatters.ts'\n\ninterface ChildFields {\n descriptor: string\n locator: string\n}\n\nconst trimVirtualMeta = (value: string): string => {\n const virtualParts = value.split('virtual:')\n if (virtualParts.length > 1) {\n const hashParts = virtualParts[1].split('#')\n return virtualParts[0] + hashParts[1]\n } else {\n return value\n }\n}\n\nconst trimObjectDependencyVirtualMeta = (obj: Record<string, ChildFields>): Record<string, ChildFields> => {\n const resultObj: Record<string, ChildFields> = {}\n for (const [key, value] of Object.entries(obj)) {\n resultObj[trimVirtualMeta(key)] = {\n descriptor: trimVirtualMeta(value.descriptor),\n locator: trimVirtualMeta(value.locator),\n }\n }\n return resultObj\n}\n\nconst trimDependencyVirtualMeta = (dependencies: DependencyEntries): DependencyEntries => {\n return dependencies.map((dependency) => {\n return { children: trimObjectDependencyVirtualMeta(dependency.children), value: trimVirtualMeta(dependency.value) }\n })\n}\n\ninterface DependencyEntry {\n children: Record<string, ChildFields>\n value: string\n}\n\ntype DependencyEntries = DependencyEntry[]\n\ninterface Results {\n currentVersion: string | undefined\n dependency: string\n duplicateVersions: string[]\n}\n\nexport class DuplicateDetector {\n private dependency: string\n private dependencyEntries: DependencyEntries\n\n constructor(output: string, dependency: string) {\n this.dependency = dependency\n this.dependencyEntries = trimDependencyVirtualMeta(multiLineToJSONArray(output))\n }\n\n detect() {\n // eslint-disable-next-line unicorn/no-array-reduce\n const result = this.dependencyEntries.reduce(this.detectReducer, this.resultsFactory(this.dependency))\n if (result.duplicateVersions.length > 0) {\n console.log(chalk.yellow(`${EOL}Duplicates found for: ${this.dependency}`))\n const duplicateVersions = result.duplicateVersions.toString().replaceAll(',', `${EOL} `)\n console.log(chalk.grey(` ${duplicateVersions}`, EOL))\n return 1\n } else {\n console.log(`${this.dependency} - OK`)\n return 0\n }\n }\n\n private detectReducer(acc: Results, entry: DependencyEntry) {\n const version = Object.entries(entry.children).map(([k]) => k)[0]\n\n if (!acc.currentVersion) {\n acc.currentVersion = version\n return acc\n }\n\n if (acc.currentVersion && acc.currentVersion !== version && !version.includes('@virtual:')) {\n // if first duplicate, push the current version as the first duplicate\n if (acc.duplicateVersions.length === 0) {\n acc.duplicateVersions.push(acc.currentVersion)\n }\n acc.duplicateVersions.push(version)\n acc.duplicateVersions = [...new Set(acc.duplicateVersions)]\n }\n return acc\n }\n\n private resultsFactory = (dependency: string): Results => ({\n currentVersion: undefined, dependency, duplicateVersions: [],\n })\n}\n","export const multiLineToJSONArray = (output: string) => {\n const withCommas = output.replaceAll('\\r\\n', '').replaceAll('\\n', ',')\n const cleanCollection = withCommas.slice(0, Math.max(0, withCommas.length - 1))\n const collection = `[${cleanCollection}]`\n return JSON.parse(collection)\n}\n","export const WINDOWS_NEWLINE_REGEX = /\\r\\n/g\nexport const CROSS_PLATFORM_NEWLINE = '\\n'\n","import type { PathLike, WriteFileOptions } from 'node:fs'\nimport {\n existsSync, readFileSync,\n writeFileSync,\n} from 'node:fs'\n\nimport { notEmpty } from '../string/index.ts'\nimport { CROSS_PLATFORM_NEWLINE, WINDOWS_NEWLINE_REGEX } from './constants.ts'\nimport type { ReadFileSyncOptions } from './ReadFileSyncOptions.ts'\nimport { defaultReadFileSyncOptions } from './ReadFileSyncOptions.ts'\n\nexport const readLines = (uri: PathLike, options: ReadFileSyncOptions = defaultReadFileSyncOptions): string[] =>\n existsSync(uri)\n ? readFileSync(uri, options).replace(WINDOWS_NEWLINE_REGEX, CROSS_PLATFORM_NEWLINE).split(CROSS_PLATFORM_NEWLINE)\n : []\n\nexport const readNonEmptyLines = (uri: PathLike, options: ReadFileSyncOptions = defaultReadFileSyncOptions): string[] =>\n readLines(uri, options).filter(notEmpty)\n\nexport const writeLines = (uri: PathLike, lines: string[], options: WriteFileOptions = defaultReadFileSyncOptions) => {\n const existing = existsSync(uri) ? readFileSync(uri, options) : undefined\n const desired = lines.join(CROSS_PLATFORM_NEWLINE)\n // Check if the file is different before writing\n if (existing !== desired) writeFileSync(uri, desired, options)\n}\n","export const empty = (value?: string | undefined): boolean => value?.trim().length === 0\nexport const notEmpty = (value?: string | undefined): boolean => !empty(value)\n","export const union = (a: string[], b: string[]): Set<string> => new Set([...new Set(a), ...new Set(b)])\n","export type ReadFileSyncOptions = BufferEncoding | {\n encoding: BufferEncoding\n flags?: string\n}\n\nexport const defaultReadFileSyncOptions: ReadFileSyncOptions = { encoding: 'utf8' }\n","import type { PathLike } from 'node:fs'\nimport { existsSync, readFileSync } from 'node:fs'\n\nimport type { ReadFileSyncOptions } from './ReadFileSyncOptions.ts'\nimport { defaultReadFileSyncOptions } from './ReadFileSyncOptions.ts'\n\nexport const tryReadFileSync = (uri: PathLike, options: ReadFileSyncOptions = defaultReadFileSyncOptions): string | undefined => {\n return existsSync(uri) ? readFileSync(uri, options) : undefined\n}\n","import chalk from 'chalk'\n\nimport { readNonEmptyLines, writeLines } from './file/index.ts'\nimport { union } from './string/index.ts'\nimport {\n INIT_CWD, yarnWorkspace, yarnWorkspaces,\n} from './yarn/index.ts'\n\nconst localeCompare = (a: string, b: string) => a.localeCompare(b)\n\nconst mergeEntries = (a: string[], b: string[]): string[] => [...union(a, b)].toSorted(localeCompare)\n\nexport const generateIgnoreFiles = (filename: string, pkg?: string) => {\n console.log(chalk.green(`Generate ${filename} Files`))\n const cwd = INIT_CWD() ?? '.'\n const workspaces = pkg ? [yarnWorkspace(pkg)] : yarnWorkspaces()\n const readEntries = (location: string): string[] => readNonEmptyLines(`${location}/${filename}`)\n const writeEntries = (location: string, entries: string[]) => writeLines(`${location}/${filename}`, entries)\n const results = workspaces.map(({ location, name }) => {\n try {\n writeEntries(location, mergeEntries(readEntries(cwd), readEntries(location)))\n return 0\n } catch (ex) {\n const error = ex as Error\n console.error(`Generate ${filename} Files [${name}] [${error.message}]`)\n return 1\n }\n })\n const succeeded = results.every(result => result === 0)\n return succeeded ? 0 : 1\n}\n","import { spawnSync } from 'node:child_process'\n\nexport const isYarnVersionOrGreater = (major: number, minor?: number, patch?: number): [boolean, string] => {\n const result = spawnSync('yarn', ['-v'], { encoding: 'utf8', shell: true })\n const version = result.stdout.toString().replaceAll('\\n', '')\n const versionNumbers = version.split('.').map(ver => Number.parseInt(ver))\n const majorDelta = versionNumbers[0] - major\n const minorDelta = versionNumbers[1] - (minor ?? versionNumbers[1])\n const patchDelta = versionNumbers[2] - (patch ?? versionNumbers[2])\n\n const majorOk = majorDelta >= 0\n const minorOk = majorDelta > 0 || minorDelta >= 0\n const patchOk = majorDelta > 0 || minorDelta > 0 || patchDelta >= 0\n\n return [majorOk && minorOk && patchOk, version]\n}\n","import { spawnSync } from 'node:child_process'\n\nimport type { Workspace } from './Workspace.ts'\n\nexport const yarnWorkspaces = (): Workspace[] => {\n const result = spawnSync('yarn', ['workspaces', 'list', '--json', '--recursive'], { encoding: 'utf8', shell: true })\n if (result.error) {\n throw result.error\n }\n return (\n result.stdout\n .toString()\n // NOTE: This probably doesn't work on Windows\n // TODO: Replace /r/n with /n first\n .split('\\n')\n .slice(0, -1)\n .map((item) => {\n return JSON.parse(item)\n })\n )\n}\n","import type { Workspace } from './Workspace.ts'\nimport { yarnWorkspaces } from './yarnWorkspaces.ts'\n\nexport const yarnWorkspace = (pkg: string): Workspace => {\n const workspace = yarnWorkspaces().find(({ name }) => name === pkg)\n if (!workspace) throw new Error(`Workspace ${pkg} not found`)\n return workspace\n}\n","export const INIT_CWD = () => {\n if (!process.env.INIT_CWD) console.error('Missing INIT_CWD')\n return process.env.INIT_CWD\n}\n","import { execSync } from 'node:child_process'\nimport FS from 'node:fs'\nimport { readFile, writeFile } from 'node:fs/promises'\nimport PATH from 'node:path'\n\nimport chalk from 'chalk'\n\nimport {\n INIT_CWD, yarnWorkspace, yarnWorkspaces,\n} from './yarn/index.ts'\n\ninterface GenerateReadmeFilesParams {\n pkg?: string\n templatePath?: string\n typedoc?: boolean\n verbose?: boolean\n}\n\nfunction fillTemplate(template: string, data: Record<string, string>): string {\n const additionalData: Record<string, string> = { ...data, safeName: data.name.replaceAll('/', '__').replaceAll('@', '') }\n return template.replaceAll(/\\{\\{(.*?)\\}\\}/g, (_, key: string) => additionalData[key.trim()] ?? '')\n}\n\nfunction generateTypedoc(packageLocation: string, entryPoints: string[]): string {\n const tempDir = PATH.join(packageLocation, '.temp-typedoc')\n\n try {\n if (!FS.existsSync(tempDir)) {\n FS.mkdirSync(tempDir, { recursive: true })\n }\n\n const typedocConfig = {\n disableSources: true,\n entryPointStrategy: 'expand',\n entryPoints: entryPoints.map(ep => PATH.resolve(packageLocation, ep)),\n excludeExternals: true,\n excludeInternal: true,\n excludePrivate: true,\n githubPages: false,\n hideBreadcrumbs: true,\n hideGenerator: true,\n hidePageTitle: true,\n out: tempDir,\n plugin: ['typedoc-plugin-markdown'],\n readme: 'none',\n skipErrorChecking: true,\n sort: ['source-order'],\n theme: 'markdown',\n useCodeBlocks: true,\n }\n\n const typedocJsonPath = PATH.join(tempDir, 'typedoc.json')\n FS.writeFileSync(typedocJsonPath, JSON.stringify(typedocConfig, null, 2))\n\n try {\n execSync(`npx typedoc --options ${typedocJsonPath}`, {\n cwd: process.cwd(),\n stdio: ['ignore', 'pipe', 'pipe'],\n })\n } catch {\n return ''\n }\n\n return consolidateMarkdown(tempDir)\n } catch {\n return ''\n } finally {\n try {\n FS.rmSync(tempDir, { force: true, recursive: true })\n } catch {\n // ignore cleanup errors\n }\n }\n}\n\nfunction consolidateMarkdown(tempDir: string): string {\n let consolidated = '## Reference\\n\\n'\n\n const mainReadmePath = PATH.join(tempDir, 'README.md')\n if (FS.existsSync(mainReadmePath)) {\n const mainContent = FS.readFileSync(mainReadmePath, 'utf8')\n .replace(/^---(.|\\n)*?---\\n/, '')\n .replace(/^# .+\\n/, '')\n .replaceAll(/\\]\\((.+?)\\.md\\)/g, '](#$1)')\n\n consolidated += mainContent + '\\n\\n'\n }\n\n consolidated += processDirectory(tempDir)\n\n return consolidated\n .replaceAll(/\\n\\n\\n+/g, '\\n\\n')\n .replaceAll(/^#### /gm, '### ')\n .replaceAll(/^##### /gm, '#### ')\n .replaceAll(/^###### /gm, '##### ')\n}\n\nfunction processDirectory(dir: string, level = 0): string {\n const indent = ' '.repeat(level)\n let content = ''\n\n try {\n const items = FS.readdirSync(dir, { withFileTypes: true })\n\n for (const item of items) {\n if (item.isDirectory()) continue\n if (item.name === 'README.md' || !item.name.endsWith('.md')) continue\n\n const fileContent = FS.readFileSync(PATH.join(dir, item.name), 'utf8')\n .replace(/^---(.|\\n)*?---\\n/, '')\n const moduleName = item.name.replace('.md', '')\n\n content += `\\n\\n${indent}### <a id=\"${moduleName}\"></a>${moduleName}\\n\\n`\n content += fileContent\n .replace(/^# .+\\n/, '')\n .replaceAll(/\\]\\((.+?)\\.md\\)/g, '](#$1)')\n }\n\n for (const item of items) {\n if (!item.isDirectory()) continue\n if (item.name === 'spec' || item.name.includes('.spec')) continue\n\n content += `\\n\\n${indent}### ${item.name}\\n`\n content += processDirectory(PATH.join(dir, item.name), level + 1)\n }\n } catch {\n // skip unreadable directories\n }\n\n return content\n}\n\nexport async function generateReadmeFiles({\n pkg, templatePath, typedoc = false, verbose,\n}: GenerateReadmeFilesParams): Promise<number> {\n console.log(chalk.green('Generate README Files'))\n const cwd = INIT_CWD() ?? '.'\n const resolvedTemplatePath = templatePath ?? PATH.join(cwd, 'scripts', 'README.template.md')\n\n let template: string\n try {\n template = await readFile(resolvedTemplatePath, 'utf8')\n } catch {\n console.error(chalk.red(`Template not found: ${resolvedTemplatePath}`))\n return 1\n }\n\n const workspaces = pkg ? [yarnWorkspace(pkg)] : yarnWorkspaces()\n let failed = false\n\n for (const { location, name } of workspaces) {\n try {\n const pkgJsonPath = PATH.join(location, 'package.json')\n const pkgJson = JSON.parse(await readFile(pkgJsonPath, 'utf8'))\n const typedocContent = typedoc ? generateTypedoc(location, ['src/index*.ts']) : ''\n const readmeContent = fillTemplate(template, { ...pkgJson, typedoc: typedocContent })\n await writeFile(PATH.join(location, 'README.md'), readmeContent)\n if (verbose) console.log(chalk.green(` ${name}`))\n } catch (ex) {\n const error = ex as Error\n console.warn(chalk.yellow(` Skipped ${location}: ${error.message}`))\n failed = true\n }\n }\n\n return failed ? 1 : 0\n}\n","import chalk from 'chalk'\nimport { cosmiconfig } from 'cosmiconfig'\nimport { TypeScriptLoader } from 'cosmiconfig-typescript-loader'\nimport deepmerge from 'deepmerge'\n\nlet config: Record<string, unknown>\n\nexport const loadConfig = async <T extends object>(params?: T): Promise<T> => {\n if (config === undefined) {\n const cosmicConfigResult = await cosmiconfig('xy', { cache: true, loaders: { '.ts': TypeScriptLoader() } }).search()\n config = cosmicConfigResult?.config\n const configFilePath = cosmicConfigResult?.filepath\n if (configFilePath !== undefined) {\n console.log(chalk.green(`Loaded config from ${configFilePath}`))\n if (config.verbose) {\n console.log(chalk.gray(`${JSON.stringify(config, null, 2)}`))\n }\n }\n }\n return deepmerge(config, params ?? {}) as T\n}\n","import { readFileSync } from 'node:fs'\n\nexport const parsedPackageJSON = (path?: string) => {\n const pathToPackageJSON = path ?? process.env.npm_package_json ?? ''\n const packageJSON = readFileSync(pathToPackageJSON).toString()\n return JSON.parse(packageJSON)\n}\n","import type { SpawnSyncOptionsWithBufferEncoding } from 'node:child_process'\nimport { spawnSync } from 'node:child_process'\nimport { existsSync } from 'node:fs'\n\nimport chalk from 'chalk'\n\nimport { checkResult } from './checkResult.ts'\nimport { safeExit } from './safeExit.ts'\n\nexport type ScriptStep\n = | [/* command */ 'yarn' | 'node' | 'ts-node-script' | 'tsc' | 'jest' | 'npm', /* arg */ string | string[]]\n | [/* command */ string, /* arg */ string | string[], /* config */ SpawnSyncOptionsWithBufferEncoding]\n\nexport const runSteps = (name: string, steps: ScriptStep[], exitOnFail = true, messages?: string[]): number => {\n return safeExit(() => {\n const pkgName = process.env.npm_package_name\n console.log(chalk.green(`${name} [${pkgName}]`))\n let totalStatus = 0\n for (const [i, [command, args, config]] of steps.entries()) {\n if (messages?.[i]) {\n console.log(chalk.gray(messages?.[i]))\n }\n const argList = Array.isArray(args) ? args : args.split(' ')\n if (command === 'node' && !existsSync(argList[0])) {\n throw new Error(`File not found [${argList[0]}]`)\n }\n const status\n = spawnSync(command, Array.isArray(args) ? args : args.split(' '), {\n ...config,\n encoding: 'utf8',\n env: { FORCE_COLOR: '3', ...process.env },\n shell: true,\n stdio: 'inherit',\n }).status ?? 0\n checkResult(name, status, 'error', exitOnFail)\n totalStatus += status ?? 0\n }\n return totalStatus\n }, !!exitOnFail)\n}\n","import { spawn } from 'node:child_process'\nimport { existsSync } from 'node:fs'\n\nimport chalk from 'chalk'\n\nimport { checkResult } from './checkResult.ts'\nimport type { ScriptStep } from './runSteps.ts'\nimport { safeExitAsync } from './safeExit.ts'\n\nexport const runStepAsync = (name: string, step: ScriptStep, exitOnFail = true, message?: string) => {\n return new Promise<number>((resolve) => {\n const [command, args, config] = step\n if (message) {\n console.log(chalk.gray(message))\n }\n const argList = Array.isArray(args) ? args : args.split(' ')\n if (command === 'node' && !existsSync(argList[0])) {\n throw new Error(`File not found [${argList[0]}]`)\n }\n spawn(command, Array.isArray(args) ? args : args.split(' '), {\n ...config,\n env: { FORCE_COLOR: '3', ...process.env },\n shell: true,\n stdio: 'inherit',\n }).on('close', (code) => {\n if (code) {\n console.error(\n chalk.red(\n `Command Exited With Non-Zero Result [${chalk.gray(code)}] | ${chalk.yellow(command)} ${chalk.white(\n Array.isArray(args) ? args.join(' ') : args,\n )}`,\n ),\n )\n checkResult(name, code, 'error', exitOnFail)\n resolve(code)\n } else {\n resolve(0)\n }\n })\n })\n}\n\nexport const runStepsAsync = async (name: string, steps: ScriptStep[], exitOnFail = true, messages?: string[]) => {\n return await safeExitAsync(async () => {\n const pkgName = process.env.npm_package_name\n console.log(chalk.green(`${name} [${pkgName}]`))\n let result = 0\n for (const [i, step] of steps.entries()) {\n result += await runStepAsync(name, step, exitOnFail, messages?.[i])\n }\n return result\n })\n}\n","import { runSteps } from './runSteps.ts'\n\nexport const runXy = (command: string) => {\n return runSteps(\n `XY [${command}]`,\n [['yarn', ['xy', command, ...process.argv.filter((value, index) => (index > 1 ? value : undefined))]]],\n )\n}\n","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"],"mappings":";AAAA,OAAO,WAAW;AAEX,IAAM,cAAc,CAAC,MAAc,QAAgB,QAA0B,SAAS,aAAa,UAAU;AAClH,MAAI,QAAQ;AACV,UAAM,UAAU,aAAa,sBAAsB;AACnD,UAAM,YAAY,UAAU,UAAU,MAAM,MAAM,MAAM;AACxD,YAAQ,KAAK,EAAE,UAAU,GAAG,IAAI,QAAQ,MAAM,aAAa,OAAO,EAAE,CAAC;AACrE,QAAI,YAAY;AACd,cAAQ,KAAK,MAAM;AAAA,IACrB;AAAA,EACF;AACF;;;ACXA,SAAS,aAAa,oBAAoB;AAC1C,SAAS,qBAAqB;AAC9B,OAAO,UAAU;AAEjB,IAAMA,WAAU,cAAc,YAAY,GAAG;AAC7C,IAAM,cAAc,KAAK,QAAQA,SAAQ,QAAQ,uCAAuC,CAAC;AACzF,IAAM,eAAe,KAAK,QAAQ,aAAa,WAAW;AAEnD,IAAM,sBAAsB;AAC5B,IAAM,yBAAyB;AAE/B,IAAM,wBAAwB,MAA8B;AACjE,QAAM,WAAW,KAAK,QAAQ,cAAc,OAAO;AACnD,QAAM,QAAQ,YAAY,QAAQ,EAAE,OAAO,OAAK,EAAE,WAAW,mBAAmB,KAAK,EAAE,SAAS,KAAK,CAAC;AACtG,QAAM,SAAiC,CAAC;AACxC,aAAW,QAAQ,OAAO;AACxB,WAAO,IAAI,IAAI,aAAa,KAAK,QAAQ,UAAU,IAAI,GAAG,MAAM;AAAA,EAClE;AACA,SAAO;AACT;AAEO,IAAM,yBAAyB,MAA8B;AACl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AAU,QAAQ,IAAI;AAC5B,YAAQ,IAAIA,OAAM,MAAM,GAAG,IAAI,KAAK,OAAO,GAAG,CAAC;AAC/C,QAAI,SAAS;AACb,eAAW,CAAC,GAAG,IAAI,KAAK,MAAM,QAAQ,GAAG;AACvC,gBAAU,MAAM,aAAa,MAAM,MAAM,YAAY,WAAW,CAAC,CAAC;AAAA,IACpE;AACA,WAAO;AAAA,EACT,CAAC;AACH;;;AClDO,IAAM,QAAQ,CAAC,YAAoB;AACxC,SAAO;AAAA,IACL,OAAO,OAAO;AAAA,IACd,CAAC,CAAC,QAAQ,CAAC,MAAM,SAAS,GAAG,QAAQ,KAAK,OAAO,CAAC,OAAO,UAAW,QAAQ,IAAI,QAAQ,MAAU,CAAC,CAAC,CAAC;AAAA,EACvG;AACF;;;ACPA,OAAOE,YAAW;AAEX,IAAM,mBAAmB,CAAC,YAAoB;AACnD,QAAM,gBAAgB,QAAQ,OAAO;AACrC,QAAM,kBAAkB,WAAW,OAAO;AAC1C,UAAQ,KAAKA,OAAM,OAAO,aAAaA,OAAM,MAAM,aAAa,CAAC,sCAAsC,CAAC;AACxG,UAAQ,KAAKA,OAAM,KAAK,iBAAiBA,OAAM,QAAQ,eAAe,CAAC,IAAI,CAAC;AAC5E,SAAO;AACT;","names":["require","readFileSync","readFileSync","chalk","ex","ex","error","chalk","chalk","chalk","readFileSync","readFileSync","existsSync","readFileSync","existsSync","readFileSync","chalk","spawnSync","chalk","execSync","PATH","chalk","PATH","execSync","chalk","chalk","readFileSync","spawnSync","existsSync","chalk","chalk","config","existsSync","spawnSync","existsSync","chalk","config","chalk","existsSync","chalk"]}
1
+ {"version":3,"sources":["../../src/lib/checkResult.ts","../../src/lib/claudeMdTemplate.ts","../../src/lib/createBuildConfig.ts","../../src/lib/defaultBuildConfig.ts","../../src/lib/deleteGlob.ts","../../src/lib/dependencies/detectDuplicateDependencies.ts","../../src/lib/processEx.ts","../../src/lib/withError.ts","../../src/lib/withErrnoException.ts","../../src/lib/safeExit.ts","../../src/lib/dependencies/DuplicateDetector.ts","../../src/lib/jsonFormatters.ts","../../src/lib/file/constants.ts","../../src/lib/file/fileLines.ts","../../src/lib/string/empty.ts","../../src/lib/string/union.ts","../../src/lib/file/ReadFileSyncOptions.ts","../../src/lib/file/tryReadFileSync.ts","../../src/lib/generateIgnoreFiles.ts","../../src/lib/yarn/isYarnVersionOrGreater.ts","../../src/lib/yarn/workspace/yarnWorkspaces.ts","../../src/lib/yarn/workspace/yarnWorkspace.ts","../../src/lib/yarn/yarnInitCwd.ts","../../src/lib/generateReadmeFiles.ts","../../src/lib/loadConfig.ts","../../src/lib/parsedPackageJSON.ts","../../src/lib/runSteps.ts","../../src/lib/runStepsAsync.ts","../../src/lib/runXy.ts","../../src/lib/runXyWithWarning.ts"],"sourcesContent":["import chalk from 'chalk'\n\nexport const checkResult = (name: string, result: number, level: 'error' | 'warn' = 'error', exitOnFail = false) => {\n if (result) {\n const exiting = exitOnFail ? '[Exiting Process]' : '[Continuing]'\n const chalkFunc = level === 'error' ? chalk.red : chalk.yellow\n console[level](chalkFunc(`${name} had ${result} failures ${exiting}`))\n if (exitOnFail) {\n process.exit(result)\n }\n }\n}\n","import {\n readdirSync, readFileSync, statSync,\n} from 'node:fs'\nimport { createRequire } from 'node:module'\nimport PATH from 'node:path'\n\nconst require = createRequire(import.meta.url)\nconst packageRoot = PATH.dirname(require.resolve('@xylabs/ts-scripts-yarn3/package.json'))\nconst templatesDir = PATH.resolve(packageRoot, 'templates', 'claude')\n\nexport const XYLABS_RULES_PREFIX = 'xylabs-'\nexport const XYLABS_COMMANDS_PREFIX = 'xylabs-'\nexport const XYLABS_SKILLS_PREFIX = 'xylabs-'\n\nexport const claudeMdRuleTemplates = (): Record<string, string> => {\n const rulesDir = PATH.resolve(templatesDir, 'rules')\n const files = readdirSync(rulesDir).filter(f => f.startsWith(XYLABS_RULES_PREFIX) && f.endsWith('.md'))\n const result: Record<string, string> = {}\n for (const file of files) {\n result[file] = readFileSync(PATH.resolve(rulesDir, file), 'utf8')\n }\n return result\n}\n\nexport const claudeCommandTemplates = (): Record<string, string> => {\n const commandsDir = PATH.resolve(templatesDir, 'commands')\n const files = readdirSync(commandsDir).filter(f => f.startsWith(XYLABS_COMMANDS_PREFIX) && f.endsWith('.md'))\n const result: Record<string, string> = {}\n for (const file of files) {\n result[file] = readFileSync(PATH.resolve(commandsDir, file), 'utf8')\n }\n return result\n}\n\n// Returns { 'xylabs-foo': { 'SKILL.md': '...', 'other.ts': '...' } }\nexport const claudeSkillTemplates = (): Record<string, Record<string, string>> => {\n const skillsDir = PATH.resolve(templatesDir, 'skills')\n const dirs = readdirSync(skillsDir).filter(\n f => f.startsWith(XYLABS_SKILLS_PREFIX) && statSync(PATH.resolve(skillsDir, f)).isDirectory(),\n )\n const result: Record<string, Record<string, string>> = {}\n for (const dir of dirs) {\n const dirPath = PATH.resolve(skillsDir, dir)\n const files = readdirSync(dirPath, { recursive: true, encoding: 'utf8' }) as string[]\n result[dir] = {}\n for (const file of files) {\n if (statSync(PATH.resolve(dirPath, file)).isFile()) {\n result[dir][file] = readFileSync(PATH.resolve(dirPath, file), 'utf8')\n }\n }\n }\n return result\n}\n\nexport const claudeMdProjectTemplate = (): string =>\n readFileSync(PATH.resolve(templatesDir, 'CLAUDE-project.md'), 'utf8')\n","import { readFileSync } from 'node:fs'\n\nimport { defaultBuildConfig } from './defaultBuildConfig.ts'\n\nconst getGeneralTypescriptConfig = (location: string) => {\n let generalConfig: string | undefined\n try {\n generalConfig = readFileSync(`${location}/tsconfig.json`, { encoding: 'utf8' })\n } catch {\n return false\n }\n return JSON.parse(generalConfig)\n}\n\nexport const createBuildConfig = (\n location: string,\n module: 'ESNext' | 'CommonJS',\n target: 'ESNext' | 'ES6',\n outDirSuffix: string,\n): Record<string, unknown> | undefined => {\n const generalConfigObject = getGeneralTypescriptConfig(location)\n if (generalConfigObject === false) {\n return undefined\n }\n return {\n ...generalConfigObject,\n compilerOptions: {\n ...defaultBuildConfig.compilerOptions,\n ...generalConfigObject.compilerOptions,\n module,\n outDir: `./${generalConfigObject.compilerOptions?.outDir ?? 'dist'}/${outDirSuffix}`,\n target,\n },\n exclude: [...(generalConfigObject.exclude ?? []), ...defaultBuildConfig.exclude],\n include: [...(generalConfigObject.include ?? []), ...defaultBuildConfig.include],\n }\n}\n","export const defaultBuildConfig = {\n compilerOptions: {\n rootDir: 'src',\n rootDirs: ['package.json'],\n },\n exclude: [\n '**/build',\n '**/dist',\n '**/node_modules',\n '**/*.spec.*',\n '**/*.spec',\n '**/*.stories.*',\n '**/*.example.*',\n '**/spec/*',\n '**/stories/*',\n ],\n include: ['src'],\n}\n","import fs from 'node:fs'\n\nimport { glob } from 'glob'\n\nexport const deleteGlob = (globPath: string) => {\n // Find all files matching the glob pattern\n const files = glob.sync(globPath)\n\n // Remove each file or directory\n for (const file of files) {\n fs.rmSync(file, { recursive: true, force: true })\n }\n}\n","import { execSync } from 'node:child_process'\n\nimport { safeExit } from '../safeExit.ts'\nimport { DuplicateDetector } from './DuplicateDetector.ts'\n\nexport const detectDuplicateDependencies = (depsFromPackageJSON?: string[], DefaultDependencies?: string[]) => {\n let exitCode = 0\n\n const dependencies = depsFromPackageJSON?.length ? depsFromPackageJSON : DefaultDependencies\n\n return safeExit(() => {\n if (dependencies) {\n for (const dependency of dependencies) {\n let output: string\n\n try {\n const cmd = `yarn why ${dependency} --json`\n output = execSync(cmd).toString()\n } catch (e) {\n console.error(`Error running yarn why: ${e}`)\n exitCode = 1\n continue\n }\n\n if (output) {\n exitCode = new DuplicateDetector(output, dependency).detect()\n } else {\n console.log(`${dependency} - N/A`)\n if (depsFromPackageJSON) {\n exitCode = 1\n console.log(`🚨 Library ${dependency} was requested in package.json but not found`)\n }\n }\n }\n return exitCode\n } else {\n console.log('🚨 No dependencies where passed')\n return exitCode\n }\n })\n}\n","import chalk from 'chalk'\n\nimport { withErrnoException } from './withErrnoException.ts'\nimport { withError } from './withError.ts'\n\nexport const processEx = (ex: unknown) => {\n const error = typeof ex === 'string' ? new Error(ex) : ex\n const exitCode\n = withErrnoException(error, (error) => {\n if (error.code === 'ENOENT') {\n console.error(chalk.red(`'${error.path}' not found.`))\n } else {\n console.error(chalk.red(`Errno: ${error.code}`))\n }\n return error.errno ?? -1\n })\n ?? withError(error, (error) => {\n console.error(chalk.red(`${error.name}: ${error.message}`))\n return -1\n })\n ?? (() => {\n console.error(chalk.red(`Unexpected Error: ${JSON.stringify(ex, null, 2)}`))\n return -1\n })()\n // This allows us to use a previously set exit code\n process.exit(process.exitCode ?? exitCode)\n}\n","export const withError = <T extends Error = Error>(\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n ex: any,\n closure: (error: T) => number,\n predicate = (ex: T) => (!!ex.name && !!ex.message),\n) => {\n return predicate(ex as T) ? closure(ex as T) : undefined\n}\n","import { withError } from './withError.ts'\n\nexport const withErrnoException = <T extends NodeJS.ErrnoException = NodeJS.ErrnoException>(\n ex: unknown, closure: (error: T) => number,\n) => {\n return withError<T>(ex, closure, (ex: unknown) => (ex as NodeJS.ErrnoException).errno !== undefined)\n}\n","/** Catch child process a crash and returns the code */\n\nimport { processEx } from './processEx.ts'\n\nconst safeExit = (func: () => number, exitOnFail = true): number => {\n try {\n const result = func()\n if (result && exitOnFail) {\n process.exit(result)\n }\n return result\n } catch (ex) {\n return processEx(ex)\n }\n}\n\nconst safeExitAsync = async (func: () => Promise<number>, exitOnFail = true): Promise<number> => {\n try {\n const result = await func()\n if (result && exitOnFail) {\n process.exit(result)\n }\n return result\n } catch (ex) {\n return processEx(ex)\n }\n}\n\nexport { safeExit, safeExitAsync }\n","import { EOL } from 'node:os'\n\nimport chalk from 'chalk'\n\nimport { multiLineToJSONArray } from '../jsonFormatters.ts'\n\ninterface ChildFields {\n descriptor: string\n locator: string\n}\n\nconst trimVirtualMeta = (value: string): string => {\n const virtualParts = value.split('virtual:')\n if (virtualParts.length > 1) {\n const hashParts = virtualParts[1].split('#')\n return virtualParts[0] + hashParts[1]\n } else {\n return value\n }\n}\n\nconst trimObjectDependencyVirtualMeta = (obj: Record<string, ChildFields>): Record<string, ChildFields> => {\n const resultObj: Record<string, ChildFields> = {}\n for (const [key, value] of Object.entries(obj)) {\n resultObj[trimVirtualMeta(key)] = {\n descriptor: trimVirtualMeta(value.descriptor),\n locator: trimVirtualMeta(value.locator),\n }\n }\n return resultObj\n}\n\nconst trimDependencyVirtualMeta = (dependencies: DependencyEntries): DependencyEntries => {\n return dependencies.map((dependency) => {\n return { children: trimObjectDependencyVirtualMeta(dependency.children), value: trimVirtualMeta(dependency.value) }\n })\n}\n\ninterface DependencyEntry {\n children: Record<string, ChildFields>\n value: string\n}\n\ntype DependencyEntries = DependencyEntry[]\n\ninterface Results {\n currentVersion: string | undefined\n dependency: string\n duplicateVersions: string[]\n}\n\nexport class DuplicateDetector {\n private dependency: string\n private dependencyEntries: DependencyEntries\n\n constructor(output: string, dependency: string) {\n this.dependency = dependency\n this.dependencyEntries = trimDependencyVirtualMeta(multiLineToJSONArray(output))\n }\n\n detect() {\n // eslint-disable-next-line unicorn/no-array-reduce\n const result = this.dependencyEntries.reduce(this.detectReducer, this.resultsFactory(this.dependency))\n if (result.duplicateVersions.length > 0) {\n console.log(chalk.yellow(`${EOL}Duplicates found for: ${this.dependency}`))\n const duplicateVersions = result.duplicateVersions.toString().replaceAll(',', `${EOL} `)\n console.log(chalk.grey(` ${duplicateVersions}`, EOL))\n return 1\n } else {\n console.log(`${this.dependency} - OK`)\n return 0\n }\n }\n\n private detectReducer(acc: Results, entry: DependencyEntry) {\n const version = Object.entries(entry.children).map(([k]) => k)[0]\n\n if (!acc.currentVersion) {\n acc.currentVersion = version\n return acc\n }\n\n if (acc.currentVersion && acc.currentVersion !== version && !version.includes('@virtual:')) {\n // if first duplicate, push the current version as the first duplicate\n if (acc.duplicateVersions.length === 0) {\n acc.duplicateVersions.push(acc.currentVersion)\n }\n acc.duplicateVersions.push(version)\n acc.duplicateVersions = [...new Set(acc.duplicateVersions)]\n }\n return acc\n }\n\n private resultsFactory = (dependency: string): Results => ({\n currentVersion: undefined, dependency, duplicateVersions: [],\n })\n}\n","export const multiLineToJSONArray = (output: string) => {\n const withCommas = output.replaceAll('\\r\\n', '').replaceAll('\\n', ',')\n const cleanCollection = withCommas.slice(0, Math.max(0, withCommas.length - 1))\n const collection = `[${cleanCollection}]`\n return JSON.parse(collection)\n}\n","export const WINDOWS_NEWLINE_REGEX = /\\r\\n/g\nexport const CROSS_PLATFORM_NEWLINE = '\\n'\n","import type { PathLike, WriteFileOptions } from 'node:fs'\nimport {\n existsSync, readFileSync,\n writeFileSync,\n} from 'node:fs'\n\nimport { notEmpty } from '../string/index.ts'\nimport { CROSS_PLATFORM_NEWLINE, WINDOWS_NEWLINE_REGEX } from './constants.ts'\nimport type { ReadFileSyncOptions } from './ReadFileSyncOptions.ts'\nimport { defaultReadFileSyncOptions } from './ReadFileSyncOptions.ts'\n\nexport const readLines = (uri: PathLike, options: ReadFileSyncOptions = defaultReadFileSyncOptions): string[] =>\n existsSync(uri)\n ? readFileSync(uri, options).replace(WINDOWS_NEWLINE_REGEX, CROSS_PLATFORM_NEWLINE).split(CROSS_PLATFORM_NEWLINE)\n : []\n\nexport const readNonEmptyLines = (uri: PathLike, options: ReadFileSyncOptions = defaultReadFileSyncOptions): string[] =>\n readLines(uri, options).filter(notEmpty)\n\nexport const writeLines = (uri: PathLike, lines: string[], options: WriteFileOptions = defaultReadFileSyncOptions) => {\n const existing = existsSync(uri) ? readFileSync(uri, options) : undefined\n const desired = lines.join(CROSS_PLATFORM_NEWLINE)\n // Check if the file is different before writing\n if (existing !== desired) writeFileSync(uri, desired, options)\n}\n","export const empty = (value?: string | undefined): boolean => value?.trim().length === 0\nexport const notEmpty = (value?: string | undefined): boolean => !empty(value)\n","export const union = (a: string[], b: string[]): Set<string> => new Set([...new Set(a), ...new Set(b)])\n","export type ReadFileSyncOptions = BufferEncoding | {\n encoding: BufferEncoding\n flags?: string\n}\n\nexport const defaultReadFileSyncOptions: ReadFileSyncOptions = { encoding: 'utf8' }\n","import type { PathLike } from 'node:fs'\nimport { existsSync, readFileSync } from 'node:fs'\n\nimport type { ReadFileSyncOptions } from './ReadFileSyncOptions.ts'\nimport { defaultReadFileSyncOptions } from './ReadFileSyncOptions.ts'\n\nexport const tryReadFileSync = (uri: PathLike, options: ReadFileSyncOptions = defaultReadFileSyncOptions): string | undefined => {\n return existsSync(uri) ? readFileSync(uri, options) : undefined\n}\n","import chalk from 'chalk'\n\nimport { readNonEmptyLines, writeLines } from './file/index.ts'\nimport { union } from './string/index.ts'\nimport {\n INIT_CWD, yarnWorkspace, yarnWorkspaces,\n} from './yarn/index.ts'\n\nconst localeCompare = (a: string, b: string) => a.localeCompare(b)\n\nconst mergeEntries = (a: string[], b: string[]): string[] => [...union(a, b)].toSorted(localeCompare)\n\nexport const generateIgnoreFiles = (filename: string, pkg?: string) => {\n console.log(chalk.green(`Generate ${filename} Files`))\n const cwd = INIT_CWD() ?? '.'\n const workspaces = pkg ? [yarnWorkspace(pkg)] : yarnWorkspaces()\n const readEntries = (location: string): string[] => readNonEmptyLines(`${location}/${filename}`)\n const writeEntries = (location: string, entries: string[]) => writeLines(`${location}/${filename}`, entries)\n const results = workspaces.map(({ location, name }) => {\n try {\n writeEntries(location, mergeEntries(readEntries(cwd), readEntries(location)))\n return 0\n } catch (ex) {\n const error = ex as Error\n console.error(`Generate ${filename} Files [${name}] [${error.message}]`)\n return 1\n }\n })\n const succeeded = results.every(result => result === 0)\n return succeeded ? 0 : 1\n}\n","import { spawnSync } from 'node:child_process'\n\nexport const isYarnVersionOrGreater = (major: number, minor?: number, patch?: number): [boolean, string] => {\n const result = spawnSync('yarn', ['-v'], { encoding: 'utf8', shell: true })\n const version = result.stdout.toString().replaceAll('\\n', '')\n const versionNumbers = version.split('.').map(ver => Number.parseInt(ver))\n const majorDelta = versionNumbers[0] - major\n const minorDelta = versionNumbers[1] - (minor ?? versionNumbers[1])\n const patchDelta = versionNumbers[2] - (patch ?? versionNumbers[2])\n\n const majorOk = majorDelta >= 0\n const minorOk = majorDelta > 0 || minorDelta >= 0\n const patchOk = majorDelta > 0 || minorDelta > 0 || patchDelta >= 0\n\n return [majorOk && minorOk && patchOk, version]\n}\n","import { spawnSync } from 'node:child_process'\n\nimport type { Workspace } from './Workspace.ts'\n\nexport const yarnWorkspaces = (): Workspace[] => {\n const result = spawnSync('yarn', ['workspaces', 'list', '--json', '--recursive'], { encoding: 'utf8', shell: true })\n if (result.error) {\n throw result.error\n }\n return (\n result.stdout\n .toString()\n // NOTE: This probably doesn't work on Windows\n // TODO: Replace /r/n with /n first\n .split('\\n')\n .slice(0, -1)\n .map((item) => {\n return JSON.parse(item)\n })\n )\n}\n","import type { Workspace } from './Workspace.ts'\nimport { yarnWorkspaces } from './yarnWorkspaces.ts'\n\nexport const yarnWorkspace = (pkg: string): Workspace => {\n const workspace = yarnWorkspaces().find(({ name }) => name === pkg)\n if (!workspace) throw new Error(`Workspace ${pkg} not found`)\n return workspace\n}\n","export const INIT_CWD = () => {\n if (!process.env.INIT_CWD) console.error('Missing INIT_CWD')\n return process.env.INIT_CWD\n}\n","import { execSync } from 'node:child_process'\nimport FS, { readFileSync } from 'node:fs'\nimport {\n mkdir, readFile, writeFile,\n} from 'node:fs/promises'\nimport { createRequire } from 'node:module'\nimport PATH from 'node:path'\nimport { createInterface } from 'node:readline'\n\nimport chalk from 'chalk'\n\nimport {\n INIT_CWD, yarnWorkspace, yarnWorkspaces,\n} from './yarn/index.ts'\n\nconst require = createRequire(import.meta.url)\nconst packageRoot = PATH.dirname(require.resolve('@xylabs/ts-scripts-yarn3/package.json'))\nconst readmeTemplatesDir = PATH.resolve(packageRoot, 'templates', 'readme')\n\ninterface GenerateReadmeFilesParams {\n logoLinkUrl?: string\n logoUrl?: string\n pkg?: string\n templatePath?: string\n typedoc?: boolean\n verbose?: boolean\n}\n\nfunction fillTemplate(template: string, data: Record<string, string>): string {\n const additionalData: Record<string, string> = { ...data, safeName: data.name.replaceAll('/', '__').replaceAll('@', '') }\n return template.replaceAll(/\\{\\{(.*?)\\}\\}/g, (_, key: string) => additionalData[key.trim()] ?? '')\n}\n\nfunction generateTypedoc(packageLocation: string, entryPoints: string[]): string {\n const tempDir = PATH.join(packageLocation, '.temp-typedoc')\n\n try {\n if (!FS.existsSync(tempDir)) {\n FS.mkdirSync(tempDir, { recursive: true })\n }\n\n const typedocConfig = {\n disableSources: true,\n entryPointStrategy: 'expand',\n entryPoints: entryPoints.map(ep => PATH.resolve(packageLocation, ep)),\n excludeExternals: true,\n excludeInternal: true,\n excludePrivate: true,\n githubPages: false,\n hideBreadcrumbs: true,\n hideGenerator: true,\n hidePageTitle: true,\n out: tempDir,\n plugin: ['typedoc-plugin-markdown'],\n readme: 'none',\n skipErrorChecking: true,\n sort: ['source-order'],\n theme: 'markdown',\n useCodeBlocks: true,\n }\n\n const typedocJsonPath = PATH.join(tempDir, 'typedoc.json')\n FS.writeFileSync(typedocJsonPath, JSON.stringify(typedocConfig, null, 2))\n\n try {\n execSync(`npx typedoc --options ${typedocJsonPath}`, {\n cwd: process.cwd(),\n stdio: ['ignore', 'pipe', 'pipe'],\n })\n } catch {\n return ''\n }\n\n return consolidateMarkdown(tempDir)\n } catch {\n return ''\n } finally {\n try {\n FS.rmSync(tempDir, { force: true, recursive: true })\n } catch {\n // ignore cleanup errors\n }\n }\n}\n\nfunction consolidateMarkdown(tempDir: string): string {\n let consolidated = '## Reference\\n\\n'\n\n const mainReadmePath = PATH.join(tempDir, 'README.md')\n if (FS.existsSync(mainReadmePath)) {\n const mainContent = FS.readFileSync(mainReadmePath, 'utf8')\n .replace(/^---(.|\\n)*?---\\n/, '')\n .replace(/^# .+\\n/, '')\n .replaceAll(/\\]\\((.+?)\\.md\\)/g, '](#$1)')\n\n consolidated += mainContent + '\\n\\n'\n }\n\n consolidated += processDirectory(tempDir)\n\n return consolidated\n .replaceAll(/\\n\\n\\n+/g, '\\n\\n')\n .replaceAll(/^#### /gm, '### ')\n .replaceAll(/^##### /gm, '#### ')\n .replaceAll(/^###### /gm, '##### ')\n}\n\nfunction processDirectory(dir: string, level = 0): string {\n const indent = ' '.repeat(level)\n let content = ''\n\n try {\n const items = FS.readdirSync(dir, { withFileTypes: true })\n\n for (const item of items) {\n if (item.isDirectory()) continue\n if (item.name === 'README.md' || !item.name.endsWith('.md')) continue\n\n const fileContent = FS.readFileSync(PATH.join(dir, item.name), 'utf8')\n .replace(/^---(.|\\n)*?---\\n/, '')\n const moduleName = item.name.replace('.md', '')\n\n content += `\\n\\n${indent}### <a id=\"${moduleName}\"></a>${moduleName}\\n\\n`\n content += fileContent\n .replace(/^# .+\\n/, '')\n .replaceAll(/\\]\\((.+?)\\.md\\)/g, '](#$1)')\n }\n\n for (const item of items) {\n if (!item.isDirectory()) continue\n if (item.name === 'spec' || item.name.includes('.spec')) continue\n\n content += `\\n\\n${indent}### ${item.name}\\n`\n content += processDirectory(PATH.join(dir, item.name), level + 1)\n }\n } catch {\n // skip unreadable directories\n }\n\n return content\n}\n\nfunction askConfirmation(question: string): Promise<boolean> {\n const rl = createInterface({ input: process.stdin, output: process.stdout })\n return new Promise((resolve) => {\n rl.question(question, (answer) => {\n rl.close()\n resolve(answer.toLowerCase() === 'y' || answer.toLowerCase() === 'yes')\n })\n })\n}\n\nexport const DEFAULT_README_TEMPLATE = readFileSync(PATH.resolve(readmeTemplatesDir, 'README.template.md'), 'utf8')\nexport const DEFAULT_README_BODY = readFileSync(PATH.resolve(readmeTemplatesDir, 'README.body.md'), 'utf8')\n\nexport function applyLogoConfig(template: string, logoUrl?: string, logoLinkUrl?: string): string {\n let result = template\n if (logoUrl) {\n result = result.replace(/\\[logo]: .+/, `[logo]: ${logoUrl}`)\n if (logoLinkUrl) {\n result = result.replace(/\\[!\\[logo]\\[]][^)]*\\)/, `[![logo][]](${logoLinkUrl})`)\n }\n } else {\n result = result.replace(/\\[!\\[logo]\\[]][^\\n]*\\n*/, '')\n result = result.replace(/\\[logo]: [^\\n]*\\n?/, '')\n }\n return result\n}\n\nexport function resolveTemplatePath(templatePath: string | undefined): string {\n const cwd = INIT_CWD() ?? '.'\n return templatePath ?? PATH.join(cwd, '.xy', 'README.template.md')\n}\n\nasync function loadOrCreateTemplate(resolvedTemplatePath: string): Promise<{\n created: boolean\n template: string\n}> {\n try {\n const template = await readFile(resolvedTemplatePath, 'utf8')\n return { created: false, template }\n } catch {\n console.log(chalk.yellow(`Template not found: ${resolvedTemplatePath}`))\n const shouldCreate = await askConfirmation('Would you like to create a stock template? (y/N) ')\n if (!shouldCreate) {\n throw new Error('Template creation declined')\n }\n const template = DEFAULT_README_TEMPLATE\n await scaffoldTemplate(resolvedTemplatePath, template)\n return { created: true, template }\n }\n}\n\nexport async function scaffoldTemplate(resolvedTemplatePath: string, template: string): Promise<void> {\n const xyDir = PATH.dirname(resolvedTemplatePath)\n await mkdir(xyDir, { recursive: true })\n await writeFile(resolvedTemplatePath, template)\n console.log(chalk.green(`Created template: ${resolvedTemplatePath}`))\n const bodyPath = PATH.join(xyDir, 'README.body.md')\n await writeFile(bodyPath, DEFAULT_README_BODY)\n console.log(chalk.green(`Created body template: ${bodyPath}`))\n}\n\nasync function resolveBody(location: string, defaultBody: string): Promise<string> {\n const localBodyPath = PATH.join(location, 'README.body.md')\n try {\n return await readFile(localBodyPath, 'utf8')\n } catch {\n return defaultBody\n }\n}\n\nasync function generateReadmeForWorkspace(\n location: string,\n name: string,\n template: string,\n defaultBody: string,\n typedoc: boolean,\n verbose: boolean,\n): Promise<boolean> {\n try {\n const pkgJsonPath = PATH.join(location, 'package.json')\n const pkgJson = JSON.parse(await readFile(pkgJsonPath, 'utf8'))\n const body = await resolveBody(location, defaultBody)\n const typedocContent = typedoc ? generateTypedoc(location, ['src/index*.ts']) : ''\n const readmeContent = fillTemplate(template, {\n ...pkgJson, body, typedoc: typedocContent,\n })\n await writeFile(PATH.join(location, 'README.md'), readmeContent)\n if (verbose) console.log(chalk.green(` ${name}`))\n return true\n } catch (ex) {\n const error = ex as Error\n console.warn(chalk.yellow(` Skipped ${location}: ${error.message}`))\n return false\n }\n}\n\nexport async function generateReadmeFiles({\n logoLinkUrl, logoUrl, pkg, templatePath, typedoc = false, verbose = false,\n}: GenerateReadmeFilesParams): Promise<number> {\n console.log(chalk.green('Generate README Files'))\n const resolvedTemplatePath = resolveTemplatePath(templatePath)\n\n let template: string\n let templateCreated: boolean\n try {\n ({ template, created: templateCreated } = await loadOrCreateTemplate(resolvedTemplatePath))\n } catch {\n return 1\n }\n\n template = applyLogoConfig(template, logoUrl, logoLinkUrl)\n\n if (templateCreated) {\n console.log(chalk.green('Generating README files for all packages...'))\n }\n\n const xyDir = PATH.dirname(resolvedTemplatePath)\n const xyBodyPath = PATH.join(xyDir, 'README.body.md')\n let defaultBody: string\n try {\n defaultBody = await readFile(xyBodyPath, 'utf8')\n } catch {\n defaultBody = DEFAULT_README_BODY\n }\n\n const workspaces = pkg && !templateCreated ? [yarnWorkspace(pkg)] : yarnWorkspaces()\n let failed = false\n\n for (const { location, name } of workspaces) {\n const success = await generateReadmeForWorkspace(location, name, template, defaultBody, typedoc, verbose)\n if (!success) failed = true\n }\n\n return failed ? 1 : 0\n}\n","import chalk from 'chalk'\nimport { cosmiconfig } from 'cosmiconfig'\nimport { TypeScriptLoader } from 'cosmiconfig-typescript-loader'\nimport deepmerge from 'deepmerge'\n\nlet config: Record<string, unknown>\n\nexport const loadConfig = async <T extends object>(params?: T): Promise<T> => {\n if (config === undefined) {\n const cosmicConfigResult = await cosmiconfig('xy', { cache: true, loaders: { '.ts': TypeScriptLoader() } }).search()\n config = cosmicConfigResult?.config\n const configFilePath = cosmicConfigResult?.filepath\n if (configFilePath !== undefined) {\n console.log(chalk.green(`Loaded config from ${configFilePath}`))\n if (config.verbose) {\n console.log(chalk.gray(`${JSON.stringify(config, null, 2)}`))\n }\n }\n }\n return deepmerge(config, params ?? {}) as T\n}\n","import { readFileSync } from 'node:fs'\n\nexport const parsedPackageJSON = (path?: string) => {\n const pathToPackageJSON = path ?? process.env.npm_package_json ?? ''\n const packageJSON = readFileSync(pathToPackageJSON).toString()\n return JSON.parse(packageJSON)\n}\n","import type { SpawnSyncOptionsWithBufferEncoding } from 'node:child_process'\nimport { spawnSync } from 'node:child_process'\nimport { existsSync } from 'node:fs'\n\nimport chalk from 'chalk'\n\nimport { checkResult } from './checkResult.ts'\nimport { safeExit } from './safeExit.ts'\n\nexport type ScriptStep\n = | [/* command */ 'yarn' | 'node' | 'ts-node-script' | 'tsc' | 'npm' | 'vitest', /* arg */ string | string[]]\n | [/* command */ string, /* arg */ string | string[], /* config */ SpawnSyncOptionsWithBufferEncoding]\n\nexport const runSteps = (name: string, steps: ScriptStep[], exitOnFail = true, messages?: string[]): number => {\n return safeExit(() => {\n const pkgName = process.env.npm_package_name\n console.log(chalk.green(`${name} [${pkgName}]`))\n let totalStatus = 0\n for (const [i, [command, args, config]] of steps.entries()) {\n if (messages?.[i]) {\n console.log(chalk.gray(messages?.[i]))\n }\n const argList = Array.isArray(args) ? args : args.split(' ')\n if (command === 'node' && !existsSync(argList[0])) {\n throw new Error(`File not found [${argList[0]}]`)\n }\n const status\n = spawnSync(command, Array.isArray(args) ? args : args.split(' '), {\n ...config,\n encoding: 'utf8',\n env: { FORCE_COLOR: '3', ...process.env },\n shell: true,\n stdio: 'inherit',\n }).status ?? 0\n checkResult(name, status, 'error', exitOnFail)\n totalStatus += status ?? 0\n }\n return totalStatus\n }, !!exitOnFail)\n}\n","import { spawn } from 'node:child_process'\nimport { existsSync } from 'node:fs'\n\nimport chalk from 'chalk'\n\nimport { checkResult } from './checkResult.ts'\nimport type { ScriptStep } from './runSteps.ts'\nimport { safeExitAsync } from './safeExit.ts'\n\nexport const runStepAsync = (name: string, step: ScriptStep, exitOnFail = true, message?: string) => {\n return new Promise<number>((resolve) => {\n const [command, args, config] = step\n if (message) {\n console.log(chalk.gray(message))\n }\n const argList = Array.isArray(args) ? args : args.split(' ')\n if (command === 'node' && !existsSync(argList[0])) {\n throw new Error(`File not found [${argList[0]}]`)\n }\n spawn(command, Array.isArray(args) ? args : args.split(' '), {\n ...config,\n env: { FORCE_COLOR: '3', ...process.env },\n shell: true,\n stdio: 'inherit',\n }).on('close', (code) => {\n if (code) {\n console.error(\n chalk.red(\n `Command Exited With Non-Zero Result [${chalk.gray(code)}] | ${chalk.yellow(command)} ${chalk.white(\n Array.isArray(args) ? args.join(' ') : args,\n )}`,\n ),\n )\n checkResult(name, code, 'error', exitOnFail)\n resolve(code)\n } else {\n resolve(0)\n }\n })\n })\n}\n\nexport const runStepsAsync = async (name: string, steps: ScriptStep[], exitOnFail = true, messages?: string[]) => {\n return await safeExitAsync(async () => {\n const pkgName = process.env.npm_package_name\n console.log(chalk.green(`${name} [${pkgName}]`))\n let result = 0\n for (const [i, step] of steps.entries()) {\n result += await runStepAsync(name, step, exitOnFail, messages?.[i])\n }\n return result\n })\n}\n","import { runSteps } from './runSteps.ts'\n\nexport const runXy = (command: string) => {\n return runSteps(\n `XY [${command}]`,\n [['yarn', ['xy', command, ...process.argv.filter((value, index) => (index > 1 ? value : undefined))]]],\n )\n}\n","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"],"mappings":";AAAA,OAAO,WAAW;AAEX,IAAM,cAAc,CAAC,MAAc,QAAgB,QAA0B,SAAS,aAAa,UAAU;AAClH,MAAI,QAAQ;AACV,UAAM,UAAU,aAAa,sBAAsB;AACnD,UAAM,YAAY,UAAU,UAAU,MAAM,MAAM,MAAM;AACxD,YAAQ,KAAK,EAAE,UAAU,GAAG,IAAI,QAAQ,MAAM,aAAa,OAAO,EAAE,CAAC;AACrE,QAAI,YAAY;AACd,cAAQ,KAAK,MAAM;AAAA,IACrB;AAAA,EACF;AACF;;;ACXA;AAAA,EACE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,IAAI;AAAA,MACd,OAAO;AACL,gBAAQ,CAAC;AAAA,MACX;AAAA,IACF,CAAC;AAAA,EACH,CAAC;AACH;AAEO,IAAM,gBAAgB,OAAO,MAAc,OAAqB,aAAa,MAAM,aAAwB;AAChH,SAAO,MAAM,cAAc,YAAY;AACrC,UAAM,UAAU,QAAQ,IAAI;AAC5B,YAAQ,IAAIA,OAAM,MAAM,GAAG,IAAI,KAAK,OAAO,GAAG,CAAC;AAC/C,QAAI,SAAS;AACb,eAAW,CAAC,GAAG,IAAI,KAAK,MAAM,QAAQ,GAAG;AACvC,gBAAU,MAAM,aAAa,MAAM,MAAM,YAAY,WAAW,CAAC,CAAC;AAAA,IACpE;AACA,WAAO;AAAA,EACT,CAAC;AACH;;;AClDO,IAAM,QAAQ,CAAC,YAAoB;AACxC,SAAO;AAAA,IACL,OAAO,OAAO;AAAA,IACd,CAAC,CAAC,QAAQ,CAAC,MAAM,SAAS,GAAG,QAAQ,KAAK,OAAO,CAAC,OAAO,UAAW,QAAQ,IAAI,QAAQ,MAAU,CAAC,CAAC,CAAC;AAAA,EACvG;AACF;;;ACPA,OAAOE,YAAW;AAEX,IAAM,mBAAmB,CAAC,YAAoB;AACnD,QAAM,gBAAgB,QAAQ,OAAO;AACrC,QAAM,kBAAkB,WAAW,OAAO;AAC1C,UAAQ,KAAKA,OAAM,OAAO,aAAaA,OAAM,MAAM,aAAa,CAAC,sCAAsC,CAAC;AACxG,UAAQ,KAAKA,OAAM,KAAK,iBAAiBA,OAAM,QAAQ,eAAe,CAAC,IAAI,CAAC;AAC5E,SAAO;AACT;","names":["require","readFileSync","readFileSync","chalk","ex","ex","error","chalk","chalk","chalk","readFileSync","readFileSync","existsSync","readFileSync","existsSync","readFileSync","chalk","spawnSync","chalk","execSync","readFileSync","createRequire","PATH","chalk","require","createRequire","packageRoot","PATH","execSync","readFileSync","chalk","chalk","readFileSync","spawnSync","existsSync","chalk","chalk","config","existsSync","spawnSync","existsSync","chalk","config","chalk","existsSync","chalk"]}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/lib/runSteps.ts","../../src/lib/checkResult.ts","../../src/lib/processEx.ts","../../src/lib/withError.ts","../../src/lib/withErrnoException.ts","../../src/lib/safeExit.ts"],"sourcesContent":["import type { SpawnSyncOptionsWithBufferEncoding } from 'node:child_process'\nimport { spawnSync } from 'node:child_process'\nimport { existsSync } from 'node:fs'\n\nimport chalk from 'chalk'\n\nimport { checkResult } from './checkResult.ts'\nimport { safeExit } from './safeExit.ts'\n\nexport type ScriptStep\n = | [/* command */ 'yarn' | 'node' | 'ts-node-script' | 'tsc' | 'jest' | 'npm', /* arg */ string | string[]]\n | [/* command */ string, /* arg */ string | string[], /* config */ SpawnSyncOptionsWithBufferEncoding]\n\nexport const runSteps = (name: string, steps: ScriptStep[], exitOnFail = true, messages?: string[]): number => {\n return safeExit(() => {\n const pkgName = process.env.npm_package_name\n console.log(chalk.green(`${name} [${pkgName}]`))\n let totalStatus = 0\n for (const [i, [command, args, config]] of steps.entries()) {\n if (messages?.[i]) {\n console.log(chalk.gray(messages?.[i]))\n }\n const argList = Array.isArray(args) ? args : args.split(' ')\n if (command === 'node' && !existsSync(argList[0])) {\n throw new Error(`File not found [${argList[0]}]`)\n }\n const status\n = spawnSync(command, Array.isArray(args) ? args : args.split(' '), {\n ...config,\n encoding: 'utf8',\n env: { FORCE_COLOR: '3', ...process.env },\n shell: true,\n stdio: 'inherit',\n }).status ?? 0\n checkResult(name, status, 'error', exitOnFail)\n totalStatus += status ?? 0\n }\n return totalStatus\n }, !!exitOnFail)\n}\n","import chalk from 'chalk'\n\nexport const checkResult = (name: string, result: number, level: 'error' | 'warn' = 'error', exitOnFail = false) => {\n if (result) {\n const exiting = exitOnFail ? '[Exiting Process]' : '[Continuing]'\n const chalkFunc = level === 'error' ? chalk.red : chalk.yellow\n console[level](chalkFunc(`${name} had ${result} failures ${exiting}`))\n if (exitOnFail) {\n process.exit(result)\n }\n }\n}\n","import chalk from 'chalk'\n\nimport { withErrnoException } from './withErrnoException.ts'\nimport { withError } from './withError.ts'\n\nexport const processEx = (ex: unknown) => {\n const error = typeof ex === 'string' ? new Error(ex) : ex\n const exitCode\n = withErrnoException(error, (error) => {\n if (error.code === 'ENOENT') {\n console.error(chalk.red(`'${error.path}' not found.`))\n } else {\n console.error(chalk.red(`Errno: ${error.code}`))\n }\n return error.errno ?? -1\n })\n ?? withError(error, (error) => {\n console.error(chalk.red(`${error.name}: ${error.message}`))\n return -1\n })\n ?? (() => {\n console.error(chalk.red(`Unexpected Error: ${JSON.stringify(ex, null, 2)}`))\n return -1\n })()\n // This allows us to use a previously set exit code\n process.exit(process.exitCode ?? exitCode)\n}\n","export const withError = <T extends Error = Error>(\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n ex: any,\n closure: (error: T) => number,\n predicate = (ex: T) => (!!ex.name && !!ex.message),\n) => {\n return predicate(ex as T) ? closure(ex as T) : undefined\n}\n","import { withError } from './withError.ts'\n\nexport const withErrnoException = <T extends NodeJS.ErrnoException = NodeJS.ErrnoException>(\n ex: unknown, closure: (error: T) => number,\n) => {\n return withError<T>(ex, closure, (ex: unknown) => (ex as NodeJS.ErrnoException).errno !== undefined)\n}\n","/** Catch child process a crash and returns the code */\n\nimport { processEx } from './processEx.ts'\n\nconst safeExit = (func: () => number, exitOnFail = true): number => {\n try {\n const result = func()\n if (result && exitOnFail) {\n process.exit(result)\n }\n return result\n } catch (ex) {\n return processEx(ex)\n }\n}\n\nconst safeExitAsync = async (func: () => Promise<number>, exitOnFail = true): Promise<number> => {\n try {\n const result = await func()\n if (result && exitOnFail) {\n process.exit(result)\n }\n return result\n } catch (ex) {\n return processEx(ex)\n }\n}\n\nexport { safeExit, safeExitAsync }\n"],"mappings":";AACA,SAAS,iBAAiB;AAC1B,SAAS,kBAAkB;AAE3B,OAAOA,YAAW;;;ACJlB,OAAO,WAAW;AAEX,IAAM,cAAc,CAAC,MAAc,QAAgB,QAA0B,SAAS,aAAa,UAAU;AAClH,MAAI,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../../src/lib/processEx.ts","../../src/lib/withError.ts","../../src/lib/withErrnoException.ts","../../src/lib/safeExit.ts"],"sourcesContent":["import type { SpawnSyncOptionsWithBufferEncoding } from 'node:child_process'\nimport { spawnSync } from 'node:child_process'\nimport { existsSync } from 'node:fs'\n\nimport chalk from 'chalk'\n\nimport { checkResult } from './checkResult.ts'\nimport { safeExit } from './safeExit.ts'\n\nexport type ScriptStep\n = | [/* command */ 'yarn' | 'node' | 'ts-node-script' | 'tsc' | 'npm' | 'vitest', /* arg */ string | string[]]\n | [/* command */ string, /* arg */ string | string[], /* config */ SpawnSyncOptionsWithBufferEncoding]\n\nexport const runSteps = (name: string, steps: ScriptStep[], exitOnFail = true, messages?: string[]): number => {\n return safeExit(() => {\n const pkgName = process.env.npm_package_name\n console.log(chalk.green(`${name} [${pkgName}]`))\n let totalStatus = 0\n for (const [i, [command, args, config]] of steps.entries()) {\n if (messages?.[i]) {\n console.log(chalk.gray(messages?.[i]))\n }\n const argList = Array.isArray(args) ? args : args.split(' ')\n if (command === 'node' && !existsSync(argList[0])) {\n throw new Error(`File not found [${argList[0]}]`)\n }\n const status\n = spawnSync(command, Array.isArray(args) ? args : args.split(' '), {\n ...config,\n encoding: 'utf8',\n env: { FORCE_COLOR: '3', ...process.env },\n shell: true,\n stdio: 'inherit',\n }).status ?? 0\n checkResult(name, status, 'error', exitOnFail)\n totalStatus += status ?? 0\n }\n return totalStatus\n }, !!exitOnFail)\n}\n","import chalk from 'chalk'\n\nexport const checkResult = (name: string, result: number, level: 'error' | 'warn' = 'error', exitOnFail = false) => {\n if (result) {\n const exiting = exitOnFail ? '[Exiting Process]' : '[Continuing]'\n const chalkFunc = level === 'error' ? chalk.red : chalk.yellow\n console[level](chalkFunc(`${name} had ${result} failures ${exiting}`))\n if (exitOnFail) {\n process.exit(result)\n }\n }\n}\n","import chalk from 'chalk'\n\nimport { withErrnoException } from './withErrnoException.ts'\nimport { withError } from './withError.ts'\n\nexport const processEx = (ex: unknown) => {\n const error = typeof ex === 'string' ? new Error(ex) : ex\n const exitCode\n = withErrnoException(error, (error) => {\n if (error.code === 'ENOENT') {\n console.error(chalk.red(`'${error.path}' not found.`))\n } else {\n console.error(chalk.red(`Errno: ${error.code}`))\n }\n return error.errno ?? -1\n })\n ?? withError(error, (error) => {\n console.error(chalk.red(`${error.name}: ${error.message}`))\n return -1\n })\n ?? (() => {\n console.error(chalk.red(`Unexpected Error: ${JSON.stringify(ex, null, 2)}`))\n return -1\n })()\n // This allows us to use a previously set exit code\n process.exit(process.exitCode ?? exitCode)\n}\n","export const withError = <T extends Error = Error>(\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n ex: any,\n closure: (error: T) => number,\n predicate = (ex: T) => (!!ex.name && !!ex.message),\n) => {\n return predicate(ex as T) ? closure(ex as T) : undefined\n}\n","import { withError } from './withError.ts'\n\nexport const withErrnoException = <T extends NodeJS.ErrnoException = NodeJS.ErrnoException>(\n ex: unknown, closure: (error: T) => number,\n) => {\n return withError<T>(ex, closure, (ex: unknown) => (ex as NodeJS.ErrnoException).errno !== undefined)\n}\n","/** Catch child process a crash and returns the code */\n\nimport { processEx } from './processEx.ts'\n\nconst safeExit = (func: () => number, exitOnFail = true): number => {\n try {\n const result = func()\n if (result && exitOnFail) {\n process.exit(result)\n }\n return result\n } catch (ex) {\n return processEx(ex)\n }\n}\n\nconst safeExitAsync = async (func: () => Promise<number>, exitOnFail = true): Promise<number> => {\n try {\n const result = await func()\n if (result && exitOnFail) {\n process.exit(result)\n }\n return result\n } catch (ex) {\n return processEx(ex)\n }\n}\n\nexport { safeExit, safeExitAsync }\n"],"mappings":";AACA,SAAS,iBAAiB;AAC1B,SAAS,kBAAkB;AAE3B,OAAOA,YAAW;;;ACJlB,OAAO,WAAW;AAEX,IAAM,cAAc,CAAC,MAAc,QAAgB,QAA0B,SAAS,aAAa,UAAU;AAClH,MAAI,QAAQ;AACV,UAAM,UAAU,aAAa,sBAAsB;AACnD,UAAM,YAAY,UAAU,UAAU,MAAM,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,UAAU,YAAY;AACxB,cAAQ,KAAK,MAAM;AAAA,IACrB;AACA,WAAO;AAAA,EACT,SAAS,IAAI;AACX,WAAO,UAAU,EAAE;AAAA,EACrB;AACF;;;ALDO,IAAM,WAAW,CAAC,MAAc,OAAqB,aAAa,MAAM,aAAgC;AAC7G,SAAO,SAAS,MAAM;AACpB,UAAM,UAAU,QAAQ,IAAI;AAC5B,YAAQ,IAAIC,OAAM,MAAM,GAAG,IAAI,KAAK,OAAO,GAAG,CAAC;AAC/C,QAAI,cAAc;AAClB,eAAW,CAAC,GAAG,CAAC,SAAS,MAAM,MAAM,CAAC,KAAK,MAAM,QAAQ,GAAG;AAC1D,UAAI,WAAW,CAAC,GAAG;AACjB,gBAAQ,IAAIA,OAAM,KAAK,WAAW,CAAC,CAAC,CAAC;AAAA,MACvC;AACA,YAAM,UAAU,MAAM,QAAQ,IAAI,IAAI,OAAO,KAAK,MAAM,GAAG;AAC3D,UAAI,YAAY,UAAU,CAAC,WAAW,QAAQ,CAAC,CAAC,GAAG;AACjD,cAAM,IAAI,MAAM,mBAAmB,QAAQ,CAAC,CAAC,GAAG;AAAA,MAClD;AACA,YAAM,SACF,UAAU,SAAS,MAAM,QAAQ,IAAI,IAAI,OAAO,KAAK,MAAM,GAAG,GAAG;AAAA,QACjE,GAAG;AAAA,QACH,UAAU;AAAA,QACV,KAAK,EAAE,aAAa,KAAK,GAAG,QAAQ,IAAI;AAAA,QACxC,OAAO;AAAA,QACP,OAAO;AAAA,MACT,CAAC,EAAE,UAAU;AACf,kBAAY,MAAM,QAAQ,SAAS,UAAU;AAC7C,qBAAe,UAAU;AAAA,IAC3B;AACA,WAAO;AAAA,EACT,GAAG,CAAC,CAAC,UAAU;AACjB;","names":["chalk","chalk","ex","ex","error","chalk","chalk"]}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/lib/runSteps.ts","../../src/lib/checkResult.ts","../../src/lib/processEx.ts","../../src/lib/withError.ts","../../src/lib/withErrnoException.ts","../../src/lib/safeExit.ts","../../src/lib/runXy.ts"],"sourcesContent":["import type { SpawnSyncOptionsWithBufferEncoding } from 'node:child_process'\nimport { spawnSync } from 'node:child_process'\nimport { existsSync } from 'node:fs'\n\nimport chalk from 'chalk'\n\nimport { checkResult } from './checkResult.ts'\nimport { safeExit } from './safeExit.ts'\n\nexport type ScriptStep\n = | [/* command */ 'yarn' | 'node' | 'ts-node-script' | 'tsc' | 'jest' | 'npm', /* arg */ string | string[]]\n | [/* command */ string, /* arg */ string | string[], /* config */ SpawnSyncOptionsWithBufferEncoding]\n\nexport const runSteps = (name: string, steps: ScriptStep[], exitOnFail = true, messages?: string[]): number => {\n return safeExit(() => {\n const pkgName = process.env.npm_package_name\n console.log(chalk.green(`${name} [${pkgName}]`))\n let totalStatus = 0\n for (const [i, [command, args, config]] of steps.entries()) {\n if (messages?.[i]) {\n console.log(chalk.gray(messages?.[i]))\n }\n const argList = Array.isArray(args) ? args : args.split(' ')\n if (command === 'node' && !existsSync(argList[0])) {\n throw new Error(`File not found [${argList[0]}]`)\n }\n const status\n = spawnSync(command, Array.isArray(args) ? args : args.split(' '), {\n ...config,\n encoding: 'utf8',\n env: { FORCE_COLOR: '3', ...process.env },\n shell: true,\n stdio: 'inherit',\n }).status ?? 0\n checkResult(name, status, 'error', exitOnFail)\n totalStatus += status ?? 0\n }\n return totalStatus\n }, !!exitOnFail)\n}\n","import chalk from 'chalk'\n\nexport const checkResult = (name: string, result: number, level: 'error' | 'warn' = 'error', exitOnFail = false) => {\n if (result) {\n const exiting = exitOnFail ? '[Exiting Process]' : '[Continuing]'\n const chalkFunc = level === 'error' ? chalk.red : chalk.yellow\n console[level](chalkFunc(`${name} had ${result} failures ${exiting}`))\n if (exitOnFail) {\n process.exit(result)\n }\n }\n}\n","import chalk from 'chalk'\n\nimport { withErrnoException } from './withErrnoException.ts'\nimport { withError } from './withError.ts'\n\nexport const processEx = (ex: unknown) => {\n const error = typeof ex === 'string' ? new Error(ex) : ex\n const exitCode\n = withErrnoException(error, (error) => {\n if (error.code === 'ENOENT') {\n console.error(chalk.red(`'${error.path}' not found.`))\n } else {\n console.error(chalk.red(`Errno: ${error.code}`))\n }\n return error.errno ?? -1\n })\n ?? withError(error, (error) => {\n console.error(chalk.red(`${error.name}: ${error.message}`))\n return -1\n })\n ?? (() => {\n console.error(chalk.red(`Unexpected Error: ${JSON.stringify(ex, null, 2)}`))\n return -1\n })()\n // This allows us to use a previously set exit code\n process.exit(process.exitCode ?? exitCode)\n}\n","export const withError = <T extends Error = Error>(\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n ex: any,\n closure: (error: T) => number,\n predicate = (ex: T) => (!!ex.name && !!ex.message),\n) => {\n return predicate(ex as T) ? closure(ex as T) : undefined\n}\n","import { withError } from './withError.ts'\n\nexport const withErrnoException = <T extends NodeJS.ErrnoException = NodeJS.ErrnoException>(\n ex: unknown, closure: (error: T) => number,\n) => {\n return withError<T>(ex, closure, (ex: unknown) => (ex as NodeJS.ErrnoException).errno !== undefined)\n}\n","/** Catch child process a crash and returns the code */\n\nimport { processEx } from './processEx.ts'\n\nconst safeExit = (func: () => number, exitOnFail = true): number => {\n try {\n const result = func()\n if (result && exitOnFail) {\n process.exit(result)\n }\n return result\n } catch (ex) {\n return processEx(ex)\n }\n}\n\nconst safeExitAsync = async (func: () => Promise<number>, exitOnFail = true): Promise<number> => {\n try {\n const result = await func()\n if (result && exitOnFail) {\n process.exit(result)\n }\n return result\n } catch (ex) {\n return processEx(ex)\n }\n}\n\nexport { safeExit, safeExitAsync }\n","import { runSteps } from './runSteps.ts'\n\nexport const runXy = (command: string) => {\n return runSteps(\n `XY [${command}]`,\n [['yarn', ['xy', command, ...process.argv.filter((value, index) => (index > 1 ? value : undefined))]]],\n )\n}\n"],"mappings":";AACA,SAAS,iBAAiB;AAC1B,SAAS,kBAAkB;AAE3B,OAAOA,YAAW;;;ACJlB,OAAO,WAAW;AAEX,IAAM,cAAc,CAAC,MAAc,QAAgB,QAA0B,SAAS,aAAa,UAAU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ACd,CAAC,CAAC,QAAQ,CAAC,MAAM,SAAS,GAAG,QAAQ,KAAK,OAAO,CAAC,OAAO,UAAW,QAAQ,IAAI,QAAQ,MAAU,CAAC,CAAC,CAAC;AAAA,EACvG;AACF;","names":["chalk","chalk","ex","ex","error","chalk","chalk"]}
1
+ {"version":3,"sources":["../../src/lib/runSteps.ts","../../src/lib/checkResult.ts","../../src/lib/processEx.ts","../../src/lib/withError.ts","../../src/lib/withErrnoException.ts","../../src/lib/safeExit.ts","../../src/lib/runXy.ts"],"sourcesContent":["import type { SpawnSyncOptionsWithBufferEncoding } from 'node:child_process'\nimport { spawnSync } from 'node:child_process'\nimport { existsSync } from 'node:fs'\n\nimport chalk from 'chalk'\n\nimport { checkResult } from './checkResult.ts'\nimport { safeExit } from './safeExit.ts'\n\nexport type ScriptStep\n = | [/* command */ 'yarn' | 'node' | 'ts-node-script' | 'tsc' | 'npm' | 'vitest', /* arg */ string | string[]]\n | [/* command */ string, /* arg */ string | string[], /* config */ SpawnSyncOptionsWithBufferEncoding]\n\nexport const runSteps = (name: string, steps: ScriptStep[], exitOnFail = true, messages?: string[]): number => {\n return safeExit(() => {\n const pkgName = process.env.npm_package_name\n console.log(chalk.green(`${name} [${pkgName}]`))\n let totalStatus = 0\n for (const [i, [command, args, config]] of steps.entries()) {\n if (messages?.[i]) {\n console.log(chalk.gray(messages?.[i]))\n }\n const argList = Array.isArray(args) ? args : args.split(' ')\n if (command === 'node' && !existsSync(argList[0])) {\n throw new Error(`File not found [${argList[0]}]`)\n }\n const status\n = spawnSync(command, Array.isArray(args) ? args : args.split(' '), {\n ...config,\n encoding: 'utf8',\n env: { FORCE_COLOR: '3', ...process.env },\n shell: true,\n stdio: 'inherit',\n }).status ?? 0\n checkResult(name, status, 'error', exitOnFail)\n totalStatus += status ?? 0\n }\n return totalStatus\n }, !!exitOnFail)\n}\n","import chalk from 'chalk'\n\nexport const checkResult = (name: string, result: number, level: 'error' | 'warn' = 'error', exitOnFail = false) => {\n if (result) {\n const exiting = exitOnFail ? '[Exiting Process]' : '[Continuing]'\n const chalkFunc = level === 'error' ? chalk.red : chalk.yellow\n console[level](chalkFunc(`${name} had ${result} failures ${exiting}`))\n if (exitOnFail) {\n process.exit(result)\n }\n }\n}\n","import chalk from 'chalk'\n\nimport { withErrnoException } from './withErrnoException.ts'\nimport { withError } from './withError.ts'\n\nexport const processEx = (ex: unknown) => {\n const error = typeof ex === 'string' ? new Error(ex) : ex\n const exitCode\n = withErrnoException(error, (error) => {\n if (error.code === 'ENOENT') {\n console.error(chalk.red(`'${error.path}' not found.`))\n } else {\n console.error(chalk.red(`Errno: ${error.code}`))\n }\n return error.errno ?? -1\n })\n ?? withError(error, (error) => {\n console.error(chalk.red(`${error.name}: ${error.message}`))\n return -1\n })\n ?? (() => {\n console.error(chalk.red(`Unexpected Error: ${JSON.stringify(ex, null, 2)}`))\n return -1\n })()\n // This allows us to use a previously set exit code\n process.exit(process.exitCode ?? exitCode)\n}\n","export const withError = <T extends Error = Error>(\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n ex: any,\n closure: (error: T) => number,\n predicate = (ex: T) => (!!ex.name && !!ex.message),\n) => {\n return predicate(ex as T) ? closure(ex as T) : undefined\n}\n","import { withError } from './withError.ts'\n\nexport const withErrnoException = <T extends NodeJS.ErrnoException = NodeJS.ErrnoException>(\n ex: unknown, closure: (error: T) => number,\n) => {\n return withError<T>(ex, closure, (ex: unknown) => (ex as NodeJS.ErrnoException).errno !== undefined)\n}\n","/** Catch child process a crash and returns the code */\n\nimport { processEx } from './processEx.ts'\n\nconst safeExit = (func: () => number, exitOnFail = true): number => {\n try {\n const result = func()\n if (result && exitOnFail) {\n process.exit(result)\n }\n return result\n } catch (ex) {\n return processEx(ex)\n }\n}\n\nconst safeExitAsync = async (func: () => Promise<number>, exitOnFail = true): Promise<number> => {\n try {\n const result = await func()\n if (result && exitOnFail) {\n process.exit(result)\n }\n return result\n } catch (ex) {\n return processEx(ex)\n }\n}\n\nexport { safeExit, safeExitAsync }\n","import { runSteps } from './runSteps.ts'\n\nexport const runXy = (command: string) => {\n return runSteps(\n `XY [${command}]`,\n [['yarn', ['xy', command, ...process.argv.filter((value, index) => (index > 1 ? value : undefined))]]],\n )\n}\n"],"mappings":";AACA,SAAS,iBAAiB;AAC1B,SAAS,kBAAkB;AAE3B,OAAOA,YAAW;;;ACJlB,OAAO,WAAW;AAEX,IAAM,cAAc,CAAC,MAAc,QAAgB,QAA0B,SAAS,aAAa,UAAU;AAClH,MAAI,QAAQ;AACV,UAAM,UAAU,aAAa,sBAAsB;AACnD,UAAM,YAAY,UAAU,UAAU,MAAM,MAAM,MAAM;AACxD,YAAQ,KAAK,EAAE,UAAU,GAAG,IAAI,QAAQ,MAAM,aAAa,OAAO,EAAE,CAAC;AACrE,QAAI,YAAY;AACd,cAAQ,KAAK,MAAM;AAAA,IACrB;AAAA,EACF;AACF;;;ACXA,OAAOC,YAAW;;;ACAX,IAAM,YAAY,CAEvB,IACA,SACA,YAAY,CAACC,QAAW,CAAC,CAACA,IAAG,QAAQ,CAAC,CAACA,IAAG,YACvC;AACH,SAAO,UAAU,EAAO,IAAI,QAAQ,EAAO,IAAI;AACjD;;;ACLO,IAAM,qBAAqB,CAChC,IAAa,YACV;AACH,SAAO,UAAa,IAAI,SAAS,CAACC,QAAiBA,IAA6B,UAAU,MAAS;AACrG;;;AFDO,IAAM,YAAY,CAAC,OAAgB;AACxC,QAAM,QAAQ,OAAO,OAAO,WAAW,IAAI,MAAM,EAAE,IAAI;AACvD,QAAM,WACF,mBAAmB,OAAO,CAACC,WAAU;AACrC,QAAIA,OAAM,SAAS,UAAU;AAC3B,cAAQ,MAAMC,OAAM,IAAI,IAAID,OAAM,IAAI,cAAc,CAAC;AAAA,IACvD,OAAO;AACL,cAAQ,MAAMC,OAAM,IAAI,UAAUD,OAAM,IAAI,EAAE,CAAC;AAAA,IACjD;AACA,WAAOA,OAAM,SAAS;AAAA,EACxB,CAAC,KACE,UAAU,OAAO,CAACA,WA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AE,aAAa,KAAK,GAAG,QAAQ,IAAI;AAAA,QACxC,OAAO;AAAA,QACP,OAAO;AAAA,MACT,CAAC,EAAE,UAAU;AACf,kBAAY,MAAM,QAAQ,SAAS,UAAU;AAC7C,qBAAe,UAAU;AAAA,IAC3B;AACA,WAAO;AAAA,EACT,GAAG,CAAC,CAAC,UAAU;AACjB;;;AMrCO,IAAM,QAAQ,CAAC,YAAoB;AACxC,SAAO;AAAA,IACL,OAAO,OAAO;AAAA,IACd,CAAC,CAAC,QAAQ,CAAC,MAAM,SAAS,GAAG,QAAQ,KAAK,OAAO,CAAC,OAAO,UAAW,QAAQ,IAAI,QAAQ,MAAU,CAAC,CAAC,CAAC;AAAA,EACvG;AACF;","names":["chalk","chalk","ex","ex","error","chalk","chalk"]}
@@ -386,104 +386,117 @@ var recompileAll = async ({
386
386
  return result;
387
387
  };
388
388
 
389
- // src/xy/xyBuildCommands.ts
390
- var xyBuildCommands = (args) => {
391
- return args.command(
392
- "build [package]",
393
- "Build - Compile & Lint",
394
- (yargs) => {
395
- return yargs.positional("package", { describe: "Specific package to build" });
396
- },
397
- async (argv) => {
398
- if (argv.verbose) {
399
- console.log(`Building: ${argv.package ?? "all"}`);
400
- }
401
- process.exitCode = await build({
402
- incremental: !!argv.incremental,
403
- jobs: argv.jobs,
404
- pkg: argv.package,
405
- target: argv.target,
406
- verbose: !!argv.verbose
407
- });
408
- }
409
- ).command(
410
- "compile [package]",
411
- "Compile with Typescript & Copy Images",
412
- (yargs) => {
413
- return yargs.positional("package", { describe: "Specific package to compile" });
414
- },
415
- (argv) => {
416
- if (argv.verbose) {
417
- console.log(`Compiling: ${argv.package ?? "all"}`);
418
- }
419
- process.exitCode = compile({
420
- incremental: !!argv.incremental,
421
- jobs: argv.jobs,
422
- pkg: argv.package,
423
- target: argv.target,
424
- verbose: !!argv.verbose
425
- });
426
- }
427
- ).command(
428
- "compile-only [package]",
429
- "Compile with Typescript & Copy Images (No Publint)",
430
- (yargs) => {
431
- return yargs.positional("package", { describe: "Specific package to compile" });
432
- },
433
- (argv) => {
434
- if (argv.verbose) {
435
- console.log(`Compiling: ${argv.package ?? "all"}`);
436
- }
437
- process.exitCode = compile({
438
- incremental: !!argv.incremental,
439
- jobs: argv.jobs,
440
- pkg: argv.package,
441
- publint: false,
442
- target: argv.target,
443
- verbose: !!argv.verbose
444
- });
389
+ // src/xy/param.ts
390
+ var packagePositionalParam = (yargs) => {
391
+ return yargs.positional("package", { describe: "Specific package to target", type: "string" });
392
+ };
393
+
394
+ // src/xy/build-commands/build.ts
395
+ var buildCommand = {
396
+ builder: (yargs) => {
397
+ return packagePositionalParam(yargs);
398
+ },
399
+ command: "build [package]",
400
+ describe: "Build - Compile & Lint",
401
+ handler: async (argv) => {
402
+ if (argv.verbose) {
403
+ console.log(`Building: ${argv.package ?? "all"}`);
445
404
  }
446
- ).command(
447
- "recompile [package]",
448
- "Re-compile with Typescript & Copy Images",
449
- (yargs) => {
450
- return yargs.positional("package", { describe: "Specific package to re-compile" });
451
- },
452
- async (argv) => {
453
- if (argv.verbose) {
454
- console.log(`Re-compiling: ${argv.package ?? "all"}`);
455
- }
456
- process.exitCode = await recompile({
457
- incremental: !!argv.incremental,
458
- jobs: argv.jobs,
459
- pkg: argv.package,
460
- target: argv.target,
461
- verbose: !!argv.verbose
462
- });
405
+ process.exitCode = await build({
406
+ incremental: !!argv.incremental,
407
+ jobs: argv.jobs,
408
+ pkg: argv.package,
409
+ target: argv.target,
410
+ verbose: !!argv.verbose
411
+ });
412
+ }
413
+ };
414
+ var compileCommand = {
415
+ builder: (yargs) => {
416
+ return packagePositionalParam(yargs);
417
+ },
418
+ command: "compile [package]",
419
+ describe: "Compile with Typescript & Copy Images",
420
+ handler: (argv) => {
421
+ if (argv.verbose) {
422
+ console.log(`Compiling: ${argv.package ?? "all"}`);
463
423
  }
464
- ).command(
465
- "rebuild [package]",
466
- "Rebuild - Clean, Compile & Lint",
467
- (yargs) => {
468
- return yargs.positional("package", { describe: "Specific package to rebuild" });
469
- },
470
- (argv) => {
471
- if (argv.verbose) console.log(`Rebuilding: ${argv.package ?? "all"}`);
472
- process.exitCode = rebuild({ target: argv.target });
424
+ process.exitCode = compile({
425
+ incremental: !!argv.incremental,
426
+ jobs: argv.jobs,
427
+ pkg: argv.package,
428
+ target: argv.target,
429
+ verbose: !!argv.verbose
430
+ });
431
+ }
432
+ };
433
+ var compileOnlyCommand = {
434
+ builder: (yargs) => {
435
+ return packagePositionalParam(yargs);
436
+ },
437
+ command: "compile-only [package]",
438
+ describe: "Compile with Typescript & Copy Images (No Publint)",
439
+ handler: (argv) => {
440
+ if (argv.verbose) {
441
+ console.log(`Compiling: ${argv.package ?? "all"}`);
473
442
  }
474
- ).command(
475
- "copy-assets [package]",
476
- "Copy Assets - Copy the assets from src to dist",
477
- (yargs) => {
478
- return yargs.positional("package", { describe: "Specific package to copy assets" });
479
- },
480
- async (argv) => {
481
- if (argv.verbose) console.log(`Copying Assets: ${argv.package ?? "all"}`);
482
- process.exitCode = await copyAssets({ target: argv.target });
443
+ process.exitCode = compile({
444
+ incremental: !!argv.incremental,
445
+ jobs: argv.jobs,
446
+ pkg: argv.package,
447
+ publint: false,
448
+ target: argv.target,
449
+ verbose: !!argv.verbose
450
+ });
451
+ }
452
+ };
453
+ var recompileCommand = {
454
+ builder: (yargs) => {
455
+ return packagePositionalParam(yargs);
456
+ },
457
+ command: "recompile [package]",
458
+ describe: "Re-compile with Typescript & Copy Images",
459
+ handler: async (argv) => {
460
+ if (argv.verbose) {
461
+ console.log(`Re-compiling: ${argv.package ?? "all"}`);
483
462
  }
484
- );
463
+ process.exitCode = await recompile({
464
+ incremental: !!argv.incremental,
465
+ jobs: argv.jobs,
466
+ pkg: argv.package,
467
+ target: argv.target,
468
+ verbose: !!argv.verbose
469
+ });
470
+ }
471
+ };
472
+ var rebuildCommand = {
473
+ builder: (yargs) => {
474
+ return packagePositionalParam(yargs);
475
+ },
476
+ command: "rebuild [package]",
477
+ describe: "Rebuild - Clean, Compile & Lint",
478
+ handler: (argv) => {
479
+ if (argv.verbose) console.log(`Rebuilding: ${argv.package ?? "all"}`);
480
+ process.exitCode = rebuild({ target: argv.target });
481
+ }
482
+ };
483
+ var copyAssetsCommand = {
484
+ builder: (yargs) => {
485
+ return packagePositionalParam(yargs);
486
+ },
487
+ command: "copy-assets [package]",
488
+ describe: "Copy Assets - Copy the assets from src to dist",
489
+ handler: async (argv) => {
490
+ if (argv.verbose) console.log(`Copying Assets: ${argv.package ?? "all"}`);
491
+ process.exitCode = await copyAssets({ target: argv.target });
492
+ }
485
493
  };
486
494
  export {
487
- xyBuildCommands
495
+ buildCommand,
496
+ compileCommand,
497
+ compileOnlyCommand,
498
+ copyAssetsCommand,
499
+ rebuildCommand,
500
+ recompileCommand
488
501
  };
489
- //# sourceMappingURL=xyBuildCommands.mjs.map
502
+ //# sourceMappingURL=build.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/actions/build.ts","../../../src/lib/checkResult.ts","../../../src/lib/processEx.ts","../../../src/lib/withError.ts","../../../src/lib/withErrnoException.ts","../../../src/lib/safeExit.ts","../../../src/lib/yarn/workspace/yarnWorkspaces.ts","../../../src/lib/runSteps.ts","../../../src/lib/runStepsAsync.ts","../../../src/actions/compile.ts","../../../src/actions/copy-assets.ts","../../../src/actions/rebuild.ts","../../../src/actions/recompile.ts","../../../src/xy/param.ts","../../../src/xy/build-commands/build.ts"],"sourcesContent":["import chalk from 'chalk'\n\nimport { runStepsAsync } from '../lib/index.ts'\n\nexport interface BuildParams {\n incremental?: boolean\n jobs?: number\n pkg?: string\n target?: 'esm' | 'cjs'\n verbose?: boolean\n}\n\nexport const build = async ({\n incremental, jobs, target, verbose, pkg,\n}: BuildParams) => {\n const start = Date.now()\n const pkgOptions = (pkg === undefined) ? [] : [pkg] // must go first\n const incrementalOptions = incremental ? ['-i'] : []\n const verboseOptions = verbose ? ['-v'] : []\n const targetOptions = (target === undefined) ? [] : ['-t', target]\n const jobsOptions = (jobs === undefined) ? [] : ['-j', `${jobs}`]\n if (jobs !== undefined) {\n console.log(chalk.blue(`Jobs set to [${jobs}]`))\n }\n\n const result = await runStepsAsync(`Build${incremental ? '-Incremental' : ''} [${pkg ?? 'All'}]`, [\n ['yarn', ['xy', 'compile', ...pkgOptions, ...targetOptions, ...verboseOptions, ...jobsOptions, ...incrementalOptions, '--types', 'tsup']],\n ['yarn', ['xy', 'publint', ...pkgOptions, ...verboseOptions, ...jobsOptions, ...incrementalOptions]],\n ['yarn', ['xy', 'deplint', ...pkgOptions, ...verboseOptions, ...jobsOptions, ...incrementalOptions]],\n ['yarn', ['xy', 'lint', ...pkgOptions, ...verboseOptions, ...incrementalOptions]],\n ])\n console.log(`${chalk.gray('Built in')} [${chalk.magenta(((Date.now() - start) / 1000).toFixed(2))}] ${chalk.gray('seconds')}`)\n return result\n}\n","import chalk from 'chalk'\n\nexport const checkResult = (name: string, result: number, level: 'error' | 'warn' = 'error', exitOnFail = false) => {\n if (result) {\n const exiting = exitOnFail ? '[Exiting Process]' : '[Continuing]'\n const chalkFunc = level === 'error' ? chalk.red : chalk.yellow\n console[level](chalkFunc(`${name} had ${result} failures ${exiting}`))\n if (exitOnFail) {\n process.exit(result)\n }\n }\n}\n","import chalk from 'chalk'\n\nimport { withErrnoException } from './withErrnoException.ts'\nimport { withError } from './withError.ts'\n\nexport const processEx = (ex: unknown) => {\n const error = typeof ex === 'string' ? new Error(ex) : ex\n const exitCode\n = withErrnoException(error, (error) => {\n if (error.code === 'ENOENT') {\n console.error(chalk.red(`'${error.path}' not found.`))\n } else {\n console.error(chalk.red(`Errno: ${error.code}`))\n }\n return error.errno ?? -1\n })\n ?? withError(error, (error) => {\n console.error(chalk.red(`${error.name}: ${error.message}`))\n return -1\n })\n ?? (() => {\n console.error(chalk.red(`Unexpected Error: ${JSON.stringify(ex, null, 2)}`))\n return -1\n })()\n // This allows us to use a previously set exit code\n process.exit(process.exitCode ?? exitCode)\n}\n","export const withError = <T extends Error = Error>(\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n ex: any,\n closure: (error: T) => number,\n predicate = (ex: T) => (!!ex.name && !!ex.message),\n) => {\n return predicate(ex as T) ? closure(ex as T) : undefined\n}\n","import { withError } from './withError.ts'\n\nexport const withErrnoException = <T extends NodeJS.ErrnoException = NodeJS.ErrnoException>(\n ex: unknown, closure: (error: T) => number,\n) => {\n return withError<T>(ex, closure, (ex: unknown) => (ex as NodeJS.ErrnoException).errno !== undefined)\n}\n","/** Catch child process a crash and returns the code */\n\nimport { processEx } from './processEx.ts'\n\nconst safeExit = (func: () => number, exitOnFail = true): number => {\n try {\n const result = func()\n if (result && exitOnFail) {\n process.exit(result)\n }\n return result\n } catch (ex) {\n return processEx(ex)\n }\n}\n\nconst safeExitAsync = async (func: () => Promise<number>, exitOnFail = true): Promise<number> => {\n try {\n const result = await func()\n if (result && exitOnFail) {\n process.exit(result)\n }\n return result\n } catch (ex) {\n return processEx(ex)\n }\n}\n\nexport { safeExit, safeExitAsync }\n","import { spawnSync } from 'node:child_process'\n\nimport type { Workspace } from './Workspace.ts'\n\nexport const yarnWorkspaces = (): Workspace[] => {\n const result = spawnSync('yarn', ['workspaces', 'list', '--json', '--recursive'], { encoding: 'utf8', shell: true })\n if (result.error) {\n throw result.error\n }\n return (\n result.stdout\n .toString()\n // NOTE: This probably doesn't work on Windows\n // TODO: Replace /r/n with /n first\n .split('\\n')\n .slice(0, -1)\n .map((item) => {\n return JSON.parse(item)\n })\n )\n}\n","import type { SpawnSyncOptionsWithBufferEncoding } from 'node:child_process'\nimport { spawnSync } from 'node:child_process'\nimport { existsSync } from 'node:fs'\n\nimport chalk from 'chalk'\n\nimport { checkResult } from './checkResult.ts'\nimport { safeExit } from './safeExit.ts'\n\nexport type ScriptStep\n = | [/* command */ 'yarn' | 'node' | 'ts-node-script' | 'tsc' | 'npm' | 'vitest', /* arg */ string | string[]]\n | [/* command */ string, /* arg */ string | string[], /* config */ SpawnSyncOptionsWithBufferEncoding]\n\nexport const runSteps = (name: string, steps: ScriptStep[], exitOnFail = true, messages?: string[]): number => {\n return safeExit(() => {\n const pkgName = process.env.npm_package_name\n console.log(chalk.green(`${name} [${pkgName}]`))\n let totalStatus = 0\n for (const [i, [command, args, config]] of steps.entries()) {\n if (messages?.[i]) {\n console.log(chalk.gray(messages?.[i]))\n }\n const argList = Array.isArray(args) ? args : args.split(' ')\n if (command === 'node' && !existsSync(argList[0])) {\n throw new Error(`File not found [${argList[0]}]`)\n }\n const status\n = spawnSync(command, Array.isArray(args) ? args : args.split(' '), {\n ...config,\n encoding: 'utf8',\n env: { FORCE_COLOR: '3', ...process.env },\n shell: true,\n stdio: 'inherit',\n }).status ?? 0\n checkResult(name, status, 'error', exitOnFail)\n totalStatus += status ?? 0\n }\n return totalStatus\n }, !!exitOnFail)\n}\n","import { spawn } from 'node:child_process'\nimport { existsSync } from 'node:fs'\n\nimport chalk from 'chalk'\n\nimport { checkResult } from './checkResult.ts'\nimport type { ScriptStep } from './runSteps.ts'\nimport { safeExitAsync } from './safeExit.ts'\n\nexport const runStepAsync = (name: string, step: ScriptStep, exitOnFail = true, message?: string) => {\n return new Promise<number>((resolve) => {\n const [command, args, config] = step\n if (message) {\n console.log(chalk.gray(message))\n }\n const argList = Array.isArray(args) ? args : args.split(' ')\n if (command === 'node' && !existsSync(argList[0])) {\n throw new Error(`File not found [${argList[0]}]`)\n }\n spawn(command, Array.isArray(args) ? args : args.split(' '), {\n ...config,\n env: { FORCE_COLOR: '3', ...process.env },\n shell: true,\n stdio: 'inherit',\n }).on('close', (code) => {\n if (code) {\n console.error(\n chalk.red(\n `Command Exited With Non-Zero Result [${chalk.gray(code)}] | ${chalk.yellow(command)} ${chalk.white(\n Array.isArray(args) ? args.join(' ') : args,\n )}`,\n ),\n )\n checkResult(name, code, 'error', exitOnFail)\n resolve(code)\n } else {\n resolve(0)\n }\n })\n })\n}\n\nexport const runStepsAsync = async (name: string, steps: ScriptStep[], exitOnFail = true, messages?: string[]) => {\n return await safeExitAsync(async () => {\n const pkgName = process.env.npm_package_name\n console.log(chalk.green(`${name} [${pkgName}]`))\n let result = 0\n for (const [i, step] of steps.entries()) {\n result += await runStepAsync(name, step, exitOnFail, messages?.[i])\n }\n return result\n })\n}\n","import chalk from 'chalk'\n\nimport { runSteps } from '../lib/index.ts'\n\nexport interface CompileParams {\n incremental?: boolean\n jobs?: number\n pkg?: string\n publint?: boolean\n target?: 'esm' | 'cjs'\n verbose?: boolean\n}\n\ninterface CompilePackageParams {\n pkg: string\n publint?: boolean\n target?: 'esm' | 'cjs'\n verbose?: boolean\n}\n\nexport const compile = ({\n verbose, target, pkg, incremental, publint, jobs,\n}: CompileParams) => {\n return pkg\n ? compilePackage({\n pkg, publint, target, verbose,\n })\n : compileAll({\n incremental, publint, target, verbose, jobs,\n })\n}\n\nexport const compilePackage = ({ target, pkg }: CompilePackageParams) => {\n const targetOptions = target ? ['-t', target] : []\n\n return runSteps(\n `Compile [${pkg}]`,\n [['yarn', ['workspace', pkg, 'run', 'package-compile', ...targetOptions]]],\n )\n}\n\nexport const compileAll = ({\n jobs, verbose, target, incremental,\n}: CompileParams) => {\n const start = Date.now()\n const verboseOptions = verbose ? ['--verbose'] : ['--no-verbose']\n const targetOptions = target ? ['-t', target] : []\n const incrementalOptions = incremental ? ['--since', '-Ap', '--topological-dev'] : ['--parallel', '-Ap', '--topological-dev']\n const jobsOptions = jobs ? ['-j', `${jobs}`] : []\n if (jobs) {\n console.log(chalk.blue(`Jobs set to [${jobs}]`))\n }\n\n const result = runSteps(`Compile${incremental ? '-Incremental' : ''} [All]`, [\n ['yarn', ['workspaces',\n 'foreach',\n ...incrementalOptions,\n ...jobsOptions,\n ...verboseOptions,\n 'run',\n 'package-compile',\n ...targetOptions,\n ]],\n ])\n console.log(`${chalk.gray('Compiled in')} [${chalk.magenta(((Date.now() - start) / 1000).toFixed(2))}] ${chalk.gray('seconds')}`)\n return result\n}\n","import path from 'node:path/posix'\n\nimport chalk from 'chalk'\nimport cpy from 'cpy'\n\nimport { yarnWorkspaces } from '../lib/index.ts'\n\nexport interface CopyAssetsParams {\n pkg?: string\n target?: 'esm' | 'cjs'\n}\n\nconst copyPackageTargetAssets = async (target: 'esm' | 'cjs', name: string, location: string) => {\n try {\n const values = await cpy(\n ['**/*.jpg', '**/*.png', '**/*.gif', '**/*.svg', '**/*.webp', '**/*.sass', '**/*.scss', '**/*.gif', '**/*.css'],\n `../dist/${target}`,\n {\n cwd: path.join(process.cwd(), location, 'src'),\n flat: false,\n },\n )\n for (const value of values) {\n console.log(`${value.split('/').pop()} => ./dist/${target}`)\n }\n return 0\n } catch (reason) {\n console.log(`Copy Failed: ${name}: ${reason}`)\n return 1\n }\n}\n\nconst copyTargetAssets = async (target: 'esm' | 'cjs', pkg?: string) => {\n const workspaces = yarnWorkspaces()\n\n console.log(chalk.green(`Copying Assets [${target.toUpperCase()}]`))\n\n // finds the package or returns all if undefined\n const workspaceList = workspaces.filter(({ name }) => {\n return pkg === undefined || name === pkg\n })\n\n if (workspaceList.length === 0) {\n console.error(`Package not found [${pkg}]`)\n } else {\n const results = await Promise.all(\n workspaceList.map(async (workspace) => {\n const { location, name } = workspace\n return await copyPackageTargetAssets(target, name, location)\n }),\n )\n // eslint-disable-next-line unicorn/no-array-reduce\n return results.reduce((prev, result) => prev || result, 0)\n }\n return 0\n}\n\nexport const copyAssets = async ({ target, pkg }: CopyAssetsParams) => {\n switch (target) {\n case 'esm': {\n return await copyTargetAssets('esm', pkg)\n }\n case 'cjs': {\n return await copyTargetAssets('cjs', pkg)\n }\n default: {\n return (await copyTargetAssets('esm', pkg)) || (await copyTargetAssets('cjs', pkg))\n }\n }\n}\n","import { runSteps } from '../lib/index.ts'\n\nexport interface RebuildParams {\n pkg?: string\n target?: 'esm' | 'cjs'\n}\n\nexport const rebuild = ({ target }: RebuildParams) => {\n return runSteps('Rebuild', [\n ['yarn', 'xy clean'],\n ['yarn', target ? `xy build -t ${target}` : 'xy build'],\n ])\n}\n","import chalk from 'chalk'\n\nimport { runStepsAsync } from '../lib/index.ts'\n\nexport interface RecompileParams {\n incremental?: boolean\n jobs?: number\n pkg?: string\n target?: 'esm' | 'cjs'\n verbose?: boolean\n}\n\nexport interface RecompilePackageParams {\n pkg: string\n target?: 'esm' | 'cjs'\n verbose?: boolean\n}\n\nexport const recompile = async ({\n verbose, target, pkg, incremental,\n}: RecompileParams) => {\n return pkg\n ? await recompilePackage({\n pkg, target, verbose,\n })\n : await recompileAll({\n incremental, target, verbose,\n })\n}\n\nexport const recompilePackage = ({ target, pkg }: RecompilePackageParams) => {\n const targetOptions = target ? ['-t', target] : []\n\n return runStepsAsync(\n `Recompile [${pkg}]`,\n [['yarn', ['workspace', pkg, 'run', 'package-recompile', ...targetOptions]]],\n )\n}\n\nexport const recompileAll = async ({\n jobs, verbose, target, incremental,\n}: RecompileParams) => {\n const start = Date.now()\n const verboseOptions = verbose ? ['--verbose'] : ['--no-verbose']\n const targetOptions = target ? ['-t', target] : []\n const incrementalOptions = incremental\n ? ['--since', '-Apt', '--topological-dev']\n : ['--parallel', '-Apt', '--topological-dev']\n const jobsOptions = jobs ? ['-j', `${jobs}`] : []\n if (jobs) {\n console.log(chalk.blue(`Jobs set to [${jobs}]`))\n }\n\n const result = await runStepsAsync(`Recompile${incremental ? '-Incremental' : ''} [All]`, [\n ['yarn',\n [\n 'workspaces',\n 'foreach',\n ...incrementalOptions,\n ...jobsOptions,\n ...verboseOptions,\n 'run',\n 'package-clean',\n ...targetOptions],\n ],\n ['yarn',\n [\n 'workspaces',\n 'foreach',\n ...incrementalOptions,\n ...jobsOptions,\n ...verboseOptions,\n 'run',\n 'package-compile',\n ...targetOptions]],\n ])\n console.log(\n `${chalk.gray('Recompiled in')} [${chalk.magenta(((Date.now() - start) / 1000).toFixed(2))}] ${chalk.gray('seconds')}`,\n )\n return result\n}\n","import type { Argv } from 'yargs'\n\nexport const packagePositionalParam = (yargs: Argv<unknown>) => {\n return yargs.positional('package', { describe: 'Specific package to target', type: 'string' })\n}\n","import type { CommandModule } from 'yargs'\n\nimport {\n build, compile, copyAssets, rebuild, recompile,\n} from '../../actions/index.ts'\nimport { packagePositionalParam } from '../param.ts'\n\nexport const buildCommand: CommandModule = {\n builder: (yargs) => {\n return packagePositionalParam(yargs)\n },\n command: 'build [package]',\n describe: 'Build - Compile & Lint',\n handler: async (argv) => {\n if (argv.verbose) {\n console.log(`Building: ${argv.package ?? 'all'}`)\n }\n\n process.exitCode = await build({\n incremental: !!argv.incremental,\n jobs: argv.jobs as number,\n pkg: argv.package as string,\n target: argv.target as 'esm' | 'cjs',\n verbose: !!argv.verbose,\n })\n },\n}\n\nexport const compileCommand: CommandModule = {\n builder: (yargs) => {\n return packagePositionalParam(yargs)\n },\n command: 'compile [package]',\n describe: 'Compile with Typescript & Copy Images',\n handler: (argv) => {\n if (argv.verbose) {\n console.log(`Compiling: ${argv.package ?? 'all'}`)\n }\n process.exitCode = compile({\n incremental: !!argv.incremental,\n jobs: argv.jobs as number,\n pkg: argv.package as string,\n target: argv.target as 'esm' | 'cjs',\n verbose: !!argv.verbose,\n })\n },\n}\n\nexport const compileOnlyCommand: CommandModule = {\n builder: (yargs) => {\n return packagePositionalParam(yargs)\n },\n command: 'compile-only [package]',\n describe: 'Compile with Typescript & Copy Images (No Publint)',\n handler: (argv) => {\n if (argv.verbose) {\n console.log(`Compiling: ${argv.package ?? 'all'}`)\n }\n process.exitCode = compile({\n incremental: !!argv.incremental,\n jobs: argv.jobs as number,\n pkg: argv.package as string,\n publint: false,\n target: argv.target as 'esm' | 'cjs',\n verbose: !!argv.verbose,\n })\n },\n}\n\nexport const recompileCommand: CommandModule = {\n builder: (yargs) => {\n return packagePositionalParam(yargs)\n },\n command: 'recompile [package]',\n describe: 'Re-compile with Typescript & Copy Images',\n handler: async (argv) => {\n if (argv.verbose) {\n console.log(`Re-compiling: ${argv.package ?? 'all'}`)\n }\n process.exitCode = await recompile({\n incremental: !!argv.incremental,\n jobs: argv.jobs as number,\n pkg: argv.package as string,\n target: argv.target as 'esm' | 'cjs',\n verbose: !!argv.verbose,\n })\n },\n}\n\nexport const rebuildCommand: CommandModule = {\n builder: (yargs) => {\n return packagePositionalParam(yargs)\n },\n command: 'rebuild [package]',\n describe: 'Rebuild - Clean, Compile & Lint',\n handler: (argv) => {\n if (argv.verbose) console.log(`Rebuilding: ${argv.package ?? 'all'}`)\n process.exitCode = rebuild({ target: argv.target as 'esm' | 'cjs' })\n },\n}\n\nexport const copyAssetsCommand: CommandModule = {\n builder: (yargs) => {\n return packagePositionalParam(yargs)\n },\n command: 'copy-assets [package]',\n describe: 'Copy Assets - Copy the assets from src to dist',\n handler: async (argv) => {\n if (argv.verbose) console.log(`Copying Assets: ${argv.package ?? 'all'}`)\n process.exitCode = await copyAssets({ target: argv.target as 'esm' | 'cjs' })\n },\n}\n"],"mappings":";AAAA,OAAOA,YAAW;;;ACAlB,OAAO,WAAW;AAEX,IAAM,cAAc,CAAC,MAAc,QAAgB,QAA0B,SAAS,aAAa,UAAU;AAClH,MAAI,QAAQ;AACV,UAAM,UAAU,aAAa,sBAAsB;AACnD,UAAM,YAAY,UAAU,UAAU,MAAM,MAAM,MAAM;AACxD,YAAQ,KAAK,EAAE,UAAU,GAAG,IAAI,QAAQ,MAAM,aAAa,OAAO,EAAE,CAAC;AACrE,QAAI,YAAY;AACd,cAAQ,KAAK,MAAM;AAAA,IACrB;AAAA,EACF;AACF;;;ACXA,OAAOC,YAAW;;;ACAX,IAAM,YAAY,CAEvB,IACA,SACA,YAAY,CAACC,QAAW,CAAC,CAACA,IAAG,QAAQ,CAAC,CAACA,IAAG,YACvC;AACH,SAAO,UAAU,EAAO,IAAI,QAAQ,EAAO,IAAI;AACjD;;;ACLO,IAAM,qBAAqB,CAChC,IAAa,YACV;AACH,SAAO,UAAa,IAAI,SAAS,CAACC,QAAiBA,IAA6B,UAAU,MAAS;AACrG;;;AFDO,IAAM,YAAY,CAAC,OAAgB;AACxC,QAAM,QAAQ,OAAO,OAAO,WAAW,IAAI,MAAM,EAAE,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K,OAAwB,CAAC;AAAA,EAC9E;AACF;","names":["chalk","chalk","ex","ex","error","chalk","spawnSync","chalk","chalk","spawnSync","existsSync","chalk","chalk","existsSync","chalk","chalk","chalk","chalk","chalk","chalk","chalk"]}