@xylabs/ts-scripts-common 7.5.1 → 7.5.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/deplint/checkPackage/checkPackage.mjs +27 -0
- package/dist/actions/deplint/checkPackage/checkPackage.mjs.map +1 -1
- package/dist/actions/deplint/checkPackage/getUnusedDevDependencies.mjs +27 -0
- package/dist/actions/deplint/checkPackage/getUnusedDevDependencies.mjs.map +1 -1
- package/dist/actions/deplint/checkPackage/index.mjs +27 -0
- package/dist/actions/deplint/checkPackage/index.mjs.map +1 -1
- package/dist/actions/deplint/deplint.mjs +18 -0
- package/dist/actions/deplint/deplint.mjs.map +1 -1
- package/dist/actions/deplint/implicitDevDependencies.mjs +25 -0
- package/dist/actions/deplint/implicitDevDependencies.mjs.map +1 -1
- package/dist/actions/deplint/index.mjs +18 -0
- package/dist/actions/deplint/index.mjs.map +1 -1
- package/dist/actions/index.mjs +270 -110
- package/dist/actions/index.mjs.map +1 -1
- package/dist/actions/packman/convert.mjs +242 -100
- package/dist/actions/packman/convert.mjs.map +1 -1
- package/dist/actions/packman/convertToPnpm.mjs +168 -38
- package/dist/actions/packman/convertToPnpm.mjs.map +1 -1
- package/dist/actions/packman/convertToYarn.mjs +158 -38
- package/dist/actions/packman/convertToYarn.mjs.map +1 -1
- package/dist/actions/packman/index.mjs +242 -100
- package/dist/actions/packman/index.mjs.map +1 -1
- package/dist/actions/packman/rewriteSourceImports.mjs +56 -0
- package/dist/actions/packman/rewriteSourceImports.mjs.map +1 -0
- package/dist/actions/packman/swapTsScriptsDependency.mjs +57 -0
- package/dist/actions/packman/swapTsScriptsDependency.mjs.map +1 -0
- package/dist/bin/xy.mjs +287 -127
- package/dist/bin/xy.mjs.map +1 -1
- package/dist/index.mjs +289 -129
- package/dist/index.mjs.map +1 -1
- package/dist/xy/common/index.mjs +242 -100
- package/dist/xy/common/index.mjs.map +1 -1
- package/dist/xy/common/packmanCommand.mjs +242 -100
- package/dist/xy/common/packmanCommand.mjs.map +1 -1
- package/dist/xy/index.mjs +287 -127
- package/dist/xy/index.mjs.map +1 -1
- package/dist/xy/lint/deplintCommand.mjs +18 -0
- package/dist/xy/lint/deplintCommand.mjs.map +1 -1
- package/dist/xy/lint/index.mjs +18 -0
- package/dist/xy/lint/index.mjs.map +1 -1
- package/dist/xy/xy.mjs +287 -127
- package/dist/xy/xy.mjs.map +1 -1
- package/package.json +2 -2
package/dist/index.mjs
CHANGED
|
@@ -1926,6 +1926,8 @@ function hasImportPlugin({ location, allDependencies }) {
|
|
|
1926
1926
|
return false;
|
|
1927
1927
|
}
|
|
1928
1928
|
var hasVitest = ({ allDependencies }) => allDependencies.includes("vitest");
|
|
1929
|
+
var isYarnRepo = () => detectPackageManager() === "yarn";
|
|
1930
|
+
var isPnpmRepo = () => detectPackageManager() === "pnpm";
|
|
1929
1931
|
var rules = [
|
|
1930
1932
|
{
|
|
1931
1933
|
package: "typescript",
|
|
@@ -1942,6 +1944,22 @@ var rules = [
|
|
|
1942
1944
|
{
|
|
1943
1945
|
package: "@vitest/coverage-v8",
|
|
1944
1946
|
isNeeded: hasVitest
|
|
1947
|
+
},
|
|
1948
|
+
{
|
|
1949
|
+
package: "@xylabs/ts-scripts-yarn3",
|
|
1950
|
+
isNeeded: isYarnRepo
|
|
1951
|
+
},
|
|
1952
|
+
{
|
|
1953
|
+
package: "@xylabs/ts-scripts-react-yarn3",
|
|
1954
|
+
isNeeded: isYarnRepo
|
|
1955
|
+
},
|
|
1956
|
+
{
|
|
1957
|
+
package: "@xylabs/ts-scripts-pnpm",
|
|
1958
|
+
isNeeded: isPnpmRepo
|
|
1959
|
+
},
|
|
1960
|
+
{
|
|
1961
|
+
package: "@xylabs/ts-scripts-react-pnpm",
|
|
1962
|
+
isNeeded: isPnpmRepo
|
|
1945
1963
|
}
|
|
1946
1964
|
];
|
|
1947
1965
|
function getImplicitDevDependencies(context) {
|
|
@@ -3601,24 +3619,24 @@ function packageLintMonorepo(fix2 = false) {
|
|
|
3601
3619
|
|
|
3602
3620
|
// src/actions/packman/convert.ts
|
|
3603
3621
|
import {
|
|
3604
|
-
existsSync as
|
|
3622
|
+
existsSync as existsSync16,
|
|
3605
3623
|
readdirSync as readdirSync7,
|
|
3606
|
-
readFileSync as
|
|
3624
|
+
readFileSync as readFileSync18,
|
|
3607
3625
|
statSync as statSync3
|
|
3608
3626
|
} from "fs";
|
|
3609
|
-
import
|
|
3610
|
-
import
|
|
3627
|
+
import PATH15 from "path";
|
|
3628
|
+
import chalk50 from "chalk";
|
|
3611
3629
|
|
|
3612
3630
|
// src/actions/packman/convertToPnpm.ts
|
|
3613
3631
|
import {
|
|
3614
|
-
existsSync as
|
|
3632
|
+
existsSync as existsSync14,
|
|
3615
3633
|
mkdirSync as mkdirSync5,
|
|
3616
|
-
readFileSync as
|
|
3634
|
+
readFileSync as readFileSync16,
|
|
3617
3635
|
rmSync as rmSync3,
|
|
3618
|
-
writeFileSync as
|
|
3636
|
+
writeFileSync as writeFileSync10
|
|
3619
3637
|
} from "fs";
|
|
3620
|
-
import
|
|
3621
|
-
import
|
|
3638
|
+
import PATH13 from "path";
|
|
3639
|
+
import chalk48 from "chalk";
|
|
3622
3640
|
|
|
3623
3641
|
// src/actions/packman/rewriteScripts.ts
|
|
3624
3642
|
function rewriteYarnToPnpm(script) {
|
|
@@ -3668,6 +3686,113 @@ function rewriteScriptsInPackageJson(pkg, direction) {
|
|
|
3668
3686
|
return { ...pkg, scripts: rewritten };
|
|
3669
3687
|
}
|
|
3670
3688
|
|
|
3689
|
+
// src/actions/packman/rewriteSourceImports.ts
|
|
3690
|
+
import { existsSync as existsSync12, readFileSync as readFileSync14, writeFileSync as writeFileSync8 } from "fs";
|
|
3691
|
+
import chalk46 from "chalk";
|
|
3692
|
+
import { globSync as globSync3 } from "glob";
|
|
3693
|
+
var IMPORT_SWAP_MAP = {
|
|
3694
|
+
"yarn-to-pnpm": [
|
|
3695
|
+
["@xylabs/ts-scripts-yarn3", "@xylabs/ts-scripts-pnpm"],
|
|
3696
|
+
["@xylabs/ts-scripts-react-yarn3", "@xylabs/ts-scripts-react-pnpm"]
|
|
3697
|
+
],
|
|
3698
|
+
"pnpm-to-yarn": [
|
|
3699
|
+
["@xylabs/ts-scripts-pnpm", "@xylabs/ts-scripts-yarn3"],
|
|
3700
|
+
["@xylabs/ts-scripts-react-pnpm", "@xylabs/ts-scripts-react-yarn3"]
|
|
3701
|
+
]
|
|
3702
|
+
};
|
|
3703
|
+
var SOURCE_GLOBS = [
|
|
3704
|
+
"**/*.ts",
|
|
3705
|
+
"**/*.tsx",
|
|
3706
|
+
"**/*.mts",
|
|
3707
|
+
"**/*.cts",
|
|
3708
|
+
"**/*.js",
|
|
3709
|
+
"**/*.mjs"
|
|
3710
|
+
];
|
|
3711
|
+
var IGNORE_PATTERNS = [
|
|
3712
|
+
"**/node_modules/**",
|
|
3713
|
+
"**/dist/**",
|
|
3714
|
+
"**/build/**",
|
|
3715
|
+
"**/.yarn/**"
|
|
3716
|
+
];
|
|
3717
|
+
function rewriteSourceImports(cwd5, direction) {
|
|
3718
|
+
const swaps = IMPORT_SWAP_MAP[direction];
|
|
3719
|
+
const files = globSync3(SOURCE_GLOBS, {
|
|
3720
|
+
cwd: cwd5,
|
|
3721
|
+
absolute: true,
|
|
3722
|
+
ignore: IGNORE_PATTERNS
|
|
3723
|
+
});
|
|
3724
|
+
let count = 0;
|
|
3725
|
+
for (const file of files) {
|
|
3726
|
+
if (!existsSync12(file)) continue;
|
|
3727
|
+
const original = readFileSync14(file, "utf8");
|
|
3728
|
+
let content = original;
|
|
3729
|
+
for (const [from, to] of swaps) {
|
|
3730
|
+
content = content.replaceAll(from, to);
|
|
3731
|
+
}
|
|
3732
|
+
if (content !== original) {
|
|
3733
|
+
writeFileSync8(file, content, "utf8");
|
|
3734
|
+
count++;
|
|
3735
|
+
}
|
|
3736
|
+
}
|
|
3737
|
+
if (count > 0) {
|
|
3738
|
+
console.log(chalk46.green(` Rewrote ts-scripts imports in ${count} source file(s)`));
|
|
3739
|
+
}
|
|
3740
|
+
}
|
|
3741
|
+
|
|
3742
|
+
// src/actions/packman/swapTsScriptsDependency.ts
|
|
3743
|
+
import {
|
|
3744
|
+
existsSync as existsSync13,
|
|
3745
|
+
readFileSync as readFileSync15,
|
|
3746
|
+
writeFileSync as writeFileSync9
|
|
3747
|
+
} from "fs";
|
|
3748
|
+
import PATH12 from "path";
|
|
3749
|
+
import chalk47 from "chalk";
|
|
3750
|
+
var SWAP_MAP = {
|
|
3751
|
+
"yarn-to-pnpm": [
|
|
3752
|
+
["@xylabs/ts-scripts-yarn3", "@xylabs/ts-scripts-pnpm"]
|
|
3753
|
+
],
|
|
3754
|
+
"pnpm-to-yarn": [
|
|
3755
|
+
["@xylabs/ts-scripts-pnpm", "@xylabs/ts-scripts-yarn3"]
|
|
3756
|
+
]
|
|
3757
|
+
};
|
|
3758
|
+
function swapInPackageJson(pkgPath, direction) {
|
|
3759
|
+
if (!existsSync13(pkgPath)) return false;
|
|
3760
|
+
const raw = readFileSync15(pkgPath, "utf8");
|
|
3761
|
+
const pkg = JSON.parse(raw);
|
|
3762
|
+
let changed = false;
|
|
3763
|
+
for (const depField of ["dependencies", "devDependencies"]) {
|
|
3764
|
+
const deps = pkg[depField];
|
|
3765
|
+
if (!deps) continue;
|
|
3766
|
+
for (const [from, to] of SWAP_MAP[direction]) {
|
|
3767
|
+
if (deps[from]) {
|
|
3768
|
+
deps[to] = deps[from];
|
|
3769
|
+
delete deps[from];
|
|
3770
|
+
changed = true;
|
|
3771
|
+
}
|
|
3772
|
+
}
|
|
3773
|
+
}
|
|
3774
|
+
if (changed) {
|
|
3775
|
+
writeFileSync9(pkgPath, JSON.stringify(pkg, null, 2) + "\n", "utf8");
|
|
3776
|
+
}
|
|
3777
|
+
return changed;
|
|
3778
|
+
}
|
|
3779
|
+
function swapTsScriptsDependency(cwd5, workspacePackageJsonPaths, direction) {
|
|
3780
|
+
let count = 0;
|
|
3781
|
+
if (swapInPackageJson(PATH12.join(cwd5, "package.json"), direction)) {
|
|
3782
|
+
count++;
|
|
3783
|
+
}
|
|
3784
|
+
for (const pkgPath of workspacePackageJsonPaths) {
|
|
3785
|
+
const fullPath = PATH12.resolve(cwd5, pkgPath, "package.json");
|
|
3786
|
+
if (swapInPackageJson(fullPath, direction)) {
|
|
3787
|
+
count++;
|
|
3788
|
+
}
|
|
3789
|
+
}
|
|
3790
|
+
if (count > 0) {
|
|
3791
|
+
const target = direction === "yarn-to-pnpm" ? "@xylabs/ts-scripts-pnpm" : "@xylabs/ts-scripts-yarn3";
|
|
3792
|
+
console.log(chalk47.green(` Swapped ts-scripts dependency to ${target} in ${count} package(s)`));
|
|
3793
|
+
}
|
|
3794
|
+
}
|
|
3795
|
+
|
|
3671
3796
|
// src/actions/packman/convertToPnpm.ts
|
|
3672
3797
|
var PNPM_VERSION = "10.12.1";
|
|
3673
3798
|
function createPnpmWorkspaceYaml(cwd5, workspacePatterns) {
|
|
@@ -3675,24 +3800,45 @@ function createPnpmWorkspaceYaml(cwd5, workspacePatterns) {
|
|
|
3675
3800
|
for (const pattern of workspacePatterns) {
|
|
3676
3801
|
lines.push(` - '${pattern}'`);
|
|
3677
3802
|
}
|
|
3678
|
-
|
|
3679
|
-
console.log(
|
|
3803
|
+
writeFileSync10(PATH13.join(cwd5, "pnpm-workspace.yaml"), lines.join("\n") + "\n", "utf8");
|
|
3804
|
+
console.log(chalk48.green(" Created pnpm-workspace.yaml"));
|
|
3805
|
+
}
|
|
3806
|
+
function readPnpmWorkspacePatterns(cwd5) {
|
|
3807
|
+
const wsPath = PATH13.join(cwd5, "pnpm-workspace.yaml");
|
|
3808
|
+
if (!existsSync14(wsPath)) return [];
|
|
3809
|
+
const content = readFileSync16(wsPath, "utf8");
|
|
3810
|
+
const patterns = [];
|
|
3811
|
+
const lines = content.split("\n");
|
|
3812
|
+
let inPackages = false;
|
|
3813
|
+
for (const line of lines) {
|
|
3814
|
+
if (line.trim() === "packages:") {
|
|
3815
|
+
inPackages = true;
|
|
3816
|
+
continue;
|
|
3817
|
+
}
|
|
3818
|
+
if (inPackages && /^\s+-\s+/.test(line)) {
|
|
3819
|
+
const pattern = line.replace(/^\s+-\s+/, "").replaceAll(/['"]/g, "").trim();
|
|
3820
|
+
if (pattern) patterns.push(pattern);
|
|
3821
|
+
} else if (inPackages && !/^\s/.test(line) && line.trim()) {
|
|
3822
|
+
inPackages = false;
|
|
3823
|
+
}
|
|
3824
|
+
}
|
|
3825
|
+
return patterns;
|
|
3680
3826
|
}
|
|
3681
3827
|
function updateRootPackageJson(cwd5) {
|
|
3682
|
-
const pkgPath =
|
|
3683
|
-
const pkg = JSON.parse(
|
|
3684
|
-
const workspacePatterns = pkg.workspaces ??
|
|
3828
|
+
const pkgPath = PATH13.join(cwd5, "package.json");
|
|
3829
|
+
const pkg = JSON.parse(readFileSync16(pkgPath, "utf8"));
|
|
3830
|
+
const workspacePatterns = pkg.workspaces ?? readPnpmWorkspacePatterns(cwd5);
|
|
3685
3831
|
delete pkg.workspaces;
|
|
3686
3832
|
pkg.packageManager = `pnpm@${PNPM_VERSION}`;
|
|
3687
3833
|
const updated = rewriteScriptsInPackageJson(pkg, "yarn-to-pnpm");
|
|
3688
|
-
|
|
3689
|
-
console.log(
|
|
3834
|
+
writeFileSync10(pkgPath, JSON.stringify(updated, null, 2) + "\n", "utf8");
|
|
3835
|
+
console.log(chalk48.green(" Updated root package.json"));
|
|
3690
3836
|
return workspacePatterns;
|
|
3691
3837
|
}
|
|
3692
3838
|
function updateGitignore(cwd5) {
|
|
3693
|
-
const gitignorePath =
|
|
3694
|
-
if (!
|
|
3695
|
-
let content =
|
|
3839
|
+
const gitignorePath = PATH13.join(cwd5, ".gitignore");
|
|
3840
|
+
if (!existsSync14(gitignorePath)) return;
|
|
3841
|
+
let content = readFileSync16(gitignorePath, "utf8");
|
|
3696
3842
|
const yarnLines = [
|
|
3697
3843
|
".pnp.*",
|
|
3698
3844
|
".pnp",
|
|
@@ -3707,63 +3853,65 @@ function updateGitignore(cwd5) {
|
|
|
3707
3853
|
content = content.replaceAll(new RegExp(String.raw`^${line.replaceAll(".", String.raw`\.`).replaceAll("*", String.raw`\*`).replaceAll("!", String.raw`\!`)}\s*$`, "gm"), "");
|
|
3708
3854
|
}
|
|
3709
3855
|
content = content.replaceAll(/\n{3,}/g, "\n\n");
|
|
3710
|
-
|
|
3711
|
-
console.log(
|
|
3856
|
+
writeFileSync10(gitignorePath, content, "utf8");
|
|
3857
|
+
console.log(chalk48.green(" Updated .gitignore"));
|
|
3712
3858
|
}
|
|
3713
3859
|
function deleteYarnArtifacts(cwd5) {
|
|
3714
|
-
const yarnLock =
|
|
3715
|
-
const yarnrc =
|
|
3716
|
-
const yarnDir =
|
|
3717
|
-
if (
|
|
3860
|
+
const yarnLock = PATH13.join(cwd5, "yarn.lock");
|
|
3861
|
+
const yarnrc = PATH13.join(cwd5, ".yarnrc.yml");
|
|
3862
|
+
const yarnDir = PATH13.join(cwd5, ".yarn");
|
|
3863
|
+
if (existsSync14(yarnLock)) {
|
|
3718
3864
|
rmSync3(yarnLock);
|
|
3719
|
-
console.log(
|
|
3865
|
+
console.log(chalk48.gray(" Deleted yarn.lock"));
|
|
3720
3866
|
}
|
|
3721
|
-
if (
|
|
3867
|
+
if (existsSync14(yarnrc)) {
|
|
3722
3868
|
rmSync3(yarnrc);
|
|
3723
|
-
console.log(
|
|
3869
|
+
console.log(chalk48.gray(" Deleted .yarnrc.yml"));
|
|
3724
3870
|
}
|
|
3725
|
-
if (
|
|
3871
|
+
if (existsSync14(yarnDir)) {
|
|
3726
3872
|
rmSync3(yarnDir, { force: true, recursive: true });
|
|
3727
|
-
console.log(
|
|
3873
|
+
console.log(chalk48.gray(" Deleted .yarn/"));
|
|
3728
3874
|
}
|
|
3729
3875
|
}
|
|
3730
3876
|
function createNpmrc(cwd5) {
|
|
3731
|
-
const npmrcPath =
|
|
3732
|
-
if (
|
|
3733
|
-
mkdirSync5(
|
|
3734
|
-
|
|
3735
|
-
console.log(
|
|
3877
|
+
const npmrcPath = PATH13.join(cwd5, ".npmrc");
|
|
3878
|
+
if (existsSync14(npmrcPath)) return;
|
|
3879
|
+
mkdirSync5(PATH13.dirname(npmrcPath), { recursive: true });
|
|
3880
|
+
writeFileSync10(npmrcPath, "", "utf8");
|
|
3881
|
+
console.log(chalk48.green(" Created .npmrc"));
|
|
3736
3882
|
}
|
|
3737
3883
|
function convertToPnpm(cwd5, workspacePackageJsonPaths) {
|
|
3738
|
-
console.log(
|
|
3884
|
+
console.log(chalk48.blue("\nConverting to pnpm...\n"));
|
|
3739
3885
|
const workspacePatterns = updateRootPackageJson(cwd5);
|
|
3740
3886
|
createPnpmWorkspaceYaml(cwd5, workspacePatterns);
|
|
3741
3887
|
for (const pkgPath of workspacePackageJsonPaths) {
|
|
3742
|
-
const fullPath =
|
|
3743
|
-
if (!
|
|
3744
|
-
const pkg = JSON.parse(
|
|
3888
|
+
const fullPath = PATH13.resolve(cwd5, pkgPath, "package.json");
|
|
3889
|
+
if (!existsSync14(fullPath)) continue;
|
|
3890
|
+
const pkg = JSON.parse(readFileSync16(fullPath, "utf8"));
|
|
3745
3891
|
const updated = rewriteScriptsInPackageJson(pkg, "yarn-to-pnpm");
|
|
3746
3892
|
if (JSON.stringify(pkg) !== JSON.stringify(updated)) {
|
|
3747
|
-
|
|
3893
|
+
writeFileSync10(fullPath, JSON.stringify(updated, null, 2) + "\n", "utf8");
|
|
3748
3894
|
}
|
|
3749
3895
|
}
|
|
3750
|
-
console.log(
|
|
3896
|
+
console.log(chalk48.green(` Rewrote scripts in ${workspacePackageJsonPaths.length} workspace package(s)`));
|
|
3751
3897
|
updateGitignore(cwd5);
|
|
3752
3898
|
createNpmrc(cwd5);
|
|
3899
|
+
swapTsScriptsDependency(cwd5, workspacePackageJsonPaths, "yarn-to-pnpm");
|
|
3900
|
+
rewriteSourceImports(cwd5, "yarn-to-pnpm");
|
|
3753
3901
|
deleteYarnArtifacts(cwd5);
|
|
3754
|
-
console.log(
|
|
3902
|
+
console.log(chalk48.blue("\nConversion complete. Run `pnpm install` to generate pnpm-lock.yaml.\n"));
|
|
3755
3903
|
return 0;
|
|
3756
3904
|
}
|
|
3757
3905
|
|
|
3758
3906
|
// src/actions/packman/convertToYarn.ts
|
|
3759
3907
|
import {
|
|
3760
|
-
existsSync as
|
|
3761
|
-
readFileSync as
|
|
3908
|
+
existsSync as existsSync15,
|
|
3909
|
+
readFileSync as readFileSync17,
|
|
3762
3910
|
rmSync as rmSync4,
|
|
3763
|
-
writeFileSync as
|
|
3911
|
+
writeFileSync as writeFileSync11
|
|
3764
3912
|
} from "fs";
|
|
3765
|
-
import
|
|
3766
|
-
import
|
|
3913
|
+
import PATH14 from "path";
|
|
3914
|
+
import chalk49 from "chalk";
|
|
3767
3915
|
var YARN_VERSION = "4.13.0";
|
|
3768
3916
|
var YARNRC_TEMPLATE = `compressionLevel: mixed
|
|
3769
3917
|
|
|
@@ -3784,10 +3932,10 @@ var YARN_GITIGNORE_ENTRIES = `
|
|
|
3784
3932
|
!.yarn/sdks
|
|
3785
3933
|
!.yarn/versions
|
|
3786
3934
|
`;
|
|
3787
|
-
function
|
|
3788
|
-
const wsPath =
|
|
3789
|
-
if (!
|
|
3790
|
-
const content =
|
|
3935
|
+
function readPnpmWorkspacePatterns2(cwd5) {
|
|
3936
|
+
const wsPath = PATH14.join(cwd5, "pnpm-workspace.yaml");
|
|
3937
|
+
if (!existsSync15(wsPath)) return [];
|
|
3938
|
+
const content = readFileSync17(wsPath, "utf8");
|
|
3791
3939
|
const patterns = [];
|
|
3792
3940
|
const lines = content.split("\n");
|
|
3793
3941
|
let inPackages = false;
|
|
@@ -3806,91 +3954,104 @@ function readPnpmWorkspacePatterns(cwd5) {
|
|
|
3806
3954
|
return patterns;
|
|
3807
3955
|
}
|
|
3808
3956
|
function updateRootPackageJson2(cwd5, workspacePatterns) {
|
|
3809
|
-
const pkgPath =
|
|
3810
|
-
const pkg = JSON.parse(
|
|
3957
|
+
const pkgPath = PATH14.join(cwd5, "package.json");
|
|
3958
|
+
const pkg = JSON.parse(readFileSync17(pkgPath, "utf8"));
|
|
3811
3959
|
pkg.workspaces = workspacePatterns;
|
|
3812
3960
|
pkg.packageManager = `yarn@${YARN_VERSION}`;
|
|
3813
3961
|
const updated = rewriteScriptsInPackageJson(pkg, "pnpm-to-yarn");
|
|
3814
|
-
|
|
3815
|
-
console.log(
|
|
3962
|
+
writeFileSync11(pkgPath, JSON.stringify(updated, null, 2) + "\n", "utf8");
|
|
3963
|
+
console.log(chalk49.green(" Updated root package.json"));
|
|
3816
3964
|
}
|
|
3817
3965
|
function updateGitignore2(cwd5) {
|
|
3818
|
-
const gitignorePath =
|
|
3819
|
-
let content =
|
|
3966
|
+
const gitignorePath = PATH14.join(cwd5, ".gitignore");
|
|
3967
|
+
let content = existsSync15(gitignorePath) ? readFileSync17(gitignorePath, "utf8") : "";
|
|
3820
3968
|
if (!content.includes(".yarn/*")) {
|
|
3821
3969
|
content = content.trimEnd() + "\n" + YARN_GITIGNORE_ENTRIES;
|
|
3822
3970
|
}
|
|
3823
|
-
|
|
3824
|
-
console.log(
|
|
3971
|
+
writeFileSync11(gitignorePath, content, "utf8");
|
|
3972
|
+
console.log(chalk49.green(" Updated .gitignore"));
|
|
3825
3973
|
}
|
|
3826
3974
|
function deletePnpmArtifacts(cwd5) {
|
|
3827
|
-
const lockfile =
|
|
3828
|
-
const workspaceYaml =
|
|
3829
|
-
const npmrc =
|
|
3830
|
-
if (
|
|
3975
|
+
const lockfile = PATH14.join(cwd5, "pnpm-lock.yaml");
|
|
3976
|
+
const workspaceYaml = PATH14.join(cwd5, "pnpm-workspace.yaml");
|
|
3977
|
+
const npmrc = PATH14.join(cwd5, ".npmrc");
|
|
3978
|
+
if (existsSync15(lockfile)) {
|
|
3831
3979
|
rmSync4(lockfile);
|
|
3832
|
-
console.log(
|
|
3980
|
+
console.log(chalk49.gray(" Deleted pnpm-lock.yaml"));
|
|
3833
3981
|
}
|
|
3834
|
-
if (
|
|
3982
|
+
if (existsSync15(workspaceYaml)) {
|
|
3835
3983
|
rmSync4(workspaceYaml);
|
|
3836
|
-
console.log(
|
|
3984
|
+
console.log(chalk49.gray(" Deleted pnpm-workspace.yaml"));
|
|
3837
3985
|
}
|
|
3838
|
-
if (
|
|
3839
|
-
const content =
|
|
3986
|
+
if (existsSync15(npmrc)) {
|
|
3987
|
+
const content = readFileSync17(npmrc, "utf8");
|
|
3840
3988
|
if (content.trim() === "" || content.includes("shamefully-hoist") || content.includes("node-linker")) {
|
|
3841
3989
|
rmSync4(npmrc);
|
|
3842
|
-
console.log(
|
|
3990
|
+
console.log(chalk49.gray(" Deleted .npmrc"));
|
|
3843
3991
|
}
|
|
3844
3992
|
}
|
|
3845
3993
|
}
|
|
3846
3994
|
function createYarnrc(cwd5) {
|
|
3847
|
-
const yarnrcPath =
|
|
3848
|
-
if (
|
|
3849
|
-
|
|
3850
|
-
console.log(
|
|
3995
|
+
const yarnrcPath = PATH14.join(cwd5, ".yarnrc.yml");
|
|
3996
|
+
if (existsSync15(yarnrcPath)) return;
|
|
3997
|
+
writeFileSync11(yarnrcPath, YARNRC_TEMPLATE, "utf8");
|
|
3998
|
+
console.log(chalk49.green(" Created .yarnrc.yml"));
|
|
3999
|
+
}
|
|
4000
|
+
function readWorkspacePatternsFromPackageJson(cwd5) {
|
|
4001
|
+
const pkgPath = PATH14.join(cwd5, "package.json");
|
|
4002
|
+
if (!existsSync15(pkgPath)) return [];
|
|
4003
|
+
const pkg = JSON.parse(readFileSync17(pkgPath, "utf8"));
|
|
4004
|
+
return pkg.workspaces ?? [];
|
|
3851
4005
|
}
|
|
3852
4006
|
function convertToYarn(cwd5, workspacePackageJsonPaths) {
|
|
3853
|
-
console.log(
|
|
3854
|
-
const workspacePatterns =
|
|
4007
|
+
console.log(chalk49.blue("\nConverting to yarn...\n"));
|
|
4008
|
+
const workspacePatterns = readPnpmWorkspacePatterns2(cwd5);
|
|
3855
4009
|
if (workspacePatterns.length === 0) {
|
|
3856
|
-
|
|
4010
|
+
const fromPkg = readWorkspacePatternsFromPackageJson(cwd5);
|
|
4011
|
+
if (fromPkg.length > 0) {
|
|
4012
|
+
workspacePatterns.push(...fromPkg);
|
|
4013
|
+
} else {
|
|
4014
|
+
console.warn(chalk49.yellow(" No workspace patterns found"));
|
|
4015
|
+
}
|
|
3857
4016
|
}
|
|
3858
4017
|
updateRootPackageJson2(cwd5, workspacePatterns);
|
|
3859
4018
|
for (const pkgPath of workspacePackageJsonPaths) {
|
|
3860
|
-
const fullPath =
|
|
3861
|
-
if (!
|
|
3862
|
-
const pkg = JSON.parse(
|
|
4019
|
+
const fullPath = PATH14.resolve(cwd5, pkgPath, "package.json");
|
|
4020
|
+
if (!existsSync15(fullPath)) continue;
|
|
4021
|
+
const pkg = JSON.parse(readFileSync17(fullPath, "utf8"));
|
|
3863
4022
|
const updated = rewriteScriptsInPackageJson(pkg, "pnpm-to-yarn");
|
|
3864
4023
|
if (JSON.stringify(pkg) !== JSON.stringify(updated)) {
|
|
3865
|
-
|
|
4024
|
+
writeFileSync11(fullPath, JSON.stringify(updated, null, 2) + "\n", "utf8");
|
|
3866
4025
|
}
|
|
3867
4026
|
}
|
|
3868
|
-
console.log(
|
|
4027
|
+
console.log(chalk49.green(` Rewrote scripts in ${workspacePackageJsonPaths.length} workspace package(s)`));
|
|
3869
4028
|
updateGitignore2(cwd5);
|
|
3870
4029
|
createYarnrc(cwd5);
|
|
4030
|
+
swapTsScriptsDependency(cwd5, workspacePackageJsonPaths, "pnpm-to-yarn");
|
|
4031
|
+
rewriteSourceImports(cwd5, "pnpm-to-yarn");
|
|
3871
4032
|
deletePnpmArtifacts(cwd5);
|
|
3872
|
-
console.log(
|
|
4033
|
+
console.log(chalk49.blue("\nConversion complete. Run `corepack enable yarn && yarn set version stable && yarn install` to finish setup.\n"));
|
|
3873
4034
|
return 0;
|
|
3874
4035
|
}
|
|
3875
4036
|
|
|
3876
4037
|
// src/actions/packman/convert.ts
|
|
3877
4038
|
function detectCurrentPM(cwd5) {
|
|
3878
|
-
if (
|
|
4039
|
+
if (existsSync16(PATH15.join(cwd5, "pnpm-lock.yaml")) || existsSync16(PATH15.join(cwd5, "pnpm-workspace.yaml"))) {
|
|
3879
4040
|
return "pnpm";
|
|
3880
4041
|
}
|
|
3881
|
-
if (
|
|
4042
|
+
if (existsSync16(PATH15.join(cwd5, "yarn.lock")) || existsSync16(PATH15.join(cwd5, ".yarnrc.yml"))) {
|
|
3882
4043
|
return "yarn";
|
|
3883
4044
|
}
|
|
3884
4045
|
return "unknown";
|
|
3885
4046
|
}
|
|
3886
4047
|
function findWorkspacePackagePaths(cwd5) {
|
|
3887
|
-
const pkgPath =
|
|
3888
|
-
const pkg = JSON.parse(
|
|
4048
|
+
const pkgPath = PATH15.join(cwd5, "package.json");
|
|
4049
|
+
const pkg = JSON.parse(readFileSync18(pkgPath, "utf8"));
|
|
3889
4050
|
let patterns = pkg.workspaces ?? [];
|
|
3890
4051
|
if (patterns.length === 0) {
|
|
3891
|
-
const wsPath =
|
|
3892
|
-
if (
|
|
3893
|
-
const content =
|
|
4052
|
+
const wsPath = PATH15.join(cwd5, "pnpm-workspace.yaml");
|
|
4053
|
+
if (existsSync16(wsPath)) {
|
|
4054
|
+
const content = readFileSync18(wsPath, "utf8");
|
|
3894
4055
|
const lines = content.split("\n");
|
|
3895
4056
|
let inPackages = false;
|
|
3896
4057
|
for (const line of lines) {
|
|
@@ -3920,15 +4081,15 @@ function resolveWorkspaceGlob(cwd5, pattern) {
|
|
|
3920
4081
|
}
|
|
3921
4082
|
function walkGlob(basePath, parts, currentPath) {
|
|
3922
4083
|
if (parts.length === 0) {
|
|
3923
|
-
const fullPath =
|
|
3924
|
-
if (
|
|
4084
|
+
const fullPath = PATH15.join(basePath, currentPath);
|
|
4085
|
+
if (existsSync16(PATH15.join(fullPath, "package.json"))) {
|
|
3925
4086
|
return [currentPath];
|
|
3926
4087
|
}
|
|
3927
4088
|
return [];
|
|
3928
4089
|
}
|
|
3929
4090
|
const [part, ...rest] = parts;
|
|
3930
|
-
const dirPath =
|
|
3931
|
-
if (!
|
|
4091
|
+
const dirPath = PATH15.join(basePath, currentPath);
|
|
4092
|
+
if (!existsSync16(dirPath) || !statSync3(dirPath).isDirectory()) {
|
|
3932
4093
|
return [];
|
|
3933
4094
|
}
|
|
3934
4095
|
if (part === "*" || part === "**") {
|
|
@@ -3956,26 +4117,25 @@ function walkGlob(basePath, parts, currentPath) {
|
|
|
3956
4117
|
function convert({ target, verbose }) {
|
|
3957
4118
|
const validTargets = ["pnpm", "yarn"];
|
|
3958
4119
|
if (!validTargets.includes(target)) {
|
|
3959
|
-
console.error(
|
|
4120
|
+
console.error(chalk50.red(`Invalid target "${target}". Must be one of: ${validTargets.join(", ")}`));
|
|
3960
4121
|
return 1;
|
|
3961
4122
|
}
|
|
3962
4123
|
const cwd5 = process.cwd();
|
|
3963
4124
|
const currentPM = detectCurrentPM(cwd5);
|
|
3964
4125
|
if (verbose) {
|
|
3965
|
-
console.log(
|
|
3966
|
-
console.log(
|
|
4126
|
+
console.log(chalk50.gray(`Current package manager: ${currentPM}`));
|
|
4127
|
+
console.log(chalk50.gray(`Target package manager: ${target}`));
|
|
3967
4128
|
}
|
|
3968
4129
|
if (currentPM === target) {
|
|
3969
|
-
console.
|
|
3970
|
-
return 1;
|
|
4130
|
+
console.log(chalk50.yellow(`Already using ${target}. Re-applying conversion to fix any incomplete steps...`));
|
|
3971
4131
|
}
|
|
3972
4132
|
if (currentPM === "unknown") {
|
|
3973
|
-
console.error(
|
|
4133
|
+
console.error(chalk50.red("Could not detect current package manager. No yarn.lock or pnpm-lock.yaml found."));
|
|
3974
4134
|
return 1;
|
|
3975
4135
|
}
|
|
3976
4136
|
const workspacePaths = findWorkspacePackagePaths(cwd5);
|
|
3977
4137
|
if (verbose) {
|
|
3978
|
-
console.log(
|
|
4138
|
+
console.log(chalk50.gray(`Found ${workspacePaths.length} workspace packages`));
|
|
3979
4139
|
}
|
|
3980
4140
|
if (target === "pnpm") {
|
|
3981
4141
|
return convertToPnpm(cwd5, workspacePaths);
|
|
@@ -4033,7 +4193,7 @@ var rebuild = ({ target }) => {
|
|
|
4033
4193
|
};
|
|
4034
4194
|
|
|
4035
4195
|
// src/actions/recompile.ts
|
|
4036
|
-
import
|
|
4196
|
+
import chalk51 from "chalk";
|
|
4037
4197
|
var recompile = async ({
|
|
4038
4198
|
verbose,
|
|
4039
4199
|
target,
|
|
@@ -4068,7 +4228,7 @@ var recompileAll = async ({
|
|
|
4068
4228
|
const start = Date.now();
|
|
4069
4229
|
const targetOptions = target ? ["-t", target] : [];
|
|
4070
4230
|
if (jobs) {
|
|
4071
|
-
console.log(
|
|
4231
|
+
console.log(chalk51.blue(`Jobs set to [${jobs}]`));
|
|
4072
4232
|
}
|
|
4073
4233
|
const foreachOptions = {
|
|
4074
4234
|
incremental,
|
|
@@ -4081,25 +4241,25 @@ var recompileAll = async ({
|
|
|
4081
4241
|
pm.foreachWorkspace("package-compile", targetOptions, foreachOptions)
|
|
4082
4242
|
]);
|
|
4083
4243
|
console.log(
|
|
4084
|
-
`${
|
|
4244
|
+
`${chalk51.gray("Recompiled in")} [${chalk51.magenta(((Date.now() - start) / 1e3).toFixed(2))}] ${chalk51.gray("seconds")}`
|
|
4085
4245
|
);
|
|
4086
4246
|
return result;
|
|
4087
4247
|
};
|
|
4088
4248
|
|
|
4089
4249
|
// src/actions/relint.ts
|
|
4090
|
-
import
|
|
4250
|
+
import chalk52 from "chalk";
|
|
4091
4251
|
var relintPackage = ({
|
|
4092
4252
|
pkg,
|
|
4093
4253
|
fix: fix2,
|
|
4094
4254
|
verbose
|
|
4095
4255
|
}) => {
|
|
4096
|
-
console.log(
|
|
4256
|
+
console.log(chalk52.gray(`${fix2 ? "Fix" : "Lint"} [${pkg}]`));
|
|
4097
4257
|
const start = Date.now();
|
|
4098
4258
|
const pm = getPackageManager();
|
|
4099
4259
|
const result = runSteps(`${fix2 ? "Fix" : "Lint"} [${pkg}]`, [
|
|
4100
4260
|
pm.runInWorkspace(pkg, fix2 ? "package-fix" : verbose ? "package-lint-verbose" : "package-lint")
|
|
4101
4261
|
]);
|
|
4102
|
-
console.log(
|
|
4262
|
+
console.log(chalk52.gray(`${fix2 ? "Fixed in" : "Linted in"} [${chalk52.magenta(((Date.now() - start) / 1e3).toFixed(2))}] ${chalk52.gray("seconds")}`));
|
|
4103
4263
|
return result;
|
|
4104
4264
|
};
|
|
4105
4265
|
var relint = ({
|
|
@@ -4119,13 +4279,13 @@ var relint = ({
|
|
|
4119
4279
|
});
|
|
4120
4280
|
};
|
|
4121
4281
|
var relintAllPackages = ({ fix: fix2 = false } = {}) => {
|
|
4122
|
-
console.log(
|
|
4282
|
+
console.log(chalk52.gray(`${fix2 ? "Fix" : "Lint"} [All-Packages]`));
|
|
4123
4283
|
const start = Date.now();
|
|
4124
4284
|
const fixOptions = fix2 ? ["--fix"] : [];
|
|
4125
4285
|
const result = runSteps(`${fix2 ? "Fix" : "Lint"} [All-Packages]`, [
|
|
4126
4286
|
["eslint", fixOptions]
|
|
4127
4287
|
]);
|
|
4128
|
-
console.log(
|
|
4288
|
+
console.log(chalk52.gray(`${fix2 ? "Fixed in" : "Linted in"} [${chalk52.magenta(((Date.now() - start) / 1e3).toFixed(2))}] ${chalk52.gray("seconds")}`));
|
|
4129
4289
|
return result;
|
|
4130
4290
|
};
|
|
4131
4291
|
|
|
@@ -4151,10 +4311,10 @@ var sonar = () => {
|
|
|
4151
4311
|
};
|
|
4152
4312
|
|
|
4153
4313
|
// src/actions/statics.ts
|
|
4154
|
-
import
|
|
4314
|
+
import chalk53 from "chalk";
|
|
4155
4315
|
var DefaultDependencies = ["axios", "@xylabs/pixel", "react", "graphql", "react-router", "@mui/material", "@mui/system"];
|
|
4156
4316
|
var statics = () => {
|
|
4157
|
-
console.log(
|
|
4317
|
+
console.log(chalk53.green("Check Required Static Dependencies"));
|
|
4158
4318
|
const statics2 = parsedPackageJSON()?.xy?.deps?.statics;
|
|
4159
4319
|
return detectDuplicateDependencies(statics2, DefaultDependencies);
|
|
4160
4320
|
};
|
|
@@ -4586,7 +4746,7 @@ var xyCommonCommands = (args) => {
|
|
|
4586
4746
|
};
|
|
4587
4747
|
|
|
4588
4748
|
// src/xy/lint/cycleCommand.ts
|
|
4589
|
-
import
|
|
4749
|
+
import chalk54 from "chalk";
|
|
4590
4750
|
var cycleCommand = {
|
|
4591
4751
|
command: "cycle [package]",
|
|
4592
4752
|
describe: "Cycle - Check for dependency cycles",
|
|
@@ -4597,12 +4757,12 @@ var cycleCommand = {
|
|
|
4597
4757
|
const start = Date.now();
|
|
4598
4758
|
if (argv.verbose) console.log("Cycle");
|
|
4599
4759
|
process.exitCode = await cycle({ pkg: argv.package });
|
|
4600
|
-
console.log(
|
|
4760
|
+
console.log(chalk54.blue(`Finished in ${Date.now() - start}ms`));
|
|
4601
4761
|
}
|
|
4602
4762
|
};
|
|
4603
4763
|
|
|
4604
4764
|
// src/xy/lint/deplintCommand.ts
|
|
4605
|
-
import
|
|
4765
|
+
import chalk55 from "chalk";
|
|
4606
4766
|
var deplintCommand = {
|
|
4607
4767
|
command: "deplint [package]",
|
|
4608
4768
|
describe: "Deplint - Run Deplint",
|
|
@@ -4640,12 +4800,12 @@ var deplintCommand = {
|
|
|
4640
4800
|
peerDeps: !!argv.peerDeps,
|
|
4641
4801
|
verbose: !!argv.verbose
|
|
4642
4802
|
});
|
|
4643
|
-
console.log(
|
|
4803
|
+
console.log(chalk55.blue(`Finished in ${Date.now() - start}ms`));
|
|
4644
4804
|
}
|
|
4645
4805
|
};
|
|
4646
4806
|
|
|
4647
4807
|
// src/xy/lint/fixCommand.ts
|
|
4648
|
-
import
|
|
4808
|
+
import chalk56 from "chalk";
|
|
4649
4809
|
var fixCommand = {
|
|
4650
4810
|
command: "fix [package]",
|
|
4651
4811
|
describe: "Fix - Run Eslint w/fix",
|
|
@@ -4656,12 +4816,12 @@ var fixCommand = {
|
|
|
4656
4816
|
const start = Date.now();
|
|
4657
4817
|
if (argv.verbose) console.log("Fix");
|
|
4658
4818
|
process.exitCode = fix();
|
|
4659
|
-
console.log(
|
|
4819
|
+
console.log(chalk56.blue(`Finished in ${Date.now() - start}ms`));
|
|
4660
4820
|
}
|
|
4661
4821
|
};
|
|
4662
4822
|
|
|
4663
4823
|
// src/xy/lint/knipCommand.ts
|
|
4664
|
-
import
|
|
4824
|
+
import chalk57 from "chalk";
|
|
4665
4825
|
var knipCommand = {
|
|
4666
4826
|
command: "knip",
|
|
4667
4827
|
describe: "Knip - Run Knip",
|
|
@@ -4672,12 +4832,12 @@ var knipCommand = {
|
|
|
4672
4832
|
if (argv.verbose) console.log("Knip");
|
|
4673
4833
|
const start = Date.now();
|
|
4674
4834
|
process.exitCode = knip();
|
|
4675
|
-
console.log(
|
|
4835
|
+
console.log(chalk57.blue(`Knip finished in ${Date.now() - start}ms`));
|
|
4676
4836
|
}
|
|
4677
4837
|
};
|
|
4678
4838
|
|
|
4679
4839
|
// src/xy/lint/lintCommand.ts
|
|
4680
|
-
import
|
|
4840
|
+
import chalk58 from "chalk";
|
|
4681
4841
|
var lintCommand = {
|
|
4682
4842
|
command: "lint [package]",
|
|
4683
4843
|
describe: "Lint - Run Eslint",
|
|
@@ -4706,7 +4866,7 @@ var lintCommand = {
|
|
|
4706
4866
|
cache: argv.cache,
|
|
4707
4867
|
verbose: !!argv.verbose
|
|
4708
4868
|
});
|
|
4709
|
-
console.log(
|
|
4869
|
+
console.log(chalk58.blue(`Finished in ${Date.now() - start}ms`));
|
|
4710
4870
|
}
|
|
4711
4871
|
};
|
|
4712
4872
|
|
|
@@ -4748,7 +4908,7 @@ var packageLintCommand = {
|
|
|
4748
4908
|
};
|
|
4749
4909
|
|
|
4750
4910
|
// src/xy/lint/publintCommand.ts
|
|
4751
|
-
import
|
|
4911
|
+
import chalk59 from "chalk";
|
|
4752
4912
|
var publintCommand = {
|
|
4753
4913
|
command: "publint [package]",
|
|
4754
4914
|
describe: "Publint - Run Publint",
|
|
@@ -4759,12 +4919,12 @@ var publintCommand = {
|
|
|
4759
4919
|
if (argv.verbose) console.log("Publint");
|
|
4760
4920
|
const start = Date.now();
|
|
4761
4921
|
process.exitCode = await publint({ pkg: argv.package, verbose: !!argv.verbose });
|
|
4762
|
-
console.log(
|
|
4922
|
+
console.log(chalk59.blue(`Finished in ${Date.now() - start}ms`));
|
|
4763
4923
|
}
|
|
4764
4924
|
};
|
|
4765
4925
|
|
|
4766
4926
|
// src/xy/lint/relintCommand.ts
|
|
4767
|
-
import
|
|
4927
|
+
import chalk60 from "chalk";
|
|
4768
4928
|
var relintCommand = {
|
|
4769
4929
|
command: "relint [package]",
|
|
4770
4930
|
describe: "Relint - Clean & Lint",
|
|
@@ -4775,12 +4935,12 @@ var relintCommand = {
|
|
|
4775
4935
|
if (argv.verbose) console.log("Relinting");
|
|
4776
4936
|
const start = Date.now();
|
|
4777
4937
|
process.exitCode = relint();
|
|
4778
|
-
console.log(
|
|
4938
|
+
console.log(chalk60.blue(`Finished in ${Date.now() - start}ms`));
|
|
4779
4939
|
}
|
|
4780
4940
|
};
|
|
4781
4941
|
|
|
4782
4942
|
// src/xy/lint/sonarCommand.ts
|
|
4783
|
-
import
|
|
4943
|
+
import chalk61 from "chalk";
|
|
4784
4944
|
var sonarCommand = {
|
|
4785
4945
|
command: "sonar",
|
|
4786
4946
|
describe: "Sonar - Run Sonar Check",
|
|
@@ -4791,7 +4951,7 @@ var sonarCommand = {
|
|
|
4791
4951
|
const start = Date.now();
|
|
4792
4952
|
if (argv.verbose) console.log("Sonar Check");
|
|
4793
4953
|
process.exitCode = sonar();
|
|
4794
|
-
console.log(
|
|
4954
|
+
console.log(chalk61.blue(`Finished in ${Date.now() - start}ms`));
|
|
4795
4955
|
}
|
|
4796
4956
|
};
|
|
4797
4957
|
|
|
@@ -4801,7 +4961,7 @@ var xyLintCommands = (args) => {
|
|
|
4801
4961
|
};
|
|
4802
4962
|
|
|
4803
4963
|
// src/xy/xy.ts
|
|
4804
|
-
import
|
|
4964
|
+
import chalk62 from "chalk";
|
|
4805
4965
|
|
|
4806
4966
|
// src/xy/xyParseOptions.ts
|
|
4807
4967
|
import yargs from "yargs";
|
|
@@ -4844,8 +5004,8 @@ var xyBase = async (plugins) => {
|
|
|
4844
5004
|
let args = xyBuildCommands(xyCommonCommands(xyLintCommands(options)));
|
|
4845
5005
|
if (plugins) args = plugins(args);
|
|
4846
5006
|
return await args.demandCommand(1).command("*", "", () => {
|
|
4847
|
-
console.error(
|
|
4848
|
-
console.log(
|
|
5007
|
+
console.error(chalk62.yellow(`Command not found [${chalk62.magenta(process.argv[2])}]`));
|
|
5008
|
+
console.log(chalk62.gray("Try 'xy --help' for list of commands"));
|
|
4849
5009
|
}).version().help().argv;
|
|
4850
5010
|
};
|
|
4851
5011
|
export {
|