@xylabs/ts-scripts-yarn3 7.4.18 → 7.4.19
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.
- package/README.body.md +86 -0
- package/README.md +108 -0
- package/dist/actions/claude-commands.mjs +1 -1
- package/dist/actions/claude-commands.mjs.map +1 -1
- package/dist/actions/claude-rules.mjs +1 -1
- package/dist/actions/claude-rules.mjs.map +1 -1
- package/dist/actions/compile.mjs.map +1 -1
- package/dist/actions/cycle.mjs.map +1 -1
- package/dist/actions/dead.mjs.map +1 -1
- package/dist/actions/deploy-major.mjs.map +1 -1
- package/dist/actions/deploy-minor.mjs.map +1 -1
- package/dist/actions/deploy-next.mjs.map +1 -1
- package/dist/actions/deploy.mjs.map +1 -1
- package/dist/actions/fix.mjs.map +1 -1
- package/dist/actions/gen-docs.mjs.map +1 -1
- package/dist/actions/index.mjs +146 -41
- package/dist/actions/index.mjs.map +1 -1
- package/dist/actions/knip.mjs.map +1 -1
- package/dist/actions/lint.mjs.map +1 -1
- package/dist/actions/publint.mjs.map +1 -1
- package/dist/actions/publish.mjs.map +1 -1
- package/dist/actions/readme-gen.mjs +136 -20
- package/dist/actions/readme-gen.mjs.map +1 -1
- package/dist/actions/readme-init.mjs +83 -0
- package/dist/actions/readme-init.mjs.map +1 -0
- package/dist/actions/rebuild.mjs.map +1 -1
- package/dist/actions/reinstall.mjs.map +1 -1
- package/dist/actions/relint.mjs.map +1 -1
- package/dist/actions/retest.mjs +2 -2
- package/dist/actions/retest.mjs.map +1 -1
- package/dist/actions/sonar.mjs.map +1 -1
- package/dist/actions/test.mjs.map +1 -1
- package/dist/actions/up.mjs.map +1 -1
- package/dist/actions/updo.mjs.map +1 -1
- package/dist/actions/upplug.mjs.map +1 -1
- package/dist/actions/upyarn.mjs.map +1 -1
- package/dist/bin/xy.mjs +817 -576
- package/dist/bin/xy.mjs.map +1 -1
- package/dist/index.d.ts +42 -13
- package/dist/index.mjs +820 -573
- package/dist/index.mjs.map +1 -1
- package/dist/lib/claudeMdTemplate.mjs +1 -1
- package/dist/lib/claudeMdTemplate.mjs.map +1 -1
- package/dist/lib/generateReadmeFiles.mjs +118 -21
- package/dist/lib/generateReadmeFiles.mjs.map +1 -1
- package/dist/lib/index.mjs +120 -23
- package/dist/lib/index.mjs.map +1 -1
- package/dist/lib/runSteps.mjs.map +1 -1
- package/dist/lib/runXy.mjs.map +1 -1
- package/dist/xy/build/buildCommand.mjs +161 -0
- package/dist/xy/build/buildCommand.mjs.map +1 -0
- package/dist/xy/build/compileCommand.mjs +174 -0
- package/dist/xy/build/compileCommand.mjs.map +1 -0
- package/dist/xy/build/compileOnlyCommand.mjs +175 -0
- package/dist/xy/build/compileOnlyCommand.mjs.map +1 -0
- package/dist/xy/build/copyAssetsCommand.mjs +84 -0
- package/dist/xy/build/copyAssetsCommand.mjs.map +1 -0
- package/dist/xy/{xyBuildCommands.mjs → build/index.mjs} +111 -93
- package/dist/xy/build/index.mjs.map +1 -0
- package/dist/xy/build/rebuildCommand.mjs +114 -0
- package/dist/xy/build/rebuildCommand.mjs.map +1 -0
- package/dist/xy/build/recompileCommand.mjs +204 -0
- package/dist/xy/build/recompileCommand.mjs.map +1 -0
- package/dist/xy/common/claude/commandsCommand.mjs +107 -0
- package/dist/xy/common/claude/commandsCommand.mjs.map +1 -0
- package/dist/xy/common/claude/index.mjs +332 -0
- package/dist/xy/common/claude/index.mjs.map +1 -0
- package/dist/xy/common/claude/initCommand.mjs +283 -0
- package/dist/xy/common/claude/initCommand.mjs.map +1 -0
- package/dist/xy/common/claude/rulesCommand.mjs +129 -0
- package/dist/xy/common/claude/rulesCommand.mjs.map +1 -0
- package/dist/xy/common/claude/settingsCommand.mjs +90 -0
- package/dist/xy/common/claude/settingsCommand.mjs.map +1 -0
- package/dist/xy/common/cleanDocsCommand.mjs +45 -0
- package/dist/xy/common/cleanDocsCommand.mjs.map +1 -0
- package/dist/xy/common/deadCommand.mjs +116 -0
- package/dist/xy/common/deadCommand.mjs.map +1 -0
- package/dist/xy/common/genDocsCommand.mjs +125 -0
- package/dist/xy/common/genDocsCommand.mjs.map +1 -0
- package/dist/xy/common/gitignoreGenCommand.mjs +98 -0
- package/dist/xy/common/gitignoreGenCommand.mjs.map +1 -0
- package/dist/xy/common/gitlintCommand.mjs +82 -0
- package/dist/xy/common/gitlintCommand.mjs.map +1 -0
- package/dist/xy/{xyCommonCommands.mjs → common/index.mjs} +451 -241
- package/dist/xy/common/index.mjs.map +1 -0
- package/dist/xy/common/licenseCommand.mjs +100 -0
- package/dist/xy/common/licenseCommand.mjs.map +1 -0
- package/dist/xy/common/npmignoreGenCommand.mjs +98 -0
- package/dist/xy/common/npmignoreGenCommand.mjs.map +1 -0
- package/dist/xy/common/readme/genCommand.mjs +321 -0
- package/dist/xy/common/readme/genCommand.mjs.map +1 -0
- package/dist/xy/common/readme/index.mjs +361 -0
- package/dist/xy/common/readme/index.mjs.map +1 -0
- package/dist/xy/common/readme/initCommand.mjs +103 -0
- package/dist/xy/common/readme/initCommand.mjs.map +1 -0
- package/dist/xy/common/retestCommand.mjs +111 -0
- package/dist/xy/common/retestCommand.mjs.map +1 -0
- package/dist/xy/common/testCommand.mjs +108 -0
- package/dist/xy/common/testCommand.mjs.map +1 -0
- package/dist/xy/common/upplugCommand.mjs +113 -0
- package/dist/xy/common/upplugCommand.mjs.map +1 -0
- package/dist/xy/common/upyarnCommand.mjs +108 -0
- package/dist/xy/common/upyarnCommand.mjs.map +1 -0
- package/dist/xy/common/yarn3OnlyCommand.mjs +70 -0
- package/dist/xy/common/yarn3OnlyCommand.mjs.map +1 -0
- package/dist/xy/deploy/deployCommand.mjs +139 -0
- package/dist/xy/deploy/deployCommand.mjs.map +1 -0
- package/dist/xy/deploy/deployMajorCommand.mjs +139 -0
- package/dist/xy/deploy/deployMajorCommand.mjs.map +1 -0
- package/dist/xy/deploy/deployMinorCommand.mjs +139 -0
- package/dist/xy/deploy/deployMinorCommand.mjs.map +1 -0
- package/dist/xy/deploy/deployNextCommand.mjs +139 -0
- package/dist/xy/deploy/deployNextCommand.mjs.map +1 -0
- package/dist/xy/{xyDeployCommands.mjs → deploy/index.mjs} +53 -53
- package/dist/xy/deploy/index.mjs.map +1 -0
- package/dist/xy/deploy/publishCommand.mjs +108 -0
- package/dist/xy/deploy/publishCommand.mjs.map +1 -0
- package/dist/xy/index.mjs +817 -576
- package/dist/xy/index.mjs.map +1 -1
- package/dist/xy/install/cleanCommand.mjs +140 -0
- package/dist/xy/install/cleanCommand.mjs.map +1 -0
- package/dist/xy/install/dupdepsCommand.mjs +191 -0
- package/dist/xy/install/dupdepsCommand.mjs.map +1 -0
- package/dist/xy/{xyInstallCommands.mjs → install/index.mjs} +71 -68
- package/dist/xy/install/index.mjs.map +1 -0
- package/dist/xy/install/reinstallCommand.mjs +140 -0
- package/dist/xy/install/reinstallCommand.mjs.map +1 -0
- package/dist/xy/install/staticsCommand.mjs +191 -0
- package/dist/xy/install/staticsCommand.mjs.map +1 -0
- package/dist/{actions/clean-jest.mjs → xy/install/upCommand.mjs} +15 -6
- package/dist/xy/install/upCommand.mjs.map +1 -0
- package/dist/xy/install/updoCommand.mjs +112 -0
- package/dist/xy/install/updoCommand.mjs.map +1 -0
- package/dist/xy/lint/cycleCommand.mjs +163 -0
- package/dist/xy/lint/cycleCommand.mjs.map +1 -0
- package/dist/xy/lint/deplintCommand.mjs +814 -0
- package/dist/xy/lint/deplintCommand.mjs.map +1 -0
- package/dist/xy/lint/fixCommand.mjs +168 -0
- package/dist/xy/lint/fixCommand.mjs.map +1 -0
- package/dist/xy/{xyLintCommands.mjs → lint/index.mjs} +176 -145
- package/dist/xy/lint/index.mjs.map +1 -0
- package/dist/xy/lint/knipCommand.mjs +121 -0
- package/dist/xy/lint/knipCommand.mjs.map +1 -0
- package/dist/xy/lint/lintCommand.mjs +186 -0
- package/dist/xy/lint/lintCommand.mjs.map +1 -0
- package/dist/xy/lint/publintCommand.mjs +187 -0
- package/dist/xy/lint/publintCommand.mjs.map +1 -0
- package/dist/xy/lint/relintCommand.mjs +163 -0
- package/dist/xy/lint/relintCommand.mjs.map +1 -0
- package/dist/xy/lint/sonarCommand.mjs +121 -0
- package/dist/xy/lint/sonarCommand.mjs.map +1 -0
- package/dist/xy/xy.mjs +815 -574
- package/dist/xy/xy.mjs.map +1 -1
- package/package.json +2 -2
- package/templates/readme/README.body.md +11 -0
- package/templates/readme/README.template.md +22 -0
- package/dist/actions/clean-jest.mjs.map +0 -1
- package/dist/xy/xyBuildCommands.mjs.map +0 -1
- package/dist/xy/xyCommonCommands.mjs.map +0 -1
- package/dist/xy/xyDeployCommands.mjs.map +0 -1
- package/dist/xy/xyInstallCommands.mjs.map +0 -1
- package/dist/xy/xyLintCommands.mjs.map +0 -1
- /package/templates/{CLAUDE-project.md → claude/CLAUDE-project.md} +0 -0
- /package/templates/{commands → claude/commands}/xylabs-build.md +0 -0
- /package/templates/{commands → claude/commands}/xylabs-clean.md +0 -0
- /package/templates/{commands → claude/commands}/xylabs-compile.md +0 -0
- /package/templates/{commands → claude/commands}/xylabs-cycle.md +0 -0
- /package/templates/{commands → claude/commands}/xylabs-deplint.md +0 -0
- /package/templates/{commands → claude/commands}/xylabs-deploy-major.md +0 -0
- /package/templates/{commands → claude/commands}/xylabs-deploy-minor.md +0 -0
- /package/templates/{commands → claude/commands}/xylabs-deploy.md +0 -0
- /package/templates/{commands → claude/commands}/xylabs-fix.md +0 -0
- /package/templates/{commands → claude/commands}/xylabs-knip.md +0 -0
- /package/templates/{commands → claude/commands}/xylabs-lint.md +0 -0
- /package/templates/{commands → claude/commands}/xylabs-publint.md +0 -0
- /package/templates/{commands → claude/commands}/xylabs-rebuild.md +0 -0
- /package/templates/{commands → claude/commands}/xylabs-test.md +0 -0
- /package/templates/{rules → claude/rules}/xylabs-architecture.md +0 -0
- /package/templates/{rules → claude/rules}/xylabs-build.md +0 -0
- /package/templates/{rules → claude/rules}/xylabs-dependencies.md +0 -0
- /package/templates/{rules → claude/rules}/xylabs-error-handling.md +0 -0
- /package/templates/{rules → claude/rules}/xylabs-frameworks.md +0 -0
- /package/templates/{rules → claude/rules}/xylabs-git-workflow.md +0 -0
- /package/templates/{rules → claude/rules}/xylabs-linting.md +0 -0
- /package/templates/{rules → claude/rules}/xylabs-naming.md +0 -0
- /package/templates/{rules → claude/rules}/xylabs-style.md +0 -0
- /package/templates/{rules → claude/rules}/xylabs-typescript.md +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/actions/deploy.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"],"sourcesContent":["import { readFileSync } from 'node:fs'\n\nimport type { Workspace } from '../lib/index.ts'\nimport { runSteps, yarnWorkspaces } from '../lib/index.ts'\n\nconst privatePackageExcludeList = () => {\n const possibleDeployablePackages: [Workspace, { private?: boolean }][] = yarnWorkspaces().map(workspace => [workspace,\n JSON.parse(readFileSync(`${workspace.location}/package.json`, { encoding: 'utf8' })) as object])\n\n const privatePackages = possibleDeployablePackages.filter(([_, pkg]) => pkg.private).map(([workspace]) => workspace)\n const excludeList = privatePackages.map(workspace => `--exclude ${workspace.name}`)\n return excludeList\n}\n\nexport const deploy = () => {\n const excludeList = privatePackageExcludeList()\n if (excludeList.length > 0) {\n console.log('Excluding private packages from deployment:', excludeList)\n }\n\n return runSteps('Deploy [Patch]', [\n ['yarn', 'workspaces foreach --all version patch --deferred'],\n ['yarn', 'xy clean'],\n ['yarn', 'xy build'],\n ['yarn', 'version apply --all'],\n ])\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' | '
|
|
1
|
+
{"version":3,"sources":["../../src/actions/deploy.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"],"sourcesContent":["import { readFileSync } from 'node:fs'\n\nimport type { Workspace } from '../lib/index.ts'\nimport { runSteps, yarnWorkspaces } from '../lib/index.ts'\n\nconst privatePackageExcludeList = () => {\n const possibleDeployablePackages: [Workspace, { private?: boolean }][] = yarnWorkspaces().map(workspace => [workspace,\n JSON.parse(readFileSync(`${workspace.location}/package.json`, { encoding: 'utf8' })) as object])\n\n const privatePackages = possibleDeployablePackages.filter(([_, pkg]) => pkg.private).map(([workspace]) => workspace)\n const excludeList = privatePackages.map(workspace => `--exclude ${workspace.name}`)\n return excludeList\n}\n\nexport const deploy = () => {\n const excludeList = privatePackageExcludeList()\n if (excludeList.length > 0) {\n console.log('Excluding private packages from deployment:', excludeList)\n }\n\n return runSteps('Deploy [Patch]', [\n ['yarn', 'workspaces foreach --all version patch --deferred'],\n ['yarn', 'xy clean'],\n ['yarn', 'xy build'],\n ['yarn', 'version apply --all'],\n ])\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"],"mappings":";AAAA,SAAS,oBAAoB;;;ACA7B,OAAO,WAAW;AAEX,IAAM,cAAc,CAAC,MAAc,QAAgB,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AAAA,MAClD;AACA,YAAM,SACFC,WAAU,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;;;APlCA,IAAM,4BAA4B,MAAM;AACtC,QAAM,6BAAmE,eAAe,EAAE,IAAI,eAAa;AAAA,IAAC;AAAA,IAC1G,KAAK,MAAM,aAAa,GAAG,UAAU,QAAQ,iBAAiB,EAAE,UAAU,OAAO,CAAC,CAAC;AAAA,EAAW,CAAC;AAEjG,QAAM,kBAAkB,2BAA2B,OAAO,CAAC,CAAC,GAAG,GAAG,MAAM,IAAI,OAAO,EAAE,IAAI,CAAC,CAAC,SAAS,MAAM,SAAS;AACnH,QAAM,cAAc,gBAAgB,IAAI,eAAa,aAAa,UAAU,IAAI,EAAE;AAClF,SAAO;AACT;AAEO,IAAM,SAAS,MAAM;AAC1B,QAAM,cAAc,0BAA0B;AAC9C,MAAI,YAAY,SAAS,GAAG;AAC1B,YAAQ,IAAI,+CAA+C,WAAW;AAAA,EACxE;AAEA,SAAO,SAAS,kBAAkB;AAAA,IAChC,CAAC,QAAQ,mDAAmD;AAAA,IAC5D,CAAC,QAAQ,UAAU;AAAA,IACnB,CAAC,QAAQ,UAAU;AAAA,IACnB,CAAC,QAAQ,qBAAqB;AAAA,EAChC,CAAC;AACH;","names":["chalk","ex","ex","error","chalk","spawnSync","chalk","chalk","spawnSync"]}
|
package/dist/actions/fix.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/actions/lint.ts","../../src/lib/checkResult.ts","../../src/lib/processEx.ts","../../src/lib/withError.ts","../../src/lib/withErrnoException.ts","../../src/lib/safeExit.ts","../../src/lib/runSteps.ts","../../src/actions/fix.ts"],"sourcesContent":["import chalk from 'chalk'\n\nimport { runSteps } from '../lib/index.ts'\n\nexport interface LintParams {\n cache?: boolean\n fix?: boolean\n incremental?: boolean\n pkg?: string\n verbose?: boolean\n}\n\nexport interface LintPackageParams {\n pkg: string\n verbose?: boolean\n}\n\nexport const lintPackage = ({\n pkg, fix, verbose,\n}: LintParams & Required<Pick<LintParams, 'pkg'>>) => {\n console.log(chalk.gray(`${fix ? 'Fix' : 'Lint'} [${pkg}]`))\n const start = Date.now()\n\n const result = runSteps(`${fix ? 'Fix' : 'Lint'} [${pkg}]`, [\n ['yarn', ['workspace',\n pkg,\n 'run',\n fix ? 'package-fix' : verbose ? 'package-lint-verbose' : 'package-lint',\n ]],\n ])\n console.log(chalk.gray(`${fix ? 'Fixed in' : 'Linted in'} [${chalk.magenta(((Date.now() - start) / 1000).toFixed(2))}] ${chalk.gray('seconds')}`))\n return result\n}\n\nexport const lint = ({\n pkg, verbose, incremental, fix,\n}: LintParams = {}) => {\n return pkg === undefined\n ? lintAllPackages({\n verbose, incremental, fix,\n })\n : lintPackage({\n pkg, fix, verbose,\n })\n}\n\nexport const lintAllPackages = ({ fix = false }: LintParams = {}) => {\n console.log(chalk.gray(`${fix ? 'Fix' : 'Lint'} [All-Packages]`))\n const start = Date.now()\n // const verboseOptions = verbose ? ['--verbose'] : ['--no-verbose']\n // const incrementalOptions = incremental ? ['--since', '-Ap'] : ['--parallel', '-Ap']\n const fixOptions = fix ? ['--fix'] : []\n\n const result = runSteps(`${fix ? 'Fix' : 'Lint'} [All-Packages]`, [\n ['yarn', ['eslint', '--cache', '--cache-location', '.eslintcache', '--cache-strategy', 'content', ...fixOptions]],\n ])\n console.log(chalk.gray(`${fix ? 'Fixed in' : 'Linted 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 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 type { LintParams } from './lint.ts'\nimport { lint } from './lint.ts'\n\nexport const fix = (params?: LintParams) => {\n return lint({ ...params, fix: true })\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;AACx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,IAAI,IAAI,SAAS,KAAM,QAAQ,CAAC,CAAC,CAAC,KAAKA,OAAM,KAAK,SAAS,CAAC,EAAE,CAAC;AACjJ,SAAO;AACT;;;AOvDO,IAAM,MAAM,CAAC,WAAwB;AAC1C,SAAO,KAAK,EAAE,GAAG,QAAQ,KAAK,KAAK,CAAC;AACtC;","names":["chalk","chalk","ex","ex","error","chalk","chalk","chalk","fix","chalk"]}
|
|
1
|
+
{"version":3,"sources":["../../src/actions/lint.ts","../../src/lib/checkResult.ts","../../src/lib/processEx.ts","../../src/lib/withError.ts","../../src/lib/withErrnoException.ts","../../src/lib/safeExit.ts","../../src/lib/runSteps.ts","../../src/actions/fix.ts"],"sourcesContent":["import chalk from 'chalk'\n\nimport { runSteps } from '../lib/index.ts'\n\nexport interface LintParams {\n cache?: boolean\n fix?: boolean\n incremental?: boolean\n pkg?: string\n verbose?: boolean\n}\n\nexport interface LintPackageParams {\n pkg: string\n verbose?: boolean\n}\n\nexport const lintPackage = ({\n pkg, fix, verbose,\n}: LintParams & Required<Pick<LintParams, 'pkg'>>) => {\n console.log(chalk.gray(`${fix ? 'Fix' : 'Lint'} [${pkg}]`))\n const start = Date.now()\n\n const result = runSteps(`${fix ? 'Fix' : 'Lint'} [${pkg}]`, [\n ['yarn', ['workspace',\n pkg,\n 'run',\n fix ? 'package-fix' : verbose ? 'package-lint-verbose' : 'package-lint',\n ]],\n ])\n console.log(chalk.gray(`${fix ? 'Fixed in' : 'Linted in'} [${chalk.magenta(((Date.now() - start) / 1000).toFixed(2))}] ${chalk.gray('seconds')}`))\n return result\n}\n\nexport const lint = ({\n pkg, verbose, incremental, fix,\n}: LintParams = {}) => {\n return pkg === undefined\n ? lintAllPackages({\n verbose, incremental, fix,\n })\n : lintPackage({\n pkg, fix, verbose,\n })\n}\n\nexport const lintAllPackages = ({ fix = false }: LintParams = {}) => {\n console.log(chalk.gray(`${fix ? 'Fix' : 'Lint'} [All-Packages]`))\n const start = Date.now()\n // const verboseOptions = verbose ? ['--verbose'] : ['--no-verbose']\n // const incrementalOptions = incremental ? ['--since', '-Ap'] : ['--parallel', '-Ap']\n const fixOptions = fix ? ['--fix'] : []\n\n const result = runSteps(`${fix ? 'Fix' : 'Lint'} [All-Packages]`, [\n ['yarn', ['eslint', '--cache', '--cache-location', '.eslintcache', '--cache-strategy', 'content', ...fixOptions]],\n ])\n console.log(chalk.gray(`${fix ? 'Fixed in' : 'Linted 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 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 type { LintParams } from './lint.ts'\nimport { lint } from './lint.ts'\n\nexport const fix = (params?: LintParams) => {\n return lint({ ...params, fix: true })\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,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,WAAU;AAC7B,YAAQ,MAAMC,OAAM,IAAI,GAAGD,OAAM,IAAI,KAAKA,OAAM,OAAO,EAAE,CAA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Q,KAAK,IAAI;AAGvB,QAAM,aAAaA,OAAM,CAAC,OAAO,IAAI,CAAC;AAEtC,QAAM,SAAS,SAAS,GAAGA,OAAM,QAAQ,MAAM,oBAAoB;AAAA,IACjE,CAAC,QAAQ,CAAC,UAAU,WAAW,oBAAoB,gBAAgB,oBAAoB,WAAW,GAAG,UAAU,CAAC;AAAA,EAClH,CAAC;AACD,UAAQ,IAAIC,OAAM,KAAK,GAAGD,OAAM,aAAa,WAAW,KAAKC,OAAM,UAAU,KAAK,IAAI,IAAI,SAAS,KAAM,QAAQ,CAAC,CAAC,CAAC,KAAKA,OAAM,KAAK,SAAS,CAAC,EAAE,CAAC;AACjJ,SAAO;AACT;;;AOvDO,IAAM,MAAM,CAAC,WAAwB;AAC1C,SAAO,KAAK,EAAE,GAAG,QAAQ,KAAK,KAAK,CAAC;AACtC;","names":["chalk","chalk","ex","ex","error","chalk","chalk","chalk","fix","chalk"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/lib/checkResult.ts","../../src/lib/processEx.ts","../../src/lib/withError.ts","../../src/lib/withErrnoException.ts","../../src/lib/safeExit.ts","../../src/lib/runSteps.ts","../../src/actions/gen-docs.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 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 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' | '
|
|
1
|
+
{"version":3,"sources":["../../src/lib/checkResult.ts","../../src/lib/processEx.ts","../../src/lib/withError.ts","../../src/lib/withErrnoException.ts","../../src/lib/safeExit.ts","../../src/lib/runSteps.ts","../../src/actions/gen-docs.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 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 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 type { ScriptStep } from '../lib/index.ts'\nimport { runSteps } from '../lib/index.ts'\n\nexport interface GenDocsParams {\n incremental?: boolean\n pkg?: string\n}\n\nexport interface GenDocsPackageParams { pkg: string }\n\nexport const genDocs = ({ pkg, incremental }: GenDocsParams) => {\n return pkg ? genDocsPackage({ pkg }) : genDocsAll({ incremental })\n}\n\nexport const genDocsPackage = ({ pkg }: GenDocsPackageParams) => {\n const steps: ScriptStep[] = [['yarn', ['workspace', pkg, 'run', 'package-gen-docs']]]\n\n return runSteps(`GenDocs [${pkg}]`, [...steps])\n}\n\nexport const genDocsAll = ({ incremental }: GenDocsParams) => {\n const incrementalOptions = incremental ? ['--since', '-pA'] : ['-pA']\n const steps: ScriptStep[] = [['yarn', ['workspaces', 'foreach', ...incrementalOptions, 'run', 'package-gen-docs']]]\n\n return runSteps(`GenDocs [All${incremental ? '-Incremental' : ''}]`, [...steps])\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,OAAOA,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,EACx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AAI,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;;;AC7BO,IAAM,UAAU,CAAC,EAAE,KAAK,YAAY,MAAqB;AAC9D,SAAO,MAAM,eAAe,EAAE,IAAI,CAAC,IAAI,WAAW,EAAE,YAAY,CAAC;AACnE;AAEO,IAAM,iBAAiB,CAAC,EAAE,IAAI,MAA4B;AAC/D,QAAM,QAAsB,CAAC,CAAC,QAAQ,CAAC,aAAa,KAAK,OAAO,kBAAkB,CAAC,CAAC;AAEpF,SAAO,SAAS,YAAY,GAAG,KAAK,CAAC,GAAG,KAAK,CAAC;AAChD;AAEO,IAAM,aAAa,CAAC,EAAE,YAAY,MAAqB;AAC5D,QAAM,qBAAqB,cAAc,CAAC,WAAW,KAAK,IAAI,CAAC,KAAK;AACpE,QAAM,QAAsB,CAAC,CAAC,QAAQ,CAAC,cAAc,WAAW,GAAG,oBAAoB,OAAO,kBAAkB,CAAC,CAAC;AAElH,SAAO,SAAS,eAAe,cAAc,iBAAiB,EAAE,KAAK,CAAC,GAAG,KAAK,CAAC;AACjF;","names":["chalk","ex","ex","error","chalk","chalk","chalk"]}
|
package/dist/actions/index.mjs
CHANGED
|
@@ -20,7 +20,7 @@ import { createRequire } from "module";
|
|
|
20
20
|
import PATH from "path";
|
|
21
21
|
var require2 = createRequire(import.meta.url);
|
|
22
22
|
var packageRoot = PATH.dirname(require2.resolve("@xylabs/ts-scripts-yarn3/package.json"));
|
|
23
|
-
var templatesDir = PATH.resolve(packageRoot, "templates");
|
|
23
|
+
var templatesDir = PATH.resolve(packageRoot, "templates", "claude");
|
|
24
24
|
var XYLABS_RULES_PREFIX = "xylabs-";
|
|
25
25
|
var XYLABS_COMMANDS_PREFIX = "xylabs-";
|
|
26
26
|
var claudeMdRuleTemplates = () => {
|
|
@@ -323,10 +323,19 @@ var generateIgnoreFiles = (filename3, pkg) => {
|
|
|
323
323
|
|
|
324
324
|
// src/lib/generateReadmeFiles.ts
|
|
325
325
|
import { execSync as execSync2 } from "child_process";
|
|
326
|
-
import FS from "fs";
|
|
327
|
-
import {
|
|
326
|
+
import FS, { readFileSync as readFileSync3 } from "fs";
|
|
327
|
+
import {
|
|
328
|
+
mkdir,
|
|
329
|
+
readFile,
|
|
330
|
+
writeFile
|
|
331
|
+
} from "fs/promises";
|
|
332
|
+
import { createRequire as createRequire2 } from "module";
|
|
328
333
|
import PATH2 from "path";
|
|
334
|
+
import { createInterface } from "readline";
|
|
329
335
|
import chalk5 from "chalk";
|
|
336
|
+
var require3 = createRequire2(import.meta.url);
|
|
337
|
+
var packageRoot2 = PATH2.dirname(require3.resolve("@xylabs/ts-scripts-yarn3/package.json"));
|
|
338
|
+
var readmeTemplatesDir = PATH2.resolve(packageRoot2, "templates", "readme");
|
|
330
339
|
function fillTemplate(template, data) {
|
|
331
340
|
const additionalData = { ...data, safeName: data.name.replaceAll("/", "__").replaceAll("@", "") };
|
|
332
341
|
return template.replaceAll(/\{\{(.*?)\}\}/g, (_, key) => additionalData[key.trim()] ?? "");
|
|
@@ -416,37 +425,120 @@ ${indent}### ${item.name}
|
|
|
416
425
|
}
|
|
417
426
|
return content;
|
|
418
427
|
}
|
|
428
|
+
function askConfirmation(question) {
|
|
429
|
+
const rl = createInterface({ input: process.stdin, output: process.stdout });
|
|
430
|
+
return new Promise((resolve) => {
|
|
431
|
+
rl.question(question, (answer) => {
|
|
432
|
+
rl.close();
|
|
433
|
+
resolve(answer.toLowerCase() === "y" || answer.toLowerCase() === "yes");
|
|
434
|
+
});
|
|
435
|
+
});
|
|
436
|
+
}
|
|
437
|
+
var DEFAULT_README_TEMPLATE = readFileSync3(PATH2.resolve(readmeTemplatesDir, "README.template.md"), "utf8");
|
|
438
|
+
var DEFAULT_README_BODY = readFileSync3(PATH2.resolve(readmeTemplatesDir, "README.body.md"), "utf8");
|
|
439
|
+
function applyLogoConfig(template, logoUrl, logoLinkUrl) {
|
|
440
|
+
let result = template;
|
|
441
|
+
if (logoUrl) {
|
|
442
|
+
result = result.replace(/\[logo]: .+/, `[logo]: ${logoUrl}`);
|
|
443
|
+
if (logoLinkUrl) {
|
|
444
|
+
result = result.replace(/\[!\[logo]\[]][^)]*\)/, `[![logo][]](${logoLinkUrl})`);
|
|
445
|
+
}
|
|
446
|
+
} else {
|
|
447
|
+
result = result.replace(/\[!\[logo]\[]][^\n]*\n*/, "");
|
|
448
|
+
result = result.replace(/\[logo]: [^\n]*\n?/, "");
|
|
449
|
+
}
|
|
450
|
+
return result;
|
|
451
|
+
}
|
|
452
|
+
function resolveTemplatePath(templatePath) {
|
|
453
|
+
const cwd5 = INIT_CWD() ?? ".";
|
|
454
|
+
return templatePath ?? PATH2.join(cwd5, ".xy", "README.template.md");
|
|
455
|
+
}
|
|
456
|
+
async function loadOrCreateTemplate(resolvedTemplatePath) {
|
|
457
|
+
try {
|
|
458
|
+
const template = await readFile(resolvedTemplatePath, "utf8");
|
|
459
|
+
return { created: false, template };
|
|
460
|
+
} catch {
|
|
461
|
+
console.log(chalk5.yellow(`Template not found: ${resolvedTemplatePath}`));
|
|
462
|
+
const shouldCreate = await askConfirmation("Would you like to create a stock template? (y/N) ");
|
|
463
|
+
if (!shouldCreate) {
|
|
464
|
+
throw new Error("Template creation declined");
|
|
465
|
+
}
|
|
466
|
+
const template = DEFAULT_README_TEMPLATE;
|
|
467
|
+
await scaffoldTemplate(resolvedTemplatePath, template);
|
|
468
|
+
return { created: true, template };
|
|
469
|
+
}
|
|
470
|
+
}
|
|
471
|
+
async function scaffoldTemplate(resolvedTemplatePath, template) {
|
|
472
|
+
const xyDir = PATH2.dirname(resolvedTemplatePath);
|
|
473
|
+
await mkdir(xyDir, { recursive: true });
|
|
474
|
+
await writeFile(resolvedTemplatePath, template);
|
|
475
|
+
console.log(chalk5.green(`Created template: ${resolvedTemplatePath}`));
|
|
476
|
+
const bodyPath = PATH2.join(xyDir, "README.body.md");
|
|
477
|
+
await writeFile(bodyPath, DEFAULT_README_BODY);
|
|
478
|
+
console.log(chalk5.green(`Created body template: ${bodyPath}`));
|
|
479
|
+
}
|
|
480
|
+
async function resolveBody(location, defaultBody) {
|
|
481
|
+
const localBodyPath = PATH2.join(location, "README.body.md");
|
|
482
|
+
try {
|
|
483
|
+
return await readFile(localBodyPath, "utf8");
|
|
484
|
+
} catch {
|
|
485
|
+
return defaultBody;
|
|
486
|
+
}
|
|
487
|
+
}
|
|
488
|
+
async function generateReadmeForWorkspace(location, name, template, defaultBody, typedoc, verbose) {
|
|
489
|
+
try {
|
|
490
|
+
const pkgJsonPath = PATH2.join(location, "package.json");
|
|
491
|
+
const pkgJson = JSON.parse(await readFile(pkgJsonPath, "utf8"));
|
|
492
|
+
const body = await resolveBody(location, defaultBody);
|
|
493
|
+
const typedocContent = typedoc ? generateTypedoc(location, ["src/index*.ts"]) : "";
|
|
494
|
+
const readmeContent = fillTemplate(template, {
|
|
495
|
+
...pkgJson,
|
|
496
|
+
body,
|
|
497
|
+
typedoc: typedocContent
|
|
498
|
+
});
|
|
499
|
+
await writeFile(PATH2.join(location, "README.md"), readmeContent);
|
|
500
|
+
if (verbose) console.log(chalk5.green(` ${name}`));
|
|
501
|
+
return true;
|
|
502
|
+
} catch (ex) {
|
|
503
|
+
const error = ex;
|
|
504
|
+
console.warn(chalk5.yellow(` Skipped ${location}: ${error.message}`));
|
|
505
|
+
return false;
|
|
506
|
+
}
|
|
507
|
+
}
|
|
419
508
|
async function generateReadmeFiles({
|
|
509
|
+
logoLinkUrl,
|
|
510
|
+
logoUrl,
|
|
420
511
|
pkg,
|
|
421
512
|
templatePath,
|
|
422
513
|
typedoc = false,
|
|
423
|
-
verbose
|
|
514
|
+
verbose = false
|
|
424
515
|
}) {
|
|
425
516
|
console.log(chalk5.green("Generate README Files"));
|
|
426
|
-
const
|
|
427
|
-
const resolvedTemplatePath = templatePath ?? PATH2.join(cwd5, "scripts", "README.template.md");
|
|
517
|
+
const resolvedTemplatePath = resolveTemplatePath(templatePath);
|
|
428
518
|
let template;
|
|
519
|
+
let templateCreated;
|
|
429
520
|
try {
|
|
430
|
-
template = await
|
|
521
|
+
({ template, created: templateCreated } = await loadOrCreateTemplate(resolvedTemplatePath));
|
|
431
522
|
} catch {
|
|
432
|
-
console.error(chalk5.red(`Template not found: ${resolvedTemplatePath}`));
|
|
433
523
|
return 1;
|
|
434
524
|
}
|
|
435
|
-
|
|
525
|
+
template = applyLogoConfig(template, logoUrl, logoLinkUrl);
|
|
526
|
+
if (templateCreated) {
|
|
527
|
+
console.log(chalk5.green("Generating README files for all packages..."));
|
|
528
|
+
}
|
|
529
|
+
const xyDir = PATH2.dirname(resolvedTemplatePath);
|
|
530
|
+
const xyBodyPath = PATH2.join(xyDir, "README.body.md");
|
|
531
|
+
let defaultBody;
|
|
532
|
+
try {
|
|
533
|
+
defaultBody = await readFile(xyBodyPath, "utf8");
|
|
534
|
+
} catch {
|
|
535
|
+
defaultBody = DEFAULT_README_BODY;
|
|
536
|
+
}
|
|
537
|
+
const workspaces = pkg && !templateCreated ? [yarnWorkspace(pkg)] : yarnWorkspaces();
|
|
436
538
|
let failed = false;
|
|
437
539
|
for (const { location, name } of workspaces) {
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
const pkgJson = JSON.parse(await readFile(pkgJsonPath, "utf8"));
|
|
441
|
-
const typedocContent = typedoc ? generateTypedoc(location, ["src/index*.ts"]) : "";
|
|
442
|
-
const readmeContent = fillTemplate(template, { ...pkgJson, typedoc: typedocContent });
|
|
443
|
-
await writeFile(PATH2.join(location, "README.md"), readmeContent);
|
|
444
|
-
if (verbose) console.log(chalk5.green(` ${name}`));
|
|
445
|
-
} catch (ex) {
|
|
446
|
-
const error = ex;
|
|
447
|
-
console.warn(chalk5.yellow(` Skipped ${location}: ${error.message}`));
|
|
448
|
-
failed = true;
|
|
449
|
-
}
|
|
540
|
+
const success = await generateReadmeForWorkspace(location, name, template, defaultBody, typedoc, verbose);
|
|
541
|
+
if (!success) failed = true;
|
|
450
542
|
}
|
|
451
543
|
return failed ? 1 : 0;
|
|
452
544
|
}
|
|
@@ -473,10 +565,10 @@ var loadConfig = async (params) => {
|
|
|
473
565
|
};
|
|
474
566
|
|
|
475
567
|
// src/lib/parsedPackageJSON.ts
|
|
476
|
-
import { readFileSync as
|
|
568
|
+
import { readFileSync as readFileSync4 } from "fs";
|
|
477
569
|
var parsedPackageJSON = (path14) => {
|
|
478
570
|
const pathToPackageJSON = path14 ?? process.env.npm_package_json ?? "";
|
|
479
|
-
const packageJSON =
|
|
571
|
+
const packageJSON = readFileSync4(pathToPackageJSON).toString();
|
|
480
572
|
return JSON.parse(packageJSON);
|
|
481
573
|
};
|
|
482
574
|
|
|
@@ -591,7 +683,7 @@ import {
|
|
|
591
683
|
existsSync as existsSync4,
|
|
592
684
|
mkdirSync,
|
|
593
685
|
readdirSync as readdirSync2,
|
|
594
|
-
readFileSync as
|
|
686
|
+
readFileSync as readFileSync5,
|
|
595
687
|
unlinkSync,
|
|
596
688
|
writeFileSync as writeFileSync2
|
|
597
689
|
} from "fs";
|
|
@@ -604,7 +696,7 @@ var syncCommandFiles = (commandsDir) => {
|
|
|
604
696
|
let created = 0;
|
|
605
697
|
for (const [filename3, content] of Object.entries(templates)) {
|
|
606
698
|
const targetPath = PATH3.resolve(commandsDir, filename3);
|
|
607
|
-
const existing = existsSync4(targetPath) ?
|
|
699
|
+
const existing = existsSync4(targetPath) ? readFileSync5(targetPath, "utf8") : void 0;
|
|
608
700
|
if (existing === content) continue;
|
|
609
701
|
writeFileSync2(targetPath, content, "utf8");
|
|
610
702
|
if (existing) {
|
|
@@ -661,7 +753,7 @@ import {
|
|
|
661
753
|
existsSync as existsSync5,
|
|
662
754
|
mkdirSync as mkdirSync2,
|
|
663
755
|
readdirSync as readdirSync3,
|
|
664
|
-
readFileSync as
|
|
756
|
+
readFileSync as readFileSync6,
|
|
665
757
|
unlinkSync as unlinkSync2,
|
|
666
758
|
writeFileSync as writeFileSync3
|
|
667
759
|
} from "fs";
|
|
@@ -674,7 +766,7 @@ var syncRuleFiles = (rulesDir) => {
|
|
|
674
766
|
let created = 0;
|
|
675
767
|
for (const [filename3, content] of Object.entries(templates)) {
|
|
676
768
|
const targetPath = PATH4.resolve(rulesDir, filename3);
|
|
677
|
-
const existing = existsSync5(targetPath) ?
|
|
769
|
+
const existing = existsSync5(targetPath) ? readFileSync6(targetPath, "utf8") : void 0;
|
|
678
770
|
if (existing === content) continue;
|
|
679
771
|
writeFileSync3(targetPath, content, "utf8");
|
|
680
772
|
if (existing) {
|
|
@@ -746,7 +838,7 @@ import {
|
|
|
746
838
|
writeFileSync as writeFileSync4
|
|
747
839
|
} from "fs";
|
|
748
840
|
import PATH5 from "path";
|
|
749
|
-
import { createInterface } from "readline";
|
|
841
|
+
import { createInterface as createInterface2 } from "readline";
|
|
750
842
|
import chalk12 from "chalk";
|
|
751
843
|
var DEFAULT_SETTINGS = {
|
|
752
844
|
permissions: {
|
|
@@ -781,8 +873,8 @@ var DEFAULT_SETTINGS = {
|
|
|
781
873
|
]
|
|
782
874
|
}
|
|
783
875
|
};
|
|
784
|
-
function
|
|
785
|
-
const rl =
|
|
876
|
+
function askConfirmation2(question) {
|
|
877
|
+
const rl = createInterface2({ input: process.stdin, output: process.stdout });
|
|
786
878
|
return new Promise((resolve) => {
|
|
787
879
|
rl.question(question, (answer) => {
|
|
788
880
|
rl.close();
|
|
@@ -796,7 +888,7 @@ async function claudeSettings() {
|
|
|
796
888
|
const settingsPath = PATH5.resolve(claudeDir, "settings.local.json");
|
|
797
889
|
mkdirSync3(claudeDir, { recursive: true });
|
|
798
890
|
if (existsSync6(settingsPath)) {
|
|
799
|
-
const confirmed = await
|
|
891
|
+
const confirmed = await askConfirmation2(
|
|
800
892
|
chalk12.yellow(`${settingsPath} already exists. Replace it? (y/N) `)
|
|
801
893
|
);
|
|
802
894
|
if (!confirmed) {
|
|
@@ -1722,11 +1814,11 @@ var deplint = async ({
|
|
|
1722
1814
|
};
|
|
1723
1815
|
|
|
1724
1816
|
// src/actions/deploy.ts
|
|
1725
|
-
import { readFileSync as
|
|
1817
|
+
import { readFileSync as readFileSync7 } from "fs";
|
|
1726
1818
|
var privatePackageExcludeList = () => {
|
|
1727
1819
|
const possibleDeployablePackages = yarnWorkspaces().map((workspace) => [
|
|
1728
1820
|
workspace,
|
|
1729
|
-
JSON.parse(
|
|
1821
|
+
JSON.parse(readFileSync7(`${workspace.location}/package.json`, { encoding: "utf8" }))
|
|
1730
1822
|
]);
|
|
1731
1823
|
const privatePackages = possibleDeployablePackages.filter(([_, pkg]) => pkg.private).map(([workspace]) => workspace);
|
|
1732
1824
|
const excludeList = privatePackages.map((workspace) => `--exclude ${workspace.name}`);
|
|
@@ -1746,11 +1838,11 @@ var deploy = () => {
|
|
|
1746
1838
|
};
|
|
1747
1839
|
|
|
1748
1840
|
// src/actions/deploy-major.ts
|
|
1749
|
-
import { readFileSync as
|
|
1841
|
+
import { readFileSync as readFileSync8 } from "fs";
|
|
1750
1842
|
var privatePackageExcludeList2 = () => {
|
|
1751
1843
|
const possibleDeployablePackages = yarnWorkspaces().map((workspace) => [
|
|
1752
1844
|
workspace,
|
|
1753
|
-
JSON.parse(
|
|
1845
|
+
JSON.parse(readFileSync8(`${workspace.location}/package.json`, { encoding: "utf8" }))
|
|
1754
1846
|
]);
|
|
1755
1847
|
const privatePackages = possibleDeployablePackages.filter(([_, pkg]) => pkg.private).map(([workspace]) => workspace);
|
|
1756
1848
|
const excludeList = privatePackages.map((workspace) => `--exclude ${workspace.name}`);
|
|
@@ -1770,11 +1862,11 @@ var deployMajor = () => {
|
|
|
1770
1862
|
};
|
|
1771
1863
|
|
|
1772
1864
|
// src/actions/deploy-minor.ts
|
|
1773
|
-
import { readFileSync as
|
|
1865
|
+
import { readFileSync as readFileSync9 } from "fs";
|
|
1774
1866
|
var privatePackageExcludeList3 = () => {
|
|
1775
1867
|
const possibleDeployablePackages = yarnWorkspaces().map((workspace) => [
|
|
1776
1868
|
workspace,
|
|
1777
|
-
JSON.parse(
|
|
1869
|
+
JSON.parse(readFileSync9(`${workspace.location}/package.json`, { encoding: "utf8" }))
|
|
1778
1870
|
]);
|
|
1779
1871
|
const privatePackages = possibleDeployablePackages.filter(([_, pkg]) => pkg.private).map(([workspace]) => workspace);
|
|
1780
1872
|
const excludeList = privatePackages.map((workspace) => `--exclude ${workspace.name}`);
|
|
@@ -1794,11 +1886,11 @@ var deployMinor = () => {
|
|
|
1794
1886
|
};
|
|
1795
1887
|
|
|
1796
1888
|
// src/actions/deploy-next.ts
|
|
1797
|
-
import { readFileSync as
|
|
1889
|
+
import { readFileSync as readFileSync10 } from "fs";
|
|
1798
1890
|
var privatePackageExcludeList4 = () => {
|
|
1799
1891
|
const possibleDeployablePackages = yarnWorkspaces().map((workspace) => [
|
|
1800
1892
|
workspace,
|
|
1801
|
-
JSON.parse(
|
|
1893
|
+
JSON.parse(readFileSync10(`${workspace.location}/package.json`, { encoding: "utf8" }))
|
|
1802
1894
|
]);
|
|
1803
1895
|
const privatePackages = possibleDeployablePackages.filter(([_, pkg]) => pkg.private).map(([workspace]) => workspace);
|
|
1804
1896
|
const excludeList = privatePackages.map((workspace) => `--exclude ${workspace.name}`);
|
|
@@ -2842,7 +2934,10 @@ async function readmeGen({
|
|
|
2842
2934
|
typedoc,
|
|
2843
2935
|
verbose
|
|
2844
2936
|
}) {
|
|
2937
|
+
const config2 = await loadConfig();
|
|
2845
2938
|
return await generateReadmeFiles({
|
|
2939
|
+
logoLinkUrl: config2.readme?.logoLinkUrl,
|
|
2940
|
+
logoUrl: config2.readme?.logoUrl,
|
|
2846
2941
|
pkg,
|
|
2847
2942
|
templatePath,
|
|
2848
2943
|
typedoc,
|
|
@@ -2850,6 +2945,15 @@ async function readmeGen({
|
|
|
2850
2945
|
});
|
|
2851
2946
|
}
|
|
2852
2947
|
|
|
2948
|
+
// src/actions/readme-init.ts
|
|
2949
|
+
async function readmeInit({ templatePath }) {
|
|
2950
|
+
const config2 = await loadConfig();
|
|
2951
|
+
const template = applyLogoConfig(DEFAULT_README_TEMPLATE, config2.readme?.logoUrl, config2.readme?.logoLinkUrl);
|
|
2952
|
+
const resolvedTemplatePath = resolveTemplatePath(templatePath);
|
|
2953
|
+
await scaffoldTemplate(resolvedTemplatePath, template);
|
|
2954
|
+
return 0;
|
|
2955
|
+
}
|
|
2956
|
+
|
|
2853
2957
|
// src/actions/rebuild.ts
|
|
2854
2958
|
var rebuild = ({ target }) => {
|
|
2855
2959
|
return runSteps("Rebuild", [
|
|
@@ -3006,8 +3110,8 @@ var relintAllPackages = ({ fix: fix2 = false } = {}) => {
|
|
|
3006
3110
|
// src/actions/retest.ts
|
|
3007
3111
|
var retest = () => {
|
|
3008
3112
|
return runSteps("Test", [
|
|
3009
|
-
["yarn", ["
|
|
3010
|
-
["yarn", ["
|
|
3113
|
+
["yarn", ["vitest", "--clearCache"]],
|
|
3114
|
+
["yarn", ["vitest", "."]]
|
|
3011
3115
|
]);
|
|
3012
3116
|
};
|
|
3013
3117
|
|
|
@@ -3122,6 +3226,7 @@ export {
|
|
|
3122
3226
|
publintPackage,
|
|
3123
3227
|
publish,
|
|
3124
3228
|
readmeGen,
|
|
3229
|
+
readmeInit,
|
|
3125
3230
|
rebuild,
|
|
3126
3231
|
recompile,
|
|
3127
3232
|
recompileAll,
|