@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/actions/index.mjs
CHANGED
|
@@ -315,8 +315,8 @@ var loadConfig = async (params) => {
|
|
|
315
315
|
|
|
316
316
|
// src/lib/parsedPackageJSON.ts
|
|
317
317
|
import { readFileSync as readFileSync2 } from "fs";
|
|
318
|
-
var parsedPackageJSON = (
|
|
319
|
-
const pathToPackageJSON =
|
|
318
|
+
var parsedPackageJSON = (path13) => {
|
|
319
|
+
const pathToPackageJSON = path13 ?? process.env.npm_package_json ?? "";
|
|
320
320
|
const packageJSON = readFileSync2(pathToPackageJSON).toString();
|
|
321
321
|
return JSON.parse(packageJSON);
|
|
322
322
|
};
|
|
@@ -598,7 +598,7 @@ var cycleAll = async ({ verbose = false }) => {
|
|
|
598
598
|
combinedDependencies: true,
|
|
599
599
|
outputType: verbose ? "text" : "err"
|
|
600
600
|
};
|
|
601
|
-
const target = "**/src";
|
|
601
|
+
const target = "**/packages/*/src";
|
|
602
602
|
console.log(`Checking for circular dependencies in ${target}...`);
|
|
603
603
|
const result = await cruise([target], cruiseOptions);
|
|
604
604
|
if (result.output) {
|
|
@@ -618,7 +618,7 @@ var dead = () => {
|
|
|
618
618
|
};
|
|
619
619
|
|
|
620
620
|
// src/actions/deplint/deplint.ts
|
|
621
|
-
import
|
|
621
|
+
import chalk17 from "chalk";
|
|
622
622
|
|
|
623
623
|
// src/actions/deplint/findFilesByGlob.ts
|
|
624
624
|
import { globSync } from "glob";
|
|
@@ -627,12 +627,18 @@ function findFilesByGlob(cwd5, pattern) {
|
|
|
627
627
|
}
|
|
628
628
|
|
|
629
629
|
// src/actions/deplint/findFiles.ts
|
|
630
|
-
function findFiles(
|
|
631
|
-
const allSourceInclude = ["./src/**/*.{ts,tsx}"];
|
|
630
|
+
function findFiles(path13) {
|
|
631
|
+
const allSourceInclude = ["./src/**/*.{ts,tsx,mts,cts,js,mjs,cjs}"];
|
|
632
632
|
const allDistInclude = ["./dist/**/*.d.ts", "./dist/**/*.{mjs,js,cjs}"];
|
|
633
|
-
const
|
|
634
|
-
const
|
|
635
|
-
|
|
633
|
+
const allConfigInclude = ["./*.config.{ts,mts,mjs,js}"];
|
|
634
|
+
const srcFiles = allSourceInclude.flatMap((pattern) => findFilesByGlob(path13, pattern));
|
|
635
|
+
const distFiles = allDistInclude.flatMap((pattern) => findFilesByGlob(path13, pattern));
|
|
636
|
+
const configFiles = allConfigInclude.flatMap((pattern) => findFilesByGlob(path13, pattern));
|
|
637
|
+
return {
|
|
638
|
+
srcFiles,
|
|
639
|
+
distFiles,
|
|
640
|
+
configFiles
|
|
641
|
+
};
|
|
636
642
|
}
|
|
637
643
|
|
|
638
644
|
// src/actions/deplint/getDependenciesFromPackageJson.ts
|
|
@@ -652,10 +658,9 @@ function getDependenciesFromPackageJson(packageJsonPath) {
|
|
|
652
658
|
};
|
|
653
659
|
}
|
|
654
660
|
|
|
655
|
-
// src/actions/deplint/
|
|
661
|
+
// src/actions/deplint/getExtendsFromTsconfigs.ts
|
|
656
662
|
import fs3 from "fs";
|
|
657
|
-
import
|
|
658
|
-
import ts from "typescript";
|
|
663
|
+
import { globSync as globSync2 } from "glob";
|
|
659
664
|
|
|
660
665
|
// src/actions/deplint/getBasePackageName.ts
|
|
661
666
|
function getBasePackageName(importName) {
|
|
@@ -667,7 +672,37 @@ function getBasePackageName(importName) {
|
|
|
667
672
|
return importNameScrubbed.split("/")[0];
|
|
668
673
|
}
|
|
669
674
|
|
|
675
|
+
// src/actions/deplint/getExtendsFromTsconfigs.ts
|
|
676
|
+
var isExternalReference = (ref) => !ref.startsWith(".") && !ref.startsWith("/");
|
|
677
|
+
function parseExtendsField(value) {
|
|
678
|
+
if (typeof value === "string") return [value];
|
|
679
|
+
if (Array.isArray(value)) return value.filter((v) => typeof v === "string");
|
|
680
|
+
return [];
|
|
681
|
+
}
|
|
682
|
+
function getExtendsFromTsconfigs(location) {
|
|
683
|
+
const tsconfigFiles = globSync2("./tsconfig*.json", { cwd: location, absolute: true });
|
|
684
|
+
const packages = /* @__PURE__ */ new Set();
|
|
685
|
+
for (const file of tsconfigFiles) {
|
|
686
|
+
try {
|
|
687
|
+
const content = fs3.readFileSync(file, "utf8");
|
|
688
|
+
const cleaned = content.replaceAll(/\/\/.*/g, "").replaceAll(/,\s*([}\]])/g, "$1");
|
|
689
|
+
const parsed = JSON.parse(cleaned);
|
|
690
|
+
const refs = parseExtendsField(parsed.extends);
|
|
691
|
+
for (const ref of refs) {
|
|
692
|
+
if (isExternalReference(ref)) {
|
|
693
|
+
packages.add(getBasePackageName(ref));
|
|
694
|
+
}
|
|
695
|
+
}
|
|
696
|
+
} catch {
|
|
697
|
+
}
|
|
698
|
+
}
|
|
699
|
+
return [...packages];
|
|
700
|
+
}
|
|
701
|
+
|
|
670
702
|
// src/actions/deplint/getImportsFromFile.ts
|
|
703
|
+
import fs4 from "fs";
|
|
704
|
+
import path4 from "path";
|
|
705
|
+
import ts from "typescript";
|
|
671
706
|
function isTypeOnlyImportClause(clause) {
|
|
672
707
|
if (clause === void 0) {
|
|
673
708
|
return false;
|
|
@@ -680,7 +715,7 @@ function isTypeOnlyImportClause(clause) {
|
|
|
680
715
|
return clause.isTypeOnly;
|
|
681
716
|
}
|
|
682
717
|
function getImportsFromFile(filePath, importPaths, typeImportPaths) {
|
|
683
|
-
const sourceCode =
|
|
718
|
+
const sourceCode = fs4.readFileSync(filePath, "utf8");
|
|
684
719
|
const isMjsFile = filePath.endsWith(".mjs");
|
|
685
720
|
const sourceFile = ts.createSourceFile(
|
|
686
721
|
path4.basename(filePath),
|
|
@@ -733,24 +768,38 @@ var internalImportPrefixes = [".", "#", "node:"];
|
|
|
733
768
|
var removeInternalImports = (imports) => {
|
|
734
769
|
return imports.filter((imp) => !internalImportPrefixes.some((prefix) => imp.startsWith(prefix)));
|
|
735
770
|
};
|
|
736
|
-
function getExternalImportsFromFiles({
|
|
771
|
+
function getExternalImportsFromFiles({
|
|
772
|
+
srcFiles,
|
|
773
|
+
distFiles,
|
|
774
|
+
configFiles = [],
|
|
775
|
+
tsconfigExtends = []
|
|
776
|
+
}) {
|
|
737
777
|
const srcImportPaths = {};
|
|
738
778
|
const distImportPaths = {};
|
|
739
779
|
const distTypeImportPaths = {};
|
|
740
|
-
|
|
780
|
+
const configImportPaths = {};
|
|
781
|
+
for (const path13 of srcFiles) getImportsFromFile(path13, srcImportPaths, srcImportPaths).flat();
|
|
782
|
+
for (const path13 of configFiles) getImportsFromFile(path13, configImportPaths, configImportPaths).flat();
|
|
741
783
|
const distTypeFiles = distFiles.filter((file) => file.endsWith(".d.ts") || file.endsWith(".d.cts") || file.endsWith(".d.mts"));
|
|
742
784
|
const distCodeFiles = distFiles.filter((file) => !(file.endsWith(".d.ts") || file.endsWith(".d.cts") || file.endsWith(".d.mts")));
|
|
743
|
-
for (const
|
|
744
|
-
for (const
|
|
785
|
+
for (const path13 of distCodeFiles) getImportsFromFile(path13, distImportPaths, distImportPaths).flat();
|
|
786
|
+
for (const path13 of distTypeFiles) getImportsFromFile(path13, distTypeImportPaths, distTypeImportPaths).flat();
|
|
745
787
|
const srcImports = Object.keys(srcImportPaths);
|
|
746
788
|
const distImports = Object.keys(distImportPaths);
|
|
747
789
|
const distTypeImports = Object.keys(distTypeImportPaths);
|
|
748
790
|
const externalSrcImports = removeInternalImports(srcImports);
|
|
749
791
|
const externalDistImports = removeInternalImports(distImports);
|
|
750
792
|
const externalDistTypeImports = removeInternalImports(distTypeImports);
|
|
793
|
+
const externalConfigImports = removeInternalImports(Object.keys(configImportPaths));
|
|
794
|
+
for (const ext of tsconfigExtends) {
|
|
795
|
+
if (!externalSrcImports.includes(ext)) externalSrcImports.push(ext);
|
|
796
|
+
if (!externalConfigImports.includes(ext)) externalConfigImports.push(ext);
|
|
797
|
+
}
|
|
751
798
|
return {
|
|
799
|
+
configImportPaths,
|
|
752
800
|
srcImports,
|
|
753
801
|
srcImportPaths,
|
|
802
|
+
externalConfigImports,
|
|
754
803
|
externalSrcImports,
|
|
755
804
|
distImports,
|
|
756
805
|
distImportPaths,
|
|
@@ -762,6 +811,15 @@ function getExternalImportsFromFiles({ srcFiles, distFiles }) {
|
|
|
762
811
|
// src/actions/deplint/checkPackage/getUnlistedDependencies.ts
|
|
763
812
|
import { builtinModules } from "module";
|
|
764
813
|
import chalk12 from "chalk";
|
|
814
|
+
function isListedOrBuiltin(imp, name, dependencies, peerDependencies) {
|
|
815
|
+
return dependencies.includes(imp) || imp === name || dependencies.includes(`@types/${imp}`) || peerDependencies.includes(imp) || peerDependencies.includes(`@types/${imp}`) || builtinModules.includes(imp) || builtinModules.includes(`@types/${imp}`);
|
|
816
|
+
}
|
|
817
|
+
function logMissing(name, imp, importPaths) {
|
|
818
|
+
console.log(`[${chalk12.blue(name)}] Missing dependency in package.json: ${chalk12.red(imp)}`);
|
|
819
|
+
if (importPaths[imp]) {
|
|
820
|
+
console.log(` ${importPaths[imp].join("\n ")}`);
|
|
821
|
+
}
|
|
822
|
+
}
|
|
765
823
|
function getUnlistedDependencies({ name, location }, { dependencies, peerDependencies }, {
|
|
766
824
|
externalDistImports,
|
|
767
825
|
externalDistTypeImports,
|
|
@@ -769,17 +827,15 @@ function getUnlistedDependencies({ name, location }, { dependencies, peerDepende
|
|
|
769
827
|
}) {
|
|
770
828
|
let unlistedDependencies = 0;
|
|
771
829
|
for (const imp of externalDistImports) {
|
|
772
|
-
if (!
|
|
830
|
+
if (!isListedOrBuiltin(imp, name, dependencies, peerDependencies)) {
|
|
773
831
|
unlistedDependencies++;
|
|
774
|
-
|
|
775
|
-
console.log(` ${distImportPaths[imp].join("\n ")}`);
|
|
832
|
+
logMissing(name, imp, distImportPaths);
|
|
776
833
|
}
|
|
777
834
|
}
|
|
778
835
|
for (const imp of externalDistTypeImports) {
|
|
779
|
-
if (!
|
|
836
|
+
if (!isListedOrBuiltin(imp, name, dependencies, peerDependencies)) {
|
|
780
837
|
unlistedDependencies++;
|
|
781
|
-
|
|
782
|
-
console.log(` ${distImportPaths[imp].join("\n ")}`);
|
|
838
|
+
logMissing(name, imp, distImportPaths);
|
|
783
839
|
}
|
|
784
840
|
}
|
|
785
841
|
if (unlistedDependencies > 0) {
|
|
@@ -807,7 +863,9 @@ function getUnlistedDevDependencies({ name, location }, {
|
|
|
807
863
|
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)) {
|
|
808
864
|
unlistedDevDependencies++;
|
|
809
865
|
console.log(`[${chalk13.blue(name)}] Missing devDependency in package.json: ${chalk13.red(imp)}`);
|
|
810
|
-
|
|
866
|
+
if (srcImportPaths[imp]) {
|
|
867
|
+
console.log(` ${srcImportPaths[imp].join("\n ")}`);
|
|
868
|
+
}
|
|
811
869
|
}
|
|
812
870
|
}
|
|
813
871
|
if (unlistedDevDependencies > 0) {
|
|
@@ -844,29 +902,243 @@ function getUnusedDependencies({ name, location }, { dependencies }, {
|
|
|
844
902
|
return unusedDependencies;
|
|
845
903
|
}
|
|
846
904
|
|
|
847
|
-
// src/actions/deplint/checkPackage/
|
|
905
|
+
// src/actions/deplint/checkPackage/getUnusedDevDependencies.ts
|
|
848
906
|
import chalk15 from "chalk";
|
|
907
|
+
|
|
908
|
+
// src/actions/deplint/getRequiredPeerDependencies.ts
|
|
909
|
+
import fs5 from "fs";
|
|
910
|
+
import path5 from "path";
|
|
911
|
+
function findDepPackageJson(location, dep) {
|
|
912
|
+
let dir = location;
|
|
913
|
+
while (true) {
|
|
914
|
+
const candidate = path5.join(dir, "node_modules", dep, "package.json");
|
|
915
|
+
if (fs5.existsSync(candidate)) return candidate;
|
|
916
|
+
const parent = path5.dirname(dir);
|
|
917
|
+
if (parent === dir) return void 0;
|
|
918
|
+
dir = parent;
|
|
919
|
+
}
|
|
920
|
+
}
|
|
921
|
+
function getRequiredPeerDependencies(location, allDeps) {
|
|
922
|
+
const required = /* @__PURE__ */ new Set();
|
|
923
|
+
for (const dep of allDeps) {
|
|
924
|
+
const depPkgPath = findDepPackageJson(location, dep);
|
|
925
|
+
if (!depPkgPath) continue;
|
|
926
|
+
try {
|
|
927
|
+
const raw = fs5.readFileSync(depPkgPath, "utf8");
|
|
928
|
+
const pkg = JSON.parse(raw);
|
|
929
|
+
if (pkg.peerDependencies) {
|
|
930
|
+
for (const peer of Object.keys(pkg.peerDependencies)) {
|
|
931
|
+
required.add(peer);
|
|
932
|
+
}
|
|
933
|
+
}
|
|
934
|
+
} catch {
|
|
935
|
+
}
|
|
936
|
+
}
|
|
937
|
+
return required;
|
|
938
|
+
}
|
|
939
|
+
|
|
940
|
+
// src/actions/deplint/getScriptReferencedPackages.ts
|
|
941
|
+
import fs6 from "fs";
|
|
942
|
+
import path6 from "path";
|
|
943
|
+
function getBinNames(location, dep) {
|
|
944
|
+
const depPkgPath = findDepPackageJson(location, dep);
|
|
945
|
+
if (!depPkgPath) return [];
|
|
946
|
+
try {
|
|
947
|
+
const raw = fs6.readFileSync(depPkgPath, "utf8");
|
|
948
|
+
const pkg = JSON.parse(raw);
|
|
949
|
+
if (!pkg.bin) return [];
|
|
950
|
+
if (typeof pkg.bin === "string") return [pkg.name?.split("/").pop() ?? dep];
|
|
951
|
+
return Object.keys(pkg.bin);
|
|
952
|
+
} catch {
|
|
953
|
+
return [];
|
|
954
|
+
}
|
|
955
|
+
}
|
|
956
|
+
function tokenizeScript(script) {
|
|
957
|
+
return script.split(/[&|;$()"`\s]+/).map((t) => t.trim()).filter(Boolean);
|
|
958
|
+
}
|
|
959
|
+
function getScriptReferencedPackages(location, allDeps) {
|
|
960
|
+
const pkgPath = path6.join(location, "package.json");
|
|
961
|
+
let scripts = {};
|
|
962
|
+
try {
|
|
963
|
+
const raw = fs6.readFileSync(pkgPath, "utf8");
|
|
964
|
+
const pkg = JSON.parse(raw);
|
|
965
|
+
scripts = pkg.scripts ?? {};
|
|
966
|
+
} catch {
|
|
967
|
+
return /* @__PURE__ */ new Set();
|
|
968
|
+
}
|
|
969
|
+
const scriptText = Object.values(scripts).join(" ");
|
|
970
|
+
const tokens = new Set(tokenizeScript(scriptText));
|
|
971
|
+
const binToPackage = /* @__PURE__ */ new Map();
|
|
972
|
+
for (const dep of allDeps) {
|
|
973
|
+
const bins = getBinNames(location, dep);
|
|
974
|
+
for (const bin of bins) {
|
|
975
|
+
binToPackage.set(bin, dep);
|
|
976
|
+
}
|
|
977
|
+
}
|
|
978
|
+
const referenced = /* @__PURE__ */ new Set();
|
|
979
|
+
for (const token of tokens) {
|
|
980
|
+
const baseName = getBasePackageName(token);
|
|
981
|
+
if (allDeps.includes(baseName)) {
|
|
982
|
+
referenced.add(baseName);
|
|
983
|
+
}
|
|
984
|
+
const pkg = binToPackage.get(token);
|
|
985
|
+
if (pkg) {
|
|
986
|
+
referenced.add(pkg);
|
|
987
|
+
}
|
|
988
|
+
}
|
|
989
|
+
return referenced;
|
|
990
|
+
}
|
|
991
|
+
|
|
992
|
+
// src/actions/deplint/implicitDevDependencies.ts
|
|
993
|
+
import fs7 from "fs";
|
|
994
|
+
var hasFileWithExtension = (files, extensions) => files.some((f) => extensions.some((ext) => f.endsWith(ext)));
|
|
995
|
+
var tsExtensions = [".ts", ".tsx", ".mts", ".cts"];
|
|
996
|
+
var hasTypescriptFiles = ({ srcFiles, configFiles }) => hasFileWithExtension([...srcFiles, ...configFiles], tsExtensions);
|
|
997
|
+
var decoratorPattern = /^\s*@[A-Z]\w*/m;
|
|
998
|
+
var hasDecorators = ({ srcFiles }) => srcFiles.filter((f) => tsExtensions.some((ext) => f.endsWith(ext))).some((file) => {
|
|
999
|
+
try {
|
|
1000
|
+
const content = fs7.readFileSync(file, "utf8");
|
|
1001
|
+
return decoratorPattern.test(content);
|
|
1002
|
+
} catch {
|
|
1003
|
+
return false;
|
|
1004
|
+
}
|
|
1005
|
+
});
|
|
1006
|
+
var importPlugins = /* @__PURE__ */ new Set(["eslint-plugin-import-x", "eslint-plugin-import"]);
|
|
1007
|
+
function hasImportPlugin({ location, allDependencies }) {
|
|
1008
|
+
if (allDependencies.some((d) => importPlugins.has(d))) return true;
|
|
1009
|
+
for (const dep of allDependencies) {
|
|
1010
|
+
const pkgPath = findDepPackageJson(location, dep);
|
|
1011
|
+
if (!pkgPath) continue;
|
|
1012
|
+
try {
|
|
1013
|
+
const pkg = JSON.parse(fs7.readFileSync(pkgPath, "utf8"));
|
|
1014
|
+
const transitiveDeps = [
|
|
1015
|
+
...Object.keys(pkg.dependencies ?? {}),
|
|
1016
|
+
...Object.keys(pkg.peerDependencies ?? {})
|
|
1017
|
+
];
|
|
1018
|
+
if (transitiveDeps.some((d) => importPlugins.has(d))) return true;
|
|
1019
|
+
} catch {
|
|
1020
|
+
}
|
|
1021
|
+
}
|
|
1022
|
+
return false;
|
|
1023
|
+
}
|
|
1024
|
+
var rules = [
|
|
1025
|
+
{
|
|
1026
|
+
package: "typescript",
|
|
1027
|
+
isNeeded: hasTypescriptFiles
|
|
1028
|
+
},
|
|
1029
|
+
{
|
|
1030
|
+
package: "eslint-import-resolver-typescript",
|
|
1031
|
+
isNeeded: (context) => hasTypescriptFiles(context) && context.allDependencies.includes("eslint") && hasImportPlugin(context)
|
|
1032
|
+
},
|
|
1033
|
+
{
|
|
1034
|
+
package: "tslib",
|
|
1035
|
+
isNeeded: hasDecorators
|
|
1036
|
+
}
|
|
1037
|
+
];
|
|
1038
|
+
function getImplicitDevDependencies(context) {
|
|
1039
|
+
const implicit = /* @__PURE__ */ new Set();
|
|
1040
|
+
for (const rule of rules) {
|
|
1041
|
+
if (rule.isNeeded(context)) {
|
|
1042
|
+
implicit.add(rule.package);
|
|
1043
|
+
}
|
|
1044
|
+
}
|
|
1045
|
+
return implicit;
|
|
1046
|
+
}
|
|
1047
|
+
|
|
1048
|
+
// src/actions/deplint/checkPackage/getUnusedDevDependencies.ts
|
|
1049
|
+
var allExternalImports = ({
|
|
1050
|
+
externalSrcImports,
|
|
1051
|
+
externalDistImports,
|
|
1052
|
+
externalDistTypeImports,
|
|
1053
|
+
externalConfigImports
|
|
1054
|
+
}) => {
|
|
1055
|
+
const all = /* @__PURE__ */ new Set([
|
|
1056
|
+
...externalSrcImports,
|
|
1057
|
+
...externalDistImports,
|
|
1058
|
+
...externalDistTypeImports,
|
|
1059
|
+
...externalConfigImports
|
|
1060
|
+
]);
|
|
1061
|
+
return all;
|
|
1062
|
+
};
|
|
1063
|
+
function isDevDepUsed(dep, allImports, implicitDeps, requiredPeers, scriptRefs) {
|
|
1064
|
+
if (implicitDeps.has(dep)) return true;
|
|
1065
|
+
if (requiredPeers.has(dep)) return true;
|
|
1066
|
+
if (scriptRefs.has(dep)) return true;
|
|
1067
|
+
if (dep.startsWith("@types/")) {
|
|
1068
|
+
const baseName = dep.replace(/^@types\//, "");
|
|
1069
|
+
return allImports.has(baseName) || allImports.has(dep) || implicitDeps.has(baseName);
|
|
1070
|
+
}
|
|
1071
|
+
return allImports.has(dep);
|
|
1072
|
+
}
|
|
1073
|
+
function getUnusedDevDependencies({ name, location }, {
|
|
1074
|
+
devDependencies,
|
|
1075
|
+
dependencies,
|
|
1076
|
+
peerDependencies
|
|
1077
|
+
}, sourceParams, fileContext) {
|
|
1078
|
+
const allImports = allExternalImports(sourceParams);
|
|
1079
|
+
const allDeps = [...dependencies, ...devDependencies, ...peerDependencies];
|
|
1080
|
+
const implicitDeps = getImplicitDevDependencies({
|
|
1081
|
+
...fileContext,
|
|
1082
|
+
allDependencies: allDeps,
|
|
1083
|
+
location
|
|
1084
|
+
});
|
|
1085
|
+
const requiredPeers = getRequiredPeerDependencies(location, allDeps);
|
|
1086
|
+
const scriptRefs = getScriptReferencedPackages(location, allDeps);
|
|
1087
|
+
let unusedDevDependencies = 0;
|
|
1088
|
+
for (const dep of devDependencies) {
|
|
1089
|
+
if (dependencies.includes(dep) || peerDependencies.includes(dep)) continue;
|
|
1090
|
+
if (!isDevDepUsed(dep, allImports, implicitDeps, requiredPeers, scriptRefs)) {
|
|
1091
|
+
unusedDevDependencies++;
|
|
1092
|
+
console.log(`[${chalk15.blue(name)}] Unused devDependency in package.json: ${chalk15.red(dep)}`);
|
|
1093
|
+
}
|
|
1094
|
+
}
|
|
1095
|
+
if (unusedDevDependencies > 0) {
|
|
1096
|
+
const packageLocation = `${location}/package.json`;
|
|
1097
|
+
console.log(` ${chalk15.yellow(packageLocation)}
|
|
1098
|
+
`);
|
|
1099
|
+
}
|
|
1100
|
+
return unusedDevDependencies;
|
|
1101
|
+
}
|
|
1102
|
+
|
|
1103
|
+
// src/actions/deplint/checkPackage/getUnusedPeerDependencies.ts
|
|
1104
|
+
import chalk16 from "chalk";
|
|
849
1105
|
function getUnusedPeerDependencies({ name, location }, { peerDependencies, dependencies }, { externalDistImports, externalDistTypeImports }) {
|
|
850
1106
|
let unusedDependencies = 0;
|
|
851
1107
|
for (const dep of peerDependencies) {
|
|
852
1108
|
if (!externalDistImports.includes(dep) && !externalDistImports.includes(dep.replace(/^@types\//, "")) && !externalDistTypeImports.includes(dep) && !externalDistTypeImports.includes(dep.replace(/^@types\//, ""))) {
|
|
853
1109
|
unusedDependencies++;
|
|
854
1110
|
if (dependencies.includes(dep)) {
|
|
855
|
-
console.log(`[${
|
|
1111
|
+
console.log(`[${chalk16.blue(name)}] Unused peerDependency [already a dependency] in package.json: ${chalk16.red(dep)}`);
|
|
856
1112
|
} else {
|
|
857
|
-
console.log(`[${
|
|
1113
|
+
console.log(`[${chalk16.blue(name)}] Unused peerDependency in package.json: ${chalk16.red(dep)}`);
|
|
858
1114
|
}
|
|
859
1115
|
}
|
|
860
1116
|
}
|
|
861
1117
|
if (unusedDependencies > 0) {
|
|
862
1118
|
const packageLocation = `${location}/package.json`;
|
|
863
|
-
console.log(` ${
|
|
1119
|
+
console.log(` ${chalk16.yellow(packageLocation)}
|
|
864
1120
|
`);
|
|
865
1121
|
}
|
|
866
1122
|
return unusedDependencies;
|
|
867
1123
|
}
|
|
868
1124
|
|
|
869
1125
|
// src/actions/deplint/checkPackage/checkPackage.ts
|
|
1126
|
+
function logVerbose(name, location, srcFiles, distFiles, configFiles, tsconfigExtends) {
|
|
1127
|
+
console.info(`Checking package: ${name} at ${location}`);
|
|
1128
|
+
console.info(`Source files: ${srcFiles.length}, Distribution files: ${distFiles.length}, Config files: ${configFiles.length}`);
|
|
1129
|
+
for (const file of srcFiles) {
|
|
1130
|
+
console.info(`Source file: ${file}`);
|
|
1131
|
+
}
|
|
1132
|
+
for (const file of distFiles) {
|
|
1133
|
+
console.info(`Distribution file: ${file}`);
|
|
1134
|
+
}
|
|
1135
|
+
for (const file of configFiles) {
|
|
1136
|
+
console.info(`Config file: ${file}`);
|
|
1137
|
+
}
|
|
1138
|
+
for (const ext of tsconfigExtends) {
|
|
1139
|
+
console.info(`Tsconfig extends: ${ext}`);
|
|
1140
|
+
}
|
|
1141
|
+
}
|
|
870
1142
|
function checkPackage({
|
|
871
1143
|
name,
|
|
872
1144
|
location,
|
|
@@ -875,27 +1147,36 @@ function checkPackage({
|
|
|
875
1147
|
peerDeps = false,
|
|
876
1148
|
verbose = false
|
|
877
1149
|
}) {
|
|
878
|
-
const {
|
|
1150
|
+
const {
|
|
1151
|
+
srcFiles,
|
|
1152
|
+
distFiles,
|
|
1153
|
+
configFiles
|
|
1154
|
+
} = findFiles(location);
|
|
1155
|
+
const tsconfigExtends = getExtendsFromTsconfigs(location);
|
|
879
1156
|
if (verbose) {
|
|
880
|
-
|
|
881
|
-
console.info(`Source files: ${srcFiles.length}, Distribution files: ${distFiles.length}`);
|
|
882
|
-
for (const file of srcFiles) {
|
|
883
|
-
console.info(`Source file: ${file}`);
|
|
884
|
-
}
|
|
885
|
-
for (const file of distFiles) {
|
|
886
|
-
console.info(`Distribution file: ${file}`);
|
|
887
|
-
}
|
|
1157
|
+
logVerbose(name, location, srcFiles, distFiles, configFiles, tsconfigExtends);
|
|
888
1158
|
}
|
|
889
1159
|
const checkDeps = deps || !(deps || devDeps || peerDeps);
|
|
890
1160
|
const checkDevDeps = devDeps || !(deps || devDeps || peerDeps);
|
|
891
1161
|
const checkPeerDeps = peerDeps;
|
|
892
|
-
const sourceParams = getExternalImportsFromFiles({
|
|
1162
|
+
const sourceParams = getExternalImportsFromFiles({
|
|
1163
|
+
srcFiles,
|
|
1164
|
+
distFiles,
|
|
1165
|
+
configFiles,
|
|
1166
|
+
tsconfigExtends
|
|
1167
|
+
});
|
|
893
1168
|
const packageParams = getDependenciesFromPackageJson(`${location}/package.json`);
|
|
894
1169
|
const unlistedDependencies = checkDeps ? getUnlistedDependencies({ name, location }, packageParams, sourceParams) : 0;
|
|
895
1170
|
const unusedDependencies = checkDeps ? getUnusedDependencies({ name, location }, packageParams, sourceParams) : 0;
|
|
896
1171
|
const unlistedDevDependencies = checkDevDeps ? getUnlistedDevDependencies({ name, location }, packageParams, sourceParams) : 0;
|
|
1172
|
+
const fileContext = {
|
|
1173
|
+
configFiles,
|
|
1174
|
+
distFiles,
|
|
1175
|
+
srcFiles
|
|
1176
|
+
};
|
|
1177
|
+
const unusedDevDependencies = checkDevDeps ? getUnusedDevDependencies({ name, location }, packageParams, sourceParams, fileContext) : 0;
|
|
897
1178
|
const unusedPeerDependencies = checkPeerDeps ? getUnusedPeerDependencies({ name, location }, packageParams, sourceParams) : 0;
|
|
898
|
-
const totalErrors = unlistedDependencies + unlistedDevDependencies + unusedDependencies + unusedPeerDependencies;
|
|
1179
|
+
const totalErrors = unlistedDependencies + unlistedDevDependencies + unusedDependencies + unusedDevDependencies + unusedPeerDependencies;
|
|
899
1180
|
return totalErrors;
|
|
900
1181
|
}
|
|
901
1182
|
|
|
@@ -933,9 +1214,9 @@ var deplint = ({
|
|
|
933
1214
|
});
|
|
934
1215
|
}
|
|
935
1216
|
if (totalErrors > 0) {
|
|
936
|
-
console.warn(`Deplint: Found ${
|
|
1217
|
+
console.warn(`Deplint: Found ${chalk17.red(totalErrors)} dependency problems. ${chalk17.red("\u2716")}`);
|
|
937
1218
|
} else {
|
|
938
|
-
console.info(`Deplint: Found no dependency problems. ${
|
|
1219
|
+
console.info(`Deplint: Found no dependency problems. ${chalk17.green("\u2714")}`);
|
|
939
1220
|
}
|
|
940
1221
|
return 0;
|
|
941
1222
|
};
|
|
@@ -1037,22 +1318,22 @@ var deployNext = () => {
|
|
|
1037
1318
|
};
|
|
1038
1319
|
|
|
1039
1320
|
// src/actions/dupdeps.ts
|
|
1040
|
-
import
|
|
1321
|
+
import chalk18 from "chalk";
|
|
1041
1322
|
var dupdeps = () => {
|
|
1042
|
-
console.log(
|
|
1323
|
+
console.log(chalk18.green("Checking all Dependencies for Duplicates"));
|
|
1043
1324
|
const allDependencies = parsedPackageJSON()?.dependencies;
|
|
1044
1325
|
const dependencies = Object.entries(allDependencies).map(([k]) => k);
|
|
1045
1326
|
return detectDuplicateDependencies(dependencies);
|
|
1046
1327
|
};
|
|
1047
1328
|
|
|
1048
1329
|
// src/actions/lint.ts
|
|
1049
|
-
import
|
|
1330
|
+
import chalk19 from "chalk";
|
|
1050
1331
|
var lintPackage = ({
|
|
1051
1332
|
pkg,
|
|
1052
1333
|
fix: fix2,
|
|
1053
1334
|
verbose
|
|
1054
1335
|
}) => {
|
|
1055
|
-
console.log(
|
|
1336
|
+
console.log(chalk19.gray(`${fix2 ? "Fix" : "Lint"} [${pkg}]`));
|
|
1056
1337
|
const start = Date.now();
|
|
1057
1338
|
const result = runSteps(`${fix2 ? "Fix" : "Lint"} [${pkg}]`, [
|
|
1058
1339
|
["yarn", [
|
|
@@ -1062,7 +1343,7 @@ var lintPackage = ({
|
|
|
1062
1343
|
fix2 ? "package-fix" : verbose ? "package-lint-verbose" : "package-lint"
|
|
1063
1344
|
]]
|
|
1064
1345
|
]);
|
|
1065
|
-
console.log(
|
|
1346
|
+
console.log(chalk19.gray(`${fix2 ? "Fixed in" : "Linted in"} [${chalk19.magenta(((Date.now() - start) / 1e3).toFixed(2))}] ${chalk19.gray("seconds")}`));
|
|
1066
1347
|
return result;
|
|
1067
1348
|
};
|
|
1068
1349
|
var lint = ({
|
|
@@ -1082,13 +1363,13 @@ var lint = ({
|
|
|
1082
1363
|
});
|
|
1083
1364
|
};
|
|
1084
1365
|
var lintAllPackages = ({ fix: fix2 = false } = {}) => {
|
|
1085
|
-
console.log(
|
|
1366
|
+
console.log(chalk19.gray(`${fix2 ? "Fix" : "Lint"} [All-Packages]`));
|
|
1086
1367
|
const start = Date.now();
|
|
1087
1368
|
const fixOptions = fix2 ? ["--fix"] : [];
|
|
1088
1369
|
const result = runSteps(`${fix2 ? "Fix" : "Lint"} [All-Packages]`, [
|
|
1089
1370
|
["yarn", ["eslint", "--cache", "--cache-location", ".eslintcache", "--cache-strategy", "content", ...fixOptions]]
|
|
1090
1371
|
]);
|
|
1091
|
-
console.log(
|
|
1372
|
+
console.log(chalk19.gray(`${fix2 ? "Fixed in" : "Linted in"} [${chalk19.magenta(((Date.now() - start) / 1e3).toFixed(2))}] ${chalk19.gray("seconds")}`));
|
|
1092
1373
|
return result;
|
|
1093
1374
|
};
|
|
1094
1375
|
|
|
@@ -1116,7 +1397,7 @@ var filename = ".gitignore";
|
|
|
1116
1397
|
var gitignoreGen = (pkg) => generateIgnoreFiles(filename, pkg);
|
|
1117
1398
|
|
|
1118
1399
|
// src/actions/gitlint.ts
|
|
1119
|
-
import
|
|
1400
|
+
import chalk20 from "chalk";
|
|
1120
1401
|
import ParseGitConfig from "parse-git-config";
|
|
1121
1402
|
var gitlint = () => {
|
|
1122
1403
|
console.log(`
|
|
@@ -1127,7 +1408,7 @@ Gitlint Start [${process.cwd()}]
|
|
|
1127
1408
|
const errors = 0;
|
|
1128
1409
|
const gitConfig = ParseGitConfig.sync();
|
|
1129
1410
|
const warn = (message) => {
|
|
1130
|
-
console.warn(
|
|
1411
|
+
console.warn(chalk20.yellow(`Warning: ${message}`));
|
|
1131
1412
|
warnings++;
|
|
1132
1413
|
};
|
|
1133
1414
|
if (gitConfig.core.ignorecase) {
|
|
@@ -1147,13 +1428,13 @@ Gitlint Start [${process.cwd()}]
|
|
|
1147
1428
|
}
|
|
1148
1429
|
const resultMessages = [];
|
|
1149
1430
|
if (valid > 0) {
|
|
1150
|
-
resultMessages.push(
|
|
1431
|
+
resultMessages.push(chalk20.green(`Passed: ${valid}`));
|
|
1151
1432
|
}
|
|
1152
1433
|
if (warnings > 0) {
|
|
1153
|
-
resultMessages.push(
|
|
1434
|
+
resultMessages.push(chalk20.yellow(`Warnings: ${warnings}`));
|
|
1154
1435
|
}
|
|
1155
1436
|
if (errors > 0) {
|
|
1156
|
-
resultMessages.push(
|
|
1437
|
+
resultMessages.push(chalk20.red(` Errors: ${errors}`));
|
|
1157
1438
|
}
|
|
1158
1439
|
console.warn(`Gitlint Finish [ ${resultMessages.join(" | ")} ]
|
|
1159
1440
|
`);
|
|
@@ -1162,7 +1443,7 @@ Gitlint Start [${process.cwd()}]
|
|
|
1162
1443
|
|
|
1163
1444
|
// src/actions/gitlint-fix.ts
|
|
1164
1445
|
import { execSync as execSync2 } from "child_process";
|
|
1165
|
-
import
|
|
1446
|
+
import chalk21 from "chalk";
|
|
1166
1447
|
import ParseGitConfig2 from "parse-git-config";
|
|
1167
1448
|
var gitlintFix = () => {
|
|
1168
1449
|
console.log(`
|
|
@@ -1171,15 +1452,15 @@ Gitlint Fix Start [${process.cwd()}]
|
|
|
1171
1452
|
const gitConfig = ParseGitConfig2.sync();
|
|
1172
1453
|
if (gitConfig.core.ignorecase) {
|
|
1173
1454
|
execSync2("git config core.ignorecase false", { stdio: "inherit" });
|
|
1174
|
-
console.warn(
|
|
1455
|
+
console.warn(chalk21.yellow("\nGitlint Fix: Updated core.ignorecase to be false\n"));
|
|
1175
1456
|
}
|
|
1176
1457
|
if (gitConfig.core.autocrlf !== false) {
|
|
1177
1458
|
execSync2("git config core.autocrlf false", { stdio: "inherit" });
|
|
1178
|
-
console.warn(
|
|
1459
|
+
console.warn(chalk21.yellow("\nGitlint Fix: Updated core.autocrlf to be false\n"));
|
|
1179
1460
|
}
|
|
1180
1461
|
if (gitConfig.core.eol !== "lf") {
|
|
1181
1462
|
execSync2("git config core.eol lf", { stdio: "inherit" });
|
|
1182
|
-
console.warn(
|
|
1463
|
+
console.warn(chalk21.yellow('\nGitlint Fix: Updated core.eol to be "lf"\n'));
|
|
1183
1464
|
}
|
|
1184
1465
|
return 1;
|
|
1185
1466
|
};
|
|
@@ -1190,7 +1471,7 @@ var knip = () => {
|
|
|
1190
1471
|
};
|
|
1191
1472
|
|
|
1192
1473
|
// src/actions/license.ts
|
|
1193
|
-
import
|
|
1474
|
+
import chalk22 from "chalk";
|
|
1194
1475
|
import { init } from "license-checker";
|
|
1195
1476
|
var license = async (pkg) => {
|
|
1196
1477
|
const workspaces = yarnWorkspaces();
|
|
@@ -1215,18 +1496,18 @@ var license = async (pkg) => {
|
|
|
1215
1496
|
"LGPL-3.0-or-later",
|
|
1216
1497
|
"Python-2.0"
|
|
1217
1498
|
]);
|
|
1218
|
-
console.log(
|
|
1499
|
+
console.log(chalk22.green("License Checker"));
|
|
1219
1500
|
return (await Promise.all(
|
|
1220
1501
|
workspaceList.map(({ location, name }) => {
|
|
1221
1502
|
return new Promise((resolve) => {
|
|
1222
1503
|
init({ production: true, start: location }, (error, packages) => {
|
|
1223
1504
|
if (error) {
|
|
1224
|
-
console.error(
|
|
1225
|
-
console.error(
|
|
1505
|
+
console.error(chalk22.red(`License Checker [${name}] Error`));
|
|
1506
|
+
console.error(chalk22.gray(error));
|
|
1226
1507
|
console.log("\n");
|
|
1227
1508
|
resolve(1);
|
|
1228
1509
|
} else {
|
|
1229
|
-
console.log(
|
|
1510
|
+
console.log(chalk22.green(`License Checker [${name}]`));
|
|
1230
1511
|
let count = 0;
|
|
1231
1512
|
for (const [name2, info] of Object.entries(packages)) {
|
|
1232
1513
|
const licenses = Array.isArray(info.licenses) ? info.licenses : [info.licenses];
|
|
@@ -1242,7 +1523,7 @@ var license = async (pkg) => {
|
|
|
1242
1523
|
}
|
|
1243
1524
|
if (!orLicenseFound) {
|
|
1244
1525
|
count++;
|
|
1245
|
-
console.warn(
|
|
1526
|
+
console.warn(chalk22.yellow(`${name2}: Package License not allowed [${license2}]`));
|
|
1246
1527
|
}
|
|
1247
1528
|
}
|
|
1248
1529
|
}
|
|
@@ -1261,13 +1542,13 @@ var filename2 = ".npmignore";
|
|
|
1261
1542
|
var npmignoreGen = (pkg) => generateIgnoreFiles(filename2, pkg);
|
|
1262
1543
|
|
|
1263
1544
|
// src/actions/package/clean-outputs.ts
|
|
1264
|
-
import
|
|
1265
|
-
import
|
|
1545
|
+
import path7 from "path";
|
|
1546
|
+
import chalk23 from "chalk";
|
|
1266
1547
|
var packageCleanOutputs = () => {
|
|
1267
1548
|
const pkg = process.env.INIT_CWD ?? ".";
|
|
1268
1549
|
const pkgName = process.env.npm_package_name;
|
|
1269
|
-
const folders = [
|
|
1270
|
-
console.log(
|
|
1550
|
+
const folders = [path7.join(pkg, "dist"), path7.join(pkg, "build"), path7.join(pkg, "docs")];
|
|
1551
|
+
console.log(chalk23.green(`Cleaning Outputs [${pkgName}]`));
|
|
1271
1552
|
for (let folder of folders) {
|
|
1272
1553
|
deleteGlob(folder);
|
|
1273
1554
|
}
|
|
@@ -1275,13 +1556,13 @@ var packageCleanOutputs = () => {
|
|
|
1275
1556
|
};
|
|
1276
1557
|
|
|
1277
1558
|
// src/actions/package/clean-typescript.ts
|
|
1278
|
-
import
|
|
1279
|
-
import
|
|
1559
|
+
import path8 from "path";
|
|
1560
|
+
import chalk24 from "chalk";
|
|
1280
1561
|
var packageCleanTypescript = () => {
|
|
1281
1562
|
const pkg = process.env.INIT_CWD ?? ".";
|
|
1282
1563
|
const pkgName = process.env.npm_package_name;
|
|
1283
|
-
console.log(
|
|
1284
|
-
const files = [
|
|
1564
|
+
console.log(chalk24.green(`Cleaning Typescript [${pkgName}]`));
|
|
1565
|
+
const files = [path8.join(pkg, "*.tsbuildinfo"), path8.join(pkg, ".tsconfig.*"), path8.join(pkg, ".eslintcache")];
|
|
1285
1566
|
for (let file of files) {
|
|
1286
1567
|
deleteGlob(file);
|
|
1287
1568
|
}
|
|
@@ -1294,26 +1575,26 @@ var packageClean = async () => {
|
|
|
1294
1575
|
};
|
|
1295
1576
|
|
|
1296
1577
|
// src/actions/package/compile/compile.ts
|
|
1297
|
-
import
|
|
1578
|
+
import chalk29 from "chalk";
|
|
1298
1579
|
|
|
1299
1580
|
// src/actions/package/compile/packageCompileTsup.ts
|
|
1300
|
-
import
|
|
1581
|
+
import chalk28 from "chalk";
|
|
1301
1582
|
import { build as build2, defineConfig } from "tsup";
|
|
1302
1583
|
|
|
1303
1584
|
// src/actions/package/compile/inputs.ts
|
|
1304
|
-
import
|
|
1585
|
+
import chalk25 from "chalk";
|
|
1305
1586
|
import { glob as glob2 } from "glob";
|
|
1306
1587
|
var getAllInputs = (srcDir, verbose = false) => {
|
|
1307
1588
|
return [...glob2.sync(`${srcDir}/**/*.ts`, { posix: true }).map((file) => {
|
|
1308
1589
|
const result = file.slice(Math.max(0, srcDir.length + 1));
|
|
1309
1590
|
if (verbose) {
|
|
1310
|
-
console.log(
|
|
1591
|
+
console.log(chalk25.gray(`getAllInputs: ${JSON.stringify(result, null, 2)}`));
|
|
1311
1592
|
}
|
|
1312
1593
|
return result;
|
|
1313
1594
|
}), ...glob2.sync(`${srcDir}/**/*.tsx`, { posix: true }).map((file) => {
|
|
1314
1595
|
const result = file.slice(Math.max(0, srcDir.length + 1));
|
|
1315
1596
|
if (verbose) {
|
|
1316
|
-
console.log(
|
|
1597
|
+
console.log(chalk25.gray(`getAllInputs: ${JSON.stringify(result, null, 2)}`));
|
|
1317
1598
|
}
|
|
1318
1599
|
return result;
|
|
1319
1600
|
})];
|
|
@@ -1372,7 +1653,7 @@ function deepMergeObjects(objects) {
|
|
|
1372
1653
|
|
|
1373
1654
|
// src/actions/package/compile/packageCompileTsc.ts
|
|
1374
1655
|
import { cwd as cwd2 } from "process";
|
|
1375
|
-
import
|
|
1656
|
+
import chalk26 from "chalk";
|
|
1376
1657
|
import { createProgramFromConfig } from "tsc-prog";
|
|
1377
1658
|
import ts2, {
|
|
1378
1659
|
DiagnosticCategory,
|
|
@@ -1394,7 +1675,7 @@ var getCompilerOptions = (options = {}, fileName = "tsconfig.json") => {
|
|
|
1394
1675
|
var packageCompileTsc = (platform, entries, srcDir = "src", outDir = "dist", compilerOptionsParam, verbose = false) => {
|
|
1395
1676
|
const pkg = process.env.INIT_CWD ?? cwd2();
|
|
1396
1677
|
if (verbose) {
|
|
1397
|
-
console.log(
|
|
1678
|
+
console.log(chalk26.cyan(`Validating code START: ${entries.length} files to ${outDir} from ${srcDir}`));
|
|
1398
1679
|
}
|
|
1399
1680
|
const configFilePath = ts2.findConfigFile(
|
|
1400
1681
|
"./",
|
|
@@ -1417,10 +1698,10 @@ var packageCompileTsc = (platform, entries, srcDir = "src", outDir = "dist", com
|
|
|
1417
1698
|
emitDeclarationOnly: true,
|
|
1418
1699
|
noEmit: false
|
|
1419
1700
|
};
|
|
1420
|
-
console.log(
|
|
1701
|
+
console.log(chalk26.cyan(`Validating Files: ${entries.length}`));
|
|
1421
1702
|
if (verbose) {
|
|
1422
1703
|
for (const entry of entries) {
|
|
1423
|
-
console.log(
|
|
1704
|
+
console.log(chalk26.grey(`Validating: ${entry}`));
|
|
1424
1705
|
}
|
|
1425
1706
|
}
|
|
1426
1707
|
try {
|
|
@@ -1450,22 +1731,22 @@ var packageCompileTsc = (platform, entries, srcDir = "src", outDir = "dist", com
|
|
|
1450
1731
|
return 0;
|
|
1451
1732
|
} finally {
|
|
1452
1733
|
if (verbose) {
|
|
1453
|
-
console.log(
|
|
1734
|
+
console.log(chalk26.cyan(`Validating code FINISH: ${entries.length} files to ${outDir} from ${srcDir}`));
|
|
1454
1735
|
}
|
|
1455
1736
|
}
|
|
1456
1737
|
};
|
|
1457
1738
|
|
|
1458
1739
|
// src/actions/package/compile/packageCompileTscTypes.ts
|
|
1459
|
-
import
|
|
1740
|
+
import path9 from "path";
|
|
1460
1741
|
import { cwd as cwd3 } from "process";
|
|
1461
|
-
import
|
|
1742
|
+
import chalk27 from "chalk";
|
|
1462
1743
|
import { rollup } from "rollup";
|
|
1463
1744
|
import dts from "rollup-plugin-dts";
|
|
1464
1745
|
import nodeExternals from "rollup-plugin-node-externals";
|
|
1465
1746
|
var ignoredWarningCodes = /* @__PURE__ */ new Set(["EMPTY_BUNDLE", "UNRESOLVED_IMPORT"]);
|
|
1466
1747
|
async function bundleDts(inputPath, outputPath, platform, options, verbose = false) {
|
|
1467
1748
|
const pkg = process.env.INIT_CWD ?? cwd3();
|
|
1468
|
-
const tsconfigPath =
|
|
1749
|
+
const tsconfigPath = path9.resolve(pkg, "tsconfig.json");
|
|
1469
1750
|
const nodePlugIns = platform === "node" ? [nodeExternals()] : [];
|
|
1470
1751
|
try {
|
|
1471
1752
|
const bundle = await rollup({
|
|
@@ -1483,8 +1764,8 @@ async function bundleDts(inputPath, outputPath, platform, options, verbose = fal
|
|
|
1483
1764
|
if (ignoredWarningCodes.has(warning.code ?? "")) {
|
|
1484
1765
|
return;
|
|
1485
1766
|
}
|
|
1486
|
-
console.warn(
|
|
1487
|
-
console.warn(
|
|
1767
|
+
console.warn(chalk27.yellow(`[${warning.code}] ${warning.message}`));
|
|
1768
|
+
console.warn(chalk27.gray(inputPath));
|
|
1488
1769
|
warn(warning);
|
|
1489
1770
|
}
|
|
1490
1771
|
});
|
|
@@ -1494,8 +1775,8 @@ async function bundleDts(inputPath, outputPath, platform, options, verbose = fal
|
|
|
1494
1775
|
});
|
|
1495
1776
|
} catch (ex) {
|
|
1496
1777
|
const error = ex;
|
|
1497
|
-
console.warn(
|
|
1498
|
-
console.warn(
|
|
1778
|
+
console.warn(chalk27.red(error));
|
|
1779
|
+
console.warn(chalk27.gray(inputPath));
|
|
1499
1780
|
}
|
|
1500
1781
|
if (verbose) {
|
|
1501
1782
|
console.log(`Bundled declarations written to ${outputPath}`);
|
|
@@ -1503,7 +1784,7 @@ async function bundleDts(inputPath, outputPath, platform, options, verbose = fal
|
|
|
1503
1784
|
}
|
|
1504
1785
|
var packageCompileTscTypes = async (entries, outDir, platform, srcDir = "build", verbose = false) => {
|
|
1505
1786
|
if (verbose) {
|
|
1506
|
-
console.log(
|
|
1787
|
+
console.log(chalk27.cyan(`Compiling Types START [${platform}]: ${entries.length} files to ${outDir} from ${srcDir}`));
|
|
1507
1788
|
console.log(`Entries: ${entries.join(", ")}`);
|
|
1508
1789
|
}
|
|
1509
1790
|
const pkg = process.env.INIT_CWD ?? cwd3();
|
|
@@ -1527,7 +1808,7 @@ var packageCompileTscTypes = async (entries, outDir, platform, srcDir = "build",
|
|
|
1527
1808
|
await bundleDts(`${srcRoot}/${entryTypeName}`, `${outDir}/${entryTypeName}`, platform, { compilerOptions }, verbose);
|
|
1528
1809
|
}));
|
|
1529
1810
|
if (verbose) {
|
|
1530
|
-
console.log(
|
|
1811
|
+
console.log(chalk27.cyan(`Compiling Types FINISH: ${entries.length} files to ${outDir} from ${srcDir}`));
|
|
1531
1812
|
}
|
|
1532
1813
|
return 0;
|
|
1533
1814
|
};
|
|
@@ -1539,15 +1820,15 @@ var compileFolder = async (srcDir, entries, buildDir, options, bundleTypes = fal
|
|
|
1539
1820
|
console.log(`compileFolder [${srcDir}, ${options?.outDir}]`);
|
|
1540
1821
|
}
|
|
1541
1822
|
if (entries.length === 0) {
|
|
1542
|
-
console.warn(
|
|
1823
|
+
console.warn(chalk28.yellow(`No entries found in ${srcDir} to compile`));
|
|
1543
1824
|
return 0;
|
|
1544
1825
|
}
|
|
1545
1826
|
if (verbose) {
|
|
1546
|
-
console.log(
|
|
1827
|
+
console.log(chalk28.gray(`buildDir [${buildDir}]`));
|
|
1547
1828
|
}
|
|
1548
1829
|
const validationResult = packageCompileTsc(options?.platform ?? "neutral", entries, srcDir, buildDir, void 0, verbose);
|
|
1549
1830
|
if (validationResult !== 0) {
|
|
1550
|
-
console.error(
|
|
1831
|
+
console.error(chalk28.red(`Compile:Validation had ${validationResult} errors`));
|
|
1551
1832
|
return validationResult;
|
|
1552
1833
|
}
|
|
1553
1834
|
const optionsParams = tsupOptions([{
|
|
@@ -1572,12 +1853,12 @@ var compileFolder = async (srcDir, entries, buildDir, options, bundleTypes = fal
|
|
|
1572
1853
|
})
|
|
1573
1854
|
)).flat();
|
|
1574
1855
|
if (verbose) {
|
|
1575
|
-
console.log(
|
|
1576
|
-
console.log(
|
|
1856
|
+
console.log(chalk28.cyan(`TSUP:build:start [${srcDir}]`));
|
|
1857
|
+
console.log(chalk28.gray(`TSUP:build:options [${JSON.stringify(optionsList, null, 2)}]`));
|
|
1577
1858
|
}
|
|
1578
1859
|
await Promise.all(optionsList.map((options2) => build2(options2)));
|
|
1579
1860
|
if (verbose) {
|
|
1580
|
-
console.log(
|
|
1861
|
+
console.log(chalk28.cyan(`TSUP:build:stop [${srcDir}]`));
|
|
1581
1862
|
}
|
|
1582
1863
|
if (bundleTypes) {
|
|
1583
1864
|
await packageCompileTscTypes(entries, outDir, options?.platform ?? "neutral", buildDir, verbose);
|
|
@@ -1688,14 +1969,14 @@ var packageCompileTsup = async (config2) => {
|
|
|
1688
1969
|
// src/actions/package/compile/compile.ts
|
|
1689
1970
|
var packageCompile = async (inConfig = {}) => {
|
|
1690
1971
|
const pkg = process.env.INIT_CWD;
|
|
1691
|
-
console.log(
|
|
1972
|
+
console.log(chalk29.green(`Compiling ${pkg}`));
|
|
1692
1973
|
const config2 = await loadConfig(inConfig);
|
|
1693
1974
|
return await packageCompileTsup(config2);
|
|
1694
1975
|
};
|
|
1695
1976
|
|
|
1696
1977
|
// src/actions/package/copy-assets.ts
|
|
1697
|
-
import
|
|
1698
|
-
import
|
|
1978
|
+
import path10 from "path/posix";
|
|
1979
|
+
import chalk30 from "chalk";
|
|
1699
1980
|
import cpy2 from "cpy";
|
|
1700
1981
|
var copyTargetAssets2 = async (target, name, location) => {
|
|
1701
1982
|
try {
|
|
@@ -1703,12 +1984,12 @@ var copyTargetAssets2 = async (target, name, location) => {
|
|
|
1703
1984
|
["**/*.jpg", "**/*.png", "**/*.gif", "**/*.svg", "**/*.webp", "**/*.sass", "**/*.scss", "**/*.gif", "**/*.css"],
|
|
1704
1985
|
`../dist/${target}`,
|
|
1705
1986
|
{
|
|
1706
|
-
cwd:
|
|
1987
|
+
cwd: path10.join(location, "src"),
|
|
1707
1988
|
flat: false
|
|
1708
1989
|
}
|
|
1709
1990
|
);
|
|
1710
1991
|
if (values.length > 0) {
|
|
1711
|
-
console.log(
|
|
1992
|
+
console.log(chalk30.green(`Copying Assets [${target.toUpperCase()}] - ${name} - ${location}`));
|
|
1712
1993
|
}
|
|
1713
1994
|
for (const value of values) {
|
|
1714
1995
|
console.log(`${value.split("/").pop()} => ./dist/${target}`);
|
|
@@ -1774,8 +2055,8 @@ var packageCycle = async () => {
|
|
|
1774
2055
|
|
|
1775
2056
|
// src/actions/package/gen-docs.ts
|
|
1776
2057
|
import { existsSync as existsSync4 } from "fs";
|
|
1777
|
-
import
|
|
1778
|
-
import
|
|
2058
|
+
import path11 from "path";
|
|
2059
|
+
import chalk31 from "chalk";
|
|
1779
2060
|
import {
|
|
1780
2061
|
Application,
|
|
1781
2062
|
ArgumentsReader,
|
|
@@ -1793,7 +2074,7 @@ var ExitCodes = {
|
|
|
1793
2074
|
};
|
|
1794
2075
|
var packageGenDocs = async () => {
|
|
1795
2076
|
const pkg = process.env.INIT_CWD;
|
|
1796
|
-
if (pkg !== void 0 && !existsSync4(
|
|
2077
|
+
if (pkg !== void 0 && !existsSync4(path11.join(pkg, "typedoc.json"))) {
|
|
1797
2078
|
return;
|
|
1798
2079
|
}
|
|
1799
2080
|
const app = await Application.bootstrap({
|
|
@@ -1879,16 +2160,16 @@ var runTypeDoc = async (app) => {
|
|
|
1879
2160
|
return ExitCodes.OutputError;
|
|
1880
2161
|
}
|
|
1881
2162
|
}
|
|
1882
|
-
console.log(
|
|
2163
|
+
console.log(chalk31.green(`${pkgName} - Ok`));
|
|
1883
2164
|
return ExitCodes.Ok;
|
|
1884
2165
|
};
|
|
1885
2166
|
|
|
1886
2167
|
// src/actions/package/lint.ts
|
|
1887
2168
|
import { readdirSync } from "fs";
|
|
1888
|
-
import
|
|
2169
|
+
import path12 from "path";
|
|
1889
2170
|
import { cwd as cwd4 } from "process";
|
|
1890
2171
|
import { pathToFileURL } from "url";
|
|
1891
|
-
import
|
|
2172
|
+
import chalk32 from "chalk";
|
|
1892
2173
|
import { ESLint } from "eslint";
|
|
1893
2174
|
import { findUp } from "find-up";
|
|
1894
2175
|
import picomatch from "picomatch";
|
|
@@ -1897,14 +2178,14 @@ var dumpMessages = (lintResults) => {
|
|
|
1897
2178
|
const severity = ["none", "warning", "error"];
|
|
1898
2179
|
for (const lintResult of lintResults) {
|
|
1899
2180
|
if (lintResult.messages.length > 0) {
|
|
1900
|
-
console.log(
|
|
2181
|
+
console.log(chalk32.gray(`
|
|
1901
2182
|
${lintResult.filePath}`));
|
|
1902
2183
|
for (const message of lintResult.messages) {
|
|
1903
2184
|
console.log(
|
|
1904
|
-
|
|
1905
|
-
|
|
1906
|
-
|
|
1907
|
-
|
|
2185
|
+
chalk32.gray(` ${message.line}:${message.column}`),
|
|
2186
|
+
chalk32[colors[message.severity]](` ${severity[message.severity]}`),
|
|
2187
|
+
chalk32.white(` ${message.message}`),
|
|
2188
|
+
chalk32.gray(` ${message.ruleId}`)
|
|
1908
2189
|
);
|
|
1909
2190
|
}
|
|
1910
2191
|
}
|
|
@@ -1922,7 +2203,7 @@ function getFiles(dir, ignoreFolders) {
|
|
|
1922
2203
|
const subDirectory = dir.split(currentDirectory)[1]?.split("/")[1];
|
|
1923
2204
|
if (ignoreFolders.includes(subDirectory)) return [];
|
|
1924
2205
|
return readdirSync(dir, { withFileTypes: true }).flatMap((dirent) => {
|
|
1925
|
-
const res =
|
|
2206
|
+
const res = path12.resolve(dir, dirent.name);
|
|
1926
2207
|
const relativePath = subDirectory === void 0 ? dirent.name : `${subDirectory}/${dirent.name}`;
|
|
1927
2208
|
const ignoreMatchers = ignoreFolders.map((pattern) => picomatch(pattern));
|
|
1928
2209
|
if (ignoreMatchers.some((isMatch) => isMatch(relativePath))) return [];
|
|
@@ -1942,10 +2223,10 @@ var packageLint = async (fix2 = false, verbose = false, cache = true) => {
|
|
|
1942
2223
|
cache
|
|
1943
2224
|
});
|
|
1944
2225
|
const files = getFiles(cwd4(), ignoreFolders);
|
|
1945
|
-
console.log(
|
|
2226
|
+
console.log(chalk32.green(`Linting ${pkg} [files = ${files.length}]`));
|
|
1946
2227
|
if (verbose) {
|
|
1947
2228
|
for (const file of files) {
|
|
1948
|
-
console.log(
|
|
2229
|
+
console.log(chalk32.gray(` ${file}`));
|
|
1949
2230
|
}
|
|
1950
2231
|
}
|
|
1951
2232
|
const lintResults = await engine.lintFiles(files);
|
|
@@ -1956,43 +2237,43 @@ var packageLint = async (fix2 = false, verbose = false, cache = true) => {
|
|
|
1956
2237
|
const filesCountColor = files.length < 100 ? "green" : files.length < 1e3 ? "yellow" : "red";
|
|
1957
2238
|
const lintTime = Date.now() - start;
|
|
1958
2239
|
const lintTimeColor = lintTime < 1e3 ? "green" : lintTime < 3e3 ? "yellow" : "red";
|
|
1959
|
-
console.log(
|
|
2240
|
+
console.log(chalk32.white(`Linted ${chalk32[filesCountColor](files.length)} files in ${chalk32[lintTimeColor](lintTime)}ms`));
|
|
1960
2241
|
return lintResults.reduce((prev, lintResult) => prev + lintResult.errorCount, 0);
|
|
1961
2242
|
};
|
|
1962
2243
|
|
|
1963
2244
|
// src/actions/package/publint.ts
|
|
1964
|
-
import { promises as
|
|
1965
|
-
import
|
|
2245
|
+
import { promises as fs8 } from "fs";
|
|
2246
|
+
import chalk33 from "chalk";
|
|
1966
2247
|
import sortPackageJson from "sort-package-json";
|
|
1967
2248
|
var customPubLint = (pkg) => {
|
|
1968
2249
|
let errorCount = 0;
|
|
1969
2250
|
let warningCount = 0;
|
|
1970
2251
|
if (pkg.files === void 0) {
|
|
1971
|
-
console.warn(
|
|
2252
|
+
console.warn(chalk33.yellow('Publint [custom]: "files" field is missing'));
|
|
1972
2253
|
warningCount++;
|
|
1973
2254
|
}
|
|
1974
2255
|
if (pkg.main !== void 0) {
|
|
1975
|
-
console.warn(
|
|
2256
|
+
console.warn(chalk33.yellow('Publint [custom]: "main" field is deprecated, use "exports" instead'));
|
|
1976
2257
|
warningCount++;
|
|
1977
2258
|
}
|
|
1978
2259
|
if (pkg.sideEffects !== false) {
|
|
1979
|
-
console.warn(
|
|
2260
|
+
console.warn(chalk33.yellow('Publint [custom]: "sideEffects" field should be set to false'));
|
|
1980
2261
|
warningCount++;
|
|
1981
2262
|
}
|
|
1982
2263
|
if (pkg.resolutions !== void 0) {
|
|
1983
|
-
console.warn(
|
|
1984
|
-
console.warn(
|
|
2264
|
+
console.warn(chalk33.yellow('Publint [custom]: "resolutions" in use'));
|
|
2265
|
+
console.warn(chalk33.gray(JSON.stringify(pkg.resolutions, null, 2)));
|
|
1985
2266
|
warningCount++;
|
|
1986
2267
|
}
|
|
1987
2268
|
return [errorCount, warningCount];
|
|
1988
2269
|
};
|
|
1989
2270
|
var packagePublint = async ({ strict = true, verbose = false } = {}) => {
|
|
1990
2271
|
const pkgDir = process.env.INIT_CWD;
|
|
1991
|
-
const sortedPkg = sortPackageJson(await
|
|
1992
|
-
await
|
|
1993
|
-
const pkg = JSON.parse(await
|
|
1994
|
-
console.log(
|
|
1995
|
-
console.log(
|
|
2272
|
+
const sortedPkg = sortPackageJson(await fs8.readFile(`${pkgDir}/package.json`, "utf8"));
|
|
2273
|
+
await fs8.writeFile(`${pkgDir}/package.json`, sortedPkg);
|
|
2274
|
+
const pkg = JSON.parse(await fs8.readFile(`${pkgDir}/package.json`, "utf8"));
|
|
2275
|
+
console.log(chalk33.green(`Publint: ${pkg.name}`));
|
|
2276
|
+
console.log(chalk33.gray(pkgDir));
|
|
1996
2277
|
const { publint: publint2 } = await import("publint");
|
|
1997
2278
|
const { messages } = await publint2({
|
|
1998
2279
|
level: "suggestion",
|
|
@@ -2003,22 +2284,22 @@ var packagePublint = async ({ strict = true, verbose = false } = {}) => {
|
|
|
2003
2284
|
for (const message of messages) {
|
|
2004
2285
|
switch (message.type) {
|
|
2005
2286
|
case "error": {
|
|
2006
|
-
console.error(
|
|
2287
|
+
console.error(chalk33.red(`[${message.code}] ${formatMessage(message, pkg)}`));
|
|
2007
2288
|
break;
|
|
2008
2289
|
}
|
|
2009
2290
|
case "warning": {
|
|
2010
|
-
console.warn(
|
|
2291
|
+
console.warn(chalk33.yellow(`[${message.code}] ${formatMessage(message, pkg)}`));
|
|
2011
2292
|
break;
|
|
2012
2293
|
}
|
|
2013
2294
|
default: {
|
|
2014
|
-
console.log(
|
|
2295
|
+
console.log(chalk33.white(`[${message.code}] ${formatMessage(message, pkg)}`));
|
|
2015
2296
|
break;
|
|
2016
2297
|
}
|
|
2017
2298
|
}
|
|
2018
2299
|
}
|
|
2019
2300
|
const [errorCount, warningCount] = customPubLint(pkg);
|
|
2020
2301
|
if (verbose) {
|
|
2021
|
-
console.log(
|
|
2302
|
+
console.log(chalk33.gray(`Publint [Finish]: ${pkgDir} [${messages.length + errorCount + warningCount} messages]`));
|
|
2022
2303
|
}
|
|
2023
2304
|
return messages.filter((message) => message.type === "error").length + errorCount;
|
|
2024
2305
|
};
|
|
@@ -2054,7 +2335,7 @@ var rebuild = ({ target }) => {
|
|
|
2054
2335
|
};
|
|
2055
2336
|
|
|
2056
2337
|
// src/actions/recompile.ts
|
|
2057
|
-
import
|
|
2338
|
+
import chalk34 from "chalk";
|
|
2058
2339
|
var recompile = async ({
|
|
2059
2340
|
verbose,
|
|
2060
2341
|
target,
|
|
@@ -2090,7 +2371,7 @@ var recompileAll = async ({
|
|
|
2090
2371
|
const incrementalOptions = incremental ? ["--since", "-Apt", "--topological-dev"] : ["--parallel", "-Apt", "--topological-dev"];
|
|
2091
2372
|
const jobsOptions = jobs ? ["-j", `${jobs}`] : [];
|
|
2092
2373
|
if (jobs) {
|
|
2093
|
-
console.log(
|
|
2374
|
+
console.log(chalk34.blue(`Jobs set to [${jobs}]`));
|
|
2094
2375
|
}
|
|
2095
2376
|
const result = await runStepsAsync(`Recompile${incremental ? "-Incremental" : ""} [All]`, [
|
|
2096
2377
|
[
|
|
@@ -2121,7 +2402,7 @@ var recompileAll = async ({
|
|
|
2121
2402
|
]
|
|
2122
2403
|
]);
|
|
2123
2404
|
console.log(
|
|
2124
|
-
`${
|
|
2405
|
+
`${chalk34.gray("Recompiled in")} [${chalk34.magenta(((Date.now() - start) / 1e3).toFixed(2))}] ${chalk34.gray("seconds")}`
|
|
2125
2406
|
);
|
|
2126
2407
|
return result;
|
|
2127
2408
|
};
|
|
@@ -2152,13 +2433,13 @@ var reinstall = () => {
|
|
|
2152
2433
|
};
|
|
2153
2434
|
|
|
2154
2435
|
// src/actions/relint.ts
|
|
2155
|
-
import
|
|
2436
|
+
import chalk35 from "chalk";
|
|
2156
2437
|
var relintPackage = ({
|
|
2157
2438
|
pkg,
|
|
2158
2439
|
fix: fix2,
|
|
2159
2440
|
verbose
|
|
2160
2441
|
}) => {
|
|
2161
|
-
console.log(
|
|
2442
|
+
console.log(chalk35.gray(`${fix2 ? "Fix" : "Lint"} [${pkg}]`));
|
|
2162
2443
|
const start = Date.now();
|
|
2163
2444
|
const result = runSteps(`${fix2 ? "Fix" : "Lint"} [${pkg}]`, [
|
|
2164
2445
|
["yarn", [
|
|
@@ -2168,7 +2449,7 @@ var relintPackage = ({
|
|
|
2168
2449
|
fix2 ? "package-fix" : verbose ? "package-lint-verbose" : "package-lint"
|
|
2169
2450
|
]]
|
|
2170
2451
|
]);
|
|
2171
|
-
console.log(
|
|
2452
|
+
console.log(chalk35.gray(`${fix2 ? "Fixed in" : "Linted in"} [${chalk35.magenta(((Date.now() - start) / 1e3).toFixed(2))}] ${chalk35.gray("seconds")}`));
|
|
2172
2453
|
return result;
|
|
2173
2454
|
};
|
|
2174
2455
|
var relint = ({
|
|
@@ -2188,13 +2469,13 @@ var relint = ({
|
|
|
2188
2469
|
});
|
|
2189
2470
|
};
|
|
2190
2471
|
var relintAllPackages = ({ fix: fix2 = false } = {}) => {
|
|
2191
|
-
console.log(
|
|
2472
|
+
console.log(chalk35.gray(`${fix2 ? "Fix" : "Lint"} [All-Packages]`));
|
|
2192
2473
|
const start = Date.now();
|
|
2193
2474
|
const fixOptions = fix2 ? ["--fix"] : [];
|
|
2194
2475
|
const result = runSteps(`${fix2 ? "Fix" : "Lint"} [All-Packages]`, [
|
|
2195
2476
|
["yarn", ["eslint", ...fixOptions]]
|
|
2196
2477
|
]);
|
|
2197
|
-
console.log(
|
|
2478
|
+
console.log(chalk35.gray(`${fix2 ? "Fixed in" : "Linted in"} [${chalk35.magenta(((Date.now() - start) / 1e3).toFixed(2))}] ${chalk35.gray("seconds")}`));
|
|
2198
2479
|
return result;
|
|
2199
2480
|
};
|
|
2200
2481
|
|
|
@@ -2212,10 +2493,10 @@ var sonar = () => {
|
|
|
2212
2493
|
};
|
|
2213
2494
|
|
|
2214
2495
|
// src/actions/statics.ts
|
|
2215
|
-
import
|
|
2496
|
+
import chalk36 from "chalk";
|
|
2216
2497
|
var DefaultDependencies = ["axios", "@xylabs/pixel", "react", "graphql", "react-router", "@mui/material", "@mui/system"];
|
|
2217
2498
|
var statics = () => {
|
|
2218
|
-
console.log(
|
|
2499
|
+
console.log(chalk36.green("Check Required Static Dependencies"));
|
|
2219
2500
|
const statics2 = parsedPackageJSON()?.xy?.deps?.statics;
|
|
2220
2501
|
return detectDuplicateDependencies(statics2, DefaultDependencies);
|
|
2221
2502
|
};
|