@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
package/dist/xy/index.mjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
// src/xy/xy.ts
|
|
2
|
-
import
|
|
2
|
+
import chalk30 from "chalk";
|
|
3
3
|
|
|
4
4
|
// src/actions/build.ts
|
|
5
|
-
import
|
|
5
|
+
import chalk9 from "chalk";
|
|
6
6
|
|
|
7
7
|
// src/lib/checkResult.ts
|
|
8
8
|
import chalk from "chalk";
|
|
@@ -324,8 +324,138 @@ var generateIgnoreFiles = (filename3, pkg) => {
|
|
|
324
324
|
return succeeded ? 0 : 1;
|
|
325
325
|
};
|
|
326
326
|
|
|
327
|
-
// src/lib/
|
|
327
|
+
// src/lib/generateReadmeFiles.ts
|
|
328
|
+
import { execSync as execSync2 } from "child_process";
|
|
329
|
+
import FS from "fs";
|
|
330
|
+
import { readFile, writeFile } from "fs/promises";
|
|
331
|
+
import PATH2 from "path";
|
|
328
332
|
import chalk5 from "chalk";
|
|
333
|
+
function fillTemplate(template, data) {
|
|
334
|
+
const additionalData = { ...data, safeName: data.name.replaceAll("/", "__").replaceAll("@", "") };
|
|
335
|
+
return template.replaceAll(/\{\{(.*?)\}\}/g, (_, key) => additionalData[key.trim()] ?? "");
|
|
336
|
+
}
|
|
337
|
+
function generateTypedoc(packageLocation, entryPoints) {
|
|
338
|
+
const tempDir = PATH2.join(packageLocation, ".temp-typedoc");
|
|
339
|
+
try {
|
|
340
|
+
if (!FS.existsSync(tempDir)) {
|
|
341
|
+
FS.mkdirSync(tempDir, { recursive: true });
|
|
342
|
+
}
|
|
343
|
+
const typedocConfig = {
|
|
344
|
+
disableSources: true,
|
|
345
|
+
entryPointStrategy: "expand",
|
|
346
|
+
entryPoints: entryPoints.map((ep) => PATH2.resolve(packageLocation, ep)),
|
|
347
|
+
excludeExternals: true,
|
|
348
|
+
excludeInternal: true,
|
|
349
|
+
excludePrivate: true,
|
|
350
|
+
githubPages: false,
|
|
351
|
+
hideBreadcrumbs: true,
|
|
352
|
+
hideGenerator: true,
|
|
353
|
+
hidePageTitle: true,
|
|
354
|
+
out: tempDir,
|
|
355
|
+
plugin: ["typedoc-plugin-markdown"],
|
|
356
|
+
readme: "none",
|
|
357
|
+
skipErrorChecking: true,
|
|
358
|
+
sort: ["source-order"],
|
|
359
|
+
theme: "markdown",
|
|
360
|
+
useCodeBlocks: true
|
|
361
|
+
};
|
|
362
|
+
const typedocJsonPath = PATH2.join(tempDir, "typedoc.json");
|
|
363
|
+
FS.writeFileSync(typedocJsonPath, JSON.stringify(typedocConfig, null, 2));
|
|
364
|
+
try {
|
|
365
|
+
execSync2(`npx typedoc --options ${typedocJsonPath}`, {
|
|
366
|
+
cwd: process.cwd(),
|
|
367
|
+
stdio: ["ignore", "pipe", "pipe"]
|
|
368
|
+
});
|
|
369
|
+
} catch {
|
|
370
|
+
return "";
|
|
371
|
+
}
|
|
372
|
+
return consolidateMarkdown(tempDir);
|
|
373
|
+
} catch {
|
|
374
|
+
return "";
|
|
375
|
+
} finally {
|
|
376
|
+
try {
|
|
377
|
+
FS.rmSync(tempDir, { force: true, recursive: true });
|
|
378
|
+
} catch {
|
|
379
|
+
}
|
|
380
|
+
}
|
|
381
|
+
}
|
|
382
|
+
function consolidateMarkdown(tempDir) {
|
|
383
|
+
let consolidated = "## Reference\n\n";
|
|
384
|
+
const mainReadmePath = PATH2.join(tempDir, "README.md");
|
|
385
|
+
if (FS.existsSync(mainReadmePath)) {
|
|
386
|
+
const mainContent = FS.readFileSync(mainReadmePath, "utf8").replace(/^---(.|\n)*?---\n/, "").replace(/^# .+\n/, "").replaceAll(/\]\((.+?)\.md\)/g, "](#$1)");
|
|
387
|
+
consolidated += mainContent + "\n\n";
|
|
388
|
+
}
|
|
389
|
+
consolidated += processDirectory(tempDir);
|
|
390
|
+
return consolidated.replaceAll(/\n\n\n+/g, "\n\n").replaceAll(/^#### /gm, "### ").replaceAll(/^##### /gm, "#### ").replaceAll(/^###### /gm, "##### ");
|
|
391
|
+
}
|
|
392
|
+
function processDirectory(dir, level = 0) {
|
|
393
|
+
const indent = " ".repeat(level);
|
|
394
|
+
let content = "";
|
|
395
|
+
try {
|
|
396
|
+
const items = FS.readdirSync(dir, { withFileTypes: true });
|
|
397
|
+
for (const item of items) {
|
|
398
|
+
if (item.isDirectory()) continue;
|
|
399
|
+
if (item.name === "README.md" || !item.name.endsWith(".md")) continue;
|
|
400
|
+
const fileContent = FS.readFileSync(PATH2.join(dir, item.name), "utf8").replace(/^---(.|\n)*?---\n/, "");
|
|
401
|
+
const moduleName = item.name.replace(".md", "");
|
|
402
|
+
content += `
|
|
403
|
+
|
|
404
|
+
${indent}### <a id="${moduleName}"></a>${moduleName}
|
|
405
|
+
|
|
406
|
+
`;
|
|
407
|
+
content += fileContent.replace(/^# .+\n/, "").replaceAll(/\]\((.+?)\.md\)/g, "](#$1)");
|
|
408
|
+
}
|
|
409
|
+
for (const item of items) {
|
|
410
|
+
if (!item.isDirectory()) continue;
|
|
411
|
+
if (item.name === "spec" || item.name.includes(".spec")) continue;
|
|
412
|
+
content += `
|
|
413
|
+
|
|
414
|
+
${indent}### ${item.name}
|
|
415
|
+
`;
|
|
416
|
+
content += processDirectory(PATH2.join(dir, item.name), level + 1);
|
|
417
|
+
}
|
|
418
|
+
} catch {
|
|
419
|
+
}
|
|
420
|
+
return content;
|
|
421
|
+
}
|
|
422
|
+
async function generateReadmeFiles({
|
|
423
|
+
pkg,
|
|
424
|
+
templatePath,
|
|
425
|
+
typedoc = false,
|
|
426
|
+
verbose
|
|
427
|
+
}) {
|
|
428
|
+
console.log(chalk5.green("Generate README Files"));
|
|
429
|
+
const cwd = INIT_CWD() ?? ".";
|
|
430
|
+
const resolvedTemplatePath = templatePath ?? PATH2.join(cwd, "scripts", "README.template.md");
|
|
431
|
+
let template;
|
|
432
|
+
try {
|
|
433
|
+
template = await readFile(resolvedTemplatePath, "utf8");
|
|
434
|
+
} catch {
|
|
435
|
+
console.error(chalk5.red(`Template not found: ${resolvedTemplatePath}`));
|
|
436
|
+
return 1;
|
|
437
|
+
}
|
|
438
|
+
const workspaces = pkg ? [yarnWorkspace(pkg)] : yarnWorkspaces();
|
|
439
|
+
let failed = false;
|
|
440
|
+
for (const { location, name } of workspaces) {
|
|
441
|
+
try {
|
|
442
|
+
const pkgJsonPath = PATH2.join(location, "package.json");
|
|
443
|
+
const pkgJson = JSON.parse(await readFile(pkgJsonPath, "utf8"));
|
|
444
|
+
const typedocContent = typedoc ? generateTypedoc(location, ["src/index*.ts"]) : "";
|
|
445
|
+
const readmeContent = fillTemplate(template, { ...pkgJson, typedoc: typedocContent });
|
|
446
|
+
await writeFile(PATH2.join(location, "README.md"), readmeContent);
|
|
447
|
+
if (verbose) console.log(chalk5.green(` ${name}`));
|
|
448
|
+
} catch (ex) {
|
|
449
|
+
const error = ex;
|
|
450
|
+
console.warn(chalk5.yellow(` Skipped ${location}: ${error.message}`));
|
|
451
|
+
failed = true;
|
|
452
|
+
}
|
|
453
|
+
}
|
|
454
|
+
return failed ? 1 : 0;
|
|
455
|
+
}
|
|
456
|
+
|
|
457
|
+
// src/lib/loadConfig.ts
|
|
458
|
+
import chalk6 from "chalk";
|
|
329
459
|
import { cosmiconfig } from "cosmiconfig";
|
|
330
460
|
import { TypeScriptLoader } from "cosmiconfig-typescript-loader";
|
|
331
461
|
import deepmerge from "deepmerge";
|
|
@@ -336,9 +466,9 @@ var loadConfig = async (params) => {
|
|
|
336
466
|
config = cosmicConfigResult?.config;
|
|
337
467
|
const configFilePath = cosmicConfigResult?.filepath;
|
|
338
468
|
if (configFilePath !== void 0) {
|
|
339
|
-
console.log(
|
|
469
|
+
console.log(chalk6.green(`Loaded config from ${configFilePath}`));
|
|
340
470
|
if (config.verbose) {
|
|
341
|
-
console.log(
|
|
471
|
+
console.log(chalk6.gray(`${JSON.stringify(config, null, 2)}`));
|
|
342
472
|
}
|
|
343
473
|
}
|
|
344
474
|
}
|
|
@@ -356,15 +486,15 @@ var parsedPackageJSON = (path8) => {
|
|
|
356
486
|
// src/lib/runSteps.ts
|
|
357
487
|
import { spawnSync as spawnSync3 } from "child_process";
|
|
358
488
|
import { existsSync as existsSync2 } from "fs";
|
|
359
|
-
import
|
|
489
|
+
import chalk7 from "chalk";
|
|
360
490
|
var runSteps = (name, steps, exitOnFail = true, messages) => {
|
|
361
491
|
return safeExit(() => {
|
|
362
492
|
const pkgName = process.env.npm_package_name;
|
|
363
|
-
console.log(
|
|
493
|
+
console.log(chalk7.green(`${name} [${pkgName}]`));
|
|
364
494
|
let totalStatus = 0;
|
|
365
495
|
for (const [i, [command, args, config2]] of steps.entries()) {
|
|
366
496
|
if (messages?.[i]) {
|
|
367
|
-
console.log(
|
|
497
|
+
console.log(chalk7.gray(messages?.[i]));
|
|
368
498
|
}
|
|
369
499
|
const argList = Array.isArray(args) ? args : args.split(" ");
|
|
370
500
|
if (command === "node" && !existsSync2(argList[0])) {
|
|
@@ -387,12 +517,12 @@ var runSteps = (name, steps, exitOnFail = true, messages) => {
|
|
|
387
517
|
// src/lib/runStepsAsync.ts
|
|
388
518
|
import { spawn } from "child_process";
|
|
389
519
|
import { existsSync as existsSync3 } from "fs";
|
|
390
|
-
import
|
|
520
|
+
import chalk8 from "chalk";
|
|
391
521
|
var runStepAsync = (name, step, exitOnFail = true, message) => {
|
|
392
522
|
return new Promise((resolve) => {
|
|
393
523
|
const [command, args, config2] = step;
|
|
394
524
|
if (message) {
|
|
395
|
-
console.log(
|
|
525
|
+
console.log(chalk8.gray(message));
|
|
396
526
|
}
|
|
397
527
|
const argList = Array.isArray(args) ? args : args.split(" ");
|
|
398
528
|
if (command === "node" && !existsSync3(argList[0])) {
|
|
@@ -406,8 +536,8 @@ var runStepAsync = (name, step, exitOnFail = true, message) => {
|
|
|
406
536
|
}).on("close", (code) => {
|
|
407
537
|
if (code) {
|
|
408
538
|
console.error(
|
|
409
|
-
|
|
410
|
-
`Command Exited With Non-Zero Result [${
|
|
539
|
+
chalk8.red(
|
|
540
|
+
`Command Exited With Non-Zero Result [${chalk8.gray(code)}] | ${chalk8.yellow(command)} ${chalk8.white(
|
|
411
541
|
Array.isArray(args) ? args.join(" ") : args
|
|
412
542
|
)}`
|
|
413
543
|
)
|
|
@@ -423,7 +553,7 @@ var runStepAsync = (name, step, exitOnFail = true, message) => {
|
|
|
423
553
|
var runStepsAsync = async (name, steps, exitOnFail = true, messages) => {
|
|
424
554
|
return await safeExitAsync(async () => {
|
|
425
555
|
const pkgName = process.env.npm_package_name;
|
|
426
|
-
console.log(
|
|
556
|
+
console.log(chalk8.green(`${name} [${pkgName}]`));
|
|
427
557
|
let result = 0;
|
|
428
558
|
for (const [i, step] of steps.entries()) {
|
|
429
559
|
result += await runStepAsync(name, step, exitOnFail, messages?.[i]);
|
|
@@ -447,7 +577,7 @@ var build = async ({
|
|
|
447
577
|
const targetOptions = target === void 0 ? [] : ["-t", target];
|
|
448
578
|
const jobsOptions = jobs === void 0 ? [] : ["-j", `${jobs}`];
|
|
449
579
|
if (jobs !== void 0) {
|
|
450
|
-
console.log(
|
|
580
|
+
console.log(chalk9.blue(`Jobs set to [${jobs}]`));
|
|
451
581
|
}
|
|
452
582
|
const result = await runStepsAsync(`Build${incremental ? "-Incremental" : ""} [${pkg ?? "All"}]`, [
|
|
453
583
|
["yarn", ["xy", "compile", ...pkgOptions, ...targetOptions, ...verboseOptions, ...jobsOptions, ...incrementalOptions, "--types", "tsup"]],
|
|
@@ -455,7 +585,7 @@ var build = async ({
|
|
|
455
585
|
["yarn", ["xy", "deplint", ...pkgOptions, ...verboseOptions, ...jobsOptions, ...incrementalOptions]],
|
|
456
586
|
["yarn", ["xy", "lint", ...pkgOptions, ...verboseOptions, ...incrementalOptions]]
|
|
457
587
|
]);
|
|
458
|
-
console.log(`${
|
|
588
|
+
console.log(`${chalk9.gray("Built in")} [${chalk9.magenta(((Date.now() - start) / 1e3).toFixed(2))}] ${chalk9.gray("seconds")}`);
|
|
459
589
|
return result;
|
|
460
590
|
};
|
|
461
591
|
|
|
@@ -468,15 +598,15 @@ import {
|
|
|
468
598
|
unlinkSync,
|
|
469
599
|
writeFileSync as writeFileSync2
|
|
470
600
|
} from "fs";
|
|
471
|
-
import
|
|
472
|
-
import
|
|
601
|
+
import PATH3 from "path";
|
|
602
|
+
import chalk10 from "chalk";
|
|
473
603
|
var syncCommandFiles = (commandsDir) => {
|
|
474
604
|
const templates = claudeCommandTemplates();
|
|
475
605
|
const templateNames = new Set(Object.keys(templates));
|
|
476
606
|
let updated = 0;
|
|
477
607
|
let created = 0;
|
|
478
608
|
for (const [filename3, content] of Object.entries(templates)) {
|
|
479
|
-
const targetPath =
|
|
609
|
+
const targetPath = PATH3.resolve(commandsDir, filename3);
|
|
480
610
|
const existing = existsSync4(targetPath) ? readFileSync4(targetPath, "utf8") : void 0;
|
|
481
611
|
if (existing === content) continue;
|
|
482
612
|
writeFileSync2(targetPath, content, "utf8");
|
|
@@ -497,7 +627,7 @@ var removeStaleCommands = (commandsDir, templateNames) => {
|
|
|
497
627
|
let removed = 0;
|
|
498
628
|
for (const file of existingCommands) {
|
|
499
629
|
if (!templateNames.has(file)) {
|
|
500
|
-
unlinkSync(
|
|
630
|
+
unlinkSync(PATH3.resolve(commandsDir, file));
|
|
501
631
|
removed++;
|
|
502
632
|
}
|
|
503
633
|
}
|
|
@@ -510,14 +640,14 @@ var logCommandsResult = (created, updated, removed) => {
|
|
|
510
640
|
updated ? `${updated} updated` : "",
|
|
511
641
|
removed ? `${removed} removed` : ""
|
|
512
642
|
].filter(Boolean);
|
|
513
|
-
console.log(
|
|
643
|
+
console.log(chalk10.green(`.claude/commands/${XYLABS_COMMANDS_PREFIX}*.md: ${parts.join(", ")}`));
|
|
514
644
|
} else {
|
|
515
|
-
console.log(
|
|
645
|
+
console.log(chalk10.gray(`.claude/commands/${XYLABS_COMMANDS_PREFIX}*.md: already up to date`));
|
|
516
646
|
}
|
|
517
647
|
};
|
|
518
648
|
var claudeCommands = () => {
|
|
519
649
|
const cwd = INIT_CWD() ?? process.cwd();
|
|
520
|
-
const commandsDir =
|
|
650
|
+
const commandsDir = PATH3.resolve(cwd, ".claude", "commands");
|
|
521
651
|
mkdirSync(commandsDir, { recursive: true });
|
|
522
652
|
const {
|
|
523
653
|
created,
|
|
@@ -538,15 +668,15 @@ import {
|
|
|
538
668
|
unlinkSync as unlinkSync2,
|
|
539
669
|
writeFileSync as writeFileSync3
|
|
540
670
|
} from "fs";
|
|
541
|
-
import
|
|
542
|
-
import
|
|
671
|
+
import PATH4 from "path";
|
|
672
|
+
import chalk11 from "chalk";
|
|
543
673
|
var syncRuleFiles = (rulesDir) => {
|
|
544
674
|
const templates = claudeMdRuleTemplates();
|
|
545
675
|
const templateNames = new Set(Object.keys(templates));
|
|
546
676
|
let updated = 0;
|
|
547
677
|
let created = 0;
|
|
548
678
|
for (const [filename3, content] of Object.entries(templates)) {
|
|
549
|
-
const targetPath =
|
|
679
|
+
const targetPath = PATH4.resolve(rulesDir, filename3);
|
|
550
680
|
const existing = existsSync5(targetPath) ? readFileSync5(targetPath, "utf8") : void 0;
|
|
551
681
|
if (existing === content) continue;
|
|
552
682
|
writeFileSync3(targetPath, content, "utf8");
|
|
@@ -567,7 +697,7 @@ var removeStaleRules = (rulesDir, templateNames) => {
|
|
|
567
697
|
let removed = 0;
|
|
568
698
|
for (const file of existingRules) {
|
|
569
699
|
if (!templateNames.has(file)) {
|
|
570
|
-
unlinkSync2(
|
|
700
|
+
unlinkSync2(PATH4.resolve(rulesDir, file));
|
|
571
701
|
removed++;
|
|
572
702
|
}
|
|
573
703
|
}
|
|
@@ -580,26 +710,26 @@ var logRulesResult = (created, updated, removed) => {
|
|
|
580
710
|
updated ? `${updated} updated` : "",
|
|
581
711
|
removed ? `${removed} removed` : ""
|
|
582
712
|
].filter(Boolean);
|
|
583
|
-
console.log(
|
|
713
|
+
console.log(chalk11.green(`.claude/rules/${XYLABS_RULES_PREFIX}*.md: ${parts.join(", ")}`));
|
|
584
714
|
} else {
|
|
585
|
-
console.log(
|
|
715
|
+
console.log(chalk11.gray(`.claude/rules/${XYLABS_RULES_PREFIX}*.md: already up to date`));
|
|
586
716
|
}
|
|
587
717
|
};
|
|
588
718
|
var ensureProjectClaudeMd = (cwd, force) => {
|
|
589
|
-
const projectPath =
|
|
719
|
+
const projectPath = PATH4.resolve(cwd, "CLAUDE.md");
|
|
590
720
|
if (!existsSync5(projectPath) || force) {
|
|
591
721
|
if (force && existsSync5(projectPath)) {
|
|
592
|
-
console.log(
|
|
722
|
+
console.log(chalk11.yellow("Overwriting existing CLAUDE.md"));
|
|
593
723
|
}
|
|
594
724
|
writeFileSync3(projectPath, claudeMdProjectTemplate(), "utf8");
|
|
595
|
-
console.log(
|
|
725
|
+
console.log(chalk11.green("Generated CLAUDE.md"));
|
|
596
726
|
} else {
|
|
597
|
-
console.log(
|
|
727
|
+
console.log(chalk11.gray("CLAUDE.md already exists (skipped)"));
|
|
598
728
|
}
|
|
599
729
|
};
|
|
600
730
|
var claudeRules = ({ force } = {}) => {
|
|
601
731
|
const cwd = INIT_CWD() ?? process.cwd();
|
|
602
|
-
const rulesDir =
|
|
732
|
+
const rulesDir = PATH4.resolve(cwd, ".claude", "rules");
|
|
603
733
|
mkdirSync2(rulesDir, { recursive: true });
|
|
604
734
|
const {
|
|
605
735
|
created,
|
|
@@ -626,16 +756,16 @@ var cleanAll = ({ verbose }) => {
|
|
|
626
756
|
|
|
627
757
|
// src/actions/clean-docs.ts
|
|
628
758
|
import path from "path";
|
|
629
|
-
import
|
|
759
|
+
import chalk12 from "chalk";
|
|
630
760
|
var cleanDocs = () => {
|
|
631
761
|
const pkgName = process.env.npm_package_name;
|
|
632
|
-
console.log(
|
|
762
|
+
console.log(chalk12.green(`Cleaning Docs [${pkgName}]`));
|
|
633
763
|
for (const { location } of yarnWorkspaces()) deleteGlob(path.join(location, "docs"));
|
|
634
764
|
return 0;
|
|
635
765
|
};
|
|
636
766
|
|
|
637
767
|
// src/actions/compile.ts
|
|
638
|
-
import
|
|
768
|
+
import chalk13 from "chalk";
|
|
639
769
|
var compile = ({
|
|
640
770
|
verbose,
|
|
641
771
|
target,
|
|
@@ -676,7 +806,7 @@ var compileAll = ({
|
|
|
676
806
|
const incrementalOptions = incremental ? ["--since", "-Ap", "--topological-dev"] : ["--parallel", "-Ap", "--topological-dev"];
|
|
677
807
|
const jobsOptions = jobs ? ["-j", `${jobs}`] : [];
|
|
678
808
|
if (jobs) {
|
|
679
|
-
console.log(
|
|
809
|
+
console.log(chalk13.blue(`Jobs set to [${jobs}]`));
|
|
680
810
|
}
|
|
681
811
|
const result = runSteps(`Compile${incremental ? "-Incremental" : ""} [All]`, [
|
|
682
812
|
["yarn", [
|
|
@@ -690,13 +820,13 @@ var compileAll = ({
|
|
|
690
820
|
...targetOptions
|
|
691
821
|
]]
|
|
692
822
|
]);
|
|
693
|
-
console.log(`${
|
|
823
|
+
console.log(`${chalk13.gray("Compiled in")} [${chalk13.magenta(((Date.now() - start) / 1e3).toFixed(2))}] ${chalk13.gray("seconds")}`);
|
|
694
824
|
return result;
|
|
695
825
|
};
|
|
696
826
|
|
|
697
827
|
// src/actions/copy-assets.ts
|
|
698
828
|
import path2 from "path/posix";
|
|
699
|
-
import
|
|
829
|
+
import chalk14 from "chalk";
|
|
700
830
|
import cpy from "cpy";
|
|
701
831
|
var copyPackageTargetAssets = async (target, name, location) => {
|
|
702
832
|
try {
|
|
@@ -719,7 +849,7 @@ var copyPackageTargetAssets = async (target, name, location) => {
|
|
|
719
849
|
};
|
|
720
850
|
var copyTargetAssets = async (target, pkg) => {
|
|
721
851
|
const workspaces = yarnWorkspaces();
|
|
722
|
-
console.log(
|
|
852
|
+
console.log(chalk14.green(`Copying Assets [${target.toUpperCase()}]`));
|
|
723
853
|
const workspaceList = workspaces.filter(({ name }) => {
|
|
724
854
|
return pkg === void 0 || name === pkg;
|
|
725
855
|
});
|
|
@@ -803,7 +933,7 @@ var dead = () => {
|
|
|
803
933
|
};
|
|
804
934
|
|
|
805
935
|
// src/actions/deplint/deplint.ts
|
|
806
|
-
import
|
|
936
|
+
import chalk20 from "chalk";
|
|
807
937
|
|
|
808
938
|
// src/actions/deplint/findFiles.ts
|
|
809
939
|
import fs2 from "fs";
|
|
@@ -1005,37 +1135,44 @@ function getExternalImportsFromFiles({
|
|
|
1005
1135
|
|
|
1006
1136
|
// src/actions/deplint/checkPackage/getUnlistedDependencies.ts
|
|
1007
1137
|
import { builtinModules } from "module";
|
|
1008
|
-
import
|
|
1009
|
-
function
|
|
1010
|
-
return dependencies.includes(imp) || imp === name ||
|
|
1138
|
+
import chalk15 from "chalk";
|
|
1139
|
+
function isRuntimeImportListed(imp, name, dependencies, peerDependencies) {
|
|
1140
|
+
return dependencies.includes(imp) || imp === name || peerDependencies.includes(imp) || builtinModules.includes(imp);
|
|
1141
|
+
}
|
|
1142
|
+
function isTypeImportListed(imp, name, dependencies, devDependencies, peerDependencies) {
|
|
1143
|
+
return dependencies.includes(imp) || imp === name || dependencies.includes(`@types/${imp}`) || peerDependencies.includes(imp) || peerDependencies.includes(`@types/${imp}`) || devDependencies.includes(`@types/${imp}`) || builtinModules.includes(imp);
|
|
1011
1144
|
}
|
|
1012
1145
|
function logMissing(name, imp, importPaths) {
|
|
1013
|
-
console.log(`[${
|
|
1146
|
+
console.log(`[${chalk15.blue(name)}] Missing dependency in package.json: ${chalk15.red(imp)}`);
|
|
1014
1147
|
if (importPaths[imp]) {
|
|
1015
1148
|
console.log(` ${importPaths[imp].join("\n ")}`);
|
|
1016
1149
|
}
|
|
1017
1150
|
}
|
|
1018
|
-
function getUnlistedDependencies({ name, location }, {
|
|
1151
|
+
function getUnlistedDependencies({ name, location }, {
|
|
1152
|
+
dependencies,
|
|
1153
|
+
devDependencies,
|
|
1154
|
+
peerDependencies
|
|
1155
|
+
}, {
|
|
1019
1156
|
externalDistImports,
|
|
1020
1157
|
externalDistTypeImports,
|
|
1021
1158
|
distImportPaths
|
|
1022
1159
|
}) {
|
|
1023
1160
|
let unlistedDependencies = 0;
|
|
1024
1161
|
for (const imp of externalDistImports) {
|
|
1025
|
-
if (!
|
|
1162
|
+
if (!isRuntimeImportListed(imp, name, dependencies, peerDependencies)) {
|
|
1026
1163
|
unlistedDependencies++;
|
|
1027
1164
|
logMissing(name, imp, distImportPaths);
|
|
1028
1165
|
}
|
|
1029
1166
|
}
|
|
1030
1167
|
for (const imp of externalDistTypeImports) {
|
|
1031
|
-
if (!
|
|
1168
|
+
if (!isTypeImportListed(imp, name, dependencies, devDependencies, peerDependencies)) {
|
|
1032
1169
|
unlistedDependencies++;
|
|
1033
1170
|
logMissing(name, imp, distImportPaths);
|
|
1034
1171
|
}
|
|
1035
1172
|
}
|
|
1036
1173
|
if (unlistedDependencies > 0) {
|
|
1037
1174
|
const packageLocation = `${location}/package.json`;
|
|
1038
|
-
console.log(` ${
|
|
1175
|
+
console.log(` ${chalk15.yellow(packageLocation)}
|
|
1039
1176
|
`);
|
|
1040
1177
|
}
|
|
1041
1178
|
return unlistedDependencies;
|
|
@@ -1043,7 +1180,7 @@ function getUnlistedDependencies({ name, location }, { dependencies, peerDepende
|
|
|
1043
1180
|
|
|
1044
1181
|
// src/actions/deplint/checkPackage/getUnlistedDevDependencies.ts
|
|
1045
1182
|
import { builtinModules as builtinModules2 } from "module";
|
|
1046
|
-
import
|
|
1183
|
+
import chalk16 from "chalk";
|
|
1047
1184
|
function getUnlistedDevDependencies({ name, location }, {
|
|
1048
1185
|
devDependencies,
|
|
1049
1186
|
dependencies,
|
|
@@ -1057,7 +1194,7 @@ function getUnlistedDevDependencies({ name, location }, {
|
|
|
1057
1194
|
for (const imp of externalAllImports) {
|
|
1058
1195
|
if (!distImports.includes(imp) && imp !== name && !dependencies.includes(imp) && !dependencies.includes(`@types/${imp}`) && !peerDependencies.includes(imp) && !peerDependencies.includes(`@types/${imp}`) && !devDependencies.includes(imp) && !devDependencies.includes(`@types/${imp}`) && !builtinModules2.includes(imp)) {
|
|
1059
1196
|
unlistedDevDependencies++;
|
|
1060
|
-
console.log(`[${
|
|
1197
|
+
console.log(`[${chalk16.blue(name)}] Missing devDependency in package.json: ${chalk16.red(imp)}`);
|
|
1061
1198
|
if (allImportPaths[imp]) {
|
|
1062
1199
|
console.log(` ${allImportPaths[imp].join("\n ")}`);
|
|
1063
1200
|
}
|
|
@@ -1065,14 +1202,14 @@ function getUnlistedDevDependencies({ name, location }, {
|
|
|
1065
1202
|
}
|
|
1066
1203
|
if (unlistedDevDependencies > 0) {
|
|
1067
1204
|
const packageLocation = `${location}/package.json`;
|
|
1068
|
-
console.log(` ${
|
|
1205
|
+
console.log(` ${chalk16.yellow(packageLocation)}
|
|
1069
1206
|
`);
|
|
1070
1207
|
}
|
|
1071
1208
|
return unlistedDevDependencies;
|
|
1072
1209
|
}
|
|
1073
1210
|
|
|
1074
1211
|
// src/actions/deplint/checkPackage/getUnusedDependencies.ts
|
|
1075
|
-
import
|
|
1212
|
+
import chalk17 from "chalk";
|
|
1076
1213
|
function getUnusedDependencies({ name, location }, { dependencies }, {
|
|
1077
1214
|
externalDistImports,
|
|
1078
1215
|
externalDistTypeImports,
|
|
@@ -1084,22 +1221,22 @@ function getUnusedDependencies({ name, location }, { dependencies }, {
|
|
|
1084
1221
|
if (!externalDistImports.includes(dep) && !externalDistImports.includes(dep.replace(/^@types\//, "")) && !externalDistTypeImports.includes(dep) && !externalDistTypeImports.includes(dep.replace(/^@types\//, ""))) {
|
|
1085
1222
|
unusedDependencies++;
|
|
1086
1223
|
if (externalAllImports.includes(dep)) {
|
|
1087
|
-
console.log(`[${
|
|
1224
|
+
console.log(`[${chalk17.blue(name)}] dependency should be devDependency in package.json: ${chalk17.red(dep)}`);
|
|
1088
1225
|
} else {
|
|
1089
|
-
console.log(`[${
|
|
1226
|
+
console.log(`[${chalk17.blue(name)}] Unused dependency in package.json: ${chalk17.red(dep)}`);
|
|
1090
1227
|
}
|
|
1091
1228
|
}
|
|
1092
1229
|
}
|
|
1093
1230
|
if (unusedDependencies > 0) {
|
|
1094
1231
|
const packageLocation = `${location}/package.json`;
|
|
1095
|
-
console.log(` ${
|
|
1232
|
+
console.log(` ${chalk17.yellow(packageLocation)}
|
|
1096
1233
|
`);
|
|
1097
1234
|
}
|
|
1098
1235
|
return unusedDependencies;
|
|
1099
1236
|
}
|
|
1100
1237
|
|
|
1101
1238
|
// src/actions/deplint/checkPackage/getUnusedDevDependencies.ts
|
|
1102
|
-
import
|
|
1239
|
+
import chalk18 from "chalk";
|
|
1103
1240
|
|
|
1104
1241
|
// src/actions/deplint/getCliReferencedPackagesFromFiles.ts
|
|
1105
1242
|
import fs8 from "fs";
|
|
@@ -1383,19 +1520,19 @@ function getUnusedDevDependencies({ name, location }, {
|
|
|
1383
1520
|
if (dependencies.includes(dep) || peerDependencies.includes(dep)) continue;
|
|
1384
1521
|
if (!isDevDepUsed(dep, allImports, implicitDeps, requiredPeers, scriptRefs, cliRefs)) {
|
|
1385
1522
|
unusedDevDependencies++;
|
|
1386
|
-
console.log(`[${
|
|
1523
|
+
console.log(`[${chalk18.blue(name)}] Unused devDependency in package.json: ${chalk18.red(dep)}`);
|
|
1387
1524
|
}
|
|
1388
1525
|
}
|
|
1389
1526
|
if (unusedDevDependencies > 0) {
|
|
1390
1527
|
const packageLocation = `${location}/package.json`;
|
|
1391
|
-
console.log(` ${
|
|
1528
|
+
console.log(` ${chalk18.yellow(packageLocation)}
|
|
1392
1529
|
`);
|
|
1393
1530
|
}
|
|
1394
1531
|
return unusedDevDependencies;
|
|
1395
1532
|
}
|
|
1396
1533
|
|
|
1397
1534
|
// src/actions/deplint/checkPackage/getUnusedPeerDependencies.ts
|
|
1398
|
-
import
|
|
1535
|
+
import chalk19 from "chalk";
|
|
1399
1536
|
function getUnusedPeerDependencies({ name, location }, { peerDependencies, dependencies }, { externalDistImports, externalDistTypeImports }, exclude) {
|
|
1400
1537
|
let unusedDependencies = 0;
|
|
1401
1538
|
for (const dep of peerDependencies) {
|
|
@@ -1403,15 +1540,15 @@ function getUnusedPeerDependencies({ name, location }, { peerDependencies, depen
|
|
|
1403
1540
|
if (!externalDistImports.includes(dep) && !externalDistImports.includes(dep.replace(/^@types\//, "")) && !externalDistTypeImports.includes(dep) && !externalDistTypeImports.includes(dep.replace(/^@types\//, ""))) {
|
|
1404
1541
|
unusedDependencies++;
|
|
1405
1542
|
if (dependencies.includes(dep)) {
|
|
1406
|
-
console.log(`[${
|
|
1543
|
+
console.log(`[${chalk19.blue(name)}] Unused peerDependency [already a dependency] in package.json: ${chalk19.red(dep)}`);
|
|
1407
1544
|
} else {
|
|
1408
|
-
console.log(`[${
|
|
1545
|
+
console.log(`[${chalk19.blue(name)}] Unused peerDependency in package.json: ${chalk19.red(dep)}`);
|
|
1409
1546
|
}
|
|
1410
1547
|
}
|
|
1411
1548
|
}
|
|
1412
1549
|
if (unusedDependencies > 0) {
|
|
1413
1550
|
const packageLocation = `${location}/package.json`;
|
|
1414
|
-
console.log(` ${
|
|
1551
|
+
console.log(` ${chalk19.yellow(packageLocation)}
|
|
1415
1552
|
`);
|
|
1416
1553
|
}
|
|
1417
1554
|
return unusedDependencies;
|
|
@@ -1506,9 +1643,9 @@ var deplint = async ({
|
|
|
1506
1643
|
});
|
|
1507
1644
|
}
|
|
1508
1645
|
if (totalErrors > 0) {
|
|
1509
|
-
console.warn(`Deplint: Found ${
|
|
1646
|
+
console.warn(`Deplint: Found ${chalk20.red(totalErrors)} dependency problems. ${chalk20.red("\u2716")}`);
|
|
1510
1647
|
} else {
|
|
1511
|
-
console.info(`Deplint: Found no dependency problems. ${
|
|
1648
|
+
console.info(`Deplint: Found no dependency problems. ${chalk20.green("\u2714")}`);
|
|
1512
1649
|
}
|
|
1513
1650
|
return 0;
|
|
1514
1651
|
};
|
|
@@ -1610,22 +1747,22 @@ var deployNext = () => {
|
|
|
1610
1747
|
};
|
|
1611
1748
|
|
|
1612
1749
|
// src/actions/dupdeps.ts
|
|
1613
|
-
import
|
|
1750
|
+
import chalk21 from "chalk";
|
|
1614
1751
|
var dupdeps = () => {
|
|
1615
|
-
console.log(
|
|
1752
|
+
console.log(chalk21.green("Checking all Dependencies for Duplicates"));
|
|
1616
1753
|
const allDependencies = parsedPackageJSON()?.dependencies;
|
|
1617
1754
|
const dependencies = Object.entries(allDependencies).map(([k]) => k);
|
|
1618
1755
|
return detectDuplicateDependencies(dependencies);
|
|
1619
1756
|
};
|
|
1620
1757
|
|
|
1621
1758
|
// src/actions/lint.ts
|
|
1622
|
-
import
|
|
1759
|
+
import chalk22 from "chalk";
|
|
1623
1760
|
var lintPackage = ({
|
|
1624
1761
|
pkg,
|
|
1625
1762
|
fix: fix2,
|
|
1626
1763
|
verbose
|
|
1627
1764
|
}) => {
|
|
1628
|
-
console.log(
|
|
1765
|
+
console.log(chalk22.gray(`${fix2 ? "Fix" : "Lint"} [${pkg}]`));
|
|
1629
1766
|
const start = Date.now();
|
|
1630
1767
|
const result = runSteps(`${fix2 ? "Fix" : "Lint"} [${pkg}]`, [
|
|
1631
1768
|
["yarn", [
|
|
@@ -1635,7 +1772,7 @@ var lintPackage = ({
|
|
|
1635
1772
|
fix2 ? "package-fix" : verbose ? "package-lint-verbose" : "package-lint"
|
|
1636
1773
|
]]
|
|
1637
1774
|
]);
|
|
1638
|
-
console.log(
|
|
1775
|
+
console.log(chalk22.gray(`${fix2 ? "Fixed in" : "Linted in"} [${chalk22.magenta(((Date.now() - start) / 1e3).toFixed(2))}] ${chalk22.gray("seconds")}`));
|
|
1639
1776
|
return result;
|
|
1640
1777
|
};
|
|
1641
1778
|
var lint = ({
|
|
@@ -1655,13 +1792,13 @@ var lint = ({
|
|
|
1655
1792
|
});
|
|
1656
1793
|
};
|
|
1657
1794
|
var lintAllPackages = ({ fix: fix2 = false } = {}) => {
|
|
1658
|
-
console.log(
|
|
1795
|
+
console.log(chalk22.gray(`${fix2 ? "Fix" : "Lint"} [All-Packages]`));
|
|
1659
1796
|
const start = Date.now();
|
|
1660
1797
|
const fixOptions = fix2 ? ["--fix"] : [];
|
|
1661
1798
|
const result = runSteps(`${fix2 ? "Fix" : "Lint"} [All-Packages]`, [
|
|
1662
1799
|
["yarn", ["eslint", "--cache", "--cache-location", ".eslintcache", "--cache-strategy", "content", ...fixOptions]]
|
|
1663
1800
|
]);
|
|
1664
|
-
console.log(
|
|
1801
|
+
console.log(chalk22.gray(`${fix2 ? "Fixed in" : "Linted in"} [${chalk22.magenta(((Date.now() - start) / 1e3).toFixed(2))}] ${chalk22.gray("seconds")}`));
|
|
1665
1802
|
return result;
|
|
1666
1803
|
};
|
|
1667
1804
|
|
|
@@ -1689,7 +1826,7 @@ var filename = ".gitignore";
|
|
|
1689
1826
|
var gitignoreGen = (pkg) => generateIgnoreFiles(filename, pkg);
|
|
1690
1827
|
|
|
1691
1828
|
// src/actions/gitlint.ts
|
|
1692
|
-
import
|
|
1829
|
+
import chalk23 from "chalk";
|
|
1693
1830
|
import ParseGitConfig from "parse-git-config";
|
|
1694
1831
|
var gitlint = () => {
|
|
1695
1832
|
console.log(`
|
|
@@ -1700,7 +1837,7 @@ Gitlint Start [${process.cwd()}]
|
|
|
1700
1837
|
const errors = 0;
|
|
1701
1838
|
const gitConfig = ParseGitConfig.sync();
|
|
1702
1839
|
const warn = (message) => {
|
|
1703
|
-
console.warn(
|
|
1840
|
+
console.warn(chalk23.yellow(`Warning: ${message}`));
|
|
1704
1841
|
warnings++;
|
|
1705
1842
|
};
|
|
1706
1843
|
if (gitConfig.core.ignorecase) {
|
|
@@ -1720,13 +1857,13 @@ Gitlint Start [${process.cwd()}]
|
|
|
1720
1857
|
}
|
|
1721
1858
|
const resultMessages = [];
|
|
1722
1859
|
if (valid > 0) {
|
|
1723
|
-
resultMessages.push(
|
|
1860
|
+
resultMessages.push(chalk23.green(`Passed: ${valid}`));
|
|
1724
1861
|
}
|
|
1725
1862
|
if (warnings > 0) {
|
|
1726
|
-
resultMessages.push(
|
|
1863
|
+
resultMessages.push(chalk23.yellow(`Warnings: ${warnings}`));
|
|
1727
1864
|
}
|
|
1728
1865
|
if (errors > 0) {
|
|
1729
|
-
resultMessages.push(
|
|
1866
|
+
resultMessages.push(chalk23.red(` Errors: ${errors}`));
|
|
1730
1867
|
}
|
|
1731
1868
|
console.warn(`Gitlint Finish [ ${resultMessages.join(" | ")} ]
|
|
1732
1869
|
`);
|
|
@@ -1734,8 +1871,8 @@ Gitlint Start [${process.cwd()}]
|
|
|
1734
1871
|
};
|
|
1735
1872
|
|
|
1736
1873
|
// src/actions/gitlint-fix.ts
|
|
1737
|
-
import { execSync as
|
|
1738
|
-
import
|
|
1874
|
+
import { execSync as execSync3 } from "child_process";
|
|
1875
|
+
import chalk24 from "chalk";
|
|
1739
1876
|
import ParseGitConfig2 from "parse-git-config";
|
|
1740
1877
|
var gitlintFix = () => {
|
|
1741
1878
|
console.log(`
|
|
@@ -1743,16 +1880,16 @@ Gitlint Fix Start [${process.cwd()}]
|
|
|
1743
1880
|
`);
|
|
1744
1881
|
const gitConfig = ParseGitConfig2.sync();
|
|
1745
1882
|
if (gitConfig.core.ignorecase) {
|
|
1746
|
-
|
|
1747
|
-
console.warn(
|
|
1883
|
+
execSync3("git config core.ignorecase false", { stdio: "inherit" });
|
|
1884
|
+
console.warn(chalk24.yellow("\nGitlint Fix: Updated core.ignorecase to be false\n"));
|
|
1748
1885
|
}
|
|
1749
1886
|
if (gitConfig.core.autocrlf !== false) {
|
|
1750
|
-
|
|
1751
|
-
console.warn(
|
|
1887
|
+
execSync3("git config core.autocrlf false", { stdio: "inherit" });
|
|
1888
|
+
console.warn(chalk24.yellow("\nGitlint Fix: Updated core.autocrlf to be false\n"));
|
|
1752
1889
|
}
|
|
1753
1890
|
if (gitConfig.core.eol !== "lf") {
|
|
1754
|
-
|
|
1755
|
-
console.warn(
|
|
1891
|
+
execSync3("git config core.eol lf", { stdio: "inherit" });
|
|
1892
|
+
console.warn(chalk24.yellow('\nGitlint Fix: Updated core.eol to be "lf"\n'));
|
|
1756
1893
|
}
|
|
1757
1894
|
return 1;
|
|
1758
1895
|
};
|
|
@@ -1763,7 +1900,7 @@ var knip = () => {
|
|
|
1763
1900
|
};
|
|
1764
1901
|
|
|
1765
1902
|
// src/actions/license.ts
|
|
1766
|
-
import
|
|
1903
|
+
import chalk25 from "chalk";
|
|
1767
1904
|
import { init } from "license-checker";
|
|
1768
1905
|
var license = async (pkg) => {
|
|
1769
1906
|
const workspaces = yarnWorkspaces();
|
|
@@ -1788,18 +1925,18 @@ var license = async (pkg) => {
|
|
|
1788
1925
|
"LGPL-3.0-or-later",
|
|
1789
1926
|
"Python-2.0"
|
|
1790
1927
|
]);
|
|
1791
|
-
console.log(
|
|
1928
|
+
console.log(chalk25.green("License Checker"));
|
|
1792
1929
|
return (await Promise.all(
|
|
1793
1930
|
workspaceList.map(({ location, name }) => {
|
|
1794
1931
|
return new Promise((resolve) => {
|
|
1795
1932
|
init({ production: true, start: location }, (error, packages) => {
|
|
1796
1933
|
if (error) {
|
|
1797
|
-
console.error(
|
|
1798
|
-
console.error(
|
|
1934
|
+
console.error(chalk25.red(`License Checker [${name}] Error`));
|
|
1935
|
+
console.error(chalk25.gray(error));
|
|
1799
1936
|
console.log("\n");
|
|
1800
1937
|
resolve(1);
|
|
1801
1938
|
} else {
|
|
1802
|
-
console.log(
|
|
1939
|
+
console.log(chalk25.green(`License Checker [${name}]`));
|
|
1803
1940
|
let count = 0;
|
|
1804
1941
|
for (const [name2, info] of Object.entries(packages)) {
|
|
1805
1942
|
const licenses = Array.isArray(info.licenses) ? info.licenses : [info.licenses];
|
|
@@ -1815,7 +1952,7 @@ var license = async (pkg) => {
|
|
|
1815
1952
|
}
|
|
1816
1953
|
if (!orLicenseFound) {
|
|
1817
1954
|
count++;
|
|
1818
|
-
console.warn(
|
|
1955
|
+
console.warn(chalk25.yellow(`${name2}: Package License not allowed [${license2}]`));
|
|
1819
1956
|
}
|
|
1820
1957
|
}
|
|
1821
1958
|
}
|
|
@@ -1850,6 +1987,21 @@ var publish = () => {
|
|
|
1850
1987
|
return runSteps("Publish", [["npm", ["publish", "--workspaces"]]]);
|
|
1851
1988
|
};
|
|
1852
1989
|
|
|
1990
|
+
// src/actions/readme-gen.ts
|
|
1991
|
+
async function readmeGen({
|
|
1992
|
+
pkg,
|
|
1993
|
+
templatePath,
|
|
1994
|
+
typedoc,
|
|
1995
|
+
verbose
|
|
1996
|
+
}) {
|
|
1997
|
+
return await generateReadmeFiles({
|
|
1998
|
+
pkg,
|
|
1999
|
+
templatePath,
|
|
2000
|
+
typedoc,
|
|
2001
|
+
verbose
|
|
2002
|
+
});
|
|
2003
|
+
}
|
|
2004
|
+
|
|
1853
2005
|
// src/actions/rebuild.ts
|
|
1854
2006
|
var rebuild = ({ target }) => {
|
|
1855
2007
|
return runSteps("Rebuild", [
|
|
@@ -1859,7 +2011,7 @@ var rebuild = ({ target }) => {
|
|
|
1859
2011
|
};
|
|
1860
2012
|
|
|
1861
2013
|
// src/actions/recompile.ts
|
|
1862
|
-
import
|
|
2014
|
+
import chalk26 from "chalk";
|
|
1863
2015
|
var recompile = async ({
|
|
1864
2016
|
verbose,
|
|
1865
2017
|
target,
|
|
@@ -1895,7 +2047,7 @@ var recompileAll = async ({
|
|
|
1895
2047
|
const incrementalOptions = incremental ? ["--since", "-Apt", "--topological-dev"] : ["--parallel", "-Apt", "--topological-dev"];
|
|
1896
2048
|
const jobsOptions = jobs ? ["-j", `${jobs}`] : [];
|
|
1897
2049
|
if (jobs) {
|
|
1898
|
-
console.log(
|
|
2050
|
+
console.log(chalk26.blue(`Jobs set to [${jobs}]`));
|
|
1899
2051
|
}
|
|
1900
2052
|
const result = await runStepsAsync(`Recompile${incremental ? "-Incremental" : ""} [All]`, [
|
|
1901
2053
|
[
|
|
@@ -1926,7 +2078,7 @@ var recompileAll = async ({
|
|
|
1926
2078
|
]
|
|
1927
2079
|
]);
|
|
1928
2080
|
console.log(
|
|
1929
|
-
`${
|
|
2081
|
+
`${chalk26.gray("Recompiled in")} [${chalk26.magenta(((Date.now() - start) / 1e3).toFixed(2))}] ${chalk26.gray("seconds")}`
|
|
1930
2082
|
);
|
|
1931
2083
|
return result;
|
|
1932
2084
|
};
|
|
@@ -1957,13 +2109,13 @@ var reinstall = () => {
|
|
|
1957
2109
|
};
|
|
1958
2110
|
|
|
1959
2111
|
// src/actions/relint.ts
|
|
1960
|
-
import
|
|
2112
|
+
import chalk27 from "chalk";
|
|
1961
2113
|
var relintPackage = ({
|
|
1962
2114
|
pkg,
|
|
1963
2115
|
fix: fix2,
|
|
1964
2116
|
verbose
|
|
1965
2117
|
}) => {
|
|
1966
|
-
console.log(
|
|
2118
|
+
console.log(chalk27.gray(`${fix2 ? "Fix" : "Lint"} [${pkg}]`));
|
|
1967
2119
|
const start = Date.now();
|
|
1968
2120
|
const result = runSteps(`${fix2 ? "Fix" : "Lint"} [${pkg}]`, [
|
|
1969
2121
|
["yarn", [
|
|
@@ -1973,7 +2125,7 @@ var relintPackage = ({
|
|
|
1973
2125
|
fix2 ? "package-fix" : verbose ? "package-lint-verbose" : "package-lint"
|
|
1974
2126
|
]]
|
|
1975
2127
|
]);
|
|
1976
|
-
console.log(
|
|
2128
|
+
console.log(chalk27.gray(`${fix2 ? "Fixed in" : "Linted in"} [${chalk27.magenta(((Date.now() - start) / 1e3).toFixed(2))}] ${chalk27.gray("seconds")}`));
|
|
1977
2129
|
return result;
|
|
1978
2130
|
};
|
|
1979
2131
|
var relint = ({
|
|
@@ -1993,13 +2145,13 @@ var relint = ({
|
|
|
1993
2145
|
});
|
|
1994
2146
|
};
|
|
1995
2147
|
var relintAllPackages = ({ fix: fix2 = false } = {}) => {
|
|
1996
|
-
console.log(
|
|
2148
|
+
console.log(chalk27.gray(`${fix2 ? "Fix" : "Lint"} [All-Packages]`));
|
|
1997
2149
|
const start = Date.now();
|
|
1998
2150
|
const fixOptions = fix2 ? ["--fix"] : [];
|
|
1999
2151
|
const result = runSteps(`${fix2 ? "Fix" : "Lint"} [All-Packages]`, [
|
|
2000
2152
|
["yarn", ["eslint", ...fixOptions]]
|
|
2001
2153
|
]);
|
|
2002
|
-
console.log(
|
|
2154
|
+
console.log(chalk27.gray(`${fix2 ? "Fixed in" : "Linted in"} [${chalk27.magenta(((Date.now() - start) / 1e3).toFixed(2))}] ${chalk27.gray("seconds")}`));
|
|
2003
2155
|
return result;
|
|
2004
2156
|
};
|
|
2005
2157
|
|
|
@@ -2017,10 +2169,10 @@ var sonar = () => {
|
|
|
2017
2169
|
};
|
|
2018
2170
|
|
|
2019
2171
|
// src/actions/statics.ts
|
|
2020
|
-
import
|
|
2172
|
+
import chalk28 from "chalk";
|
|
2021
2173
|
var DefaultDependencies = ["axios", "@xylabs/pixel", "react", "graphql", "react-router", "@mui/material", "@mui/system"];
|
|
2022
2174
|
var statics = () => {
|
|
2023
|
-
console.log(
|
|
2175
|
+
console.log(chalk28.green("Check Required Static Dependencies"));
|
|
2024
2176
|
const statics2 = parsedPackageJSON()?.xy?.deps?.statics;
|
|
2025
2177
|
return detectDuplicateDependencies(statics2, DefaultDependencies);
|
|
2026
2178
|
};
|
|
@@ -2264,6 +2416,29 @@ var xyCommonCommands = (args) => {
|
|
|
2264
2416
|
if (argv.verbose) console.log("NpmIgnore Gen");
|
|
2265
2417
|
process.exitCode = npmignoreGen();
|
|
2266
2418
|
}
|
|
2419
|
+
).command(
|
|
2420
|
+
"readme-gen [package]",
|
|
2421
|
+
"Readme Gen - Generate README.md files from template",
|
|
2422
|
+
(yargs2) => {
|
|
2423
|
+
return packagePositionalParam(yargs2).option("template", {
|
|
2424
|
+
alias: "t",
|
|
2425
|
+
description: "Path to README.template.md",
|
|
2426
|
+
type: "string"
|
|
2427
|
+
}).option("typedoc", {
|
|
2428
|
+
default: false,
|
|
2429
|
+
description: "Generate TypeDoc reference sections",
|
|
2430
|
+
type: "boolean"
|
|
2431
|
+
});
|
|
2432
|
+
},
|
|
2433
|
+
async (argv) => {
|
|
2434
|
+
if (argv.verbose) console.log("Readme Gen");
|
|
2435
|
+
process.exitCode = await readmeGen({
|
|
2436
|
+
pkg: argv.package,
|
|
2437
|
+
templatePath: argv.template,
|
|
2438
|
+
typedoc: argv.typedoc,
|
|
2439
|
+
verbose: !!argv.verbose
|
|
2440
|
+
});
|
|
2441
|
+
}
|
|
2267
2442
|
).command(
|
|
2268
2443
|
"retest",
|
|
2269
2444
|
"Re-Test - Run Jest Tests with cleaned cache",
|
|
@@ -2443,7 +2618,7 @@ var xyInstallCommands = (args) => {
|
|
|
2443
2618
|
};
|
|
2444
2619
|
|
|
2445
2620
|
// src/xy/xyLintCommands.ts
|
|
2446
|
-
import
|
|
2621
|
+
import chalk29 from "chalk";
|
|
2447
2622
|
var xyLintCommands = (args) => {
|
|
2448
2623
|
return args.command(
|
|
2449
2624
|
"cycle [package]",
|
|
@@ -2455,7 +2630,7 @@ var xyLintCommands = (args) => {
|
|
|
2455
2630
|
const start = Date.now();
|
|
2456
2631
|
if (argv.verbose) console.log("Cycle");
|
|
2457
2632
|
process.exitCode = await cycle({ pkg: argv.package });
|
|
2458
|
-
console.log(
|
|
2633
|
+
console.log(chalk29.blue(`Finished in ${Date.now() - start}ms`));
|
|
2459
2634
|
}
|
|
2460
2635
|
).command(
|
|
2461
2636
|
"lint [package]",
|
|
@@ -2485,7 +2660,7 @@ var xyLintCommands = (args) => {
|
|
|
2485
2660
|
cache: argv.cache,
|
|
2486
2661
|
verbose: !!argv.verbose
|
|
2487
2662
|
});
|
|
2488
|
-
console.log(
|
|
2663
|
+
console.log(chalk29.blue(`Finished in ${Date.now() - start}ms`));
|
|
2489
2664
|
}
|
|
2490
2665
|
).command(
|
|
2491
2666
|
"deplint [package]",
|
|
@@ -2524,7 +2699,7 @@ var xyLintCommands = (args) => {
|
|
|
2524
2699
|
peerDeps: !!argv.peerDeps,
|
|
2525
2700
|
verbose: !!argv.verbose
|
|
2526
2701
|
});
|
|
2527
|
-
console.log(
|
|
2702
|
+
console.log(chalk29.blue(`Finished in ${Date.now() - start}ms`));
|
|
2528
2703
|
}
|
|
2529
2704
|
).command(
|
|
2530
2705
|
"fix [package]",
|
|
@@ -2536,7 +2711,7 @@ var xyLintCommands = (args) => {
|
|
|
2536
2711
|
const start = Date.now();
|
|
2537
2712
|
if (argv.verbose) console.log("Fix");
|
|
2538
2713
|
process.exitCode = fix();
|
|
2539
|
-
console.log(
|
|
2714
|
+
console.log(chalk29.blue(`Finished in ${Date.now() - start}ms`));
|
|
2540
2715
|
}
|
|
2541
2716
|
).command(
|
|
2542
2717
|
"relint [package]",
|
|
@@ -2548,7 +2723,7 @@ var xyLintCommands = (args) => {
|
|
|
2548
2723
|
if (argv.verbose) console.log("Relinting");
|
|
2549
2724
|
const start = Date.now();
|
|
2550
2725
|
process.exitCode = relint();
|
|
2551
|
-
console.log(
|
|
2726
|
+
console.log(chalk29.blue(`Finished in ${Date.now() - start}ms`));
|
|
2552
2727
|
}
|
|
2553
2728
|
).command(
|
|
2554
2729
|
"publint [package]",
|
|
@@ -2560,7 +2735,7 @@ var xyLintCommands = (args) => {
|
|
|
2560
2735
|
if (argv.verbose) console.log("Publint");
|
|
2561
2736
|
const start = Date.now();
|
|
2562
2737
|
process.exitCode = await publint({ pkg: argv.package, verbose: !!argv.verbose });
|
|
2563
|
-
console.log(
|
|
2738
|
+
console.log(chalk29.blue(`Finished in ${Date.now() - start}ms`));
|
|
2564
2739
|
}
|
|
2565
2740
|
).command(
|
|
2566
2741
|
"knip",
|
|
@@ -2572,7 +2747,7 @@ var xyLintCommands = (args) => {
|
|
|
2572
2747
|
if (argv.verbose) console.log("Knip");
|
|
2573
2748
|
const start = Date.now();
|
|
2574
2749
|
process.exitCode = knip();
|
|
2575
|
-
console.log(
|
|
2750
|
+
console.log(chalk29.blue(`Knip finished in ${Date.now() - start}ms`));
|
|
2576
2751
|
}
|
|
2577
2752
|
).command(
|
|
2578
2753
|
"sonar",
|
|
@@ -2584,7 +2759,7 @@ var xyLintCommands = (args) => {
|
|
|
2584
2759
|
const start = Date.now();
|
|
2585
2760
|
if (argv.verbose) console.log("Sonar Check");
|
|
2586
2761
|
process.exitCode = sonar();
|
|
2587
|
-
console.log(
|
|
2762
|
+
console.log(chalk29.blue(`Finished in ${Date.now() - start}ms`));
|
|
2588
2763
|
}
|
|
2589
2764
|
);
|
|
2590
2765
|
};
|
|
@@ -2620,8 +2795,8 @@ var xyParseOptions = () => {
|
|
|
2620
2795
|
var xy = async () => {
|
|
2621
2796
|
const options = xyParseOptions();
|
|
2622
2797
|
return await xyBuildCommands(xyCommonCommands(xyInstallCommands(xyDeployCommands(xyLintCommands(options))))).demandCommand(1).command("*", "", () => {
|
|
2623
|
-
console.error(
|
|
2624
|
-
console.log(
|
|
2798
|
+
console.error(chalk30.yellow(`Command not found [${chalk30.magenta(process.argv[2])}]`));
|
|
2799
|
+
console.log(chalk30.gray("Try 'yarn xy --help' for list of commands"));
|
|
2625
2800
|
}).version().help().argv;
|
|
2626
2801
|
};
|
|
2627
2802
|
export {
|