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