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