@xylabs/ts-scripts-yarn3 4.0.1 → 4.0.3
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 +29 -21
- package/dist/actions/index.mjs.map +1 -1
- package/dist/actions/package/compile/compile.mjs +17 -13
- package/dist/actions/package/compile/compile.mjs.map +1 -1
- package/dist/actions/package/compile/index.mjs +17 -13
- package/dist/actions/package/compile/index.mjs.map +1 -1
- package/dist/actions/package/compile/packageCompileTsup.mjs +15 -11
- package/dist/actions/package/compile/packageCompileTsup.mjs.map +1 -1
- package/dist/actions/package/index.mjs +17 -13
- package/dist/actions/package/index.mjs.map +1 -1
- package/dist/actions/package/recompile.mjs +17 -13
- 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 +17 -13
- package/dist/bin/package/compile-only.mjs.map +1 -1
- package/dist/bin/package/compile-tsup.mjs +15 -11
- package/dist/bin/package/compile-tsup.mjs.map +1 -1
- package/dist/bin/package/compile.mjs +17 -13
- package/dist/bin/package/compile.mjs.map +1 -1
- package/dist/bin/package/recompile.mjs +17 -13
- 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 +43 -25
- 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 -4
- 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
|
@@ -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
|
]
|
|
@@ -1732,7 +1736,7 @@ var packageCompileTscTypes = /* @__PURE__ */ __name((folder = "src", { verbose }
|
|
|
1732
1736
|
}, "packageCompileTscTypes");
|
|
1733
1737
|
|
|
1734
1738
|
// src/actions/package/compile/packageCompileTsup.ts
|
|
1735
|
-
var compileFolder = /* @__PURE__ */ __name(async (folder, entryMode = "single", options, verbose) => {
|
|
1739
|
+
var compileFolder = /* @__PURE__ */ __name(async (folder, entryMode = "single", options, types = "tsup", verbose) => {
|
|
1736
1740
|
const outDir = options?.outDir ?? "dist";
|
|
1737
1741
|
const entry = buildEntries(folder, entryMode);
|
|
1738
1742
|
const optionsResult = defineConfig({
|
|
@@ -1746,7 +1750,7 @@ var compileFolder = /* @__PURE__ */ __name(async (folder, entryMode = "single",
|
|
|
1746
1750
|
],
|
|
1747
1751
|
outDir,
|
|
1748
1752
|
silent: true,
|
|
1749
|
-
sourcemap:
|
|
1753
|
+
sourcemap: types === "tsup",
|
|
1750
1754
|
splitting: false,
|
|
1751
1755
|
tsconfig: "tsconfig.json",
|
|
1752
1756
|
...options
|
|
@@ -1762,13 +1766,17 @@ var compileFolder = /* @__PURE__ */ __name(async (folder, entryMode = "single",
|
|
|
1762
1766
|
];
|
|
1763
1767
|
}))).flat();
|
|
1764
1768
|
await Promise.all(optionsList.map((options2) => build2(options2)));
|
|
1765
|
-
|
|
1766
|
-
|
|
1767
|
-
|
|
1768
|
-
|
|
1769
|
-
|
|
1769
|
+
if (types === "tsc") {
|
|
1770
|
+
return packageCompileTscTypes(folder, {
|
|
1771
|
+
verbose
|
|
1772
|
+
}, {
|
|
1773
|
+
outDir
|
|
1774
|
+
});
|
|
1775
|
+
}
|
|
1776
|
+
return 0;
|
|
1770
1777
|
}, "compileFolder");
|
|
1771
|
-
var packageCompileTsup = /* @__PURE__ */ __name(async (config2) => {
|
|
1778
|
+
var packageCompileTsup = /* @__PURE__ */ __name(async (config2, types = "tsup") => {
|
|
1779
|
+
console.warn("packageCompileTsup-types", types);
|
|
1772
1780
|
const compile2 = config2?.compile;
|
|
1773
1781
|
const publint2 = config2?.publint ?? true;
|
|
1774
1782
|
const verbose = config2?.verbose ?? false;
|
|
@@ -1820,7 +1828,7 @@ var packageCompileTsup = /* @__PURE__ */ __name(async (config2) => {
|
|
|
1820
1828
|
platform: "node",
|
|
1821
1829
|
...compile2?.tsup?.options,
|
|
1822
1830
|
...typeof options === "object" ? options : {}
|
|
1823
|
-
}, verbose) : 0;
|
|
1831
|
+
}, types, verbose) : 0;
|
|
1824
1832
|
}))).reduce((prev, value) => prev + value, 0) || (await Promise.all(Object.entries(compileForBrowser).map(async ([folder, options]) => {
|
|
1825
1833
|
const inEsBuildOptions = typeof compile2?.browser?.esbuildOptions === "object" ? compile2?.browser?.esbuildOptions : {};
|
|
1826
1834
|
return folder ? await compileFolder(folder, compile2?.entryMode, {
|
|
@@ -1833,7 +1841,7 @@ var packageCompileTsup = /* @__PURE__ */ __name(async (config2) => {
|
|
|
1833
1841
|
platform: "browser",
|
|
1834
1842
|
...compile2?.tsup?.options,
|
|
1835
1843
|
...typeof options === "object" ? options : {}
|
|
1836
|
-
}, verbose) : 0;
|
|
1844
|
+
}, types, verbose) : 0;
|
|
1837
1845
|
}))).reduce((prev, value) => prev + value, 0) || (await Promise.all(Object.entries(compileForNeutral).map(async ([folder, options]) => {
|
|
1838
1846
|
const inEsBuildOptions = typeof compile2?.neutral?.esbuildOptions === "object" ? compile2?.neutral?.esbuildOptions : {};
|
|
1839
1847
|
return folder ? await compileFolder(folder, compile2?.entryMode, {
|
|
@@ -1846,12 +1854,12 @@ var packageCompileTsup = /* @__PURE__ */ __name(async (config2) => {
|
|
|
1846
1854
|
platform: "neutral",
|
|
1847
1855
|
...compile2?.tsup?.options,
|
|
1848
1856
|
...typeof options === "object" ? options : {}
|
|
1849
|
-
}, verbose) : 0;
|
|
1857
|
+
}, types, verbose) : 0;
|
|
1850
1858
|
}))).reduce((prev, value) => prev + value, 0) || (publint2 ? await packagePublint() : 0);
|
|
1851
1859
|
}, "packageCompileTsup");
|
|
1852
1860
|
|
|
1853
1861
|
// src/actions/package/compile/compile.ts
|
|
1854
|
-
var packageCompile = /* @__PURE__ */ __name(async (inConfig = {}) => {
|
|
1862
|
+
var packageCompile = /* @__PURE__ */ __name(async (inConfig = {}, types) => {
|
|
1855
1863
|
const pkg = process.env.INIT_CWD;
|
|
1856
1864
|
console.log(chalk24.green(`Compiling ${pkg}`));
|
|
1857
1865
|
const config2 = await loadConfig(inConfig);
|
|
@@ -1864,7 +1872,7 @@ var packageCompile = /* @__PURE__ */ __name(async (inConfig = {}) => {
|
|
|
1864
1872
|
break;
|
|
1865
1873
|
}
|
|
1866
1874
|
case "tsup": {
|
|
1867
|
-
result += await packageCompileTsup(config2);
|
|
1875
|
+
result += await packageCompileTsup(config2, types);
|
|
1868
1876
|
break;
|
|
1869
1877
|
}
|
|
1870
1878
|
}
|
|
@@ -2595,26 +2603,27 @@ var xyBuildCommands = /* @__PURE__ */ __name((args) => {
|
|
|
2595
2603
|
return yargs2.positional("package", {
|
|
2596
2604
|
describe: "Specific package to compile"
|
|
2597
2605
|
});
|
|
2598
|
-
},
|
|
2606
|
+
}, (argv) => {
|
|
2599
2607
|
if (argv.verbose) {
|
|
2600
2608
|
console.log(`Compiling: ${argv.package ?? "all"}`);
|
|
2601
2609
|
}
|
|
2602
|
-
process.exitCode =
|
|
2610
|
+
process.exitCode = compile({
|
|
2603
2611
|
incremental: !!argv.incremental,
|
|
2604
2612
|
jobs: argv.jobs,
|
|
2605
2613
|
pkg: argv.package,
|
|
2606
2614
|
target: argv.target,
|
|
2615
|
+
types: argv.types,
|
|
2607
2616
|
verbose: !!argv.verbose
|
|
2608
2617
|
});
|
|
2609
2618
|
}).command("compile-only [package]", "Compile with Typescript & Copy Images (No Publint)", (yargs2) => {
|
|
2610
2619
|
return yargs2.positional("package", {
|
|
2611
2620
|
describe: "Specific package to compile"
|
|
2612
2621
|
});
|
|
2613
|
-
},
|
|
2622
|
+
}, (argv) => {
|
|
2614
2623
|
if (argv.verbose) {
|
|
2615
2624
|
console.log(`Compiling: ${argv.package ?? "all"}`);
|
|
2616
2625
|
}
|
|
2617
|
-
process.exitCode =
|
|
2626
|
+
process.exitCode = compile({
|
|
2618
2627
|
incremental: !!argv.incremental,
|
|
2619
2628
|
jobs: argv.jobs,
|
|
2620
2629
|
pkg: argv.package,
|
|
@@ -2876,6 +2885,7 @@ var xyParseOptions = /* @__PURE__ */ __name(() => {
|
|
|
2876
2885
|
type: "boolean"
|
|
2877
2886
|
}).option("target", {
|
|
2878
2887
|
alias: "t",
|
|
2888
|
+
default: "esm",
|
|
2879
2889
|
choices: [
|
|
2880
2890
|
"esm",
|
|
2881
2891
|
"cjs"
|
|
@@ -2902,6 +2912,14 @@ var xyParseOptions = /* @__PURE__ */ __name(() => {
|
|
|
2902
2912
|
default: false,
|
|
2903
2913
|
description: "Profile action",
|
|
2904
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"
|
|
2905
2923
|
});
|
|
2906
2924
|
}, "xyParseOptions");
|
|
2907
2925
|
|