@xylabs/ts-scripts-yarn3 7.0.0-rc.15 → 7.0.0-rc.16
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/index.mjs +104 -92
- package/dist/actions/index.mjs.map +1 -1
- package/dist/actions/package/compile/buildEntries.mjs +10 -5
- package/dist/actions/package/compile/buildEntries.mjs.map +1 -1
- package/dist/actions/package/compile/compile.mjs +79 -65
- package/dist/actions/package/compile/compile.mjs.map +1 -1
- package/dist/actions/package/compile/index.mjs +79 -65
- package/dist/actions/package/compile/index.mjs.map +1 -1
- package/dist/actions/package/compile/inputs.mjs +8 -3
- package/dist/actions/package/compile/inputs.mjs.map +1 -1
- package/dist/actions/package/compile/packageCompileTsc.mjs +9 -10
- package/dist/actions/package/compile/packageCompileTsc.mjs.map +1 -1
- package/dist/actions/package/compile/packageCompileTscTypes.mjs +6 -5
- package/dist/actions/package/compile/packageCompileTscTypes.mjs.map +1 -1
- package/dist/actions/package/compile/packageCompileTsup.mjs +68 -53
- package/dist/actions/package/compile/packageCompileTsup.mjs.map +1 -1
- package/dist/actions/package/cycle.mjs +3 -5
- package/dist/actions/package/cycle.mjs.map +1 -1
- package/dist/actions/package/index.mjs +94 -82
- package/dist/actions/package/index.mjs.map +1 -1
- package/dist/actions/package/recompile.mjs +79 -65
- package/dist/actions/package/recompile.mjs.map +1 -1
- package/dist/bin/package/build-only.mjs +81 -67
- package/dist/bin/package/build-only.mjs.map +1 -1
- package/dist/bin/package/build.mjs +83 -69
- package/dist/bin/package/build.mjs.map +1 -1
- package/dist/bin/package/compile-only.mjs +81 -67
- package/dist/bin/package/compile-only.mjs.map +1 -1
- package/dist/bin/package/compile-tsup.mjs +70 -55
- package/dist/bin/package/compile-tsup.mjs.map +1 -1
- package/dist/bin/package/compile.mjs +83 -69
- package/dist/bin/package/compile.mjs.map +1 -1
- package/dist/bin/package/cycle.mjs +5 -7
- package/dist/bin/package/cycle.mjs.map +1 -1
- package/dist/bin/package/recompile.mjs +81 -67
- package/dist/bin/package/recompile.mjs.map +1 -1
- package/dist/index.d.ts +4 -9
- package/dist/index.mjs +116 -104
- package/dist/index.mjs.map +1 -1
- package/dist/lib/index.mjs +9 -10
- package/dist/lib/index.mjs.map +1 -1
- package/dist/lib/loadConfig.mjs +9 -10
- package/dist/lib/loadConfig.mjs.map +1 -1
- package/package.json +2 -2
package/dist/actions/index.mjs
CHANGED
|
@@ -299,16 +299,15 @@ import { TypeScriptLoader } from "cosmiconfig-typescript-loader";
|
|
|
299
299
|
import deepmerge from "deepmerge";
|
|
300
300
|
var config;
|
|
301
301
|
var loadConfig = async (params) => {
|
|
302
|
-
if (config
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
console.log(chalk5.gray(`${JSON.stringify(config, null, 2)}`));
|
|
302
|
+
if (config === void 0) {
|
|
303
|
+
const cosmicConfigResult = await cosmiconfig("xy", { cache: true, loaders: { ".ts": TypeScriptLoader() } }).search();
|
|
304
|
+
config = cosmicConfigResult?.config;
|
|
305
|
+
const configFilePath = cosmicConfigResult?.filepath;
|
|
306
|
+
if (configFilePath !== void 0) {
|
|
307
|
+
console.log(chalk5.green(`Loaded config from ${configFilePath}`));
|
|
308
|
+
if (config.verbose) {
|
|
309
|
+
console.log(chalk5.gray(`${JSON.stringify(config, null, 2)}`));
|
|
310
|
+
}
|
|
312
311
|
}
|
|
313
312
|
}
|
|
314
313
|
return deepmerge(config, params ?? {});
|
|
@@ -1322,7 +1321,7 @@ var packageClean = async () => {
|
|
|
1322
1321
|
};
|
|
1323
1322
|
|
|
1324
1323
|
// src/actions/package/compile/compile.ts
|
|
1325
|
-
import
|
|
1324
|
+
import chalk30 from "chalk";
|
|
1326
1325
|
|
|
1327
1326
|
// src/actions/package/publint.ts
|
|
1328
1327
|
import { promises as fs4 } from "fs";
|
|
@@ -1369,18 +1368,24 @@ var packagePublint = async (params) => {
|
|
|
1369
1368
|
};
|
|
1370
1369
|
|
|
1371
1370
|
// src/actions/package/compile/packageCompileTsup.ts
|
|
1371
|
+
import chalk29 from "chalk";
|
|
1372
1372
|
import { build as build2, defineConfig } from "tsup";
|
|
1373
1373
|
|
|
1374
1374
|
// src/actions/package/compile/inputs.ts
|
|
1375
|
+
import chalk26 from "chalk";
|
|
1375
1376
|
import { glob as glob2 } from "glob";
|
|
1376
|
-
var getAllInputs = (
|
|
1377
|
-
return glob2.sync(`${
|
|
1378
|
-
|
|
1377
|
+
var getAllInputs = (srcDir, verbose = false) => {
|
|
1378
|
+
return glob2.sync(`${srcDir}/**/*.*`, { posix: true }).map((file) => {
|
|
1379
|
+
const result = file.slice(Math.max(0, srcDir.length + 1));
|
|
1380
|
+
if (verbose) {
|
|
1381
|
+
console.log(chalk26.gray(`getAllInputs: ${JSON.stringify(result, null, 2)}`));
|
|
1382
|
+
}
|
|
1383
|
+
return result;
|
|
1379
1384
|
});
|
|
1380
1385
|
};
|
|
1381
1386
|
|
|
1382
1387
|
// src/actions/package/compile/buildEntries.ts
|
|
1383
|
-
var buildEntries = (
|
|
1388
|
+
var buildEntries = (srcDir, entryMode = "single", options, excludeSpecAndStories = true, verbose = false) => {
|
|
1384
1389
|
let entries = [];
|
|
1385
1390
|
switch (entryMode) {
|
|
1386
1391
|
case "platform": {
|
|
@@ -1388,7 +1393,7 @@ var buildEntries = (folder, entryMode = "single", options, excludeSpecAndStories
|
|
|
1388
1393
|
break;
|
|
1389
1394
|
}
|
|
1390
1395
|
case "all": {
|
|
1391
|
-
entries = excludeSpecAndStories ? getAllInputs(
|
|
1396
|
+
entries = excludeSpecAndStories ? getAllInputs(srcDir).filter((entry) => !entry.includes(".spec.") && !entry.includes(".stories.")) : getAllInputs(srcDir);
|
|
1392
1397
|
break;
|
|
1393
1398
|
}
|
|
1394
1399
|
case "custom": {
|
|
@@ -1432,7 +1437,7 @@ function deepMergeObjects(objects) {
|
|
|
1432
1437
|
|
|
1433
1438
|
// src/actions/package/compile/packageCompileTsc.ts
|
|
1434
1439
|
import { cwd as cwd2 } from "process";
|
|
1435
|
-
import
|
|
1440
|
+
import chalk27 from "chalk";
|
|
1436
1441
|
import { createProgramFromConfig } from "tsc-prog";
|
|
1437
1442
|
import {
|
|
1438
1443
|
DiagnosticCategory,
|
|
@@ -1451,11 +1456,10 @@ var getCompilerOptions = (options = {}, fileName = "tsconfig.json") => {
|
|
|
1451
1456
|
};
|
|
1452
1457
|
|
|
1453
1458
|
// src/actions/package/compile/packageCompileTsc.ts
|
|
1454
|
-
var packageCompileTsc = (entries,
|
|
1459
|
+
var packageCompileTsc = (entries, srcDir = "src", outDir = "build", compilerOptionsParam, verbose = false) => {
|
|
1455
1460
|
const pkg = process.env.INIT_CWD ?? cwd2();
|
|
1456
|
-
|
|
1457
|
-
|
|
1458
|
-
console.log(`Verifying code START: ${entries.length} files to ${outDir} from ${folder}`);
|
|
1461
|
+
if (verbose) {
|
|
1462
|
+
console.log(chalk27.cyan(`Validating code START: ${entries.length} files to ${outDir} from ${srcDir}`));
|
|
1459
1463
|
}
|
|
1460
1464
|
const compilerOptions = {
|
|
1461
1465
|
...getCompilerOptions({
|
|
@@ -1469,10 +1473,10 @@ var packageCompileTsc = (entries, folder = "src", outDir = "build", config2 = {}
|
|
|
1469
1473
|
emitDeclarationOnly: true,
|
|
1470
1474
|
noEmit: false
|
|
1471
1475
|
};
|
|
1472
|
-
console.log(
|
|
1473
|
-
if (
|
|
1476
|
+
console.log(chalk27.cyan(`Validating Files: ${entries.length}`));
|
|
1477
|
+
if (verbose) {
|
|
1474
1478
|
for (const entry of entries) {
|
|
1475
|
-
console.log(
|
|
1479
|
+
console.log(chalk27.grey(`Validating: ${entry}`));
|
|
1476
1480
|
}
|
|
1477
1481
|
}
|
|
1478
1482
|
try {
|
|
@@ -1480,7 +1484,7 @@ var packageCompileTsc = (entries, folder = "src", outDir = "build", config2 = {}
|
|
|
1480
1484
|
const program = createProgramFromConfig({
|
|
1481
1485
|
basePath: pkg ?? cwd2(),
|
|
1482
1486
|
compilerOptions,
|
|
1483
|
-
files: entries.map((entry) => `${
|
|
1487
|
+
files: entries.map((entry) => `${srcDir}/${entry}`)
|
|
1484
1488
|
});
|
|
1485
1489
|
const diagnostics = getPreEmitDiagnostics(program);
|
|
1486
1490
|
if (diagnostics.length > 0) {
|
|
@@ -1488,7 +1492,7 @@ var packageCompileTsc = (entries, folder = "src", outDir = "build", config2 = {}
|
|
|
1488
1492
|
diagnostics,
|
|
1489
1493
|
{
|
|
1490
1494
|
getCanonicalFileName: (fileName) => fileName,
|
|
1491
|
-
getCurrentDirectory: () =>
|
|
1495
|
+
getCurrentDirectory: () => srcDir,
|
|
1492
1496
|
getNewLine: () => sys.newLine
|
|
1493
1497
|
}
|
|
1494
1498
|
);
|
|
@@ -1499,14 +1503,15 @@ var packageCompileTsc = (entries, folder = "src", outDir = "build", config2 = {}
|
|
|
1499
1503
|
}
|
|
1500
1504
|
return 0;
|
|
1501
1505
|
} finally {
|
|
1502
|
-
if (
|
|
1503
|
-
console.log(`Verifying code FINISH: ${entries.length} files to ${outDir} from ${
|
|
1506
|
+
if (verbose) {
|
|
1507
|
+
console.log(chalk27.cyan(`Verifying code FINISH: ${entries.length} files to ${outDir} from ${srcDir}`));
|
|
1504
1508
|
}
|
|
1505
1509
|
}
|
|
1506
1510
|
};
|
|
1507
1511
|
|
|
1508
1512
|
// src/actions/package/compile/packageCompileTscTypes.ts
|
|
1509
1513
|
import { cwd as cwd3 } from "process";
|
|
1514
|
+
import chalk28 from "chalk";
|
|
1510
1515
|
import { rollup } from "rollup";
|
|
1511
1516
|
import dts from "rollup-plugin-dts";
|
|
1512
1517
|
import nodeExternals from "rollup-plugin-node-externals";
|
|
@@ -1528,12 +1533,12 @@ async function bundleDts(inputPath, outputPath, platform, options, verbose = fal
|
|
|
1528
1533
|
console.log(`Bundled declarations written to ${outputPath}`);
|
|
1529
1534
|
}
|
|
1530
1535
|
}
|
|
1531
|
-
var packageCompileTscTypes = async (entries, outDir, platform,
|
|
1536
|
+
var packageCompileTscTypes = async (entries, outDir, platform, srcDir = "build", verbose = false) => {
|
|
1532
1537
|
if (verbose) {
|
|
1533
|
-
console.log(`Compiling Types START: ${entries.length} files to ${outDir} from ${
|
|
1538
|
+
console.log(chalk28.cyan(`Compiling Types START: ${entries.length} files to ${outDir} from ${srcDir}`));
|
|
1534
1539
|
}
|
|
1535
1540
|
const pkg = process.env.INIT_CWD ?? cwd3();
|
|
1536
|
-
const srcRoot = `${pkg}/${
|
|
1541
|
+
const srcRoot = `${pkg}/${srcDir}`;
|
|
1537
1542
|
const entryNameToTypeName = (entry) => {
|
|
1538
1543
|
const splitEntryName = entry.split(".");
|
|
1539
1544
|
const newEntryExtension = "d." + splitEntryName.at(-1);
|
|
@@ -1547,43 +1552,48 @@ var packageCompileTscTypes = async (entries, outDir, platform, folder = "build",
|
|
|
1547
1552
|
emitDeclarationOnly: false,
|
|
1548
1553
|
noEmit: true
|
|
1549
1554
|
};
|
|
1550
|
-
const entryNames = entries.map((entry) => entry.split(`${
|
|
1555
|
+
const entryNames = entries.map((entry) => entry.split(`${srcDir}/`).at(-1) ?? entry);
|
|
1551
1556
|
await Promise.all(entryNames.map(async (entryName) => {
|
|
1552
1557
|
const entryTypeName = entryNameToTypeName(entryName);
|
|
1553
1558
|
console.log(`Compiling Types: ${srcRoot}/${entryTypeName} to ${outDir}/${entryTypeName}`);
|
|
1554
1559
|
await bundleDts(`${srcRoot}/${entryTypeName}`, outDir + "/" + entryTypeName, platform, { compilerOptions, tsconfig: "tsconfig.json" }, verbose);
|
|
1555
1560
|
}));
|
|
1556
1561
|
if (verbose) {
|
|
1557
|
-
console.log(`Compiling Types FINISH: ${entries.length} files to ${outDir} from ${
|
|
1562
|
+
console.log(chalk28.cyan(`Compiling Types FINISH: ${entries.length} files to ${outDir} from ${srcDir}`));
|
|
1558
1563
|
}
|
|
1559
1564
|
return 0;
|
|
1560
1565
|
};
|
|
1561
1566
|
|
|
1562
1567
|
// src/actions/package/compile/packageCompileTsup.ts
|
|
1563
|
-
var compileFolder = async (
|
|
1568
|
+
var compileFolder = async (srcDir, entries, options, verbose) => {
|
|
1564
1569
|
const outDir = options?.outDir ?? "dist";
|
|
1565
1570
|
if (verbose) {
|
|
1566
|
-
console.log(`compileFolder [${
|
|
1571
|
+
console.log(`compileFolder [${srcDir}, ${options?.outDir}]`);
|
|
1572
|
+
}
|
|
1573
|
+
if (entries.length === 0) {
|
|
1574
|
+
console.warn(chalk29.yellow(`No entries found in ${srcDir} to compile`));
|
|
1575
|
+
return 0;
|
|
1567
1576
|
}
|
|
1568
|
-
const
|
|
1577
|
+
const validationResult = packageCompileTsc(entries, srcDir, void 0, void 0, verbose);
|
|
1578
|
+
if (validationResult !== 0) {
|
|
1579
|
+
console.error(chalk29.red(`Compile:Validation had ${validationResult} errors`));
|
|
1580
|
+
return validationResult;
|
|
1581
|
+
}
|
|
1582
|
+
const optionsParams = {
|
|
1569
1583
|
bundle: true,
|
|
1570
1584
|
cjsInterop: true,
|
|
1571
1585
|
clean: true,
|
|
1572
1586
|
dts: false,
|
|
1573
|
-
entry: entries.map((entry) => `${folder}/${entry}`),
|
|
1574
1587
|
format: ["esm"],
|
|
1575
1588
|
outDir,
|
|
1576
1589
|
silent: true,
|
|
1577
1590
|
sourcemap: true,
|
|
1578
1591
|
splitting: false,
|
|
1579
1592
|
tsconfig: "tsconfig.json",
|
|
1580
|
-
...options
|
|
1581
|
-
|
|
1582
|
-
|
|
1583
|
-
|
|
1584
|
-
console.error(`Compile:Validation had ${validationResult} errors`);
|
|
1585
|
-
return validationResult;
|
|
1586
|
-
}
|
|
1593
|
+
...options,
|
|
1594
|
+
entry: entries.map((entry) => `${srcDir}/${entry}`)
|
|
1595
|
+
};
|
|
1596
|
+
const optionsResult = defineConfig(optionsParams);
|
|
1587
1597
|
const optionsList = (await Promise.all(
|
|
1588
1598
|
(Array.isArray(optionsResult) ? optionsResult : [optionsResult]).flatMap(async (options2) => {
|
|
1589
1599
|
const result = typeof options2 === "function" ? await options2({}) : [options2];
|
|
@@ -1591,11 +1601,12 @@ var compileFolder = async (folder, entries, options, verbose) => {
|
|
|
1591
1601
|
})
|
|
1592
1602
|
)).flat();
|
|
1593
1603
|
if (verbose) {
|
|
1594
|
-
console.log(`TSUP:build:start [${
|
|
1604
|
+
console.log(chalk29.cyan(`TSUP:build:start [${srcDir}]`));
|
|
1605
|
+
console.log(chalk29.gray(`TSUP:build:options [${JSON.stringify(optionsList, null, 2)}]`));
|
|
1595
1606
|
}
|
|
1596
1607
|
await Promise.all(optionsList.map((options2) => build2(options2)));
|
|
1597
1608
|
if (verbose) {
|
|
1598
|
-
console.log(`TSUP:build:stop [${
|
|
1609
|
+
console.log(chalk29.cyan(`TSUP:build:stop [${srcDir}]`));
|
|
1599
1610
|
}
|
|
1600
1611
|
await packageCompileTscTypes(entries, outDir, options?.platform ?? "neutral", "build", verbose);
|
|
1601
1612
|
return 0;
|
|
@@ -1623,59 +1634,62 @@ var tsupOptions = (options = []) => {
|
|
|
1623
1634
|
};
|
|
1624
1635
|
var packageCompileTsup = async (config2) => {
|
|
1625
1636
|
const compile2 = config2?.compile;
|
|
1626
|
-
const
|
|
1627
|
-
if (
|
|
1628
|
-
console.log(
|
|
1637
|
+
const verbose = config2?.verbose ?? false;
|
|
1638
|
+
if (verbose) {
|
|
1639
|
+
console.log("Compiling with TSUP");
|
|
1629
1640
|
}
|
|
1630
1641
|
const compileForNode = compile2?.node ?? { src: {} };
|
|
1631
1642
|
const compileForBrowser = compile2?.browser ?? { src: {} };
|
|
1632
1643
|
const compileForNeutral = compile2?.neutral ?? { src: {} };
|
|
1633
1644
|
return (await Promise.all(
|
|
1634
|
-
Object.entries(compileForNode).map(async ([
|
|
1645
|
+
Object.entries(compileForNode).map(async ([srcDir, options]) => {
|
|
1635
1646
|
const optionsObject = typeof options === "object" ? options : {};
|
|
1636
1647
|
const inEsBuildOptions = typeof compile2?.node?.esbuildOptions === "object" ? compile2?.node?.esbuildOptions : {};
|
|
1637
|
-
|
|
1638
|
-
|
|
1639
|
-
|
|
1648
|
+
const entry = buildEntries(srcDir, compile2?.entryMode, options, true, verbose);
|
|
1649
|
+
return typeof srcDir === "string" ? await compileFolder(
|
|
1650
|
+
srcDir,
|
|
1651
|
+
entry,
|
|
1640
1652
|
tsupOptions([
|
|
1641
1653
|
inEsBuildOptions,
|
|
1642
1654
|
compile2?.tsup?.options ?? {},
|
|
1643
1655
|
typeof options === "object" ? options : {},
|
|
1644
1656
|
{ platform: "node", outDir: optionsObject.outDir ?? "dist/node" }
|
|
1645
1657
|
]),
|
|
1646
|
-
|
|
1658
|
+
verbose
|
|
1647
1659
|
) : 0;
|
|
1648
1660
|
})
|
|
1649
1661
|
)).reduce((prev, value) => prev + value, 0) + (await Promise.all(
|
|
1650
|
-
Object.entries(compileForBrowser).map(async ([
|
|
1662
|
+
Object.entries(compileForBrowser).map(async ([srcDir, options]) => {
|
|
1651
1663
|
const optionsObject = typeof options === "object" ? options : {};
|
|
1652
1664
|
const inEsBuildOptions = typeof compile2?.browser?.esbuildOptions === "object" ? compile2?.browser?.esbuildOptions : {};
|
|
1653
|
-
|
|
1654
|
-
|
|
1655
|
-
|
|
1665
|
+
const entry = buildEntries(srcDir, compile2?.entryMode, options, true, verbose);
|
|
1666
|
+
return typeof srcDir === "string" ? await compileFolder(
|
|
1667
|
+
srcDir,
|
|
1668
|
+
entry,
|
|
1656
1669
|
tsupOptions([
|
|
1657
1670
|
inEsBuildOptions,
|
|
1658
1671
|
compile2?.tsup?.options ?? {},
|
|
1659
1672
|
typeof options === "object" ? options : {},
|
|
1660
1673
|
{ platform: "browser", outDir: optionsObject.outDir ?? "dist/browser" }
|
|
1661
1674
|
]),
|
|
1662
|
-
|
|
1675
|
+
verbose
|
|
1663
1676
|
) : 0;
|
|
1664
1677
|
})
|
|
1665
1678
|
)).reduce((prev, value) => prev + value, 0) + (await Promise.all(
|
|
1666
|
-
Object.entries(compileForNeutral).map(async ([
|
|
1679
|
+
Object.entries(compileForNeutral).map(async ([srcDir, options]) => {
|
|
1667
1680
|
const optionsObject = typeof options === "object" ? options : {};
|
|
1668
1681
|
const inEsBuildOptions = typeof compile2?.neutral?.esbuildOptions === "object" ? compile2?.neutral?.esbuildOptions : {};
|
|
1669
|
-
|
|
1670
|
-
|
|
1671
|
-
|
|
1682
|
+
const entry = buildEntries(srcDir, compile2?.entryMode, options, true, verbose);
|
|
1683
|
+
return typeof srcDir === "string" ? await compileFolder(
|
|
1684
|
+
srcDir,
|
|
1685
|
+
entry,
|
|
1672
1686
|
tsupOptions([
|
|
1673
1687
|
inEsBuildOptions,
|
|
1674
1688
|
compile2?.tsup?.options ?? {},
|
|
1675
1689
|
typeof options === "object" ? options : {},
|
|
1676
1690
|
{ platform: "neutral", outDir: optionsObject.outDir ?? "dist/neutral" }
|
|
1677
1691
|
]),
|
|
1678
|
-
|
|
1692
|
+
verbose
|
|
1679
1693
|
) : 0;
|
|
1680
1694
|
})
|
|
1681
1695
|
)).reduce((prev, value) => prev + value, 0) + 0;
|
|
@@ -1684,7 +1698,7 @@ var packageCompileTsup = async (config2) => {
|
|
|
1684
1698
|
// src/actions/package/compile/compile.ts
|
|
1685
1699
|
var packageCompile = async (inConfig = {}) => {
|
|
1686
1700
|
const pkg = process.env.INIT_CWD;
|
|
1687
|
-
console.log(
|
|
1701
|
+
console.log(chalk30.green(`Compiling ${pkg}`));
|
|
1688
1702
|
const config2 = await loadConfig(inConfig);
|
|
1689
1703
|
const publint2 = config2.publint;
|
|
1690
1704
|
const tsupResults = await packageCompileTsup(config2);
|
|
@@ -1696,7 +1710,7 @@ var packageCompile = async (inConfig = {}) => {
|
|
|
1696
1710
|
|
|
1697
1711
|
// src/actions/package/copy-assets.ts
|
|
1698
1712
|
import path7 from "path/posix";
|
|
1699
|
-
import
|
|
1713
|
+
import chalk31 from "chalk";
|
|
1700
1714
|
import cpy2 from "cpy";
|
|
1701
1715
|
var copyTargetAssets2 = async (target, name, location) => {
|
|
1702
1716
|
try {
|
|
@@ -1709,7 +1723,7 @@ var copyTargetAssets2 = async (target, name, location) => {
|
|
|
1709
1723
|
}
|
|
1710
1724
|
);
|
|
1711
1725
|
if (values.length > 0) {
|
|
1712
|
-
console.log(
|
|
1726
|
+
console.log(chalk31.green(`Copying Assets [${target.toUpperCase()}] - ${name} - ${location}`));
|
|
1713
1727
|
}
|
|
1714
1728
|
for (const value of values) {
|
|
1715
1729
|
console.log(`${value.split("/").pop()} => ./dist/${target}`);
|
|
@@ -1739,7 +1753,7 @@ var packageCopyAssets = async ({ target }) => {
|
|
|
1739
1753
|
|
|
1740
1754
|
// src/actions/package/cycle.ts
|
|
1741
1755
|
import { cruise as cruise2 } from "dependency-cruiser";
|
|
1742
|
-
var packageCycle = async (
|
|
1756
|
+
var packageCycle = async () => {
|
|
1743
1757
|
const pkg = process.env.INIT_CWD;
|
|
1744
1758
|
const pkgName = process.env.npm_package_name;
|
|
1745
1759
|
const cruiseOptions = {
|
|
@@ -1759,14 +1773,12 @@ var packageCycle = async ({ verbose = false }) => {
|
|
|
1759
1773
|
doNotFollow: { path: "node_modules|packages/.*/packages" },
|
|
1760
1774
|
tsPreCompilationDeps: false,
|
|
1761
1775
|
combinedDependencies: true,
|
|
1762
|
-
outputType:
|
|
1776
|
+
outputType: "err"
|
|
1763
1777
|
};
|
|
1764
1778
|
const target = `${pkg}/src`;
|
|
1765
1779
|
console.log(`Checking for circular dependencies in ${target}...`);
|
|
1766
1780
|
const result = await cruise2([target], cruiseOptions);
|
|
1767
|
-
|
|
1768
|
-
console.log(result.output);
|
|
1769
|
-
}
|
|
1781
|
+
console.log(result.output);
|
|
1770
1782
|
if (result.exitCode === 0) {
|
|
1771
1783
|
console.log(`${pkgName} \u2705 No dependency violations`);
|
|
1772
1784
|
} else {
|
|
@@ -1778,7 +1790,7 @@ var packageCycle = async ({ verbose = false }) => {
|
|
|
1778
1790
|
// src/actions/package/gen-docs.ts
|
|
1779
1791
|
import { existsSync as existsSync4 } from "fs";
|
|
1780
1792
|
import path8 from "path";
|
|
1781
|
-
import
|
|
1793
|
+
import chalk32 from "chalk";
|
|
1782
1794
|
import {
|
|
1783
1795
|
Application,
|
|
1784
1796
|
ArgumentsReader,
|
|
@@ -1882,7 +1894,7 @@ var runTypeDoc = async (app) => {
|
|
|
1882
1894
|
return ExitCodes.OutputError;
|
|
1883
1895
|
}
|
|
1884
1896
|
}
|
|
1885
|
-
console.log(
|
|
1897
|
+
console.log(chalk32.green(`${pkgName} - Ok`));
|
|
1886
1898
|
return ExitCodes.Ok;
|
|
1887
1899
|
};
|
|
1888
1900
|
|
|
@@ -1891,7 +1903,7 @@ import { readdirSync } from "fs";
|
|
|
1891
1903
|
import path9 from "path";
|
|
1892
1904
|
import { cwd as cwd4 } from "process";
|
|
1893
1905
|
import { pathToFileURL } from "url";
|
|
1894
|
-
import
|
|
1906
|
+
import chalk33 from "chalk";
|
|
1895
1907
|
import { ESLint } from "eslint";
|
|
1896
1908
|
import { findUp } from "find-up";
|
|
1897
1909
|
import picomatch from "picomatch";
|
|
@@ -1900,14 +1912,14 @@ var dumpMessages = (lintResults) => {
|
|
|
1900
1912
|
const severity = ["none", "warning", "error"];
|
|
1901
1913
|
for (const lintResult of lintResults) {
|
|
1902
1914
|
if (lintResult.messages.length > 0) {
|
|
1903
|
-
console.log(
|
|
1915
|
+
console.log(chalk33.gray(`
|
|
1904
1916
|
${lintResult.filePath}`));
|
|
1905
1917
|
for (const message of lintResult.messages) {
|
|
1906
1918
|
console.log(
|
|
1907
|
-
|
|
1908
|
-
|
|
1909
|
-
|
|
1910
|
-
|
|
1919
|
+
chalk33.gray(` ${message.line}:${message.column}`),
|
|
1920
|
+
chalk33[colors[message.severity]](` ${severity[message.severity]}`),
|
|
1921
|
+
chalk33.white(` ${message.message}`),
|
|
1922
|
+
chalk33.gray(` ${message.ruleId}`)
|
|
1911
1923
|
);
|
|
1912
1924
|
}
|
|
1913
1925
|
}
|
|
@@ -1946,7 +1958,7 @@ var packageLint = async (fix2 = false, verbose = false, cache = true) => {
|
|
|
1946
1958
|
});
|
|
1947
1959
|
const files = getFiles(cwd4(), ignoreFolders);
|
|
1948
1960
|
if (verbose) {
|
|
1949
|
-
console.log(
|
|
1961
|
+
console.log(chalk33.green(`Linting ${pkg} [files = ${files.length}]`));
|
|
1950
1962
|
}
|
|
1951
1963
|
const lintResults = await engine.lintFiles(files);
|
|
1952
1964
|
dumpMessages(lintResults);
|
|
@@ -1956,7 +1968,7 @@ var packageLint = async (fix2 = false, verbose = false, cache = true) => {
|
|
|
1956
1968
|
const filesCountColor = files.length < 100 ? "green" : files.length < 1e3 ? "yellow" : "red";
|
|
1957
1969
|
const lintTime = Date.now() - start;
|
|
1958
1970
|
const lintTimeColor = lintTime < 1e3 ? "green" : lintTime < 3e3 ? "yellow" : "red";
|
|
1959
|
-
console.log(
|
|
1971
|
+
console.log(chalk33.white(`Linted ${chalk33[filesCountColor](files.length)} files in ${chalk33[lintTimeColor](lintTime)}ms`));
|
|
1960
1972
|
return lintResults.reduce((prev, lintResult) => prev + lintResult.errorCount, 0);
|
|
1961
1973
|
};
|
|
1962
1974
|
|
|
@@ -1986,7 +1998,7 @@ var rebuild = ({ target }) => {
|
|
|
1986
1998
|
};
|
|
1987
1999
|
|
|
1988
2000
|
// src/actions/recompile.ts
|
|
1989
|
-
import
|
|
2001
|
+
import chalk34 from "chalk";
|
|
1990
2002
|
var recompile = async ({
|
|
1991
2003
|
verbose,
|
|
1992
2004
|
target,
|
|
@@ -2022,7 +2034,7 @@ var recompileAll = async ({
|
|
|
2022
2034
|
const incrementalOptions = incremental ? ["--since", "-Apt", "--topological-dev"] : ["--parallel", "-Apt", "--topological-dev"];
|
|
2023
2035
|
const jobsOptions = jobs ? ["-j", `${jobs}`] : [];
|
|
2024
2036
|
if (jobs) {
|
|
2025
|
-
console.log(
|
|
2037
|
+
console.log(chalk34.blue(`Jobs set to [${jobs}]`));
|
|
2026
2038
|
}
|
|
2027
2039
|
const result = await runStepsAsync(`Recompile${incremental ? "-Incremental" : ""} [All]`, [
|
|
2028
2040
|
[
|
|
@@ -2053,7 +2065,7 @@ var recompileAll = async ({
|
|
|
2053
2065
|
]
|
|
2054
2066
|
]);
|
|
2055
2067
|
console.log(
|
|
2056
|
-
`${
|
|
2068
|
+
`${chalk34.gray("Recompiled in")} [${chalk34.magenta(((Date.now() - start) / 1e3).toFixed(2))}] ${chalk34.gray("seconds")}`
|
|
2057
2069
|
);
|
|
2058
2070
|
return result;
|
|
2059
2071
|
};
|
|
@@ -2084,9 +2096,9 @@ var reinstall = () => {
|
|
|
2084
2096
|
};
|
|
2085
2097
|
|
|
2086
2098
|
// src/actions/relint.ts
|
|
2087
|
-
import
|
|
2099
|
+
import chalk35 from "chalk";
|
|
2088
2100
|
var relintPackage = ({ pkg }) => {
|
|
2089
|
-
console.log(
|
|
2101
|
+
console.log(chalk35.gray(`${"Relint"} [All-Packages]`));
|
|
2090
2102
|
const start = Date.now();
|
|
2091
2103
|
const result = runSteps("Relint [All-Packages]", [
|
|
2092
2104
|
["yarn", [
|
|
@@ -2096,7 +2108,7 @@ var relintPackage = ({ pkg }) => {
|
|
|
2096
2108
|
"package-relint"
|
|
2097
2109
|
]]
|
|
2098
2110
|
]);
|
|
2099
|
-
console.log(
|
|
2111
|
+
console.log(chalk35.gray(`${"Relinted in"} [${chalk35.magenta(((Date.now() - start) / 1e3).toFixed(2))}] ${chalk35.gray("seconds")}`));
|
|
2100
2112
|
return result;
|
|
2101
2113
|
};
|
|
2102
2114
|
var relint = ({
|
|
@@ -2107,7 +2119,7 @@ var relint = ({
|
|
|
2107
2119
|
return pkg ? relintPackage({ pkg }) : relintAllPackages({ verbose, incremental });
|
|
2108
2120
|
};
|
|
2109
2121
|
var relintAllPackages = ({ verbose = true, incremental } = {}) => {
|
|
2110
|
-
console.log(
|
|
2122
|
+
console.log(chalk35.gray(`${"Relint"} [All-Packages]`));
|
|
2111
2123
|
const start = Date.now();
|
|
2112
2124
|
const verboseOptions = verbose ? ["--verbose"] : ["--no-verbose"];
|
|
2113
2125
|
const incrementalOptions = incremental ? ["--since", "-Ap"] : ["--parallel", "-Ap"];
|
|
@@ -2121,7 +2133,7 @@ var relintAllPackages = ({ verbose = true, incremental } = {}) => {
|
|
|
2121
2133
|
"package-relint"
|
|
2122
2134
|
]]
|
|
2123
2135
|
]);
|
|
2124
|
-
console.log(
|
|
2136
|
+
console.log(chalk35.gray(`Relinted in [${chalk35.magenta(((Date.now() - start) / 1e3).toFixed(2))}] ${chalk35.gray("seconds")}`));
|
|
2125
2137
|
return result;
|
|
2126
2138
|
};
|
|
2127
2139
|
|
|
@@ -2139,10 +2151,10 @@ var sonar = () => {
|
|
|
2139
2151
|
};
|
|
2140
2152
|
|
|
2141
2153
|
// src/actions/statics.ts
|
|
2142
|
-
import
|
|
2154
|
+
import chalk36 from "chalk";
|
|
2143
2155
|
var DefaultDependencies = ["axios", "@xylabs/pixel", "react", "graphql", "react-router", "@mui/material", "@mui/system"];
|
|
2144
2156
|
var statics = () => {
|
|
2145
|
-
console.log(
|
|
2157
|
+
console.log(chalk36.green("Check Required Static Dependencies"));
|
|
2146
2158
|
const statics2 = parsedPackageJSON()?.xy?.deps?.statics;
|
|
2147
2159
|
return detectDuplicateDependencies(statics2, DefaultDependencies);
|
|
2148
2160
|
};
|