@xylabs/ts-scripts-yarn3 4.0.0-rc.4 → 4.0.0-rc.5
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 +24 -92
- package/dist/actions/index.mjs.map +1 -1
- package/dist/actions/package/compile/compile.mjs +3 -71
- package/dist/actions/package/compile/compile.mjs.map +1 -1
- package/dist/actions/package/compile/index.mjs +3 -71
- package/dist/actions/package/compile/index.mjs.map +1 -1
- package/dist/actions/package/compile/packageCompileTsup.mjs +1 -69
- package/dist/actions/package/compile/packageCompileTsup.mjs.map +1 -1
- package/dist/actions/package/index.mjs +17 -85
- package/dist/actions/package/index.mjs.map +1 -1
- package/dist/actions/package/recompile.mjs +3 -71
- package/dist/actions/package/recompile.mjs.map +1 -1
- package/dist/bin/package/compile-only.mjs +5 -73
- package/dist/bin/package/compile-only.mjs.map +1 -1
- package/dist/bin/package/compile-tsup.mjs +3 -71
- package/dist/bin/package/compile-tsup.mjs.map +1 -1
- package/dist/bin/package/compile.mjs +5 -73
- package/dist/bin/package/compile.mjs.map +1 -1
- package/dist/bin/package/recompile.mjs +5 -73
- package/dist/bin/package/recompile.mjs.map +1 -1
- package/dist/index.mjs +34 -102
- package/dist/index.mjs.map +1 -1
- package/package.json +4 -4
- package/src/actions/package/compile/packageCompileTsup.ts +2 -4
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,67 +1418,6 @@ 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
1422
|
var compileFolder = /* @__PURE__ */ __name(async (folder, entryMode = "single", options, verbose) => {
|
|
1484
1423
|
const outDir = options?.outDir ?? "dist";
|
|
@@ -1487,17 +1426,15 @@ var compileFolder = /* @__PURE__ */ __name(async (folder, entryMode = "single",
|
|
|
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) => {
|
|
@@ -1607,7 +1539,7 @@ var packageCompileTsup = /* @__PURE__ */ __name(async (config2) => {
|
|
|
1607
1539
|
// src/actions/package/compile/compile.ts
|
|
1608
1540
|
var packageCompile = /* @__PURE__ */ __name(async (inConfig = {}) => {
|
|
1609
1541
|
const pkg = process.env.INIT_CWD;
|
|
1610
|
-
console.log(
|
|
1542
|
+
console.log(chalk22.green(`Compiling ${pkg}`));
|
|
1611
1543
|
const config2 = await loadConfig(inConfig);
|
|
1612
1544
|
const publint2 = config2.publint;
|
|
1613
1545
|
const mode = config2.compile?.mode ?? "tsup";
|
|
@@ -1627,7 +1559,7 @@ var packageCompile = /* @__PURE__ */ __name(async (inConfig = {}) => {
|
|
|
1627
1559
|
|
|
1628
1560
|
// src/actions/package/copy-assets.ts
|
|
1629
1561
|
import path5 from "node:path/posix";
|
|
1630
|
-
import
|
|
1562
|
+
import chalk23 from "chalk";
|
|
1631
1563
|
import cpy2 from "cpy";
|
|
1632
1564
|
var copyTargetAssets2 = /* @__PURE__ */ __name(async (target, name, location) => {
|
|
1633
1565
|
try {
|
|
@@ -1646,7 +1578,7 @@ var copyTargetAssets2 = /* @__PURE__ */ __name(async (target, name, location) =>
|
|
|
1646
1578
|
flat: false
|
|
1647
1579
|
});
|
|
1648
1580
|
if (values.length > 0) {
|
|
1649
|
-
console.log(
|
|
1581
|
+
console.log(chalk23.green(`Copying Assets [${target.toUpperCase()}] - ${name} - ${location}`));
|
|
1650
1582
|
}
|
|
1651
1583
|
for (const value of values) {
|
|
1652
1584
|
console.log(`${value.split("/").pop()} => ./dist/${target}`);
|
|
@@ -1676,8 +1608,8 @@ var packageCopyAssets = /* @__PURE__ */ __name(async ({ target }) => {
|
|
|
1676
1608
|
|
|
1677
1609
|
// src/actions/package/deps.ts
|
|
1678
1610
|
import { existsSync as existsSync4, readFileSync as readFileSync3 } from "node:fs";
|
|
1679
|
-
import { cwd as
|
|
1680
|
-
import
|
|
1611
|
+
import { cwd as cwd2 } from "node:process";
|
|
1612
|
+
import chalk24 from "chalk";
|
|
1681
1613
|
import depcheck from "depcheck";
|
|
1682
1614
|
var special = depcheck.special;
|
|
1683
1615
|
var defaultIgnorePatterns = [
|
|
@@ -1704,21 +1636,21 @@ var defaultIgnoreDevPatterns = [
|
|
|
1704
1636
|
var reportUnused = /* @__PURE__ */ __name((name, unused) => {
|
|
1705
1637
|
if (unused.length > 0) {
|
|
1706
1638
|
const message = [
|
|
1707
|
-
|
|
1639
|
+
chalk24.yellow(`${unused.length} Unused ${name}`)
|
|
1708
1640
|
];
|
|
1709
|
-
for (const value of unused) message.push(
|
|
1641
|
+
for (const value of unused) message.push(chalk24.gray(` ${value}`));
|
|
1710
1642
|
console.log(message.join("\n"));
|
|
1711
1643
|
}
|
|
1712
1644
|
}, "reportUnused");
|
|
1713
1645
|
var reportMissing = /* @__PURE__ */ __name((name, missing) => {
|
|
1714
1646
|
if (Object.keys(missing).length > 0) {
|
|
1715
1647
|
const message = [
|
|
1716
|
-
|
|
1648
|
+
chalk24.yellow(`${Object.entries(missing).length} Missing ${name}`)
|
|
1717
1649
|
];
|
|
1718
1650
|
for (const [key, value] of Object.entries(missing)) {
|
|
1719
|
-
message.push(`${key}`,
|
|
1651
|
+
message.push(`${key}`, chalk24.gray(` ${value.at(0)}`));
|
|
1720
1652
|
}
|
|
1721
|
-
console.log(
|
|
1653
|
+
console.log(chalk24.yellow(message.join("\n")));
|
|
1722
1654
|
}
|
|
1723
1655
|
}, "reportMissing");
|
|
1724
1656
|
var analyzeDeps = /* @__PURE__ */ __name(async (pkg, ignoreMatches) => {
|
|
@@ -1773,7 +1705,7 @@ var analyzeDeps = /* @__PURE__ */ __name(async (pkg, ignoreMatches) => {
|
|
|
1773
1705
|
};
|
|
1774
1706
|
}, "analyzeDeps");
|
|
1775
1707
|
var packageDeps = /* @__PURE__ */ __name(async () => {
|
|
1776
|
-
const pkg = process.env.INIT_CWD ??
|
|
1708
|
+
const pkg = process.env.INIT_CWD ?? cwd2();
|
|
1777
1709
|
const pkgName = process.env.npm_package_name;
|
|
1778
1710
|
const packageContent = existsSync4(`${pkg}/package.json`) ? JSON.parse(readFileSync3(`${pkg}/package.json`, {
|
|
1779
1711
|
encoding: "utf8"
|
|
@@ -1823,10 +1755,10 @@ var packageDeps = /* @__PURE__ */ __name(async () => {
|
|
|
1823
1755
|
reportUnused("dependencies", unusedDeps);
|
|
1824
1756
|
reportUnused("devDependencies", unusedDevDeps);
|
|
1825
1757
|
if (Object.entries(invalidDirs).length > 0) {
|
|
1826
|
-
for (const [key, value] of Object.entries(invalidDirs)) console.warn(
|
|
1758
|
+
for (const [key, value] of Object.entries(invalidDirs)) console.warn(chalk24.gray(`Invalid Dir: ${key}: ${value}`));
|
|
1827
1759
|
}
|
|
1828
1760
|
if (Object.entries(invalidFiles).length > 0) {
|
|
1829
|
-
for (const [key, value] of Object.entries(invalidFiles)) console.warn(
|
|
1761
|
+
for (const [key, value] of Object.entries(invalidFiles)) console.warn(chalk24.gray(`Invalid File: ${key}: ${value}`));
|
|
1830
1762
|
}
|
|
1831
1763
|
reportMissing("dependencies", missingDepsObject);
|
|
1832
1764
|
reportMissing("devDependencies", missingDevDepsObject);
|
|
@@ -1837,7 +1769,7 @@ var packageDeps = /* @__PURE__ */ __name(async () => {
|
|
|
1837
1769
|
// src/actions/package/gen-docs.ts
|
|
1838
1770
|
import { existsSync as existsSync5 } from "node:fs";
|
|
1839
1771
|
import path6 from "node:path";
|
|
1840
|
-
import
|
|
1772
|
+
import chalk25 from "chalk";
|
|
1841
1773
|
import { Application, ArgumentsReader, TSConfigReader, TypeDocReader } from "typedoc";
|
|
1842
1774
|
var ExitCodes = {
|
|
1843
1775
|
CompileError: 3,
|
|
@@ -1939,7 +1871,7 @@ var runTypeDoc = /* @__PURE__ */ __name(async (app) => {
|
|
|
1939
1871
|
return ExitCodes.OutputError;
|
|
1940
1872
|
}
|
|
1941
1873
|
}
|
|
1942
|
-
console.log(
|
|
1874
|
+
console.log(chalk25.green(`${pkgName} - Ok`));
|
|
1943
1875
|
return ExitCodes.Ok;
|
|
1944
1876
|
}, "runTypeDoc");
|
|
1945
1877
|
|
|
@@ -2009,7 +1941,7 @@ var rebuild = /* @__PURE__ */ __name(({ target }) => {
|
|
|
2009
1941
|
}, "rebuild");
|
|
2010
1942
|
|
|
2011
1943
|
// src/actions/recompile.ts
|
|
2012
|
-
import
|
|
1944
|
+
import chalk26 from "chalk";
|
|
2013
1945
|
var recompile = /* @__PURE__ */ __name(async ({ verbose, target, pkg, incremental }) => {
|
|
2014
1946
|
return pkg ? await recompilePackage({
|
|
2015
1947
|
pkg,
|
|
@@ -2070,7 +2002,7 @@ var recompileAll = /* @__PURE__ */ __name(async ({ jobs, verbose, target, increm
|
|
|
2070
2002
|
`${jobs}`
|
|
2071
2003
|
] : [];
|
|
2072
2004
|
if (jobs) {
|
|
2073
|
-
console.log(
|
|
2005
|
+
console.log(chalk26.blue(`Jobs set to [${jobs}]`));
|
|
2074
2006
|
}
|
|
2075
2007
|
const result = await runStepsAsync(`Recompile${incremental ? "-Incremental" : ""} [All]`, [
|
|
2076
2008
|
[
|
|
@@ -2087,7 +2019,7 @@ var recompileAll = /* @__PURE__ */ __name(async ({ jobs, verbose, target, increm
|
|
|
2087
2019
|
]
|
|
2088
2020
|
]
|
|
2089
2021
|
]);
|
|
2090
|
-
console.log(`${
|
|
2022
|
+
console.log(`${chalk26.gray("Recompiled in")} [${chalk26.magenta(((Date.now() - start) / 1e3).toFixed(2))}] ${chalk26.gray("seconds")}`);
|
|
2091
2023
|
return result;
|
|
2092
2024
|
}, "recompileAll");
|
|
2093
2025
|
|
|
@@ -2187,7 +2119,7 @@ var sonar = /* @__PURE__ */ __name(() => {
|
|
|
2187
2119
|
}, "sonar");
|
|
2188
2120
|
|
|
2189
2121
|
// src/actions/statics.ts
|
|
2190
|
-
import
|
|
2122
|
+
import chalk27 from "chalk";
|
|
2191
2123
|
var DefaultDependencies = [
|
|
2192
2124
|
"axios",
|
|
2193
2125
|
"@xylabs/pixel",
|
|
@@ -2198,7 +2130,7 @@ var DefaultDependencies = [
|
|
|
2198
2130
|
"@mui/system"
|
|
2199
2131
|
];
|
|
2200
2132
|
var statics = /* @__PURE__ */ __name(() => {
|
|
2201
|
-
console.log(
|
|
2133
|
+
console.log(chalk27.green("Check Required Static Dependencies"));
|
|
2202
2134
|
const statics2 = parsedPackageJSON()?.xy?.deps?.statics;
|
|
2203
2135
|
return detectDuplicateDependencies(statics2, DefaultDependencies);
|
|
2204
2136
|
}, "statics");
|