@xylabs/ts-scripts-yarn3 4.0.0-rc.4 → 4.0.0-rc.6
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 +26 -97
- package/dist/actions/index.mjs.map +1 -1
- package/dist/actions/package/compile/compile.mjs +5 -76
- package/dist/actions/package/compile/compile.mjs.map +1 -1
- package/dist/actions/package/compile/index.mjs +5 -76
- package/dist/actions/package/compile/index.mjs.map +1 -1
- package/dist/actions/package/compile/packageCompileTsup.mjs +3 -157
- package/dist/actions/package/compile/packageCompileTsup.mjs.map +1 -1
- package/dist/actions/package/index.mjs +19 -90
- package/dist/actions/package/index.mjs.map +1 -1
- package/dist/actions/package/recompile.mjs +5 -76
- package/dist/actions/package/recompile.mjs.map +1 -1
- package/dist/bin/package/compile-only.mjs +7 -78
- package/dist/bin/package/compile-only.mjs.map +1 -1
- package/dist/bin/package/compile-tsup.mjs +5 -159
- package/dist/bin/package/compile-tsup.mjs.map +1 -1
- package/dist/bin/package/compile.mjs +7 -78
- package/dist/bin/package/compile.mjs.map +1 -1
- package/dist/bin/package/recompile.mjs +7 -78
- package/dist/bin/package/recompile.mjs.map +1 -1
- package/dist/index.mjs +36 -107
- package/dist/index.mjs.map +1 -1
- package/package.json +4 -4
- package/src/actions/package/compile/packageCompileTsup.ts +4 -10
package/dist/actions/index.mjs
CHANGED
|
@@ -292,7 +292,7 @@ var mergeEntries = /* @__PURE__ */ __name((a, b) => [
|
|
|
292
292
|
].sort(), "mergeEntries");
|
|
293
293
|
var generateIgnoreFiles = /* @__PURE__ */ __name((filename3, pkg) => {
|
|
294
294
|
console.log(chalk4.green(`Generate ${filename3} Files`));
|
|
295
|
-
const
|
|
295
|
+
const cwd3 = INIT_CWD() ?? ".";
|
|
296
296
|
const workspaces = pkg ? [
|
|
297
297
|
yarnWorkspace(pkg)
|
|
298
298
|
] : yarnWorkspaces();
|
|
@@ -300,7 +300,7 @@ var generateIgnoreFiles = /* @__PURE__ */ __name((filename3, pkg) => {
|
|
|
300
300
|
const writeEntries = /* @__PURE__ */ __name((location, entries) => writeLines(`${location}/${filename3}`, entries), "writeEntries");
|
|
301
301
|
const results = workspaces.map(({ location, name }) => {
|
|
302
302
|
try {
|
|
303
|
-
writeEntries(location, mergeEntries(readEntries(
|
|
303
|
+
writeEntries(location, mergeEntries(readEntries(cwd3), readEntries(location)));
|
|
304
304
|
return 0;
|
|
305
305
|
} catch (ex) {
|
|
306
306
|
const error = ex;
|
|
@@ -1253,7 +1253,7 @@ var packageClean = /* @__PURE__ */ __name(async () => {
|
|
|
1253
1253
|
}, "packageClean");
|
|
1254
1254
|
|
|
1255
1255
|
// src/actions/package/compile/compile.ts
|
|
1256
|
-
import
|
|
1256
|
+
import chalk22 from "chalk";
|
|
1257
1257
|
|
|
1258
1258
|
// src/actions/package/publint.ts
|
|
1259
1259
|
import { promises as fs } from "node:fs";
|
|
@@ -1418,86 +1418,23 @@ var buildEntries = /* @__PURE__ */ __name((folder, entryMode, verbose = false) =
|
|
|
1418
1418
|
}
|
|
1419
1419
|
}, "buildEntries");
|
|
1420
1420
|
|
|
1421
|
-
// src/actions/package/compile/packageCompileTscTypes.ts
|
|
1422
|
-
import { cwd as cwd2 } from "node:process";
|
|
1423
|
-
import chalk22 from "chalk";
|
|
1424
|
-
import { createProgramFromConfig as createProgramFromConfig2 } from "tsc-prog";
|
|
1425
|
-
import { DiagnosticCategory as DiagnosticCategory2 } from "typescript";
|
|
1426
|
-
var packageCompileTscTypes = /* @__PURE__ */ __name((folder = "src", { verbose } = {}, compilerOptionsParam) => {
|
|
1427
|
-
const pkg = process.env.INIT_CWD ?? cwd2();
|
|
1428
|
-
if (verbose) {
|
|
1429
|
-
console.log(`Compiling types with TSC [${pkg}]`);
|
|
1430
|
-
}
|
|
1431
|
-
const compilerOptions = {
|
|
1432
|
-
...getCompilerOptions({
|
|
1433
|
-
declaration: true,
|
|
1434
|
-
emitDeclarationOnly: true,
|
|
1435
|
-
outDir: "dist",
|
|
1436
|
-
removeComments: true,
|
|
1437
|
-
skipDefaultLibCheck: true,
|
|
1438
|
-
skipLibCheck: true,
|
|
1439
|
-
sourceMap: true
|
|
1440
|
-
}),
|
|
1441
|
-
...compilerOptionsParam
|
|
1442
|
-
};
|
|
1443
|
-
const files = buildEntries(folder, "all");
|
|
1444
|
-
const result = createProgramFromConfig2({
|
|
1445
|
-
basePath: pkg ?? cwd2(),
|
|
1446
|
-
compilerOptions,
|
|
1447
|
-
exclude: [
|
|
1448
|
-
"dist",
|
|
1449
|
-
"docs",
|
|
1450
|
-
"**/*.spec.*",
|
|
1451
|
-
"**/*.stories.*",
|
|
1452
|
-
"src/**/spec/**/*"
|
|
1453
|
-
],
|
|
1454
|
-
files
|
|
1455
|
-
}).emit();
|
|
1456
|
-
const diagResults = result.diagnostics.length;
|
|
1457
|
-
for (const diag of result.diagnostics) {
|
|
1458
|
-
switch (diag.category) {
|
|
1459
|
-
case DiagnosticCategory2.Error: {
|
|
1460
|
-
console.error(chalk22.red(diag.messageText));
|
|
1461
|
-
console.error(chalk22.grey(pkg));
|
|
1462
|
-
console.error(chalk22.blue(diag.file?.fileName));
|
|
1463
|
-
break;
|
|
1464
|
-
}
|
|
1465
|
-
case DiagnosticCategory2.Warning: {
|
|
1466
|
-
console.error(chalk22.yellow(diag.messageText));
|
|
1467
|
-
console.error(chalk22.grey(pkg));
|
|
1468
|
-
console.error(chalk22.blue(diag.file?.fileName));
|
|
1469
|
-
break;
|
|
1470
|
-
}
|
|
1471
|
-
case DiagnosticCategory2.Suggestion: {
|
|
1472
|
-
console.error(chalk22.white(diag.messageText));
|
|
1473
|
-
console.error(chalk22.grey(pkg));
|
|
1474
|
-
console.error(chalk22.blue(diag.file?.fileName));
|
|
1475
|
-
break;
|
|
1476
|
-
}
|
|
1477
|
-
}
|
|
1478
|
-
}
|
|
1479
|
-
return diagResults;
|
|
1480
|
-
}, "packageCompileTscTypes");
|
|
1481
|
-
|
|
1482
1421
|
// src/actions/package/compile/packageCompileTsup.ts
|
|
1483
|
-
var compileFolder = /* @__PURE__ */ __name(async (folder, entryMode = "single", options,
|
|
1422
|
+
var compileFolder = /* @__PURE__ */ __name(async (folder, entryMode = "single", options, _verbose) => {
|
|
1484
1423
|
const outDir = options?.outDir ?? "dist";
|
|
1485
1424
|
const entry = buildEntries(folder, entryMode);
|
|
1486
1425
|
const optionsResult = defineConfig({
|
|
1487
1426
|
bundle: true,
|
|
1488
1427
|
cjsInterop: true,
|
|
1489
1428
|
clean: true,
|
|
1490
|
-
dts:
|
|
1429
|
+
dts: true,
|
|
1491
1430
|
entry,
|
|
1492
1431
|
format: [
|
|
1493
1432
|
"esm"
|
|
1494
1433
|
],
|
|
1495
|
-
// minify: true,
|
|
1496
1434
|
outDir,
|
|
1497
1435
|
silent: true,
|
|
1498
1436
|
sourcemap: true,
|
|
1499
1437
|
splitting: false,
|
|
1500
|
-
// terserOptions: { format: { comments: false } },
|
|
1501
1438
|
tsconfig: "tsconfig.json",
|
|
1502
1439
|
...options
|
|
1503
1440
|
});
|
|
@@ -1512,11 +1449,6 @@ var compileFolder = /* @__PURE__ */ __name(async (folder, entryMode = "single",
|
|
|
1512
1449
|
];
|
|
1513
1450
|
}))).flat();
|
|
1514
1451
|
await Promise.all(optionsList.map((options2) => build2(options2)));
|
|
1515
|
-
packageCompileTscTypes(folder, {
|
|
1516
|
-
verbose
|
|
1517
|
-
}, {
|
|
1518
|
-
outDir
|
|
1519
|
-
});
|
|
1520
1452
|
return 0;
|
|
1521
1453
|
}, "compileFolder");
|
|
1522
1454
|
var packageCompileTsup = /* @__PURE__ */ __name(async (config2) => {
|
|
@@ -1559,10 +1491,7 @@ var packageCompileTsup = /* @__PURE__ */ __name(async (config2) => {
|
|
|
1559
1491
|
sourcemap: true,
|
|
1560
1492
|
target: "esnext"
|
|
1561
1493
|
};
|
|
1562
|
-
return await
|
|
1563
|
-
publint: false,
|
|
1564
|
-
verbose
|
|
1565
|
-
}) || (await Promise.all(Object.entries(compileForNode).map(async ([folder, options]) => {
|
|
1494
|
+
return (await Promise.all(Object.entries(compileForNode).map(async ([folder, options]) => {
|
|
1566
1495
|
const inEsBuildOptions = typeof compile2?.node?.esbuildOptions === "object" ? compile2?.node?.esbuildOptions : {};
|
|
1567
1496
|
return folder ? await compileFolder(folder, compile2?.entryMode, {
|
|
1568
1497
|
...standardOptions,
|
|
@@ -1607,7 +1536,7 @@ var packageCompileTsup = /* @__PURE__ */ __name(async (config2) => {
|
|
|
1607
1536
|
// src/actions/package/compile/compile.ts
|
|
1608
1537
|
var packageCompile = /* @__PURE__ */ __name(async (inConfig = {}) => {
|
|
1609
1538
|
const pkg = process.env.INIT_CWD;
|
|
1610
|
-
console.log(
|
|
1539
|
+
console.log(chalk22.green(`Compiling ${pkg}`));
|
|
1611
1540
|
const config2 = await loadConfig(inConfig);
|
|
1612
1541
|
const publint2 = config2.publint;
|
|
1613
1542
|
const mode = config2.compile?.mode ?? "tsup";
|
|
@@ -1627,7 +1556,7 @@ var packageCompile = /* @__PURE__ */ __name(async (inConfig = {}) => {
|
|
|
1627
1556
|
|
|
1628
1557
|
// src/actions/package/copy-assets.ts
|
|
1629
1558
|
import path5 from "node:path/posix";
|
|
1630
|
-
import
|
|
1559
|
+
import chalk23 from "chalk";
|
|
1631
1560
|
import cpy2 from "cpy";
|
|
1632
1561
|
var copyTargetAssets2 = /* @__PURE__ */ __name(async (target, name, location) => {
|
|
1633
1562
|
try {
|
|
@@ -1646,7 +1575,7 @@ var copyTargetAssets2 = /* @__PURE__ */ __name(async (target, name, location) =>
|
|
|
1646
1575
|
flat: false
|
|
1647
1576
|
});
|
|
1648
1577
|
if (values.length > 0) {
|
|
1649
|
-
console.log(
|
|
1578
|
+
console.log(chalk23.green(`Copying Assets [${target.toUpperCase()}] - ${name} - ${location}`));
|
|
1650
1579
|
}
|
|
1651
1580
|
for (const value of values) {
|
|
1652
1581
|
console.log(`${value.split("/").pop()} => ./dist/${target}`);
|
|
@@ -1676,8 +1605,8 @@ var packageCopyAssets = /* @__PURE__ */ __name(async ({ target }) => {
|
|
|
1676
1605
|
|
|
1677
1606
|
// src/actions/package/deps.ts
|
|
1678
1607
|
import { existsSync as existsSync4, readFileSync as readFileSync3 } from "node:fs";
|
|
1679
|
-
import { cwd as
|
|
1680
|
-
import
|
|
1608
|
+
import { cwd as cwd2 } from "node:process";
|
|
1609
|
+
import chalk24 from "chalk";
|
|
1681
1610
|
import depcheck from "depcheck";
|
|
1682
1611
|
var special = depcheck.special;
|
|
1683
1612
|
var defaultIgnorePatterns = [
|
|
@@ -1704,21 +1633,21 @@ var defaultIgnoreDevPatterns = [
|
|
|
1704
1633
|
var reportUnused = /* @__PURE__ */ __name((name, unused) => {
|
|
1705
1634
|
if (unused.length > 0) {
|
|
1706
1635
|
const message = [
|
|
1707
|
-
|
|
1636
|
+
chalk24.yellow(`${unused.length} Unused ${name}`)
|
|
1708
1637
|
];
|
|
1709
|
-
for (const value of unused) message.push(
|
|
1638
|
+
for (const value of unused) message.push(chalk24.gray(` ${value}`));
|
|
1710
1639
|
console.log(message.join("\n"));
|
|
1711
1640
|
}
|
|
1712
1641
|
}, "reportUnused");
|
|
1713
1642
|
var reportMissing = /* @__PURE__ */ __name((name, missing) => {
|
|
1714
1643
|
if (Object.keys(missing).length > 0) {
|
|
1715
1644
|
const message = [
|
|
1716
|
-
|
|
1645
|
+
chalk24.yellow(`${Object.entries(missing).length} Missing ${name}`)
|
|
1717
1646
|
];
|
|
1718
1647
|
for (const [key, value] of Object.entries(missing)) {
|
|
1719
|
-
message.push(`${key}`,
|
|
1648
|
+
message.push(`${key}`, chalk24.gray(` ${value.at(0)}`));
|
|
1720
1649
|
}
|
|
1721
|
-
console.log(
|
|
1650
|
+
console.log(chalk24.yellow(message.join("\n")));
|
|
1722
1651
|
}
|
|
1723
1652
|
}, "reportMissing");
|
|
1724
1653
|
var analyzeDeps = /* @__PURE__ */ __name(async (pkg, ignoreMatches) => {
|
|
@@ -1773,7 +1702,7 @@ var analyzeDeps = /* @__PURE__ */ __name(async (pkg, ignoreMatches) => {
|
|
|
1773
1702
|
};
|
|
1774
1703
|
}, "analyzeDeps");
|
|
1775
1704
|
var packageDeps = /* @__PURE__ */ __name(async () => {
|
|
1776
|
-
const pkg = process.env.INIT_CWD ??
|
|
1705
|
+
const pkg = process.env.INIT_CWD ?? cwd2();
|
|
1777
1706
|
const pkgName = process.env.npm_package_name;
|
|
1778
1707
|
const packageContent = existsSync4(`${pkg}/package.json`) ? JSON.parse(readFileSync3(`${pkg}/package.json`, {
|
|
1779
1708
|
encoding: "utf8"
|
|
@@ -1823,10 +1752,10 @@ var packageDeps = /* @__PURE__ */ __name(async () => {
|
|
|
1823
1752
|
reportUnused("dependencies", unusedDeps);
|
|
1824
1753
|
reportUnused("devDependencies", unusedDevDeps);
|
|
1825
1754
|
if (Object.entries(invalidDirs).length > 0) {
|
|
1826
|
-
for (const [key, value] of Object.entries(invalidDirs)) console.warn(
|
|
1755
|
+
for (const [key, value] of Object.entries(invalidDirs)) console.warn(chalk24.gray(`Invalid Dir: ${key}: ${value}`));
|
|
1827
1756
|
}
|
|
1828
1757
|
if (Object.entries(invalidFiles).length > 0) {
|
|
1829
|
-
for (const [key, value] of Object.entries(invalidFiles)) console.warn(
|
|
1758
|
+
for (const [key, value] of Object.entries(invalidFiles)) console.warn(chalk24.gray(`Invalid File: ${key}: ${value}`));
|
|
1830
1759
|
}
|
|
1831
1760
|
reportMissing("dependencies", missingDepsObject);
|
|
1832
1761
|
reportMissing("devDependencies", missingDevDepsObject);
|
|
@@ -1837,7 +1766,7 @@ var packageDeps = /* @__PURE__ */ __name(async () => {
|
|
|
1837
1766
|
// src/actions/package/gen-docs.ts
|
|
1838
1767
|
import { existsSync as existsSync5 } from "node:fs";
|
|
1839
1768
|
import path6 from "node:path";
|
|
1840
|
-
import
|
|
1769
|
+
import chalk25 from "chalk";
|
|
1841
1770
|
import { Application, ArgumentsReader, TSConfigReader, TypeDocReader } from "typedoc";
|
|
1842
1771
|
var ExitCodes = {
|
|
1843
1772
|
CompileError: 3,
|
|
@@ -1939,7 +1868,7 @@ var runTypeDoc = /* @__PURE__ */ __name(async (app) => {
|
|
|
1939
1868
|
return ExitCodes.OutputError;
|
|
1940
1869
|
}
|
|
1941
1870
|
}
|
|
1942
|
-
console.log(
|
|
1871
|
+
console.log(chalk25.green(`${pkgName} - Ok`));
|
|
1943
1872
|
return ExitCodes.Ok;
|
|
1944
1873
|
}, "runTypeDoc");
|
|
1945
1874
|
|
|
@@ -2009,7 +1938,7 @@ var rebuild = /* @__PURE__ */ __name(({ target }) => {
|
|
|
2009
1938
|
}, "rebuild");
|
|
2010
1939
|
|
|
2011
1940
|
// src/actions/recompile.ts
|
|
2012
|
-
import
|
|
1941
|
+
import chalk26 from "chalk";
|
|
2013
1942
|
var recompile = /* @__PURE__ */ __name(async ({ verbose, target, pkg, incremental }) => {
|
|
2014
1943
|
return pkg ? await recompilePackage({
|
|
2015
1944
|
pkg,
|
|
@@ -2070,7 +1999,7 @@ var recompileAll = /* @__PURE__ */ __name(async ({ jobs, verbose, target, increm
|
|
|
2070
1999
|
`${jobs}`
|
|
2071
2000
|
] : [];
|
|
2072
2001
|
if (jobs) {
|
|
2073
|
-
console.log(
|
|
2002
|
+
console.log(chalk26.blue(`Jobs set to [${jobs}]`));
|
|
2074
2003
|
}
|
|
2075
2004
|
const result = await runStepsAsync(`Recompile${incremental ? "-Incremental" : ""} [All]`, [
|
|
2076
2005
|
[
|
|
@@ -2087,7 +2016,7 @@ var recompileAll = /* @__PURE__ */ __name(async ({ jobs, verbose, target, increm
|
|
|
2087
2016
|
]
|
|
2088
2017
|
]
|
|
2089
2018
|
]);
|
|
2090
|
-
console.log(`${
|
|
2019
|
+
console.log(`${chalk26.gray("Recompiled in")} [${chalk26.magenta(((Date.now() - start) / 1e3).toFixed(2))}] ${chalk26.gray("seconds")}`);
|
|
2091
2020
|
return result;
|
|
2092
2021
|
}, "recompileAll");
|
|
2093
2022
|
|
|
@@ -2187,7 +2116,7 @@ var sonar = /* @__PURE__ */ __name(() => {
|
|
|
2187
2116
|
}, "sonar");
|
|
2188
2117
|
|
|
2189
2118
|
// src/actions/statics.ts
|
|
2190
|
-
import
|
|
2119
|
+
import chalk27 from "chalk";
|
|
2191
2120
|
var DefaultDependencies = [
|
|
2192
2121
|
"axios",
|
|
2193
2122
|
"@xylabs/pixel",
|
|
@@ -2198,7 +2127,7 @@ var DefaultDependencies = [
|
|
|
2198
2127
|
"@mui/system"
|
|
2199
2128
|
];
|
|
2200
2129
|
var statics = /* @__PURE__ */ __name(() => {
|
|
2201
|
-
console.log(
|
|
2130
|
+
console.log(chalk27.green("Check Required Static Dependencies"));
|
|
2202
2131
|
const statics2 = parsedPackageJSON()?.xy?.deps?.statics;
|
|
2203
2132
|
return detectDuplicateDependencies(statics2, DefaultDependencies);
|
|
2204
2133
|
}, "statics");
|