@xylabs/ts-scripts-yarn3 4.0.0 → 4.0.1
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 +91 -26
- package/dist/actions/index.mjs.map +1 -1
- package/dist/actions/package/compile/compile.mjs +70 -5
- package/dist/actions/package/compile/compile.mjs.map +1 -1
- package/dist/actions/package/compile/index.mjs +70 -5
- package/dist/actions/package/compile/index.mjs.map +1 -1
- package/dist/actions/package/compile/packageCompileTsup.mjs +232 -3
- package/dist/actions/package/compile/packageCompileTsup.mjs.map +1 -1
- package/dist/actions/package/index.mjs +84 -19
- package/dist/actions/package/index.mjs.map +1 -1
- package/dist/actions/package/recompile.mjs +70 -5
- package/dist/actions/package/recompile.mjs.map +1 -1
- package/dist/bin/package/compile-only.mjs +72 -7
- package/dist/bin/package/compile-only.mjs.map +1 -1
- package/dist/bin/package/compile-tsup.mjs +232 -5
- package/dist/bin/package/compile-tsup.mjs.map +1 -1
- package/dist/bin/package/compile.mjs +72 -7
- package/dist/bin/package/compile.mjs.map +1 -1
- package/dist/bin/package/recompile.mjs +72 -7
- package/dist/bin/package/recompile.mjs.map +1 -1
- package/dist/index.mjs +101 -36
- package/dist/index.mjs.map +1 -1
- package/package.json +4 -4
- package/src/actions/package/compile/packageCompileTsup.ts +4 -5
package/dist/actions/index.mjs
CHANGED
|
@@ -446,7 +446,7 @@ var mergeEntries = /* @__PURE__ */ __name((a, b) => [
|
|
|
446
446
|
].sort(), "mergeEntries");
|
|
447
447
|
var generateIgnoreFiles = /* @__PURE__ */ __name((filename3, pkg) => {
|
|
448
448
|
console.log(chalk4.green(`Generate ${filename3} Files`));
|
|
449
|
-
const
|
|
449
|
+
const cwd5 = INIT_CWD() ?? ".";
|
|
450
450
|
const workspaces = pkg ? [
|
|
451
451
|
yarnWorkspace(pkg)
|
|
452
452
|
] : yarnWorkspaces();
|
|
@@ -454,7 +454,7 @@ var generateIgnoreFiles = /* @__PURE__ */ __name((filename3, pkg) => {
|
|
|
454
454
|
const writeEntries = /* @__PURE__ */ __name((location, entries) => writeLines(`${location}/${filename3}`, entries), "writeEntries");
|
|
455
455
|
const results = workspaces.map(({ location, name }) => {
|
|
456
456
|
try {
|
|
457
|
-
writeEntries(location, mergeEntries(readEntries(
|
|
457
|
+
writeEntries(location, mergeEntries(readEntries(cwd5), readEntries(location)));
|
|
458
458
|
return 0;
|
|
459
459
|
} catch (ex) {
|
|
460
460
|
const error = ex;
|
|
@@ -1411,7 +1411,7 @@ var packageClean = /* @__PURE__ */ __name(async () => {
|
|
|
1411
1411
|
}, "packageClean");
|
|
1412
1412
|
|
|
1413
1413
|
// src/actions/package/compile/compile.ts
|
|
1414
|
-
import
|
|
1414
|
+
import chalk23 from "chalk";
|
|
1415
1415
|
|
|
1416
1416
|
// src/actions/package/publint.ts
|
|
1417
1417
|
import { promises as fs2 } from "node:fs";
|
|
@@ -1576,8 +1576,69 @@ var buildEntries = /* @__PURE__ */ __name((folder, entryMode, verbose = false) =
|
|
|
1576
1576
|
}
|
|
1577
1577
|
}, "buildEntries");
|
|
1578
1578
|
|
|
1579
|
+
// src/actions/package/compile/packageCompileTscTypes.ts
|
|
1580
|
+
import { cwd as cwd3 } from "node:process";
|
|
1581
|
+
import chalk22 from "chalk";
|
|
1582
|
+
import { createProgramFromConfig as createProgramFromConfig2 } from "tsc-prog";
|
|
1583
|
+
import { DiagnosticCategory as DiagnosticCategory2 } from "typescript";
|
|
1584
|
+
var packageCompileTscTypes = /* @__PURE__ */ __name((folder = "src", { verbose } = {}, compilerOptionsParam) => {
|
|
1585
|
+
const pkg = process.env.INIT_CWD ?? cwd3();
|
|
1586
|
+
if (verbose) {
|
|
1587
|
+
console.log(`Compiling types with TSC [${pkg}]`);
|
|
1588
|
+
}
|
|
1589
|
+
const compilerOptions = {
|
|
1590
|
+
...getCompilerOptions({
|
|
1591
|
+
declaration: true,
|
|
1592
|
+
emitDeclarationOnly: true,
|
|
1593
|
+
outDir: "dist",
|
|
1594
|
+
removeComments: true,
|
|
1595
|
+
skipDefaultLibCheck: true,
|
|
1596
|
+
skipLibCheck: true,
|
|
1597
|
+
sourceMap: true
|
|
1598
|
+
}),
|
|
1599
|
+
...compilerOptionsParam
|
|
1600
|
+
};
|
|
1601
|
+
const files = buildEntries(folder, "all");
|
|
1602
|
+
const result = createProgramFromConfig2({
|
|
1603
|
+
basePath: pkg ?? cwd3(),
|
|
1604
|
+
compilerOptions,
|
|
1605
|
+
exclude: [
|
|
1606
|
+
"dist",
|
|
1607
|
+
"docs",
|
|
1608
|
+
"**/*.spec.*",
|
|
1609
|
+
"**/*.stories.*",
|
|
1610
|
+
"src/**/spec/**/*"
|
|
1611
|
+
],
|
|
1612
|
+
files
|
|
1613
|
+
}).emit();
|
|
1614
|
+
const diagResults = result.diagnostics.length;
|
|
1615
|
+
for (const diag of result.diagnostics) {
|
|
1616
|
+
switch (diag.category) {
|
|
1617
|
+
case DiagnosticCategory2.Error: {
|
|
1618
|
+
console.error(chalk22.red(diag.messageText));
|
|
1619
|
+
console.error(chalk22.grey(pkg));
|
|
1620
|
+
console.error(chalk22.blue(diag.file?.fileName));
|
|
1621
|
+
break;
|
|
1622
|
+
}
|
|
1623
|
+
case DiagnosticCategory2.Warning: {
|
|
1624
|
+
console.error(chalk22.yellow(diag.messageText));
|
|
1625
|
+
console.error(chalk22.grey(pkg));
|
|
1626
|
+
console.error(chalk22.blue(diag.file?.fileName));
|
|
1627
|
+
break;
|
|
1628
|
+
}
|
|
1629
|
+
case DiagnosticCategory2.Suggestion: {
|
|
1630
|
+
console.error(chalk22.white(diag.messageText));
|
|
1631
|
+
console.error(chalk22.grey(pkg));
|
|
1632
|
+
console.error(chalk22.blue(diag.file?.fileName));
|
|
1633
|
+
break;
|
|
1634
|
+
}
|
|
1635
|
+
}
|
|
1636
|
+
}
|
|
1637
|
+
return diagResults;
|
|
1638
|
+
}, "packageCompileTscTypes");
|
|
1639
|
+
|
|
1579
1640
|
// src/actions/package/compile/packageCompileTsup.ts
|
|
1580
|
-
var compileFolder = /* @__PURE__ */ __name(async (folder, entryMode = "single", options,
|
|
1641
|
+
var compileFolder = /* @__PURE__ */ __name(async (folder, entryMode = "single", options, verbose) => {
|
|
1581
1642
|
const outDir = options?.outDir ?? "dist";
|
|
1582
1643
|
const entry = buildEntries(folder, entryMode);
|
|
1583
1644
|
const optionsResult = defineConfig({
|
|
@@ -1591,7 +1652,7 @@ var compileFolder = /* @__PURE__ */ __name(async (folder, entryMode = "single",
|
|
|
1591
1652
|
],
|
|
1592
1653
|
outDir,
|
|
1593
1654
|
silent: true,
|
|
1594
|
-
sourcemap:
|
|
1655
|
+
sourcemap: false,
|
|
1595
1656
|
splitting: false,
|
|
1596
1657
|
tsconfig: "tsconfig.json",
|
|
1597
1658
|
...options
|
|
@@ -1607,7 +1668,11 @@ var compileFolder = /* @__PURE__ */ __name(async (folder, entryMode = "single",
|
|
|
1607
1668
|
];
|
|
1608
1669
|
}))).flat();
|
|
1609
1670
|
await Promise.all(optionsList.map((options2) => build2(options2)));
|
|
1610
|
-
return
|
|
1671
|
+
return packageCompileTscTypes(folder, {
|
|
1672
|
+
verbose
|
|
1673
|
+
}, {
|
|
1674
|
+
outDir
|
|
1675
|
+
});
|
|
1611
1676
|
}, "compileFolder");
|
|
1612
1677
|
var packageCompileTsup = /* @__PURE__ */ __name(async (config2) => {
|
|
1613
1678
|
const compile2 = config2?.compile;
|
|
@@ -1694,7 +1759,7 @@ var packageCompileTsup = /* @__PURE__ */ __name(async (config2) => {
|
|
|
1694
1759
|
// src/actions/package/compile/compile.ts
|
|
1695
1760
|
var packageCompile = /* @__PURE__ */ __name(async (inConfig = {}) => {
|
|
1696
1761
|
const pkg = process.env.INIT_CWD;
|
|
1697
|
-
console.log(
|
|
1762
|
+
console.log(chalk23.green(`Compiling ${pkg}`));
|
|
1698
1763
|
const config2 = await loadConfig(inConfig);
|
|
1699
1764
|
const publint2 = config2.publint;
|
|
1700
1765
|
const mode = config2.compile?.mode ?? "tsup";
|
|
@@ -1714,7 +1779,7 @@ var packageCompile = /* @__PURE__ */ __name(async (inConfig = {}) => {
|
|
|
1714
1779
|
|
|
1715
1780
|
// src/actions/package/copy-assets.ts
|
|
1716
1781
|
import path5 from "node:path/posix";
|
|
1717
|
-
import
|
|
1782
|
+
import chalk24 from "chalk";
|
|
1718
1783
|
import cpy2 from "cpy";
|
|
1719
1784
|
var copyTargetAssets2 = /* @__PURE__ */ __name(async (target, name, location) => {
|
|
1720
1785
|
try {
|
|
@@ -1733,7 +1798,7 @@ var copyTargetAssets2 = /* @__PURE__ */ __name(async (target, name, location) =>
|
|
|
1733
1798
|
flat: false
|
|
1734
1799
|
});
|
|
1735
1800
|
if (values.length > 0) {
|
|
1736
|
-
console.log(
|
|
1801
|
+
console.log(chalk24.green(`Copying Assets [${target.toUpperCase()}] - ${name} - ${location}`));
|
|
1737
1802
|
}
|
|
1738
1803
|
for (const value of values) {
|
|
1739
1804
|
console.log(`${value.split("/").pop()} => ./dist/${target}`);
|
|
@@ -1763,8 +1828,8 @@ var packageCopyAssets = /* @__PURE__ */ __name(async ({ target }) => {
|
|
|
1763
1828
|
|
|
1764
1829
|
// src/actions/package/deps.ts
|
|
1765
1830
|
import { existsSync as existsSync4, readFileSync as readFileSync3 } from "node:fs";
|
|
1766
|
-
import { cwd as
|
|
1767
|
-
import
|
|
1831
|
+
import { cwd as cwd4 } from "node:process";
|
|
1832
|
+
import chalk25 from "chalk";
|
|
1768
1833
|
import depcheck from "depcheck";
|
|
1769
1834
|
var special = depcheck.special;
|
|
1770
1835
|
var defaultIgnorePatterns = [
|
|
@@ -1791,21 +1856,21 @@ var defaultIgnoreDevPatterns = [
|
|
|
1791
1856
|
var reportUnused = /* @__PURE__ */ __name((name, unused) => {
|
|
1792
1857
|
if (unused.length > 0) {
|
|
1793
1858
|
const message = [
|
|
1794
|
-
|
|
1859
|
+
chalk25.yellow(`${unused.length} Unused ${name}`)
|
|
1795
1860
|
];
|
|
1796
|
-
for (const value of unused) message.push(
|
|
1861
|
+
for (const value of unused) message.push(chalk25.gray(` ${value}`));
|
|
1797
1862
|
console.log(message.join("\n"));
|
|
1798
1863
|
}
|
|
1799
1864
|
}, "reportUnused");
|
|
1800
1865
|
var reportMissing = /* @__PURE__ */ __name((name, missing) => {
|
|
1801
1866
|
if (Object.keys(missing).length > 0) {
|
|
1802
1867
|
const message = [
|
|
1803
|
-
|
|
1868
|
+
chalk25.yellow(`${Object.entries(missing).length} Missing ${name}`)
|
|
1804
1869
|
];
|
|
1805
1870
|
for (const [key, value] of Object.entries(missing)) {
|
|
1806
|
-
message.push(`${key}`,
|
|
1871
|
+
message.push(`${key}`, chalk25.gray(` ${value.at(0)}`));
|
|
1807
1872
|
}
|
|
1808
|
-
console.log(
|
|
1873
|
+
console.log(chalk25.yellow(message.join("\n")));
|
|
1809
1874
|
}
|
|
1810
1875
|
}, "reportMissing");
|
|
1811
1876
|
var analyzeDeps = /* @__PURE__ */ __name(async (pkg, ignoreMatches) => {
|
|
@@ -1860,7 +1925,7 @@ var analyzeDeps = /* @__PURE__ */ __name(async (pkg, ignoreMatches) => {
|
|
|
1860
1925
|
};
|
|
1861
1926
|
}, "analyzeDeps");
|
|
1862
1927
|
var packageDeps = /* @__PURE__ */ __name(async () => {
|
|
1863
|
-
const pkg = process.env.INIT_CWD ??
|
|
1928
|
+
const pkg = process.env.INIT_CWD ?? cwd4();
|
|
1864
1929
|
const pkgName = process.env.npm_package_name;
|
|
1865
1930
|
const packageContent = existsSync4(`${pkg}/package.json`) ? JSON.parse(readFileSync3(`${pkg}/package.json`, {
|
|
1866
1931
|
encoding: "utf8"
|
|
@@ -1910,10 +1975,10 @@ var packageDeps = /* @__PURE__ */ __name(async () => {
|
|
|
1910
1975
|
reportUnused("dependencies", unusedDeps);
|
|
1911
1976
|
reportUnused("devDependencies", unusedDevDeps);
|
|
1912
1977
|
if (Object.entries(invalidDirs).length > 0) {
|
|
1913
|
-
for (const [key, value] of Object.entries(invalidDirs)) console.warn(
|
|
1978
|
+
for (const [key, value] of Object.entries(invalidDirs)) console.warn(chalk25.gray(`Invalid Dir: ${key}: ${value}`));
|
|
1914
1979
|
}
|
|
1915
1980
|
if (Object.entries(invalidFiles).length > 0) {
|
|
1916
|
-
for (const [key, value] of Object.entries(invalidFiles)) console.warn(
|
|
1981
|
+
for (const [key, value] of Object.entries(invalidFiles)) console.warn(chalk25.gray(`Invalid File: ${key}: ${value}`));
|
|
1917
1982
|
}
|
|
1918
1983
|
reportMissing("dependencies", missingDepsObject);
|
|
1919
1984
|
reportMissing("devDependencies", missingDevDepsObject);
|
|
@@ -1924,7 +1989,7 @@ var packageDeps = /* @__PURE__ */ __name(async () => {
|
|
|
1924
1989
|
// src/actions/package/gen-docs.ts
|
|
1925
1990
|
import { existsSync as existsSync5 } from "node:fs";
|
|
1926
1991
|
import path6 from "node:path";
|
|
1927
|
-
import
|
|
1992
|
+
import chalk26 from "chalk";
|
|
1928
1993
|
import { Application, ArgumentsReader, TSConfigReader, TypeDocReader } from "typedoc";
|
|
1929
1994
|
var ExitCodes = {
|
|
1930
1995
|
CompileError: 3,
|
|
@@ -2026,7 +2091,7 @@ var runTypeDoc = /* @__PURE__ */ __name(async (app) => {
|
|
|
2026
2091
|
return ExitCodes.OutputError;
|
|
2027
2092
|
}
|
|
2028
2093
|
}
|
|
2029
|
-
console.log(
|
|
2094
|
+
console.log(chalk26.green(`${pkgName} - Ok`));
|
|
2030
2095
|
return ExitCodes.Ok;
|
|
2031
2096
|
}, "runTypeDoc");
|
|
2032
2097
|
|
|
@@ -2093,7 +2158,7 @@ var rebuild = /* @__PURE__ */ __name(({ target }) => {
|
|
|
2093
2158
|
}, "rebuild");
|
|
2094
2159
|
|
|
2095
2160
|
// src/actions/recompile.ts
|
|
2096
|
-
import
|
|
2161
|
+
import chalk27 from "chalk";
|
|
2097
2162
|
var recompile = /* @__PURE__ */ __name(async ({ verbose, target, pkg, incremental }) => {
|
|
2098
2163
|
return pkg ? await recompilePackage({
|
|
2099
2164
|
pkg,
|
|
@@ -2154,7 +2219,7 @@ var recompileAll = /* @__PURE__ */ __name(async ({ jobs, verbose, target, increm
|
|
|
2154
2219
|
`${jobs}`
|
|
2155
2220
|
] : [];
|
|
2156
2221
|
if (jobs) {
|
|
2157
|
-
console.log(
|
|
2222
|
+
console.log(chalk27.blue(`Jobs set to [${jobs}]`));
|
|
2158
2223
|
}
|
|
2159
2224
|
const result = await runStepsAsync(`Recompile${incremental ? "-Incremental" : ""} [All]`, [
|
|
2160
2225
|
[
|
|
@@ -2184,7 +2249,7 @@ var recompileAll = /* @__PURE__ */ __name(async ({ jobs, verbose, target, increm
|
|
|
2184
2249
|
]
|
|
2185
2250
|
]
|
|
2186
2251
|
]);
|
|
2187
|
-
console.log(`${
|
|
2252
|
+
console.log(`${chalk27.gray("Recompiled in")} [${chalk27.magenta(((Date.now() - start) / 1e3).toFixed(2))}] ${chalk27.gray("seconds")}`);
|
|
2188
2253
|
return result;
|
|
2189
2254
|
}, "recompileAll");
|
|
2190
2255
|
|
|
@@ -2284,7 +2349,7 @@ var sonar = /* @__PURE__ */ __name(() => {
|
|
|
2284
2349
|
}, "sonar");
|
|
2285
2350
|
|
|
2286
2351
|
// src/actions/statics.ts
|
|
2287
|
-
import
|
|
2352
|
+
import chalk28 from "chalk";
|
|
2288
2353
|
var DefaultDependencies = [
|
|
2289
2354
|
"axios",
|
|
2290
2355
|
"@xylabs/pixel",
|
|
@@ -2295,7 +2360,7 @@ var DefaultDependencies = [
|
|
|
2295
2360
|
"@mui/system"
|
|
2296
2361
|
];
|
|
2297
2362
|
var statics = /* @__PURE__ */ __name(() => {
|
|
2298
|
-
console.log(
|
|
2363
|
+
console.log(chalk28.green("Check Required Static Dependencies"));
|
|
2299
2364
|
const statics2 = parsedPackageJSON()?.xy?.deps?.statics;
|
|
2300
2365
|
return detectDuplicateDependencies(statics2, DefaultDependencies);
|
|
2301
2366
|
}, "statics");
|