@xylabs/ts-scripts-yarn3 4.2.5 → 5.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (136) hide show
  1. package/dist/actions/build.mjs +1 -1
  2. package/dist/actions/build.mjs.map +1 -1
  3. package/dist/actions/clean-jest.mjs +1 -1
  4. package/dist/actions/clean-jest.mjs.map +1 -1
  5. package/dist/actions/clean.mjs +1 -1
  6. package/dist/actions/clean.mjs.map +1 -1
  7. package/dist/actions/compile.mjs +1 -1
  8. package/dist/actions/compile.mjs.map +1 -1
  9. package/dist/actions/dead.mjs +1 -1
  10. package/dist/actions/dead.mjs.map +1 -1
  11. package/dist/actions/deploy-major.mjs +1 -1
  12. package/dist/actions/deploy-major.mjs.map +1 -1
  13. package/dist/actions/deploy-minor.mjs +1 -1
  14. package/dist/actions/deploy-minor.mjs.map +1 -1
  15. package/dist/actions/deploy-next.mjs +1 -1
  16. package/dist/actions/deploy-next.mjs.map +1 -1
  17. package/dist/actions/deploy.mjs +1 -1
  18. package/dist/actions/deploy.mjs.map +1 -1
  19. package/dist/actions/deps.mjs +1 -1
  20. package/dist/actions/deps.mjs.map +1 -1
  21. package/dist/actions/dupdeps.mjs +1 -1
  22. package/dist/actions/dupdeps.mjs.map +1 -1
  23. package/dist/actions/fix.mjs +1 -1
  24. package/dist/actions/fix.mjs.map +1 -1
  25. package/dist/actions/gen-docs.mjs +1 -1
  26. package/dist/actions/gen-docs.mjs.map +1 -1
  27. package/dist/actions/gitignore-gen.mjs +2 -1
  28. package/dist/actions/gitignore-gen.mjs.map +1 -1
  29. package/dist/actions/index.mjs +15 -12
  30. package/dist/actions/index.mjs.map +1 -1
  31. package/dist/actions/license.mjs +2 -4
  32. package/dist/actions/license.mjs.map +1 -1
  33. package/dist/actions/lint-clean.mjs +3 -3
  34. package/dist/actions/lint-clean.mjs.map +1 -1
  35. package/dist/actions/lint-profile.mjs +1 -1
  36. package/dist/actions/lint-profile.mjs.map +1 -1
  37. package/dist/actions/lint.mjs +1 -1
  38. package/dist/actions/lint.mjs.map +1 -1
  39. package/dist/actions/npmignore-gen.mjs +2 -1
  40. package/dist/actions/npmignore-gen.mjs.map +1 -1
  41. package/dist/actions/package/clean-outputs.mjs +4 -2
  42. package/dist/actions/package/clean-outputs.mjs.map +1 -1
  43. package/dist/actions/package/clean-typescript.mjs +4 -2
  44. package/dist/actions/package/clean-typescript.mjs.map +1 -1
  45. package/dist/actions/package/clean.mjs +8 -4
  46. package/dist/actions/package/clean.mjs.map +1 -1
  47. package/dist/actions/package/index.mjs +8 -4
  48. package/dist/actions/package/index.mjs.map +1 -1
  49. package/dist/actions/package/recompile.mjs +8 -4
  50. package/dist/actions/package/recompile.mjs.map +1 -1
  51. package/dist/actions/publint.mjs +1 -1
  52. package/dist/actions/publint.mjs.map +1 -1
  53. package/dist/actions/rebuild.mjs +1 -1
  54. package/dist/actions/rebuild.mjs.map +1 -1
  55. package/dist/actions/recompile.mjs +1 -1
  56. package/dist/actions/recompile.mjs.map +1 -1
  57. package/dist/actions/reinstall.mjs +1 -1
  58. package/dist/actions/reinstall.mjs.map +1 -1
  59. package/dist/actions/relint.mjs +1 -1
  60. package/dist/actions/relint.mjs.map +1 -1
  61. package/dist/actions/retest.mjs +1 -1
  62. package/dist/actions/retest.mjs.map +1 -1
  63. package/dist/actions/sonar.mjs +1 -1
  64. package/dist/actions/sonar.mjs.map +1 -1
  65. package/dist/actions/statics.mjs +1 -1
  66. package/dist/actions/statics.mjs.map +1 -1
  67. package/dist/actions/test.mjs +1 -1
  68. package/dist/actions/test.mjs.map +1 -1
  69. package/dist/actions/up.mjs +1 -1
  70. package/dist/actions/up.mjs.map +1 -1
  71. package/dist/actions/updo.mjs +1 -1
  72. package/dist/actions/updo.mjs.map +1 -1
  73. package/dist/actions/upplug.mjs +1 -1
  74. package/dist/actions/upplug.mjs.map +1 -1
  75. package/dist/actions/upyarn.mjs +1 -1
  76. package/dist/actions/upyarn.mjs.map +1 -1
  77. package/dist/actions/yarn3only.mjs +1 -1
  78. package/dist/actions/yarn3only.mjs.map +1 -1
  79. package/dist/bin/package/clean-outputs.mjs +4 -2
  80. package/dist/bin/package/clean-outputs.mjs.map +1 -1
  81. package/dist/bin/package/clean-typescript.mjs +4 -2
  82. package/dist/bin/package/clean-typescript.mjs.map +1 -1
  83. package/dist/bin/package/clean.mjs +8 -4
  84. package/dist/bin/package/clean.mjs.map +1 -1
  85. package/dist/bin/package/recompile.mjs +8 -4
  86. package/dist/bin/package/recompile.mjs.map +1 -1
  87. package/dist/bin/xy-ts.mjs +5 -6
  88. package/dist/bin/xy-ts.mjs.map +1 -1
  89. package/dist/bin/xy.mjs +5 -6
  90. package/dist/bin/xy.mjs.map +1 -1
  91. package/dist/index.d.ts +3 -3
  92. package/dist/index.mjs +15 -12
  93. package/dist/index.mjs.map +1 -1
  94. package/dist/lib/dependencies/detectDuplicateDependencies.mjs +1 -1
  95. package/dist/lib/dependencies/detectDuplicateDependencies.mjs.map +1 -1
  96. package/dist/lib/dependencies/index.mjs +1 -1
  97. package/dist/lib/dependencies/index.mjs.map +1 -1
  98. package/dist/lib/generateIgnoreFiles.mjs +2 -1
  99. package/dist/lib/generateIgnoreFiles.mjs.map +1 -1
  100. package/dist/lib/index.mjs +3 -2
  101. package/dist/lib/index.mjs.map +1 -1
  102. package/dist/lib/processEx.mjs +1 -1
  103. package/dist/lib/processEx.mjs.map +1 -1
  104. package/dist/lib/runSteps.mjs +1 -1
  105. package/dist/lib/runSteps.mjs.map +1 -1
  106. package/dist/lib/runStepsAsync.mjs +1 -1
  107. package/dist/lib/runStepsAsync.mjs.map +1 -1
  108. package/dist/lib/runXy.mjs +1 -1
  109. package/dist/lib/runXy.mjs.map +1 -1
  110. package/dist/lib/safeExit.mjs +1 -1
  111. package/dist/lib/safeExit.mjs.map +1 -1
  112. package/dist/lib/withErrnoException.mjs +1 -1
  113. package/dist/lib/withErrnoException.mjs.map +1 -1
  114. package/dist/lib/withError.mjs +1 -1
  115. package/dist/lib/withError.mjs.map +1 -1
  116. package/dist/xy/index.mjs +5 -6
  117. package/dist/xy/index.mjs.map +1 -1
  118. package/dist/xy/xy.mjs +5 -6
  119. package/dist/xy/xy.mjs.map +1 -1
  120. package/dist/xy/xyBuildCommands.mjs +1 -1
  121. package/dist/xy/xyBuildCommands.mjs.map +1 -1
  122. package/dist/xy/xyCommonCommands.mjs +5 -6
  123. package/dist/xy/xyCommonCommands.mjs.map +1 -1
  124. package/dist/xy/xyDeployCommands.mjs +1 -1
  125. package/dist/xy/xyDeployCommands.mjs.map +1 -1
  126. package/dist/xy/xyInstallCommands.mjs +1 -1
  127. package/dist/xy/xyInstallCommands.mjs.map +1 -1
  128. package/dist/xy/xyLintCommands.mjs +1 -1
  129. package/dist/xy/xyLintCommands.mjs.map +1 -1
  130. package/package.json +20 -20
  131. package/src/actions/license.ts +4 -4
  132. package/src/actions/lint-clean.ts +2 -2
  133. package/src/actions/package/clean-outputs.ts +4 -2
  134. package/src/actions/package/clean-typescript.ts +4 -2
  135. package/src/lib/generateIgnoreFiles.ts +3 -1
  136. package/src/lib/withError.ts +1 -1
