@xylabs/ts-scripts-yarn3 7.3.2 → 7.4.0
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/cycle.mjs +1 -1
- package/dist/actions/cycle.mjs.map +1 -1
- package/dist/actions/deplint/checkPackage/checkPackage.mjs +278 -35
- package/dist/actions/deplint/checkPackage/checkPackage.mjs.map +1 -1
- package/dist/actions/deplint/checkPackage/getUnlistedDependencies.mjs +13 -6
- package/dist/actions/deplint/checkPackage/getUnlistedDependencies.mjs.map +1 -1
- package/dist/actions/deplint/checkPackage/getUnlistedDevDependencies.mjs +3 -1
- package/dist/actions/deplint/checkPackage/getUnlistedDevDependencies.mjs.map +1 -1
- package/dist/actions/deplint/checkPackage/getUnusedDevDependencies.mjs +175 -0
- package/dist/actions/deplint/checkPackage/getUnusedDevDependencies.mjs.map +1 -0
- package/dist/actions/deplint/checkPackage/index.mjs +278 -35
- package/dist/actions/deplint/checkPackage/index.mjs.map +1 -1
- package/dist/actions/deplint/deplint.mjs +281 -38
- package/dist/actions/deplint/deplint.mjs.map +1 -1
- package/dist/actions/deplint/findFiles.mjs +8 -2
- package/dist/actions/deplint/findFiles.mjs.map +1 -1
- package/dist/actions/deplint/getExtendsFromTsconfigs.mjs +44 -0
- package/dist/actions/deplint/getExtendsFromTsconfigs.mjs.map +1 -0
- package/dist/actions/deplint/getExternalImportsFromFiles.mjs +15 -1
- package/dist/actions/deplint/getExternalImportsFromFiles.mjs.map +1 -1
- package/dist/actions/deplint/getRequiredPeerDependencies.mjs +36 -0
- package/dist/actions/deplint/getRequiredPeerDependencies.mjs.map +1 -0
- package/dist/actions/deplint/getScriptReferencedPackages.mjs +81 -0
- package/dist/actions/deplint/getScriptReferencedPackages.mjs.map +1 -0
- package/dist/actions/deplint/implicitDevDependencies.mjs +25 -0
- package/dist/actions/deplint/implicitDevDependencies.mjs.map +1 -0
- package/dist/actions/deplint/index.mjs +281 -38
- package/dist/actions/deplint/index.mjs.map +1 -1
- package/dist/actions/index.mjs +385 -142
- package/dist/actions/index.mjs.map +1 -1
- package/dist/bin/xy.mjs +328 -85
- package/dist/bin/xy.mjs.map +1 -1
- package/dist/index.mjs +397 -154
- package/dist/index.mjs.map +1 -1
- package/dist/xy/index.mjs +328 -85
- package/dist/xy/index.mjs.map +1 -1
- package/dist/xy/xy.mjs +328 -85
- package/dist/xy/xy.mjs.map +1 -1
- package/dist/xy/xyLintCommands.mjs +301 -58
- package/dist/xy/xyLintCommands.mjs.map +1 -1
- package/package.json +15 -16
package/dist/bin/xy.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
3
|
// src/xy/xy.ts
|
|
4
|
-
import
|
|
4
|
+
import chalk26 from "chalk";
|
|
5
5
|
|
|
6
6
|
// src/actions/build.ts
|
|
7
7
|
import chalk7 from "chalk";
|
|
@@ -299,8 +299,8 @@ var generateIgnoreFiles = (filename3, pkg) => {
|
|
|
299
299
|
|
|
300
300
|
// src/lib/parsedPackageJSON.ts
|
|
301
301
|
import { readFileSync as readFileSync2 } from "fs";
|
|
302
|
-
var parsedPackageJSON = (
|
|
303
|
-
const pathToPackageJSON =
|
|
302
|
+
var parsedPackageJSON = (path7) => {
|
|
303
|
+
const pathToPackageJSON = path7 ?? process.env.npm_package_json ?? "";
|
|
304
304
|
const packageJSON = readFileSync2(pathToPackageJSON).toString();
|
|
305
305
|
return JSON.parse(packageJSON);
|
|
306
306
|
};
|
|
@@ -582,7 +582,7 @@ var cycleAll = async ({ verbose = false }) => {
|
|
|
582
582
|
combinedDependencies: true,
|
|
583
583
|
outputType: verbose ? "text" : "err"
|
|
584
584
|
};
|
|
585
|
-
const target = "**/src";
|
|
585
|
+
const target = "**/packages/*/src";
|
|
586
586
|
console.log(`Checking for circular dependencies in ${target}...`);
|
|
587
587
|
const result = await cruise([target], cruiseOptions);
|
|
588
588
|
if (result.output) {
|
|
@@ -602,7 +602,7 @@ var dead = () => {
|
|
|
602
602
|
};
|
|
603
603
|
|
|
604
604
|
// src/actions/deplint/deplint.ts
|
|
605
|
-
import
|
|
605
|
+
import chalk16 from "chalk";
|
|
606
606
|
|
|
607
607
|
// src/actions/deplint/findFilesByGlob.ts
|
|
608
608
|
import { globSync } from "glob";
|
|
@@ -611,12 +611,18 @@ function findFilesByGlob(cwd, pattern) {
|
|
|
611
611
|
}
|
|
612
612
|
|
|
613
613
|
// src/actions/deplint/findFiles.ts
|
|
614
|
-
function findFiles(
|
|
615
|
-
const allSourceInclude = ["./src/**/*.{ts,tsx}"];
|
|
614
|
+
function findFiles(path7) {
|
|
615
|
+
const allSourceInclude = ["./src/**/*.{ts,tsx,mts,cts,js,mjs,cjs}"];
|
|
616
616
|
const allDistInclude = ["./dist/**/*.d.ts", "./dist/**/*.{mjs,js,cjs}"];
|
|
617
|
-
const
|
|
618
|
-
const
|
|
619
|
-
|
|
617
|
+
const allConfigInclude = ["./*.config.{ts,mts,mjs,js}"];
|
|
618
|
+
const srcFiles = allSourceInclude.flatMap((pattern) => findFilesByGlob(path7, pattern));
|
|
619
|
+
const distFiles = allDistInclude.flatMap((pattern) => findFilesByGlob(path7, pattern));
|
|
620
|
+
const configFiles = allConfigInclude.flatMap((pattern) => findFilesByGlob(path7, pattern));
|
|
621
|
+
return {
|
|
622
|
+
srcFiles,
|
|
623
|
+
distFiles,
|
|
624
|
+
configFiles
|
|
625
|
+
};
|
|
620
626
|
}
|
|
621
627
|
|
|
622
628
|
// src/actions/deplint/getDependenciesFromPackageJson.ts
|
|
@@ -636,10 +642,9 @@ function getDependenciesFromPackageJson(packageJsonPath) {
|
|
|
636
642
|
};
|
|
637
643
|
}
|
|
638
644
|
|
|
639
|
-
// src/actions/deplint/
|
|
645
|
+
// src/actions/deplint/getExtendsFromTsconfigs.ts
|
|
640
646
|
import fs3 from "fs";
|
|
641
|
-
import
|
|
642
|
-
import ts from "typescript";
|
|
647
|
+
import { globSync as globSync2 } from "glob";
|
|
643
648
|
|
|
644
649
|
// src/actions/deplint/getBasePackageName.ts
|
|
645
650
|
function getBasePackageName(importName) {
|
|
@@ -651,7 +656,37 @@ function getBasePackageName(importName) {
|
|
|
651
656
|
return importNameScrubbed.split("/")[0];
|
|
652
657
|
}
|
|
653
658
|
|
|
659
|
+
// src/actions/deplint/getExtendsFromTsconfigs.ts
|
|
660
|
+
var isExternalReference = (ref) => !ref.startsWith(".") && !ref.startsWith("/");
|
|
661
|
+
function parseExtendsField(value) {
|
|
662
|
+
if (typeof value === "string") return [value];
|
|
663
|
+
if (Array.isArray(value)) return value.filter((v) => typeof v === "string");
|
|
664
|
+
return [];
|
|
665
|
+
}
|
|
666
|
+
function getExtendsFromTsconfigs(location) {
|
|
667
|
+
const tsconfigFiles = globSync2("./tsconfig*.json", { cwd: location, absolute: true });
|
|
668
|
+
const packages = /* @__PURE__ */ new Set();
|
|
669
|
+
for (const file of tsconfigFiles) {
|
|
670
|
+
try {
|
|
671
|
+
const content = fs3.readFileSync(file, "utf8");
|
|
672
|
+
const cleaned = content.replaceAll(/\/\/.*/g, "").replaceAll(/,\s*([}\]])/g, "$1");
|
|
673
|
+
const parsed = JSON.parse(cleaned);
|
|
674
|
+
const refs = parseExtendsField(parsed.extends);
|
|
675
|
+
for (const ref of refs) {
|
|
676
|
+
if (isExternalReference(ref)) {
|
|
677
|
+
packages.add(getBasePackageName(ref));
|
|
678
|
+
}
|
|
679
|
+
}
|
|
680
|
+
} catch {
|
|
681
|
+
}
|
|
682
|
+
}
|
|
683
|
+
return [...packages];
|
|
684
|
+
}
|
|
685
|
+
|
|
654
686
|
// src/actions/deplint/getImportsFromFile.ts
|
|
687
|
+
import fs4 from "fs";
|
|
688
|
+
import path4 from "path";
|
|
689
|
+
import ts from "typescript";
|
|
655
690
|
function isTypeOnlyImportClause(clause) {
|
|
656
691
|
if (clause === void 0) {
|
|
657
692
|
return false;
|
|
@@ -664,7 +699,7 @@ function isTypeOnlyImportClause(clause) {
|
|
|
664
699
|
return clause.isTypeOnly;
|
|
665
700
|
}
|
|
666
701
|
function getImportsFromFile(filePath, importPaths, typeImportPaths) {
|
|
667
|
-
const sourceCode =
|
|
702
|
+
const sourceCode = fs4.readFileSync(filePath, "utf8");
|
|
668
703
|
const isMjsFile = filePath.endsWith(".mjs");
|
|
669
704
|
const sourceFile = ts.createSourceFile(
|
|
670
705
|
path4.basename(filePath),
|
|
@@ -717,24 +752,38 @@ var internalImportPrefixes = [".", "#", "node:"];
|
|
|
717
752
|
var removeInternalImports = (imports) => {
|
|
718
753
|
return imports.filter((imp) => !internalImportPrefixes.some((prefix) => imp.startsWith(prefix)));
|
|
719
754
|
};
|
|
720
|
-
function getExternalImportsFromFiles({
|
|
755
|
+
function getExternalImportsFromFiles({
|
|
756
|
+
srcFiles,
|
|
757
|
+
distFiles,
|
|
758
|
+
configFiles = [],
|
|
759
|
+
tsconfigExtends = []
|
|
760
|
+
}) {
|
|
721
761
|
const srcImportPaths = {};
|
|
722
762
|
const distImportPaths = {};
|
|
723
763
|
const distTypeImportPaths = {};
|
|
724
|
-
|
|
764
|
+
const configImportPaths = {};
|
|
765
|
+
for (const path7 of srcFiles) getImportsFromFile(path7, srcImportPaths, srcImportPaths).flat();
|
|
766
|
+
for (const path7 of configFiles) getImportsFromFile(path7, configImportPaths, configImportPaths).flat();
|
|
725
767
|
const distTypeFiles = distFiles.filter((file) => file.endsWith(".d.ts") || file.endsWith(".d.cts") || file.endsWith(".d.mts"));
|
|
726
768
|
const distCodeFiles = distFiles.filter((file) => !(file.endsWith(".d.ts") || file.endsWith(".d.cts") || file.endsWith(".d.mts")));
|
|
727
|
-
for (const
|
|
728
|
-
for (const
|
|
769
|
+
for (const path7 of distCodeFiles) getImportsFromFile(path7, distImportPaths, distImportPaths).flat();
|
|
770
|
+
for (const path7 of distTypeFiles) getImportsFromFile(path7, distTypeImportPaths, distTypeImportPaths).flat();
|
|
729
771
|
const srcImports = Object.keys(srcImportPaths);
|
|
730
772
|
const distImports = Object.keys(distImportPaths);
|
|
731
773
|
const distTypeImports = Object.keys(distTypeImportPaths);
|
|
732
774
|
const externalSrcImports = removeInternalImports(srcImports);
|
|
733
775
|
const externalDistImports = removeInternalImports(distImports);
|
|
734
776
|
const externalDistTypeImports = removeInternalImports(distTypeImports);
|
|
777
|
+
const externalConfigImports = removeInternalImports(Object.keys(configImportPaths));
|
|
778
|
+
for (const ext of tsconfigExtends) {
|
|
779
|
+
if (!externalSrcImports.includes(ext)) externalSrcImports.push(ext);
|
|
780
|
+
if (!externalConfigImports.includes(ext)) externalConfigImports.push(ext);
|
|
781
|
+
}
|
|
735
782
|
return {
|
|
783
|
+
configImportPaths,
|
|
736
784
|
srcImports,
|
|
737
785
|
srcImportPaths,
|
|
786
|
+
externalConfigImports,
|
|
738
787
|
externalSrcImports,
|
|
739
788
|
distImports,
|
|
740
789
|
distImportPaths,
|
|
@@ -746,6 +795,15 @@ function getExternalImportsFromFiles({ srcFiles, distFiles }) {
|
|
|
746
795
|
// src/actions/deplint/checkPackage/getUnlistedDependencies.ts
|
|
747
796
|
import { builtinModules } from "module";
|
|
748
797
|
import chalk11 from "chalk";
|
|
798
|
+
function isListedOrBuiltin(imp, name, dependencies, peerDependencies) {
|
|
799
|
+
return dependencies.includes(imp) || imp === name || dependencies.includes(`@types/${imp}`) || peerDependencies.includes(imp) || peerDependencies.includes(`@types/${imp}`) || builtinModules.includes(imp) || builtinModules.includes(`@types/${imp}`);
|
|
800
|
+
}
|
|
801
|
+
function logMissing(name, imp, importPaths) {
|
|
802
|
+
console.log(`[${chalk11.blue(name)}] Missing dependency in package.json: ${chalk11.red(imp)}`);
|
|
803
|
+
if (importPaths[imp]) {
|
|
804
|
+
console.log(` ${importPaths[imp].join("\n ")}`);
|
|
805
|
+
}
|
|
806
|
+
}
|
|
749
807
|
function getUnlistedDependencies({ name, location }, { dependencies, peerDependencies }, {
|
|
750
808
|
externalDistImports,
|
|
751
809
|
externalDistTypeImports,
|
|
@@ -753,17 +811,15 @@ function getUnlistedDependencies({ name, location }, { dependencies, peerDepende
|
|
|
753
811
|
}) {
|
|
754
812
|
let unlistedDependencies = 0;
|
|
755
813
|
for (const imp of externalDistImports) {
|
|
756
|
-
if (!
|
|
814
|
+
if (!isListedOrBuiltin(imp, name, dependencies, peerDependencies)) {
|
|
757
815
|
unlistedDependencies++;
|
|
758
|
-
|
|
759
|
-
console.log(` ${distImportPaths[imp].join("\n ")}`);
|
|
816
|
+
logMissing(name, imp, distImportPaths);
|
|
760
817
|
}
|
|
761
818
|
}
|
|
762
819
|
for (const imp of externalDistTypeImports) {
|
|
763
|
-
if (!
|
|
820
|
+
if (!isListedOrBuiltin(imp, name, dependencies, peerDependencies)) {
|
|
764
821
|
unlistedDependencies++;
|
|
765
|
-
|
|
766
|
-
console.log(` ${distImportPaths[imp].join("\n ")}`);
|
|
822
|
+
logMissing(name, imp, distImportPaths);
|
|
767
823
|
}
|
|
768
824
|
}
|
|
769
825
|
if (unlistedDependencies > 0) {
|
|
@@ -791,7 +847,9 @@ function getUnlistedDevDependencies({ name, location }, {
|
|
|
791
847
|
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)) {
|
|
792
848
|
unlistedDevDependencies++;
|
|
793
849
|
console.log(`[${chalk12.blue(name)}] Missing devDependency in package.json: ${chalk12.red(imp)}`);
|
|
794
|
-
|
|
850
|
+
if (srcImportPaths[imp]) {
|
|
851
|
+
console.log(` ${srcImportPaths[imp].join("\n ")}`);
|
|
852
|
+
}
|
|
795
853
|
}
|
|
796
854
|
}
|
|
797
855
|
if (unlistedDevDependencies > 0) {
|
|
@@ -828,29 +886,205 @@ function getUnusedDependencies({ name, location }, { dependencies }, {
|
|
|
828
886
|
return unusedDependencies;
|
|
829
887
|
}
|
|
830
888
|
|
|
831
|
-
// src/actions/deplint/checkPackage/
|
|
889
|
+
// src/actions/deplint/checkPackage/getUnusedDevDependencies.ts
|
|
832
890
|
import chalk14 from "chalk";
|
|
891
|
+
|
|
892
|
+
// src/actions/deplint/getRequiredPeerDependencies.ts
|
|
893
|
+
import fs5 from "fs";
|
|
894
|
+
import path5 from "path";
|
|
895
|
+
function findDepPackageJson(location, dep) {
|
|
896
|
+
let dir = location;
|
|
897
|
+
while (true) {
|
|
898
|
+
const candidate = path5.join(dir, "node_modules", dep, "package.json");
|
|
899
|
+
if (fs5.existsSync(candidate)) return candidate;
|
|
900
|
+
const parent = path5.dirname(dir);
|
|
901
|
+
if (parent === dir) return void 0;
|
|
902
|
+
dir = parent;
|
|
903
|
+
}
|
|
904
|
+
}
|
|
905
|
+
function getRequiredPeerDependencies(location, allDeps) {
|
|
906
|
+
const required = /* @__PURE__ */ new Set();
|
|
907
|
+
for (const dep of allDeps) {
|
|
908
|
+
const depPkgPath = findDepPackageJson(location, dep);
|
|
909
|
+
if (!depPkgPath) continue;
|
|
910
|
+
try {
|
|
911
|
+
const raw = fs5.readFileSync(depPkgPath, "utf8");
|
|
912
|
+
const pkg = JSON.parse(raw);
|
|
913
|
+
if (pkg.peerDependencies) {
|
|
914
|
+
for (const peer of Object.keys(pkg.peerDependencies)) {
|
|
915
|
+
required.add(peer);
|
|
916
|
+
}
|
|
917
|
+
}
|
|
918
|
+
} catch {
|
|
919
|
+
}
|
|
920
|
+
}
|
|
921
|
+
return required;
|
|
922
|
+
}
|
|
923
|
+
|
|
924
|
+
// src/actions/deplint/getScriptReferencedPackages.ts
|
|
925
|
+
import fs6 from "fs";
|
|
926
|
+
import path6 from "path";
|
|
927
|
+
function getBinNames(location, dep) {
|
|
928
|
+
const depPkgPath = findDepPackageJson(location, dep);
|
|
929
|
+
if (!depPkgPath) return [];
|
|
930
|
+
try {
|
|
931
|
+
const raw = fs6.readFileSync(depPkgPath, "utf8");
|
|
932
|
+
const pkg = JSON.parse(raw);
|
|
933
|
+
if (!pkg.bin) return [];
|
|
934
|
+
if (typeof pkg.bin === "string") return [pkg.name?.split("/").pop() ?? dep];
|
|
935
|
+
return Object.keys(pkg.bin);
|
|
936
|
+
} catch {
|
|
937
|
+
return [];
|
|
938
|
+
}
|
|
939
|
+
}
|
|
940
|
+
function tokenizeScript(script) {
|
|
941
|
+
return script.split(/[&|;$()"`\s]+/).map((t) => t.trim()).filter(Boolean);
|
|
942
|
+
}
|
|
943
|
+
function getScriptReferencedPackages(location, allDeps) {
|
|
944
|
+
const pkgPath = path6.join(location, "package.json");
|
|
945
|
+
let scripts = {};
|
|
946
|
+
try {
|
|
947
|
+
const raw = fs6.readFileSync(pkgPath, "utf8");
|
|
948
|
+
const pkg = JSON.parse(raw);
|
|
949
|
+
scripts = pkg.scripts ?? {};
|
|
950
|
+
} catch {
|
|
951
|
+
return /* @__PURE__ */ new Set();
|
|
952
|
+
}
|
|
953
|
+
const scriptText = Object.values(scripts).join(" ");
|
|
954
|
+
const tokens = new Set(tokenizeScript(scriptText));
|
|
955
|
+
const binToPackage = /* @__PURE__ */ new Map();
|
|
956
|
+
for (const dep of allDeps) {
|
|
957
|
+
const bins = getBinNames(location, dep);
|
|
958
|
+
for (const bin of bins) {
|
|
959
|
+
binToPackage.set(bin, dep);
|
|
960
|
+
}
|
|
961
|
+
}
|
|
962
|
+
const referenced = /* @__PURE__ */ new Set();
|
|
963
|
+
for (const token of tokens) {
|
|
964
|
+
const baseName = getBasePackageName(token);
|
|
965
|
+
if (allDeps.includes(baseName)) {
|
|
966
|
+
referenced.add(baseName);
|
|
967
|
+
}
|
|
968
|
+
const pkg = binToPackage.get(token);
|
|
969
|
+
if (pkg) {
|
|
970
|
+
referenced.add(pkg);
|
|
971
|
+
}
|
|
972
|
+
}
|
|
973
|
+
return referenced;
|
|
974
|
+
}
|
|
975
|
+
|
|
976
|
+
// src/actions/deplint/implicitDevDependencies.ts
|
|
977
|
+
var hasFileWithExtension = (files, extensions) => files.some((f) => extensions.some((ext) => f.endsWith(ext)));
|
|
978
|
+
var rules = [
|
|
979
|
+
{
|
|
980
|
+
package: "typescript",
|
|
981
|
+
isNeeded: ({ srcFiles, configFiles }) => hasFileWithExtension([...srcFiles, ...configFiles], [".ts", ".tsx", ".mts", ".cts"])
|
|
982
|
+
},
|
|
983
|
+
{
|
|
984
|
+
package: "eslint-import-resolver-typescript",
|
|
985
|
+
isNeeded: ({ srcFiles, configFiles }) => hasFileWithExtension([...srcFiles, ...configFiles], [".ts", ".tsx", ".mts", ".cts"])
|
|
986
|
+
}
|
|
987
|
+
];
|
|
988
|
+
function getImplicitDevDependencies(context) {
|
|
989
|
+
const implicit = /* @__PURE__ */ new Set();
|
|
990
|
+
for (const rule of rules) {
|
|
991
|
+
if (rule.isNeeded(context)) {
|
|
992
|
+
implicit.add(rule.package);
|
|
993
|
+
}
|
|
994
|
+
}
|
|
995
|
+
return implicit;
|
|
996
|
+
}
|
|
997
|
+
|
|
998
|
+
// src/actions/deplint/checkPackage/getUnusedDevDependencies.ts
|
|
999
|
+
var allExternalImports = ({
|
|
1000
|
+
externalSrcImports,
|
|
1001
|
+
externalDistImports,
|
|
1002
|
+
externalDistTypeImports,
|
|
1003
|
+
externalConfigImports
|
|
1004
|
+
}) => {
|
|
1005
|
+
const all = /* @__PURE__ */ new Set([
|
|
1006
|
+
...externalSrcImports,
|
|
1007
|
+
...externalDistImports,
|
|
1008
|
+
...externalDistTypeImports,
|
|
1009
|
+
...externalConfigImports
|
|
1010
|
+
]);
|
|
1011
|
+
return all;
|
|
1012
|
+
};
|
|
1013
|
+
function isDevDepUsed(dep, allImports, implicitDeps, requiredPeers, scriptRefs) {
|
|
1014
|
+
if (implicitDeps.has(dep)) return true;
|
|
1015
|
+
if (requiredPeers.has(dep)) return true;
|
|
1016
|
+
if (scriptRefs.has(dep)) return true;
|
|
1017
|
+
if (dep.startsWith("@types/")) {
|
|
1018
|
+
const baseName = dep.replace(/^@types\//, "");
|
|
1019
|
+
return allImports.has(baseName) || allImports.has(dep) || implicitDeps.has(baseName);
|
|
1020
|
+
}
|
|
1021
|
+
return allImports.has(dep);
|
|
1022
|
+
}
|
|
1023
|
+
function getUnusedDevDependencies({ name, location }, {
|
|
1024
|
+
devDependencies,
|
|
1025
|
+
dependencies,
|
|
1026
|
+
peerDependencies
|
|
1027
|
+
}, sourceParams, fileContext) {
|
|
1028
|
+
const allImports = allExternalImports(sourceParams);
|
|
1029
|
+
const implicitDeps = getImplicitDevDependencies(fileContext);
|
|
1030
|
+
const allDeps = [...dependencies, ...devDependencies, ...peerDependencies];
|
|
1031
|
+
const requiredPeers = getRequiredPeerDependencies(location, allDeps);
|
|
1032
|
+
const scriptRefs = getScriptReferencedPackages(location, allDeps);
|
|
1033
|
+
let unusedDevDependencies = 0;
|
|
1034
|
+
for (const dep of devDependencies) {
|
|
1035
|
+
if (dependencies.includes(dep) || peerDependencies.includes(dep)) continue;
|
|
1036
|
+
if (!isDevDepUsed(dep, allImports, implicitDeps, requiredPeers, scriptRefs)) {
|
|
1037
|
+
unusedDevDependencies++;
|
|
1038
|
+
console.log(`[${chalk14.blue(name)}] Unused devDependency in package.json: ${chalk14.red(dep)}`);
|
|
1039
|
+
}
|
|
1040
|
+
}
|
|
1041
|
+
if (unusedDevDependencies > 0) {
|
|
1042
|
+
const packageLocation = `${location}/package.json`;
|
|
1043
|
+
console.log(` ${chalk14.yellow(packageLocation)}
|
|
1044
|
+
`);
|
|
1045
|
+
}
|
|
1046
|
+
return unusedDevDependencies;
|
|
1047
|
+
}
|
|
1048
|
+
|
|
1049
|
+
// src/actions/deplint/checkPackage/getUnusedPeerDependencies.ts
|
|
1050
|
+
import chalk15 from "chalk";
|
|
833
1051
|
function getUnusedPeerDependencies({ name, location }, { peerDependencies, dependencies }, { externalDistImports, externalDistTypeImports }) {
|
|
834
1052
|
let unusedDependencies = 0;
|
|
835
1053
|
for (const dep of peerDependencies) {
|
|
836
1054
|
if (!externalDistImports.includes(dep) && !externalDistImports.includes(dep.replace(/^@types\//, "")) && !externalDistTypeImports.includes(dep) && !externalDistTypeImports.includes(dep.replace(/^@types\//, ""))) {
|
|
837
1055
|
unusedDependencies++;
|
|
838
1056
|
if (dependencies.includes(dep)) {
|
|
839
|
-
console.log(`[${
|
|
1057
|
+
console.log(`[${chalk15.blue(name)}] Unused peerDependency [already a dependency] in package.json: ${chalk15.red(dep)}`);
|
|
840
1058
|
} else {
|
|
841
|
-
console.log(`[${
|
|
1059
|
+
console.log(`[${chalk15.blue(name)}] Unused peerDependency in package.json: ${chalk15.red(dep)}`);
|
|
842
1060
|
}
|
|
843
1061
|
}
|
|
844
1062
|
}
|
|
845
1063
|
if (unusedDependencies > 0) {
|
|
846
1064
|
const packageLocation = `${location}/package.json`;
|
|
847
|
-
console.log(` ${
|
|
1065
|
+
console.log(` ${chalk15.yellow(packageLocation)}
|
|
848
1066
|
`);
|
|
849
1067
|
}
|
|
850
1068
|
return unusedDependencies;
|
|
851
1069
|
}
|
|
852
1070
|
|
|
853
1071
|
// src/actions/deplint/checkPackage/checkPackage.ts
|
|
1072
|
+
function logVerbose(name, location, srcFiles, distFiles, configFiles, tsconfigExtends) {
|
|
1073
|
+
console.info(`Checking package: ${name} at ${location}`);
|
|
1074
|
+
console.info(`Source files: ${srcFiles.length}, Distribution files: ${distFiles.length}, Config files: ${configFiles.length}`);
|
|
1075
|
+
for (const file of srcFiles) {
|
|
1076
|
+
console.info(`Source file: ${file}`);
|
|
1077
|
+
}
|
|
1078
|
+
for (const file of distFiles) {
|
|
1079
|
+
console.info(`Distribution file: ${file}`);
|
|
1080
|
+
}
|
|
1081
|
+
for (const file of configFiles) {
|
|
1082
|
+
console.info(`Config file: ${file}`);
|
|
1083
|
+
}
|
|
1084
|
+
for (const ext of tsconfigExtends) {
|
|
1085
|
+
console.info(`Tsconfig extends: ${ext}`);
|
|
1086
|
+
}
|
|
1087
|
+
}
|
|
854
1088
|
function checkPackage({
|
|
855
1089
|
name,
|
|
856
1090
|
location,
|
|
@@ -859,27 +1093,36 @@ function checkPackage({
|
|
|
859
1093
|
peerDeps = false,
|
|
860
1094
|
verbose = false
|
|
861
1095
|
}) {
|
|
862
|
-
const {
|
|
1096
|
+
const {
|
|
1097
|
+
srcFiles,
|
|
1098
|
+
distFiles,
|
|
1099
|
+
configFiles
|
|
1100
|
+
} = findFiles(location);
|
|
1101
|
+
const tsconfigExtends = getExtendsFromTsconfigs(location);
|
|
863
1102
|
if (verbose) {
|
|
864
|
-
|
|
865
|
-
console.info(`Source files: ${srcFiles.length}, Distribution files: ${distFiles.length}`);
|
|
866
|
-
for (const file of srcFiles) {
|
|
867
|
-
console.info(`Source file: ${file}`);
|
|
868
|
-
}
|
|
869
|
-
for (const file of distFiles) {
|
|
870
|
-
console.info(`Distribution file: ${file}`);
|
|
871
|
-
}
|
|
1103
|
+
logVerbose(name, location, srcFiles, distFiles, configFiles, tsconfigExtends);
|
|
872
1104
|
}
|
|
873
1105
|
const checkDeps = deps || !(deps || devDeps || peerDeps);
|
|
874
1106
|
const checkDevDeps = devDeps || !(deps || devDeps || peerDeps);
|
|
875
1107
|
const checkPeerDeps = peerDeps;
|
|
876
|
-
const sourceParams = getExternalImportsFromFiles({
|
|
1108
|
+
const sourceParams = getExternalImportsFromFiles({
|
|
1109
|
+
srcFiles,
|
|
1110
|
+
distFiles,
|
|
1111
|
+
configFiles,
|
|
1112
|
+
tsconfigExtends
|
|
1113
|
+
});
|
|
877
1114
|
const packageParams = getDependenciesFromPackageJson(`${location}/package.json`);
|
|
878
1115
|
const unlistedDependencies = checkDeps ? getUnlistedDependencies({ name, location }, packageParams, sourceParams) : 0;
|
|
879
1116
|
const unusedDependencies = checkDeps ? getUnusedDependencies({ name, location }, packageParams, sourceParams) : 0;
|
|
880
1117
|
const unlistedDevDependencies = checkDevDeps ? getUnlistedDevDependencies({ name, location }, packageParams, sourceParams) : 0;
|
|
1118
|
+
const fileContext = {
|
|
1119
|
+
configFiles,
|
|
1120
|
+
distFiles,
|
|
1121
|
+
srcFiles
|
|
1122
|
+
};
|
|
1123
|
+
const unusedDevDependencies = checkDevDeps ? getUnusedDevDependencies({ name, location }, packageParams, sourceParams, fileContext) : 0;
|
|
881
1124
|
const unusedPeerDependencies = checkPeerDeps ? getUnusedPeerDependencies({ name, location }, packageParams, sourceParams) : 0;
|
|
882
|
-
const totalErrors = unlistedDependencies + unlistedDevDependencies + unusedDependencies + unusedPeerDependencies;
|
|
1125
|
+
const totalErrors = unlistedDependencies + unlistedDevDependencies + unusedDependencies + unusedDevDependencies + unusedPeerDependencies;
|
|
883
1126
|
return totalErrors;
|
|
884
1127
|
}
|
|
885
1128
|
|
|
@@ -917,9 +1160,9 @@ var deplint = ({
|
|
|
917
1160
|
});
|
|
918
1161
|
}
|
|
919
1162
|
if (totalErrors > 0) {
|
|
920
|
-
console.warn(`Deplint: Found ${
|
|
1163
|
+
console.warn(`Deplint: Found ${chalk16.red(totalErrors)} dependency problems. ${chalk16.red("\u2716")}`);
|
|
921
1164
|
} else {
|
|
922
|
-
console.info(`Deplint: Found no dependency problems. ${
|
|
1165
|
+
console.info(`Deplint: Found no dependency problems. ${chalk16.green("\u2714")}`);
|
|
923
1166
|
}
|
|
924
1167
|
return 0;
|
|
925
1168
|
};
|
|
@@ -1021,22 +1264,22 @@ var deployNext = () => {
|
|
|
1021
1264
|
};
|
|
1022
1265
|
|
|
1023
1266
|
// src/actions/dupdeps.ts
|
|
1024
|
-
import
|
|
1267
|
+
import chalk17 from "chalk";
|
|
1025
1268
|
var dupdeps = () => {
|
|
1026
|
-
console.log(
|
|
1269
|
+
console.log(chalk17.green("Checking all Dependencies for Duplicates"));
|
|
1027
1270
|
const allDependencies = parsedPackageJSON()?.dependencies;
|
|
1028
1271
|
const dependencies = Object.entries(allDependencies).map(([k]) => k);
|
|
1029
1272
|
return detectDuplicateDependencies(dependencies);
|
|
1030
1273
|
};
|
|
1031
1274
|
|
|
1032
1275
|
// src/actions/lint.ts
|
|
1033
|
-
import
|
|
1276
|
+
import chalk18 from "chalk";
|
|
1034
1277
|
var lintPackage = ({
|
|
1035
1278
|
pkg,
|
|
1036
1279
|
fix: fix2,
|
|
1037
1280
|
verbose
|
|
1038
1281
|
}) => {
|
|
1039
|
-
console.log(
|
|
1282
|
+
console.log(chalk18.gray(`${fix2 ? "Fix" : "Lint"} [${pkg}]`));
|
|
1040
1283
|
const start = Date.now();
|
|
1041
1284
|
const result = runSteps(`${fix2 ? "Fix" : "Lint"} [${pkg}]`, [
|
|
1042
1285
|
["yarn", [
|
|
@@ -1046,7 +1289,7 @@ var lintPackage = ({
|
|
|
1046
1289
|
fix2 ? "package-fix" : verbose ? "package-lint-verbose" : "package-lint"
|
|
1047
1290
|
]]
|
|
1048
1291
|
]);
|
|
1049
|
-
console.log(
|
|
1292
|
+
console.log(chalk18.gray(`${fix2 ? "Fixed in" : "Linted in"} [${chalk18.magenta(((Date.now() - start) / 1e3).toFixed(2))}] ${chalk18.gray("seconds")}`));
|
|
1050
1293
|
return result;
|
|
1051
1294
|
};
|
|
1052
1295
|
var lint = ({
|
|
@@ -1066,13 +1309,13 @@ var lint = ({
|
|
|
1066
1309
|
});
|
|
1067
1310
|
};
|
|
1068
1311
|
var lintAllPackages = ({ fix: fix2 = false } = {}) => {
|
|
1069
|
-
console.log(
|
|
1312
|
+
console.log(chalk18.gray(`${fix2 ? "Fix" : "Lint"} [All-Packages]`));
|
|
1070
1313
|
const start = Date.now();
|
|
1071
1314
|
const fixOptions = fix2 ? ["--fix"] : [];
|
|
1072
1315
|
const result = runSteps(`${fix2 ? "Fix" : "Lint"} [All-Packages]`, [
|
|
1073
1316
|
["yarn", ["eslint", "--cache", "--cache-location", ".eslintcache", "--cache-strategy", "content", ...fixOptions]]
|
|
1074
1317
|
]);
|
|
1075
|
-
console.log(
|
|
1318
|
+
console.log(chalk18.gray(`${fix2 ? "Fixed in" : "Linted in"} [${chalk18.magenta(((Date.now() - start) / 1e3).toFixed(2))}] ${chalk18.gray("seconds")}`));
|
|
1076
1319
|
return result;
|
|
1077
1320
|
};
|
|
1078
1321
|
|
|
@@ -1100,7 +1343,7 @@ var filename = ".gitignore";
|
|
|
1100
1343
|
var gitignoreGen = (pkg) => generateIgnoreFiles(filename, pkg);
|
|
1101
1344
|
|
|
1102
1345
|
// src/actions/gitlint.ts
|
|
1103
|
-
import
|
|
1346
|
+
import chalk19 from "chalk";
|
|
1104
1347
|
import ParseGitConfig from "parse-git-config";
|
|
1105
1348
|
var gitlint = () => {
|
|
1106
1349
|
console.log(`
|
|
@@ -1111,7 +1354,7 @@ Gitlint Start [${process.cwd()}]
|
|
|
1111
1354
|
const errors = 0;
|
|
1112
1355
|
const gitConfig = ParseGitConfig.sync();
|
|
1113
1356
|
const warn = (message) => {
|
|
1114
|
-
console.warn(
|
|
1357
|
+
console.warn(chalk19.yellow(`Warning: ${message}`));
|
|
1115
1358
|
warnings++;
|
|
1116
1359
|
};
|
|
1117
1360
|
if (gitConfig.core.ignorecase) {
|
|
@@ -1131,13 +1374,13 @@ Gitlint Start [${process.cwd()}]
|
|
|
1131
1374
|
}
|
|
1132
1375
|
const resultMessages = [];
|
|
1133
1376
|
if (valid > 0) {
|
|
1134
|
-
resultMessages.push(
|
|
1377
|
+
resultMessages.push(chalk19.green(`Passed: ${valid}`));
|
|
1135
1378
|
}
|
|
1136
1379
|
if (warnings > 0) {
|
|
1137
|
-
resultMessages.push(
|
|
1380
|
+
resultMessages.push(chalk19.yellow(`Warnings: ${warnings}`));
|
|
1138
1381
|
}
|
|
1139
1382
|
if (errors > 0) {
|
|
1140
|
-
resultMessages.push(
|
|
1383
|
+
resultMessages.push(chalk19.red(` Errors: ${errors}`));
|
|
1141
1384
|
}
|
|
1142
1385
|
console.warn(`Gitlint Finish [ ${resultMessages.join(" | ")} ]
|
|
1143
1386
|
`);
|
|
@@ -1146,7 +1389,7 @@ Gitlint Start [${process.cwd()}]
|
|
|
1146
1389
|
|
|
1147
1390
|
// src/actions/gitlint-fix.ts
|
|
1148
1391
|
import { execSync as execSync2 } from "child_process";
|
|
1149
|
-
import
|
|
1392
|
+
import chalk20 from "chalk";
|
|
1150
1393
|
import ParseGitConfig2 from "parse-git-config";
|
|
1151
1394
|
var gitlintFix = () => {
|
|
1152
1395
|
console.log(`
|
|
@@ -1155,15 +1398,15 @@ Gitlint Fix Start [${process.cwd()}]
|
|
|
1155
1398
|
const gitConfig = ParseGitConfig2.sync();
|
|
1156
1399
|
if (gitConfig.core.ignorecase) {
|
|
1157
1400
|
execSync2("git config core.ignorecase false", { stdio: "inherit" });
|
|
1158
|
-
console.warn(
|
|
1401
|
+
console.warn(chalk20.yellow("\nGitlint Fix: Updated core.ignorecase to be false\n"));
|
|
1159
1402
|
}
|
|
1160
1403
|
if (gitConfig.core.autocrlf !== false) {
|
|
1161
1404
|
execSync2("git config core.autocrlf false", { stdio: "inherit" });
|
|
1162
|
-
console.warn(
|
|
1405
|
+
console.warn(chalk20.yellow("\nGitlint Fix: Updated core.autocrlf to be false\n"));
|
|
1163
1406
|
}
|
|
1164
1407
|
if (gitConfig.core.eol !== "lf") {
|
|
1165
1408
|
execSync2("git config core.eol lf", { stdio: "inherit" });
|
|
1166
|
-
console.warn(
|
|
1409
|
+
console.warn(chalk20.yellow('\nGitlint Fix: Updated core.eol to be "lf"\n'));
|
|
1167
1410
|
}
|
|
1168
1411
|
return 1;
|
|
1169
1412
|
};
|
|
@@ -1174,7 +1417,7 @@ var knip = () => {
|
|
|
1174
1417
|
};
|
|
1175
1418
|
|
|
1176
1419
|
// src/actions/license.ts
|
|
1177
|
-
import
|
|
1420
|
+
import chalk21 from "chalk";
|
|
1178
1421
|
import { init } from "license-checker";
|
|
1179
1422
|
var license = async (pkg) => {
|
|
1180
1423
|
const workspaces = yarnWorkspaces();
|
|
@@ -1199,18 +1442,18 @@ var license = async (pkg) => {
|
|
|
1199
1442
|
"LGPL-3.0-or-later",
|
|
1200
1443
|
"Python-2.0"
|
|
1201
1444
|
]);
|
|
1202
|
-
console.log(
|
|
1445
|
+
console.log(chalk21.green("License Checker"));
|
|
1203
1446
|
return (await Promise.all(
|
|
1204
1447
|
workspaceList.map(({ location, name }) => {
|
|
1205
1448
|
return new Promise((resolve) => {
|
|
1206
1449
|
init({ production: true, start: location }, (error, packages) => {
|
|
1207
1450
|
if (error) {
|
|
1208
|
-
console.error(
|
|
1209
|
-
console.error(
|
|
1451
|
+
console.error(chalk21.red(`License Checker [${name}] Error`));
|
|
1452
|
+
console.error(chalk21.gray(error));
|
|
1210
1453
|
console.log("\n");
|
|
1211
1454
|
resolve(1);
|
|
1212
1455
|
} else {
|
|
1213
|
-
console.log(
|
|
1456
|
+
console.log(chalk21.green(`License Checker [${name}]`));
|
|
1214
1457
|
let count = 0;
|
|
1215
1458
|
for (const [name2, info] of Object.entries(packages)) {
|
|
1216
1459
|
const licenses = Array.isArray(info.licenses) ? info.licenses : [info.licenses];
|
|
@@ -1226,7 +1469,7 @@ var license = async (pkg) => {
|
|
|
1226
1469
|
}
|
|
1227
1470
|
if (!orLicenseFound) {
|
|
1228
1471
|
count++;
|
|
1229
|
-
console.warn(
|
|
1472
|
+
console.warn(chalk21.yellow(`${name2}: Package License not allowed [${license2}]`));
|
|
1230
1473
|
}
|
|
1231
1474
|
}
|
|
1232
1475
|
}
|
|
@@ -1270,7 +1513,7 @@ var rebuild = ({ target }) => {
|
|
|
1270
1513
|
};
|
|
1271
1514
|
|
|
1272
1515
|
// src/actions/recompile.ts
|
|
1273
|
-
import
|
|
1516
|
+
import chalk22 from "chalk";
|
|
1274
1517
|
var recompile = async ({
|
|
1275
1518
|
verbose,
|
|
1276
1519
|
target,
|
|
@@ -1306,7 +1549,7 @@ var recompileAll = async ({
|
|
|
1306
1549
|
const incrementalOptions = incremental ? ["--since", "-Apt", "--topological-dev"] : ["--parallel", "-Apt", "--topological-dev"];
|
|
1307
1550
|
const jobsOptions = jobs ? ["-j", `${jobs}`] : [];
|
|
1308
1551
|
if (jobs) {
|
|
1309
|
-
console.log(
|
|
1552
|
+
console.log(chalk22.blue(`Jobs set to [${jobs}]`));
|
|
1310
1553
|
}
|
|
1311
1554
|
const result = await runStepsAsync(`Recompile${incremental ? "-Incremental" : ""} [All]`, [
|
|
1312
1555
|
[
|
|
@@ -1337,7 +1580,7 @@ var recompileAll = async ({
|
|
|
1337
1580
|
]
|
|
1338
1581
|
]);
|
|
1339
1582
|
console.log(
|
|
1340
|
-
`${
|
|
1583
|
+
`${chalk22.gray("Recompiled in")} [${chalk22.magenta(((Date.now() - start) / 1e3).toFixed(2))}] ${chalk22.gray("seconds")}`
|
|
1341
1584
|
);
|
|
1342
1585
|
return result;
|
|
1343
1586
|
};
|
|
@@ -1368,13 +1611,13 @@ var reinstall = () => {
|
|
|
1368
1611
|
};
|
|
1369
1612
|
|
|
1370
1613
|
// src/actions/relint.ts
|
|
1371
|
-
import
|
|
1614
|
+
import chalk23 from "chalk";
|
|
1372
1615
|
var relintPackage = ({
|
|
1373
1616
|
pkg,
|
|
1374
1617
|
fix: fix2,
|
|
1375
1618
|
verbose
|
|
1376
1619
|
}) => {
|
|
1377
|
-
console.log(
|
|
1620
|
+
console.log(chalk23.gray(`${fix2 ? "Fix" : "Lint"} [${pkg}]`));
|
|
1378
1621
|
const start = Date.now();
|
|
1379
1622
|
const result = runSteps(`${fix2 ? "Fix" : "Lint"} [${pkg}]`, [
|
|
1380
1623
|
["yarn", [
|
|
@@ -1384,7 +1627,7 @@ var relintPackage = ({
|
|
|
1384
1627
|
fix2 ? "package-fix" : verbose ? "package-lint-verbose" : "package-lint"
|
|
1385
1628
|
]]
|
|
1386
1629
|
]);
|
|
1387
|
-
console.log(
|
|
1630
|
+
console.log(chalk23.gray(`${fix2 ? "Fixed in" : "Linted in"} [${chalk23.magenta(((Date.now() - start) / 1e3).toFixed(2))}] ${chalk23.gray("seconds")}`));
|
|
1388
1631
|
return result;
|
|
1389
1632
|
};
|
|
1390
1633
|
var relint = ({
|
|
@@ -1404,13 +1647,13 @@ var relint = ({
|
|
|
1404
1647
|
});
|
|
1405
1648
|
};
|
|
1406
1649
|
var relintAllPackages = ({ fix: fix2 = false } = {}) => {
|
|
1407
|
-
console.log(
|
|
1650
|
+
console.log(chalk23.gray(`${fix2 ? "Fix" : "Lint"} [All-Packages]`));
|
|
1408
1651
|
const start = Date.now();
|
|
1409
1652
|
const fixOptions = fix2 ? ["--fix"] : [];
|
|
1410
1653
|
const result = runSteps(`${fix2 ? "Fix" : "Lint"} [All-Packages]`, [
|
|
1411
1654
|
["yarn", ["eslint", ...fixOptions]]
|
|
1412
1655
|
]);
|
|
1413
|
-
console.log(
|
|
1656
|
+
console.log(chalk23.gray(`${fix2 ? "Fixed in" : "Linted in"} [${chalk23.magenta(((Date.now() - start) / 1e3).toFixed(2))}] ${chalk23.gray("seconds")}`));
|
|
1414
1657
|
return result;
|
|
1415
1658
|
};
|
|
1416
1659
|
|
|
@@ -1428,10 +1671,10 @@ var sonar = () => {
|
|
|
1428
1671
|
};
|
|
1429
1672
|
|
|
1430
1673
|
// src/actions/statics.ts
|
|
1431
|
-
import
|
|
1674
|
+
import chalk24 from "chalk";
|
|
1432
1675
|
var DefaultDependencies = ["axios", "@xylabs/pixel", "react", "graphql", "react-router", "@mui/material", "@mui/system"];
|
|
1433
1676
|
var statics = () => {
|
|
1434
|
-
console.log(
|
|
1677
|
+
console.log(chalk24.green("Check Required Static Dependencies"));
|
|
1435
1678
|
const statics2 = parsedPackageJSON()?.xy?.deps?.statics;
|
|
1436
1679
|
return detectDuplicateDependencies(statics2, DefaultDependencies);
|
|
1437
1680
|
};
|
|
@@ -1831,7 +2074,7 @@ var xyInstallCommands = (args) => {
|
|
|
1831
2074
|
};
|
|
1832
2075
|
|
|
1833
2076
|
// src/xy/xyLintCommands.ts
|
|
1834
|
-
import
|
|
2077
|
+
import chalk25 from "chalk";
|
|
1835
2078
|
var xyLintCommands = (args) => {
|
|
1836
2079
|
return args.command(
|
|
1837
2080
|
"cycle [package]",
|
|
@@ -1843,7 +2086,7 @@ var xyLintCommands = (args) => {
|
|
|
1843
2086
|
const start = Date.now();
|
|
1844
2087
|
if (argv.verbose) console.log("Cycle");
|
|
1845
2088
|
process.exitCode = await cycle({ pkg: argv.package });
|
|
1846
|
-
console.log(
|
|
2089
|
+
console.log(chalk25.blue(`Finished in ${Date.now() - start}ms`));
|
|
1847
2090
|
}
|
|
1848
2091
|
).command(
|
|
1849
2092
|
"lint [package]",
|
|
@@ -1873,7 +2116,7 @@ var xyLintCommands = (args) => {
|
|
|
1873
2116
|
cache: argv.cache,
|
|
1874
2117
|
verbose: !!argv.verbose
|
|
1875
2118
|
});
|
|
1876
|
-
console.log(
|
|
2119
|
+
console.log(chalk25.blue(`Finished in ${Date.now() - start}ms`));
|
|
1877
2120
|
}
|
|
1878
2121
|
).command(
|
|
1879
2122
|
"deplint [package]",
|
|
@@ -1906,7 +2149,7 @@ var xyLintCommands = (args) => {
|
|
|
1906
2149
|
peerDeps: !!argv.peerDeps,
|
|
1907
2150
|
verbose: !!argv.verbose
|
|
1908
2151
|
});
|
|
1909
|
-
console.log(
|
|
2152
|
+
console.log(chalk25.blue(`Finished in ${Date.now() - start}ms`));
|
|
1910
2153
|
}
|
|
1911
2154
|
).command(
|
|
1912
2155
|
"fix [package]",
|
|
@@ -1918,7 +2161,7 @@ var xyLintCommands = (args) => {
|
|
|
1918
2161
|
const start = Date.now();
|
|
1919
2162
|
if (argv.verbose) console.log("Fix");
|
|
1920
2163
|
process.exitCode = fix();
|
|
1921
|
-
console.log(
|
|
2164
|
+
console.log(chalk25.blue(`Finished in ${Date.now() - start}ms`));
|
|
1922
2165
|
}
|
|
1923
2166
|
).command(
|
|
1924
2167
|
"relint [package]",
|
|
@@ -1930,7 +2173,7 @@ var xyLintCommands = (args) => {
|
|
|
1930
2173
|
if (argv.verbose) console.log("Relinting");
|
|
1931
2174
|
const start = Date.now();
|
|
1932
2175
|
process.exitCode = relint();
|
|
1933
|
-
console.log(
|
|
2176
|
+
console.log(chalk25.blue(`Finished in ${Date.now() - start}ms`));
|
|
1934
2177
|
}
|
|
1935
2178
|
).command(
|
|
1936
2179
|
"publint [package]",
|
|
@@ -1942,7 +2185,7 @@ var xyLintCommands = (args) => {
|
|
|
1942
2185
|
if (argv.verbose) console.log("Publint");
|
|
1943
2186
|
const start = Date.now();
|
|
1944
2187
|
process.exitCode = await publint({ pkg: argv.package, verbose: !!argv.verbose });
|
|
1945
|
-
console.log(
|
|
2188
|
+
console.log(chalk25.blue(`Finished in ${Date.now() - start}ms`));
|
|
1946
2189
|
}
|
|
1947
2190
|
).command(
|
|
1948
2191
|
"knip",
|
|
@@ -1954,7 +2197,7 @@ var xyLintCommands = (args) => {
|
|
|
1954
2197
|
if (argv.verbose) console.log("Knip");
|
|
1955
2198
|
const start = Date.now();
|
|
1956
2199
|
process.exitCode = knip();
|
|
1957
|
-
console.log(
|
|
2200
|
+
console.log(chalk25.blue(`Knip finished in ${Date.now() - start}ms`));
|
|
1958
2201
|
}
|
|
1959
2202
|
).command(
|
|
1960
2203
|
"sonar",
|
|
@@ -1966,7 +2209,7 @@ var xyLintCommands = (args) => {
|
|
|
1966
2209
|
const start = Date.now();
|
|
1967
2210
|
if (argv.verbose) console.log("Sonar Check");
|
|
1968
2211
|
process.exitCode = sonar();
|
|
1969
|
-
console.log(
|
|
2212
|
+
console.log(chalk25.blue(`Finished in ${Date.now() - start}ms`));
|
|
1970
2213
|
}
|
|
1971
2214
|
);
|
|
1972
2215
|
};
|
|
@@ -2002,8 +2245,8 @@ var xyParseOptions = () => {
|
|
|
2002
2245
|
var xy = async () => {
|
|
2003
2246
|
const options = xyParseOptions();
|
|
2004
2247
|
return await xyBuildCommands(xyCommonCommands(xyInstallCommands(xyDeployCommands(xyLintCommands(options))))).demandCommand(1).command("*", "", () => {
|
|
2005
|
-
console.error(
|
|
2006
|
-
console.log(
|
|
2248
|
+
console.error(chalk26.yellow(`Command not found [${chalk26.magenta(process.argv[2])}]`));
|
|
2249
|
+
console.log(chalk26.gray("Try 'yarn xy --help' for list of commands"));
|
|
2007
2250
|
}).version().help().argv;
|
|
2008
2251
|
};
|
|
2009
2252
|
|