@xylabs/ts-scripts-yarn3 7.4.11 → 7.4.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/actions/deplint/checkPackage/checkPackage.mjs +12 -5
- package/dist/actions/deplint/checkPackage/checkPackage.mjs.map +1 -1
- package/dist/actions/deplint/checkPackage/getUnlistedDependencies.mjs +12 -5
- package/dist/actions/deplint/checkPackage/getUnlistedDependencies.mjs.map +1 -1
- package/dist/actions/deplint/checkPackage/index.mjs +12 -5
- package/dist/actions/deplint/checkPackage/index.mjs.map +1 -1
- package/dist/actions/deplint/deplint.mjs +12 -5
- package/dist/actions/deplint/deplint.mjs.map +1 -1
- package/dist/actions/deplint/index.mjs +12 -5
- package/dist/actions/deplint/index.mjs.map +1 -1
- package/dist/actions/index.mjs +306 -153
- package/dist/actions/index.mjs.map +1 -1
- package/dist/actions/readme-gen.mjs +173 -0
- package/dist/actions/readme-gen.mjs.map +1 -0
- package/dist/bin/xy.mjs +287 -112
- package/dist/bin/xy.mjs.map +1 -1
- package/dist/index.d.ts +17 -1
- package/dist/index.mjs +347 -170
- package/dist/index.mjs.map +1 -1
- package/dist/lib/generateReadmeFiles.mjs +160 -0
- package/dist/lib/generateReadmeFiles.mjs.map +1 -0
- package/dist/lib/index.mjs +145 -14
- package/dist/lib/index.mjs.map +1 -1
- package/dist/xy/index.mjs +287 -112
- package/dist/xy/index.mjs.map +1 -1
- package/dist/xy/xy.mjs +287 -112
- package/dist/xy/xy.mjs.map +1 -1
- package/dist/xy/xyCommonCommands.mjs +210 -42
- package/dist/xy/xyCommonCommands.mjs.map +1 -1
- package/dist/xy/xyLintCommands.mjs +12 -5
- package/dist/xy/xyLintCommands.mjs.map +1 -1
- package/package.json +2 -2
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
// src/lib/generateReadmeFiles.ts
|
|
2
|
+
import { execSync } from "child_process";
|
|
3
|
+
import FS from "fs";
|
|
4
|
+
import { readFile, writeFile } from "fs/promises";
|
|
5
|
+
import PATH from "path";
|
|
6
|
+
import chalk from "chalk";
|
|
7
|
+
|
|
8
|
+
// src/lib/yarn/workspace/yarnWorkspaces.ts
|
|
9
|
+
import { spawnSync } from "child_process";
|
|
10
|
+
var yarnWorkspaces = () => {
|
|
11
|
+
const result = spawnSync("yarn", ["workspaces", "list", "--json", "--recursive"], { encoding: "utf8", shell: true });
|
|
12
|
+
if (result.error) {
|
|
13
|
+
throw result.error;
|
|
14
|
+
}
|
|
15
|
+
return result.stdout.toString().split("\n").slice(0, -1).map((item) => {
|
|
16
|
+
return JSON.parse(item);
|
|
17
|
+
});
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
// src/lib/yarn/workspace/yarnWorkspace.ts
|
|
21
|
+
var yarnWorkspace = (pkg) => {
|
|
22
|
+
const workspace = yarnWorkspaces().find(({ name }) => name === pkg);
|
|
23
|
+
if (!workspace) throw new Error(`Workspace ${pkg} not found`);
|
|
24
|
+
return workspace;
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
// src/lib/yarn/yarnInitCwd.ts
|
|
28
|
+
var INIT_CWD = () => {
|
|
29
|
+
if (!process.env.INIT_CWD) console.error("Missing INIT_CWD");
|
|
30
|
+
return process.env.INIT_CWD;
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
// src/lib/generateReadmeFiles.ts
|
|
34
|
+
function fillTemplate(template, data) {
|
|
35
|
+
const additionalData = { ...data, safeName: data.name.replaceAll("/", "__").replaceAll("@", "") };
|
|
36
|
+
return template.replaceAll(/\{\{(.*?)\}\}/g, (_, key) => additionalData[key.trim()] ?? "");
|
|
37
|
+
}
|
|
38
|
+
function generateTypedoc(packageLocation, entryPoints) {
|
|
39
|
+
const tempDir = PATH.join(packageLocation, ".temp-typedoc");
|
|
40
|
+
try {
|
|
41
|
+
if (!FS.existsSync(tempDir)) {
|
|
42
|
+
FS.mkdirSync(tempDir, { recursive: true });
|
|
43
|
+
}
|
|
44
|
+
const typedocConfig = {
|
|
45
|
+
disableSources: true,
|
|
46
|
+
entryPointStrategy: "expand",
|
|
47
|
+
entryPoints: entryPoints.map((ep) => PATH.resolve(packageLocation, ep)),
|
|
48
|
+
excludeExternals: true,
|
|
49
|
+
excludeInternal: true,
|
|
50
|
+
excludePrivate: true,
|
|
51
|
+
githubPages: false,
|
|
52
|
+
hideBreadcrumbs: true,
|
|
53
|
+
hideGenerator: true,
|
|
54
|
+
hidePageTitle: true,
|
|
55
|
+
out: tempDir,
|
|
56
|
+
plugin: ["typedoc-plugin-markdown"],
|
|
57
|
+
readme: "none",
|
|
58
|
+
skipErrorChecking: true,
|
|
59
|
+
sort: ["source-order"],
|
|
60
|
+
theme: "markdown",
|
|
61
|
+
useCodeBlocks: true
|
|
62
|
+
};
|
|
63
|
+
const typedocJsonPath = PATH.join(tempDir, "typedoc.json");
|
|
64
|
+
FS.writeFileSync(typedocJsonPath, JSON.stringify(typedocConfig, null, 2));
|
|
65
|
+
try {
|
|
66
|
+
execSync(`npx typedoc --options ${typedocJsonPath}`, {
|
|
67
|
+
cwd: process.cwd(),
|
|
68
|
+
stdio: ["ignore", "pipe", "pipe"]
|
|
69
|
+
});
|
|
70
|
+
} catch {
|
|
71
|
+
return "";
|
|
72
|
+
}
|
|
73
|
+
return consolidateMarkdown(tempDir);
|
|
74
|
+
} catch {
|
|
75
|
+
return "";
|
|
76
|
+
} finally {
|
|
77
|
+
try {
|
|
78
|
+
FS.rmSync(tempDir, { force: true, recursive: true });
|
|
79
|
+
} catch {
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
function consolidateMarkdown(tempDir) {
|
|
84
|
+
let consolidated = "## Reference\n\n";
|
|
85
|
+
const mainReadmePath = PATH.join(tempDir, "README.md");
|
|
86
|
+
if (FS.existsSync(mainReadmePath)) {
|
|
87
|
+
const mainContent = FS.readFileSync(mainReadmePath, "utf8").replace(/^---(.|\n)*?---\n/, "").replace(/^# .+\n/, "").replaceAll(/\]\((.+?)\.md\)/g, "](#$1)");
|
|
88
|
+
consolidated += mainContent + "\n\n";
|
|
89
|
+
}
|
|
90
|
+
consolidated += processDirectory(tempDir);
|
|
91
|
+
return consolidated.replaceAll(/\n\n\n+/g, "\n\n").replaceAll(/^#### /gm, "### ").replaceAll(/^##### /gm, "#### ").replaceAll(/^###### /gm, "##### ");
|
|
92
|
+
}
|
|
93
|
+
function processDirectory(dir, level = 0) {
|
|
94
|
+
const indent = " ".repeat(level);
|
|
95
|
+
let content = "";
|
|
96
|
+
try {
|
|
97
|
+
const items = FS.readdirSync(dir, { withFileTypes: true });
|
|
98
|
+
for (const item of items) {
|
|
99
|
+
if (item.isDirectory()) continue;
|
|
100
|
+
if (item.name === "README.md" || !item.name.endsWith(".md")) continue;
|
|
101
|
+
const fileContent = FS.readFileSync(PATH.join(dir, item.name), "utf8").replace(/^---(.|\n)*?---\n/, "");
|
|
102
|
+
const moduleName = item.name.replace(".md", "");
|
|
103
|
+
content += `
|
|
104
|
+
|
|
105
|
+
${indent}### <a id="${moduleName}"></a>${moduleName}
|
|
106
|
+
|
|
107
|
+
`;
|
|
108
|
+
content += fileContent.replace(/^# .+\n/, "").replaceAll(/\]\((.+?)\.md\)/g, "](#$1)");
|
|
109
|
+
}
|
|
110
|
+
for (const item of items) {
|
|
111
|
+
if (!item.isDirectory()) continue;
|
|
112
|
+
if (item.name === "spec" || item.name.includes(".spec")) continue;
|
|
113
|
+
content += `
|
|
114
|
+
|
|
115
|
+
${indent}### ${item.name}
|
|
116
|
+
`;
|
|
117
|
+
content += processDirectory(PATH.join(dir, item.name), level + 1);
|
|
118
|
+
}
|
|
119
|
+
} catch {
|
|
120
|
+
}
|
|
121
|
+
return content;
|
|
122
|
+
}
|
|
123
|
+
async function generateReadmeFiles({
|
|
124
|
+
pkg,
|
|
125
|
+
templatePath,
|
|
126
|
+
typedoc = false,
|
|
127
|
+
verbose
|
|
128
|
+
}) {
|
|
129
|
+
console.log(chalk.green("Generate README Files"));
|
|
130
|
+
const cwd = INIT_CWD() ?? ".";
|
|
131
|
+
const resolvedTemplatePath = templatePath ?? PATH.join(cwd, "scripts", "README.template.md");
|
|
132
|
+
let template;
|
|
133
|
+
try {
|
|
134
|
+
template = await readFile(resolvedTemplatePath, "utf8");
|
|
135
|
+
} catch {
|
|
136
|
+
console.error(chalk.red(`Template not found: ${resolvedTemplatePath}`));
|
|
137
|
+
return 1;
|
|
138
|
+
}
|
|
139
|
+
const workspaces = pkg ? [yarnWorkspace(pkg)] : yarnWorkspaces();
|
|
140
|
+
let failed = false;
|
|
141
|
+
for (const { location, name } of workspaces) {
|
|
142
|
+
try {
|
|
143
|
+
const pkgJsonPath = PATH.join(location, "package.json");
|
|
144
|
+
const pkgJson = JSON.parse(await readFile(pkgJsonPath, "utf8"));
|
|
145
|
+
const typedocContent = typedoc ? generateTypedoc(location, ["src/index*.ts"]) : "";
|
|
146
|
+
const readmeContent = fillTemplate(template, { ...pkgJson, typedoc: typedocContent });
|
|
147
|
+
await writeFile(PATH.join(location, "README.md"), readmeContent);
|
|
148
|
+
if (verbose) console.log(chalk.green(` ${name}`));
|
|
149
|
+
} catch (ex) {
|
|
150
|
+
const error = ex;
|
|
151
|
+
console.warn(chalk.yellow(` Skipped ${location}: ${error.message}`));
|
|
152
|
+
failed = true;
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
return failed ? 1 : 0;
|
|
156
|
+
}
|
|
157
|
+
export {
|
|
158
|
+
generateReadmeFiles
|
|
159
|
+
};
|
|
160
|
+
//# sourceMappingURL=generateReadmeFiles.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/lib/generateReadmeFiles.ts","../../src/lib/yarn/workspace/yarnWorkspaces.ts","../../src/lib/yarn/workspace/yarnWorkspace.ts","../../src/lib/yarn/yarnInitCwd.ts"],"sourcesContent":["import { execSync } from 'node:child_process'\nimport FS from 'node:fs'\nimport { readFile, writeFile } from 'node:fs/promises'\nimport PATH from 'node:path'\n\nimport chalk from 'chalk'\n\nimport {\n INIT_CWD, yarnWorkspace, yarnWorkspaces,\n} from './yarn/index.ts'\n\ninterface GenerateReadmeFilesParams {\n pkg?: string\n templatePath?: string\n typedoc?: boolean\n verbose?: boolean\n}\n\nfunction fillTemplate(template: string, data: Record<string, string>): string {\n const additionalData: Record<string, string> = { ...data, safeName: data.name.replaceAll('/', '__').replaceAll('@', '') }\n return template.replaceAll(/\\{\\{(.*?)\\}\\}/g, (_, key: string) => additionalData[key.trim()] ?? '')\n}\n\nfunction generateTypedoc(packageLocation: string, entryPoints: string[]): string {\n const tempDir = PATH.join(packageLocation, '.temp-typedoc')\n\n try {\n if (!FS.existsSync(tempDir)) {\n FS.mkdirSync(tempDir, { recursive: true })\n }\n\n const typedocConfig = {\n disableSources: true,\n entryPointStrategy: 'expand',\n entryPoints: entryPoints.map(ep => PATH.resolve(packageLocation, ep)),\n excludeExternals: true,\n excludeInternal: true,\n excludePrivate: true,\n githubPages: false,\n hideBreadcrumbs: true,\n hideGenerator: true,\n hidePageTitle: true,\n out: tempDir,\n plugin: ['typedoc-plugin-markdown'],\n readme: 'none',\n skipErrorChecking: true,\n sort: ['source-order'],\n theme: 'markdown',\n useCodeBlocks: true,\n }\n\n const typedocJsonPath = PATH.join(tempDir, 'typedoc.json')\n FS.writeFileSync(typedocJsonPath, JSON.stringify(typedocConfig, null, 2))\n\n try {\n execSync(`npx typedoc --options ${typedocJsonPath}`, {\n cwd: process.cwd(),\n stdio: ['ignore', 'pipe', 'pipe'],\n })\n } catch {\n return ''\n }\n\n return consolidateMarkdown(tempDir)\n } catch {\n return ''\n } finally {\n try {\n FS.rmSync(tempDir, { force: true, recursive: true })\n } catch {\n // ignore cleanup errors\n }\n }\n}\n\nfunction consolidateMarkdown(tempDir: string): string {\n let consolidated = '## Reference\\n\\n'\n\n const mainReadmePath = PATH.join(tempDir, 'README.md')\n if (FS.existsSync(mainReadmePath)) {\n const mainContent = FS.readFileSync(mainReadmePath, 'utf8')\n .replace(/^---(.|\\n)*?---\\n/, '')\n .replace(/^# .+\\n/, '')\n .replaceAll(/\\]\\((.+?)\\.md\\)/g, '](#$1)')\n\n consolidated += mainContent + '\\n\\n'\n }\n\n consolidated += processDirectory(tempDir)\n\n return consolidated\n .replaceAll(/\\n\\n\\n+/g, '\\n\\n')\n .replaceAll(/^#### /gm, '### ')\n .replaceAll(/^##### /gm, '#### ')\n .replaceAll(/^###### /gm, '##### ')\n}\n\nfunction processDirectory(dir: string, level = 0): string {\n const indent = ' '.repeat(level)\n let content = ''\n\n try {\n const items = FS.readdirSync(dir, { withFileTypes: true })\n\n for (const item of items) {\n if (item.isDirectory()) continue\n if (item.name === 'README.md' || !item.name.endsWith('.md')) continue\n\n const fileContent = FS.readFileSync(PATH.join(dir, item.name), 'utf8')\n .replace(/^---(.|\\n)*?---\\n/, '')\n const moduleName = item.name.replace('.md', '')\n\n content += `\\n\\n${indent}### <a id=\"${moduleName}\"></a>${moduleName}\\n\\n`\n content += fileContent\n .replace(/^# .+\\n/, '')\n .replaceAll(/\\]\\((.+?)\\.md\\)/g, '](#$1)')\n }\n\n for (const item of items) {\n if (!item.isDirectory()) continue\n if (item.name === 'spec' || item.name.includes('.spec')) continue\n\n content += `\\n\\n${indent}### ${item.name}\\n`\n content += processDirectory(PATH.join(dir, item.name), level + 1)\n }\n } catch {\n // skip unreadable directories\n }\n\n return content\n}\n\nexport async function generateReadmeFiles({\n pkg, templatePath, typedoc = false, verbose,\n}: GenerateReadmeFilesParams): Promise<number> {\n console.log(chalk.green('Generate README Files'))\n const cwd = INIT_CWD() ?? '.'\n const resolvedTemplatePath = templatePath ?? PATH.join(cwd, 'scripts', 'README.template.md')\n\n let template: string\n try {\n template = await readFile(resolvedTemplatePath, 'utf8')\n } catch {\n console.error(chalk.red(`Template not found: ${resolvedTemplatePath}`))\n return 1\n }\n\n const workspaces = pkg ? [yarnWorkspace(pkg)] : yarnWorkspaces()\n let failed = false\n\n for (const { location, name } of workspaces) {\n try {\n const pkgJsonPath = PATH.join(location, 'package.json')\n const pkgJson = JSON.parse(await readFile(pkgJsonPath, 'utf8'))\n const typedocContent = typedoc ? generateTypedoc(location, ['src/index*.ts']) : ''\n const readmeContent = fillTemplate(template, { ...pkgJson, typedoc: typedocContent })\n await writeFile(PATH.join(location, 'README.md'), readmeContent)\n if (verbose) console.log(chalk.green(` ${name}`))\n } catch (ex) {\n const error = ex as Error\n console.warn(chalk.yellow(` Skipped ${location}: ${error.message}`))\n failed = true\n }\n }\n\n return failed ? 1 : 0\n}\n","import { 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"],"mappings":";AAAA,SAAS,gBAAgB;AACzB,OAAO,QAAQ;AACf,SAAS,UAAU,iBAAiB;AACpC,OAAO,UAAU;AAEjB,OAAO,WAAW;;;ACLlB,SAAS,iBAAiB;AAInB,IAAM,iBAAiB,MAAmB;AAC/C,QAAM,SAAS,UAAU,QAAQ,CAAC,cAAc,QAAQ,UAAU,aAAa,GAAG,EAAE,UAAU,QAAQ,OAAO,KAAK,CAAC;AACnH,MAAI,OAAO,OAAO;AAChB,UAAM,OAAO;AAAA,EACf;AACA,SACE,OAAO,OACJ,SAAS,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MAAM,SAAS,aAAa,MAAM,CAAC;AAC9D,YAAM,iBAAiB,UAAU,gBAAgB,UAAU,CAAC,eAAe,CAAC,IAAI;AAChF,YAAM,gBAAgB,aAAa,UAAU,EAAE,GAAG,SAAS,SAAS,eAAe,CAAC;AACpF,YAAM,UAAU,KAAK,KAAK,UAAU,WAAW,GAAG,aAAa;AAC/D,UAAI,QAAS,SAAQ,IAAI,MAAM,MAAM,KAAK,IAAI,EAAE,CAAC;AAAA,IACnD,SAAS,IAAI;AACX,YAAM,QAAQ;AACd,cAAQ,KAAK,MAAM,OAAO,aAAa,QAAQ,KAAK,MAAM,OAAO,EAAE,CAAC;AACpE,eAAS;AAAA,IACX;AAAA,EACF;AAEA,SAAO,SAAS,IAAI;AACtB;","names":[]}
|
package/dist/lib/index.mjs
CHANGED
|
@@ -376,8 +376,138 @@ var generateIgnoreFiles = (filename, pkg) => {
|
|
|
376
376
|
return succeeded ? 0 : 1;
|
|
377
377
|
};
|
|
378
378
|
|
|
379
|
-
// src/lib/
|
|
379
|
+
// src/lib/generateReadmeFiles.ts
|
|
380
|
+
import { execSync as execSync2 } from "child_process";
|
|
381
|
+
import FS from "fs";
|
|
382
|
+
import { readFile, writeFile } from "fs/promises";
|
|
383
|
+
import PATH2 from "path";
|
|
380
384
|
import chalk5 from "chalk";
|
|
385
|
+
function fillTemplate(template, data) {
|
|
386
|
+
const additionalData = { ...data, safeName: data.name.replaceAll("/", "__").replaceAll("@", "") };
|
|
387
|
+
return template.replaceAll(/\{\{(.*?)\}\}/g, (_, key) => additionalData[key.trim()] ?? "");
|
|
388
|
+
}
|
|
389
|
+
function generateTypedoc(packageLocation, entryPoints) {
|
|
390
|
+
const tempDir = PATH2.join(packageLocation, ".temp-typedoc");
|
|
391
|
+
try {
|
|
392
|
+
if (!FS.existsSync(tempDir)) {
|
|
393
|
+
FS.mkdirSync(tempDir, { recursive: true });
|
|
394
|
+
}
|
|
395
|
+
const typedocConfig = {
|
|
396
|
+
disableSources: true,
|
|
397
|
+
entryPointStrategy: "expand",
|
|
398
|
+
entryPoints: entryPoints.map((ep) => PATH2.resolve(packageLocation, ep)),
|
|
399
|
+
excludeExternals: true,
|
|
400
|
+
excludeInternal: true,
|
|
401
|
+
excludePrivate: true,
|
|
402
|
+
githubPages: false,
|
|
403
|
+
hideBreadcrumbs: true,
|
|
404
|
+
hideGenerator: true,
|
|
405
|
+
hidePageTitle: true,
|
|
406
|
+
out: tempDir,
|
|
407
|
+
plugin: ["typedoc-plugin-markdown"],
|
|
408
|
+
readme: "none",
|
|
409
|
+
skipErrorChecking: true,
|
|
410
|
+
sort: ["source-order"],
|
|
411
|
+
theme: "markdown",
|
|
412
|
+
useCodeBlocks: true
|
|
413
|
+
};
|
|
414
|
+
const typedocJsonPath = PATH2.join(tempDir, "typedoc.json");
|
|
415
|
+
FS.writeFileSync(typedocJsonPath, JSON.stringify(typedocConfig, null, 2));
|
|
416
|
+
try {
|
|
417
|
+
execSync2(`npx typedoc --options ${typedocJsonPath}`, {
|
|
418
|
+
cwd: process.cwd(),
|
|
419
|
+
stdio: ["ignore", "pipe", "pipe"]
|
|
420
|
+
});
|
|
421
|
+
} catch {
|
|
422
|
+
return "";
|
|
423
|
+
}
|
|
424
|
+
return consolidateMarkdown(tempDir);
|
|
425
|
+
} catch {
|
|
426
|
+
return "";
|
|
427
|
+
} finally {
|
|
428
|
+
try {
|
|
429
|
+
FS.rmSync(tempDir, { force: true, recursive: true });
|
|
430
|
+
} catch {
|
|
431
|
+
}
|
|
432
|
+
}
|
|
433
|
+
}
|
|
434
|
+
function consolidateMarkdown(tempDir) {
|
|
435
|
+
let consolidated = "## Reference\n\n";
|
|
436
|
+
const mainReadmePath = PATH2.join(tempDir, "README.md");
|
|
437
|
+
if (FS.existsSync(mainReadmePath)) {
|
|
438
|
+
const mainContent = FS.readFileSync(mainReadmePath, "utf8").replace(/^---(.|\n)*?---\n/, "").replace(/^# .+\n/, "").replaceAll(/\]\((.+?)\.md\)/g, "](#$1)");
|
|
439
|
+
consolidated += mainContent + "\n\n";
|
|
440
|
+
}
|
|
441
|
+
consolidated += processDirectory(tempDir);
|
|
442
|
+
return consolidated.replaceAll(/\n\n\n+/g, "\n\n").replaceAll(/^#### /gm, "### ").replaceAll(/^##### /gm, "#### ").replaceAll(/^###### /gm, "##### ");
|
|
443
|
+
}
|
|
444
|
+
function processDirectory(dir, level = 0) {
|
|
445
|
+
const indent = " ".repeat(level);
|
|
446
|
+
let content = "";
|
|
447
|
+
try {
|
|
448
|
+
const items = FS.readdirSync(dir, { withFileTypes: true });
|
|
449
|
+
for (const item of items) {
|
|
450
|
+
if (item.isDirectory()) continue;
|
|
451
|
+
if (item.name === "README.md" || !item.name.endsWith(".md")) continue;
|
|
452
|
+
const fileContent = FS.readFileSync(PATH2.join(dir, item.name), "utf8").replace(/^---(.|\n)*?---\n/, "");
|
|
453
|
+
const moduleName = item.name.replace(".md", "");
|
|
454
|
+
content += `
|
|
455
|
+
|
|
456
|
+
${indent}### <a id="${moduleName}"></a>${moduleName}
|
|
457
|
+
|
|
458
|
+
`;
|
|
459
|
+
content += fileContent.replace(/^# .+\n/, "").replaceAll(/\]\((.+?)\.md\)/g, "](#$1)");
|
|
460
|
+
}
|
|
461
|
+
for (const item of items) {
|
|
462
|
+
if (!item.isDirectory()) continue;
|
|
463
|
+
if (item.name === "spec" || item.name.includes(".spec")) continue;
|
|
464
|
+
content += `
|
|
465
|
+
|
|
466
|
+
${indent}### ${item.name}
|
|
467
|
+
`;
|
|
468
|
+
content += processDirectory(PATH2.join(dir, item.name), level + 1);
|
|
469
|
+
}
|
|
470
|
+
} catch {
|
|
471
|
+
}
|
|
472
|
+
return content;
|
|
473
|
+
}
|
|
474
|
+
async function generateReadmeFiles({
|
|
475
|
+
pkg,
|
|
476
|
+
templatePath,
|
|
477
|
+
typedoc = false,
|
|
478
|
+
verbose
|
|
479
|
+
}) {
|
|
480
|
+
console.log(chalk5.green("Generate README Files"));
|
|
481
|
+
const cwd = INIT_CWD() ?? ".";
|
|
482
|
+
const resolvedTemplatePath = templatePath ?? PATH2.join(cwd, "scripts", "README.template.md");
|
|
483
|
+
let template;
|
|
484
|
+
try {
|
|
485
|
+
template = await readFile(resolvedTemplatePath, "utf8");
|
|
486
|
+
} catch {
|
|
487
|
+
console.error(chalk5.red(`Template not found: ${resolvedTemplatePath}`));
|
|
488
|
+
return 1;
|
|
489
|
+
}
|
|
490
|
+
const workspaces = pkg ? [yarnWorkspace(pkg)] : yarnWorkspaces();
|
|
491
|
+
let failed = false;
|
|
492
|
+
for (const { location, name } of workspaces) {
|
|
493
|
+
try {
|
|
494
|
+
const pkgJsonPath = PATH2.join(location, "package.json");
|
|
495
|
+
const pkgJson = JSON.parse(await readFile(pkgJsonPath, "utf8"));
|
|
496
|
+
const typedocContent = typedoc ? generateTypedoc(location, ["src/index*.ts"]) : "";
|
|
497
|
+
const readmeContent = fillTemplate(template, { ...pkgJson, typedoc: typedocContent });
|
|
498
|
+
await writeFile(PATH2.join(location, "README.md"), readmeContent);
|
|
499
|
+
if (verbose) console.log(chalk5.green(` ${name}`));
|
|
500
|
+
} catch (ex) {
|
|
501
|
+
const error = ex;
|
|
502
|
+
console.warn(chalk5.yellow(` Skipped ${location}: ${error.message}`));
|
|
503
|
+
failed = true;
|
|
504
|
+
}
|
|
505
|
+
}
|
|
506
|
+
return failed ? 1 : 0;
|
|
507
|
+
}
|
|
508
|
+
|
|
509
|
+
// src/lib/loadConfig.ts
|
|
510
|
+
import chalk6 from "chalk";
|
|
381
511
|
import { cosmiconfig } from "cosmiconfig";
|
|
382
512
|
import { TypeScriptLoader } from "cosmiconfig-typescript-loader";
|
|
383
513
|
import deepmerge from "deepmerge";
|
|
@@ -388,9 +518,9 @@ var loadConfig = async (params) => {
|
|
|
388
518
|
config = cosmicConfigResult?.config;
|
|
389
519
|
const configFilePath = cosmicConfigResult?.filepath;
|
|
390
520
|
if (configFilePath !== void 0) {
|
|
391
|
-
console.log(
|
|
521
|
+
console.log(chalk6.green(`Loaded config from ${configFilePath}`));
|
|
392
522
|
if (config.verbose) {
|
|
393
|
-
console.log(
|
|
523
|
+
console.log(chalk6.gray(`${JSON.stringify(config, null, 2)}`));
|
|
394
524
|
}
|
|
395
525
|
}
|
|
396
526
|
}
|
|
@@ -408,15 +538,15 @@ var parsedPackageJSON = (path) => {
|
|
|
408
538
|
// src/lib/runSteps.ts
|
|
409
539
|
import { spawnSync as spawnSync3 } from "child_process";
|
|
410
540
|
import { existsSync as existsSync3 } from "fs";
|
|
411
|
-
import
|
|
541
|
+
import chalk7 from "chalk";
|
|
412
542
|
var runSteps = (name, steps, exitOnFail = true, messages) => {
|
|
413
543
|
return safeExit(() => {
|
|
414
544
|
const pkgName = process.env.npm_package_name;
|
|
415
|
-
console.log(
|
|
545
|
+
console.log(chalk7.green(`${name} [${pkgName}]`));
|
|
416
546
|
let totalStatus = 0;
|
|
417
547
|
for (const [i, [command, args, config2]] of steps.entries()) {
|
|
418
548
|
if (messages?.[i]) {
|
|
419
|
-
console.log(
|
|
549
|
+
console.log(chalk7.gray(messages?.[i]));
|
|
420
550
|
}
|
|
421
551
|
const argList = Array.isArray(args) ? args : args.split(" ");
|
|
422
552
|
if (command === "node" && !existsSync3(argList[0])) {
|
|
@@ -439,12 +569,12 @@ var runSteps = (name, steps, exitOnFail = true, messages) => {
|
|
|
439
569
|
// src/lib/runStepsAsync.ts
|
|
440
570
|
import { spawn } from "child_process";
|
|
441
571
|
import { existsSync as existsSync4 } from "fs";
|
|
442
|
-
import
|
|
572
|
+
import chalk8 from "chalk";
|
|
443
573
|
var runStepAsync = (name, step, exitOnFail = true, message) => {
|
|
444
574
|
return new Promise((resolve) => {
|
|
445
575
|
const [command, args, config2] = step;
|
|
446
576
|
if (message) {
|
|
447
|
-
console.log(
|
|
577
|
+
console.log(chalk8.gray(message));
|
|
448
578
|
}
|
|
449
579
|
const argList = Array.isArray(args) ? args : args.split(" ");
|
|
450
580
|
if (command === "node" && !existsSync4(argList[0])) {
|
|
@@ -458,8 +588,8 @@ var runStepAsync = (name, step, exitOnFail = true, message) => {
|
|
|
458
588
|
}).on("close", (code) => {
|
|
459
589
|
if (code) {
|
|
460
590
|
console.error(
|
|
461
|
-
|
|
462
|
-
`Command Exited With Non-Zero Result [${
|
|
591
|
+
chalk8.red(
|
|
592
|
+
`Command Exited With Non-Zero Result [${chalk8.gray(code)}] | ${chalk8.yellow(command)} ${chalk8.white(
|
|
463
593
|
Array.isArray(args) ? args.join(" ") : args
|
|
464
594
|
)}`
|
|
465
595
|
)
|
|
@@ -475,7 +605,7 @@ var runStepAsync = (name, step, exitOnFail = true, message) => {
|
|
|
475
605
|
var runStepsAsync = async (name, steps, exitOnFail = true, messages) => {
|
|
476
606
|
return await safeExitAsync(async () => {
|
|
477
607
|
const pkgName = process.env.npm_package_name;
|
|
478
|
-
console.log(
|
|
608
|
+
console.log(chalk8.green(`${name} [${pkgName}]`));
|
|
479
609
|
let result = 0;
|
|
480
610
|
for (const [i, step] of steps.entries()) {
|
|
481
611
|
result += await runStepAsync(name, step, exitOnFail, messages?.[i]);
|
|
@@ -493,12 +623,12 @@ var runXy = (command) => {
|
|
|
493
623
|
};
|
|
494
624
|
|
|
495
625
|
// src/lib/runXyWithWarning.ts
|
|
496
|
-
import
|
|
626
|
+
import chalk9 from "chalk";
|
|
497
627
|
var runXyWithWarning = (command) => {
|
|
498
628
|
const commandString = `yarn ${command}`;
|
|
499
629
|
const commandXyString = `yarn xy ${command}`;
|
|
500
|
-
console.warn(
|
|
501
|
-
console.warn(
|
|
630
|
+
console.warn(chalk9.yellow(`WARNING: [${chalk9.white(commandString)}] is deprecated for XY Labs Scripts.`));
|
|
631
|
+
console.warn(chalk9.gray(`Did you mean [${chalk9.magenta(commandXyString)}]?`));
|
|
502
632
|
return 1;
|
|
503
633
|
};
|
|
504
634
|
export {
|
|
@@ -519,6 +649,7 @@ export {
|
|
|
519
649
|
detectDuplicateDependencies,
|
|
520
650
|
empty,
|
|
521
651
|
generateIgnoreFiles,
|
|
652
|
+
generateReadmeFiles,
|
|
522
653
|
isYarnVersionOrGreater,
|
|
523
654
|
loadConfig,
|
|
524
655
|
multiLineToJSONArray,
|
package/dist/lib/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/lib/checkResult.ts","../../src/lib/claudeMdTemplate.ts","../../src/lib/createBuildConfig.ts","../../src/lib/defaultBuildConfig.ts","../../src/lib/deleteGlob.ts","../../src/lib/dependencies/detectDuplicateDependencies.ts","../../src/lib/processEx.ts","../../src/lib/withError.ts","../../src/lib/withErrnoException.ts","../../src/lib/safeExit.ts","../../src/lib/dependencies/DuplicateDetector.ts","../../src/lib/jsonFormatters.ts","../../src/lib/file/constants.ts","../../src/lib/file/fileLines.ts","../../src/lib/string/empty.ts","../../src/lib/string/union.ts","../../src/lib/file/ReadFileSyncOptions.ts","../../src/lib/file/tryReadFileSync.ts","../../src/lib/generateIgnoreFiles.ts","../../src/lib/yarn/isYarnVersionOrGreater.ts","../../src/lib/yarn/workspace/yarnWorkspaces.ts","../../src/lib/yarn/workspace/yarnWorkspace.ts","../../src/lib/yarn/yarnInitCwd.ts","../../src/lib/loadConfig.ts","../../src/lib/parsedPackageJSON.ts","../../src/lib/runSteps.ts","../../src/lib/runStepsAsync.ts","../../src/lib/runXy.ts","../../src/lib/runXyWithWarning.ts"],"sourcesContent":["import chalk from 'chalk'\n\nexport const checkResult = (name: string, result: number, level: 'error' | 'warn' = 'error', exitOnFail = false) => {\n if (result) {\n const exiting = exitOnFail ? '[Exiting Process]' : '[Continuing]'\n const chalkFunc = level === 'error' ? chalk.red : chalk.yellow\n console[level](chalkFunc(`${name} had ${result} failures ${exiting}`))\n if (exitOnFail) {\n process.exit(result)\n }\n }\n}\n","import { readdirSync, readFileSync } from 'node:fs'\nimport { createRequire } from 'node:module'\nimport PATH from 'node:path'\n\nconst require = createRequire(import.meta.url)\nconst packageRoot = PATH.dirname(require.resolve('@xylabs/ts-scripts-yarn3/package.json'))\nconst templatesDir = PATH.resolve(packageRoot, 'templates')\n\nexport const XYLABS_RULES_PREFIX = 'xylabs-'\nexport const XYLABS_COMMANDS_PREFIX = 'xylabs-'\n\nexport const claudeMdRuleTemplates = (): Record<string, string> => {\n const rulesDir = PATH.resolve(templatesDir, 'rules')\n const files = readdirSync(rulesDir).filter(f => f.startsWith(XYLABS_RULES_PREFIX) && f.endsWith('.md'))\n const result: Record<string, string> = {}\n for (const file of files) {\n result[file] = readFileSync(PATH.resolve(rulesDir, file), 'utf8')\n }\n return result\n}\n\nexport const claudeCommandTemplates = (): Record<string, string> => {\n const commandsDir = PATH.resolve(templatesDir, 'commands')\n const files = readdirSync(commandsDir).filter(f => f.startsWith(XYLABS_COMMANDS_PREFIX) && f.endsWith('.md'))\n const result: Record<string, string> = {}\n for (const file of files) {\n result[file] = readFileSync(PATH.resolve(commandsDir, file), 'utf8')\n }\n return result\n}\n\nexport const claudeMdProjectTemplate = (): string =>\n readFileSync(PATH.resolve(templatesDir, 'CLAUDE-project.md'), 'utf8')\n","import { readFileSync } from 'node:fs'\n\nimport { defaultBuildConfig } from './defaultBuildConfig.ts'\n\nconst getGeneralTypescriptConfig = (location: string) => {\n let generalConfig: string | undefined\n try {\n generalConfig = readFileSync(`${location}/tsconfig.json`, { encoding: 'utf8' })\n } catch {\n return false\n }\n return JSON.parse(generalConfig)\n}\n\nexport const createBuildConfig = (\n location: string,\n module: 'ESNext' | 'CommonJS',\n target: 'ESNext' | 'ES6',\n outDirSuffix: string,\n): Record<string, unknown> | undefined => {\n const generalConfigObject = getGeneralTypescriptConfig(location)\n if (generalConfigObject === false) {\n return undefined\n }\n return {\n ...generalConfigObject,\n compilerOptions: {\n ...defaultBuildConfig.compilerOptions,\n ...generalConfigObject.compilerOptions,\n module,\n outDir: `./${generalConfigObject.compilerOptions?.outDir ?? 'dist'}/${outDirSuffix}`,\n target,\n },\n exclude: [...(generalConfigObject.exclude ?? []), ...defaultBuildConfig.exclude],\n include: [...(generalConfigObject.include ?? []), ...defaultBuildConfig.include],\n }\n}\n","export const defaultBuildConfig = {\n compilerOptions: {\n rootDir: 'src',\n rootDirs: ['package.json'],\n },\n exclude: [\n '**/build',\n '**/dist',\n '**/node_modules',\n '**/*.spec.*',\n '**/*.spec',\n '**/*.stories.*',\n '**/*.example.*',\n '**/spec/*',\n '**/stories/*',\n ],\n include: ['src'],\n}\n","import fs from 'node:fs'\n\nimport { glob } from 'glob'\n\nexport const deleteGlob = (globPath: string) => {\n // Find all files matching the glob pattern\n const files = glob.sync(globPath)\n\n // Remove each file or directory\n for (const file of files) {\n fs.rmSync(file, { recursive: true, force: true })\n }\n}\n","import { execSync } from 'node:child_process'\n\nimport { safeExit } from '../safeExit.ts'\nimport { DuplicateDetector } from './DuplicateDetector.ts'\n\nexport const detectDuplicateDependencies = (depsFromPackageJSON?: string[], DefaultDependencies?: string[]) => {\n let exitCode = 0\n\n const dependencies = depsFromPackageJSON?.length ? depsFromPackageJSON : DefaultDependencies\n\n return safeExit(() => {\n if (dependencies) {\n for (const dependency of dependencies) {\n let output: string\n\n try {\n const cmd = `yarn why ${dependency} --json`\n output = execSync(cmd).toString()\n } catch (e) {\n console.error(`Error running yarn why: ${e}`)\n exitCode = 1\n continue\n }\n\n if (output) {\n exitCode = new DuplicateDetector(output, dependency).detect()\n } else {\n console.log(`${dependency} - N/A`)\n if (depsFromPackageJSON) {\n exitCode = 1\n console.log(`🚨 Library ${dependency} was requested in package.json but not found`)\n }\n }\n }\n return exitCode\n } else {\n console.log('🚨 No dependencies where passed')\n return exitCode\n }\n })\n}\n","import chalk from 'chalk'\n\nimport { withErrnoException } from './withErrnoException.ts'\nimport { withError } from './withError.ts'\n\nexport const processEx = (ex: unknown) => {\n const error = typeof ex === 'string' ? new Error(ex) : ex\n const exitCode\n = withErrnoException(error, (error) => {\n if (error.code === 'ENOENT') {\n console.error(chalk.red(`'${error.path}' not found.`))\n } else {\n console.error(chalk.red(`Errno: ${error.code}`))\n }\n return error.errno ?? -1\n })\n ?? withError(error, (error) => {\n console.error(chalk.red(`${error.name}: ${error.message}`))\n return -1\n })\n ?? (() => {\n console.error(chalk.red(`Unexpected Error: ${JSON.stringify(ex, null, 2)}`))\n return -1\n })()\n // This allows us to use a previously set exit code\n process.exit(process.exitCode ?? exitCode)\n}\n","export const withError = <T extends Error = Error>(\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n ex: any,\n closure: (error: T) => number,\n predicate = (ex: T) => (!!ex.name && !!ex.message),\n) => {\n return predicate(ex as T) ? closure(ex as T) : undefined\n}\n","import { withError } from './withError.ts'\n\nexport const withErrnoException = <T extends NodeJS.ErrnoException = NodeJS.ErrnoException>(\n ex: unknown, closure: (error: T) => number,\n) => {\n return withError<T>(ex, closure, (ex: unknown) => (ex as NodeJS.ErrnoException).errno !== undefined)\n}\n","/** Catch child process a crash and returns the code */\n\nimport { processEx } from './processEx.ts'\n\nconst safeExit = (func: () => number, exitOnFail = true): number => {\n try {\n const result = func()\n if (result && exitOnFail) {\n process.exit(result)\n }\n return result\n } catch (ex) {\n return processEx(ex)\n }\n}\n\nconst safeExitAsync = async (func: () => Promise<number>, exitOnFail = true): Promise<number> => {\n try {\n const result = await func()\n if (result && exitOnFail) {\n process.exit(result)\n }\n return result\n } catch (ex) {\n return processEx(ex)\n }\n}\n\nexport { safeExit, safeExitAsync }\n","import { EOL } from 'node:os'\n\nimport chalk from 'chalk'\n\nimport { multiLineToJSONArray } from '../jsonFormatters.ts'\n\ninterface ChildFields {\n descriptor: string\n locator: string\n}\n\nconst trimVirtualMeta = (value: string): string => {\n const virtualParts = value.split('virtual:')\n if (virtualParts.length > 1) {\n const hashParts = virtualParts[1].split('#')\n return virtualParts[0] + hashParts[1]\n } else {\n return value\n }\n}\n\nconst trimObjectDependencyVirtualMeta = (obj: Record<string, ChildFields>): Record<string, ChildFields> => {\n const resultObj: Record<string, ChildFields> = {}\n for (const [key, value] of Object.entries(obj)) {\n resultObj[trimVirtualMeta(key)] = {\n descriptor: trimVirtualMeta(value.descriptor),\n locator: trimVirtualMeta(value.locator),\n }\n }\n return resultObj\n}\n\nconst trimDependencyVirtualMeta = (dependencies: DependencyEntries): DependencyEntries => {\n return dependencies.map((dependency) => {\n return { children: trimObjectDependencyVirtualMeta(dependency.children), value: trimVirtualMeta(dependency.value) }\n })\n}\n\ninterface DependencyEntry {\n children: Record<string, ChildFields>\n value: string\n}\n\ntype DependencyEntries = DependencyEntry[]\n\ninterface Results {\n currentVersion: string | undefined\n dependency: string\n duplicateVersions: string[]\n}\n\nexport class DuplicateDetector {\n private dependency: string\n private dependencyEntries: DependencyEntries\n\n constructor(output: string, dependency: string) {\n this.dependency = dependency\n this.dependencyEntries = trimDependencyVirtualMeta(multiLineToJSONArray(output))\n }\n\n detect() {\n // eslint-disable-next-line unicorn/no-array-reduce\n const result = this.dependencyEntries.reduce(this.detectReducer, this.resultsFactory(this.dependency))\n if (result.duplicateVersions.length > 0) {\n console.log(chalk.yellow(`${EOL}Duplicates found for: ${this.dependency}`))\n const duplicateVersions = result.duplicateVersions.toString().replaceAll(',', `${EOL} `)\n console.log(chalk.grey(` ${duplicateVersions}`, EOL))\n return 1\n } else {\n console.log(`${this.dependency} - OK`)\n return 0\n }\n }\n\n private detectReducer(acc: Results, entry: DependencyEntry) {\n const version = Object.entries(entry.children).map(([k]) => k)[0]\n\n if (!acc.currentVersion) {\n acc.currentVersion = version\n return acc\n }\n\n if (acc.currentVersion && acc.currentVersion !== version && !version.includes('@virtual:')) {\n // if first duplicate, push the current version as the first duplicate\n if (acc.duplicateVersions.length === 0) {\n acc.duplicateVersions.push(acc.currentVersion)\n }\n acc.duplicateVersions.push(version)\n acc.duplicateVersions = [...new Set(acc.duplicateVersions)]\n }\n return acc\n }\n\n private resultsFactory = (dependency: string): Results => ({\n currentVersion: undefined, dependency, duplicateVersions: [],\n })\n}\n","export const multiLineToJSONArray = (output: string) => {\n const withCommas = output.replaceAll('\\r\\n', '').replaceAll('\\n', ',')\n const cleanCollection = withCommas.slice(0, Math.max(0, withCommas.length - 1))\n const collection = `[${cleanCollection}]`\n return JSON.parse(collection)\n}\n","export const WINDOWS_NEWLINE_REGEX = /\\r\\n/g\nexport const CROSS_PLATFORM_NEWLINE = '\\n'\n","import type { PathLike, WriteFileOptions } from 'node:fs'\nimport {\n existsSync, readFileSync,\n writeFileSync,\n} from 'node:fs'\n\nimport { notEmpty } from '../string/index.ts'\nimport { CROSS_PLATFORM_NEWLINE, WINDOWS_NEWLINE_REGEX } from './constants.ts'\nimport type { ReadFileSyncOptions } from './ReadFileSyncOptions.ts'\nimport { defaultReadFileSyncOptions } from './ReadFileSyncOptions.ts'\n\nexport const readLines = (uri: PathLike, options: ReadFileSyncOptions = defaultReadFileSyncOptions): string[] =>\n existsSync(uri)\n ? readFileSync(uri, options).replace(WINDOWS_NEWLINE_REGEX, CROSS_PLATFORM_NEWLINE).split(CROSS_PLATFORM_NEWLINE)\n : []\n\nexport const readNonEmptyLines = (uri: PathLike, options: ReadFileSyncOptions = defaultReadFileSyncOptions): string[] =>\n readLines(uri, options).filter(notEmpty)\n\nexport const writeLines = (uri: PathLike, lines: string[], options: WriteFileOptions = defaultReadFileSyncOptions) => {\n const existing = existsSync(uri) ? readFileSync(uri, options) : undefined\n const desired = lines.join(CROSS_PLATFORM_NEWLINE)\n // Check if the file is different before writing\n if (existing !== desired) writeFileSync(uri, desired, options)\n}\n","export const empty = (value?: string | undefined): boolean => value?.trim().length === 0\nexport const notEmpty = (value?: string | undefined): boolean => !empty(value)\n","export const union = (a: string[], b: string[]): Set<string> => new Set([...new Set(a), ...new Set(b)])\n","export type ReadFileSyncOptions = BufferEncoding | {\n encoding: BufferEncoding\n flags?: string\n}\n\nexport const defaultReadFileSyncOptions: ReadFileSyncOptions = { encoding: 'utf8' }\n","import type { PathLike } from 'node:fs'\nimport { existsSync, readFileSync } from 'node:fs'\n\nimport type { ReadFileSyncOptions } from './ReadFileSyncOptions.ts'\nimport { defaultReadFileSyncOptions } from './ReadFileSyncOptions.ts'\n\nexport const tryReadFileSync = (uri: PathLike, options: ReadFileSyncOptions = defaultReadFileSyncOptions): string | undefined => {\n return existsSync(uri) ? readFileSync(uri, options) : undefined\n}\n","import chalk from 'chalk'\n\nimport { readNonEmptyLines, writeLines } from './file/index.ts'\nimport { union } from './string/index.ts'\nimport {\n INIT_CWD, yarnWorkspace, yarnWorkspaces,\n} from './yarn/index.ts'\n\nconst localeCompare = (a: string, b: string) => a.localeCompare(b)\n\nconst mergeEntries = (a: string[], b: string[]): string[] => [...union(a, b)].toSorted(localeCompare)\n\nexport const generateIgnoreFiles = (filename: string, pkg?: string) => {\n console.log(chalk.green(`Generate ${filename} Files`))\n const cwd = INIT_CWD() ?? '.'\n const workspaces = pkg ? [yarnWorkspace(pkg)] : yarnWorkspaces()\n const readEntries = (location: string): string[] => readNonEmptyLines(`${location}/${filename}`)\n const writeEntries = (location: string, entries: string[]) => writeLines(`${location}/${filename}`, entries)\n const results = workspaces.map(({ location, name }) => {\n try {\n writeEntries(location, mergeEntries(readEntries(cwd), readEntries(location)))\n return 0\n } catch (ex) {\n const error = ex as Error\n console.error(`Generate ${filename} Files [${name}] [${error.message}]`)\n return 1\n }\n })\n const succeeded = results.every(result => result === 0)\n return succeeded ? 0 : 1\n}\n","import { spawnSync } from 'node:child_process'\n\nexport const isYarnVersionOrGreater = (major: number, minor?: number, patch?: number): [boolean, string] => {\n const result = spawnSync('yarn', ['-v'], { encoding: 'utf8', shell: true })\n const version = result.stdout.toString().replaceAll('\\n', '')\n const versionNumbers = version.split('.').map(ver => Number.parseInt(ver))\n const majorDelta = versionNumbers[0] - major\n const minorDelta = versionNumbers[1] - (minor ?? versionNumbers[1])\n const patchDelta = versionNumbers[2] - (patch ?? versionNumbers[2])\n\n const majorOk = majorDelta >= 0\n const minorOk = majorDelta > 0 || minorDelta >= 0\n const patchOk = majorDelta > 0 || minorDelta > 0 || patchDelta >= 0\n\n return [majorOk && minorOk && patchOk, version]\n}\n","import { spawnSync } from 'node:child_process'\n\nimport type { Workspace } from './Workspace.ts'\n\nexport const yarnWorkspaces = (): Workspace[] => {\n const result = spawnSync('yarn', ['workspaces', 'list', '--json', '--recursive'], { encoding: 'utf8', shell: true })\n if (result.error) {\n throw result.error\n }\n return (\n result.stdout\n .toString()\n // NOTE: This probably doesn't work on Windows\n // TODO: Replace /r/n with /n first\n .split('\\n')\n .slice(0, -1)\n .map((item) => {\n return JSON.parse(item)\n })\n )\n}\n","import type { Workspace } from './Workspace.ts'\nimport { yarnWorkspaces } from './yarnWorkspaces.ts'\n\nexport const yarnWorkspace = (pkg: string): Workspace => {\n const workspace = yarnWorkspaces().find(({ name }) => name === pkg)\n if (!workspace) throw new Error(`Workspace ${pkg} not found`)\n return workspace\n}\n","export const INIT_CWD = () => {\n if (!process.env.INIT_CWD) console.error('Missing INIT_CWD')\n return process.env.INIT_CWD\n}\n","import chalk from 'chalk'\nimport { cosmiconfig } from 'cosmiconfig'\nimport { TypeScriptLoader } from 'cosmiconfig-typescript-loader'\nimport deepmerge from 'deepmerge'\n\nlet config: Record<string, unknown>\n\nexport const loadConfig = async <T extends object>(params?: T): Promise<T> => {\n if (config === undefined) {\n const cosmicConfigResult = await cosmiconfig('xy', { cache: true, loaders: { '.ts': TypeScriptLoader() } }).search()\n config = cosmicConfigResult?.config\n const configFilePath = cosmicConfigResult?.filepath\n if (configFilePath !== undefined) {\n console.log(chalk.green(`Loaded config from ${configFilePath}`))\n if (config.verbose) {\n console.log(chalk.gray(`${JSON.stringify(config, null, 2)}`))\n }\n }\n }\n return deepmerge(config, params ?? {}) as T\n}\n","import { readFileSync } from 'node:fs'\n\nexport const parsedPackageJSON = (path?: string) => {\n const pathToPackageJSON = path ?? process.env.npm_package_json ?? ''\n const packageJSON = readFileSync(pathToPackageJSON).toString()\n return JSON.parse(packageJSON)\n}\n","import type { SpawnSyncOptionsWithBufferEncoding } from 'node:child_process'\nimport { spawnSync } from 'node:child_process'\nimport { existsSync } from 'node:fs'\n\nimport chalk from 'chalk'\n\nimport { checkResult } from './checkResult.ts'\nimport { safeExit } from './safeExit.ts'\n\nexport type ScriptStep\n = | [/* command */ 'yarn' | 'node' | 'ts-node-script' | 'tsc' | 'jest' | 'npm', /* arg */ string | string[]]\n | [/* command */ string, /* arg */ string | string[], /* config */ SpawnSyncOptionsWithBufferEncoding]\n\nexport const runSteps = (name: string, steps: ScriptStep[], exitOnFail = true, messages?: string[]): number => {\n return safeExit(() => {\n const pkgName = process.env.npm_package_name\n console.log(chalk.green(`${name} [${pkgName}]`))\n let totalStatus = 0\n for (const [i, [command, args, config]] of steps.entries()) {\n if (messages?.[i]) {\n console.log(chalk.gray(messages?.[i]))\n }\n const argList = Array.isArray(args) ? args : args.split(' ')\n if (command === 'node' && !existsSync(argList[0])) {\n throw new Error(`File not found [${argList[0]}]`)\n }\n const status\n = spawnSync(command, Array.isArray(args) ? args : args.split(' '), {\n ...config,\n encoding: 'utf8',\n env: { FORCE_COLOR: '3', ...process.env },\n shell: true,\n stdio: 'inherit',\n }).status ?? 0\n checkResult(name, status, 'error', exitOnFail)\n totalStatus += status ?? 0\n }\n return totalStatus\n }, !!exitOnFail)\n}\n","import { spawn } from 'node:child_process'\nimport { existsSync } from 'node:fs'\n\nimport chalk from 'chalk'\n\nimport { checkResult } from './checkResult.ts'\nimport type { ScriptStep } from './runSteps.ts'\nimport { safeExitAsync } from './safeExit.ts'\n\nexport const runStepAsync = (name: string, step: ScriptStep, exitOnFail = true, message?: string) => {\n return new Promise<number>((resolve) => {\n const [command, args, config] = step\n if (message) {\n console.log(chalk.gray(message))\n }\n const argList = Array.isArray(args) ? args : args.split(' ')\n if (command === 'node' && !existsSync(argList[0])) {\n throw new Error(`File not found [${argList[0]}]`)\n }\n spawn(command, Array.isArray(args) ? args : args.split(' '), {\n ...config,\n env: { FORCE_COLOR: '3', ...process.env },\n shell: true,\n stdio: 'inherit',\n }).on('close', (code) => {\n if (code) {\n console.error(\n chalk.red(\n `Command Exited With Non-Zero Result [${chalk.gray(code)}] | ${chalk.yellow(command)} ${chalk.white(\n Array.isArray(args) ? args.join(' ') : args,\n )}`,\n ),\n )\n checkResult(name, code, 'error', exitOnFail)\n resolve(code)\n } else {\n resolve(0)\n }\n })\n })\n}\n\nexport const runStepsAsync = async (name: string, steps: ScriptStep[], exitOnFail = true, messages?: string[]) => {\n return await safeExitAsync(async () => {\n const pkgName = process.env.npm_package_name\n console.log(chalk.green(`${name} [${pkgName}]`))\n let result = 0\n for (const [i, step] of steps.entries()) {\n result += await runStepAsync(name, step, exitOnFail, messages?.[i])\n }\n return result\n })\n}\n","import { runSteps } from './runSteps.ts'\n\nexport const runXy = (command: string) => {\n return runSteps(\n `XY [${command}]`,\n [['yarn', ['xy', command, ...process.argv.filter((value, index) => (index > 1 ? value : undefined))]]],\n )\n}\n","import chalk from 'chalk'\n\nexport const runXyWithWarning = (command: string) => {\n const commandString = `yarn ${command}`\n const commandXyString = `yarn xy ${command}`\n console.warn(chalk.yellow(`WARNING: [${chalk.white(commandString)}] is deprecated for XY Labs Scripts.`))\n console.warn(chalk.gray(`Did you mean [${chalk.magenta(commandXyString)}]?`))\n return 1\n}\n"],"mappings":";AAAA,OAAO,WAAW;AAEX,IAAM,cAAc,CAAC,MAAc,QAAgB,QAA0B,SAAS,aAAa,UAAU;AAClH,MAAI,QAAQ;AACV,UAAM,UAAU,aAAa,sBAAsB;AACnD,UAAM,YAAY,UAAU,UAAU,MAAM,MAAM,MAAM;AACxD,YAAQ,KAAK,EAAE,UAAU,GAAG,IAAI,QAAQ,MAAM,aAAa,OAAO,EAAE,CAAC;AACrE,QAAI,YAAY;AACd,cAAQ,KAAK,MAAM;AAAA,IACrB;AAAA,EACF;AACF;;;ACXA,SAAS,aAAa,oBAAoB;AAC1C,SAAS,qBAAqB;AAC9B,OAAO,UAAU;AAEjB,IAAMA,WAAU,cAAc,YAAY,GAAG;AAC7C,IAAM,cAAc,KAAK,QAAQA,SAAQ,QAAQ,uCAAuC,CAAC;AACzF,IAAM,eAAe,KAAK,QAAQ,aAAa,WAAW;AAEnD,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AC3C,gBAAQ,IAAI;AAAA,MACd,OAAO;AACL,gBAAQ,CAAC;AAAA,MACX;AAAA,IACF,CAAC;AAAA,EACH,CAAC;AACH;AAEO,IAAM,gBAAgB,OAAO,MAAc,OAAqB,aAAa,MAAM,aAAwB;AAChH,SAAO,MAAM,cAAc,YAAY;AACrC,UAAM,UAAU,QAAQ,IAAI;AAC5B,YAAQ,IAAIA,OAAM,MAAM,GAAG,IAAI,KAAK,OAAO,GAAG,CAAC;AAC/C,QAAI,SAAS;AACb,eAAW,CAAC,GAAG,IAAI,KAAK,MAAM,QAAQ,GAAG;AACvC,gBAAU,MAAM,aAAa,MAAM,MAAM,YAAY,WAAW,CAAC,CAAC;AAAA,IACpE;AACA,WAAO;AAAA,EACT,CAAC;AACH;;;AClDO,IAAM,QAAQ,CAAC,YAAoB;AACxC,SAAO;AAAA,IACL,OAAO,OAAO;AAAA,IACd,CAAC,CAAC,QAAQ,CAAC,MAAM,SAAS,GAAG,QAAQ,KAAK,OAAO,CAAC,OAAO,UAAW,QAAQ,IAAI,QAAQ,MAAU,CAAC,CAAC,CAAC;AAAA,EACvG;AACF;;;ACPA,OAAOE,YAAW;AAEX,IAAM,mBAAmB,CAAC,YAAoB;AACnD,QAAM,gBAAgB,QAAQ,OAAO;AACrC,QAAM,kBAAkB,WAAW,OAAO;AAC1C,UAAQ,KAAKA,OAAM,OAAO,aAAaA,OAAM,MAAM,aAAa,CAAC,sCAAsC,CAAC;AACxG,UAAQ,KAAKA,OAAM,KAAK,iBAAiBA,OAAM,QAAQ,eAAe,CAAC,IAAI,CAAC;AAC5E,SAAO;AACT;","names":["require","readFileSync","readFileSync","chalk","ex","ex","error","chalk","chalk","chalk","readFileSync","readFileSync","existsSync","readFileSync","existsSync","readFileSync","chalk","spawnSync","chalk","chalk","readFileSync","spawnSync","existsSync","chalk","chalk","config","existsSync","spawnSync","existsSync","chalk","config","chalk","existsSync","chalk"]}
|
|
1
|
+
{"version":3,"sources":["../../src/lib/checkResult.ts","../../src/lib/claudeMdTemplate.ts","../../src/lib/createBuildConfig.ts","../../src/lib/defaultBuildConfig.ts","../../src/lib/deleteGlob.ts","../../src/lib/dependencies/detectDuplicateDependencies.ts","../../src/lib/processEx.ts","../../src/lib/withError.ts","../../src/lib/withErrnoException.ts","../../src/lib/safeExit.ts","../../src/lib/dependencies/DuplicateDetector.ts","../../src/lib/jsonFormatters.ts","../../src/lib/file/constants.ts","../../src/lib/file/fileLines.ts","../../src/lib/string/empty.ts","../../src/lib/string/union.ts","../../src/lib/file/ReadFileSyncOptions.ts","../../src/lib/file/tryReadFileSync.ts","../../src/lib/generateIgnoreFiles.ts","../../src/lib/yarn/isYarnVersionOrGreater.ts","../../src/lib/yarn/workspace/yarnWorkspaces.ts","../../src/lib/yarn/workspace/yarnWorkspace.ts","../../src/lib/yarn/yarnInitCwd.ts","../../src/lib/generateReadmeFiles.ts","../../src/lib/loadConfig.ts","../../src/lib/parsedPackageJSON.ts","../../src/lib/runSteps.ts","../../src/lib/runStepsAsync.ts","../../src/lib/runXy.ts","../../src/lib/runXyWithWarning.ts"],"sourcesContent":["import chalk from 'chalk'\n\nexport const checkResult = (name: string, result: number, level: 'error' | 'warn' = 'error', exitOnFail = false) => {\n if (result) {\n const exiting = exitOnFail ? '[Exiting Process]' : '[Continuing]'\n const chalkFunc = level === 'error' ? chalk.red : chalk.yellow\n console[level](chalkFunc(`${name} had ${result} failures ${exiting}`))\n if (exitOnFail) {\n process.exit(result)\n }\n }\n}\n","import { readdirSync, readFileSync } from 'node:fs'\nimport { createRequire } from 'node:module'\nimport PATH from 'node:path'\n\nconst require = createRequire(import.meta.url)\nconst packageRoot = PATH.dirname(require.resolve('@xylabs/ts-scripts-yarn3/package.json'))\nconst templatesDir = PATH.resolve(packageRoot, 'templates')\n\nexport const XYLABS_RULES_PREFIX = 'xylabs-'\nexport const XYLABS_COMMANDS_PREFIX = 'xylabs-'\n\nexport const claudeMdRuleTemplates = (): Record<string, string> => {\n const rulesDir = PATH.resolve(templatesDir, 'rules')\n const files = readdirSync(rulesDir).filter(f => f.startsWith(XYLABS_RULES_PREFIX) && f.endsWith('.md'))\n const result: Record<string, string> = {}\n for (const file of files) {\n result[file] = readFileSync(PATH.resolve(rulesDir, file), 'utf8')\n }\n return result\n}\n\nexport const claudeCommandTemplates = (): Record<string, string> => {\n const commandsDir = PATH.resolve(templatesDir, 'commands')\n const files = readdirSync(commandsDir).filter(f => f.startsWith(XYLABS_COMMANDS_PREFIX) && f.endsWith('.md'))\n const result: Record<string, string> = {}\n for (const file of files) {\n result[file] = readFileSync(PATH.resolve(commandsDir, file), 'utf8')\n }\n return result\n}\n\nexport const claudeMdProjectTemplate = (): string =>\n readFileSync(PATH.resolve(templatesDir, 'CLAUDE-project.md'), 'utf8')\n","import { readFileSync } from 'node:fs'\n\nimport { defaultBuildConfig } from './defaultBuildConfig.ts'\n\nconst getGeneralTypescriptConfig = (location: string) => {\n let generalConfig: string | undefined\n try {\n generalConfig = readFileSync(`${location}/tsconfig.json`, { encoding: 'utf8' })\n } catch {\n return false\n }\n return JSON.parse(generalConfig)\n}\n\nexport const createBuildConfig = (\n location: string,\n module: 'ESNext' | 'CommonJS',\n target: 'ESNext' | 'ES6',\n outDirSuffix: string,\n): Record<string, unknown> | undefined => {\n const generalConfigObject = getGeneralTypescriptConfig(location)\n if (generalConfigObject === false) {\n return undefined\n }\n return {\n ...generalConfigObject,\n compilerOptions: {\n ...defaultBuildConfig.compilerOptions,\n ...generalConfigObject.compilerOptions,\n module,\n outDir: `./${generalConfigObject.compilerOptions?.outDir ?? 'dist'}/${outDirSuffix}`,\n target,\n },\n exclude: [...(generalConfigObject.exclude ?? []), ...defaultBuildConfig.exclude],\n include: [...(generalConfigObject.include ?? []), ...defaultBuildConfig.include],\n }\n}\n","export const defaultBuildConfig = {\n compilerOptions: {\n rootDir: 'src',\n rootDirs: ['package.json'],\n },\n exclude: [\n '**/build',\n '**/dist',\n '**/node_modules',\n '**/*.spec.*',\n '**/*.spec',\n '**/*.stories.*',\n '**/*.example.*',\n '**/spec/*',\n '**/stories/*',\n ],\n include: ['src'],\n}\n","import fs from 'node:fs'\n\nimport { glob } from 'glob'\n\nexport const deleteGlob = (globPath: string) => {\n // Find all files matching the glob pattern\n const files = glob.sync(globPath)\n\n // Remove each file or directory\n for (const file of files) {\n fs.rmSync(file, { recursive: true, force: true })\n }\n}\n","import { execSync } from 'node:child_process'\n\nimport { safeExit } from '../safeExit.ts'\nimport { DuplicateDetector } from './DuplicateDetector.ts'\n\nexport const detectDuplicateDependencies = (depsFromPackageJSON?: string[], DefaultDependencies?: string[]) => {\n let exitCode = 0\n\n const dependencies = depsFromPackageJSON?.length ? depsFromPackageJSON : DefaultDependencies\n\n return safeExit(() => {\n if (dependencies) {\n for (const dependency of dependencies) {\n let output: string\n\n try {\n const cmd = `yarn why ${dependency} --json`\n output = execSync(cmd).toString()\n } catch (e) {\n console.error(`Error running yarn why: ${e}`)\n exitCode = 1\n continue\n }\n\n if (output) {\n exitCode = new DuplicateDetector(output, dependency).detect()\n } else {\n console.log(`${dependency} - N/A`)\n if (depsFromPackageJSON) {\n exitCode = 1\n console.log(`🚨 Library ${dependency} was requested in package.json but not found`)\n }\n }\n }\n return exitCode\n } else {\n console.log('🚨 No dependencies where passed')\n return exitCode\n }\n })\n}\n","import chalk from 'chalk'\n\nimport { withErrnoException } from './withErrnoException.ts'\nimport { withError } from './withError.ts'\n\nexport const processEx = (ex: unknown) => {\n const error = typeof ex === 'string' ? new Error(ex) : ex\n const exitCode\n = withErrnoException(error, (error) => {\n if (error.code === 'ENOENT') {\n console.error(chalk.red(`'${error.path}' not found.`))\n } else {\n console.error(chalk.red(`Errno: ${error.code}`))\n }\n return error.errno ?? -1\n })\n ?? withError(error, (error) => {\n console.error(chalk.red(`${error.name}: ${error.message}`))\n return -1\n })\n ?? (() => {\n console.error(chalk.red(`Unexpected Error: ${JSON.stringify(ex, null, 2)}`))\n return -1\n })()\n // This allows us to use a previously set exit code\n process.exit(process.exitCode ?? exitCode)\n}\n","export const withError = <T extends Error = Error>(\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n ex: any,\n closure: (error: T) => number,\n predicate = (ex: T) => (!!ex.name && !!ex.message),\n) => {\n return predicate(ex as T) ? closure(ex as T) : undefined\n}\n","import { withError } from './withError.ts'\n\nexport const withErrnoException = <T extends NodeJS.ErrnoException = NodeJS.ErrnoException>(\n ex: unknown, closure: (error: T) => number,\n) => {\n return withError<T>(ex, closure, (ex: unknown) => (ex as NodeJS.ErrnoException).errno !== undefined)\n}\n","/** Catch child process a crash and returns the code */\n\nimport { processEx } from './processEx.ts'\n\nconst safeExit = (func: () => number, exitOnFail = true): number => {\n try {\n const result = func()\n if (result && exitOnFail) {\n process.exit(result)\n }\n return result\n } catch (ex) {\n return processEx(ex)\n }\n}\n\nconst safeExitAsync = async (func: () => Promise<number>, exitOnFail = true): Promise<number> => {\n try {\n const result = await func()\n if (result && exitOnFail) {\n process.exit(result)\n }\n return result\n } catch (ex) {\n return processEx(ex)\n }\n}\n\nexport { safeExit, safeExitAsync }\n","import { EOL } from 'node:os'\n\nimport chalk from 'chalk'\n\nimport { multiLineToJSONArray } from '../jsonFormatters.ts'\n\ninterface ChildFields {\n descriptor: string\n locator: string\n}\n\nconst trimVirtualMeta = (value: string): string => {\n const virtualParts = value.split('virtual:')\n if (virtualParts.length > 1) {\n const hashParts = virtualParts[1].split('#')\n return virtualParts[0] + hashParts[1]\n } else {\n return value\n }\n}\n\nconst trimObjectDependencyVirtualMeta = (obj: Record<string, ChildFields>): Record<string, ChildFields> => {\n const resultObj: Record<string, ChildFields> = {}\n for (const [key, value] of Object.entries(obj)) {\n resultObj[trimVirtualMeta(key)] = {\n descriptor: trimVirtualMeta(value.descriptor),\n locator: trimVirtualMeta(value.locator),\n }\n }\n return resultObj\n}\n\nconst trimDependencyVirtualMeta = (dependencies: DependencyEntries): DependencyEntries => {\n return dependencies.map((dependency) => {\n return { children: trimObjectDependencyVirtualMeta(dependency.children), value: trimVirtualMeta(dependency.value) }\n })\n}\n\ninterface DependencyEntry {\n children: Record<string, ChildFields>\n value: string\n}\n\ntype DependencyEntries = DependencyEntry[]\n\ninterface Results {\n currentVersion: string | undefined\n dependency: string\n duplicateVersions: string[]\n}\n\nexport class DuplicateDetector {\n private dependency: string\n private dependencyEntries: DependencyEntries\n\n constructor(output: string, dependency: string) {\n this.dependency = dependency\n this.dependencyEntries = trimDependencyVirtualMeta(multiLineToJSONArray(output))\n }\n\n detect() {\n // eslint-disable-next-line unicorn/no-array-reduce\n const result = this.dependencyEntries.reduce(this.detectReducer, this.resultsFactory(this.dependency))\n if (result.duplicateVersions.length > 0) {\n console.log(chalk.yellow(`${EOL}Duplicates found for: ${this.dependency}`))\n const duplicateVersions = result.duplicateVersions.toString().replaceAll(',', `${EOL} `)\n console.log(chalk.grey(` ${duplicateVersions}`, EOL))\n return 1\n } else {\n console.log(`${this.dependency} - OK`)\n return 0\n }\n }\n\n private detectReducer(acc: Results, entry: DependencyEntry) {\n const version = Object.entries(entry.children).map(([k]) => k)[0]\n\n if (!acc.currentVersion) {\n acc.currentVersion = version\n return acc\n }\n\n if (acc.currentVersion && acc.currentVersion !== version && !version.includes('@virtual:')) {\n // if first duplicate, push the current version as the first duplicate\n if (acc.duplicateVersions.length === 0) {\n acc.duplicateVersions.push(acc.currentVersion)\n }\n acc.duplicateVersions.push(version)\n acc.duplicateVersions = [...new Set(acc.duplicateVersions)]\n }\n return acc\n }\n\n private resultsFactory = (dependency: string): Results => ({\n currentVersion: undefined, dependency, duplicateVersions: [],\n })\n}\n","export const multiLineToJSONArray = (output: string) => {\n const withCommas = output.replaceAll('\\r\\n', '').replaceAll('\\n', ',')\n const cleanCollection = withCommas.slice(0, Math.max(0, withCommas.length - 1))\n const collection = `[${cleanCollection}]`\n return JSON.parse(collection)\n}\n","export const WINDOWS_NEWLINE_REGEX = /\\r\\n/g\nexport const CROSS_PLATFORM_NEWLINE = '\\n'\n","import type { PathLike, WriteFileOptions } from 'node:fs'\nimport {\n existsSync, readFileSync,\n writeFileSync,\n} from 'node:fs'\n\nimport { notEmpty } from '../string/index.ts'\nimport { CROSS_PLATFORM_NEWLINE, WINDOWS_NEWLINE_REGEX } from './constants.ts'\nimport type { ReadFileSyncOptions } from './ReadFileSyncOptions.ts'\nimport { defaultReadFileSyncOptions } from './ReadFileSyncOptions.ts'\n\nexport const readLines = (uri: PathLike, options: ReadFileSyncOptions = defaultReadFileSyncOptions): string[] =>\n existsSync(uri)\n ? readFileSync(uri, options).replace(WINDOWS_NEWLINE_REGEX, CROSS_PLATFORM_NEWLINE).split(CROSS_PLATFORM_NEWLINE)\n : []\n\nexport const readNonEmptyLines = (uri: PathLike, options: ReadFileSyncOptions = defaultReadFileSyncOptions): string[] =>\n readLines(uri, options).filter(notEmpty)\n\nexport const writeLines = (uri: PathLike, lines: string[], options: WriteFileOptions = defaultReadFileSyncOptions) => {\n const existing = existsSync(uri) ? readFileSync(uri, options) : undefined\n const desired = lines.join(CROSS_PLATFORM_NEWLINE)\n // Check if the file is different before writing\n if (existing !== desired) writeFileSync(uri, desired, options)\n}\n","export const empty = (value?: string | undefined): boolean => value?.trim().length === 0\nexport const notEmpty = (value?: string | undefined): boolean => !empty(value)\n","export const union = (a: string[], b: string[]): Set<string> => new Set([...new Set(a), ...new Set(b)])\n","export type ReadFileSyncOptions = BufferEncoding | {\n encoding: BufferEncoding\n flags?: string\n}\n\nexport const defaultReadFileSyncOptions: ReadFileSyncOptions = { encoding: 'utf8' }\n","import type { PathLike } from 'node:fs'\nimport { existsSync, readFileSync } from 'node:fs'\n\nimport type { ReadFileSyncOptions } from './ReadFileSyncOptions.ts'\nimport { defaultReadFileSyncOptions } from './ReadFileSyncOptions.ts'\n\nexport const tryReadFileSync = (uri: PathLike, options: ReadFileSyncOptions = defaultReadFileSyncOptions): string | undefined => {\n return existsSync(uri) ? readFileSync(uri, options) : undefined\n}\n","import chalk from 'chalk'\n\nimport { readNonEmptyLines, writeLines } from './file/index.ts'\nimport { union } from './string/index.ts'\nimport {\n INIT_CWD, yarnWorkspace, yarnWorkspaces,\n} from './yarn/index.ts'\n\nconst localeCompare = (a: string, b: string) => a.localeCompare(b)\n\nconst mergeEntries = (a: string[], b: string[]): string[] => [...union(a, b)].toSorted(localeCompare)\n\nexport const generateIgnoreFiles = (filename: string, pkg?: string) => {\n console.log(chalk.green(`Generate ${filename} Files`))\n const cwd = INIT_CWD() ?? '.'\n const workspaces = pkg ? [yarnWorkspace(pkg)] : yarnWorkspaces()\n const readEntries = (location: string): string[] => readNonEmptyLines(`${location}/${filename}`)\n const writeEntries = (location: string, entries: string[]) => writeLines(`${location}/${filename}`, entries)\n const results = workspaces.map(({ location, name }) => {\n try {\n writeEntries(location, mergeEntries(readEntries(cwd), readEntries(location)))\n return 0\n } catch (ex) {\n const error = ex as Error\n console.error(`Generate ${filename} Files [${name}] [${error.message}]`)\n return 1\n }\n })\n const succeeded = results.every(result => result === 0)\n return succeeded ? 0 : 1\n}\n","import { spawnSync } from 'node:child_process'\n\nexport const isYarnVersionOrGreater = (major: number, minor?: number, patch?: number): [boolean, string] => {\n const result = spawnSync('yarn', ['-v'], { encoding: 'utf8', shell: true })\n const version = result.stdout.toString().replaceAll('\\n', '')\n const versionNumbers = version.split('.').map(ver => Number.parseInt(ver))\n const majorDelta = versionNumbers[0] - major\n const minorDelta = versionNumbers[1] - (minor ?? versionNumbers[1])\n const patchDelta = versionNumbers[2] - (patch ?? versionNumbers[2])\n\n const majorOk = majorDelta >= 0\n const minorOk = majorDelta > 0 || minorDelta >= 0\n const patchOk = majorDelta > 0 || minorDelta > 0 || patchDelta >= 0\n\n return [majorOk && minorOk && patchOk, version]\n}\n","import { spawnSync } from 'node:child_process'\n\nimport type { Workspace } from './Workspace.ts'\n\nexport const yarnWorkspaces = (): Workspace[] => {\n const result = spawnSync('yarn', ['workspaces', 'list', '--json', '--recursive'], { encoding: 'utf8', shell: true })\n if (result.error) {\n throw result.error\n }\n return (\n result.stdout\n .toString()\n // NOTE: This probably doesn't work on Windows\n // TODO: Replace /r/n with /n first\n .split('\\n')\n .slice(0, -1)\n .map((item) => {\n return JSON.parse(item)\n })\n )\n}\n","import type { Workspace } from './Workspace.ts'\nimport { yarnWorkspaces } from './yarnWorkspaces.ts'\n\nexport const yarnWorkspace = (pkg: string): Workspace => {\n const workspace = yarnWorkspaces().find(({ name }) => name === pkg)\n if (!workspace) throw new Error(`Workspace ${pkg} not found`)\n return workspace\n}\n","export const INIT_CWD = () => {\n if (!process.env.INIT_CWD) console.error('Missing INIT_CWD')\n return process.env.INIT_CWD\n}\n","import { execSync } from 'node:child_process'\nimport FS from 'node:fs'\nimport { readFile, writeFile } from 'node:fs/promises'\nimport PATH from 'node:path'\n\nimport chalk from 'chalk'\n\nimport {\n INIT_CWD, yarnWorkspace, yarnWorkspaces,\n} from './yarn/index.ts'\n\ninterface GenerateReadmeFilesParams {\n pkg?: string\n templatePath?: string\n typedoc?: boolean\n verbose?: boolean\n}\n\nfunction fillTemplate(template: string, data: Record<string, string>): string {\n const additionalData: Record<string, string> = { ...data, safeName: data.name.replaceAll('/', '__').replaceAll('@', '') }\n return template.replaceAll(/\\{\\{(.*?)\\}\\}/g, (_, key: string) => additionalData[key.trim()] ?? '')\n}\n\nfunction generateTypedoc(packageLocation: string, entryPoints: string[]): string {\n const tempDir = PATH.join(packageLocation, '.temp-typedoc')\n\n try {\n if (!FS.existsSync(tempDir)) {\n FS.mkdirSync(tempDir, { recursive: true })\n }\n\n const typedocConfig = {\n disableSources: true,\n entryPointStrategy: 'expand',\n entryPoints: entryPoints.map(ep => PATH.resolve(packageLocation, ep)),\n excludeExternals: true,\n excludeInternal: true,\n excludePrivate: true,\n githubPages: false,\n hideBreadcrumbs: true,\n hideGenerator: true,\n hidePageTitle: true,\n out: tempDir,\n plugin: ['typedoc-plugin-markdown'],\n readme: 'none',\n skipErrorChecking: true,\n sort: ['source-order'],\n theme: 'markdown',\n useCodeBlocks: true,\n }\n\n const typedocJsonPath = PATH.join(tempDir, 'typedoc.json')\n FS.writeFileSync(typedocJsonPath, JSON.stringify(typedocConfig, null, 2))\n\n try {\n execSync(`npx typedoc --options ${typedocJsonPath}`, {\n cwd: process.cwd(),\n stdio: ['ignore', 'pipe', 'pipe'],\n })\n } catch {\n return ''\n }\n\n return consolidateMarkdown(tempDir)\n } catch {\n return ''\n } finally {\n try {\n FS.rmSync(tempDir, { force: true, recursive: true })\n } catch {\n // ignore cleanup errors\n }\n }\n}\n\nfunction consolidateMarkdown(tempDir: string): string {\n let consolidated = '## Reference\\n\\n'\n\n const mainReadmePath = PATH.join(tempDir, 'README.md')\n if (FS.existsSync(mainReadmePath)) {\n const mainContent = FS.readFileSync(mainReadmePath, 'utf8')\n .replace(/^---(.|\\n)*?---\\n/, '')\n .replace(/^# .+\\n/, '')\n .replaceAll(/\\]\\((.+?)\\.md\\)/g, '](#$1)')\n\n consolidated += mainContent + '\\n\\n'\n }\n\n consolidated += processDirectory(tempDir)\n\n return consolidated\n .replaceAll(/\\n\\n\\n+/g, '\\n\\n')\n .replaceAll(/^#### /gm, '### ')\n .replaceAll(/^##### /gm, '#### ')\n .replaceAll(/^###### /gm, '##### ')\n}\n\nfunction processDirectory(dir: string, level = 0): string {\n const indent = ' '.repeat(level)\n let content = ''\n\n try {\n const items = FS.readdirSync(dir, { withFileTypes: true })\n\n for (const item of items) {\n if (item.isDirectory()) continue\n if (item.name === 'README.md' || !item.name.endsWith('.md')) continue\n\n const fileContent = FS.readFileSync(PATH.join(dir, item.name), 'utf8')\n .replace(/^---(.|\\n)*?---\\n/, '')\n const moduleName = item.name.replace('.md', '')\n\n content += `\\n\\n${indent}### <a id=\"${moduleName}\"></a>${moduleName}\\n\\n`\n content += fileContent\n .replace(/^# .+\\n/, '')\n .replaceAll(/\\]\\((.+?)\\.md\\)/g, '](#$1)')\n }\n\n for (const item of items) {\n if (!item.isDirectory()) continue\n if (item.name === 'spec' || item.name.includes('.spec')) continue\n\n content += `\\n\\n${indent}### ${item.name}\\n`\n content += processDirectory(PATH.join(dir, item.name), level + 1)\n }\n } catch {\n // skip unreadable directories\n }\n\n return content\n}\n\nexport async function generateReadmeFiles({\n pkg, templatePath, typedoc = false, verbose,\n}: GenerateReadmeFilesParams): Promise<number> {\n console.log(chalk.green('Generate README Files'))\n const cwd = INIT_CWD() ?? '.'\n const resolvedTemplatePath = templatePath ?? PATH.join(cwd, 'scripts', 'README.template.md')\n\n let template: string\n try {\n template = await readFile(resolvedTemplatePath, 'utf8')\n } catch {\n console.error(chalk.red(`Template not found: ${resolvedTemplatePath}`))\n return 1\n }\n\n const workspaces = pkg ? [yarnWorkspace(pkg)] : yarnWorkspaces()\n let failed = false\n\n for (const { location, name } of workspaces) {\n try {\n const pkgJsonPath = PATH.join(location, 'package.json')\n const pkgJson = JSON.parse(await readFile(pkgJsonPath, 'utf8'))\n const typedocContent = typedoc ? generateTypedoc(location, ['src/index*.ts']) : ''\n const readmeContent = fillTemplate(template, { ...pkgJson, typedoc: typedocContent })\n await writeFile(PATH.join(location, 'README.md'), readmeContent)\n if (verbose) console.log(chalk.green(` ${name}`))\n } catch (ex) {\n const error = ex as Error\n console.warn(chalk.yellow(` Skipped ${location}: ${error.message}`))\n failed = true\n }\n }\n\n return failed ? 1 : 0\n}\n","import chalk from 'chalk'\nimport { cosmiconfig } from 'cosmiconfig'\nimport { TypeScriptLoader } from 'cosmiconfig-typescript-loader'\nimport deepmerge from 'deepmerge'\n\nlet config: Record<string, unknown>\n\nexport const loadConfig = async <T extends object>(params?: T): Promise<T> => {\n if (config === undefined) {\n const cosmicConfigResult = await cosmiconfig('xy', { cache: true, loaders: { '.ts': TypeScriptLoader() } }).search()\n config = cosmicConfigResult?.config\n const configFilePath = cosmicConfigResult?.filepath\n if (configFilePath !== undefined) {\n console.log(chalk.green(`Loaded config from ${configFilePath}`))\n if (config.verbose) {\n console.log(chalk.gray(`${JSON.stringify(config, null, 2)}`))\n }\n }\n }\n return deepmerge(config, params ?? {}) as T\n}\n","import { readFileSync } from 'node:fs'\n\nexport const parsedPackageJSON = (path?: string) => {\n const pathToPackageJSON = path ?? process.env.npm_package_json ?? ''\n const packageJSON = readFileSync(pathToPackageJSON).toString()\n return JSON.parse(packageJSON)\n}\n","import type { SpawnSyncOptionsWithBufferEncoding } from 'node:child_process'\nimport { spawnSync } from 'node:child_process'\nimport { existsSync } from 'node:fs'\n\nimport chalk from 'chalk'\n\nimport { checkResult } from './checkResult.ts'\nimport { safeExit } from './safeExit.ts'\n\nexport type ScriptStep\n = | [/* command */ 'yarn' | 'node' | 'ts-node-script' | 'tsc' | 'jest' | 'npm', /* arg */ string | string[]]\n | [/* command */ string, /* arg */ string | string[], /* config */ SpawnSyncOptionsWithBufferEncoding]\n\nexport const runSteps = (name: string, steps: ScriptStep[], exitOnFail = true, messages?: string[]): number => {\n return safeExit(() => {\n const pkgName = process.env.npm_package_name\n console.log(chalk.green(`${name} [${pkgName}]`))\n let totalStatus = 0\n for (const [i, [command, args, config]] of steps.entries()) {\n if (messages?.[i]) {\n console.log(chalk.gray(messages?.[i]))\n }\n const argList = Array.isArray(args) ? args : args.split(' ')\n if (command === 'node' && !existsSync(argList[0])) {\n throw new Error(`File not found [${argList[0]}]`)\n }\n const status\n = spawnSync(command, Array.isArray(args) ? args : args.split(' '), {\n ...config,\n encoding: 'utf8',\n env: { FORCE_COLOR: '3', ...process.env },\n shell: true,\n stdio: 'inherit',\n }).status ?? 0\n checkResult(name, status, 'error', exitOnFail)\n totalStatus += status ?? 0\n }\n return totalStatus\n }, !!exitOnFail)\n}\n","import { spawn } from 'node:child_process'\nimport { existsSync } from 'node:fs'\n\nimport chalk from 'chalk'\n\nimport { checkResult } from './checkResult.ts'\nimport type { ScriptStep } from './runSteps.ts'\nimport { safeExitAsync } from './safeExit.ts'\n\nexport const runStepAsync = (name: string, step: ScriptStep, exitOnFail = true, message?: string) => {\n return new Promise<number>((resolve) => {\n const [command, args, config] = step\n if (message) {\n console.log(chalk.gray(message))\n }\n const argList = Array.isArray(args) ? args : args.split(' ')\n if (command === 'node' && !existsSync(argList[0])) {\n throw new Error(`File not found [${argList[0]}]`)\n }\n spawn(command, Array.isArray(args) ? args : args.split(' '), {\n ...config,\n env: { FORCE_COLOR: '3', ...process.env },\n shell: true,\n stdio: 'inherit',\n }).on('close', (code) => {\n if (code) {\n console.error(\n chalk.red(\n `Command Exited With Non-Zero Result [${chalk.gray(code)}] | ${chalk.yellow(command)} ${chalk.white(\n Array.isArray(args) ? args.join(' ') : args,\n )}`,\n ),\n )\n checkResult(name, code, 'error', exitOnFail)\n resolve(code)\n } else {\n resolve(0)\n }\n })\n })\n}\n\nexport const runStepsAsync = async (name: string, steps: ScriptStep[], exitOnFail = true, messages?: string[]) => {\n return await safeExitAsync(async () => {\n const pkgName = process.env.npm_package_name\n console.log(chalk.green(`${name} [${pkgName}]`))\n let result = 0\n for (const [i, step] of steps.entries()) {\n result += await runStepAsync(name, step, exitOnFail, messages?.[i])\n }\n return result\n })\n}\n","import { runSteps } from './runSteps.ts'\n\nexport const runXy = (command: string) => {\n return runSteps(\n `XY [${command}]`,\n [['yarn', ['xy', command, ...process.argv.filter((value, index) => (index > 1 ? value : undefined))]]],\n )\n}\n","import chalk from 'chalk'\n\nexport const runXyWithWarning = (command: string) => {\n const commandString = `yarn ${command}`\n const commandXyString = `yarn xy ${command}`\n console.warn(chalk.yellow(`WARNING: [${chalk.white(commandString)}] is deprecated for XY Labs Scripts.`))\n console.warn(chalk.gray(`Did you mean [${chalk.magenta(commandXyString)}]?`))\n return 1\n}\n"],"mappings":";AAAA,OAAO,WAAW;AAEX,IAAM,cAAc,CAAC,MAAc,QAAgB,QAA0B,SAAS,aAAa,UAAU;AAClH,MAAI,QAAQ;AACV,UAAM,UAAU,aAAa,sBAAsB;AACnD,UAAM,YAAY,UAAU,UAAU,MAAM,MAAM,MAAM;AACxD,YAAQ,KAAK,EAAE,UAAU,GAAG,IAAI,QAAQ,MAAM,aAAa,OAAO,EAAE,CAAC;AACrE,QAAI,YAAY;AACd,cAAQ,KAAK,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BAAkB,WAAW,OAAO;AAC1C,UAAQ,KAAKA,OAAM,OAAO,aAAaA,OAAM,MAAM,aAAa,CAAC,sCAAsC,CAAC;AACxG,UAAQ,KAAKA,OAAM,KAAK,iBAAiBA,OAAM,QAAQ,eAAe,CAAC,IAAI,CAAC;AAC5E,SAAO;AACT;","names":["require","readFileSync","readFileSync","chalk","ex","ex","error","chalk","chalk","chalk","readFileSync","readFileSync","existsSync","readFileSync","existsSync","readFileSync","chalk","spawnSync","chalk","execSync","PATH","chalk","PATH","execSync","chalk","chalk","readFileSync","spawnSync","existsSync","chalk","chalk","config","existsSync","spawnSync","existsSync","chalk","config","chalk","existsSync","chalk"]}
|