@xylabs/ts-scripts-yarn3 6.5.18 → 7.0.0-rc.10
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 +110 -130
- package/dist/actions/index.mjs.map +1 -1
- package/dist/actions/package/compile/buildEntries.mjs +8 -1
- package/dist/actions/package/compile/buildEntries.mjs.map +1 -1
- package/dist/actions/package/compile/compile.mjs +87 -107
- package/dist/actions/package/compile/compile.mjs.map +1 -1
- package/dist/actions/package/compile/index.mjs +88 -108
- package/dist/actions/package/compile/index.mjs.map +1 -1
- package/dist/actions/package/compile/packageCompileTsc.mjs +9 -35
- package/dist/actions/package/compile/packageCompileTsc.mjs.map +1 -1
- package/dist/actions/package/compile/packageCompileTscTypes.mjs +29 -102
- package/dist/actions/package/compile/packageCompileTscTypes.mjs.map +1 -1
- package/dist/actions/package/compile/packageCompileTsup.mjs +96 -135
- package/dist/actions/package/compile/packageCompileTsup.mjs.map +1 -1
- package/dist/actions/package/index.mjs +100 -120
- package/dist/actions/package/index.mjs.map +1 -1
- package/dist/actions/package/recompile.mjs +87 -107
- package/dist/actions/package/recompile.mjs.map +1 -1
- package/dist/bin/package/build-only.mjs +89 -109
- package/dist/bin/package/build-only.mjs.map +1 -1
- package/dist/bin/package/build.mjs +89 -109
- package/dist/bin/package/build.mjs.map +1 -1
- package/dist/bin/package/compile-only.mjs +89 -109
- package/dist/bin/package/compile-only.mjs.map +1 -1
- package/dist/bin/package/compile-tsup.mjs +101 -140
- package/dist/bin/package/compile-tsup.mjs.map +1 -1
- package/dist/bin/package/compile.mjs +89 -109
- package/dist/bin/package/compile.mjs.map +1 -1
- package/dist/bin/package/recompile.mjs +89 -109
- package/dist/bin/package/recompile.mjs.map +1 -1
- package/dist/index.d.ts +24 -7
- package/dist/index.mjs +122 -142
- package/dist/index.mjs.map +1 -1
- package/package.json +8 -5
- package/dist/actions/package/compile/compileTypes.mjs +0 -138
- package/dist/actions/package/compile/compileTypes.mjs.map +0 -1
- package/dist/bin/package/compile-types.mjs +0 -150
- package/dist/bin/package/compile-types.mjs.map +0 -1
package/dist/index.mjs
CHANGED
|
@@ -1395,7 +1395,7 @@ var packageClean = async () => {
|
|
|
1395
1395
|
};
|
|
1396
1396
|
|
|
1397
1397
|
// src/actions/package/compile/compile.ts
|
|
1398
|
-
import
|
|
1398
|
+
import chalk28 from "chalk";
|
|
1399
1399
|
|
|
1400
1400
|
// src/actions/package/publint.ts
|
|
1401
1401
|
import { promises as fs4 } from "fs";
|
|
@@ -1451,7 +1451,7 @@ var getAllInputs = (folder) => {
|
|
|
1451
1451
|
};
|
|
1452
1452
|
|
|
1453
1453
|
// src/actions/package/compile/buildEntries.ts
|
|
1454
|
-
var buildEntries = (folder, entryMode = "single", excludeSpecAndStories = true, verbose = false) => {
|
|
1454
|
+
var buildEntries = (folder, entryMode = "single", options, excludeSpecAndStories = true, verbose = false) => {
|
|
1455
1455
|
let entries = [];
|
|
1456
1456
|
switch (entryMode) {
|
|
1457
1457
|
case "platform": {
|
|
@@ -1462,16 +1462,46 @@ var buildEntries = (folder, entryMode = "single", excludeSpecAndStories = true,
|
|
|
1462
1462
|
entries = excludeSpecAndStories ? getAllInputs(folder).filter((entry) => !entry.includes(".spec.") && !entry.includes(".stories.")) : getAllInputs(folder);
|
|
1463
1463
|
break;
|
|
1464
1464
|
}
|
|
1465
|
+
case "custom": {
|
|
1466
|
+
entries = [];
|
|
1467
|
+
break;
|
|
1468
|
+
}
|
|
1465
1469
|
default: {
|
|
1466
1470
|
entries = [`${folder}/index.ts`];
|
|
1467
1471
|
break;
|
|
1468
1472
|
}
|
|
1469
1473
|
}
|
|
1474
|
+
if (typeof options !== "boolean" && Array.isArray(options?.entry)) {
|
|
1475
|
+
entries.push(...options.entry);
|
|
1476
|
+
}
|
|
1470
1477
|
if (verbose) console.log(`buildEntries [${entryMode}] ${entries.length}`);
|
|
1471
1478
|
return entries;
|
|
1472
1479
|
};
|
|
1473
1480
|
|
|
1474
|
-
// src/actions/package/compile/
|
|
1481
|
+
// src/actions/package/compile/deepMerge.ts
|
|
1482
|
+
function deepMerge(target, source) {
|
|
1483
|
+
if (!source || typeof source !== "object") return target;
|
|
1484
|
+
for (const key of Object.keys(source)) {
|
|
1485
|
+
if (typeof source[key] === "object" && source[key] !== null && !Array.isArray(source[key])) {
|
|
1486
|
+
if (!target[key] || typeof target[key] !== "object") {
|
|
1487
|
+
target[key] = {};
|
|
1488
|
+
}
|
|
1489
|
+
deepMerge(target[key], source[key]);
|
|
1490
|
+
} else {
|
|
1491
|
+
target[key] = source[key];
|
|
1492
|
+
}
|
|
1493
|
+
}
|
|
1494
|
+
return target;
|
|
1495
|
+
}
|
|
1496
|
+
function deepMergeObjects(objects) {
|
|
1497
|
+
const result = {};
|
|
1498
|
+
for (const obj of objects) {
|
|
1499
|
+
deepMerge(result, obj);
|
|
1500
|
+
}
|
|
1501
|
+
return result;
|
|
1502
|
+
}
|
|
1503
|
+
|
|
1504
|
+
// src/actions/package/compile/packageCompileTsc.ts
|
|
1475
1505
|
import { cwd } from "process";
|
|
1476
1506
|
import chalk27 from "chalk";
|
|
1477
1507
|
import { createProgramFromConfig } from "tsc-prog";
|
|
@@ -1508,33 +1538,33 @@ var getCompilerOptions = (options = {}, tsconfig = "tsconfig.json") => {
|
|
|
1508
1538
|
return deepmerge2(configFileCompilerOptions, options);
|
|
1509
1539
|
};
|
|
1510
1540
|
|
|
1511
|
-
// src/actions/package/compile/
|
|
1512
|
-
var
|
|
1541
|
+
// src/actions/package/compile/packageCompileTsc.ts
|
|
1542
|
+
var packageCompileTsc = (entries, folder = "src", config2 = {}, compilerOptionsParam) => {
|
|
1513
1543
|
const pkg = process.env.INIT_CWD ?? cwd();
|
|
1514
1544
|
const verbose = config2?.verbose ?? false;
|
|
1515
1545
|
const compilerOptions = {
|
|
1516
1546
|
...getCompilerOptions({
|
|
1517
|
-
|
|
1518
|
-
outDir: config2.compile?.tsup?.options?.outDir ?? "dist/types",
|
|
1547
|
+
outDir: "dist/types",
|
|
1519
1548
|
removeComments: false,
|
|
1520
1549
|
skipDefaultLibCheck: true,
|
|
1521
1550
|
skipLibCheck: true,
|
|
1522
1551
|
sourceMap: false
|
|
1523
1552
|
}),
|
|
1524
1553
|
...compilerOptionsParam,
|
|
1525
|
-
emitDeclarationOnly:
|
|
1526
|
-
noEmit:
|
|
1554
|
+
emitDeclarationOnly: false,
|
|
1555
|
+
noEmit: true
|
|
1527
1556
|
};
|
|
1528
|
-
|
|
1529
|
-
|
|
1530
|
-
|
|
1531
|
-
|
|
1532
|
-
|
|
1557
|
+
console.log(chalk27.green(`Validating Files: ${entries.length}`));
|
|
1558
|
+
if (verbose) {
|
|
1559
|
+
for (const entry of entries) {
|
|
1560
|
+
console.log(chalk27.grey(`Validating: ${entry}`));
|
|
1561
|
+
}
|
|
1562
|
+
}
|
|
1563
|
+
if (entries.length > 0) {
|
|
1533
1564
|
const program = createProgramFromConfig({
|
|
1534
1565
|
basePath: pkg ?? cwd(),
|
|
1535
1566
|
compilerOptions,
|
|
1536
|
-
|
|
1537
|
-
files
|
|
1567
|
+
files: entries
|
|
1538
1568
|
});
|
|
1539
1569
|
const diagnostics = getPreEmitDiagnostics(program);
|
|
1540
1570
|
if (diagnostics.length > 0) {
|
|
@@ -1554,102 +1584,54 @@ var packageCompileTscTypes = (folder = "src", config2 = {}, compilerOptionsParam
|
|
|
1554
1584
|
return 0;
|
|
1555
1585
|
};
|
|
1556
1586
|
|
|
1557
|
-
// src/actions/package/compile/
|
|
1558
|
-
|
|
1559
|
-
|
|
1560
|
-
|
|
1561
|
-
|
|
1562
|
-
|
|
1563
|
-
|
|
1564
|
-
|
|
1565
|
-
|
|
1566
|
-
|
|
1567
|
-
|
|
1568
|
-
if (
|
|
1569
|
-
|
|
1570
|
-
}
|
|
1571
|
-
deepMerge(target[key], source[key]);
|
|
1572
|
-
} else {
|
|
1573
|
-
target[key] = source[key];
|
|
1587
|
+
// src/actions/package/compile/packageCompileTscTypes.ts
|
|
1588
|
+
import { cwd as cwd2 } from "process";
|
|
1589
|
+
import { rollup } from "rollup";
|
|
1590
|
+
import dts from "rollup-plugin-dts";
|
|
1591
|
+
import nodeExternals from "rollup-plugin-node-externals";
|
|
1592
|
+
async function bundleDts(inputPath, outputPath, platform) {
|
|
1593
|
+
const nodePlugIns = platform === "node" ? [nodeExternals()] : [];
|
|
1594
|
+
const bundle = await rollup({
|
|
1595
|
+
input: inputPath,
|
|
1596
|
+
plugins: [dts(), ...nodePlugIns],
|
|
1597
|
+
onwarn(warning, warn) {
|
|
1598
|
+
if (warning.code === "UNUSED_EXTERNAL_IMPORT") return;
|
|
1599
|
+
warn(warning);
|
|
1574
1600
|
}
|
|
1575
|
-
}
|
|
1576
|
-
|
|
1577
|
-
|
|
1578
|
-
|
|
1579
|
-
|
|
1580
|
-
|
|
1581
|
-
deepMerge(result, obj);
|
|
1582
|
-
}
|
|
1583
|
-
return result;
|
|
1601
|
+
});
|
|
1602
|
+
await bundle.write({
|
|
1603
|
+
file: outputPath,
|
|
1604
|
+
format: "es"
|
|
1605
|
+
});
|
|
1606
|
+
console.log(`Bundled declarations written to ${outputPath}`);
|
|
1584
1607
|
}
|
|
1585
|
-
|
|
1586
|
-
// src/actions/package/compile/packageCompileTsc.ts
|
|
1587
|
-
import { cwd as cwd2 } from "process";
|
|
1588
|
-
import chalk28 from "chalk";
|
|
1589
|
-
import { createProgramFromConfig as createProgramFromConfig2 } from "tsc-prog";
|
|
1590
|
-
import {
|
|
1591
|
-
DiagnosticCategory as DiagnosticCategory2,
|
|
1592
|
-
formatDiagnosticsWithColorAndContext as formatDiagnosticsWithColorAndContext2,
|
|
1593
|
-
getPreEmitDiagnostics as getPreEmitDiagnostics2,
|
|
1594
|
-
sys as sys3
|
|
1595
|
-
} from "typescript";
|
|
1596
|
-
var packageCompileTsc = (folder = "src", config2 = {}, compilerOptionsParam) => {
|
|
1608
|
+
var packageCompileTscTypes = async (entries, outDir, platform, folder = "src") => {
|
|
1597
1609
|
const pkg = process.env.INIT_CWD ?? cwd2();
|
|
1598
|
-
const
|
|
1599
|
-
const
|
|
1600
|
-
|
|
1601
|
-
|
|
1602
|
-
|
|
1603
|
-
skipDefaultLibCheck: true,
|
|
1604
|
-
skipLibCheck: true,
|
|
1605
|
-
sourceMap: false
|
|
1606
|
-
}),
|
|
1607
|
-
...compilerOptionsParam,
|
|
1608
|
-
emitDeclarationOnly: false,
|
|
1609
|
-
noEmit: true
|
|
1610
|
+
const srcRoot = `${pkg}/${folder}`;
|
|
1611
|
+
const entryNameToTypeName = (entry) => {
|
|
1612
|
+
const splitEntryName = entry.split(".");
|
|
1613
|
+
const newEntryExtension = "d." + splitEntryName.at(-1);
|
|
1614
|
+
return [...splitEntryName.slice(0, -1), newEntryExtension].join(".");
|
|
1610
1615
|
};
|
|
1611
|
-
const
|
|
1612
|
-
|
|
1613
|
-
|
|
1614
|
-
|
|
1615
|
-
if (files.length > 0) {
|
|
1616
|
-
const program = createProgramFromConfig2({
|
|
1617
|
-
basePath: pkg ?? cwd2(),
|
|
1618
|
-
compilerOptions,
|
|
1619
|
-
exclude: ["dist", "docs"],
|
|
1620
|
-
files
|
|
1621
|
-
});
|
|
1622
|
-
const diagnostics = getPreEmitDiagnostics2(program);
|
|
1623
|
-
if (diagnostics.length > 0) {
|
|
1624
|
-
const formattedDiagnostics = formatDiagnosticsWithColorAndContext2(
|
|
1625
|
-
diagnostics,
|
|
1626
|
-
{
|
|
1627
|
-
getCanonicalFileName: (fileName) => fileName,
|
|
1628
|
-
getCurrentDirectory: () => folder,
|
|
1629
|
-
getNewLine: () => sys3.newLine
|
|
1630
|
-
}
|
|
1631
|
-
);
|
|
1632
|
-
console.error(formattedDiagnostics);
|
|
1633
|
-
}
|
|
1634
|
-
program.emit();
|
|
1635
|
-
return diagnostics.reduce((acc, diag) => acc + (diag.category === DiagnosticCategory2.Error ? 1 : 0), 0);
|
|
1636
|
-
}
|
|
1616
|
+
const entryNames = entries.map((entry) => entry.split(`${folder}/`).at(-1) ?? entry);
|
|
1617
|
+
await Promise.all(entryNames.map(async (entryName) => {
|
|
1618
|
+
await bundleDts(`${srcRoot}/${entryName}`, outDir + "/" + entryNameToTypeName(entryName), platform);
|
|
1619
|
+
}));
|
|
1637
1620
|
return 0;
|
|
1638
1621
|
};
|
|
1639
1622
|
|
|
1640
1623
|
// src/actions/package/compile/packageCompileTsup.ts
|
|
1641
|
-
var compileFolder = async (folder,
|
|
1624
|
+
var compileFolder = async (folder, entries, options, verbose) => {
|
|
1642
1625
|
const outDir = options?.outDir ?? "dist";
|
|
1643
1626
|
if (verbose) {
|
|
1644
1627
|
console.log(`compileFolder [${folder}]`);
|
|
1645
1628
|
}
|
|
1646
|
-
const entry = buildEntries(folder, entryMode);
|
|
1647
1629
|
const optionsResult = defineConfig({
|
|
1648
1630
|
bundle: true,
|
|
1649
1631
|
cjsInterop: true,
|
|
1650
1632
|
clean: true,
|
|
1651
1633
|
dts: false,
|
|
1652
|
-
entry,
|
|
1634
|
+
entry: entries,
|
|
1653
1635
|
format: ["esm"],
|
|
1654
1636
|
outDir,
|
|
1655
1637
|
silent: true,
|
|
@@ -1658,6 +1640,11 @@ var compileFolder = async (folder, entryMode = "single", options, verbose) => {
|
|
|
1658
1640
|
tsconfig: "tsconfig.json",
|
|
1659
1641
|
...options
|
|
1660
1642
|
});
|
|
1643
|
+
const validationResult = packageCompileTsc(entries);
|
|
1644
|
+
if (validationResult !== 0) {
|
|
1645
|
+
console.error(`Compile:Validation had ${validationResult} errors`);
|
|
1646
|
+
return validationResult;
|
|
1647
|
+
}
|
|
1661
1648
|
const optionsList = (await Promise.all(
|
|
1662
1649
|
(Array.isArray(optionsResult) ? optionsResult : [optionsResult]).flatMap(async (options2) => {
|
|
1663
1650
|
const result = typeof options2 === "function" ? await options2({}) : [options2];
|
|
@@ -1671,6 +1658,7 @@ var compileFolder = async (folder, entryMode = "single", options, verbose) => {
|
|
|
1671
1658
|
if (verbose) {
|
|
1672
1659
|
console.log(`TSUP:build:stop [${folder}]`);
|
|
1673
1660
|
}
|
|
1661
|
+
await packageCompileTscTypes(entries, outDir, options?.platform ?? "neutral", folder);
|
|
1674
1662
|
return 0;
|
|
1675
1663
|
};
|
|
1676
1664
|
var tsupOptions = (options = []) => {
|
|
@@ -1703,21 +1691,13 @@ var packageCompileTsup = async (config2) => {
|
|
|
1703
1691
|
const compileForNode = compile2?.node ?? { src: {} };
|
|
1704
1692
|
const compileForBrowser = compile2?.browser ?? { src: {} };
|
|
1705
1693
|
const compileForNeutral = compile2?.neutral ?? { src: {} };
|
|
1706
|
-
if (verbose) {
|
|
1707
|
-
console.log("Calling packageCompileTscTypes");
|
|
1708
|
-
}
|
|
1709
|
-
let errors = await packageCompileTypes(config2);
|
|
1710
|
-
errors = errors + packageCompileTsc(void 0, config2);
|
|
1711
|
-
if (errors > 0) {
|
|
1712
|
-
return errors;
|
|
1713
|
-
}
|
|
1714
1694
|
return (await Promise.all(
|
|
1715
1695
|
Object.entries(compileForNode).map(async ([folder, options]) => {
|
|
1716
1696
|
const optionsObject = typeof options === "object" ? options : {};
|
|
1717
1697
|
const inEsBuildOptions = typeof compile2?.node?.esbuildOptions === "object" ? compile2?.node?.esbuildOptions : {};
|
|
1718
1698
|
return typeof folder === "string" ? await compileFolder(
|
|
1719
1699
|
folder,
|
|
1720
|
-
compile2?.entryMode,
|
|
1700
|
+
buildEntries(folder, compile2?.entryMode, options, true, verbose),
|
|
1721
1701
|
tsupOptions([
|
|
1722
1702
|
inEsBuildOptions,
|
|
1723
1703
|
compile2?.tsup?.options ?? {},
|
|
@@ -1733,7 +1713,7 @@ var packageCompileTsup = async (config2) => {
|
|
|
1733
1713
|
const inEsBuildOptions = typeof compile2?.browser?.esbuildOptions === "object" ? compile2?.browser?.esbuildOptions : {};
|
|
1734
1714
|
return typeof folder === "string" ? await compileFolder(
|
|
1735
1715
|
folder,
|
|
1736
|
-
compile2?.entryMode,
|
|
1716
|
+
buildEntries(folder, compile2?.entryMode, options, true, verbose),
|
|
1737
1717
|
tsupOptions([
|
|
1738
1718
|
inEsBuildOptions,
|
|
1739
1719
|
compile2?.tsup?.options ?? {},
|
|
@@ -1749,7 +1729,7 @@ var packageCompileTsup = async (config2) => {
|
|
|
1749
1729
|
const inEsBuildOptions = typeof compile2?.neutral?.esbuildOptions === "object" ? compile2?.neutral?.esbuildOptions : {};
|
|
1750
1730
|
return typeof folder === "string" ? await compileFolder(
|
|
1751
1731
|
folder,
|
|
1752
|
-
compile2?.entryMode,
|
|
1732
|
+
buildEntries(folder, compile2?.entryMode, options, true, verbose),
|
|
1753
1733
|
tsupOptions([
|
|
1754
1734
|
inEsBuildOptions,
|
|
1755
1735
|
compile2?.tsup?.options ?? {},
|
|
@@ -1765,7 +1745,7 @@ var packageCompileTsup = async (config2) => {
|
|
|
1765
1745
|
// src/actions/package/compile/compile.ts
|
|
1766
1746
|
var packageCompile = async (inConfig = {}) => {
|
|
1767
1747
|
const pkg = process.env.INIT_CWD;
|
|
1768
|
-
console.log(
|
|
1748
|
+
console.log(chalk28.green(`Compiling ${pkg}`));
|
|
1769
1749
|
const config2 = await loadConfig(inConfig);
|
|
1770
1750
|
const publint2 = config2.publint;
|
|
1771
1751
|
const tsupResults = await packageCompileTsup(config2);
|
|
@@ -1777,7 +1757,7 @@ var packageCompile = async (inConfig = {}) => {
|
|
|
1777
1757
|
|
|
1778
1758
|
// src/actions/package/copy-assets.ts
|
|
1779
1759
|
import path7 from "path/posix";
|
|
1780
|
-
import
|
|
1760
|
+
import chalk29 from "chalk";
|
|
1781
1761
|
import cpy2 from "cpy";
|
|
1782
1762
|
var copyTargetAssets2 = async (target, name, location) => {
|
|
1783
1763
|
try {
|
|
@@ -1790,7 +1770,7 @@ var copyTargetAssets2 = async (target, name, location) => {
|
|
|
1790
1770
|
}
|
|
1791
1771
|
);
|
|
1792
1772
|
if (values.length > 0) {
|
|
1793
|
-
console.log(
|
|
1773
|
+
console.log(chalk29.green(`Copying Assets [${target.toUpperCase()}] - ${name} - ${location}`));
|
|
1794
1774
|
}
|
|
1795
1775
|
for (const value of values) {
|
|
1796
1776
|
console.log(`${value.split("/").pop()} => ./dist/${target}`);
|
|
@@ -1859,7 +1839,7 @@ var packageCycle = async ({ verbose = false }) => {
|
|
|
1859
1839
|
// src/actions/package/gen-docs.ts
|
|
1860
1840
|
import { existsSync as existsSync5 } from "fs";
|
|
1861
1841
|
import path8 from "path";
|
|
1862
|
-
import
|
|
1842
|
+
import chalk30 from "chalk";
|
|
1863
1843
|
import {
|
|
1864
1844
|
Application,
|
|
1865
1845
|
ArgumentsReader,
|
|
@@ -1963,7 +1943,7 @@ var runTypeDoc = async (app) => {
|
|
|
1963
1943
|
return ExitCodes.OutputError;
|
|
1964
1944
|
}
|
|
1965
1945
|
}
|
|
1966
|
-
console.log(
|
|
1946
|
+
console.log(chalk30.green(`${pkgName} - Ok`));
|
|
1967
1947
|
return ExitCodes.Ok;
|
|
1968
1948
|
};
|
|
1969
1949
|
|
|
@@ -1972,7 +1952,7 @@ import { readdirSync } from "fs";
|
|
|
1972
1952
|
import path9 from "path";
|
|
1973
1953
|
import { cwd as cwd3 } from "process";
|
|
1974
1954
|
import { pathToFileURL } from "url";
|
|
1975
|
-
import
|
|
1955
|
+
import chalk31 from "chalk";
|
|
1976
1956
|
import { ESLint } from "eslint";
|
|
1977
1957
|
import { findUp } from "find-up";
|
|
1978
1958
|
import picomatch from "picomatch";
|
|
@@ -1981,14 +1961,14 @@ var dumpMessages = (lintResults) => {
|
|
|
1981
1961
|
const severity = ["none", "warning", "error"];
|
|
1982
1962
|
for (const lintResult of lintResults) {
|
|
1983
1963
|
if (lintResult.messages.length > 0) {
|
|
1984
|
-
console.log(
|
|
1964
|
+
console.log(chalk31.gray(`
|
|
1985
1965
|
${lintResult.filePath}`));
|
|
1986
1966
|
for (const message of lintResult.messages) {
|
|
1987
1967
|
console.log(
|
|
1988
|
-
|
|
1989
|
-
|
|
1990
|
-
|
|
1991
|
-
|
|
1968
|
+
chalk31.gray(` ${message.line}:${message.column}`),
|
|
1969
|
+
chalk31[colors[message.severity]](` ${severity[message.severity]}`),
|
|
1970
|
+
chalk31.white(` ${message.message}`),
|
|
1971
|
+
chalk31.gray(` ${message.ruleId}`)
|
|
1992
1972
|
);
|
|
1993
1973
|
}
|
|
1994
1974
|
}
|
|
@@ -2027,7 +2007,7 @@ var packageLint = async (fix2 = false, verbose = false, cache = true) => {
|
|
|
2027
2007
|
});
|
|
2028
2008
|
const files = getFiles(cwd3(), ignoreFolders);
|
|
2029
2009
|
if (verbose) {
|
|
2030
|
-
console.log(
|
|
2010
|
+
console.log(chalk31.green(`Linting ${pkg} [files = ${files.length}]`));
|
|
2031
2011
|
}
|
|
2032
2012
|
const lintResults = await engine.lintFiles(files);
|
|
2033
2013
|
dumpMessages(lintResults);
|
|
@@ -2037,7 +2017,7 @@ var packageLint = async (fix2 = false, verbose = false, cache = true) => {
|
|
|
2037
2017
|
const filesCountColor = files.length < 100 ? "green" : files.length < 1e3 ? "yellow" : "red";
|
|
2038
2018
|
const lintTime = Date.now() - start;
|
|
2039
2019
|
const lintTimeColor = lintTime < 1e3 ? "green" : lintTime < 3e3 ? "yellow" : "red";
|
|
2040
|
-
console.log(
|
|
2020
|
+
console.log(chalk31.white(`Linted ${chalk31[filesCountColor](files.length)} files in ${chalk31[lintTimeColor](lintTime)}ms`));
|
|
2041
2021
|
return lintResults.reduce((prev, lintResult) => prev + lintResult.errorCount, 0);
|
|
2042
2022
|
};
|
|
2043
2023
|
|
|
@@ -2067,7 +2047,7 @@ var rebuild = ({ target }) => {
|
|
|
2067
2047
|
};
|
|
2068
2048
|
|
|
2069
2049
|
// src/actions/recompile.ts
|
|
2070
|
-
import
|
|
2050
|
+
import chalk32 from "chalk";
|
|
2071
2051
|
var recompile = async ({
|
|
2072
2052
|
verbose,
|
|
2073
2053
|
target,
|
|
@@ -2103,7 +2083,7 @@ var recompileAll = async ({
|
|
|
2103
2083
|
const incrementalOptions = incremental ? ["--since", "-Apt", "--topological-dev"] : ["--parallel", "-Apt", "--topological-dev"];
|
|
2104
2084
|
const jobsOptions = jobs ? ["-j", `${jobs}`] : [];
|
|
2105
2085
|
if (jobs) {
|
|
2106
|
-
console.log(
|
|
2086
|
+
console.log(chalk32.blue(`Jobs set to [${jobs}]`));
|
|
2107
2087
|
}
|
|
2108
2088
|
const result = await runStepsAsync(`Recompile${incremental ? "-Incremental" : ""} [All]`, [
|
|
2109
2089
|
[
|
|
@@ -2134,7 +2114,7 @@ var recompileAll = async ({
|
|
|
2134
2114
|
]
|
|
2135
2115
|
]);
|
|
2136
2116
|
console.log(
|
|
2137
|
-
`${
|
|
2117
|
+
`${chalk32.gray("Recompiled in")} [${chalk32.magenta(((Date.now() - start) / 1e3).toFixed(2))}] ${chalk32.gray("seconds")}`
|
|
2138
2118
|
);
|
|
2139
2119
|
return result;
|
|
2140
2120
|
};
|
|
@@ -2165,9 +2145,9 @@ var reinstall = () => {
|
|
|
2165
2145
|
};
|
|
2166
2146
|
|
|
2167
2147
|
// src/actions/relint.ts
|
|
2168
|
-
import
|
|
2148
|
+
import chalk33 from "chalk";
|
|
2169
2149
|
var relintPackage = ({ pkg }) => {
|
|
2170
|
-
console.log(
|
|
2150
|
+
console.log(chalk33.gray(`${"Relint"} [All-Packages]`));
|
|
2171
2151
|
const start = Date.now();
|
|
2172
2152
|
const result = runSteps("Relint [All-Packages]", [
|
|
2173
2153
|
["yarn", [
|
|
@@ -2177,7 +2157,7 @@ var relintPackage = ({ pkg }) => {
|
|
|
2177
2157
|
"package-relint"
|
|
2178
2158
|
]]
|
|
2179
2159
|
]);
|
|
2180
|
-
console.log(
|
|
2160
|
+
console.log(chalk33.gray(`${"Relinted in"} [${chalk33.magenta(((Date.now() - start) / 1e3).toFixed(2))}] ${chalk33.gray("seconds")}`));
|
|
2181
2161
|
return result;
|
|
2182
2162
|
};
|
|
2183
2163
|
var relint = ({
|
|
@@ -2188,7 +2168,7 @@ var relint = ({
|
|
|
2188
2168
|
return pkg ? relintPackage({ pkg }) : relintAllPackages({ verbose, incremental });
|
|
2189
2169
|
};
|
|
2190
2170
|
var relintAllPackages = ({ verbose = true, incremental } = {}) => {
|
|
2191
|
-
console.log(
|
|
2171
|
+
console.log(chalk33.gray(`${"Relint"} [All-Packages]`));
|
|
2192
2172
|
const start = Date.now();
|
|
2193
2173
|
const verboseOptions = verbose ? ["--verbose"] : ["--no-verbose"];
|
|
2194
2174
|
const incrementalOptions = incremental ? ["--since", "-Ap"] : ["--parallel", "-Ap"];
|
|
@@ -2202,7 +2182,7 @@ var relintAllPackages = ({ verbose = true, incremental } = {}) => {
|
|
|
2202
2182
|
"package-relint"
|
|
2203
2183
|
]]
|
|
2204
2184
|
]);
|
|
2205
|
-
console.log(
|
|
2185
|
+
console.log(chalk33.gray(`Relinted in [${chalk33.magenta(((Date.now() - start) / 1e3).toFixed(2))}] ${chalk33.gray("seconds")}`));
|
|
2206
2186
|
return result;
|
|
2207
2187
|
};
|
|
2208
2188
|
|
|
@@ -2220,10 +2200,10 @@ var sonar = () => {
|
|
|
2220
2200
|
};
|
|
2221
2201
|
|
|
2222
2202
|
// src/actions/statics.ts
|
|
2223
|
-
import
|
|
2203
|
+
import chalk34 from "chalk";
|
|
2224
2204
|
var DefaultDependencies = ["axios", "@xylabs/pixel", "react", "graphql", "react-router", "@mui/material", "@mui/system"];
|
|
2225
2205
|
var statics = () => {
|
|
2226
|
-
console.log(
|
|
2206
|
+
console.log(chalk34.green("Check Required Static Dependencies"));
|
|
2227
2207
|
const statics2 = parsedPackageJSON()?.xy?.deps?.statics;
|
|
2228
2208
|
return detectDuplicateDependencies(statics2, DefaultDependencies);
|
|
2229
2209
|
};
|
|
@@ -2280,7 +2260,7 @@ var loadPackageConfig = async () => {
|
|
|
2280
2260
|
};
|
|
2281
2261
|
|
|
2282
2262
|
// src/xy/xy.ts
|
|
2283
|
-
import
|
|
2263
|
+
import chalk36 from "chalk";
|
|
2284
2264
|
|
|
2285
2265
|
// src/xy/xyBuildCommands.ts
|
|
2286
2266
|
var xyBuildCommands = (args) => {
|
|
@@ -2641,7 +2621,7 @@ var xyInstallCommands = (args) => {
|
|
|
2641
2621
|
};
|
|
2642
2622
|
|
|
2643
2623
|
// src/xy/xyLintCommands.ts
|
|
2644
|
-
import
|
|
2624
|
+
import chalk35 from "chalk";
|
|
2645
2625
|
var xyLintCommands = (args) => {
|
|
2646
2626
|
return args.command(
|
|
2647
2627
|
"cycle [package]",
|
|
@@ -2653,7 +2633,7 @@ var xyLintCommands = (args) => {
|
|
|
2653
2633
|
const start = Date.now();
|
|
2654
2634
|
if (argv.verbose) console.log("Cycle");
|
|
2655
2635
|
process.exitCode = await cycle({ pkg: argv.package });
|
|
2656
|
-
console.log(
|
|
2636
|
+
console.log(chalk35.blue(`Finished in ${Date.now() - start}ms`));
|
|
2657
2637
|
}
|
|
2658
2638
|
).command(
|
|
2659
2639
|
"lint [package]",
|
|
@@ -2675,7 +2655,7 @@ var xyLintCommands = (args) => {
|
|
|
2675
2655
|
if (argv.verbose) console.log("Lint");
|
|
2676
2656
|
const start = Date.now();
|
|
2677
2657
|
process.exitCode = argv.fix ? fix({ pkg: argv.package, cache: argv.cache }) : lint({ pkg: argv.package, cache: argv.cache });
|
|
2678
|
-
console.log(
|
|
2658
|
+
console.log(chalk35.blue(`Finished in ${Date.now() - start}ms`));
|
|
2679
2659
|
}
|
|
2680
2660
|
).command(
|
|
2681
2661
|
"deplint [package]",
|
|
@@ -2707,7 +2687,7 @@ var xyLintCommands = (args) => {
|
|
|
2707
2687
|
devDeps: !!argv.devDeps,
|
|
2708
2688
|
peerDeps: !!argv.peerDeps
|
|
2709
2689
|
});
|
|
2710
|
-
console.log(
|
|
2690
|
+
console.log(chalk35.blue(`Finished in ${Date.now() - start}ms`));
|
|
2711
2691
|
}
|
|
2712
2692
|
).command(
|
|
2713
2693
|
"fix [package]",
|
|
@@ -2719,7 +2699,7 @@ var xyLintCommands = (args) => {
|
|
|
2719
2699
|
const start = Date.now();
|
|
2720
2700
|
if (argv.verbose) console.log("Fix");
|
|
2721
2701
|
process.exitCode = fix();
|
|
2722
|
-
console.log(
|
|
2702
|
+
console.log(chalk35.blue(`Finished in ${Date.now() - start}ms`));
|
|
2723
2703
|
}
|
|
2724
2704
|
).command(
|
|
2725
2705
|
"relint [package]",
|
|
@@ -2731,7 +2711,7 @@ var xyLintCommands = (args) => {
|
|
|
2731
2711
|
if (argv.verbose) console.log("Relinting");
|
|
2732
2712
|
const start = Date.now();
|
|
2733
2713
|
process.exitCode = relint();
|
|
2734
|
-
console.log(
|
|
2714
|
+
console.log(chalk35.blue(`Finished in ${Date.now() - start}ms`));
|
|
2735
2715
|
}
|
|
2736
2716
|
).command(
|
|
2737
2717
|
"publint [package]",
|
|
@@ -2743,7 +2723,7 @@ var xyLintCommands = (args) => {
|
|
|
2743
2723
|
if (argv.verbose) console.log("Publint");
|
|
2744
2724
|
const start = Date.now();
|
|
2745
2725
|
process.exitCode = await publint({ pkg: argv.package, verbose: !!argv.verbose });
|
|
2746
|
-
console.log(
|
|
2726
|
+
console.log(chalk35.blue(`Finished in ${Date.now() - start}ms`));
|
|
2747
2727
|
}
|
|
2748
2728
|
).command(
|
|
2749
2729
|
"knip",
|
|
@@ -2755,7 +2735,7 @@ var xyLintCommands = (args) => {
|
|
|
2755
2735
|
if (argv.verbose) console.log("Knip");
|
|
2756
2736
|
const start = Date.now();
|
|
2757
2737
|
process.exitCode = knip();
|
|
2758
|
-
console.log(
|
|
2738
|
+
console.log(chalk35.blue(`Knip finished in ${Date.now() - start}ms`));
|
|
2759
2739
|
}
|
|
2760
2740
|
).command(
|
|
2761
2741
|
"sonar",
|
|
@@ -2767,7 +2747,7 @@ var xyLintCommands = (args) => {
|
|
|
2767
2747
|
const start = Date.now();
|
|
2768
2748
|
if (argv.verbose) console.log("Sonar Check");
|
|
2769
2749
|
process.exitCode = sonar();
|
|
2770
|
-
console.log(
|
|
2750
|
+
console.log(chalk35.blue(`Finished in ${Date.now() - start}ms`));
|
|
2771
2751
|
}
|
|
2772
2752
|
);
|
|
2773
2753
|
};
|
|
@@ -2803,8 +2783,8 @@ var xyParseOptions = () => {
|
|
|
2803
2783
|
var xy = async () => {
|
|
2804
2784
|
const options = xyParseOptions();
|
|
2805
2785
|
return await xyBuildCommands(xyCommonCommands(xyInstallCommands(xyDeployCommands(xyLintCommands(options))))).demandCommand(1).command("*", "", () => {
|
|
2806
|
-
console.error(
|
|
2807
|
-
console.log(
|
|
2786
|
+
console.error(chalk36.yellow(`Command not found [${chalk36.magenta(process.argv[2])}]`));
|
|
2787
|
+
console.log(chalk36.gray("Try 'yarn xy --help' for list of commands"));
|
|
2808
2788
|
}).version().help().argv;
|
|
2809
2789
|
};
|
|
2810
2790
|
export {
|
|
@@ -2813,6 +2793,7 @@ export {
|
|
|
2813
2793
|
INIT_CWD,
|
|
2814
2794
|
WINDOWS_NEWLINE_REGEX,
|
|
2815
2795
|
build,
|
|
2796
|
+
bundleDts,
|
|
2816
2797
|
checkResult,
|
|
2817
2798
|
clean,
|
|
2818
2799
|
cleanAll,
|
|
@@ -2867,7 +2848,6 @@ export {
|
|
|
2867
2848
|
packageCompileTsc,
|
|
2868
2849
|
packageCompileTscTypes,
|
|
2869
2850
|
packageCompileTsup,
|
|
2870
|
-
packageCompileTypes,
|
|
2871
2851
|
packageCopyAssets,
|
|
2872
2852
|
packageCycle,
|
|
2873
2853
|
packageGenDocs,
|