@xylabs/ts-scripts-common 7.5.2 → 7.5.4
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 +52 -5
- package/dist/actions/deplint/checkPackage/checkPackage.mjs.map +1 -1
- package/dist/actions/deplint/checkPackage/getUnlistedDependencies.mjs +17 -2
- package/dist/actions/deplint/checkPackage/getUnlistedDependencies.mjs.map +1 -1
- package/dist/actions/deplint/checkPackage/getUnlistedDevDependencies.mjs +15 -1
- package/dist/actions/deplint/checkPackage/getUnlistedDevDependencies.mjs.map +1 -1
- package/dist/actions/deplint/checkPackage/getUnusedDependencies.mjs +15 -1
- package/dist/actions/deplint/checkPackage/getUnusedDependencies.mjs.map +1 -1
- package/dist/actions/deplint/checkPackage/getUnusedDevDependencies.mjs +41 -1
- package/dist/actions/deplint/checkPackage/getUnusedDevDependencies.mjs.map +1 -1
- package/dist/actions/deplint/checkPackage/index.mjs +52 -5
- package/dist/actions/deplint/checkPackage/index.mjs.map +1 -1
- package/dist/actions/deplint/deplint.mjs +43 -5
- 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 +43 -5
- package/dist/actions/deplint/index.mjs.map +1 -1
- package/dist/actions/deplint/tsScriptsAliases.mjs +20 -0
- package/dist/actions/deplint/tsScriptsAliases.mjs.map +1 -0
- package/dist/actions/index.mjs +195 -98
- package/dist/actions/index.mjs.map +1 -1
- package/dist/actions/packman/convert.mjs +142 -83
- package/dist/actions/packman/convert.mjs.map +1 -1
- package/dist/actions/packman/convertToPnpm.mjs +94 -36
- package/dist/actions/packman/convertToPnpm.mjs.map +1 -1
- package/dist/actions/packman/convertToYarn.mjs +95 -37
- package/dist/actions/packman/convertToYarn.mjs.map +1 -1
- package/dist/actions/packman/index.mjs +142 -83
- package/dist/actions/packman/index.mjs.map +1 -1
- package/dist/actions/packman/rewriteSourceImports.mjs +60 -0
- package/dist/actions/packman/rewriteSourceImports.mjs.map +1 -0
- package/dist/bin/xy.mjs +212 -115
- package/dist/bin/xy.mjs.map +1 -1
- package/dist/index.mjs +214 -117
- package/dist/index.mjs.map +1 -1
- package/dist/xy/common/index.mjs +142 -83
- package/dist/xy/common/index.mjs.map +1 -1
- package/dist/xy/common/packmanCommand.mjs +142 -83
- package/dist/xy/common/packmanCommand.mjs.map +1 -1
- package/dist/xy/index.mjs +212 -115
- package/dist/xy/index.mjs.map +1 -1
- package/dist/xy/lint/deplintCommand.mjs +43 -5
- package/dist/xy/lint/deplintCommand.mjs.map +1 -1
- package/dist/xy/lint/index.mjs +43 -5
- package/dist/xy/lint/index.mjs.map +1 -1
- package/dist/xy/xy.mjs +212 -115
- package/dist/xy/xy.mjs.map +1 -1
- package/package.json +2 -2
package/dist/index.mjs
CHANGED
|
@@ -1614,6 +1614,24 @@ function getExternalImportsFromFiles({
|
|
|
1614
1614
|
// src/actions/deplint/checkPackage/getUnlistedDependencies.ts
|
|
1615
1615
|
import { builtinModules } from "module";
|
|
1616
1616
|
import chalk21 from "chalk";
|
|
1617
|
+
|
|
1618
|
+
// src/actions/deplint/tsScriptsAliases.ts
|
|
1619
|
+
var VARIANT_MAP = {
|
|
1620
|
+
"@xylabs/ts-scripts-yarn3": "@xylabs/ts-scripts-pnpm",
|
|
1621
|
+
"@xylabs/ts-scripts-pnpm": "@xylabs/ts-scripts-yarn3",
|
|
1622
|
+
"@xylabs/ts-scripts-react-yarn3": "@xylabs/ts-scripts-react-pnpm",
|
|
1623
|
+
"@xylabs/ts-scripts-react-pnpm": "@xylabs/ts-scripts-react-yarn3"
|
|
1624
|
+
};
|
|
1625
|
+
function isSatisfiedByTsScriptsVariant(imp, allDeps) {
|
|
1626
|
+
const variant = VARIANT_MAP[imp];
|
|
1627
|
+
return variant !== void 0 && allDeps.includes(variant);
|
|
1628
|
+
}
|
|
1629
|
+
function isUsedViaTsScriptsVariant(dep, imports) {
|
|
1630
|
+
const variant = VARIANT_MAP[dep];
|
|
1631
|
+
return variant !== void 0 && imports.includes(variant);
|
|
1632
|
+
}
|
|
1633
|
+
|
|
1634
|
+
// src/actions/deplint/checkPackage/getUnlistedDependencies.ts
|
|
1617
1635
|
function isRuntimeImportListed(imp, name, dependencies, peerDependencies) {
|
|
1618
1636
|
return dependencies.includes(imp) || imp === name || peerDependencies.includes(imp) || builtinModules.includes(imp);
|
|
1619
1637
|
}
|
|
@@ -1636,14 +1654,15 @@ function getUnlistedDependencies({ name, location }, {
|
|
|
1636
1654
|
distImportPaths
|
|
1637
1655
|
}) {
|
|
1638
1656
|
let unlistedDependencies = 0;
|
|
1657
|
+
const allDeps = [...dependencies, ...devDependencies, ...peerDependencies];
|
|
1639
1658
|
for (const imp of externalDistImports) {
|
|
1640
|
-
if (!isRuntimeImportListed(imp, name, dependencies, peerDependencies)) {
|
|
1659
|
+
if (!isRuntimeImportListed(imp, name, dependencies, peerDependencies) && !isSatisfiedByTsScriptsVariant(imp, allDeps)) {
|
|
1641
1660
|
unlistedDependencies++;
|
|
1642
1661
|
logMissing(name, imp, distImportPaths);
|
|
1643
1662
|
}
|
|
1644
1663
|
}
|
|
1645
1664
|
for (const imp of externalDistTypeImports) {
|
|
1646
|
-
if (!isTypeImportListed(imp, name, dependencies, devDependencies, peerDependencies)) {
|
|
1665
|
+
if (!isTypeImportListed(imp, name, dependencies, devDependencies, peerDependencies) && !isSatisfiedByTsScriptsVariant(imp, allDeps)) {
|
|
1647
1666
|
unlistedDependencies++;
|
|
1648
1667
|
logMissing(name, imp, distImportPaths);
|
|
1649
1668
|
}
|
|
@@ -1670,7 +1689,7 @@ function getUnlistedDevDependencies({ name, location }, {
|
|
|
1670
1689
|
}) {
|
|
1671
1690
|
let unlistedDevDependencies = 0;
|
|
1672
1691
|
for (const imp of externalAllImports) {
|
|
1673
|
-
if (!distImports.includes(imp) && imp !== name && !dependencies.includes(imp) && !dependencies.includes(`@types/${imp}`) && !peerDependencies.includes(imp) && !peerDependencies.includes(`@types/${imp}`) && !devDependencies.includes(imp) && !devDependencies.includes(`@types/${imp}`) && !builtinModules2.includes(imp)) {
|
|
1692
|
+
if (!distImports.includes(imp) && imp !== name && !dependencies.includes(imp) && !dependencies.includes(`@types/${imp}`) && !peerDependencies.includes(imp) && !peerDependencies.includes(`@types/${imp}`) && !devDependencies.includes(imp) && !devDependencies.includes(`@types/${imp}`) && !builtinModules2.includes(imp) && !isSatisfiedByTsScriptsVariant(imp, [...dependencies, ...devDependencies, ...peerDependencies])) {
|
|
1674
1693
|
unlistedDevDependencies++;
|
|
1675
1694
|
console.log(`[${chalk22.blue(name)}] Missing devDependency in package.json: ${chalk22.red(imp)}`);
|
|
1676
1695
|
if (allImportPaths[imp]) {
|
|
@@ -1696,7 +1715,7 @@ function getUnusedDependencies({ name, location }, { dependencies }, {
|
|
|
1696
1715
|
let unusedDependencies = 0;
|
|
1697
1716
|
for (const dep of dependencies) {
|
|
1698
1717
|
if (exclude?.has(dep)) continue;
|
|
1699
|
-
if (!externalDistImports.includes(dep) && !externalDistImports.includes(dep.replace(/^@types\//, "")) && !externalDistTypeImports.includes(dep) && !externalDistTypeImports.includes(dep.replace(/^@types\//, ""))) {
|
|
1718
|
+
if (!externalDistImports.includes(dep) && !externalDistImports.includes(dep.replace(/^@types\//, "")) && !externalDistTypeImports.includes(dep) && !externalDistTypeImports.includes(dep.replace(/^@types\//, "")) && !isUsedViaTsScriptsVariant(dep, [...externalDistImports, ...externalDistTypeImports])) {
|
|
1700
1719
|
unusedDependencies++;
|
|
1701
1720
|
if (externalAllImports.includes(dep)) {
|
|
1702
1721
|
console.log(`[${chalk23.blue(name)}] dependency should be devDependency in package.json: ${chalk23.red(dep)}`);
|
|
@@ -1926,6 +1945,8 @@ function hasImportPlugin({ location, allDependencies }) {
|
|
|
1926
1945
|
return false;
|
|
1927
1946
|
}
|
|
1928
1947
|
var hasVitest = ({ allDependencies }) => allDependencies.includes("vitest");
|
|
1948
|
+
var isYarnRepo = () => detectPackageManager() === "yarn";
|
|
1949
|
+
var isPnpmRepo = () => detectPackageManager() === "pnpm";
|
|
1929
1950
|
var rules = [
|
|
1930
1951
|
{
|
|
1931
1952
|
package: "typescript",
|
|
@@ -1942,6 +1963,22 @@ var rules = [
|
|
|
1942
1963
|
{
|
|
1943
1964
|
package: "@vitest/coverage-v8",
|
|
1944
1965
|
isNeeded: hasVitest
|
|
1966
|
+
},
|
|
1967
|
+
{
|
|
1968
|
+
package: "@xylabs/ts-scripts-yarn3",
|
|
1969
|
+
isNeeded: isYarnRepo
|
|
1970
|
+
},
|
|
1971
|
+
{
|
|
1972
|
+
package: "@xylabs/ts-scripts-react-yarn3",
|
|
1973
|
+
isNeeded: isYarnRepo
|
|
1974
|
+
},
|
|
1975
|
+
{
|
|
1976
|
+
package: "@xylabs/ts-scripts-pnpm",
|
|
1977
|
+
isNeeded: isPnpmRepo
|
|
1978
|
+
},
|
|
1979
|
+
{
|
|
1980
|
+
package: "@xylabs/ts-scripts-react-pnpm",
|
|
1981
|
+
isNeeded: isPnpmRepo
|
|
1945
1982
|
}
|
|
1946
1983
|
];
|
|
1947
1984
|
function getImplicitDevDependencies(context) {
|
|
@@ -1975,7 +2012,8 @@ function isDevDepUsed(dep, allImports, implicitDeps, requiredPeers, scriptRefs,
|
|
|
1975
2012
|
const baseName = dep.replace(/^@types\//, "");
|
|
1976
2013
|
return allImports.has(baseName) || allImports.has(dep) || implicitDeps.has(baseName);
|
|
1977
2014
|
}
|
|
1978
|
-
|
|
2015
|
+
if (allImports.has(dep)) return true;
|
|
2016
|
+
return isUsedViaTsScriptsVariant(dep, [...allImports]);
|
|
1979
2017
|
}
|
|
1980
2018
|
function getUnusedDevDependencies({ name, location }, {
|
|
1981
2019
|
devDependencies,
|
|
@@ -3601,24 +3639,24 @@ function packageLintMonorepo(fix2 = false) {
|
|
|
3601
3639
|
|
|
3602
3640
|
// src/actions/packman/convert.ts
|
|
3603
3641
|
import {
|
|
3604
|
-
existsSync as
|
|
3642
|
+
existsSync as existsSync16,
|
|
3605
3643
|
readdirSync as readdirSync7,
|
|
3606
|
-
readFileSync as
|
|
3644
|
+
readFileSync as readFileSync18,
|
|
3607
3645
|
statSync as statSync3
|
|
3608
3646
|
} from "fs";
|
|
3609
3647
|
import PATH15 from "path";
|
|
3610
|
-
import
|
|
3648
|
+
import chalk50 from "chalk";
|
|
3611
3649
|
|
|
3612
3650
|
// src/actions/packman/convertToPnpm.ts
|
|
3613
3651
|
import {
|
|
3614
|
-
existsSync as
|
|
3652
|
+
existsSync as existsSync14,
|
|
3615
3653
|
mkdirSync as mkdirSync5,
|
|
3616
|
-
readFileSync as
|
|
3654
|
+
readFileSync as readFileSync16,
|
|
3617
3655
|
rmSync as rmSync3,
|
|
3618
|
-
writeFileSync as
|
|
3656
|
+
writeFileSync as writeFileSync10
|
|
3619
3657
|
} from "fs";
|
|
3620
3658
|
import PATH13 from "path";
|
|
3621
|
-
import
|
|
3659
|
+
import chalk48 from "chalk";
|
|
3622
3660
|
|
|
3623
3661
|
// src/actions/packman/rewriteScripts.ts
|
|
3624
3662
|
function rewriteYarnToPnpm(script) {
|
|
@@ -3668,14 +3706,71 @@ function rewriteScriptsInPackageJson(pkg, direction) {
|
|
|
3668
3706
|
return { ...pkg, scripts: rewritten };
|
|
3669
3707
|
}
|
|
3670
3708
|
|
|
3671
|
-
// src/actions/packman/
|
|
3709
|
+
// src/actions/packman/rewriteSourceImports.ts
|
|
3672
3710
|
import {
|
|
3673
3711
|
existsSync as existsSync12,
|
|
3674
3712
|
readFileSync as readFileSync14,
|
|
3675
3713
|
writeFileSync as writeFileSync8
|
|
3676
3714
|
} from "fs";
|
|
3677
|
-
import PATH12 from "path";
|
|
3678
3715
|
import chalk46 from "chalk";
|
|
3716
|
+
import { globSync as globSync3 } from "glob";
|
|
3717
|
+
var IMPORT_SWAP_MAP = {
|
|
3718
|
+
"yarn-to-pnpm": [
|
|
3719
|
+
["@xylabs/ts-scripts-yarn3", "@xylabs/ts-scripts-pnpm"],
|
|
3720
|
+
["@xylabs/ts-scripts-react-yarn3", "@xylabs/ts-scripts-react-pnpm"]
|
|
3721
|
+
],
|
|
3722
|
+
"pnpm-to-yarn": [
|
|
3723
|
+
["@xylabs/ts-scripts-pnpm", "@xylabs/ts-scripts-yarn3"],
|
|
3724
|
+
["@xylabs/ts-scripts-react-pnpm", "@xylabs/ts-scripts-react-yarn3"]
|
|
3725
|
+
]
|
|
3726
|
+
};
|
|
3727
|
+
var SOURCE_GLOBS = [
|
|
3728
|
+
"**/*.ts",
|
|
3729
|
+
"**/*.tsx",
|
|
3730
|
+
"**/*.mts",
|
|
3731
|
+
"**/*.cts",
|
|
3732
|
+
"**/*.js",
|
|
3733
|
+
"**/*.mjs"
|
|
3734
|
+
];
|
|
3735
|
+
var IGNORE_PATTERNS = [
|
|
3736
|
+
"**/node_modules/**",
|
|
3737
|
+
"**/dist/**",
|
|
3738
|
+
"**/build/**",
|
|
3739
|
+
"**/.yarn/**"
|
|
3740
|
+
];
|
|
3741
|
+
function rewriteSourceImports(cwd5, direction) {
|
|
3742
|
+
const swaps = IMPORT_SWAP_MAP[direction];
|
|
3743
|
+
const files = globSync3(SOURCE_GLOBS, {
|
|
3744
|
+
cwd: cwd5,
|
|
3745
|
+
absolute: true,
|
|
3746
|
+
ignore: IGNORE_PATTERNS
|
|
3747
|
+
});
|
|
3748
|
+
let count = 0;
|
|
3749
|
+
for (const file of files) {
|
|
3750
|
+
if (!existsSync12(file)) continue;
|
|
3751
|
+
const original = readFileSync14(file, "utf8");
|
|
3752
|
+
let content = original;
|
|
3753
|
+
for (const [from, to] of swaps) {
|
|
3754
|
+
content = content.replaceAll(from, to);
|
|
3755
|
+
}
|
|
3756
|
+
if (content !== original) {
|
|
3757
|
+
writeFileSync8(file, content, "utf8");
|
|
3758
|
+
count++;
|
|
3759
|
+
}
|
|
3760
|
+
}
|
|
3761
|
+
if (count > 0) {
|
|
3762
|
+
console.log(chalk46.green(` Rewrote ts-scripts imports in ${count} source file(s)`));
|
|
3763
|
+
}
|
|
3764
|
+
}
|
|
3765
|
+
|
|
3766
|
+
// src/actions/packman/swapTsScriptsDependency.ts
|
|
3767
|
+
import {
|
|
3768
|
+
existsSync as existsSync13,
|
|
3769
|
+
readFileSync as readFileSync15,
|
|
3770
|
+
writeFileSync as writeFileSync9
|
|
3771
|
+
} from "fs";
|
|
3772
|
+
import PATH12 from "path";
|
|
3773
|
+
import chalk47 from "chalk";
|
|
3679
3774
|
var SWAP_MAP = {
|
|
3680
3775
|
"yarn-to-pnpm": [
|
|
3681
3776
|
["@xylabs/ts-scripts-yarn3", "@xylabs/ts-scripts-pnpm"]
|
|
@@ -3685,8 +3780,8 @@ var SWAP_MAP = {
|
|
|
3685
3780
|
]
|
|
3686
3781
|
};
|
|
3687
3782
|
function swapInPackageJson(pkgPath, direction) {
|
|
3688
|
-
if (!
|
|
3689
|
-
const raw =
|
|
3783
|
+
if (!existsSync13(pkgPath)) return false;
|
|
3784
|
+
const raw = readFileSync15(pkgPath, "utf8");
|
|
3690
3785
|
const pkg = JSON.parse(raw);
|
|
3691
3786
|
let changed = false;
|
|
3692
3787
|
for (const depField of ["dependencies", "devDependencies"]) {
|
|
@@ -3701,7 +3796,7 @@ function swapInPackageJson(pkgPath, direction) {
|
|
|
3701
3796
|
}
|
|
3702
3797
|
}
|
|
3703
3798
|
if (changed) {
|
|
3704
|
-
|
|
3799
|
+
writeFileSync9(pkgPath, JSON.stringify(pkg, null, 2) + "\n", "utf8");
|
|
3705
3800
|
}
|
|
3706
3801
|
return changed;
|
|
3707
3802
|
}
|
|
@@ -3718,7 +3813,7 @@ function swapTsScriptsDependency(cwd5, workspacePackageJsonPaths, direction) {
|
|
|
3718
3813
|
}
|
|
3719
3814
|
if (count > 0) {
|
|
3720
3815
|
const target = direction === "yarn-to-pnpm" ? "@xylabs/ts-scripts-pnpm" : "@xylabs/ts-scripts-yarn3";
|
|
3721
|
-
console.log(
|
|
3816
|
+
console.log(chalk47.green(` Swapped ts-scripts dependency to ${target} in ${count} package(s)`));
|
|
3722
3817
|
}
|
|
3723
3818
|
}
|
|
3724
3819
|
|
|
@@ -3729,13 +3824,13 @@ function createPnpmWorkspaceYaml(cwd5, workspacePatterns) {
|
|
|
3729
3824
|
for (const pattern of workspacePatterns) {
|
|
3730
3825
|
lines.push(` - '${pattern}'`);
|
|
3731
3826
|
}
|
|
3732
|
-
|
|
3733
|
-
console.log(
|
|
3827
|
+
writeFileSync10(PATH13.join(cwd5, "pnpm-workspace.yaml"), lines.join("\n") + "\n", "utf8");
|
|
3828
|
+
console.log(chalk48.green(" Created pnpm-workspace.yaml"));
|
|
3734
3829
|
}
|
|
3735
3830
|
function readPnpmWorkspacePatterns(cwd5) {
|
|
3736
3831
|
const wsPath = PATH13.join(cwd5, "pnpm-workspace.yaml");
|
|
3737
|
-
if (!
|
|
3738
|
-
const content =
|
|
3832
|
+
if (!existsSync14(wsPath)) return [];
|
|
3833
|
+
const content = readFileSync16(wsPath, "utf8");
|
|
3739
3834
|
const patterns = [];
|
|
3740
3835
|
const lines = content.split("\n");
|
|
3741
3836
|
let inPackages = false;
|
|
@@ -3755,19 +3850,19 @@ function readPnpmWorkspacePatterns(cwd5) {
|
|
|
3755
3850
|
}
|
|
3756
3851
|
function updateRootPackageJson(cwd5) {
|
|
3757
3852
|
const pkgPath = PATH13.join(cwd5, "package.json");
|
|
3758
|
-
const pkg = JSON.parse(
|
|
3853
|
+
const pkg = JSON.parse(readFileSync16(pkgPath, "utf8"));
|
|
3759
3854
|
const workspacePatterns = pkg.workspaces ?? readPnpmWorkspacePatterns(cwd5);
|
|
3760
3855
|
delete pkg.workspaces;
|
|
3761
3856
|
pkg.packageManager = `pnpm@${PNPM_VERSION}`;
|
|
3762
3857
|
const updated = rewriteScriptsInPackageJson(pkg, "yarn-to-pnpm");
|
|
3763
|
-
|
|
3764
|
-
console.log(
|
|
3858
|
+
writeFileSync10(pkgPath, JSON.stringify(updated, null, 2) + "\n", "utf8");
|
|
3859
|
+
console.log(chalk48.green(" Updated root package.json"));
|
|
3765
3860
|
return workspacePatterns;
|
|
3766
3861
|
}
|
|
3767
3862
|
function updateGitignore(cwd5) {
|
|
3768
3863
|
const gitignorePath = PATH13.join(cwd5, ".gitignore");
|
|
3769
|
-
if (!
|
|
3770
|
-
let content =
|
|
3864
|
+
if (!existsSync14(gitignorePath)) return;
|
|
3865
|
+
let content = readFileSync16(gitignorePath, "utf8");
|
|
3771
3866
|
const yarnLines = [
|
|
3772
3867
|
".pnp.*",
|
|
3773
3868
|
".pnp",
|
|
@@ -3782,64 +3877,65 @@ function updateGitignore(cwd5) {
|
|
|
3782
3877
|
content = content.replaceAll(new RegExp(String.raw`^${line.replaceAll(".", String.raw`\.`).replaceAll("*", String.raw`\*`).replaceAll("!", String.raw`\!`)}\s*$`, "gm"), "");
|
|
3783
3878
|
}
|
|
3784
3879
|
content = content.replaceAll(/\n{3,}/g, "\n\n");
|
|
3785
|
-
|
|
3786
|
-
console.log(
|
|
3880
|
+
writeFileSync10(gitignorePath, content, "utf8");
|
|
3881
|
+
console.log(chalk48.green(" Updated .gitignore"));
|
|
3787
3882
|
}
|
|
3788
3883
|
function deleteYarnArtifacts(cwd5) {
|
|
3789
3884
|
const yarnLock = PATH13.join(cwd5, "yarn.lock");
|
|
3790
3885
|
const yarnrc = PATH13.join(cwd5, ".yarnrc.yml");
|
|
3791
3886
|
const yarnDir = PATH13.join(cwd5, ".yarn");
|
|
3792
|
-
if (
|
|
3887
|
+
if (existsSync14(yarnLock)) {
|
|
3793
3888
|
rmSync3(yarnLock);
|
|
3794
|
-
console.log(
|
|
3889
|
+
console.log(chalk48.gray(" Deleted yarn.lock"));
|
|
3795
3890
|
}
|
|
3796
|
-
if (
|
|
3891
|
+
if (existsSync14(yarnrc)) {
|
|
3797
3892
|
rmSync3(yarnrc);
|
|
3798
|
-
console.log(
|
|
3893
|
+
console.log(chalk48.gray(" Deleted .yarnrc.yml"));
|
|
3799
3894
|
}
|
|
3800
|
-
if (
|
|
3895
|
+
if (existsSync14(yarnDir)) {
|
|
3801
3896
|
rmSync3(yarnDir, { force: true, recursive: true });
|
|
3802
|
-
console.log(
|
|
3897
|
+
console.log(chalk48.gray(" Deleted .yarn/"));
|
|
3803
3898
|
}
|
|
3804
3899
|
}
|
|
3805
3900
|
function createNpmrc(cwd5) {
|
|
3806
3901
|
const npmrcPath = PATH13.join(cwd5, ".npmrc");
|
|
3807
|
-
if (
|
|
3902
|
+
if (existsSync14(npmrcPath)) return;
|
|
3808
3903
|
mkdirSync5(PATH13.dirname(npmrcPath), { recursive: true });
|
|
3809
|
-
|
|
3810
|
-
console.log(
|
|
3904
|
+
writeFileSync10(npmrcPath, "", "utf8");
|
|
3905
|
+
console.log(chalk48.green(" Created .npmrc"));
|
|
3811
3906
|
}
|
|
3812
3907
|
function convertToPnpm(cwd5, workspacePackageJsonPaths) {
|
|
3813
|
-
console.log(
|
|
3908
|
+
console.log(chalk48.blue("\nConverting to pnpm...\n"));
|
|
3814
3909
|
const workspacePatterns = updateRootPackageJson(cwd5);
|
|
3815
3910
|
createPnpmWorkspaceYaml(cwd5, workspacePatterns);
|
|
3816
3911
|
for (const pkgPath of workspacePackageJsonPaths) {
|
|
3817
3912
|
const fullPath = PATH13.resolve(cwd5, pkgPath, "package.json");
|
|
3818
|
-
if (!
|
|
3819
|
-
const pkg = JSON.parse(
|
|
3913
|
+
if (!existsSync14(fullPath)) continue;
|
|
3914
|
+
const pkg = JSON.parse(readFileSync16(fullPath, "utf8"));
|
|
3820
3915
|
const updated = rewriteScriptsInPackageJson(pkg, "yarn-to-pnpm");
|
|
3821
3916
|
if (JSON.stringify(pkg) !== JSON.stringify(updated)) {
|
|
3822
|
-
|
|
3917
|
+
writeFileSync10(fullPath, JSON.stringify(updated, null, 2) + "\n", "utf8");
|
|
3823
3918
|
}
|
|
3824
3919
|
}
|
|
3825
|
-
console.log(
|
|
3920
|
+
console.log(chalk48.green(` Rewrote scripts in ${workspacePackageJsonPaths.length} workspace package(s)`));
|
|
3826
3921
|
updateGitignore(cwd5);
|
|
3827
3922
|
createNpmrc(cwd5);
|
|
3828
3923
|
swapTsScriptsDependency(cwd5, workspacePackageJsonPaths, "yarn-to-pnpm");
|
|
3924
|
+
rewriteSourceImports(cwd5, "yarn-to-pnpm");
|
|
3829
3925
|
deleteYarnArtifacts(cwd5);
|
|
3830
|
-
console.log(
|
|
3926
|
+
console.log(chalk48.blue("\nConversion complete. Run `pnpm install` to generate pnpm-lock.yaml.\n"));
|
|
3831
3927
|
return 0;
|
|
3832
3928
|
}
|
|
3833
3929
|
|
|
3834
3930
|
// src/actions/packman/convertToYarn.ts
|
|
3835
3931
|
import {
|
|
3836
|
-
existsSync as
|
|
3837
|
-
readFileSync as
|
|
3932
|
+
existsSync as existsSync15,
|
|
3933
|
+
readFileSync as readFileSync17,
|
|
3838
3934
|
rmSync as rmSync4,
|
|
3839
|
-
writeFileSync as
|
|
3935
|
+
writeFileSync as writeFileSync11
|
|
3840
3936
|
} from "fs";
|
|
3841
3937
|
import PATH14 from "path";
|
|
3842
|
-
import
|
|
3938
|
+
import chalk49 from "chalk";
|
|
3843
3939
|
var YARN_VERSION = "4.13.0";
|
|
3844
3940
|
var YARNRC_TEMPLATE = `compressionLevel: mixed
|
|
3845
3941
|
|
|
@@ -3862,8 +3958,8 @@ var YARN_GITIGNORE_ENTRIES = `
|
|
|
3862
3958
|
`;
|
|
3863
3959
|
function readPnpmWorkspacePatterns2(cwd5) {
|
|
3864
3960
|
const wsPath = PATH14.join(cwd5, "pnpm-workspace.yaml");
|
|
3865
|
-
if (!
|
|
3866
|
-
const content =
|
|
3961
|
+
if (!existsSync15(wsPath)) return [];
|
|
3962
|
+
const content = readFileSync17(wsPath, "utf8");
|
|
3867
3963
|
const patterns = [];
|
|
3868
3964
|
const lines = content.split("\n");
|
|
3869
3965
|
let inPackages = false;
|
|
@@ -3883,102 +3979,103 @@ function readPnpmWorkspacePatterns2(cwd5) {
|
|
|
3883
3979
|
}
|
|
3884
3980
|
function updateRootPackageJson2(cwd5, workspacePatterns) {
|
|
3885
3981
|
const pkgPath = PATH14.join(cwd5, "package.json");
|
|
3886
|
-
const pkg = JSON.parse(
|
|
3982
|
+
const pkg = JSON.parse(readFileSync17(pkgPath, "utf8"));
|
|
3887
3983
|
pkg.workspaces = workspacePatterns;
|
|
3888
3984
|
pkg.packageManager = `yarn@${YARN_VERSION}`;
|
|
3889
3985
|
const updated = rewriteScriptsInPackageJson(pkg, "pnpm-to-yarn");
|
|
3890
|
-
|
|
3891
|
-
console.log(
|
|
3986
|
+
writeFileSync11(pkgPath, JSON.stringify(updated, null, 2) + "\n", "utf8");
|
|
3987
|
+
console.log(chalk49.green(" Updated root package.json"));
|
|
3892
3988
|
}
|
|
3893
3989
|
function updateGitignore2(cwd5) {
|
|
3894
3990
|
const gitignorePath = PATH14.join(cwd5, ".gitignore");
|
|
3895
|
-
let content =
|
|
3991
|
+
let content = existsSync15(gitignorePath) ? readFileSync17(gitignorePath, "utf8") : "";
|
|
3896
3992
|
if (!content.includes(".yarn/*")) {
|
|
3897
3993
|
content = content.trimEnd() + "\n" + YARN_GITIGNORE_ENTRIES;
|
|
3898
3994
|
}
|
|
3899
|
-
|
|
3900
|
-
console.log(
|
|
3995
|
+
writeFileSync11(gitignorePath, content, "utf8");
|
|
3996
|
+
console.log(chalk49.green(" Updated .gitignore"));
|
|
3901
3997
|
}
|
|
3902
3998
|
function deletePnpmArtifacts(cwd5) {
|
|
3903
3999
|
const lockfile = PATH14.join(cwd5, "pnpm-lock.yaml");
|
|
3904
4000
|
const workspaceYaml = PATH14.join(cwd5, "pnpm-workspace.yaml");
|
|
3905
4001
|
const npmrc = PATH14.join(cwd5, ".npmrc");
|
|
3906
|
-
if (
|
|
4002
|
+
if (existsSync15(lockfile)) {
|
|
3907
4003
|
rmSync4(lockfile);
|
|
3908
|
-
console.log(
|
|
4004
|
+
console.log(chalk49.gray(" Deleted pnpm-lock.yaml"));
|
|
3909
4005
|
}
|
|
3910
|
-
if (
|
|
4006
|
+
if (existsSync15(workspaceYaml)) {
|
|
3911
4007
|
rmSync4(workspaceYaml);
|
|
3912
|
-
console.log(
|
|
4008
|
+
console.log(chalk49.gray(" Deleted pnpm-workspace.yaml"));
|
|
3913
4009
|
}
|
|
3914
|
-
if (
|
|
3915
|
-
const content =
|
|
4010
|
+
if (existsSync15(npmrc)) {
|
|
4011
|
+
const content = readFileSync17(npmrc, "utf8");
|
|
3916
4012
|
if (content.trim() === "" || content.includes("shamefully-hoist") || content.includes("node-linker")) {
|
|
3917
4013
|
rmSync4(npmrc);
|
|
3918
|
-
console.log(
|
|
4014
|
+
console.log(chalk49.gray(" Deleted .npmrc"));
|
|
3919
4015
|
}
|
|
3920
4016
|
}
|
|
3921
4017
|
}
|
|
3922
4018
|
function createYarnrc(cwd5) {
|
|
3923
4019
|
const yarnrcPath = PATH14.join(cwd5, ".yarnrc.yml");
|
|
3924
|
-
if (
|
|
3925
|
-
|
|
3926
|
-
console.log(
|
|
4020
|
+
if (existsSync15(yarnrcPath)) return;
|
|
4021
|
+
writeFileSync11(yarnrcPath, YARNRC_TEMPLATE, "utf8");
|
|
4022
|
+
console.log(chalk49.green(" Created .yarnrc.yml"));
|
|
3927
4023
|
}
|
|
3928
4024
|
function readWorkspacePatternsFromPackageJson(cwd5) {
|
|
3929
4025
|
const pkgPath = PATH14.join(cwd5, "package.json");
|
|
3930
|
-
if (!
|
|
3931
|
-
const pkg = JSON.parse(
|
|
4026
|
+
if (!existsSync15(pkgPath)) return [];
|
|
4027
|
+
const pkg = JSON.parse(readFileSync17(pkgPath, "utf8"));
|
|
3932
4028
|
return pkg.workspaces ?? [];
|
|
3933
4029
|
}
|
|
3934
4030
|
function convertToYarn(cwd5, workspacePackageJsonPaths) {
|
|
3935
|
-
console.log(
|
|
4031
|
+
console.log(chalk49.blue("\nConverting to yarn...\n"));
|
|
3936
4032
|
const workspacePatterns = readPnpmWorkspacePatterns2(cwd5);
|
|
3937
4033
|
if (workspacePatterns.length === 0) {
|
|
3938
4034
|
const fromPkg = readWorkspacePatternsFromPackageJson(cwd5);
|
|
3939
4035
|
if (fromPkg.length > 0) {
|
|
3940
4036
|
workspacePatterns.push(...fromPkg);
|
|
3941
4037
|
} else {
|
|
3942
|
-
console.warn(
|
|
4038
|
+
console.warn(chalk49.yellow(" No workspace patterns found"));
|
|
3943
4039
|
}
|
|
3944
4040
|
}
|
|
3945
4041
|
updateRootPackageJson2(cwd5, workspacePatterns);
|
|
3946
4042
|
for (const pkgPath of workspacePackageJsonPaths) {
|
|
3947
4043
|
const fullPath = PATH14.resolve(cwd5, pkgPath, "package.json");
|
|
3948
|
-
if (!
|
|
3949
|
-
const pkg = JSON.parse(
|
|
4044
|
+
if (!existsSync15(fullPath)) continue;
|
|
4045
|
+
const pkg = JSON.parse(readFileSync17(fullPath, "utf8"));
|
|
3950
4046
|
const updated = rewriteScriptsInPackageJson(pkg, "pnpm-to-yarn");
|
|
3951
4047
|
if (JSON.stringify(pkg) !== JSON.stringify(updated)) {
|
|
3952
|
-
|
|
4048
|
+
writeFileSync11(fullPath, JSON.stringify(updated, null, 2) + "\n", "utf8");
|
|
3953
4049
|
}
|
|
3954
4050
|
}
|
|
3955
|
-
console.log(
|
|
4051
|
+
console.log(chalk49.green(` Rewrote scripts in ${workspacePackageJsonPaths.length} workspace package(s)`));
|
|
3956
4052
|
updateGitignore2(cwd5);
|
|
3957
4053
|
createYarnrc(cwd5);
|
|
3958
4054
|
swapTsScriptsDependency(cwd5, workspacePackageJsonPaths, "pnpm-to-yarn");
|
|
4055
|
+
rewriteSourceImports(cwd5, "pnpm-to-yarn");
|
|
3959
4056
|
deletePnpmArtifacts(cwd5);
|
|
3960
|
-
console.log(
|
|
4057
|
+
console.log(chalk49.blue("\nConversion complete. Run `corepack enable yarn && yarn set version stable && yarn install` to finish setup.\n"));
|
|
3961
4058
|
return 0;
|
|
3962
4059
|
}
|
|
3963
4060
|
|
|
3964
4061
|
// src/actions/packman/convert.ts
|
|
3965
4062
|
function detectCurrentPM(cwd5) {
|
|
3966
|
-
if (
|
|
4063
|
+
if (existsSync16(PATH15.join(cwd5, "pnpm-lock.yaml")) || existsSync16(PATH15.join(cwd5, "pnpm-workspace.yaml"))) {
|
|
3967
4064
|
return "pnpm";
|
|
3968
4065
|
}
|
|
3969
|
-
if (
|
|
4066
|
+
if (existsSync16(PATH15.join(cwd5, "yarn.lock")) || existsSync16(PATH15.join(cwd5, ".yarnrc.yml"))) {
|
|
3970
4067
|
return "yarn";
|
|
3971
4068
|
}
|
|
3972
4069
|
return "unknown";
|
|
3973
4070
|
}
|
|
3974
4071
|
function findWorkspacePackagePaths(cwd5) {
|
|
3975
4072
|
const pkgPath = PATH15.join(cwd5, "package.json");
|
|
3976
|
-
const pkg = JSON.parse(
|
|
4073
|
+
const pkg = JSON.parse(readFileSync18(pkgPath, "utf8"));
|
|
3977
4074
|
let patterns = pkg.workspaces ?? [];
|
|
3978
4075
|
if (patterns.length === 0) {
|
|
3979
4076
|
const wsPath = PATH15.join(cwd5, "pnpm-workspace.yaml");
|
|
3980
|
-
if (
|
|
3981
|
-
const content =
|
|
4077
|
+
if (existsSync16(wsPath)) {
|
|
4078
|
+
const content = readFileSync18(wsPath, "utf8");
|
|
3982
4079
|
const lines = content.split("\n");
|
|
3983
4080
|
let inPackages = false;
|
|
3984
4081
|
for (const line of lines) {
|
|
@@ -4009,14 +4106,14 @@ function resolveWorkspaceGlob(cwd5, pattern) {
|
|
|
4009
4106
|
function walkGlob(basePath, parts, currentPath) {
|
|
4010
4107
|
if (parts.length === 0) {
|
|
4011
4108
|
const fullPath = PATH15.join(basePath, currentPath);
|
|
4012
|
-
if (
|
|
4109
|
+
if (existsSync16(PATH15.join(fullPath, "package.json"))) {
|
|
4013
4110
|
return [currentPath];
|
|
4014
4111
|
}
|
|
4015
4112
|
return [];
|
|
4016
4113
|
}
|
|
4017
4114
|
const [part, ...rest] = parts;
|
|
4018
4115
|
const dirPath = PATH15.join(basePath, currentPath);
|
|
4019
|
-
if (!
|
|
4116
|
+
if (!existsSync16(dirPath) || !statSync3(dirPath).isDirectory()) {
|
|
4020
4117
|
return [];
|
|
4021
4118
|
}
|
|
4022
4119
|
if (part === "*" || part === "**") {
|
|
@@ -4044,25 +4141,25 @@ function walkGlob(basePath, parts, currentPath) {
|
|
|
4044
4141
|
function convert({ target, verbose }) {
|
|
4045
4142
|
const validTargets = ["pnpm", "yarn"];
|
|
4046
4143
|
if (!validTargets.includes(target)) {
|
|
4047
|
-
console.error(
|
|
4144
|
+
console.error(chalk50.red(`Invalid target "${target}". Must be one of: ${validTargets.join(", ")}`));
|
|
4048
4145
|
return 1;
|
|
4049
4146
|
}
|
|
4050
4147
|
const cwd5 = process.cwd();
|
|
4051
4148
|
const currentPM = detectCurrentPM(cwd5);
|
|
4052
4149
|
if (verbose) {
|
|
4053
|
-
console.log(
|
|
4054
|
-
console.log(
|
|
4150
|
+
console.log(chalk50.gray(`Current package manager: ${currentPM}`));
|
|
4151
|
+
console.log(chalk50.gray(`Target package manager: ${target}`));
|
|
4055
4152
|
}
|
|
4056
4153
|
if (currentPM === target) {
|
|
4057
|
-
console.log(
|
|
4154
|
+
console.log(chalk50.yellow(`Already using ${target}. Re-applying conversion to fix any incomplete steps...`));
|
|
4058
4155
|
}
|
|
4059
4156
|
if (currentPM === "unknown") {
|
|
4060
|
-
console.error(
|
|
4157
|
+
console.error(chalk50.red("Could not detect current package manager. No yarn.lock or pnpm-lock.yaml found."));
|
|
4061
4158
|
return 1;
|
|
4062
4159
|
}
|
|
4063
4160
|
const workspacePaths = findWorkspacePackagePaths(cwd5);
|
|
4064
4161
|
if (verbose) {
|
|
4065
|
-
console.log(
|
|
4162
|
+
console.log(chalk50.gray(`Found ${workspacePaths.length} workspace packages`));
|
|
4066
4163
|
}
|
|
4067
4164
|
if (target === "pnpm") {
|
|
4068
4165
|
return convertToPnpm(cwd5, workspacePaths);
|
|
@@ -4120,7 +4217,7 @@ var rebuild = ({ target }) => {
|
|
|
4120
4217
|
};
|
|
4121
4218
|
|
|
4122
4219
|
// src/actions/recompile.ts
|
|
4123
|
-
import
|
|
4220
|
+
import chalk51 from "chalk";
|
|
4124
4221
|
var recompile = async ({
|
|
4125
4222
|
verbose,
|
|
4126
4223
|
target,
|
|
@@ -4155,7 +4252,7 @@ var recompileAll = async ({
|
|
|
4155
4252
|
const start = Date.now();
|
|
4156
4253
|
const targetOptions = target ? ["-t", target] : [];
|
|
4157
4254
|
if (jobs) {
|
|
4158
|
-
console.log(
|
|
4255
|
+
console.log(chalk51.blue(`Jobs set to [${jobs}]`));
|
|
4159
4256
|
}
|
|
4160
4257
|
const foreachOptions = {
|
|
4161
4258
|
incremental,
|
|
@@ -4168,25 +4265,25 @@ var recompileAll = async ({
|
|
|
4168
4265
|
pm.foreachWorkspace("package-compile", targetOptions, foreachOptions)
|
|
4169
4266
|
]);
|
|
4170
4267
|
console.log(
|
|
4171
|
-
`${
|
|
4268
|
+
`${chalk51.gray("Recompiled in")} [${chalk51.magenta(((Date.now() - start) / 1e3).toFixed(2))}] ${chalk51.gray("seconds")}`
|
|
4172
4269
|
);
|
|
4173
4270
|
return result;
|
|
4174
4271
|
};
|
|
4175
4272
|
|
|
4176
4273
|
// src/actions/relint.ts
|
|
4177
|
-
import
|
|
4274
|
+
import chalk52 from "chalk";
|
|
4178
4275
|
var relintPackage = ({
|
|
4179
4276
|
pkg,
|
|
4180
4277
|
fix: fix2,
|
|
4181
4278
|
verbose
|
|
4182
4279
|
}) => {
|
|
4183
|
-
console.log(
|
|
4280
|
+
console.log(chalk52.gray(`${fix2 ? "Fix" : "Lint"} [${pkg}]`));
|
|
4184
4281
|
const start = Date.now();
|
|
4185
4282
|
const pm = getPackageManager();
|
|
4186
4283
|
const result = runSteps(`${fix2 ? "Fix" : "Lint"} [${pkg}]`, [
|
|
4187
4284
|
pm.runInWorkspace(pkg, fix2 ? "package-fix" : verbose ? "package-lint-verbose" : "package-lint")
|
|
4188
4285
|
]);
|
|
4189
|
-
console.log(
|
|
4286
|
+
console.log(chalk52.gray(`${fix2 ? "Fixed in" : "Linted in"} [${chalk52.magenta(((Date.now() - start) / 1e3).toFixed(2))}] ${chalk52.gray("seconds")}`));
|
|
4190
4287
|
return result;
|
|
4191
4288
|
};
|
|
4192
4289
|
var relint = ({
|
|
@@ -4206,13 +4303,13 @@ var relint = ({
|
|
|
4206
4303
|
});
|
|
4207
4304
|
};
|
|
4208
4305
|
var relintAllPackages = ({ fix: fix2 = false } = {}) => {
|
|
4209
|
-
console.log(
|
|
4306
|
+
console.log(chalk52.gray(`${fix2 ? "Fix" : "Lint"} [All-Packages]`));
|
|
4210
4307
|
const start = Date.now();
|
|
4211
4308
|
const fixOptions = fix2 ? ["--fix"] : [];
|
|
4212
4309
|
const result = runSteps(`${fix2 ? "Fix" : "Lint"} [All-Packages]`, [
|
|
4213
4310
|
["eslint", fixOptions]
|
|
4214
4311
|
]);
|
|
4215
|
-
console.log(
|
|
4312
|
+
console.log(chalk52.gray(`${fix2 ? "Fixed in" : "Linted in"} [${chalk52.magenta(((Date.now() - start) / 1e3).toFixed(2))}] ${chalk52.gray("seconds")}`));
|
|
4216
4313
|
return result;
|
|
4217
4314
|
};
|
|
4218
4315
|
|
|
@@ -4238,10 +4335,10 @@ var sonar = () => {
|
|
|
4238
4335
|
};
|
|
4239
4336
|
|
|
4240
4337
|
// src/actions/statics.ts
|
|
4241
|
-
import
|
|
4338
|
+
import chalk53 from "chalk";
|
|
4242
4339
|
var DefaultDependencies = ["axios", "@xylabs/pixel", "react", "graphql", "react-router", "@mui/material", "@mui/system"];
|
|
4243
4340
|
var statics = () => {
|
|
4244
|
-
console.log(
|
|
4341
|
+
console.log(chalk53.green("Check Required Static Dependencies"));
|
|
4245
4342
|
const statics2 = parsedPackageJSON()?.xy?.deps?.statics;
|
|
4246
4343
|
return detectDuplicateDependencies(statics2, DefaultDependencies);
|
|
4247
4344
|
};
|
|
@@ -4673,7 +4770,7 @@ var xyCommonCommands = (args) => {
|
|
|
4673
4770
|
};
|
|
4674
4771
|
|
|
4675
4772
|
// src/xy/lint/cycleCommand.ts
|
|
4676
|
-
import
|
|
4773
|
+
import chalk54 from "chalk";
|
|
4677
4774
|
var cycleCommand = {
|
|
4678
4775
|
command: "cycle [package]",
|
|
4679
4776
|
describe: "Cycle - Check for dependency cycles",
|
|
@@ -4684,12 +4781,12 @@ var cycleCommand = {
|
|
|
4684
4781
|
const start = Date.now();
|
|
4685
4782
|
if (argv.verbose) console.log("Cycle");
|
|
4686
4783
|
process.exitCode = await cycle({ pkg: argv.package });
|
|
4687
|
-
console.log(
|
|
4784
|
+
console.log(chalk54.blue(`Finished in ${Date.now() - start}ms`));
|
|
4688
4785
|
}
|
|
4689
4786
|
};
|
|
4690
4787
|
|
|
4691
4788
|
// src/xy/lint/deplintCommand.ts
|
|
4692
|
-
import
|
|
4789
|
+
import chalk55 from "chalk";
|
|
4693
4790
|
var deplintCommand = {
|
|
4694
4791
|
command: "deplint [package]",
|
|
4695
4792
|
describe: "Deplint - Run Deplint",
|
|
@@ -4727,12 +4824,12 @@ var deplintCommand = {
|
|
|
4727
4824
|
peerDeps: !!argv.peerDeps,
|
|
4728
4825
|
verbose: !!argv.verbose
|
|
4729
4826
|
});
|
|
4730
|
-
console.log(
|
|
4827
|
+
console.log(chalk55.blue(`Finished in ${Date.now() - start}ms`));
|
|
4731
4828
|
}
|
|
4732
4829
|
};
|
|
4733
4830
|
|
|
4734
4831
|
// src/xy/lint/fixCommand.ts
|
|
4735
|
-
import
|
|
4832
|
+
import chalk56 from "chalk";
|
|
4736
4833
|
var fixCommand = {
|
|
4737
4834
|
command: "fix [package]",
|
|
4738
4835
|
describe: "Fix - Run Eslint w/fix",
|
|
@@ -4743,12 +4840,12 @@ var fixCommand = {
|
|
|
4743
4840
|
const start = Date.now();
|
|
4744
4841
|
if (argv.verbose) console.log("Fix");
|
|
4745
4842
|
process.exitCode = fix();
|
|
4746
|
-
console.log(
|
|
4843
|
+
console.log(chalk56.blue(`Finished in ${Date.now() - start}ms`));
|
|
4747
4844
|
}
|
|
4748
4845
|
};
|
|
4749
4846
|
|
|
4750
4847
|
// src/xy/lint/knipCommand.ts
|
|
4751
|
-
import
|
|
4848
|
+
import chalk57 from "chalk";
|
|
4752
4849
|
var knipCommand = {
|
|
4753
4850
|
command: "knip",
|
|
4754
4851
|
describe: "Knip - Run Knip",
|
|
@@ -4759,12 +4856,12 @@ var knipCommand = {
|
|
|
4759
4856
|
if (argv.verbose) console.log("Knip");
|
|
4760
4857
|
const start = Date.now();
|
|
4761
4858
|
process.exitCode = knip();
|
|
4762
|
-
console.log(
|
|
4859
|
+
console.log(chalk57.blue(`Knip finished in ${Date.now() - start}ms`));
|
|
4763
4860
|
}
|
|
4764
4861
|
};
|
|
4765
4862
|
|
|
4766
4863
|
// src/xy/lint/lintCommand.ts
|
|
4767
|
-
import
|
|
4864
|
+
import chalk58 from "chalk";
|
|
4768
4865
|
var lintCommand = {
|
|
4769
4866
|
command: "lint [package]",
|
|
4770
4867
|
describe: "Lint - Run Eslint",
|
|
@@ -4793,7 +4890,7 @@ var lintCommand = {
|
|
|
4793
4890
|
cache: argv.cache,
|
|
4794
4891
|
verbose: !!argv.verbose
|
|
4795
4892
|
});
|
|
4796
|
-
console.log(
|
|
4893
|
+
console.log(chalk58.blue(`Finished in ${Date.now() - start}ms`));
|
|
4797
4894
|
}
|
|
4798
4895
|
};
|
|
4799
4896
|
|
|
@@ -4835,7 +4932,7 @@ var packageLintCommand = {
|
|
|
4835
4932
|
};
|
|
4836
4933
|
|
|
4837
4934
|
// src/xy/lint/publintCommand.ts
|
|
4838
|
-
import
|
|
4935
|
+
import chalk59 from "chalk";
|
|
4839
4936
|
var publintCommand = {
|
|
4840
4937
|
command: "publint [package]",
|
|
4841
4938
|
describe: "Publint - Run Publint",
|
|
@@ -4846,12 +4943,12 @@ var publintCommand = {
|
|
|
4846
4943
|
if (argv.verbose) console.log("Publint");
|
|
4847
4944
|
const start = Date.now();
|
|
4848
4945
|
process.exitCode = await publint({ pkg: argv.package, verbose: !!argv.verbose });
|
|
4849
|
-
console.log(
|
|
4946
|
+
console.log(chalk59.blue(`Finished in ${Date.now() - start}ms`));
|
|
4850
4947
|
}
|
|
4851
4948
|
};
|
|
4852
4949
|
|
|
4853
4950
|
// src/xy/lint/relintCommand.ts
|
|
4854
|
-
import
|
|
4951
|
+
import chalk60 from "chalk";
|
|
4855
4952
|
var relintCommand = {
|
|
4856
4953
|
command: "relint [package]",
|
|
4857
4954
|
describe: "Relint - Clean & Lint",
|
|
@@ -4862,12 +4959,12 @@ var relintCommand = {
|
|
|
4862
4959
|
if (argv.verbose) console.log("Relinting");
|
|
4863
4960
|
const start = Date.now();
|
|
4864
4961
|
process.exitCode = relint();
|
|
4865
|
-
console.log(
|
|
4962
|
+
console.log(chalk60.blue(`Finished in ${Date.now() - start}ms`));
|
|
4866
4963
|
}
|
|
4867
4964
|
};
|
|
4868
4965
|
|
|
4869
4966
|
// src/xy/lint/sonarCommand.ts
|
|
4870
|
-
import
|
|
4967
|
+
import chalk61 from "chalk";
|
|
4871
4968
|
var sonarCommand = {
|
|
4872
4969
|
command: "sonar",
|
|
4873
4970
|
describe: "Sonar - Run Sonar Check",
|
|
@@ -4878,7 +4975,7 @@ var sonarCommand = {
|
|
|
4878
4975
|
const start = Date.now();
|
|
4879
4976
|
if (argv.verbose) console.log("Sonar Check");
|
|
4880
4977
|
process.exitCode = sonar();
|
|
4881
|
-
console.log(
|
|
4978
|
+
console.log(chalk61.blue(`Finished in ${Date.now() - start}ms`));
|
|
4882
4979
|
}
|
|
4883
4980
|
};
|
|
4884
4981
|
|
|
@@ -4888,7 +4985,7 @@ var xyLintCommands = (args) => {
|
|
|
4888
4985
|
};
|
|
4889
4986
|
|
|
4890
4987
|
// src/xy/xy.ts
|
|
4891
|
-
import
|
|
4988
|
+
import chalk62 from "chalk";
|
|
4892
4989
|
|
|
4893
4990
|
// src/xy/xyParseOptions.ts
|
|
4894
4991
|
import yargs from "yargs";
|
|
@@ -4931,8 +5028,8 @@ var xyBase = async (plugins) => {
|
|
|
4931
5028
|
let args = xyBuildCommands(xyCommonCommands(xyLintCommands(options)));
|
|
4932
5029
|
if (plugins) args = plugins(args);
|
|
4933
5030
|
return await args.demandCommand(1).command("*", "", () => {
|
|
4934
|
-
console.error(
|
|
4935
|
-
console.log(
|
|
5031
|
+
console.error(chalk62.yellow(`Command not found [${chalk62.magenta(process.argv[2])}]`));
|
|
5032
|
+
console.log(chalk62.gray("Try 'xy --help' for list of commands"));
|
|
4936
5033
|
}).version().help().argv;
|
|
4937
5034
|
};
|
|
4938
5035
|
export {
|