@xylabs/ts-scripts-yarn3 7.3.2 → 7.4.1
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 +316 -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 +213 -0
- package/dist/actions/deplint/checkPackage/getUnusedDevDependencies.mjs.map +1 -0
- package/dist/actions/deplint/checkPackage/index.mjs +316 -35
- package/dist/actions/deplint/checkPackage/index.mjs.map +1 -1
- package/dist/actions/deplint/deplint.mjs +319 -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 +75 -0
- package/dist/actions/deplint/implicitDevDependencies.mjs.map +1 -0
- package/dist/actions/deplint/index.mjs +319 -38
- package/dist/actions/deplint/index.mjs.map +1 -1
- package/dist/actions/index.mjs +423 -142
- package/dist/actions/index.mjs.map +1 -1
- package/dist/bin/xy.mjs +366 -85
- package/dist/bin/xy.mjs.map +1 -1
- package/dist/index.mjs +435 -154
- package/dist/index.mjs.map +1 -1
- package/dist/xy/index.mjs +366 -85
- package/dist/xy/index.mjs.map +1 -1
- package/dist/xy/xy.mjs +366 -85
- package/dist/xy/xy.mjs.map +1 -1
- package/dist/xy/xyLintCommands.mjs +339 -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,243 @@ 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
|
+
import fs7 from "fs";
|
|
976
|
+
var hasFileWithExtension = (files, extensions) => files.some((f) => extensions.some((ext) => f.endsWith(ext)));
|
|
977
|
+
var tsExtensions = [".ts", ".tsx", ".mts", ".cts"];
|
|
978
|
+
var hasTypescriptFiles = ({ srcFiles, configFiles }) => hasFileWithExtension([...srcFiles, ...configFiles], tsExtensions);
|
|
979
|
+
var decoratorPattern = /^\s*@[A-Z]\w*/m;
|
|
980
|
+
var hasDecorators = ({ srcFiles }) => srcFiles.filter((f) => tsExtensions.some((ext) => f.endsWith(ext))).some((file) => {
|
|
981
|
+
try {
|
|
982
|
+
const content = fs7.readFileSync(file, "utf8");
|
|
983
|
+
return decoratorPattern.test(content);
|
|
984
|
+
} catch {
|
|
985
|
+
return false;
|
|
986
|
+
}
|
|
987
|
+
});
|
|
988
|
+
var importPlugins = /* @__PURE__ */ new Set(["eslint-plugin-import-x", "eslint-plugin-import"]);
|
|
989
|
+
function hasImportPlugin({ location, allDependencies }) {
|
|
990
|
+
if (allDependencies.some((d) => importPlugins.has(d))) return true;
|
|
991
|
+
for (const dep of allDependencies) {
|
|
992
|
+
const pkgPath = findDepPackageJson(location, dep);
|
|
993
|
+
if (!pkgPath) continue;
|
|
994
|
+
try {
|
|
995
|
+
const pkg = JSON.parse(fs7.readFileSync(pkgPath, "utf8"));
|
|
996
|
+
const transitiveDeps = [
|
|
997
|
+
...Object.keys(pkg.dependencies ?? {}),
|
|
998
|
+
...Object.keys(pkg.peerDependencies ?? {})
|
|
999
|
+
];
|
|
1000
|
+
if (transitiveDeps.some((d) => importPlugins.has(d))) return true;
|
|
1001
|
+
} catch {
|
|
1002
|
+
}
|
|
1003
|
+
}
|
|
1004
|
+
return false;
|
|
1005
|
+
}
|
|
1006
|
+
var rules = [
|
|
1007
|
+
{
|
|
1008
|
+
package: "typescript",
|
|
1009
|
+
isNeeded: hasTypescriptFiles
|
|
1010
|
+
},
|
|
1011
|
+
{
|
|
1012
|
+
package: "eslint-import-resolver-typescript",
|
|
1013
|
+
isNeeded: (context) => hasTypescriptFiles(context) && context.allDependencies.includes("eslint") && hasImportPlugin(context)
|
|
1014
|
+
},
|
|
1015
|
+
{
|
|
1016
|
+
package: "tslib",
|
|
1017
|
+
isNeeded: hasDecorators
|
|
1018
|
+
}
|
|
1019
|
+
];
|
|
1020
|
+
function getImplicitDevDependencies(context) {
|
|
1021
|
+
const implicit = /* @__PURE__ */ new Set();
|
|
1022
|
+
for (const rule of rules) {
|
|
1023
|
+
if (rule.isNeeded(context)) {
|
|
1024
|
+
implicit.add(rule.package);
|
|
1025
|
+
}
|
|
1026
|
+
}
|
|
1027
|
+
return implicit;
|
|
1028
|
+
}
|
|
1029
|
+
|
|
1030
|
+
// src/actions/deplint/checkPackage/getUnusedDevDependencies.ts
|
|
1031
|
+
var allExternalImports = ({
|
|
1032
|
+
externalSrcImports,
|
|
1033
|
+
externalDistImports,
|
|
1034
|
+
externalDistTypeImports,
|
|
1035
|
+
externalConfigImports
|
|
1036
|
+
}) => {
|
|
1037
|
+
const all = /* @__PURE__ */ new Set([
|
|
1038
|
+
...externalSrcImports,
|
|
1039
|
+
...externalDistImports,
|
|
1040
|
+
...externalDistTypeImports,
|
|
1041
|
+
...externalConfigImports
|
|
1042
|
+
]);
|
|
1043
|
+
return all;
|
|
1044
|
+
};
|
|
1045
|
+
function isDevDepUsed(dep, allImports, implicitDeps, requiredPeers, scriptRefs) {
|
|
1046
|
+
if (implicitDeps.has(dep)) return true;
|
|
1047
|
+
if (requiredPeers.has(dep)) return true;
|
|
1048
|
+
if (scriptRefs.has(dep)) return true;
|
|
1049
|
+
if (dep.startsWith("@types/")) {
|
|
1050
|
+
const baseName = dep.replace(/^@types\//, "");
|
|
1051
|
+
return allImports.has(baseName) || allImports.has(dep) || implicitDeps.has(baseName);
|
|
1052
|
+
}
|
|
1053
|
+
return allImports.has(dep);
|
|
1054
|
+
}
|
|
1055
|
+
function getUnusedDevDependencies({ name, location }, {
|
|
1056
|
+
devDependencies,
|
|
1057
|
+
dependencies,
|
|
1058
|
+
peerDependencies
|
|
1059
|
+
}, sourceParams, fileContext) {
|
|
1060
|
+
const allImports = allExternalImports(sourceParams);
|
|
1061
|
+
const allDeps = [...dependencies, ...devDependencies, ...peerDependencies];
|
|
1062
|
+
const implicitDeps = getImplicitDevDependencies({
|
|
1063
|
+
...fileContext,
|
|
1064
|
+
allDependencies: allDeps,
|
|
1065
|
+
location
|
|
1066
|
+
});
|
|
1067
|
+
const requiredPeers = getRequiredPeerDependencies(location, allDeps);
|
|
1068
|
+
const scriptRefs = getScriptReferencedPackages(location, allDeps);
|
|
1069
|
+
let unusedDevDependencies = 0;
|
|
1070
|
+
for (const dep of devDependencies) {
|
|
1071
|
+
if (dependencies.includes(dep) || peerDependencies.includes(dep)) continue;
|
|
1072
|
+
if (!isDevDepUsed(dep, allImports, implicitDeps, requiredPeers, scriptRefs)) {
|
|
1073
|
+
unusedDevDependencies++;
|
|
1074
|
+
console.log(`[${chalk14.blue(name)}] Unused devDependency in package.json: ${chalk14.red(dep)}`);
|
|
1075
|
+
}
|
|
1076
|
+
}
|
|
1077
|
+
if (unusedDevDependencies > 0) {
|
|
1078
|
+
const packageLocation = `${location}/package.json`;
|
|
1079
|
+
console.log(` ${chalk14.yellow(packageLocation)}
|
|
1080
|
+
`);
|
|
1081
|
+
}
|
|
1082
|
+
return unusedDevDependencies;
|
|
1083
|
+
}
|
|
1084
|
+
|
|
1085
|
+
// src/actions/deplint/checkPackage/getUnusedPeerDependencies.ts
|
|
1086
|
+
import chalk15 from "chalk";
|
|
831
1087
|
function getUnusedPeerDependencies({ name, location }, { peerDependencies, dependencies }, { externalDistImports, externalDistTypeImports }) {
|
|
832
1088
|
let unusedDependencies = 0;
|
|
833
1089
|
for (const dep of peerDependencies) {
|
|
834
1090
|
if (!externalDistImports.includes(dep) && !externalDistImports.includes(dep.replace(/^@types\//, "")) && !externalDistTypeImports.includes(dep) && !externalDistTypeImports.includes(dep.replace(/^@types\//, ""))) {
|
|
835
1091
|
unusedDependencies++;
|
|
836
1092
|
if (dependencies.includes(dep)) {
|
|
837
|
-
console.log(`[${
|
|
1093
|
+
console.log(`[${chalk15.blue(name)}] Unused peerDependency [already a dependency] in package.json: ${chalk15.red(dep)}`);
|
|
838
1094
|
} else {
|
|
839
|
-
console.log(`[${
|
|
1095
|
+
console.log(`[${chalk15.blue(name)}] Unused peerDependency in package.json: ${chalk15.red(dep)}`);
|
|
840
1096
|
}
|
|
841
1097
|
}
|
|
842
1098
|
}
|
|
843
1099
|
if (unusedDependencies > 0) {
|
|
844
1100
|
const packageLocation = `${location}/package.json`;
|
|
845
|
-
console.log(` ${
|
|
1101
|
+
console.log(` ${chalk15.yellow(packageLocation)}
|
|
846
1102
|
`);
|
|
847
1103
|
}
|
|
848
1104
|
return unusedDependencies;
|
|
849
1105
|
}
|
|
850
1106
|
|
|
851
1107
|
// src/actions/deplint/checkPackage/checkPackage.ts
|
|
1108
|
+
function logVerbose(name, location, srcFiles, distFiles, configFiles, tsconfigExtends) {
|
|
1109
|
+
console.info(`Checking package: ${name} at ${location}`);
|
|
1110
|
+
console.info(`Source files: ${srcFiles.length}, Distribution files: ${distFiles.length}, Config files: ${configFiles.length}`);
|
|
1111
|
+
for (const file of srcFiles) {
|
|
1112
|
+
console.info(`Source file: ${file}`);
|
|
1113
|
+
}
|
|
1114
|
+
for (const file of distFiles) {
|
|
1115
|
+
console.info(`Distribution file: ${file}`);
|
|
1116
|
+
}
|
|
1117
|
+
for (const file of configFiles) {
|
|
1118
|
+
console.info(`Config file: ${file}`);
|
|
1119
|
+
}
|
|
1120
|
+
for (const ext of tsconfigExtends) {
|
|
1121
|
+
console.info(`Tsconfig extends: ${ext}`);
|
|
1122
|
+
}
|
|
1123
|
+
}
|
|
852
1124
|
function checkPackage({
|
|
853
1125
|
name,
|
|
854
1126
|
location,
|
|
@@ -857,27 +1129,36 @@ function checkPackage({
|
|
|
857
1129
|
peerDeps = false,
|
|
858
1130
|
verbose = false
|
|
859
1131
|
}) {
|
|
860
|
-
const {
|
|
1132
|
+
const {
|
|
1133
|
+
srcFiles,
|
|
1134
|
+
distFiles,
|
|
1135
|
+
configFiles
|
|
1136
|
+
} = findFiles(location);
|
|
1137
|
+
const tsconfigExtends = getExtendsFromTsconfigs(location);
|
|
861
1138
|
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
|
-
}
|
|
1139
|
+
logVerbose(name, location, srcFiles, distFiles, configFiles, tsconfigExtends);
|
|
870
1140
|
}
|
|
871
1141
|
const checkDeps = deps || !(deps || devDeps || peerDeps);
|
|
872
1142
|
const checkDevDeps = devDeps || !(deps || devDeps || peerDeps);
|
|
873
1143
|
const checkPeerDeps = peerDeps;
|
|
874
|
-
const sourceParams = getExternalImportsFromFiles({
|
|
1144
|
+
const sourceParams = getExternalImportsFromFiles({
|
|
1145
|
+
srcFiles,
|
|
1146
|
+
distFiles,
|
|
1147
|
+
configFiles,
|
|
1148
|
+
tsconfigExtends
|
|
1149
|
+
});
|
|
875
1150
|
const packageParams = getDependenciesFromPackageJson(`${location}/package.json`);
|
|
876
1151
|
const unlistedDependencies = checkDeps ? getUnlistedDependencies({ name, location }, packageParams, sourceParams) : 0;
|
|
877
1152
|
const unusedDependencies = checkDeps ? getUnusedDependencies({ name, location }, packageParams, sourceParams) : 0;
|
|
878
1153
|
const unlistedDevDependencies = checkDevDeps ? getUnlistedDevDependencies({ name, location }, packageParams, sourceParams) : 0;
|
|
1154
|
+
const fileContext = {
|
|
1155
|
+
configFiles,
|
|
1156
|
+
distFiles,
|
|
1157
|
+
srcFiles
|
|
1158
|
+
};
|
|
1159
|
+
const unusedDevDependencies = checkDevDeps ? getUnusedDevDependencies({ name, location }, packageParams, sourceParams, fileContext) : 0;
|
|
879
1160
|
const unusedPeerDependencies = checkPeerDeps ? getUnusedPeerDependencies({ name, location }, packageParams, sourceParams) : 0;
|
|
880
|
-
const totalErrors = unlistedDependencies + unlistedDevDependencies + unusedDependencies + unusedPeerDependencies;
|
|
1161
|
+
const totalErrors = unlistedDependencies + unlistedDevDependencies + unusedDependencies + unusedDevDependencies + unusedPeerDependencies;
|
|
881
1162
|
return totalErrors;
|
|
882
1163
|
}
|
|
883
1164
|
|
|
@@ -915,9 +1196,9 @@ var deplint = ({
|
|
|
915
1196
|
});
|
|
916
1197
|
}
|
|
917
1198
|
if (totalErrors > 0) {
|
|
918
|
-
console.warn(`Deplint: Found ${
|
|
1199
|
+
console.warn(`Deplint: Found ${chalk16.red(totalErrors)} dependency problems. ${chalk16.red("\u2716")}`);
|
|
919
1200
|
} else {
|
|
920
|
-
console.info(`Deplint: Found no dependency problems. ${
|
|
1201
|
+
console.info(`Deplint: Found no dependency problems. ${chalk16.green("\u2714")}`);
|
|
921
1202
|
}
|
|
922
1203
|
return 0;
|
|
923
1204
|
};
|
|
@@ -1019,22 +1300,22 @@ var deployNext = () => {
|
|
|
1019
1300
|
};
|
|
1020
1301
|
|
|
1021
1302
|
// src/actions/dupdeps.ts
|
|
1022
|
-
import
|
|
1303
|
+
import chalk17 from "chalk";
|
|
1023
1304
|
var dupdeps = () => {
|
|
1024
|
-
console.log(
|
|
1305
|
+
console.log(chalk17.green("Checking all Dependencies for Duplicates"));
|
|
1025
1306
|
const allDependencies = parsedPackageJSON()?.dependencies;
|
|
1026
1307
|
const dependencies = Object.entries(allDependencies).map(([k]) => k);
|
|
1027
1308
|
return detectDuplicateDependencies(dependencies);
|
|
1028
1309
|
};
|
|
1029
1310
|
|
|
1030
1311
|
// src/actions/lint.ts
|
|
1031
|
-
import
|
|
1312
|
+
import chalk18 from "chalk";
|
|
1032
1313
|
var lintPackage = ({
|
|
1033
1314
|
pkg,
|
|
1034
1315
|
fix: fix2,
|
|
1035
1316
|
verbose
|
|
1036
1317
|
}) => {
|
|
1037
|
-
console.log(
|
|
1318
|
+
console.log(chalk18.gray(`${fix2 ? "Fix" : "Lint"} [${pkg}]`));
|
|
1038
1319
|
const start = Date.now();
|
|
1039
1320
|
const result = runSteps(`${fix2 ? "Fix" : "Lint"} [${pkg}]`, [
|
|
1040
1321
|
["yarn", [
|
|
@@ -1044,7 +1325,7 @@ var lintPackage = ({
|
|
|
1044
1325
|
fix2 ? "package-fix" : verbose ? "package-lint-verbose" : "package-lint"
|
|
1045
1326
|
]]
|
|
1046
1327
|
]);
|
|
1047
|
-
console.log(
|
|
1328
|
+
console.log(chalk18.gray(`${fix2 ? "Fixed in" : "Linted in"} [${chalk18.magenta(((Date.now() - start) / 1e3).toFixed(2))}] ${chalk18.gray("seconds")}`));
|
|
1048
1329
|
return result;
|
|
1049
1330
|
};
|
|
1050
1331
|
var lint = ({
|
|
@@ -1064,13 +1345,13 @@ var lint = ({
|
|
|
1064
1345
|
});
|
|
1065
1346
|
};
|
|
1066
1347
|
var lintAllPackages = ({ fix: fix2 = false } = {}) => {
|
|
1067
|
-
console.log(
|
|
1348
|
+
console.log(chalk18.gray(`${fix2 ? "Fix" : "Lint"} [All-Packages]`));
|
|
1068
1349
|
const start = Date.now();
|
|
1069
1350
|
const fixOptions = fix2 ? ["--fix"] : [];
|
|
1070
1351
|
const result = runSteps(`${fix2 ? "Fix" : "Lint"} [All-Packages]`, [
|
|
1071
1352
|
["yarn", ["eslint", "--cache", "--cache-location", ".eslintcache", "--cache-strategy", "content", ...fixOptions]]
|
|
1072
1353
|
]);
|
|
1073
|
-
console.log(
|
|
1354
|
+
console.log(chalk18.gray(`${fix2 ? "Fixed in" : "Linted in"} [${chalk18.magenta(((Date.now() - start) / 1e3).toFixed(2))}] ${chalk18.gray("seconds")}`));
|
|
1074
1355
|
return result;
|
|
1075
1356
|
};
|
|
1076
1357
|
|
|
@@ -1098,7 +1379,7 @@ var filename = ".gitignore";
|
|
|
1098
1379
|
var gitignoreGen = (pkg) => generateIgnoreFiles(filename, pkg);
|
|
1099
1380
|
|
|
1100
1381
|
// src/actions/gitlint.ts
|
|
1101
|
-
import
|
|
1382
|
+
import chalk19 from "chalk";
|
|
1102
1383
|
import ParseGitConfig from "parse-git-config";
|
|
1103
1384
|
var gitlint = () => {
|
|
1104
1385
|
console.log(`
|
|
@@ -1109,7 +1390,7 @@ Gitlint Start [${process.cwd()}]
|
|
|
1109
1390
|
const errors = 0;
|
|
1110
1391
|
const gitConfig = ParseGitConfig.sync();
|
|
1111
1392
|
const warn = (message) => {
|
|
1112
|
-
console.warn(
|
|
1393
|
+
console.warn(chalk19.yellow(`Warning: ${message}`));
|
|
1113
1394
|
warnings++;
|
|
1114
1395
|
};
|
|
1115
1396
|
if (gitConfig.core.ignorecase) {
|
|
@@ -1129,13 +1410,13 @@ Gitlint Start [${process.cwd()}]
|
|
|
1129
1410
|
}
|
|
1130
1411
|
const resultMessages = [];
|
|
1131
1412
|
if (valid > 0) {
|
|
1132
|
-
resultMessages.push(
|
|
1413
|
+
resultMessages.push(chalk19.green(`Passed: ${valid}`));
|
|
1133
1414
|
}
|
|
1134
1415
|
if (warnings > 0) {
|
|
1135
|
-
resultMessages.push(
|
|
1416
|
+
resultMessages.push(chalk19.yellow(`Warnings: ${warnings}`));
|
|
1136
1417
|
}
|
|
1137
1418
|
if (errors > 0) {
|
|
1138
|
-
resultMessages.push(
|
|
1419
|
+
resultMessages.push(chalk19.red(` Errors: ${errors}`));
|
|
1139
1420
|
}
|
|
1140
1421
|
console.warn(`Gitlint Finish [ ${resultMessages.join(" | ")} ]
|
|
1141
1422
|
`);
|
|
@@ -1144,7 +1425,7 @@ Gitlint Start [${process.cwd()}]
|
|
|
1144
1425
|
|
|
1145
1426
|
// src/actions/gitlint-fix.ts
|
|
1146
1427
|
import { execSync as execSync2 } from "child_process";
|
|
1147
|
-
import
|
|
1428
|
+
import chalk20 from "chalk";
|
|
1148
1429
|
import ParseGitConfig2 from "parse-git-config";
|
|
1149
1430
|
var gitlintFix = () => {
|
|
1150
1431
|
console.log(`
|
|
@@ -1153,15 +1434,15 @@ Gitlint Fix Start [${process.cwd()}]
|
|
|
1153
1434
|
const gitConfig = ParseGitConfig2.sync();
|
|
1154
1435
|
if (gitConfig.core.ignorecase) {
|
|
1155
1436
|
execSync2("git config core.ignorecase false", { stdio: "inherit" });
|
|
1156
|
-
console.warn(
|
|
1437
|
+
console.warn(chalk20.yellow("\nGitlint Fix: Updated core.ignorecase to be false\n"));
|
|
1157
1438
|
}
|
|
1158
1439
|
if (gitConfig.core.autocrlf !== false) {
|
|
1159
1440
|
execSync2("git config core.autocrlf false", { stdio: "inherit" });
|
|
1160
|
-
console.warn(
|
|
1441
|
+
console.warn(chalk20.yellow("\nGitlint Fix: Updated core.autocrlf to be false\n"));
|
|
1161
1442
|
}
|
|
1162
1443
|
if (gitConfig.core.eol !== "lf") {
|
|
1163
1444
|
execSync2("git config core.eol lf", { stdio: "inherit" });
|
|
1164
|
-
console.warn(
|
|
1445
|
+
console.warn(chalk20.yellow('\nGitlint Fix: Updated core.eol to be "lf"\n'));
|
|
1165
1446
|
}
|
|
1166
1447
|
return 1;
|
|
1167
1448
|
};
|
|
@@ -1172,7 +1453,7 @@ var knip = () => {
|
|
|
1172
1453
|
};
|
|
1173
1454
|
|
|
1174
1455
|
// src/actions/license.ts
|
|
1175
|
-
import
|
|
1456
|
+
import chalk21 from "chalk";
|
|
1176
1457
|
import { init } from "license-checker";
|
|
1177
1458
|
var license = async (pkg) => {
|
|
1178
1459
|
const workspaces = yarnWorkspaces();
|
|
@@ -1197,18 +1478,18 @@ var license = async (pkg) => {
|
|
|
1197
1478
|
"LGPL-3.0-or-later",
|
|
1198
1479
|
"Python-2.0"
|
|
1199
1480
|
]);
|
|
1200
|
-
console.log(
|
|
1481
|
+
console.log(chalk21.green("License Checker"));
|
|
1201
1482
|
return (await Promise.all(
|
|
1202
1483
|
workspaceList.map(({ location, name }) => {
|
|
1203
1484
|
return new Promise((resolve) => {
|
|
1204
1485
|
init({ production: true, start: location }, (error, packages) => {
|
|
1205
1486
|
if (error) {
|
|
1206
|
-
console.error(
|
|
1207
|
-
console.error(
|
|
1487
|
+
console.error(chalk21.red(`License Checker [${name}] Error`));
|
|
1488
|
+
console.error(chalk21.gray(error));
|
|
1208
1489
|
console.log("\n");
|
|
1209
1490
|
resolve(1);
|
|
1210
1491
|
} else {
|
|
1211
|
-
console.log(
|
|
1492
|
+
console.log(chalk21.green(`License Checker [${name}]`));
|
|
1212
1493
|
let count = 0;
|
|
1213
1494
|
for (const [name2, info] of Object.entries(packages)) {
|
|
1214
1495
|
const licenses = Array.isArray(info.licenses) ? info.licenses : [info.licenses];
|
|
@@ -1224,7 +1505,7 @@ var license = async (pkg) => {
|
|
|
1224
1505
|
}
|
|
1225
1506
|
if (!orLicenseFound) {
|
|
1226
1507
|
count++;
|
|
1227
|
-
console.warn(
|
|
1508
|
+
console.warn(chalk21.yellow(`${name2}: Package License not allowed [${license2}]`));
|
|
1228
1509
|
}
|
|
1229
1510
|
}
|
|
1230
1511
|
}
|
|
@@ -1268,7 +1549,7 @@ var rebuild = ({ target }) => {
|
|
|
1268
1549
|
};
|
|
1269
1550
|
|
|
1270
1551
|
// src/actions/recompile.ts
|
|
1271
|
-
import
|
|
1552
|
+
import chalk22 from "chalk";
|
|
1272
1553
|
var recompile = async ({
|
|
1273
1554
|
verbose,
|
|
1274
1555
|
target,
|
|
@@ -1304,7 +1585,7 @@ var recompileAll = async ({
|
|
|
1304
1585
|
const incrementalOptions = incremental ? ["--since", "-Apt", "--topological-dev"] : ["--parallel", "-Apt", "--topological-dev"];
|
|
1305
1586
|
const jobsOptions = jobs ? ["-j", `${jobs}`] : [];
|
|
1306
1587
|
if (jobs) {
|
|
1307
|
-
console.log(
|
|
1588
|
+
console.log(chalk22.blue(`Jobs set to [${jobs}]`));
|
|
1308
1589
|
}
|
|
1309
1590
|
const result = await runStepsAsync(`Recompile${incremental ? "-Incremental" : ""} [All]`, [
|
|
1310
1591
|
[
|
|
@@ -1335,7 +1616,7 @@ var recompileAll = async ({
|
|
|
1335
1616
|
]
|
|
1336
1617
|
]);
|
|
1337
1618
|
console.log(
|
|
1338
|
-
`${
|
|
1619
|
+
`${chalk22.gray("Recompiled in")} [${chalk22.magenta(((Date.now() - start) / 1e3).toFixed(2))}] ${chalk22.gray("seconds")}`
|
|
1339
1620
|
);
|
|
1340
1621
|
return result;
|
|
1341
1622
|
};
|
|
@@ -1366,13 +1647,13 @@ var reinstall = () => {
|
|
|
1366
1647
|
};
|
|
1367
1648
|
|
|
1368
1649
|
// src/actions/relint.ts
|
|
1369
|
-
import
|
|
1650
|
+
import chalk23 from "chalk";
|
|
1370
1651
|
var relintPackage = ({
|
|
1371
1652
|
pkg,
|
|
1372
1653
|
fix: fix2,
|
|
1373
1654
|
verbose
|
|
1374
1655
|
}) => {
|
|
1375
|
-
console.log(
|
|
1656
|
+
console.log(chalk23.gray(`${fix2 ? "Fix" : "Lint"} [${pkg}]`));
|
|
1376
1657
|
const start = Date.now();
|
|
1377
1658
|
const result = runSteps(`${fix2 ? "Fix" : "Lint"} [${pkg}]`, [
|
|
1378
1659
|
["yarn", [
|
|
@@ -1382,7 +1663,7 @@ var relintPackage = ({
|
|
|
1382
1663
|
fix2 ? "package-fix" : verbose ? "package-lint-verbose" : "package-lint"
|
|
1383
1664
|
]]
|
|
1384
1665
|
]);
|
|
1385
|
-
console.log(
|
|
1666
|
+
console.log(chalk23.gray(`${fix2 ? "Fixed in" : "Linted in"} [${chalk23.magenta(((Date.now() - start) / 1e3).toFixed(2))}] ${chalk23.gray("seconds")}`));
|
|
1386
1667
|
return result;
|
|
1387
1668
|
};
|
|
1388
1669
|
var relint = ({
|
|
@@ -1402,13 +1683,13 @@ var relint = ({
|
|
|
1402
1683
|
});
|
|
1403
1684
|
};
|
|
1404
1685
|
var relintAllPackages = ({ fix: fix2 = false } = {}) => {
|
|
1405
|
-
console.log(
|
|
1686
|
+
console.log(chalk23.gray(`${fix2 ? "Fix" : "Lint"} [All-Packages]`));
|
|
1406
1687
|
const start = Date.now();
|
|
1407
1688
|
const fixOptions = fix2 ? ["--fix"] : [];
|
|
1408
1689
|
const result = runSteps(`${fix2 ? "Fix" : "Lint"} [All-Packages]`, [
|
|
1409
1690
|
["yarn", ["eslint", ...fixOptions]]
|
|
1410
1691
|
]);
|
|
1411
|
-
console.log(
|
|
1692
|
+
console.log(chalk23.gray(`${fix2 ? "Fixed in" : "Linted in"} [${chalk23.magenta(((Date.now() - start) / 1e3).toFixed(2))}] ${chalk23.gray("seconds")}`));
|
|
1412
1693
|
return result;
|
|
1413
1694
|
};
|
|
1414
1695
|
|
|
@@ -1426,10 +1707,10 @@ var sonar = () => {
|
|
|
1426
1707
|
};
|
|
1427
1708
|
|
|
1428
1709
|
// src/actions/statics.ts
|
|
1429
|
-
import
|
|
1710
|
+
import chalk24 from "chalk";
|
|
1430
1711
|
var DefaultDependencies = ["axios", "@xylabs/pixel", "react", "graphql", "react-router", "@mui/material", "@mui/system"];
|
|
1431
1712
|
var statics = () => {
|
|
1432
|
-
console.log(
|
|
1713
|
+
console.log(chalk24.green("Check Required Static Dependencies"));
|
|
1433
1714
|
const statics2 = parsedPackageJSON()?.xy?.deps?.statics;
|
|
1434
1715
|
return detectDuplicateDependencies(statics2, DefaultDependencies);
|
|
1435
1716
|
};
|
|
@@ -1829,7 +2110,7 @@ var xyInstallCommands = (args) => {
|
|
|
1829
2110
|
};
|
|
1830
2111
|
|
|
1831
2112
|
// src/xy/xyLintCommands.ts
|
|
1832
|
-
import
|
|
2113
|
+
import chalk25 from "chalk";
|
|
1833
2114
|
var xyLintCommands = (args) => {
|
|
1834
2115
|
return args.command(
|
|
1835
2116
|
"cycle [package]",
|
|
@@ -1841,7 +2122,7 @@ var xyLintCommands = (args) => {
|
|
|
1841
2122
|
const start = Date.now();
|
|
1842
2123
|
if (argv.verbose) console.log("Cycle");
|
|
1843
2124
|
process.exitCode = await cycle({ pkg: argv.package });
|
|
1844
|
-
console.log(
|
|
2125
|
+
console.log(chalk25.blue(`Finished in ${Date.now() - start}ms`));
|
|
1845
2126
|
}
|
|
1846
2127
|
).command(
|
|
1847
2128
|
"lint [package]",
|
|
@@ -1871,7 +2152,7 @@ var xyLintCommands = (args) => {
|
|
|
1871
2152
|
cache: argv.cache,
|
|
1872
2153
|
verbose: !!argv.verbose
|
|
1873
2154
|
});
|
|
1874
|
-
console.log(
|
|
2155
|
+
console.log(chalk25.blue(`Finished in ${Date.now() - start}ms`));
|
|
1875
2156
|
}
|
|
1876
2157
|
).command(
|
|
1877
2158
|
"deplint [package]",
|
|
@@ -1904,7 +2185,7 @@ var xyLintCommands = (args) => {
|
|
|
1904
2185
|
peerDeps: !!argv.peerDeps,
|
|
1905
2186
|
verbose: !!argv.verbose
|
|
1906
2187
|
});
|
|
1907
|
-
console.log(
|
|
2188
|
+
console.log(chalk25.blue(`Finished in ${Date.now() - start}ms`));
|
|
1908
2189
|
}
|
|
1909
2190
|
).command(
|
|
1910
2191
|
"fix [package]",
|
|
@@ -1916,7 +2197,7 @@ var xyLintCommands = (args) => {
|
|
|
1916
2197
|
const start = Date.now();
|
|
1917
2198
|
if (argv.verbose) console.log("Fix");
|
|
1918
2199
|
process.exitCode = fix();
|
|
1919
|
-
console.log(
|
|
2200
|
+
console.log(chalk25.blue(`Finished in ${Date.now() - start}ms`));
|
|
1920
2201
|
}
|
|
1921
2202
|
).command(
|
|
1922
2203
|
"relint [package]",
|
|
@@ -1928,7 +2209,7 @@ var xyLintCommands = (args) => {
|
|
|
1928
2209
|
if (argv.verbose) console.log("Relinting");
|
|
1929
2210
|
const start = Date.now();
|
|
1930
2211
|
process.exitCode = relint();
|
|
1931
|
-
console.log(
|
|
2212
|
+
console.log(chalk25.blue(`Finished in ${Date.now() - start}ms`));
|
|
1932
2213
|
}
|
|
1933
2214
|
).command(
|
|
1934
2215
|
"publint [package]",
|
|
@@ -1940,7 +2221,7 @@ var xyLintCommands = (args) => {
|
|
|
1940
2221
|
if (argv.verbose) console.log("Publint");
|
|
1941
2222
|
const start = Date.now();
|
|
1942
2223
|
process.exitCode = await publint({ pkg: argv.package, verbose: !!argv.verbose });
|
|
1943
|
-
console.log(
|
|
2224
|
+
console.log(chalk25.blue(`Finished in ${Date.now() - start}ms`));
|
|
1944
2225
|
}
|
|
1945
2226
|
).command(
|
|
1946
2227
|
"knip",
|
|
@@ -1952,7 +2233,7 @@ var xyLintCommands = (args) => {
|
|
|
1952
2233
|
if (argv.verbose) console.log("Knip");
|
|
1953
2234
|
const start = Date.now();
|
|
1954
2235
|
process.exitCode = knip();
|
|
1955
|
-
console.log(
|
|
2236
|
+
console.log(chalk25.blue(`Knip finished in ${Date.now() - start}ms`));
|
|
1956
2237
|
}
|
|
1957
2238
|
).command(
|
|
1958
2239
|
"sonar",
|
|
@@ -1964,7 +2245,7 @@ var xyLintCommands = (args) => {
|
|
|
1964
2245
|
const start = Date.now();
|
|
1965
2246
|
if (argv.verbose) console.log("Sonar Check");
|
|
1966
2247
|
process.exitCode = sonar();
|
|
1967
|
-
console.log(
|
|
2248
|
+
console.log(chalk25.blue(`Finished in ${Date.now() - start}ms`));
|
|
1968
2249
|
}
|
|
1969
2250
|
);
|
|
1970
2251
|
};
|
|
@@ -2000,8 +2281,8 @@ var xyParseOptions = () => {
|
|
|
2000
2281
|
var xy = async () => {
|
|
2001
2282
|
const options = xyParseOptions();
|
|
2002
2283
|
return await xyBuildCommands(xyCommonCommands(xyInstallCommands(xyDeployCommands(xyLintCommands(options))))).demandCommand(1).command("*", "", () => {
|
|
2003
|
-
console.error(
|
|
2004
|
-
console.log(
|
|
2284
|
+
console.error(chalk26.yellow(`Command not found [${chalk26.magenta(process.argv[2])}]`));
|
|
2285
|
+
console.log(chalk26.gray("Try 'yarn xy --help' for list of commands"));
|
|
2005
2286
|
}).version().help().argv;
|
|
2006
2287
|
};
|
|
2007
2288
|
export {
|