@xylabs/ts-scripts-yarn3 4.0.0 → 4.0.2
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/build.mjs +3 -1
- package/dist/actions/build.mjs.map +1 -1
- package/dist/actions/compile.mjs +9 -7
- package/dist/actions/compile.mjs.map +1 -1
- package/dist/actions/index.mjs +112 -39
- package/dist/actions/index.mjs.map +1 -1
- package/dist/actions/package/compile/compile.mjs +79 -10
- package/dist/actions/package/compile/compile.mjs.map +1 -1
- package/dist/actions/package/compile/index.mjs +79 -10
- package/dist/actions/package/compile/index.mjs.map +1 -1
- package/dist/actions/package/compile/packageCompileTsup.mjs +239 -6
- package/dist/actions/package/compile/packageCompileTsup.mjs.map +1 -1
- package/dist/actions/package/index.mjs +93 -24
- package/dist/actions/package/index.mjs.map +1 -1
- package/dist/actions/package/recompile.mjs +79 -10
- package/dist/actions/package/recompile.mjs.map +1 -1
- package/dist/bin/package/build.mjs +551 -0
- package/dist/bin/package/build.mjs.map +1 -0
- package/dist/bin/package/compile-only.mjs +81 -12
- package/dist/bin/package/compile-only.mjs.map +1 -1
- package/dist/bin/package/compile-tsup.mjs +239 -8
- package/dist/bin/package/compile-tsup.mjs.map +1 -1
- package/dist/bin/package/compile.mjs +81 -12
- package/dist/bin/package/compile.mjs.map +1 -1
- package/dist/bin/package/recompile.mjs +81 -12
- package/dist/bin/package/recompile.mjs.map +1 -1
- package/dist/bin/xy-ts.mjs +26 -12
- package/dist/bin/xy-ts.mjs.map +1 -1
- package/dist/bin/xy.mjs +26 -12
- package/dist/bin/xy.mjs.map +1 -1
- package/dist/index.d.ts +7 -5
- package/dist/index.mjs +136 -53
- package/dist/index.mjs.map +1 -1
- package/dist/xy/index.mjs +26 -12
- package/dist/xy/index.mjs.map +1 -1
- package/dist/xy/xy.mjs +26 -12
- package/dist/xy/xy.mjs.map +1 -1
- package/dist/xy/xyBuildCommands.mjs +17 -12
- package/dist/xy/xyBuildCommands.mjs.map +1 -1
- package/dist/xy/xyParseOptions.mjs +9 -0
- package/dist/xy/xyParseOptions.mjs.map +1 -1
- package/package.json +5 -4
- package/src/actions/build.ts +1 -1
- package/src/actions/compile.ts +22 -7
- package/src/actions/package/compile/compile.ts +2 -2
- package/src/actions/package/compile/packageCompileTsup.ts +18 -5
- package/src/bin/package/build.ts +16 -0
- package/src/xy/xyBuildCommands.ts +5 -4
- package/src/xy/xyParseOptions.ts +7 -0
package/dist/index.d.ts
CHANGED
|
@@ -34,17 +34,19 @@ interface CompileParams {
|
|
|
34
34
|
pkg?: string;
|
|
35
35
|
publint?: boolean;
|
|
36
36
|
target?: 'esm' | 'cjs';
|
|
37
|
+
types?: 'tsc' | 'tsup';
|
|
37
38
|
verbose?: boolean;
|
|
38
39
|
}
|
|
39
40
|
interface CompilePackageParams {
|
|
40
41
|
pkg: string;
|
|
41
42
|
publint?: boolean;
|
|
42
43
|
target?: 'esm' | 'cjs';
|
|
44
|
+
types?: 'tsc' | 'tsup';
|
|
43
45
|
verbose?: boolean;
|
|
44
46
|
}
|
|
45
|
-
declare const compile: ({ verbose, target, pkg, incremental, publint, jobs, }: CompileParams) => number;
|
|
46
|
-
declare const compilePackage: ({ target, pkg }: CompilePackageParams) => number;
|
|
47
|
-
declare const compileAll: ({ jobs, verbose, target, incremental, }: CompileParams) => number;
|
|
47
|
+
declare const compile: ({ verbose, target, pkg, incremental, publint, jobs, types, }: CompileParams) => number;
|
|
48
|
+
declare const compilePackage: ({ target, pkg, types, }: CompilePackageParams) => number;
|
|
49
|
+
declare const compileAll: ({ jobs, verbose, target, incremental, types, }: CompileParams) => number;
|
|
48
50
|
|
|
49
51
|
interface CopyAssetsParams {
|
|
50
52
|
pkg?: string;
|
|
@@ -167,11 +169,11 @@ interface XyTscConfig extends XyConfigBase {
|
|
|
167
169
|
}
|
|
168
170
|
type XyConfig = XyTsupConfig | XyTscConfig;
|
|
169
171
|
|
|
170
|
-
declare const packageCompile: (inConfig?: XyConfig) => Promise<number>;
|
|
172
|
+
declare const packageCompile: (inConfig?: XyConfig, types?: "tsc" | "tsup") => Promise<number>;
|
|
171
173
|
|
|
172
174
|
declare const packageCompileTsc: (noEmit?: boolean, config?: XyTscConfig, compilerOptionsParam?: CompilerOptions) => Promise<number>;
|
|
173
175
|
|
|
174
|
-
declare const packageCompileTsup: (config?: XyTsupConfig) => Promise<number>;
|
|
176
|
+
declare const packageCompileTsup: (config?: XyTsupConfig, types?: "tsc" | "tsup") => Promise<number>;
|
|
175
177
|
|
|
176
178
|
interface PackageCopyAssetsParams {
|
|
177
179
|
target?: 'esm' | 'cjs';
|
package/dist/index.mjs
CHANGED
|
@@ -516,7 +516,7 @@ var mergeEntries = /* @__PURE__ */ __name((a, b) => [
|
|
|
516
516
|
].sort(), "mergeEntries");
|
|
517
517
|
var generateIgnoreFiles = /* @__PURE__ */ __name((filename3, pkg) => {
|
|
518
518
|
console.log(chalk4.green(`Generate ${filename3} Files`));
|
|
519
|
-
const
|
|
519
|
+
const cwd5 = INIT_CWD() ?? ".";
|
|
520
520
|
const workspaces = pkg ? [
|
|
521
521
|
yarnWorkspace(pkg)
|
|
522
522
|
] : yarnWorkspaces();
|
|
@@ -524,7 +524,7 @@ var generateIgnoreFiles = /* @__PURE__ */ __name((filename3, pkg) => {
|
|
|
524
524
|
const writeEntries = /* @__PURE__ */ __name((location, entries) => writeLines(`${location}/${filename3}`, entries), "writeEntries");
|
|
525
525
|
const results = workspaces.map(({ location, name }) => {
|
|
526
526
|
try {
|
|
527
|
-
writeEntries(location, mergeEntries(readEntries(
|
|
527
|
+
writeEntries(location, mergeEntries(readEntries(cwd5), readEntries(location)));
|
|
528
528
|
return 0;
|
|
529
529
|
} catch (ex) {
|
|
530
530
|
const error = ex;
|
|
@@ -700,7 +700,9 @@ var build = /* @__PURE__ */ __name(async ({ incremental, jobs, target, verbose,
|
|
|
700
700
|
...targetOptions,
|
|
701
701
|
...verboseOptions,
|
|
702
702
|
...jobsOptions,
|
|
703
|
-
...incrementalOptions
|
|
703
|
+
...incrementalOptions,
|
|
704
|
+
"--types",
|
|
705
|
+
"tsc"
|
|
704
706
|
]
|
|
705
707
|
],
|
|
706
708
|
[
|
|
@@ -784,21 +786,23 @@ var cleanDocs = /* @__PURE__ */ __name(() => {
|
|
|
784
786
|
|
|
785
787
|
// src/actions/compile.ts
|
|
786
788
|
import chalk11 from "chalk";
|
|
787
|
-
var compile = /* @__PURE__ */ __name(({ verbose, target, pkg, incremental, publint: publint2, jobs }) => {
|
|
789
|
+
var compile = /* @__PURE__ */ __name(({ verbose, target, pkg, incremental, publint: publint2, jobs, types }) => {
|
|
788
790
|
return pkg ? compilePackage({
|
|
789
791
|
pkg,
|
|
790
792
|
publint: publint2,
|
|
791
793
|
target,
|
|
792
|
-
verbose
|
|
794
|
+
verbose,
|
|
795
|
+
types
|
|
793
796
|
}) : compileAll({
|
|
794
797
|
incremental,
|
|
795
798
|
publint: publint2,
|
|
796
799
|
target,
|
|
797
800
|
verbose,
|
|
798
|
-
jobs
|
|
801
|
+
jobs,
|
|
802
|
+
types
|
|
799
803
|
});
|
|
800
804
|
}, "compile");
|
|
801
|
-
var compilePackage = /* @__PURE__ */ __name(({ target, pkg }) => {
|
|
805
|
+
var compilePackage = /* @__PURE__ */ __name(({ target, pkg, types }) => {
|
|
802
806
|
const targetOptions = target ? [
|
|
803
807
|
"-t",
|
|
804
808
|
target
|
|
@@ -810,13 +814,13 @@ var compilePackage = /* @__PURE__ */ __name(({ target, pkg }) => {
|
|
|
810
814
|
"workspace",
|
|
811
815
|
pkg,
|
|
812
816
|
"run",
|
|
813
|
-
"package-compile",
|
|
817
|
+
types === "tsup" ? "package-compile" : "package-build",
|
|
814
818
|
...targetOptions
|
|
815
819
|
]
|
|
816
820
|
]
|
|
817
821
|
]);
|
|
818
822
|
}, "compilePackage");
|
|
819
|
-
var compileAll = /* @__PURE__ */ __name(({ jobs, verbose, target, incremental }) => {
|
|
823
|
+
var compileAll = /* @__PURE__ */ __name(({ jobs, verbose, target, incremental, types }) => {
|
|
820
824
|
const start = Date.now();
|
|
821
825
|
const verboseOptions = verbose ? [
|
|
822
826
|
"--verbose"
|
|
@@ -853,7 +857,7 @@ var compileAll = /* @__PURE__ */ __name(({ jobs, verbose, target, incremental })
|
|
|
853
857
|
...jobsOptions,
|
|
854
858
|
...verboseOptions,
|
|
855
859
|
"run",
|
|
856
|
-
"package-compile",
|
|
860
|
+
types === "tsup" ? "package-compile" : "package-build",
|
|
857
861
|
...targetOptions
|
|
858
862
|
]
|
|
859
863
|
]
|
|
@@ -1505,7 +1509,7 @@ var packageClean = /* @__PURE__ */ __name(async () => {
|
|
|
1505
1509
|
}, "packageClean");
|
|
1506
1510
|
|
|
1507
1511
|
// src/actions/package/compile/compile.ts
|
|
1508
|
-
import
|
|
1512
|
+
import chalk24 from "chalk";
|
|
1509
1513
|
|
|
1510
1514
|
// src/actions/package/publint.ts
|
|
1511
1515
|
import { promises as fs2 } from "node:fs";
|
|
@@ -1670,8 +1674,69 @@ var buildEntries = /* @__PURE__ */ __name((folder, entryMode, verbose = false) =
|
|
|
1670
1674
|
}
|
|
1671
1675
|
}, "buildEntries");
|
|
1672
1676
|
|
|
1677
|
+
// src/actions/package/compile/packageCompileTscTypes.ts
|
|
1678
|
+
import { cwd as cwd3 } from "node:process";
|
|
1679
|
+
import chalk23 from "chalk";
|
|
1680
|
+
import { createProgramFromConfig as createProgramFromConfig2 } from "tsc-prog";
|
|
1681
|
+
import { DiagnosticCategory as DiagnosticCategory2 } from "typescript";
|
|
1682
|
+
var packageCompileTscTypes = /* @__PURE__ */ __name((folder = "src", { verbose } = {}, compilerOptionsParam) => {
|
|
1683
|
+
const pkg = process.env.INIT_CWD ?? cwd3();
|
|
1684
|
+
if (verbose) {
|
|
1685
|
+
console.log(`Compiling types with TSC [${pkg}]`);
|
|
1686
|
+
}
|
|
1687
|
+
const compilerOptions = {
|
|
1688
|
+
...getCompilerOptions({
|
|
1689
|
+
declaration: true,
|
|
1690
|
+
emitDeclarationOnly: true,
|
|
1691
|
+
outDir: "dist",
|
|
1692
|
+
removeComments: true,
|
|
1693
|
+
skipDefaultLibCheck: true,
|
|
1694
|
+
skipLibCheck: true,
|
|
1695
|
+
sourceMap: true
|
|
1696
|
+
}),
|
|
1697
|
+
...compilerOptionsParam
|
|
1698
|
+
};
|
|
1699
|
+
const files = buildEntries(folder, "all");
|
|
1700
|
+
const result = createProgramFromConfig2({
|
|
1701
|
+
basePath: pkg ?? cwd3(),
|
|
1702
|
+
compilerOptions,
|
|
1703
|
+
exclude: [
|
|
1704
|
+
"dist",
|
|
1705
|
+
"docs",
|
|
1706
|
+
"**/*.spec.*",
|
|
1707
|
+
"**/*.stories.*",
|
|
1708
|
+
"src/**/spec/**/*"
|
|
1709
|
+
],
|
|
1710
|
+
files
|
|
1711
|
+
}).emit();
|
|
1712
|
+
const diagResults = result.diagnostics.length;
|
|
1713
|
+
for (const diag of result.diagnostics) {
|
|
1714
|
+
switch (diag.category) {
|
|
1715
|
+
case DiagnosticCategory2.Error: {
|
|
1716
|
+
console.error(chalk23.red(diag.messageText));
|
|
1717
|
+
console.error(chalk23.grey(pkg));
|
|
1718
|
+
console.error(chalk23.blue(diag.file?.fileName));
|
|
1719
|
+
break;
|
|
1720
|
+
}
|
|
1721
|
+
case DiagnosticCategory2.Warning: {
|
|
1722
|
+
console.error(chalk23.yellow(diag.messageText));
|
|
1723
|
+
console.error(chalk23.grey(pkg));
|
|
1724
|
+
console.error(chalk23.blue(diag.file?.fileName));
|
|
1725
|
+
break;
|
|
1726
|
+
}
|
|
1727
|
+
case DiagnosticCategory2.Suggestion: {
|
|
1728
|
+
console.error(chalk23.white(diag.messageText));
|
|
1729
|
+
console.error(chalk23.grey(pkg));
|
|
1730
|
+
console.error(chalk23.blue(diag.file?.fileName));
|
|
1731
|
+
break;
|
|
1732
|
+
}
|
|
1733
|
+
}
|
|
1734
|
+
}
|
|
1735
|
+
return diagResults;
|
|
1736
|
+
}, "packageCompileTscTypes");
|
|
1737
|
+
|
|
1673
1738
|
// src/actions/package/compile/packageCompileTsup.ts
|
|
1674
|
-
var compileFolder = /* @__PURE__ */ __name(async (folder, entryMode = "single", options,
|
|
1739
|
+
var compileFolder = /* @__PURE__ */ __name(async (folder, entryMode = "single", options, types = "tsup", verbose) => {
|
|
1675
1740
|
const outDir = options?.outDir ?? "dist";
|
|
1676
1741
|
const entry = buildEntries(folder, entryMode);
|
|
1677
1742
|
const optionsResult = defineConfig({
|
|
@@ -1685,7 +1750,7 @@ var compileFolder = /* @__PURE__ */ __name(async (folder, entryMode = "single",
|
|
|
1685
1750
|
],
|
|
1686
1751
|
outDir,
|
|
1687
1752
|
silent: true,
|
|
1688
|
-
sourcemap:
|
|
1753
|
+
sourcemap: types === "tsup",
|
|
1689
1754
|
splitting: false,
|
|
1690
1755
|
tsconfig: "tsconfig.json",
|
|
1691
1756
|
...options
|
|
@@ -1701,9 +1766,17 @@ var compileFolder = /* @__PURE__ */ __name(async (folder, entryMode = "single",
|
|
|
1701
1766
|
];
|
|
1702
1767
|
}))).flat();
|
|
1703
1768
|
await Promise.all(optionsList.map((options2) => build2(options2)));
|
|
1769
|
+
if (types === "tsc") {
|
|
1770
|
+
return packageCompileTscTypes(folder, {
|
|
1771
|
+
verbose
|
|
1772
|
+
}, {
|
|
1773
|
+
outDir
|
|
1774
|
+
});
|
|
1775
|
+
}
|
|
1704
1776
|
return 0;
|
|
1705
1777
|
}, "compileFolder");
|
|
1706
|
-
var packageCompileTsup = /* @__PURE__ */ __name(async (config2) => {
|
|
1778
|
+
var packageCompileTsup = /* @__PURE__ */ __name(async (config2, types = "tsup") => {
|
|
1779
|
+
console.warn("packageCompileTsup-types", types);
|
|
1707
1780
|
const compile2 = config2?.compile;
|
|
1708
1781
|
const publint2 = config2?.publint ?? true;
|
|
1709
1782
|
const verbose = config2?.verbose ?? false;
|
|
@@ -1755,7 +1828,7 @@ var packageCompileTsup = /* @__PURE__ */ __name(async (config2) => {
|
|
|
1755
1828
|
platform: "node",
|
|
1756
1829
|
...compile2?.tsup?.options,
|
|
1757
1830
|
...typeof options === "object" ? options : {}
|
|
1758
|
-
}, verbose) : 0;
|
|
1831
|
+
}, types, verbose) : 0;
|
|
1759
1832
|
}))).reduce((prev, value) => prev + value, 0) || (await Promise.all(Object.entries(compileForBrowser).map(async ([folder, options]) => {
|
|
1760
1833
|
const inEsBuildOptions = typeof compile2?.browser?.esbuildOptions === "object" ? compile2?.browser?.esbuildOptions : {};
|
|
1761
1834
|
return folder ? await compileFolder(folder, compile2?.entryMode, {
|
|
@@ -1768,7 +1841,7 @@ var packageCompileTsup = /* @__PURE__ */ __name(async (config2) => {
|
|
|
1768
1841
|
platform: "browser",
|
|
1769
1842
|
...compile2?.tsup?.options,
|
|
1770
1843
|
...typeof options === "object" ? options : {}
|
|
1771
|
-
}, verbose) : 0;
|
|
1844
|
+
}, types, verbose) : 0;
|
|
1772
1845
|
}))).reduce((prev, value) => prev + value, 0) || (await Promise.all(Object.entries(compileForNeutral).map(async ([folder, options]) => {
|
|
1773
1846
|
const inEsBuildOptions = typeof compile2?.neutral?.esbuildOptions === "object" ? compile2?.neutral?.esbuildOptions : {};
|
|
1774
1847
|
return folder ? await compileFolder(folder, compile2?.entryMode, {
|
|
@@ -1781,14 +1854,14 @@ var packageCompileTsup = /* @__PURE__ */ __name(async (config2) => {
|
|
|
1781
1854
|
platform: "neutral",
|
|
1782
1855
|
...compile2?.tsup?.options,
|
|
1783
1856
|
...typeof options === "object" ? options : {}
|
|
1784
|
-
}, verbose) : 0;
|
|
1857
|
+
}, types, verbose) : 0;
|
|
1785
1858
|
}))).reduce((prev, value) => prev + value, 0) || (publint2 ? await packagePublint() : 0);
|
|
1786
1859
|
}, "packageCompileTsup");
|
|
1787
1860
|
|
|
1788
1861
|
// src/actions/package/compile/compile.ts
|
|
1789
|
-
var packageCompile = /* @__PURE__ */ __name(async (inConfig = {}) => {
|
|
1862
|
+
var packageCompile = /* @__PURE__ */ __name(async (inConfig = {}, types) => {
|
|
1790
1863
|
const pkg = process.env.INIT_CWD;
|
|
1791
|
-
console.log(
|
|
1864
|
+
console.log(chalk24.green(`Compiling ${pkg}`));
|
|
1792
1865
|
const config2 = await loadConfig(inConfig);
|
|
1793
1866
|
const publint2 = config2.publint;
|
|
1794
1867
|
const mode = config2.compile?.mode ?? "tsup";
|
|
@@ -1799,7 +1872,7 @@ var packageCompile = /* @__PURE__ */ __name(async (inConfig = {}) => {
|
|
|
1799
1872
|
break;
|
|
1800
1873
|
}
|
|
1801
1874
|
case "tsup": {
|
|
1802
|
-
result += await packageCompileTsup(config2);
|
|
1875
|
+
result += await packageCompileTsup(config2, types);
|
|
1803
1876
|
break;
|
|
1804
1877
|
}
|
|
1805
1878
|
}
|
|
@@ -1808,7 +1881,7 @@ var packageCompile = /* @__PURE__ */ __name(async (inConfig = {}) => {
|
|
|
1808
1881
|
|
|
1809
1882
|
// src/actions/package/copy-assets.ts
|
|
1810
1883
|
import path5 from "node:path/posix";
|
|
1811
|
-
import
|
|
1884
|
+
import chalk25 from "chalk";
|
|
1812
1885
|
import cpy2 from "cpy";
|
|
1813
1886
|
var copyTargetAssets2 = /* @__PURE__ */ __name(async (target, name, location) => {
|
|
1814
1887
|
try {
|
|
@@ -1827,7 +1900,7 @@ var copyTargetAssets2 = /* @__PURE__ */ __name(async (target, name, location) =>
|
|
|
1827
1900
|
flat: false
|
|
1828
1901
|
});
|
|
1829
1902
|
if (values.length > 0) {
|
|
1830
|
-
console.log(
|
|
1903
|
+
console.log(chalk25.green(`Copying Assets [${target.toUpperCase()}] - ${name} - ${location}`));
|
|
1831
1904
|
}
|
|
1832
1905
|
for (const value of values) {
|
|
1833
1906
|
console.log(`${value.split("/").pop()} => ./dist/${target}`);
|
|
@@ -1857,8 +1930,8 @@ var packageCopyAssets = /* @__PURE__ */ __name(async ({ target }) => {
|
|
|
1857
1930
|
|
|
1858
1931
|
// src/actions/package/deps.ts
|
|
1859
1932
|
import { existsSync as existsSync5, readFileSync as readFileSync5 } from "node:fs";
|
|
1860
|
-
import { cwd as
|
|
1861
|
-
import
|
|
1933
|
+
import { cwd as cwd4 } from "node:process";
|
|
1934
|
+
import chalk26 from "chalk";
|
|
1862
1935
|
import depcheck from "depcheck";
|
|
1863
1936
|
var special = depcheck.special;
|
|
1864
1937
|
var defaultIgnorePatterns = [
|
|
@@ -1885,21 +1958,21 @@ var defaultIgnoreDevPatterns = [
|
|
|
1885
1958
|
var reportUnused = /* @__PURE__ */ __name((name, unused) => {
|
|
1886
1959
|
if (unused.length > 0) {
|
|
1887
1960
|
const message = [
|
|
1888
|
-
|
|
1961
|
+
chalk26.yellow(`${unused.length} Unused ${name}`)
|
|
1889
1962
|
];
|
|
1890
|
-
for (const value of unused) message.push(
|
|
1963
|
+
for (const value of unused) message.push(chalk26.gray(` ${value}`));
|
|
1891
1964
|
console.log(message.join("\n"));
|
|
1892
1965
|
}
|
|
1893
1966
|
}, "reportUnused");
|
|
1894
1967
|
var reportMissing = /* @__PURE__ */ __name((name, missing) => {
|
|
1895
1968
|
if (Object.keys(missing).length > 0) {
|
|
1896
1969
|
const message = [
|
|
1897
|
-
|
|
1970
|
+
chalk26.yellow(`${Object.entries(missing).length} Missing ${name}`)
|
|
1898
1971
|
];
|
|
1899
1972
|
for (const [key, value] of Object.entries(missing)) {
|
|
1900
|
-
message.push(`${key}`,
|
|
1973
|
+
message.push(`${key}`, chalk26.gray(` ${value.at(0)}`));
|
|
1901
1974
|
}
|
|
1902
|
-
console.log(
|
|
1975
|
+
console.log(chalk26.yellow(message.join("\n")));
|
|
1903
1976
|
}
|
|
1904
1977
|
}, "reportMissing");
|
|
1905
1978
|
var analyzeDeps = /* @__PURE__ */ __name(async (pkg, ignoreMatches) => {
|
|
@@ -1954,7 +2027,7 @@ var analyzeDeps = /* @__PURE__ */ __name(async (pkg, ignoreMatches) => {
|
|
|
1954
2027
|
};
|
|
1955
2028
|
}, "analyzeDeps");
|
|
1956
2029
|
var packageDeps = /* @__PURE__ */ __name(async () => {
|
|
1957
|
-
const pkg = process.env.INIT_CWD ??
|
|
2030
|
+
const pkg = process.env.INIT_CWD ?? cwd4();
|
|
1958
2031
|
const pkgName = process.env.npm_package_name;
|
|
1959
2032
|
const packageContent = existsSync5(`${pkg}/package.json`) ? JSON.parse(readFileSync5(`${pkg}/package.json`, {
|
|
1960
2033
|
encoding: "utf8"
|
|
@@ -2004,10 +2077,10 @@ var packageDeps = /* @__PURE__ */ __name(async () => {
|
|
|
2004
2077
|
reportUnused("dependencies", unusedDeps);
|
|
2005
2078
|
reportUnused("devDependencies", unusedDevDeps);
|
|
2006
2079
|
if (Object.entries(invalidDirs).length > 0) {
|
|
2007
|
-
for (const [key, value] of Object.entries(invalidDirs)) console.warn(
|
|
2080
|
+
for (const [key, value] of Object.entries(invalidDirs)) console.warn(chalk26.gray(`Invalid Dir: ${key}: ${value}`));
|
|
2008
2081
|
}
|
|
2009
2082
|
if (Object.entries(invalidFiles).length > 0) {
|
|
2010
|
-
for (const [key, value] of Object.entries(invalidFiles)) console.warn(
|
|
2083
|
+
for (const [key, value] of Object.entries(invalidFiles)) console.warn(chalk26.gray(`Invalid File: ${key}: ${value}`));
|
|
2011
2084
|
}
|
|
2012
2085
|
reportMissing("dependencies", missingDepsObject);
|
|
2013
2086
|
reportMissing("devDependencies", missingDevDepsObject);
|
|
@@ -2018,7 +2091,7 @@ var packageDeps = /* @__PURE__ */ __name(async () => {
|
|
|
2018
2091
|
// src/actions/package/gen-docs.ts
|
|
2019
2092
|
import { existsSync as existsSync6 } from "node:fs";
|
|
2020
2093
|
import path6 from "node:path";
|
|
2021
|
-
import
|
|
2094
|
+
import chalk27 from "chalk";
|
|
2022
2095
|
import { Application, ArgumentsReader, TSConfigReader, TypeDocReader } from "typedoc";
|
|
2023
2096
|
var ExitCodes = {
|
|
2024
2097
|
CompileError: 3,
|
|
@@ -2120,7 +2193,7 @@ var runTypeDoc = /* @__PURE__ */ __name(async (app) => {
|
|
|
2120
2193
|
return ExitCodes.OutputError;
|
|
2121
2194
|
}
|
|
2122
2195
|
}
|
|
2123
|
-
console.log(
|
|
2196
|
+
console.log(chalk27.green(`${pkgName} - Ok`));
|
|
2124
2197
|
return ExitCodes.Ok;
|
|
2125
2198
|
}, "runTypeDoc");
|
|
2126
2199
|
|
|
@@ -2187,7 +2260,7 @@ var rebuild = /* @__PURE__ */ __name(({ target }) => {
|
|
|
2187
2260
|
}, "rebuild");
|
|
2188
2261
|
|
|
2189
2262
|
// src/actions/recompile.ts
|
|
2190
|
-
import
|
|
2263
|
+
import chalk28 from "chalk";
|
|
2191
2264
|
var recompile = /* @__PURE__ */ __name(async ({ verbose, target, pkg, incremental }) => {
|
|
2192
2265
|
return pkg ? await recompilePackage({
|
|
2193
2266
|
pkg,
|
|
@@ -2248,7 +2321,7 @@ var recompileAll = /* @__PURE__ */ __name(async ({ jobs, verbose, target, increm
|
|
|
2248
2321
|
`${jobs}`
|
|
2249
2322
|
] : [];
|
|
2250
2323
|
if (jobs) {
|
|
2251
|
-
console.log(
|
|
2324
|
+
console.log(chalk28.blue(`Jobs set to [${jobs}]`));
|
|
2252
2325
|
}
|
|
2253
2326
|
const result = await runStepsAsync(`Recompile${incremental ? "-Incremental" : ""} [All]`, [
|
|
2254
2327
|
[
|
|
@@ -2278,7 +2351,7 @@ var recompileAll = /* @__PURE__ */ __name(async ({ jobs, verbose, target, increm
|
|
|
2278
2351
|
]
|
|
2279
2352
|
]
|
|
2280
2353
|
]);
|
|
2281
|
-
console.log(`${
|
|
2354
|
+
console.log(`${chalk28.gray("Recompiled in")} [${chalk28.magenta(((Date.now() - start) / 1e3).toFixed(2))}] ${chalk28.gray("seconds")}`);
|
|
2282
2355
|
return result;
|
|
2283
2356
|
}, "recompileAll");
|
|
2284
2357
|
|
|
@@ -2378,7 +2451,7 @@ var sonar = /* @__PURE__ */ __name(() => {
|
|
|
2378
2451
|
}, "sonar");
|
|
2379
2452
|
|
|
2380
2453
|
// src/actions/statics.ts
|
|
2381
|
-
import
|
|
2454
|
+
import chalk29 from "chalk";
|
|
2382
2455
|
var DefaultDependencies = [
|
|
2383
2456
|
"axios",
|
|
2384
2457
|
"@xylabs/pixel",
|
|
@@ -2389,7 +2462,7 @@ var DefaultDependencies = [
|
|
|
2389
2462
|
"@mui/system"
|
|
2390
2463
|
];
|
|
2391
2464
|
var statics = /* @__PURE__ */ __name(() => {
|
|
2392
|
-
console.log(
|
|
2465
|
+
console.log(chalk29.green("Check Required Static Dependencies"));
|
|
2393
2466
|
const statics2 = parsedPackageJSON()?.xy?.deps?.statics;
|
|
2394
2467
|
return detectDuplicateDependencies(statics2, DefaultDependencies);
|
|
2395
2468
|
}, "statics");
|
|
@@ -2507,7 +2580,7 @@ var loadPackageConfig = /* @__PURE__ */ __name(async () => {
|
|
|
2507
2580
|
}, "loadPackageConfig");
|
|
2508
2581
|
|
|
2509
2582
|
// src/xy/xy.ts
|
|
2510
|
-
import
|
|
2583
|
+
import chalk31 from "chalk";
|
|
2511
2584
|
|
|
2512
2585
|
// src/xy/xyBuildCommands.ts
|
|
2513
2586
|
var xyBuildCommands = /* @__PURE__ */ __name((args) => {
|
|
@@ -2530,26 +2603,27 @@ var xyBuildCommands = /* @__PURE__ */ __name((args) => {
|
|
|
2530
2603
|
return yargs2.positional("package", {
|
|
2531
2604
|
describe: "Specific package to compile"
|
|
2532
2605
|
});
|
|
2533
|
-
},
|
|
2606
|
+
}, (argv) => {
|
|
2534
2607
|
if (argv.verbose) {
|
|
2535
2608
|
console.log(`Compiling: ${argv.package ?? "all"}`);
|
|
2536
2609
|
}
|
|
2537
|
-
process.exitCode =
|
|
2610
|
+
process.exitCode = compile({
|
|
2538
2611
|
incremental: !!argv.incremental,
|
|
2539
2612
|
jobs: argv.jobs,
|
|
2540
2613
|
pkg: argv.package,
|
|
2541
2614
|
target: argv.target,
|
|
2615
|
+
types: argv.types,
|
|
2542
2616
|
verbose: !!argv.verbose
|
|
2543
2617
|
});
|
|
2544
2618
|
}).command("compile-only [package]", "Compile with Typescript & Copy Images (No Publint)", (yargs2) => {
|
|
2545
2619
|
return yargs2.positional("package", {
|
|
2546
2620
|
describe: "Specific package to compile"
|
|
2547
2621
|
});
|
|
2548
|
-
},
|
|
2622
|
+
}, (argv) => {
|
|
2549
2623
|
if (argv.verbose) {
|
|
2550
2624
|
console.log(`Compiling: ${argv.package ?? "all"}`);
|
|
2551
2625
|
}
|
|
2552
|
-
process.exitCode =
|
|
2626
|
+
process.exitCode = compile({
|
|
2553
2627
|
incremental: !!argv.incremental,
|
|
2554
2628
|
jobs: argv.jobs,
|
|
2555
2629
|
pkg: argv.package,
|
|
@@ -2743,7 +2817,7 @@ var xyInstallCommands = /* @__PURE__ */ __name((args) => {
|
|
|
2743
2817
|
}, "xyInstallCommands");
|
|
2744
2818
|
|
|
2745
2819
|
// src/xy/xyLintCommands.ts
|
|
2746
|
-
import
|
|
2820
|
+
import chalk30 from "chalk";
|
|
2747
2821
|
var xyLintCommands = /* @__PURE__ */ __name((args) => {
|
|
2748
2822
|
return args.command("cycle [package]", "Cycle - Check for dependency cycles", (yargs2) => {
|
|
2749
2823
|
return packagePositionalParam(yargs2);
|
|
@@ -2751,7 +2825,7 @@ var xyLintCommands = /* @__PURE__ */ __name((args) => {
|
|
|
2751
2825
|
const start = Date.now();
|
|
2752
2826
|
if (argv.verbose) console.log("Cycle");
|
|
2753
2827
|
process.exitCode = await cycle();
|
|
2754
|
-
console.log(
|
|
2828
|
+
console.log(chalk30.blue(`Finished in ${Date.now() - start}ms`));
|
|
2755
2829
|
}).command("lint [package]", "Lint - Run Eslint", (yargs2) => {
|
|
2756
2830
|
return packagePositionalParam(yargs2);
|
|
2757
2831
|
}, async (argv) => {
|
|
@@ -2760,21 +2834,21 @@ var xyLintCommands = /* @__PURE__ */ __name((args) => {
|
|
|
2760
2834
|
process.exitCode = argv.fix ? fix() : argv.profile ? lintProfile() : await lint({
|
|
2761
2835
|
pkg: argv.package
|
|
2762
2836
|
});
|
|
2763
|
-
console.log(
|
|
2837
|
+
console.log(chalk30.blue(`Finished in ${Date.now() - start}ms`));
|
|
2764
2838
|
}).command("fix [package]", "Fix - Run Eslint w/fix", (yargs2) => {
|
|
2765
2839
|
return packagePositionalParam(yargs2);
|
|
2766
2840
|
}, (argv) => {
|
|
2767
2841
|
const start = Date.now();
|
|
2768
2842
|
if (argv.verbose) console.log("Fix");
|
|
2769
2843
|
process.exitCode = fix();
|
|
2770
|
-
console.log(
|
|
2844
|
+
console.log(chalk30.blue(`Finished in ${Date.now() - start}ms`));
|
|
2771
2845
|
}).command("relint [package]", "Relint - Clean & Lint", (yargs2) => {
|
|
2772
2846
|
return packagePositionalParam(yargs2);
|
|
2773
2847
|
}, (argv) => {
|
|
2774
2848
|
if (argv.verbose) console.log("Relinting");
|
|
2775
2849
|
const start = Date.now();
|
|
2776
2850
|
process.exitCode = relint();
|
|
2777
|
-
console.log(
|
|
2851
|
+
console.log(chalk30.blue(`Finished in ${Date.now() - start}ms`));
|
|
2778
2852
|
}).command("publint [package]", "Publint - Run Publint", (yargs2) => {
|
|
2779
2853
|
return packagePositionalParam(yargs2);
|
|
2780
2854
|
}, async (argv) => {
|
|
@@ -2784,14 +2858,14 @@ var xyLintCommands = /* @__PURE__ */ __name((args) => {
|
|
|
2784
2858
|
pkg: argv.package,
|
|
2785
2859
|
verbose: !!argv.verbose
|
|
2786
2860
|
});
|
|
2787
|
-
console.log(
|
|
2861
|
+
console.log(chalk30.blue(`Finished in ${Date.now() - start}ms`));
|
|
2788
2862
|
}).command("sonar", "Sonar - Run Sonar Check", (yargs2) => {
|
|
2789
2863
|
return packagePositionalParam(yargs2);
|
|
2790
2864
|
}, (argv) => {
|
|
2791
2865
|
const start = Date.now();
|
|
2792
2866
|
if (argv.verbose) console.log("Sonar Check");
|
|
2793
2867
|
process.exitCode = sonar();
|
|
2794
|
-
console.log(
|
|
2868
|
+
console.log(chalk30.blue(`Finished in ${Date.now() - start}ms`));
|
|
2795
2869
|
});
|
|
2796
2870
|
}, "xyLintCommands");
|
|
2797
2871
|
|
|
@@ -2811,6 +2885,7 @@ var xyParseOptions = /* @__PURE__ */ __name(() => {
|
|
|
2811
2885
|
type: "boolean"
|
|
2812
2886
|
}).option("target", {
|
|
2813
2887
|
alias: "t",
|
|
2888
|
+
default: "esm",
|
|
2814
2889
|
choices: [
|
|
2815
2890
|
"esm",
|
|
2816
2891
|
"cjs"
|
|
@@ -2837,6 +2912,14 @@ var xyParseOptions = /* @__PURE__ */ __name(() => {
|
|
|
2837
2912
|
default: false,
|
|
2838
2913
|
description: "Profile action",
|
|
2839
2914
|
type: "boolean"
|
|
2915
|
+
}).option("types", {
|
|
2916
|
+
default: "tsup",
|
|
2917
|
+
choices: [
|
|
2918
|
+
"tsc",
|
|
2919
|
+
"tsup"
|
|
2920
|
+
],
|
|
2921
|
+
description: "Tool to generate Typescript types",
|
|
2922
|
+
type: "string"
|
|
2840
2923
|
});
|
|
2841
2924
|
}, "xyParseOptions");
|
|
2842
2925
|
|
|
@@ -2844,8 +2927,8 @@ var xyParseOptions = /* @__PURE__ */ __name(() => {
|
|
|
2844
2927
|
var xy = /* @__PURE__ */ __name(async () => {
|
|
2845
2928
|
const options = xyParseOptions();
|
|
2846
2929
|
return await xyBuildCommands(xyCommonCommands(xyInstallCommands(xyDeployCommands(xyLintCommands(options))))).demandCommand(1).command("*", "", () => {
|
|
2847
|
-
console.error(
|
|
2848
|
-
console.log(
|
|
2930
|
+
console.error(chalk31.yellow(`Command not found [${chalk31.magenta(process.argv[2])}]`));
|
|
2931
|
+
console.log(chalk31.gray("Try 'yarn xy --help' for list of commands"));
|
|
2849
2932
|
}).version().help().argv;
|
|
2850
2933
|
}, "xy");
|
|
2851
2934
|
export {
|