@@ -70,10 +70,8 @@ var license = /* @__PURE__ */ __name(async (pkg) => {
70
70
  ];
71
71
  for (let license2 of licenses) {
72
72
  if (license2) {
73
- if (license2[0] === "(" && license2.at(-1) === ")") {
74
- license2 = license2.slice(1, -2);
75
- }
76
- const orLicenses = license2.split(" OR ");
73
+ const processedLicense = license2[0] === "(" && license2.at(-1) === ")" ? license2.slice(1, -2) : license2;
74
+ const orLicenses = processedLicense.split(" OR ");
77
75
  let orLicenseFound = false;
78
76
  for (const orLicense of orLicenses) {
79
77
  if (exclude.has(orLicense)) {
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/actions/license.ts","../../src/lib/yarn/workspace/yarnWorkspaces.ts"],"sourcesContent":["import chalk from 'chalk'\nimport { init } from 'license-checker'\n\nimport { yarnWorkspaces } from '../lib/index.ts'\n\nexport const license = async (pkg?: string) => {\n const workspaces = yarnWorkspaces()\n const workspaceList = workspaces.filter(({ name }) => {\n return pkg === undefined || name === pkg\n })\n\n const exclude = new Set([\n 'MIT',\n 'MIT*',\n 'ISC',\n 'Apache-2.0',\n 'BSD',\n 'BSD*',\n 'BSD-2-Clause',\n 'BSD-3-Clause',\n 'CC-BY-4.0',\n 'Unlicense',\n 'CC-BY-3.0',\n 'CC0-1.0',\n 'LGPL-3.0-only',\n 'LGPL-3.0',\n 'LGPL-3.0-or-later',\n 'Python-2.0',\n ])\n\n console.log(chalk.green('License Checker'))\n\n return (\n (\n await Promise.all(\n workspaceList.map(({ location, name }) => {\n return new Promise<number>((resolve) => {\n init({ production: true, start: location }, (error, packages) => {\n if (error) {\n console.error(chalk.red(`License Checker [${name}] Error`))\n console.error(chalk.gray(error))\n console.log('\\n')\n resolve(1)\n } else {\n console.log(chalk.green(`License Checker [${name}]`))\n let count = 0\n for (const [name, info] of Object.entries(packages)) {\n const licenses = Array.isArray(info.licenses) ? info.licenses : [info.licenses]\n for (let license of licenses) {\n if (license) {\n // remove surrounding parens on some string\n if (license[0] === '(' && license.at(-1) === ')') {\n license = license.slice(1, -2)\n }\n // get list of OR licenses from string\n const orLicenses = license.split(' OR ')\n let orLicenseFound = false\n for (const orLicense of orLicenses) {\n if (exclude.has(orLicense)) {\n orLicenseFound = true\n }\n }\n if (!orLicenseFound) {\n count++\n console.warn(chalk.yellow(`${name}: Package License not allowed [${license}]`))\n }\n }\n }\n }\n console.log('\\n')\n resolve(count)\n }\n })\n })\n }),\n )\n )\n // eslint-disable-next-line unicorn/no-array-reduce\n .reduce((prev, value) => prev || value, 0)\n )\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 //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AO;AACLR,kBAAQC,IAAIC,MAAMC,MAAM,oBAAoBP,IAAAA,GAAO,CAAA;AACnD,cAAIoB,QAAQ;AACZ,qBAAW,CAACpB,OAAMqB,IAAAA,KAASC,OAAOC,QAAQN,QAAAA,GAAW;AACnD,kBAAMO,WAAWC,MAAMC,QAAQL,KAAKG,QAAQ,IAAIH,KAAKG,WAAW;cAACH,KAAKG;;AACtE,qBAAS9B,YAAW8B,UAAU;AAC5B,kBAAI9B,UAAS;AAEX,oBAAIA,SAAQ,CAAA,MAAO,OAAOA,SAAQiC,GAAG,EAAC,MAAO,KAAK;AAChDjC,kBAAAA,WAAUA,SAAQkC,MAAM,GAAG,EAAC;gBAC9B;AAEA,sBAAMC,aAAanC,SAAQoC,MAAM,MAAA;AACjC,oBAAIC,iBAAiB;AACrB,2BAAWC,aAAaH,YAAY;AAClC,sBAAI3B,QAAQ+B,IAAID,SAAAA,GAAY;AAC1BD,qCAAiB;kBACnB;gBACF;AACA,oBAAI,CAACA,gBAAgB;AACnBX;AACAhB,0BAAQ8B,KAAK5B,MAAM6B,OAAO,GAAGnC,KAAAA,kCAAsCN,QAAAA,GAAU,CAAA;gBAC/E;cACF;YACF;UACF;AACAU,kBAAQC,IAAI,IAAA;AACZO,kBAAQQ,KAAAA;QACV;MACF,CAAA;IACF,CAAA;EACF,CAAA,CAAA,GAIDgB,OAAO,CAACC,MAAMC,UAAUD,QAAQC,OAAO,CAAA;AAE9C,GA3EuB;","names":["chalk","init","spawnSync","yarnWorkspaces","result","spawnSync","encoding","shell","error","stdout","toString","split","slice","map","item","JSON","parse","license","pkg","workspaces","yarnWorkspaces","workspaceList","filter","name","undefined","exclude","Set","console","log","chalk","green","Promise","all","map","location","resolve","init","production","start","error","packages","red","gray","count","info","Object","entries","licenses","Array","isArray","at","slice","orLicenses","split","orLicenseFound","orLicense","has","warn","yellow","reduce","prev","value"]}
1
+ {"version":3,"sources":["../../src/actions/license.ts","../../src/lib/yarn/workspace/yarnWorkspaces.ts"],"sourcesContent":["import chalk from 'chalk'\nimport { init } from 'license-checker'\n\nimport { yarnWorkspaces } from '../lib/index.ts'\n\nexport const license = async (pkg?: string) => {\n const workspaces = yarnWorkspaces()\n const workspaceList = workspaces.filter(({ name }) => {\n return pkg === undefined || name === pkg\n })\n\n const exclude = new Set([\n 'MIT',\n 'MIT*',\n 'ISC',\n 'Apache-2.0',\n 'BSD',\n 'BSD*',\n 'BSD-2-Clause',\n 'BSD-3-Clause',\n 'CC-BY-4.0',\n 'Unlicense',\n 'CC-BY-3.0',\n 'CC0-1.0',\n 'LGPL-3.0-only',\n 'LGPL-3.0',\n 'LGPL-3.0-or-later',\n 'Python-2.0',\n ])\n\n console.log(chalk.green('License Checker'))\n\n return (\n (\n await Promise.all(\n workspaceList.map(({ location, name }) => {\n return new Promise<number>((resolve) => {\n init({ production: true, start: location }, (error, packages) => {\n if (error) {\n console.error(chalk.red(`License Checker [${name}] Error`))\n console.error(chalk.gray(error))\n console.log('\\n')\n resolve(1)\n } else {\n console.log(chalk.green(`License Checker [${name}]`))\n let count = 0\n for (const [name, info] of Object.entries(packages)) {\n const licenses = Array.isArray(info.licenses) ? info.licenses : [info.licenses]\n for (let license of licenses) {\n if (license) {\n // remove surrounding parens on some string\n const processedLicense = (license[0] === '(' && license.at(-1) === ')')\n ? license.slice(1, -2)\n : license\n // get list of OR licenses from string\n const orLicenses = processedLicense.split(' OR ')\n let orLicenseFound = false\n for (const orLicense of orLicenses) {\n if (exclude.has(orLicense)) {\n orLicenseFound = true\n }\n }\n if (!orLicenseFound) {\n count++\n console.warn(chalk.yellow(`${name}: Package License not allowed [${license}]`))\n }\n }\n }\n }\n console.log('\\n')\n resolve(count)\n }\n })\n })\n }),\n )\n )\n // eslint-disable-next-line unicorn/no-array-reduce\n .reduce((prev, value) => prev || value, 0)\n )\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"],"mappings":";;;;AAAA,OAAOA,WAAW;AAClB,SAASC,YAAY;;;ACDrB,SAASC,iBAAiB;AAInB,IAAMC,iBAAiB,6BAAA;AAC5B,QAAMC,SAASC,UAAU,QAAQ;IAAC;IAAc;IAAQ;IAAU;KAAgB;IAAEC,UAAU;IAAQC,OAAO;EAAK,CAAA;AAClH,MAAIH,OAAOI,OAAO;AAChB,UAAMJ,OAAOI;EACf;AACA,SACEJ,OAAOK,OACJC,SAAQ,EAGRC,MAAM,IAAA,EACNC,MAAM,GAAG,EAAC,EACVC,IAAI,CAACC,SAAAA;AACJ,WAAOC,KAAKC,MAAMF,IAAAA;EACpB,CAAA;AAEN,GAhB8B;;;ADCvB,IAAMG,UAAU,8BAAOC,QAAAA;AAC5B,QAAMC,aAAaC,eAAAA;AACnB,QAAMC,gBAAgBF,WAAWG,OAAO,CAAC,EAAEC,KAAI,MAAE;AAC/C,WAAOL,QAAQM,UAAaD,SAASL;EACvC,CAAA;AAEA,QAAMO,UAAU,oBAAIC,IAAI;IACtB;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;GACD;AAEDC,UAAQC,IAAIC,MAAMC,MAAM,iBAAA,CAAA;AAExB,UAEI,MAAMC,QAAQC,IACZX,cAAcY,IAAI,CAAC,EAAEC,UAAUX,KAAI,MAAE;AACnC,WAAO,IAAIQ,QAAgB,CAACI,YAAAA;AAC1BC,WAAK;QAAEC,YAAY;QAAMC,OAAOJ;MAAS,GAAG,CAACK,OAAOC,aAAAA;AAClD,YAAID,OAAO;AACTZ,kBAAQY,MAAMV,MAAMY,IAAI,oBAAoBlB,IAAAA,SAAa,CAAA;AACzDI,kBAAQY,MAAMV,MAAMa,KAAKH,KAAAA,CAAAA;AACzBZ,kBAAQC,IAAI,IAAA;AACZO,kBAAQ,CAAA;QACV,OAAO;AACLR,kBAAQC,IAAIC,MAAMC,MAAM,oBAAoBP,IAAAA,GAAO,CAAA;AACnD,cAAIoB,QAAQ;AACZ,qBAAW,CAACpB,OAAMqB,IAAAA,KAASC,OAAOC,QAAQN,QAAAA,GAAW;AACnD,kBAAMO,WAAWC,MAAMC,QAAQL,KAAKG,QAAQ,IAAIH,KAAKG,WAAW;cAACH,KAAKG;;AACtE,qBAAS9B,YAAW8B,UAAU;AAC5B,kBAAI9B,UAAS;AAEX,sBAAMiC,mBAAoBjC,SAAQ,CAAA,MAAO,OAAOA,SAAQkC,GAAG,EAAC,MAAO,MAC/DlC,SAAQmC,MAAM,GAAG,EAAC,IAClBnC;AAEJ,sBAAMoC,aAAaH,iBAAiBI,MAAM,MAAA;AAC1C,oBAAIC,iBAAiB;AACrB,2BAAWC,aAAaH,YAAY;AAClC,sBAAI5B,QAAQgC,IAAID,SAAAA,GAAY;AAC1BD,qCAAiB;kBACnB;gBACF;AACA,oBAAI,CAACA,gBAAgB;AACnBZ;AACAhB,0BAAQ+B,KAAK7B,MAAM8B,OAAO,GAAGpC,KAAAA,kCAAsCN,QAAAA,GAAU,CAAA;gBAC/E;cACF;YACF;UACF;AACAU,kBAAQC,IAAI,IAAA;AACZO,kBAAQQ,KAAAA;QACV;MACF,CAAA;IACF,CAAA;EACF,CAAA,CAAA,GAIDiB,OAAO,CAACC,MAAMC,UAAUD,QAAQC,OAAO,CAAA;AAE9C,GA3EuB;","names":["chalk","init","spawnSync","yarnWorkspaces","result","spawnSync","encoding","shell","error","stdout","toString","split","slice","map","item","JSON","parse","license","pkg","workspaces","yarnWorkspaces","workspaceList","filter","name","undefined","exclude","Set","console","log","chalk","green","Promise","all","map","location","resolve","init","production","start","error","packages","red","gray","count","info","Object","entries","licenses","Array","isArray","processedLicense","at","slice","orLicenses","split","orLicenseFound","orLicense","has","warn","yellow","reduce","prev","value"]}
@@ -21,7 +21,7 @@ var checkResult = /* @__PURE__ */ __name((name, result, level = "error", exitOnF
21
21
  import chalk2 from "chalk";
22
22
 
23
23
  // src/lib/withError.ts
24
- var withError = /* @__PURE__ */ __name((ex, closure, predicate = (ex2) => ex2.name !== void 0 && ex2.message !== void 0) => {
24
+ var withError = /* @__PURE__ */ __name((ex, closure, predicate = (ex2) => !!ex2.name && !!ex2.message) => {
25
25
  return predicate(ex) ? closure(ex) : void 0;
26
26
  }, "withError");
27
27
 
@@ -169,7 +169,7 @@ var lint = /* @__PURE__ */ __name(async ({ pkg } = {}) => {
169
169
  }, "lint");
170
170
 
171
171
  // src/actions/lint-clean.ts
172
- var lintClean = /* @__PURE__ */ __name(() => {
172
+ var lintClean = /* @__PURE__ */ __name(async () => {
173
173
  console.log("Lint Clean [.eslintcache]");
174
174
  const workspaces = yarnWorkspaces();
175
175
  const result = workspaces.map(({ location, name }) => {
@@ -186,7 +186,7 @@ var lintClean = /* @__PURE__ */ __name(() => {
186
186
  return 1;
187
187
  }
188
188
  }).reduce((prev, result2) => prev || result2, 0);
189
- return result || lint();
189
+ return result || await lint();
190
190
  }, "lintClean");
191
191
  export {
192
192
  lintClean
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/actions/lint-clean.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/actions/lint.ts"],"sourcesContent":["import { rmSync } from 'node:fs'\n\nimport { yarnWorkspaces } from '../lib/index.ts'\nimport { lint } from './lint.ts'\n\nexport const lintClean = () => {\n console.log('Lint Clean [.eslintcache]')\n const workspaces = yarnWorkspaces()\n const result = workspaces\n .map(({ location, name }) => {\n const dist = `${location}/.eslintcache`\n try {\n rmSync(dist, { force: true, recursive: true })\n return 0\n } catch (ex) {\n const error = ex as Error\n console.error(`Lint Clean [.eslintcache] Failed [${name}, ${error.message}]`)\n return 1\n }\n })\n // eslint-disable-next-line unicorn/no-array-reduce\n .reduce((prev, result) => prev || result, 0)\n return result || lint()\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 !== undefined && ex.message !== undefined,\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' | 'jest', /* 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'\nimport { ESLint } from 'eslint'\n\nimport { runSteps, yarnWorkspaces } from '../lib/index.ts'\n\nexport interface LintParams {\n pkg?: string\n verbose?: boolean\n}\n\nexport interface LintPackageParams {\n pkg: string\n verbose?: boolean\n}\n\nconst dumpMessages = (lintResults: ESLint.LintResult[]) => {\n const colors: ('white' | 'red' | 'yellow')[] = ['white', 'yellow', 'red']\n const severity: string[] = ['none', 'warning', 'error']\n\n for (const lintResult of lintResults) {\n if (lintResult.messages.length > 0) {\n console.log(chalk.gray(`${lintResult.filePath}`))\n for (const message of lintResult.messages) {\n console.log(\n chalk.gray(`\\t${message.line}:${message.column}`),\n chalk[colors[message.severity]](`\\t${severity[message.severity]}`),\n chalk.white(`\\t${message.message}`),\n chalk.gray(`\\t${message.ruleId}`),\n )\n }\n }\n }\n}\n\nexport const lintPackage = async ({ pkg }: LintParams) => {\n const workspace = yarnWorkspaces().find(workspace => workspace.name === pkg)\n if (!workspace) {\n console.error(chalk.red(`Unable to locate package [${chalk.magenta(pkg)}]`))\n process.exit(1)\n }\n\n const engine = new ESLint({ cache: true })\n\n const lintResults = await engine.lintFiles(workspace.location)\n\n dumpMessages(lintResults)\n\n return lintResults.reduce((prev, lintResult) => prev + lintResult.errorCount, 0)\n}\n\nexport const lintAll = async () => {\n const engine = new ESLint({ cache: true })\n\n const lintResults = await engine.lintFiles('./**/*.*')\n\n dumpMessages(lintResults)\n\n return lintResults.reduce((prev, lintResult) => prev + lintResult.errorCount, 0)\n}\n\nexport const lint = async ({ pkg }: LintParams = {}) => {\n return pkg ? await lintPackage({ pkg }) : runSteps('Lint-Caching [All]', [['yarn', ['eslint', '.', '--cache']]])\n}\n"],"mappings":";;;;AAAA,SAASA,cAAc;;;ACAvB,OAAOC,WAAW;AAEX,IAAMC,cAAc,wBAACC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AAKF,CAAAA,eAAaA,WAAUG,SAASJ,GAAAA;AACxE,MAAI,CAACC,WAAW;AACdZ,YAAQgB,MAAMd,OAAMe,IAAI,6BAA6Bf,OAAMgB,QAAQP,GAAAA,CAAAA,GAAO,CAAA;AAC1EQ,YAAQC,KAAK,CAAA;EACf;AAEA,QAAMC,SAAS,IAAIC,OAAO;IAAEC,OAAO;EAAK,CAAA;AAExC,QAAM7B,cAAc,MAAM2B,OAAOG,UAAUZ,UAAUa,QAAQ;AAE7DhC,eAAaC,WAAAA;AAEb,SAAOA,YAAYgC,OAAO,CAACC,MAAM9B,eAAe8B,OAAO9B,WAAW+B,YAAY,CAAA;AAChF,GAd2B;AA0BpB,IAAMC,OAAO,8BAAO,EAAEC,IAAG,IAAiB,CAAC,MAAC;AACjD,SAAOA,MAAM,MAAMC,YAAY;IAAED;EAAI,CAAA,IAAKE,SAAS,sBAAsB;IAAC;MAAC;MAAQ;QAAC;QAAU;QAAK;;;GAAY;AACjH,GAFoB;;;ARvDb,IAAMC,YAAY,6BAAA;AACvBC,UAAQC,IAAI,2BAAA;AACZ,QAAMC,aAAaC,eAAAA;AACnB,QAAMC,SAASF,WACZG,IAAI,CAAC,EAAEC,UAAUC,KAAI,MAAE;AACtB,UAAMC,OAAO,GAAGF,QAAAA;AAChB,QAAI;AACFG,aAAOD,MAAM;QAAEE,OAAO;QAAMC,WAAW;MAAK,CAAA;AAC5C,aAAO;IACT,SAASC,IAAI;AACX,YAAMC,QAAQD;AACdZ,cAAQa,MAAM,qCAAqCN,IAAAA,KAASM,MAAMC,OAAO,GAAG;AAC5E,aAAO;IACT;EACF,CAAA,EAECC,OAAO,CAACC,MAAMZ,YAAWY,QAAQZ,SAAQ,CAAA;AAC5C,SAAOA,UAAUa,KAAAA;AACnB,GAlByB;","names":["rmSync","chalk","checkResult","name","result","level","exitOnFail","exiting","chalkFunc","chalk","red","yellow","console","process","exit","chalk","withError","ex","closure","predicate","name","undefined","message","withErrnoException","ex","closure","withError","errno","undefined","processEx","ex","error","Error","exitCode","withErrnoException","code","console","chalk","red","path","errno","withError","name","message","JSON","stringify","process","exit","safeExit","func","exitOnFail","result","process","exit","ex","processEx","spawnSync","yarnWorkspaces","result","spawnSync","encoding","shell","error","stdout","toString","split","slice","map","item","JSON","parse","spawnSync","existsSync","chalk","runSteps","name","steps","exitOnFail","messages","safeExit","pkgName","process","env","npm_package_name","console","log","chalk","green","totalStatus","i","command","args","config","entries","gray","argList","Array","isArray","split","existsSync","Error","status","spawnSync","encoding","FORCE_COLOR","shell","stdio","checkResult","chalk","ESLint","dumpMessages","lintResults","colors","severity","lintResult","messages","length","console","log","chalk","gray","filePath","message","line","column","white","ruleId","lintPackage","pkg","workspace","yarnWorkspaces","find","name","error","red","magenta","process","exit","engine","ESLint","cache","lintFiles","location","reduce","prev","errorCount","lint","pkg","lintPackage","runSteps","lintClean","console","log","workspaces","yarnWorkspaces","result","map","location","name","dist","rmSync","force","recursive","ex","error","message","reduce","prev","lint"]}
1
+ {"version":3,"sources":["../../src/actions/lint-clean.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/actions/lint.ts"],"sourcesContent":["import { rmSync } from 'node:fs'\n\nimport { yarnWorkspaces } from '../lib/index.ts'\nimport { lint } from './lint.ts'\n\nexport const lintClean = async () => {\n console.log('Lint Clean [.eslintcache]')\n const workspaces = yarnWorkspaces()\n const result = workspaces\n .map(({ location, name }) => {\n const dist = `${location}/.eslintcache`\n try {\n rmSync(dist, { force: true, recursive: true })\n return 0\n } catch (ex) {\n const error = ex as Error\n console.error(`Lint Clean [.eslintcache] Failed [${name}, ${error.message}]`)\n return 1\n }\n })\n // eslint-disable-next-line unicorn/no-array-reduce\n .reduce((prev, result) => prev || result, 0)\n return result || await lint()\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' | 'jest', /* 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'\nimport { ESLint } from 'eslint'\n\nimport { runSteps, yarnWorkspaces } from '../lib/index.ts'\n\nexport interface LintParams {\n pkg?: string\n verbose?: boolean\n}\n\nexport interface LintPackageParams {\n pkg: string\n verbose?: boolean\n}\n\nconst dumpMessages = (lintResults: ESLint.LintResult[]) => {\n const colors: ('white' | 'red' | 'yellow')[] = ['white', 'yellow', 'red']\n const severity: string[] = ['none', 'warning', 'error']\n\n for (const lintResult of lintResults) {\n if (lintResult.messages.length > 0) {\n console.log(chalk.gray(`${lintResult.filePath}`))\n for (const message of lintResult.messages) {\n console.log(\n chalk.gray(`\\t${message.line}:${message.column}`),\n chalk[colors[message.severity]](`\\t${severity[message.severity]}`),\n chalk.white(`\\t${message.message}`),\n chalk.gray(`\\t${message.ruleId}`),\n )\n }\n }\n }\n}\n\nexport const lintPackage = async ({ pkg }: LintParams) => {\n const workspace = yarnWorkspaces().find(workspace => workspace.name === pkg)\n if (!workspace) {\n console.error(chalk.red(`Unable to locate package [${chalk.magenta(pkg)}]`))\n process.exit(1)\n }\n\n const engine = new ESLint({ cache: true })\n\n const lintResults = await engine.lintFiles(workspace.location)\n\n dumpMessages(lintResults)\n\n return lintResults.reduce((prev, lintResult) => prev + lintResult.errorCount, 0)\n}\n\nexport const lintAll = async () => {\n const engine = new ESLint({ cache: true })\n\n const lintResults = await engine.lintFiles('./**/*.*')\n\n dumpMessages(lintResults)\n\n return lintResults.reduce((prev, lintResult) => prev + lintResult.errorCount, 0)\n}\n\nexport const lint = async ({ pkg }: LintParams = {}) => {\n return pkg ? await lintPackage({ pkg }) : runSteps('Lint-Caching [All]', [['yarn', ['eslint', '.', '--cache']]])\n}\n"],"mappings":";;;;AAAA,SAASA,cAAc;;;ACAvB,OAAOC,WAAW;AAEX,IAAMC,cAAc,wBAACC,MAAcC,QAAgBC,QAA0B,SAASC,aAAa,UAAK;AAC7G,MAAIF,QAAQ;AACV,UAAMG,UAAUD,aAAa,sBAAsB;AACnD,UAAME,YAAYH,UAAU,UAAUI,MAAMC,MAAMD,MAAME;AACxDC,YAAQP,KAAAA,EAAOG,UAAU,GA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,CAAA;EACf;AAEA,QAAMC,SAAS,IAAIC,OAAO;IAAEC,OAAO;EAAK,CAAA;AAExC,QAAM7B,cAAc,MAAM2B,OAAOG,UAAUZ,UAAUa,QAAQ;AAE7DhC,eAAaC,WAAAA;AAEb,SAAOA,YAAYgC,OAAO,CAACC,MAAM9B,eAAe8B,OAAO9B,WAAW+B,YAAY,CAAA;AAChF,GAd2B;AA0BpB,IAAMC,OAAO,8BAAO,EAAEC,IAAG,IAAiB,CAAC,MAAC;AACjD,SAAOA,MAAM,MAAMC,YAAY;IAAED;EAAI,CAAA,IAAKE,SAAS,sBAAsB;IAAC;MAAC;MAAQ;QAAC;QAAU;QAAK;;;GAAY;AACjH,GAFoB;;;ARvDb,IAAMC,YAAY,mCAAA;AACvBC,UAAQC,IAAI,2BAAA;AACZ,QAAMC,aAAaC,eAAAA;AACnB,QAAMC,SAASF,WACZG,IAAI,CAAC,EAAEC,UAAUC,KAAI,MAAE;AACtB,UAAMC,OAAO,GAAGF,QAAAA;AAChB,QAAI;AACFG,aAAOD,MAAM;QAAEE,OAAO;QAAMC,WAAW;MAAK,CAAA;AAC5C,aAAO;IACT,SAASC,IAAI;AACX,YAAMC,QAAQD;AACdZ,cAAQa,MAAM,qCAAqCN,IAAAA,KAASM,MAAMC,OAAO,GAAG;AAC5E,aAAO;IACT;EACF,CAAA,EAECC,OAAO,CAACC,MAAMZ,YAAWY,QAAQZ,SAAQ,CAAA;AAC5C,SAAOA,UAAU,MAAMa,KAAAA;AACzB,GAlByB;","names":["rmSync","chalk","checkResult","name","result","level","exitOnFail","exiting","chalkFunc","chalk","red","yellow","console","process","exit","chalk","withError","ex","closure","predicate","name","message","undefined","withErrnoException","ex","closure","withError","errno","undefined","processEx","ex","error","Error","exitCode","withErrnoException","code","console","chalk","red","path","errno","withError","name","message","JSON","stringify","process","exit","safeExit","func","exitOnFail","result","process","exit","ex","processEx","spawnSync","yarnWorkspaces","result","spawnSync","encoding","shell","error","stdout","toString","split","slice","map","item","JSON","parse","spawnSync","existsSync","chalk","runSteps","name","steps","exitOnFail","messages","safeExit","pkgName","process","env","npm_package_name","console","log","chalk","green","totalStatus","i","command","args","config","entries","gray","argList","Array","isArray","split","existsSync","Error","status","spawnSync","encoding","FORCE_COLOR","shell","stdio","checkResult","chalk","ESLint","dumpMessages","lintResults","colors","severity","lintResult","messages","length","console","log","chalk","gray","filePath","message","line","column","white","ruleId","lintPackage","pkg","workspace","yarnWorkspaces","find","name","error","red","magenta","process","exit","engine","ESLint","cache","lintFiles","location","reduce","prev","errorCount","lint","pkg","lintPackage","runSteps","lintClean","console","log","workspaces","yarnWorkspaces","result","map","location","name","dist","rmSync","force","recursive","ex","error","message","reduce","prev","lint"]}
@@ -18,7 +18,7 @@ var checkResult = /* @__PURE__ */ __name((name, result, level = "error", exitOnF
18
18
  import chalk2 from "chalk";
19
19
 
20
20
  // src/lib/withError.ts
21
- var withError = /* @__PURE__ */ __name((ex, closure, predicate = (ex2) => ex2.name !== void 0 && ex2.message !== void 0) => {
21
+ var withError = /* @__PURE__ */ __name((ex, closure, predicate = (ex2) => !!ex2.name && !!ex2.message) => {
22
22
  return predicate(ex) ? closure(ex) : void 0;
23
23
  }, "withError");
24
24
 
@@ -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/lint-profile.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 !== undefined && ex.message !== undefined,\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', /* 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 { runSteps } from '../lib/index.ts'\n\nexport const lintProfile = () => {\n return runSteps('Lint Profile', [['yarn', ['xy', 'lint'], { env: { ...process.env, TIMING: '1' } }]])\n}\n"],"mappings":";;;;AAAA,OAAOA,WAAW;AAEX,IAAMC,cAAc,wBAACC,MAAcC,QAAgBC,QAA0B,SAASC,aAAa,UAAK;AAC7G,MAAIF,QAAQ;AACV,UAAMG,UAAUD,aAAa,sBAAsB;AACnD,UAAME,YAAYH,UAAU,UAAUI,MAAMC,MAAMD,MAAME;AACxDC,YAAQP,KAAAA,EAAOG,UAAU,GAAGL,IAAAA,QAAYC,MAAAA,aAAmBG,OAAAA,EAAS,CAAA;AACpE,QAAID,YAAY;AACdO,cAAQC,KAAKV,MAAAA;IACf;EACF;AACF,GAT2B;;;ACF3B,OAAOW,YAAW;;;ACAX,IAAMC,YAAY,wBAEvBC,IACAC,SACAC,YAAY,CAACF,QAAUA,IAAGG,SAASC,UAAaJ,IAAGK,YAAYD,WAAS;AAExE,SAAOF,UAAUF,EAAAA,IAAWC,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OC,SAAS,MAAA;AACd,UAAMC,UAAUC,QAAQC,IAAIC;AAC5BC,YAAQC,IAAIC,OAAMC,MAAM,GAAGZ,IAAAA,KAASK,OAAAA,GAAU,CAAA;AAC9C,QAAIQ,cAAc;AAClB,eAAW,CAACC,GAAG,CAACC,SAASC,MAAMC,MAAAA,CAAO,KAAKhB,MAAMiB,QAAO,GAAI;AAC1D,UAAIf,WAAWW,CAAAA,GAAI;AACjBL,gBAAQC,IAAIC,OAAMQ,KAAKhB,WAAWW,CAAAA,CAAE,CAAA;MACtC;AACA,YAAMM,UAAUC,MAAMC,QAAQN,IAAAA,IAAQA,OAAOA,KAAKO,MAAM,GAAA;AACxD,UAAIR,YAAY,UAAU,CAACS,WAAWJ,QAAQ,CAAA,CAAE,GAAG;AACjD,cAAM,IAAIK,MAAM,mBAAmBL,QAAQ,CAAA,CAAE,GAAG;MAClD;AACA,YAAMM,SACFC,UAAUZ,SAASM,MAAMC,QAAQN,IAAAA,IAAQA,OAAOA,KAAKO,MAAM,GAAA,GAAM;QACjE,GAAGN;QACHW,UAAU;QACVrB,KAAK;UAAEsB,aAAa;UAAK,GAAGvB,QAAQC;QAAI;QACxCuB,OAAO;QACPC,OAAO;MACT,CAAA,EAAGL,UAAU;AACfM,kBAAYhC,MAAM0B,QAAQ,SAASxB,UAAAA;AACnCW,qBAAea,UAAU;IAC3B;AACA,WAAOb;EACT,GAAG,CAAC,CAACX,UAAAA;AACP,GA1BwB;;;ACXjB,IAAM+B,cAAc,6BAAA;AACzB,SAAOC,SAAS,gBAAgB;IAAC;MAAC;MAAQ;QAAC;QAAM;;MAAS;QAAEC,KAAK;UAAE,GAAGC,QAAQD;UAAKE,QAAQ;QAAI;MAAE;;GAAG;AACtG,GAF2B;","names":["chalk","checkResult","name","result","level","exitOnFail","exiting","chalkFunc","chalk","red","yellow","console","process","exit","chalk","withError","ex","closure","predicate","name","undefined","message","withErrnoException","ex","closure","withError","errno","undefined","processEx","ex","error","Error","exitCode","withErrnoException","code","console","chalk","red","path","errno","withError","name","message","JSON","stringify","process","exit","safeExit","func","exitOnFail","result","process","exit","ex","processEx","spawnSync","existsSync","chalk","runSteps","name","steps","exitOnFail","messages","safeExit","pkgName","process","env","npm_package_name","console","log","chalk","green","totalStatus","i","command","args","config","entries","gray","argList","Array","isArray","split","existsSync","Error","status","spawnSync","encoding","FORCE_COLOR","shell","stdio","checkResult","lintProfile","runSteps","env","process","TIMING"]}
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/lint-profile.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' | 'jest', /* 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 { runSteps } from '../lib/index.ts'\n\nexport const lintProfile = () => {\n return runSteps('Lint Profile', [['yarn', ['xy', 'lint'], { env: { ...process.env, TIMING: '1' } }]])\n}\n"],"mappings":";;;;AAAA,OAAOA,WAAW;AAEX,IAAMC,cAAc,wBAACC,MAAcC,QAAgBC,QAA0B,SAASC,aAAa,UAAK;AAC7G,MAAIF,QAAQ;AACV,UAAMG,UAAUD,aAAa,sBAAsB;AACnD,UAAME,YAAYH,UAAU,UAAUI,MAAMC,MAAMD,MAAME;AACxDC,YAAQP,KAAAA,EAAOG,UAAU,GAAGL,IAAAA,QAAYC,MAAAA,aAAmBG,OAAAA,EAAS,CAAA;AACpE,QAAID,YAAY;AACdO,cAAQC,KAAKV,MAAAA;IACf;EACF;AACF,GAT2B;;;ACF3B,OAAOW,YAAW;;;ACAX,IAAMC,YAAY,wBAEvBC,IACAC,SACAC,YAAY,CAACF,QAAW,CAAC,CAACA,IAAGG,QAAQ,CAAC,CAACH,IAAGI,YAAQ;AAElD,SAAOF,UAAUF,EAAAA,IAAWC,QAAQD,EAAAA,IAAWK;AACjD,GAPyB;;;ACElB,IAAMC,qBAAqB,wBAChCC,IAAaC,YAAAA;AAEb,SAAOC,UAAaF,IAAIC,SAAS,CAACD,QAAiBA,IAA6BG,UAAUC,MAAAA;AAC5F,GAJkC;;;AFG3B,IAAMC,YAAY,wBAACC,OAAAA;AACxB,QAAMC,QAAQ,OAAOD,OAAO,WAAW,IAAIE,MAAMF,EAAAA,IAAMA;AACvD,QAAMG,WACFC,mBAAmBH,OAAO,CAACA,WAAAA;AAC3B,QAAIA,OAAMI,SAAS,UAAU;AAC3BC,cAAQL,MAAMM,OAAMC,IAAI,IAAIP,OAAMQ,IAAI,cAAc,CAAA;IACtD,OAAO;AACLH,cAAQL,MAAMM,OAAMC,IAAI,UAAUP,OAAMI,IA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cAAM,IAAIK,MAAM,mBAAmBL,QAAQ,CAAA,CAAE,GAAG;MAClD;AACA,YAAMM,SACFC,UAAUZ,SAASM,MAAMC,QAAQN,IAAAA,IAAQA,OAAOA,KAAKO,MAAM,GAAA,GAAM;QACjE,GAAGN;QACHW,UAAU;QACVrB,KAAK;UAAEsB,aAAa;UAAK,GAAGvB,QAAQC;QAAI;QACxCuB,OAAO;QACPC,OAAO;MACT,CAAA,EAAGL,UAAU;AACfM,kBAAYhC,MAAM0B,QAAQ,SAASxB,UAAAA;AACnCW,qBAAea,UAAU;IAC3B;AACA,WAAOb;EACT,GAAG,CAAC,CAACX,UAAAA;AACP,GA1BwB;;;ACXjB,IAAM+B,cAAc,6BAAA;AACzB,SAAOC,SAAS,gBAAgB;IAAC;MAAC;MAAQ;QAAC;QAAM;;MAAS;QAAEC,KAAK;UAAE,GAAGC,QAAQD;UAAKE,QAAQ;QAAI;MAAE;;GAAG;AACtG,GAF2B;","names":["chalk","checkResult","name","result","level","exitOnFail","exiting","chalkFunc","chalk","red","yellow","console","process","exit","chalk","withError","ex","closure","predicate","name","message","undefined","withErrnoException","ex","closure","withError","errno","undefined","processEx","ex","error","Error","exitCode","withErrnoException","code","console","chalk","red","path","errno","withError","name","message","JSON","stringify","process","exit","safeExit","func","exitOnFail","result","process","exit","ex","processEx","spawnSync","existsSync","chalk","runSteps","name","steps","exitOnFail","messages","safeExit","pkgName","process","env","npm_package_name","console","log","chalk","green","totalStatus","i","command","args","config","entries","gray","argList","Array","isArray","split","existsSync","Error","status","spawnSync","encoding","FORCE_COLOR","shell","stdio","checkResult","lintProfile","runSteps","env","process","TIMING"]}
@@ -22,7 +22,7 @@ var checkResult = /* @__PURE__ */ __name((name, result, level = "error", exitOnF
22
22
  import chalk2 from "chalk";
23
23
 
24
24
  // src/lib/withError.ts
25
- var withError = /* @__PURE__ */ __name((ex, closure, predicate = (ex2) => ex2.name !== void 0 && ex2.message !== void 0) => {
25
+ var withError = /* @__PURE__ */ __name((ex, closure, predicate = (ex2) => !!ex2.name && !!ex2.message) => {
26
26
  return predicate(ex) ? closure(ex) : void 0;
27
27
  }, "withError");
28
28
 
@@ -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/yarn/workspace/yarnWorkspaces.ts","../../src/lib/runSteps.ts"],"sourcesContent":["import chalk from 'chalk'\nimport { ESLint } from 'eslint'\n\nimport { runSteps, yarnWorkspaces } from '../lib/index.ts'\n\nexport interface LintParams {\n pkg?: string\n verbose?: boolean\n}\n\nexport interface LintPackageParams {\n pkg: string\n verbose?: boolean\n}\n\nconst dumpMessages = (lintResults: ESLint.LintResult[]) => {\n const colors: ('white' | 'red' | 'yellow')[] = ['white', 'yellow', 'red']\n const severity: string[] = ['none', 'warning', 'error']\n\n for (const lintResult of lintResults) {\n if (lintResult.messages.length > 0) {\n console.log(chalk.gray(`${lintResult.filePath}`))\n for (const message of lintResult.messages) {\n console.log(\n chalk.gray(`\\t${message.line}:${message.column}`),\n chalk[colors[message.severity]](`\\t${severity[message.severity]}`),\n chalk.white(`\\t${message.message}`),\n chalk.gray(`\\t${message.ruleId}`),\n )\n }\n }\n }\n}\n\nexport const lintPackage = async ({ pkg }: LintParams) => {\n const workspace = yarnWorkspaces().find(workspace => workspace.name === pkg)\n if (!workspace) {\n console.error(chalk.red(`Unable to locate package [${chalk.magenta(pkg)}]`))\n process.exit(1)\n }\n\n const engine = new ESLint({ cache: true })\n\n const lintResults = await engine.lintFiles(workspace.location)\n\n dumpMessages(lintResults)\n\n return lintResults.reduce((prev, lintResult) => prev + lintResult.errorCount, 0)\n}\n\nexport const lintAll = async () => {\n const engine = new ESLint({ cache: true })\n\n const lintResults = await engine.lintFiles('./**/*.*')\n\n dumpMessages(lintResults)\n\n return lintResults.reduce((prev, lintResult) => prev + lintResult.errorCount, 0)\n}\n\nexport const lint = async ({ pkg }: LintParams = {}) => {\n return pkg ? await lintPackage({ pkg }) : runSteps('Lint-Caching [All]', [['yarn', ['eslint', '.', '--cache']]])\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 !== undefined && ex.message !== undefined,\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' | 'jest', /* 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(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,EAAE,CAAA;MAEpC;IACF;EACF;AACF,GAjBqB;AAmBd,IAAMC,cAAc,8BAAO,EAAEC,IAAG,MAAc;AACnD,QAAMC,YAAYC,eAAAA,EAAiBC,KAAKF,CAAAA,eAAaA,WAAUG,SAASJ,GAAAA;AACxE,MAAI,CAACC,WAAW;AACdZ,YAAQgB,MAAMd,OAAMe,IAAI,6BAA6Bf,OAAMgB,QAAQP,GAAAA,CAAAA,GAAO,CAAA;AAC1EQ,YAAQC,KAAK,CAAA;EACf;AAEA,QAAMC,SAAS,IAAIC,OAAO;IAAEC,OAAO;EAAK,CAAA;AAExC,QAAM7B,cAAc,MAAM2B,OAAOG,UAAUZ,UAAUa,QAAQ;AAE7DhC,eAAaC,WAAAA;AAEb,SAAOA,YAAYgC,OAAO,CAACC,MAAM9B,eAAe8B,OAAO9B,WAAW+B,YAAY,CAAA;AAChF,GAd2B;AAgBpB,IAAMC,UAAU,mCAAA;AACrB,QAAMR,SAAS,IAAIC,OAAO;IAAEC,OAAO;EAAK,CAAA;AAExC,QAAM7B,cAAc,MAAM2B,OAAOG,UAAU,UAAA;AAE3C/B,eAAaC,WAAAA;AAEb,SAAOA,YAAYgC,OAAO,CAACC,MAAM9B,eAAe8B,OAAO9B,WAAW+B,YAAY,CAAA;AAChF,GARuB;AAUhB,IAAME,OAAO,8BAAO,EAAEnB,IAAG,IAAiB,CAAC,MAAC;AACjD,SAAOA,MAAM,MAAMD,YAAY;IAAEC;EAAI,CAAA,IAAKoB,SAAS,sBAAsB;IAAC;MAAC;MAAQ;QAAC;QAAU;QAAK;;;GAAY;AACjH,GAFoB;","names":["chalk","ESLint","chalk","checkResult","name","result","level","exitOnFail","exiting","chalkFunc","chalk","red","yellow","console","process","exit","chalk","withError","ex","closure","predicate","name","undefined","message","withErrnoException","ex","closure","withError","errno","undefined","processEx","ex","error","Error","exitCode","withErrnoException","code","console","chalk","red","path","errno","withError","name","message","JSON","stringify","process","exit","safeExit","func","exitOnFail","result","process","exit","ex","processEx","spawnSync","yarnWorkspaces","result","spawnSync","encoding","shell","error","stdout","toString","split","slice","map","item","JSON","parse","spawnSync","existsSync","chalk","runSteps","name","steps","exitOnFail","messages","safeExit","pkgName","process","env","npm_package_name","console","log","chalk","green","totalStatus","i","command","args","config","entries","gray","argList","Array","isArray","split","existsSync","Error","status","spawnSync","encoding","FORCE_COLOR","shell","stdio","checkResult","dumpMessages","lintResults","colors","severity","lintResult","messages","length","console","log","chalk","gray","filePath","message","line","column","white","ruleId","lintPackage","pkg","workspace","yarnWorkspaces","find","name","error","red","magenta","process","exit","engine","ESLint","cache","lintFiles","location","reduce","prev","errorCount","lintAll","lint","runSteps"]}
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/yarn/workspace/yarnWorkspaces.ts","../../src/lib/runSteps.ts"],"sourcesContent":["import chalk from 'chalk'\nimport { ESLint } from 'eslint'\n\nimport { runSteps, yarnWorkspaces } from '../lib/index.ts'\n\nexport interface LintParams {\n pkg?: string\n verbose?: boolean\n}\n\nexport interface LintPackageParams {\n pkg: string\n verbose?: boolean\n}\n\nconst dumpMessages = (lintResults: ESLint.LintResult[]) => {\n const colors: ('white' | 'red' | 'yellow')[] = ['white', 'yellow', 'red']\n const severity: string[] = ['none', 'warning', 'error']\n\n for (const lintResult of lintResults) {\n if (lintResult.messages.length > 0) {\n console.log(chalk.gray(`${lintResult.filePath}`))\n for (const message of lintResult.messages) {\n console.log(\n chalk.gray(`\\t${message.line}:${message.column}`),\n chalk[colors[message.severity]](`\\t${severity[message.severity]}`),\n chalk.white(`\\t${message.message}`),\n chalk.gray(`\\t${message.ruleId}`),\n )\n }\n }\n }\n}\n\nexport const lintPackage = async ({ pkg }: LintParams) => {\n const workspace = yarnWorkspaces().find(workspace => workspace.name === pkg)\n if (!workspace) {\n console.error(chalk.red(`Unable to locate package [${chalk.magenta(pkg)}]`))\n process.exit(1)\n }\n\n const engine = new ESLint({ cache: true })\n\n const lintResults = await engine.lintFiles(workspace.location)\n\n dumpMessages(lintResults)\n\n return lintResults.reduce((prev, lintResult) => prev + lintResult.errorCount, 0)\n}\n\nexport const lintAll = async () => {\n const engine = new ESLint({ cache: true })\n\n const lintResults = await engine.lintFiles('./**/*.*')\n\n dumpMessages(lintResults)\n\n return lintResults.reduce((prev, lintResult) => prev + lintResult.errorCount, 0)\n}\n\nexport const lint = async ({ pkg }: LintParams = {}) => {\n return pkg ? await lintPackage({ pkg }) : runSteps('Lint-Caching [All]', [['yarn', ['eslint', '.', '--cache']]])\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' | 'jest', /* 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,OAAOA,YAAW;AAClB,SAASC,cAAc;;;ACDvB,OAAOC,WAAW;AAEX,IAAMC,cAAc,wBAACC,MAAcC,QAAgBC,QAA0B,SAASC,aAAa,UAAK;AAC7G,MAAIF,QAAQ;AACV,UAAMG,UAAUD,aAAa,sBAAsB;AACnD,UAAME,YAAYH,UAAU,UAAUI,MAAMC,MAAMD,MAAME;AACxDC,YAAQP,KAAAA,EAAOG,UAAU,GAAGL,IAAAA,QAAYC,MAAAA,aAAmBG,OAAAA,EAAS,CAAA;AACpE,QAAID,YAAY;AACdO,cAAQC,KAAKV,MAAAA;IACf;EACF;AACF,GAT2B;;;ACF3B,OAAOW,YAAW;;;ACAX,IAAMC,YAAY,wBAEvBC,IACAC,SACAC,YAAY,CAACF,QAAW,CAAC,CAACA,IAAGG,QAAQ,CAAC,CAACH,IAAGI,YAAQ;AAElD,SAAOF,UAAUF,EAAAA,IAAWC,QAAQD,EAAAA,IAAWK;AACjD,GAPyB;;;ACElB,IAAMC,qBAAqB,wBAChCC,IAAaC,YAAAA;AAEb,SAAOC,UAAaF,IAAIC,SAAS,CAACD,QAAiBA,IAA6BG,UAAUC,MAAAA;AAC5F,GAJkC;;;AFG3B,IAAMC,YAAY,wBAACC,OAAAA;AACxB,QAAMC,QAAQ,OAAOD,OAAO,WAAW,IAAIE,MAAMF,EAAAA,IAAMA;AACvD,QAAMG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S,sBAAsB;IAAC;MAAC;MAAQ;QAAC;QAAU;QAAK;;;GAAY;AACjH,GAFoB;","names":["chalk","ESLint","chalk","checkResult","name","result","level","exitOnFail","exiting","chalkFunc","chalk","red","yellow","console","process","exit","chalk","withError","ex","closure","predicate","name","message","undefined","withErrnoException","ex","closure","withError","errno","undefined","processEx","ex","error","Error","exitCode","withErrnoException","code","console","chalk","red","path","errno","withError","name","message","JSON","stringify","process","exit","safeExit","func","exitOnFail","result","process","exit","ex","processEx","spawnSync","yarnWorkspaces","result","spawnSync","encoding","shell","error","stdout","toString","split","slice","map","item","JSON","parse","spawnSync","existsSync","chalk","runSteps","name","steps","exitOnFail","messages","safeExit","pkgName","process","env","npm_package_name","console","log","chalk","green","totalStatus","i","command","args","config","entries","gray","argList","Array","isArray","split","existsSync","Error","status","spawnSync","encoding","FORCE_COLOR","shell","stdio","checkResult","dumpMessages","lintResults","colors","severity","lintResult","messages","length","console","log","chalk","gray","filePath","message","line","column","white","ruleId","lintPackage","pkg","workspace","yarnWorkspaces","find","name","error","red","magenta","process","exit","engine","ESLint","cache","lintFiles","location","reduce","prev","errorCount","lintAll","lint","runSteps"]}
@@ -69,9 +69,10 @@ var INIT_CWD = /* @__PURE__ */ __name(() => {
69
69
  }, "INIT_CWD");
70
70
 
71
71
  // src/lib/generateIgnoreFiles.ts
72
+ var localeCompare = /* @__PURE__ */ __name((a, b) => a.localeCompare(b), "localeCompare");
72
73
  var mergeEntries = /* @__PURE__ */ __name((a, b) => [
73
74
  ...union(a, b)
74
- ].sort(), "mergeEntries");
75
+ ].sort(localeCompare), "mergeEntries");
75
76
  var generateIgnoreFiles = /* @__PURE__ */ __name((filename2, pkg) => {
76
77
  console.log(chalk.green(`Generate ${filename2} Files`));
77
78
  const cwd = INIT_CWD() ?? ".";
@@ -1 +1 @@
1
- {"version":3,"sources":["../../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/generateIgnoreFiles.ts","../../src/lib/yarn/workspace/yarnWorkspaces.ts","../../src/lib/yarn/workspace/yarnWorkspace.ts","../../src/lib/yarn/yarnInitCwd.ts","../../src/actions/npmignore-gen.ts"],"sourcesContent":["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, 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 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 mergeEntries = (a: string[], b: string[]): string[] => [...union(a, b)].sort()\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\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 { generateIgnoreFiles } from '../lib/index.ts'\n\nconst filename = '.npmignore'\n\nexport const npmignoreGen = (pkg?: string) => generateIgnoreFiles(filename, pkg)\n"],"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AACA,QAAMC,YAAYN,QAAQO,MAAMC,CAAAA,WAAUA,WAAW,CAAA;AACrD,SAAOF,YAAY,IAAI;AACzB,GAlBmC;;;AIRnC,IAAMG,WAAW;AAEV,IAAMC,eAAe,wBAACC,QAAiBC,oBAAoBH,UAAUE,GAAAA,GAAhD;","names":["WINDOWS_NEWLINE_REGEX","CROSS_PLATFORM_NEWLINE","existsSync","readFileSync","writeFileSync","empty","value","trim","length","notEmpty","union","a","b","Set","defaultReadFileSyncOptions","encoding","readLines","uri","options","defaultReadFileSyncOptions","existsSync","readFileSync","replace","WINDOWS_NEWLINE_REGEX","CROSS_PLATFORM_NEWLINE","split","readNonEmptyLines","filter","notEmpty","writeLines","lines","existing","undefined","desired","join","writeFileSync","chalk","spawnSync","yarnWorkspaces","result","spawnSync","encoding","shell","error","stdout","toString","split","slice","map","item","JSON","parse","yarnWorkspace","pkg","workspace","yarnWorkspaces","find","name","Error","INIT_CWD","process","env","console","error","mergeEntries","a","b","union","sort","generateIgnoreFiles","filename","pkg","console","log","chalk","green","cwd","INIT_CWD","workspaces","yarnWorkspace","yarnWorkspaces","readEntries","location","readNonEmptyLines","writeEntries","entries","writeLines","results","map","name","ex","error","message","succeeded","every","result","filename","npmignoreGen","pkg","generateIgnoreFiles"]}
1
+ {"version":3,"sources":["../../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/generateIgnoreFiles.ts","../../src/lib/yarn/workspace/yarnWorkspaces.ts","../../src/lib/yarn/workspace/yarnWorkspace.ts","../../src/lib/yarn/yarnInitCwd.ts","../../src/actions/npmignore-gen.ts"],"sourcesContent":["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, 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 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)].sort(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\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 { generateIgnoreFiles } from '../lib/index.ts'\n\nconst filename = '.npmignore'\n\nexport const npmignoreGen = (pkg?: string) => generateIgnoreFiles(filename, pkg)\n"],"mappings":";;;;AAAO,IAAMA,wBAAwB;AAC9B,IAAMC,yBAAyB;;;ACAtC,SACEC,YAAYC,cAAcC,qBACrB;;;ACHA,IAAMC,QAAQ,wBAACC,UAAwCA,OAAOC,KAAAA,EAAOC,WAAW,GAAlE;AACd,IAAMC,WAAW,wBAACH,UAAwC,CAACD,MAAMC,KAAAA,GAAhD;;;ACDjB,IAAMI,QAAQ,wBAACC,GAAaC,MAA6B,oBAAIC,IAAI;KAA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REGEX","CROSS_PLATFORM_NEWLINE","existsSync","readFileSync","writeFileSync","empty","value","trim","length","notEmpty","union","a","b","Set","defaultReadFileSyncOptions","encoding","readLines","uri","options","defaultReadFileSyncOptions","existsSync","readFileSync","replace","WINDOWS_NEWLINE_REGEX","CROSS_PLATFORM_NEWLINE","split","readNonEmptyLines","filter","notEmpty","writeLines","lines","existing","undefined","desired","join","writeFileSync","chalk","spawnSync","yarnWorkspaces","result","spawnSync","encoding","shell","error","stdout","toString","split","slice","map","item","JSON","parse","yarnWorkspace","pkg","workspace","yarnWorkspaces","find","name","Error","INIT_CWD","process","env","console","error","localeCompare","a","b","mergeEntries","union","sort","generateIgnoreFiles","filename","pkg","console","log","chalk","green","cwd","INIT_CWD","workspaces","yarnWorkspace","yarnWorkspaces","readEntries","location","readNonEmptyLines","writeEntries","entries","writeLines","results","map","name","ex","error","message","succeeded","every","result","filename","npmignoreGen","pkg","generateIgnoreFiles"]}
@@ -19,7 +19,7 @@ var deleteGlob = /* @__PURE__ */ __name((globPath) => {
19
19
  }, "deleteGlob");
20
20
 
21
21
  // src/actions/package/clean-outputs.ts
22
- var packageCleanOutputs = /* @__PURE__ */ __name(async () => {
22
+ var packageCleanOutputs = /* @__PURE__ */ __name(() => {
23
23
  const pkg = process.env.INIT_CWD ?? ".";
24
24
  const pkgName = process.env.npm_package_name;
25
25
  const folders = [
@@ -28,7 +28,9 @@ var packageCleanOutputs = /* @__PURE__ */ __name(async () => {
28
28
  path.join(pkg, "docs")
29
29
  ];
30
30
  console.log(chalk.green(`Cleaning Outputs [${pkgName}]`));
31
- await Promise.all(folders.map((folder) => deleteGlob(folder)));
31
+ for (let folder of folders) {
32
+ deleteGlob(folder);
33
+ }
32
34
  return 0;
33
35
  }, "packageCleanOutputs");
34
36
  export {
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/actions/package/clean-outputs.ts","../../../src/lib/deleteGlob.ts"],"sourcesContent":["import path from 'node:path'\n\nimport chalk from 'chalk'\n\nimport { deleteGlob } from '../../lib/index.ts'\n\nexport const packageCleanOutputs = async () => {\n const pkg = process.env.INIT_CWD ?? '.'\n const pkgName = process.env.npm_package_name\n const folders: string[] = [path.join(pkg, 'dist'), path.join(pkg, 'build'), path.join(pkg, 'docs')]\n console.log(chalk.green(`Cleaning Outputs [${pkgName}]`))\n\n await Promise.all(folders.map(folder => deleteGlob(folder)))\n\n return 0\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"],"mappings":";;;;AAAA,OAAOA,UAAU;AAEjB,OAAOC,WAAW;;;ACFlB,OAAOC,QAAQ;AAEf,SAASC,YAAY;AAEd,IAAMC,aAAa,wBAACC,aAAAA;AAEzB,QAAMC,QAAQC,KAAKC,KAAKH,QAAAA;AAGxB,aAAWI,QAAQH,OAAO;AACxBI,OAAGC,OAAOF,MAAM;MAAEG,WAAW;MAAMC,OAAO;IAAK,CAAA;EACjD;AACF,GAR0B;;;ADEnB,IAAMC,sBAAsB,mCAAA;AACjC,QAAMC,MAAMC,QAAQC,IAAIC,YAAY;AACpC,QAAMC,UAAUH,QAAQC,IAAIG;AAC5B,QAAMC,UAAoB;IAACC,KAAKC,KAAKR,KAAK,MAAA;IAASO,KAAKC,KAAKR,KAAK,OAAA;IAAUO,KAAKC,KAAKR,KAAK,MAAA;;AAC3FS,UAAQC,IAAIC,MAAMC,MAAM,qBAAqBR,OAAAA,GAAU,CAAA;AAEvD,QAAMS,QAAQC,IAAIR,QAAQS,IAAIC,CAAAA,WAAUC,WAAWD,MAAAA,CAAAA,CAAAA;AAEnD,SAAO;AACT,GATmC;","names":["path","chalk","fs","glob","deleteGlob","globPath","files","glob","sync","file","fs","rmSync","recursive","force","packageCleanOutputs","pkg","process","env","INIT_CWD","pkgName","npm_package_name","folders","path","join","console","log","chalk","green","Promise","all","map","folder","deleteGlob"]}
1
+ {"version":3,"sources":["../../../src/actions/package/clean-outputs.ts","../../../src/lib/deleteGlob.ts"],"sourcesContent":["import path from 'node:path'\n\nimport chalk from 'chalk'\n\nimport { deleteGlob } from '../../lib/index.ts'\n\nexport const packageCleanOutputs = () => {\n const pkg = process.env.INIT_CWD ?? '.'\n const pkgName = process.env.npm_package_name\n const folders: string[] = [path.join(pkg, 'dist'), path.join(pkg, 'build'), path.join(pkg, 'docs')]\n console.log(chalk.green(`Cleaning Outputs [${pkgName}]`))\n\n for (let folder of folders) {\n deleteGlob(folder)\n }\n\n return 0\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"],"mappings":";;;;AAAA,OAAOA,UAAU;AAEjB,OAAOC,WAAW;;;ACFlB,OAAOC,QAAQ;AAEf,SAASC,YAAY;AAEd,IAAMC,aAAa,wBAACC,aAAAA;AAEzB,QAAMC,QAAQC,KAAKC,KAAKH,QAAAA;AAGxB,aAAWI,QAAQH,OAAO;AACxBI,OAAGC,OAAOF,MAAM;MAAEG,WAAW;MAAMC,OAAO;IAAK,CAAA;EACjD;AACF,GAR0B;;;ADEnB,IAAMC,sBAAsB,6BAAA;AACjC,QAAMC,MAAMC,QAAQC,IAAIC,YAAY;AACpC,QAAMC,UAAUH,QAAQC,IAAIG;AAC5B,QAAMC,UAAoB;IAACC,KAAKC,KAAKR,KAAK,MAAA;IAASO,KAAKC,KAAKR,KAAK,OAAA;IAAUO,KAAKC,KAAKR,KAAK,MAAA;;AAC3FS,UAAQC,IAAIC,MAAMC,MAAM,qBAAqBR,OAAAA,GAAU,CAAA;AAEvD,WAASS,UAAUP,SAAS;AAC1BQ,eAAWD,MAAAA;EACb;AAEA,SAAO;AACT,GAXmC;","names":["path","chalk","fs","glob","deleteGlob","globPath","files","glob","sync","file","fs","rmSync","recursive","force","packageCleanOutputs","pkg","process","env","INIT_CWD","pkgName","npm_package_name","folders","path","join","console","log","chalk","green","folder","deleteGlob"]}
@@ -19,7 +19,7 @@ var deleteGlob = /* @__PURE__ */ __name((globPath) => {
19
19
  }, "deleteGlob");
20
20
 
21
21
  // src/actions/package/clean-typescript.ts
22
- var packageCleanTypescript = /* @__PURE__ */ __name(async () => {
22
+ var packageCleanTypescript = /* @__PURE__ */ __name(() => {
23
23
  const pkg = process.env.INIT_CWD ?? ".";
24
24
  const pkgName = process.env.npm_package_name;
25
25
  console.log(chalk.green(`Cleaning Typescript [${pkgName}]`));
@@ -28,7 +28,9 @@ var packageCleanTypescript = /* @__PURE__ */ __name(async () => {
28
28
  path.join(pkg, ".tsconfig.*"),
29
29
  path.join(pkg, ".eslintcache")
30
30
  ];
31
- await Promise.all(files.map((file) => deleteGlob(file)));
31
+ for (let file of files) {
32
+ deleteGlob(file);
33
+ }
32
34
  return 0;
33
35
  }, "packageCleanTypescript");
34
36
  export {
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/actions/package/clean-typescript.ts","../../../src/lib/deleteGlob.ts"],"sourcesContent":["import path from 'node:path'\n\nimport chalk from 'chalk'\n\nimport { deleteGlob } from '../../lib/index.ts'\n\nexport const packageCleanTypescript = async () => {\n const pkg = process.env.INIT_CWD ?? '.'\n const pkgName = process.env.npm_package_name\n console.log(chalk.green(`Cleaning Typescript [${pkgName}]`))\n const files: string[] = [path.join(pkg, '*.tsbuildinfo'), path.join(pkg, '.tsconfig.*'), path.join(pkg, '.eslintcache')]\n\n await Promise.all(files.map(file => deleteGlob(file)))\n\n return 0\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"],"mappings":";;;;AAAA,OAAOA,UAAU;AAEjB,OAAOC,WAAW;;;ACFlB,OAAOC,QAAQ;AAEf,SAASC,YAAY;AAEd,IAAMC,aAAa,wBAACC,aAAAA;AAEzB,QAAMC,QAAQC,KAAKC,KAAKH,QAAAA;AAGxB,aAAWI,QAAQH,OAAO;AACxBI,OAAGC,OAAOF,MAAM;MAAEG,WAAW;MAAMC,OAAO;IAAK,CAAA;EACjD;AACF,GAR0B;;;ADEnB,IAAMC,yBAAyB,mCAAA;AACpC,QAAMC,MAAMC,QAAQC,IAAIC,YAAY;AACpC,QAAMC,UAAUH,QAAQC,IAAIG;AAC5BC,UAAQC,IAAIC,MAAMC,MAAM,wBAAwBL,OAAAA,GAAU,CAAA;AAC1D,QAAMM,QAAkB;IAACC,KAAKC,KAAKZ,KAAK,eAAA;IAAkBW,KAAKC,KAAKZ,KAAK,aAAA;IAAgBW,KAAKC,KAAKZ,KAAK,cAAA;;AAExG,QAAMa,QAAQC,IAAIJ,MAAMK,IAAIC,CAAAA,SAAQC,WAAWD,IAAAA,CAAAA,CAAAA;AAE/C,SAAO;AACT,GATsC;","names":["path","chalk","fs","glob","deleteGlob","globPath","files","glob","sync","file","fs","rmSync","recursive","force","packageCleanTypescript","pkg","process","env","INIT_CWD","pkgName","npm_package_name","console","log","chalk","green","files","path","join","Promise","all","map","file","deleteGlob"]}
1
+ {"version":3,"sources":["../../../src/actions/package/clean-typescript.ts","../../../src/lib/deleteGlob.ts"],"sourcesContent":["import path from 'node:path'\n\nimport chalk from 'chalk'\n\nimport { deleteGlob } from '../../lib/index.ts'\n\nexport const packageCleanTypescript = () => {\n const pkg = process.env.INIT_CWD ?? '.'\n const pkgName = process.env.npm_package_name\n console.log(chalk.green(`Cleaning Typescript [${pkgName}]`))\n const files: string[] = [path.join(pkg, '*.tsbuildinfo'), path.join(pkg, '.tsconfig.*'), path.join(pkg, '.eslintcache')]\n\n for (let file of files) {\n deleteGlob(file)\n }\n\n return 0\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"],"mappings":";;;;AAAA,OAAOA,UAAU;AAEjB,OAAOC,WAAW;;;ACFlB,OAAOC,QAAQ;AAEf,SAASC,YAAY;AAEd,IAAMC,aAAa,wBAACC,aAAAA;AAEzB,QAAMC,QAAQC,KAAKC,KAAKH,QAAAA;AAGxB,aAAWI,QAAQH,OAAO;AACxBI,OAAGC,OAAOF,MAAM;MAAEG,WAAW;MAAMC,OAAO;IAAK,CAAA;EACjD;AACF,GAR0B;;;ADEnB,IAAMC,yBAAyB,6BAAA;AACpC,QAAMC,MAAMC,QAAQC,IAAIC,YAAY;AACpC,QAAMC,UAAUH,QAAQC,IAAIG;AAC5BC,UAAQC,IAAIC,MAAMC,MAAM,wBAAwBL,OAAAA,GAAU,CAAA;AAC1D,QAAMM,QAAkB;IAACC,KAAKC,KAAKZ,KAAK,eAAA;IAAkBW,KAAKC,KAAKZ,KAAK,aAAA;IAAgBW,KAAKC,KAAKZ,KAAK,cAAA;;AAExG,WAASa,QAAQH,OAAO;AACtBI,eAAWD,IAAAA;EACb;AAEA,SAAO;AACT,GAXsC;","names":["path","chalk","fs","glob","deleteGlob","globPath","files","glob","sync","file","fs","rmSync","recursive","force","packageCleanTypescript","pkg","process","env","INIT_CWD","pkgName","npm_package_name","console","log","chalk","green","files","path","join","file","deleteGlob"]}
@@ -19,7 +19,7 @@ var deleteGlob = /* @__PURE__ */ __name((globPath) => {
19
19
  }, "deleteGlob");
20
20
 
21
21
  // src/actions/package/clean-outputs.ts
22
- var packageCleanOutputs = /* @__PURE__ */ __name(async () => {
22
+ var packageCleanOutputs = /* @__PURE__ */ __name(() => {
23
23
  const pkg = process.env.INIT_CWD ?? ".";
24
24
  const pkgName = process.env.npm_package_name;
25
25
  const folders = [
@@ -28,14 +28,16 @@ var packageCleanOutputs = /* @__PURE__ */ __name(async () => {
28
28
  path.join(pkg, "docs")
29
29
  ];
30
30
  console.log(chalk.green(`Cleaning Outputs [${pkgName}]`));
31
- await Promise.all(folders.map((folder) => deleteGlob(folder)));
31
+ for (let folder of folders) {
32
+ deleteGlob(folder);
33
+ }
32
34
  return 0;
33
35
  }, "packageCleanOutputs");
34
36
 
35
37
  // src/actions/package/clean-typescript.ts
36
38
  import path2 from "node:path";
37
39
  import chalk2 from "chalk";
38
- var packageCleanTypescript = /* @__PURE__ */ __name(async () => {
40
+ var packageCleanTypescript = /* @__PURE__ */ __name(() => {
39
41
  const pkg = process.env.INIT_CWD ?? ".";
40
42
  const pkgName = process.env.npm_package_name;
41
43
  console.log(chalk2.green(`Cleaning Typescript [${pkgName}]`));
@@ -44,7 +46,9 @@ var packageCleanTypescript = /* @__PURE__ */ __name(async () => {
44
46
  path2.join(pkg, ".tsconfig.*"),
45
47
  path2.join(pkg, ".eslintcache")
46
48
  ];
47
- await Promise.all(files.map((file) => deleteGlob(file)));
49
+ for (let file of files) {
50
+ deleteGlob(file);
51
+ }
48
52
  return 0;
49
53
  }, "packageCleanTypescript");
50
54
 
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/actions/package/clean-outputs.ts","../../../src/lib/deleteGlob.ts","../../../src/actions/package/clean-typescript.ts","../../../src/actions/package/clean.ts"],"sourcesContent":["import path from 'node:path'\n\nimport chalk from 'chalk'\n\nimport { deleteGlob } from '../../lib/index.ts'\n\nexport const packageCleanOutputs = async () => {\n const pkg = process.env.INIT_CWD ?? '.'\n const pkgName = process.env.npm_package_name\n const folders: string[] = [path.join(pkg, 'dist'), path.join(pkg, 'build'), path.join(pkg, 'docs')]\n console.log(chalk.green(`Cleaning Outputs [${pkgName}]`))\n\n await Promise.all(folders.map(folder => deleteGlob(folder)))\n\n return 0\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 path from 'node:path'\n\nimport chalk from 'chalk'\n\nimport { deleteGlob } from '../../lib/index.ts'\n\nexport const packageCleanTypescript = async () => {\n const pkg = process.env.INIT_CWD ?? '.'\n const pkgName = process.env.npm_package_name\n console.log(chalk.green(`Cleaning Typescript [${pkgName}]`))\n const files: string[] = [path.join(pkg, '*.tsbuildinfo'), path.join(pkg, '.tsconfig.*'), path.join(pkg, '.eslintcache')]\n\n await Promise.all(files.map(file => deleteGlob(file)))\n\n return 0\n}\n","import { packageCleanOutputs } from './clean-outputs.ts'\nimport { packageCleanTypescript } from './clean-typescript.ts'\n\nexport const packageClean = async () => {\n return (await Promise.all([packageCleanOutputs(), packageCleanTypescript()])).reduce((prev, value) => prev + value, 0)\n}\n"],"mappings":";;;;AAAA,OAAOA,UAAU;AAEjB,OAAOC,WAAW;;;ACFlB,OAAOC,QAAQ;AAEf,SAASC,YAAY;AAEd,IAAMC,aAAa,wBAACC,aAAAA;AAEzB,QAAMC,QAAQC,KAAKC,KAAKH,QAAAA;AAGxB,aAAWI,QAAQH,OAAO;AACxBI,OAAGC,OAAOF,MAAM;MAAEG,WAAW;MAAMC,OAAO;IAAK,CAAA;EACjD;AACF,GAR0B;;;ADEnB,IAAMC,sBAAsB,mCAAA;AACjC,QAAMC,MAAMC,QAAQC,IAAIC,YAAY;AACpC,QAAMC,UAAUH,QAAQC,IAAIG;AAC5B,QAAMC,UAAoB;IAACC,KAAKC,KAAKR,KAAK,MAAA;IAASO,KAAKC,KAAKR,KAAK,OAAA;IAAUO,KAAKC,KAAKR,KAAK,MAAA;;AAC3FS,UAAQC,IAAIC,MAAMC,MAAM,qBAAqBR,OAAAA,GAAU,CAAA;AAEvD,QAAMS,QAAQC,IAAIR,QAAQS,IAAIC,CAAAA,WAAUC,WAAWD,MAAAA,CAAAA,CAAAA;AAEnD,SAAO;AACT,GATmC;;;AENnC,OAAOE,WAAU;AAEjB,OAAOC,YAAW;AAIX,IAAMC,yBAAyB,mCAAA;AACpC,QAAMC,MAAMC,QAAQC,IAAIC,YAAY;AACpC,QAAMC,UAAUH,QAAQC,IAAIG;AAC5BC,UAAQC,IAAIC,OAAMC,MAAM,wBAAwBL,OAAAA,GAAU,CAAA;AAC1D,QAAMM,QAAkB;IAACC,MAAKC,KAAKZ,KAAK,eAAA;IAAkBW,MAAKC,KAAKZ,KAAK,aAAA;IAAgBW,MAAKC,KAAKZ,KAAK,cAAA;;AAExG,QAAMa,QAAQC,IAAIJ,MAAMK,IAAIC,CAAAA,SAAQC,WAAWD,IAAAA,CAAAA,CAAAA;AAE/C,SAAO;AACT,GATsC;;;ACH/B,IAAME,eAAe,mCAAA;AAC1B,UAAQ,MAAMC,QAAQC,IAAI;IAACC,oBAAAA;IAAuBC,uBAAAA;GAAyB,GAAGC,OAAO,CAACC,MAAMC,UAAUD,OAAOC,OAAO,CAAA;AACtH,GAF4B;","names":["path","chalk","fs","glob","deleteGlob","globPath","files","glob","sync","file","fs","rmSync","recursive","force","packageCleanOutputs","pkg","process","env","INIT_CWD","pkgName","npm_package_name","folders","path","join","console","log","chalk","green","Promise","all","map","folder","deleteGlob","path","chalk","packageCleanTypescript","pkg","process","env","INIT_CWD","pkgName","npm_package_name","console","log","chalk","green","files","path","join","Promise","all","map","file","deleteGlob","packageClean","Promise","all","packageCleanOutputs","packageCleanTypescript","reduce","prev","value"]}
1
+ {"version":3,"sources":["../../../src/actions/package/clean-outputs.ts","../../../src/lib/deleteGlob.ts","../../../src/actions/package/clean-typescript.ts","../../../src/actions/package/clean.ts"],"sourcesContent":["import path from 'node:path'\n\nimport chalk from 'chalk'\n\nimport { deleteGlob } from '../../lib/index.ts'\n\nexport const packageCleanOutputs = () => {\n const pkg = process.env.INIT_CWD ?? '.'\n const pkgName = process.env.npm_package_name\n const folders: string[] = [path.join(pkg, 'dist'), path.join(pkg, 'build'), path.join(pkg, 'docs')]\n console.log(chalk.green(`Cleaning Outputs [${pkgName}]`))\n\n for (let folder of folders) {\n deleteGlob(folder)\n }\n\n return 0\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 path from 'node:path'\n\nimport chalk from 'chalk'\n\nimport { deleteGlob } from '../../lib/index.ts'\n\nexport const packageCleanTypescript = () => {\n const pkg = process.env.INIT_CWD ?? '.'\n const pkgName = process.env.npm_package_name\n console.log(chalk.green(`Cleaning Typescript [${pkgName}]`))\n const files: string[] = [path.join(pkg, '*.tsbuildinfo'), path.join(pkg, '.tsconfig.*'), path.join(pkg, '.eslintcache')]\n\n for (let file of files) {\n deleteGlob(file)\n }\n\n return 0\n}\n","import { packageCleanOutputs } from './clean-outputs.ts'\nimport { packageCleanTypescript } from './clean-typescript.ts'\n\nexport const packageClean = async () => {\n return (await Promise.all([packageCleanOutputs(), packageCleanTypescript()])).reduce((prev, value) => prev + value, 0)\n}\n"],"mappings":";;;;AAAA,OAAOA,UAAU;AAEjB,OAAOC,WAAW;;;ACFlB,OAAOC,QAAQ;AAEf,SAASC,YAAY;AAEd,IAAMC,aAAa,wBAACC,aAAAA;AAEzB,QAAMC,QAAQC,KAAKC,KAAKH,QAAAA;AAGxB,aAAWI,QAAQH,OAAO;AACxBI,OAAGC,OAAOF,MAAM;MAAEG,WAAW;MAAMC,OAAO;IAAK,CAAA;EACjD;AACF,GAR0B;;;ADEnB,IAAMC,sBAAsB,6BAAA;AACjC,QAAMC,MAAMC,QAAQC,IAAIC,YAAY;AACpC,QAAMC,UAAUH,QAAQC,IAAIG;AAC5B,QAAMC,UAAoB;IAACC,KAAKC,KAAKR,KAAK,MAAA;IAASO,KAAKC,KAAKR,KAAK,OAAA;IAAUO,KAAKC,KAAKR,KAAK,MAAA;;AAC3FS,UAAQC,IAAIC,MAAMC,MAAM,qBAAqBR,OAAAA,GAAU,CAAA;AAEvD,WAASS,UAAUP,SAAS;AAC1BQ,eAAWD,MAAAA;EACb;AAEA,SAAO;AACT,GAXmC;;;AENnC,OAAOE,WAAU;AAEjB,OAAOC,YAAW;AAIX,IAAMC,yBAAyB,6BAAA;AACpC,QAAMC,MAAMC,QAAQC,IAAIC,YAAY;AACpC,QAAMC,UAAUH,QAAQC,IAAIG;AAC5BC,UAAQC,IAAIC,OAAMC,MAAM,wBAAwBL,OAAAA,GAAU,CAAA;AAC1D,QAAMM,QAAkB;IAACC,MAAKC,KAAKZ,KAAK,eAAA;IAAkBW,MAAKC,KAAKZ,KAAK,aAAA;IAAgBW,MAAKC,KAAKZ,KAAK,cAAA;;AAExG,WAASa,QAAQH,OAAO;AACtBI,eAAWD,IAAAA;EACb;AAEA,SAAO;AACT,GAXsC;;;ACH/B,IAAME,eAAe,mCAAA;AAC1B,UAAQ,MAAMC,QAAQC,IAAI;IAACC,oBAAAA;IAAuBC,uBAAAA;GAAyB,GAAGC,OAAO,CAACC,MAAMC,UAAUD,OAAOC,OAAO,CAAA;AACtH,GAF4B;","names":["path","chalk","fs","glob","deleteGlob","globPath","files","glob","sync","file","fs","rmSync","recursive","force","packageCleanOutputs","pkg","process","env","INIT_CWD","pkgName","npm_package_name","folders","path","join","console","log","chalk","green","folder","deleteGlob","path","chalk","packageCleanTypescript","pkg","process","env","INIT_CWD","pkgName","npm_package_name","console","log","chalk","green","files","path","join","file","deleteGlob","packageClean","Promise","all","packageCleanOutputs","packageCleanTypescript","reduce","prev","value"]}
@@ -52,7 +52,7 @@ var loadConfig = /* @__PURE__ */ __name(async (params) => {
52
52
  }, "loadConfig");
53
53
 
54
54
  // src/actions/package/clean-outputs.ts
55
- var packageCleanOutputs = /* @__PURE__ */ __name(async () => {
55
+ var packageCleanOutputs = /* @__PURE__ */ __name(() => {
56
56
  const pkg = process.env.INIT_CWD ?? ".";
57
57
  const pkgName = process.env.npm_package_name;
58
58
  const folders = [
@@ -61,14 +61,16 @@ var packageCleanOutputs = /* @__PURE__ */ __name(async () => {
61
61
  path.join(pkg, "docs")
62
62
  ];
63
63
  console.log(chalk3.green(`Cleaning Outputs [${pkgName}]`));
64
- await Promise.all(folders.map((folder) => deleteGlob(folder)));
64
+ for (let folder of folders) {
65
+ deleteGlob(folder);
66
+ }
65
67
  return 0;
66
68
  }, "packageCleanOutputs");
67
69
 
68
70
  // src/actions/package/clean-typescript.ts
69
71
  import path2 from "node:path";
70
72
  import chalk4 from "chalk";
71
- var packageCleanTypescript = /* @__PURE__ */ __name(async () => {
73
+ var packageCleanTypescript = /* @__PURE__ */ __name(() => {
72
74
  const pkg = process.env.INIT_CWD ?? ".";
73
75
  const pkgName = process.env.npm_package_name;
74
76
  console.log(chalk4.green(`Cleaning Typescript [${pkgName}]`));
@@ -77,7 +79,9 @@ var packageCleanTypescript = /* @__PURE__ */ __name(async () => {
77
79
  path2.join(pkg, ".tsconfig.*"),
78
80
  path2.join(pkg, ".eslintcache")
79
81
  ];
80
- await Promise.all(files.map((file) => deleteGlob(file)));
82
+ for (let file of files) {
83
+ deleteGlob(file);
84
+ }
81
85
  return 0;
82
86
  }, "packageCleanTypescript");
83
87