@xylabs/ts-scripts-yarn3 6.5.0 → 6.5.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/actions/deplint/checkPackage/checkPackage.mjs +260 -0
- package/dist/actions/deplint/checkPackage/checkPackage.mjs.map +1 -0
- package/dist/actions/deplint/checkPackage/checkPackageTypes.mjs +1 -0
- package/dist/actions/deplint/checkPackage/checkPackageTypes.mjs.map +1 -0
- package/dist/actions/deplint/checkPackage/getTypesInDependencies.mjs +19 -0
- package/dist/actions/deplint/checkPackage/getTypesInDependencies.mjs.map +1 -0
- package/dist/actions/deplint/checkPackage/getUnlistedDependencies.mjs +35 -0
- package/dist/actions/deplint/checkPackage/getUnlistedDependencies.mjs.map +1 -0
- package/dist/actions/deplint/checkPackage/getUnlistedDevDependencies.mjs +21 -0
- package/dist/actions/deplint/checkPackage/getUnlistedDevDependencies.mjs.map +1 -0
- package/dist/actions/deplint/checkPackage/getUnusedDependencies.mjs +22 -0
- package/dist/actions/deplint/checkPackage/getUnusedDependencies.mjs.map +1 -0
- package/dist/actions/deplint/checkPackage/getUnusedPeerDependencies.mjs +19 -0
- package/dist/actions/deplint/checkPackage/getUnusedPeerDependencies.mjs.map +1 -0
- package/dist/actions/deplint/checkPackage/index.mjs +260 -0
- package/dist/actions/deplint/checkPackage/index.mjs.map +1 -0
- package/dist/actions/deplint/deplint.mjs +320 -0
- package/dist/actions/deplint/deplint.mjs.map +1 -0
- package/dist/actions/deplint/findFiles.mjs +24 -0
- package/dist/actions/deplint/findFiles.mjs.map +1 -0
- package/dist/actions/deplint/findFilesByGlob.mjs +9 -0
- package/dist/actions/deplint/findFilesByGlob.mjs.map +1 -0
- package/dist/actions/deplint/getBasePackageName.mjs +12 -0
- package/dist/actions/deplint/getBasePackageName.mjs.map +1 -0
- package/dist/actions/deplint/getDependenciesFromPackageJson.mjs +20 -0
- package/dist/actions/deplint/getDependenciesFromPackageJson.mjs.map +1 -0
- package/dist/actions/deplint/getExternalImportsFromFiles.mjs +98 -0
- package/dist/actions/deplint/getExternalImportsFromFiles.mjs.map +1 -0
- package/dist/actions/deplint/getImportsFromFile.mjs +65 -0
- package/dist/actions/deplint/getImportsFromFile.mjs.map +1 -0
- package/dist/actions/{deplint.mjs → deplint/index.mjs} +165 -88
- package/dist/actions/deplint/index.mjs.map +1 -0
- package/dist/actions/fix.mjs.map +1 -1
- package/dist/actions/index.mjs +240 -161
- package/dist/actions/index.mjs.map +1 -1
- package/dist/actions/lint.mjs.map +1 -1
- package/dist/bin/xy.mjs +244 -156
- package/dist/bin/xy.mjs.map +1 -1
- package/dist/index.d.ts +5 -1
- package/dist/index.mjs +287 -199
- package/dist/index.mjs.map +1 -1
- package/dist/xy/index.mjs +244 -156
- package/dist/xy/index.mjs.map +1 -1
- package/dist/xy/param.mjs +1 -1
- package/dist/xy/param.mjs.map +1 -1
- package/dist/xy/xy.mjs +244 -156
- package/dist/xy/xy.mjs.map +1 -1
- package/dist/xy/xyCommonCommands.mjs +1 -1
- package/dist/xy/xyCommonCommands.mjs.map +1 -1
- package/dist/xy/xyLintCommands.mjs +217 -108
- package/dist/xy/xyLintCommands.mjs.map +1 -1
- package/dist/xy/xyParseOptions.mjs +0 -21
- package/dist/xy/xyParseOptions.mjs.map +1 -1
- package/package.json +3 -3
- package/dist/actions/deplint.mjs.map +0 -1
package/dist/actions/index.mjs
CHANGED
|
@@ -313,8 +313,8 @@ var loadConfig = async (params) => {
|
|
|
313
313
|
|
|
314
314
|
// src/lib/parsedPackageJSON.ts
|
|
315
315
|
import { readFileSync as readFileSync2 } from "node:fs";
|
|
316
|
-
var parsedPackageJSON = (
|
|
317
|
-
const pathToPackageJSON =
|
|
316
|
+
var parsedPackageJSON = (path10) => {
|
|
317
|
+
const pathToPackageJSON = path10 ?? process.env.npm_package_json ?? "";
|
|
318
318
|
const packageJSON = readFileSync2(pathToPackageJSON).toString();
|
|
319
319
|
return JSON.parse(packageJSON);
|
|
320
320
|
};
|
|
@@ -671,12 +671,33 @@ var dead = () => {
|
|
|
671
671
|
return runSteps("Dead", [["yarn", ["ts-prune", "-p", "tsconfig.json"]]]);
|
|
672
672
|
};
|
|
673
673
|
|
|
674
|
-
// src/actions/deplint.ts
|
|
674
|
+
// src/actions/deplint/deplint.ts
|
|
675
|
+
import chalk18 from "chalk";
|
|
676
|
+
|
|
677
|
+
// src/actions/deplint/findFilesByGlob.ts
|
|
678
|
+
import { globSync } from "glob";
|
|
679
|
+
function findFilesByGlob(cwd4, pattern) {
|
|
680
|
+
return globSync(pattern, { cwd: cwd4, absolute: true });
|
|
681
|
+
}
|
|
682
|
+
|
|
683
|
+
// src/actions/deplint/findFiles.ts
|
|
684
|
+
function findFiles(path10) {
|
|
685
|
+
const allSourceInclude = ["./src/**/*.{ts,tsx}", "./dist/**/*.d.ts"];
|
|
686
|
+
const prodExcludeEndswith = [".spec.ts", ".stories.tsx"];
|
|
687
|
+
const prodExcludeIncludes = ["/spec/", "/stories/", "/scripts/"];
|
|
688
|
+
const allSourceFiles = allSourceInclude.flatMap((pattern) => findFilesByGlob(path10, pattern));
|
|
689
|
+
const prodSourceFiles = allSourceFiles.filter((file) => !prodExcludeEndswith.some((ext) => file.endsWith(ext)) && !prodExcludeIncludes.some((excl) => file.includes(excl)));
|
|
690
|
+
const devSourceFiles = allSourceFiles.filter((file) => !prodSourceFiles.includes(file));
|
|
691
|
+
return {
|
|
692
|
+
allSourceFiles,
|
|
693
|
+
prodSourceFiles,
|
|
694
|
+
devSourceFiles
|
|
695
|
+
};
|
|
696
|
+
}
|
|
697
|
+
|
|
698
|
+
// src/actions/deplint/getDependenciesFromPackageJson.ts
|
|
675
699
|
import fs2 from "node:fs";
|
|
676
700
|
import path3 from "node:path";
|
|
677
|
-
import chalk13 from "chalk";
|
|
678
|
-
import { globSync } from "glob";
|
|
679
|
-
import ts from "typescript";
|
|
680
701
|
function getDependenciesFromPackageJson(packageJsonPath) {
|
|
681
702
|
const packageJsonFullPath = path3.resolve(packageJsonPath);
|
|
682
703
|
const rawContent = fs2.readFileSync(packageJsonFullPath, "utf8");
|
|
@@ -690,6 +711,13 @@ function getDependenciesFromPackageJson(packageJsonPath) {
|
|
|
690
711
|
peerDependencies
|
|
691
712
|
};
|
|
692
713
|
}
|
|
714
|
+
|
|
715
|
+
// src/actions/deplint/getImportsFromFile.ts
|
|
716
|
+
import fs3 from "node:fs";
|
|
717
|
+
import path4 from "node:path";
|
|
718
|
+
import ts from "typescript";
|
|
719
|
+
|
|
720
|
+
// src/actions/deplint/getBasePackageName.ts
|
|
693
721
|
function getBasePackageName(importName) {
|
|
694
722
|
if (importName.startsWith("@")) {
|
|
695
723
|
const parts = importName.split("/");
|
|
@@ -697,10 +725,12 @@ function getBasePackageName(importName) {
|
|
|
697
725
|
}
|
|
698
726
|
return importName.split("/")[0];
|
|
699
727
|
}
|
|
728
|
+
|
|
729
|
+
// src/actions/deplint/getImportsFromFile.ts
|
|
700
730
|
function getImportsFromFile(filePath, importPaths, typeImportPaths) {
|
|
701
|
-
const sourceCode =
|
|
731
|
+
const sourceCode = fs3.readFileSync(filePath, "utf8");
|
|
702
732
|
const sourceFile = ts.createSourceFile(
|
|
703
|
-
|
|
733
|
+
path4.basename(filePath),
|
|
704
734
|
sourceCode,
|
|
705
735
|
ts.ScriptTarget.Latest,
|
|
706
736
|
true
|
|
@@ -743,36 +773,26 @@ function getImportsFromFile(filePath, importPaths, typeImportPaths) {
|
|
|
743
773
|
}
|
|
744
774
|
return [cleanedImports, cleanedTypeImports];
|
|
745
775
|
}
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
const prodExcludeIncludes = ["/spec/", "/stories/", "/scripts/"];
|
|
753
|
-
const allSourceFiles = allSourceInclude.flatMap((pattern) => findFilesByGlob(path9, pattern));
|
|
754
|
-
const prodSourceFiles = allSourceFiles.filter((file) => !prodExcludeEndswith.some((ext) => file.endsWith(ext)) && !prodExcludeIncludes.some((excl) => file.includes(excl)));
|
|
755
|
-
const devSourceFiles = allSourceFiles.filter((file) => !prodSourceFiles.includes(file));
|
|
756
|
-
return {
|
|
757
|
-
allSourceFiles,
|
|
758
|
-
prodSourceFiles,
|
|
759
|
-
devSourceFiles
|
|
760
|
-
};
|
|
761
|
-
}
|
|
776
|
+
|
|
777
|
+
// src/actions/deplint/getExternalImportsFromFiles.ts
|
|
778
|
+
var internalImportPrefixes = [".", "#", "node:"];
|
|
779
|
+
var removeInternalImports = (imports) => {
|
|
780
|
+
return imports.filter((imp) => !internalImportPrefixes.some((prefix) => imp.startsWith(prefix)));
|
|
781
|
+
};
|
|
762
782
|
function getExternalImportsFromFiles({ prodSourceFiles, devSourceFiles }) {
|
|
763
783
|
const prodImportPaths = {};
|
|
764
784
|
const prodTypeImportPaths = {};
|
|
765
|
-
const prodImportPairs = prodSourceFiles.map((
|
|
785
|
+
const prodImportPairs = prodSourceFiles.map((path10) => getImportsFromFile(path10, prodImportPaths, prodTypeImportPaths));
|
|
766
786
|
const prodImports = prodImportPairs.flatMap((pair) => pair[0]);
|
|
767
787
|
const prodTypeImports = prodImportPairs.flatMap((pair) => pair[1]);
|
|
768
788
|
const devImportPaths = {};
|
|
769
789
|
const devTypeImportPaths = {};
|
|
770
|
-
const devImportPairs = devSourceFiles.map((
|
|
790
|
+
const devImportPairs = devSourceFiles.map((path10) => getImportsFromFile(path10, devImportPaths, devTypeImportPaths));
|
|
771
791
|
const devImports = devImportPairs.flatMap((pair) => pair[0]);
|
|
772
792
|
const devTypeImports = devImportPairs.flatMap((pair) => pair[1]);
|
|
773
|
-
const externalProdImports = prodImports
|
|
774
|
-
const externalProdTypeImports = prodTypeImports
|
|
775
|
-
const externalDevImports = devImports
|
|
793
|
+
const externalProdImports = removeInternalImports(prodImports);
|
|
794
|
+
const externalProdTypeImports = removeInternalImports(prodTypeImports);
|
|
795
|
+
const externalDevImports = removeInternalImports(devImports);
|
|
776
796
|
return {
|
|
777
797
|
prodImports,
|
|
778
798
|
devImports,
|
|
@@ -786,34 +806,40 @@ function getExternalImportsFromFiles({ prodSourceFiles, devSourceFiles }) {
|
|
|
786
806
|
externalProdTypeImports
|
|
787
807
|
};
|
|
788
808
|
}
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
809
|
+
|
|
810
|
+
// src/actions/deplint/checkPackage/getTypesInDependencies.ts
|
|
811
|
+
import chalk13 from "chalk";
|
|
812
|
+
function getTypesInDependencies({ name, location }, { dependencies }, {}) {
|
|
813
|
+
let typesInDependencies = 0;
|
|
814
|
+
for (const dep of dependencies) {
|
|
815
|
+
if (dep.startsWith("@types/")) {
|
|
816
|
+
typesInDependencies++;
|
|
817
|
+
console.log(`[${chalk13.blue(name)}] @types in dependencies in package.json: ${chalk13.red(dep)}`);
|
|
818
|
+
console.log(` ${location}/package.json
|
|
819
|
+
`);
|
|
820
|
+
console.log("");
|
|
821
|
+
}
|
|
822
|
+
}
|
|
823
|
+
return typesInDependencies;
|
|
824
|
+
}
|
|
825
|
+
|
|
826
|
+
// src/actions/deplint/checkPackage/getUnlistedDependencies.ts
|
|
827
|
+
import chalk14 from "chalk";
|
|
828
|
+
function getUnlistedDependencies({ name }, {
|
|
829
|
+
dependencies,
|
|
830
|
+
devDependencies,
|
|
831
|
+
peerDependencies
|
|
832
|
+
}, {
|
|
833
|
+
externalProdTypeImports,
|
|
834
|
+
prodTypeImportPaths,
|
|
835
|
+
externalProdImports,
|
|
836
|
+
prodImportPaths
|
|
794
837
|
}) {
|
|
795
|
-
const { prodSourceFiles, devSourceFiles } = findFiles(location);
|
|
796
|
-
const {
|
|
797
|
-
prodTypeImportPaths,
|
|
798
|
-
prodImportPaths,
|
|
799
|
-
externalProdTypeImports,
|
|
800
|
-
devImportPaths,
|
|
801
|
-
externalProdImports,
|
|
802
|
-
externalDevImports
|
|
803
|
-
} = getExternalImportsFromFiles({ prodSourceFiles, devSourceFiles });
|
|
804
|
-
const {
|
|
805
|
-
dependencies,
|
|
806
|
-
devDependencies,
|
|
807
|
-
peerDependencies
|
|
808
|
-
} = getDependenciesFromPackageJson(`${location}/package.json`);
|
|
809
838
|
let unlistedDependencies = 0;
|
|
810
|
-
let unlistedDevDependencies = 0;
|
|
811
|
-
let unusedDependencies = 0;
|
|
812
|
-
let typesInDependencies = 0;
|
|
813
839
|
for (const imp of externalProdTypeImports) {
|
|
814
|
-
if (!dependencies.includes(imp) && !peerDependencies.includes(imp) && !
|
|
840
|
+
if (!dependencies.includes(imp) && !peerDependencies.includes(imp) && !dependencies.includes(`@types/${imp}`) && !peerDependencies.includes(`@types/${imp}`)) {
|
|
815
841
|
unlistedDependencies++;
|
|
816
|
-
console.log(`[${
|
|
842
|
+
console.log(`[${chalk14.blue(name)}] Missing dependency in package.json: ${chalk14.red(imp)}`);
|
|
817
843
|
console.log(` ${prodTypeImportPaths[imp].join("\n")}`);
|
|
818
844
|
console.log("");
|
|
819
845
|
}
|
|
@@ -821,70 +847,123 @@ function check({
|
|
|
821
847
|
for (const imp of externalProdImports) {
|
|
822
848
|
if (!dependencies.includes(imp) && !peerDependencies.includes(imp)) {
|
|
823
849
|
unlistedDependencies++;
|
|
824
|
-
console.log(`[${
|
|
850
|
+
console.log(`[${chalk14.blue(name)}] Missing dependency in package.json: ${chalk14.red(imp)}`);
|
|
825
851
|
console.log(` ${prodImportPaths[imp].join("\n")}`);
|
|
826
852
|
console.log("");
|
|
827
853
|
}
|
|
828
854
|
}
|
|
855
|
+
return unlistedDependencies;
|
|
856
|
+
}
|
|
857
|
+
|
|
858
|
+
// src/actions/deplint/checkPackage/getUnlistedDevDependencies.ts
|
|
859
|
+
import chalk15 from "chalk";
|
|
860
|
+
function getUnlistedDevDependencies({ name }, {
|
|
861
|
+
devDependencies,
|
|
862
|
+
dependencies,
|
|
863
|
+
peerDependencies
|
|
864
|
+
}, { devImportPaths, externalDevImports }) {
|
|
865
|
+
let unlistedDevDependencies = 0;
|
|
866
|
+
for (const imp of externalDevImports) {
|
|
867
|
+
if (!devDependencies.includes(imp) && !dependencies.includes(imp) && !peerDependencies.includes(imp)) {
|
|
868
|
+
unlistedDevDependencies++;
|
|
869
|
+
console.log(`[${chalk15.blue(name)}] Missing devDependency in package.json: ${chalk15.red(imp)}`);
|
|
870
|
+
console.log(` Found in: ${devImportPaths[imp].join(", ")}`);
|
|
871
|
+
}
|
|
872
|
+
}
|
|
873
|
+
return unlistedDevDependencies;
|
|
874
|
+
}
|
|
875
|
+
|
|
876
|
+
// src/actions/deplint/checkPackage/getUnusedDependencies.ts
|
|
877
|
+
import chalk16 from "chalk";
|
|
878
|
+
function getUnusedDependencies({ name, location }, { dependencies }, {
|
|
879
|
+
externalProdImports,
|
|
880
|
+
externalProdTypeImports
|
|
881
|
+
}) {
|
|
882
|
+
let unusedDependencies = 0;
|
|
829
883
|
for (const dep of dependencies) {
|
|
830
|
-
if (dep.
|
|
831
|
-
|
|
832
|
-
console.log(`[${
|
|
884
|
+
if (!externalProdImports.includes(dep) && !externalProdTypeImports.includes(dep)) {
|
|
885
|
+
unusedDependencies++;
|
|
886
|
+
console.log(`[${chalk16.blue(name)}] Unused dependency in package.json: ${chalk16.red(dep)}`);
|
|
833
887
|
console.log(` ${location}/package.json
|
|
834
888
|
`);
|
|
835
889
|
console.log("");
|
|
836
890
|
}
|
|
837
|
-
|
|
891
|
+
}
|
|
892
|
+
return unusedDependencies;
|
|
893
|
+
}
|
|
894
|
+
|
|
895
|
+
// src/actions/deplint/checkPackage/getUnusedPeerDependencies.ts
|
|
896
|
+
import chalk17 from "chalk";
|
|
897
|
+
function getUnusedPeerDependencies({ name, location }, { peerDependencies }, { externalProdImports, externalProdTypeImports }) {
|
|
898
|
+
let unusedDependencies = 0;
|
|
899
|
+
for (const dep of peerDependencies) {
|
|
900
|
+
if (!externalProdImports.includes(dep) && !externalProdTypeImports.includes(dep)) {
|
|
838
901
|
unusedDependencies++;
|
|
839
|
-
console.log(`[${
|
|
902
|
+
console.log(`[${chalk17.blue(name)}] Unused peerDependency in package.json: ${chalk17.red(dep)}`);
|
|
840
903
|
console.log(` ${location}/package.json
|
|
841
904
|
`);
|
|
842
905
|
console.log("");
|
|
843
906
|
}
|
|
844
907
|
}
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
}
|
|
865
|
-
const
|
|
908
|
+
return unusedDependencies;
|
|
909
|
+
}
|
|
910
|
+
|
|
911
|
+
// src/actions/deplint/checkPackage/checkPackage.ts
|
|
912
|
+
function checkPackage({
|
|
913
|
+
name,
|
|
914
|
+
location,
|
|
915
|
+
deps = false,
|
|
916
|
+
devDeps = false,
|
|
917
|
+
peerDeps = false
|
|
918
|
+
}) {
|
|
919
|
+
const { prodSourceFiles, devSourceFiles } = findFiles(location);
|
|
920
|
+
const checkDeps = deps || !(deps || devDeps || peerDeps);
|
|
921
|
+
const checkDevDeps = devDeps || !(deps || devDeps || peerDeps);
|
|
922
|
+
const checkPeerDeps = peerDeps || !(deps || devDeps || peerDeps);
|
|
923
|
+
const sourceParams = getExternalImportsFromFiles({ prodSourceFiles, devSourceFiles });
|
|
924
|
+
const packageParams = getDependenciesFromPackageJson(`${location}/package.json`);
|
|
925
|
+
const unlistedDependencies = checkDeps ? getUnlistedDependencies({ name, location }, packageParams, sourceParams) : 0;
|
|
926
|
+
const unusedDependencies = checkDeps ? getUnusedDependencies({ name, location }, packageParams, sourceParams) : 0;
|
|
927
|
+
const typesInDependencies = checkDeps ? getTypesInDependencies({ name, location }, packageParams, sourceParams) : 0;
|
|
928
|
+
const unlistedDevDependencies = checkDevDeps ? getUnlistedDevDependencies({ name, location }, packageParams, sourceParams) : 0;
|
|
929
|
+
const unusedPeerDependencies = checkPeerDeps ? getUnusedPeerDependencies({ name, location }, packageParams, sourceParams) : 0;
|
|
930
|
+
const totalErrors = unlistedDependencies + unlistedDevDependencies + unusedDependencies + typesInDependencies + unusedPeerDependencies;
|
|
866
931
|
return totalErrors;
|
|
867
932
|
}
|
|
868
|
-
|
|
933
|
+
|
|
934
|
+
// src/actions/deplint/deplint.ts
|
|
935
|
+
var deplint = ({
|
|
936
|
+
pkg,
|
|
937
|
+
deps,
|
|
938
|
+
devDeps,
|
|
939
|
+
peerDeps
|
|
940
|
+
}) => {
|
|
869
941
|
if (pkg) {
|
|
870
942
|
const { location, name } = yarnWorkspace(pkg);
|
|
871
943
|
console.log(`Running Deplint for ${name}`);
|
|
872
|
-
|
|
944
|
+
checkPackage({
|
|
873
945
|
name,
|
|
874
946
|
location,
|
|
875
|
-
devDeps
|
|
947
|
+
devDeps,
|
|
948
|
+
deps,
|
|
949
|
+
peerDeps
|
|
876
950
|
});
|
|
877
951
|
} else {
|
|
878
952
|
const workspaces = yarnWorkspaces();
|
|
879
953
|
console.log("Deplint Started...");
|
|
880
954
|
let totalErrors = 0;
|
|
881
955
|
for (const workspace of workspaces) {
|
|
882
|
-
totalErrors +=
|
|
956
|
+
totalErrors += checkPackage({
|
|
957
|
+
...workspace,
|
|
958
|
+
deps,
|
|
959
|
+
devDeps,
|
|
960
|
+
peerDeps
|
|
961
|
+
});
|
|
883
962
|
}
|
|
884
963
|
if (totalErrors > 0) {
|
|
885
|
-
console.log(`Found ${
|
|
964
|
+
console.log(`Deplint: Found ${chalk18.red(totalErrors)} dependency problems. ${chalk18.red("\u2716")}`);
|
|
886
965
|
} else {
|
|
887
|
-
console.log(`
|
|
966
|
+
console.log(`Deplint: Found no dependency problems. ${chalk18.green("\u2714")}`);
|
|
888
967
|
}
|
|
889
968
|
}
|
|
890
969
|
return 0;
|
|
@@ -991,18 +1070,18 @@ var deployNext = () => {
|
|
|
991
1070
|
};
|
|
992
1071
|
|
|
993
1072
|
// src/actions/dupdeps.ts
|
|
994
|
-
import
|
|
1073
|
+
import chalk19 from "chalk";
|
|
995
1074
|
var dupdeps = () => {
|
|
996
|
-
console.log(
|
|
1075
|
+
console.log(chalk19.green("Checking all Dependencies for Duplicates"));
|
|
997
1076
|
const allDependencies = parsedPackageJSON()?.dependencies;
|
|
998
1077
|
const dependencies = Object.entries(allDependencies).map(([k]) => k);
|
|
999
1078
|
return detectDuplicateDependencies(dependencies);
|
|
1000
1079
|
};
|
|
1001
1080
|
|
|
1002
1081
|
// src/actions/lint.ts
|
|
1003
|
-
import
|
|
1082
|
+
import chalk20 from "chalk";
|
|
1004
1083
|
var lintPackage = ({ pkg, fix: fix2 }) => {
|
|
1005
|
-
console.log(
|
|
1084
|
+
console.log(chalk20.gray(`${fix2 ? "Fix" : "Lint"} [${pkg}]`));
|
|
1006
1085
|
const start = Date.now();
|
|
1007
1086
|
const result = runSteps(`${fix2 ? "Fix" : "Lint"} [${pkg}]`, [
|
|
1008
1087
|
["yarn", [
|
|
@@ -1012,7 +1091,7 @@ var lintPackage = ({ pkg, fix: fix2 }) => {
|
|
|
1012
1091
|
fix2 ? "package-fix" : "package-lint"
|
|
1013
1092
|
]]
|
|
1014
1093
|
]);
|
|
1015
|
-
console.log(
|
|
1094
|
+
console.log(chalk20.gray(`${fix2 ? "Fixed in" : "Linted in"} [${chalk20.magenta(((Date.now() - start) / 1e3).toFixed(2))}] ${chalk20.gray("seconds")}`));
|
|
1016
1095
|
return result;
|
|
1017
1096
|
};
|
|
1018
1097
|
var lint = ({
|
|
@@ -1028,13 +1107,13 @@ var lint = ({
|
|
|
1028
1107
|
});
|
|
1029
1108
|
};
|
|
1030
1109
|
var lintAllPackages = ({ fix: fix2 = false } = {}) => {
|
|
1031
|
-
console.log(
|
|
1110
|
+
console.log(chalk20.gray(`${fix2 ? "Fix" : "Lint"} [All-Packages]`));
|
|
1032
1111
|
const start = Date.now();
|
|
1033
1112
|
const fixOptions = fix2 ? ["--fix"] : [];
|
|
1034
1113
|
const result = runSteps(`${fix2 ? "Fix" : "Lint"} [All-Packages]`, [
|
|
1035
1114
|
["yarn", ["eslint", ...fixOptions]]
|
|
1036
1115
|
]);
|
|
1037
|
-
console.log(
|
|
1116
|
+
console.log(chalk20.gray(`${fix2 ? "Fixed in" : "Linted in"} [${chalk20.magenta(((Date.now() - start) / 1e3).toFixed(2))}] ${chalk20.gray("seconds")}`));
|
|
1038
1117
|
return result;
|
|
1039
1118
|
};
|
|
1040
1119
|
|
|
@@ -1062,7 +1141,7 @@ var filename = ".gitignore";
|
|
|
1062
1141
|
var gitignoreGen = (pkg) => generateIgnoreFiles(filename, pkg);
|
|
1063
1142
|
|
|
1064
1143
|
// src/actions/gitlint.ts
|
|
1065
|
-
import
|
|
1144
|
+
import chalk21 from "chalk";
|
|
1066
1145
|
import ParseGitConfig from "parse-git-config";
|
|
1067
1146
|
var gitlint = () => {
|
|
1068
1147
|
console.log(`
|
|
@@ -1073,7 +1152,7 @@ Gitlint Start [${process.cwd()}]
|
|
|
1073
1152
|
const errors = 0;
|
|
1074
1153
|
const gitConfig = ParseGitConfig.sync();
|
|
1075
1154
|
const warn = (message) => {
|
|
1076
|
-
console.warn(
|
|
1155
|
+
console.warn(chalk21.yellow(`Warning: ${message}`));
|
|
1077
1156
|
warnings++;
|
|
1078
1157
|
};
|
|
1079
1158
|
if (gitConfig.core.ignorecase) {
|
|
@@ -1093,13 +1172,13 @@ Gitlint Start [${process.cwd()}]
|
|
|
1093
1172
|
}
|
|
1094
1173
|
const resultMessages = [];
|
|
1095
1174
|
if (valid > 0) {
|
|
1096
|
-
resultMessages.push(
|
|
1175
|
+
resultMessages.push(chalk21.green(`Passed: ${valid}`));
|
|
1097
1176
|
}
|
|
1098
1177
|
if (warnings > 0) {
|
|
1099
|
-
resultMessages.push(
|
|
1178
|
+
resultMessages.push(chalk21.yellow(`Warnings: ${warnings}`));
|
|
1100
1179
|
}
|
|
1101
1180
|
if (errors > 0) {
|
|
1102
|
-
resultMessages.push(
|
|
1181
|
+
resultMessages.push(chalk21.red(` Errors: ${errors}`));
|
|
1103
1182
|
}
|
|
1104
1183
|
console.warn(`Gitlint Finish [ ${resultMessages.join(" | ")} ]
|
|
1105
1184
|
`);
|
|
@@ -1108,7 +1187,7 @@ Gitlint Start [${process.cwd()}]
|
|
|
1108
1187
|
|
|
1109
1188
|
// src/actions/gitlint-fix.ts
|
|
1110
1189
|
import { execSync as execSync2 } from "node:child_process";
|
|
1111
|
-
import
|
|
1190
|
+
import chalk22 from "chalk";
|
|
1112
1191
|
import ParseGitConfig2 from "parse-git-config";
|
|
1113
1192
|
var gitlintFix = () => {
|
|
1114
1193
|
console.log(`
|
|
@@ -1117,15 +1196,15 @@ Gitlint Fix Start [${process.cwd()}]
|
|
|
1117
1196
|
const gitConfig = ParseGitConfig2.sync();
|
|
1118
1197
|
if (gitConfig.core.ignorecase) {
|
|
1119
1198
|
execSync2("git config core.ignorecase false", { stdio: "inherit" });
|
|
1120
|
-
console.warn(
|
|
1199
|
+
console.warn(chalk22.yellow("\nGitlint Fix: Updated core.ignorecase to be false\n"));
|
|
1121
1200
|
}
|
|
1122
1201
|
if (gitConfig.core.autocrlf !== false) {
|
|
1123
1202
|
execSync2("git config core.autocrlf false", { stdio: "inherit" });
|
|
1124
|
-
console.warn(
|
|
1203
|
+
console.warn(chalk22.yellow("\nGitlint Fix: Updated core.autocrlf to be false\n"));
|
|
1125
1204
|
}
|
|
1126
1205
|
if (gitConfig.core.eol !== "lf") {
|
|
1127
1206
|
execSync2("git config core.eol lf", { stdio: "inherit" });
|
|
1128
|
-
console.warn(
|
|
1207
|
+
console.warn(chalk22.yellow('\nGitlint Fix: Updated core.eol to be "lf"\n'));
|
|
1129
1208
|
}
|
|
1130
1209
|
return 1;
|
|
1131
1210
|
};
|
|
@@ -1136,7 +1215,7 @@ var knip = () => {
|
|
|
1136
1215
|
};
|
|
1137
1216
|
|
|
1138
1217
|
// src/actions/license.ts
|
|
1139
|
-
import
|
|
1218
|
+
import chalk23 from "chalk";
|
|
1140
1219
|
import { init } from "license-checker";
|
|
1141
1220
|
var license = async (pkg) => {
|
|
1142
1221
|
const workspaces = yarnWorkspaces();
|
|
@@ -1161,18 +1240,18 @@ var license = async (pkg) => {
|
|
|
1161
1240
|
"LGPL-3.0-or-later",
|
|
1162
1241
|
"Python-2.0"
|
|
1163
1242
|
]);
|
|
1164
|
-
console.log(
|
|
1243
|
+
console.log(chalk23.green("License Checker"));
|
|
1165
1244
|
return (await Promise.all(
|
|
1166
1245
|
workspaceList.map(({ location, name }) => {
|
|
1167
1246
|
return new Promise((resolve) => {
|
|
1168
1247
|
init({ production: true, start: location }, (error, packages) => {
|
|
1169
1248
|
if (error) {
|
|
1170
|
-
console.error(
|
|
1171
|
-
console.error(
|
|
1249
|
+
console.error(chalk23.red(`License Checker [${name}] Error`));
|
|
1250
|
+
console.error(chalk23.gray(error));
|
|
1172
1251
|
console.log("\n");
|
|
1173
1252
|
resolve(1);
|
|
1174
1253
|
} else {
|
|
1175
|
-
console.log(
|
|
1254
|
+
console.log(chalk23.green(`License Checker [${name}]`));
|
|
1176
1255
|
let count = 0;
|
|
1177
1256
|
for (const [name2, info] of Object.entries(packages)) {
|
|
1178
1257
|
const licenses = Array.isArray(info.licenses) ? info.licenses : [info.licenses];
|
|
@@ -1188,7 +1267,7 @@ var license = async (pkg) => {
|
|
|
1188
1267
|
}
|
|
1189
1268
|
if (!orLicenseFound) {
|
|
1190
1269
|
count++;
|
|
1191
|
-
console.warn(
|
|
1270
|
+
console.warn(chalk23.yellow(`${name2}: Package License not allowed [${license2}]`));
|
|
1192
1271
|
}
|
|
1193
1272
|
}
|
|
1194
1273
|
}
|
|
@@ -1207,13 +1286,13 @@ var filename2 = ".npmignore";
|
|
|
1207
1286
|
var npmignoreGen = (pkg) => generateIgnoreFiles(filename2, pkg);
|
|
1208
1287
|
|
|
1209
1288
|
// src/actions/package/clean-outputs.ts
|
|
1210
|
-
import
|
|
1211
|
-
import
|
|
1289
|
+
import path5 from "node:path";
|
|
1290
|
+
import chalk24 from "chalk";
|
|
1212
1291
|
var packageCleanOutputs = () => {
|
|
1213
1292
|
const pkg = process.env.INIT_CWD ?? ".";
|
|
1214
1293
|
const pkgName = process.env.npm_package_name;
|
|
1215
|
-
const folders = [
|
|
1216
|
-
console.log(
|
|
1294
|
+
const folders = [path5.join(pkg, "dist"), path5.join(pkg, "build"), path5.join(pkg, "docs")];
|
|
1295
|
+
console.log(chalk24.green(`Cleaning Outputs [${pkgName}]`));
|
|
1217
1296
|
for (let folder of folders) {
|
|
1218
1297
|
deleteGlob(folder);
|
|
1219
1298
|
}
|
|
@@ -1221,13 +1300,13 @@ var packageCleanOutputs = () => {
|
|
|
1221
1300
|
};
|
|
1222
1301
|
|
|
1223
1302
|
// src/actions/package/clean-typescript.ts
|
|
1224
|
-
import
|
|
1225
|
-
import
|
|
1303
|
+
import path6 from "node:path";
|
|
1304
|
+
import chalk25 from "chalk";
|
|
1226
1305
|
var packageCleanTypescript = () => {
|
|
1227
1306
|
const pkg = process.env.INIT_CWD ?? ".";
|
|
1228
1307
|
const pkgName = process.env.npm_package_name;
|
|
1229
|
-
console.log(
|
|
1230
|
-
const files = [
|
|
1308
|
+
console.log(chalk25.green(`Cleaning Typescript [${pkgName}]`));
|
|
1309
|
+
const files = [path6.join(pkg, "*.tsbuildinfo"), path6.join(pkg, ".tsconfig.*"), path6.join(pkg, ".eslintcache")];
|
|
1231
1310
|
for (let file of files) {
|
|
1232
1311
|
deleteGlob(file);
|
|
1233
1312
|
}
|
|
@@ -1240,19 +1319,19 @@ var packageClean = async () => {
|
|
|
1240
1319
|
};
|
|
1241
1320
|
|
|
1242
1321
|
// src/actions/package/compile/compile.ts
|
|
1243
|
-
import
|
|
1322
|
+
import chalk29 from "chalk";
|
|
1244
1323
|
|
|
1245
1324
|
// src/actions/package/publint.ts
|
|
1246
|
-
import { promises as
|
|
1247
|
-
import
|
|
1325
|
+
import { promises as fs4 } from "node:fs";
|
|
1326
|
+
import chalk26 from "chalk";
|
|
1248
1327
|
import sortPackageJson from "sort-package-json";
|
|
1249
1328
|
var packagePublint = async (params) => {
|
|
1250
1329
|
const pkgDir = process.env.INIT_CWD;
|
|
1251
|
-
const sortedPkg = sortPackageJson(await
|
|
1252
|
-
await
|
|
1253
|
-
const pkg = JSON.parse(await
|
|
1254
|
-
console.log(
|
|
1255
|
-
console.log(
|
|
1330
|
+
const sortedPkg = sortPackageJson(await fs4.readFile(`${pkgDir}/package.json`, "utf8"));
|
|
1331
|
+
await fs4.writeFile(`${pkgDir}/package.json`, sortedPkg);
|
|
1332
|
+
const pkg = JSON.parse(await fs4.readFile(`${pkgDir}/package.json`, "utf8"));
|
|
1333
|
+
console.log(chalk26.green(`Publint: ${pkg.name}`));
|
|
1334
|
+
console.log(chalk26.gray(pkgDir));
|
|
1256
1335
|
const { publint: publint2 } = await import("publint");
|
|
1257
1336
|
const { messages } = await publint2({
|
|
1258
1337
|
level: "suggestion",
|
|
@@ -1267,21 +1346,21 @@ var packagePublint = async (params) => {
|
|
|
1267
1346
|
for (const message of validMessages) {
|
|
1268
1347
|
switch (message.type) {
|
|
1269
1348
|
case "error": {
|
|
1270
|
-
console.error(
|
|
1349
|
+
console.error(chalk26.red(`[${message.code}] ${formatMessage(message, pkg)}`));
|
|
1271
1350
|
break;
|
|
1272
1351
|
}
|
|
1273
1352
|
case "warning": {
|
|
1274
|
-
console.warn(
|
|
1353
|
+
console.warn(chalk26.yellow(`[${message.code}] ${formatMessage(message, pkg)}`));
|
|
1275
1354
|
break;
|
|
1276
1355
|
}
|
|
1277
1356
|
default: {
|
|
1278
|
-
console.log(
|
|
1357
|
+
console.log(chalk26.white(`[${message.code}] ${formatMessage(message, pkg)}`));
|
|
1279
1358
|
break;
|
|
1280
1359
|
}
|
|
1281
1360
|
}
|
|
1282
1361
|
}
|
|
1283
1362
|
if (params?.verbose) {
|
|
1284
|
-
console.log(
|
|
1363
|
+
console.log(chalk26.gray(`Publint [Finish]: ${pkgDir} [${validMessages.length}]`));
|
|
1285
1364
|
}
|
|
1286
1365
|
return validMessages.filter((message) => message.type === "error").length;
|
|
1287
1366
|
};
|
|
@@ -1318,7 +1397,7 @@ var buildEntries = (folder, entryMode = "single", excludeSpecAndStories = true,
|
|
|
1318
1397
|
|
|
1319
1398
|
// src/actions/package/compile/packageCompileTscTypes.ts
|
|
1320
1399
|
import { cwd } from "node:process";
|
|
1321
|
-
import
|
|
1400
|
+
import chalk27 from "chalk";
|
|
1322
1401
|
import { createProgramFromConfig } from "tsc-prog";
|
|
1323
1402
|
import {
|
|
1324
1403
|
DiagnosticCategory,
|
|
@@ -1373,7 +1452,7 @@ var packageCompileTscTypes = (folder = "src", config2 = {}, compilerOptionsParam
|
|
|
1373
1452
|
const validTsExt = [".ts", ".tsx", ".d.ts", ".cts", ".d.cts", ".mts", ".d.mts"];
|
|
1374
1453
|
const excludes = [".stories.", ".spec."];
|
|
1375
1454
|
const files = buildEntries(folder, "all", verbose).filter((file) => validTsExt.find((ext) => file.endsWith(ext)) && !excludes.some((exclude) => file.includes(exclude)));
|
|
1376
|
-
console.log(
|
|
1455
|
+
console.log(chalk27.green(`Compiling Types ${pkg}: ${files.length}`));
|
|
1377
1456
|
if (files.length > 0) {
|
|
1378
1457
|
const program = createProgramFromConfig({
|
|
1379
1458
|
basePath: pkg ?? cwd(),
|
|
@@ -1430,7 +1509,7 @@ function deepMergeObjects(objects) {
|
|
|
1430
1509
|
|
|
1431
1510
|
// src/actions/package/compile/packageCompileTsc.ts
|
|
1432
1511
|
import { cwd as cwd2 } from "node:process";
|
|
1433
|
-
import
|
|
1512
|
+
import chalk28 from "chalk";
|
|
1434
1513
|
import { createProgramFromConfig as createProgramFromConfig2 } from "tsc-prog";
|
|
1435
1514
|
import {
|
|
1436
1515
|
DiagnosticCategory as DiagnosticCategory2,
|
|
@@ -1456,7 +1535,7 @@ var packageCompileTsc = (folder = "src", config2 = {}, compilerOptionsParam) =>
|
|
|
1456
1535
|
const validTsExt = [".ts", ".tsx", ".d.ts", ".cts", ".d.cts", ".mts", ".d.mts"];
|
|
1457
1536
|
const includes = [".stories.", ".spec.", ".d.ts", ".d.cts", ".d.mts"];
|
|
1458
1537
|
const files = buildEntries(folder, "all", verbose).filter((file) => validTsExt.find((ext) => file.endsWith(ext)) && includes.find((include) => file.includes(include)));
|
|
1459
|
-
console.log(
|
|
1538
|
+
console.log(chalk28.green(`Compiling Files ${pkg}: ${files.length}`));
|
|
1460
1539
|
if (files.length > 0) {
|
|
1461
1540
|
const program = createProgramFromConfig2({
|
|
1462
1541
|
basePath: pkg ?? cwd2(),
|
|
@@ -1607,7 +1686,7 @@ var packageCompileTsup = async (config2) => {
|
|
|
1607
1686
|
// src/actions/package/compile/compile.ts
|
|
1608
1687
|
var packageCompile = async (inConfig = {}) => {
|
|
1609
1688
|
const pkg = process.env.INIT_CWD;
|
|
1610
|
-
console.log(
|
|
1689
|
+
console.log(chalk29.green(`Compiling ${pkg}`));
|
|
1611
1690
|
const config2 = await loadConfig(inConfig);
|
|
1612
1691
|
const publint2 = config2.publint;
|
|
1613
1692
|
const tsupResults = await packageCompileTsup(config2);
|
|
@@ -1618,8 +1697,8 @@ var packageCompile = async (inConfig = {}) => {
|
|
|
1618
1697
|
};
|
|
1619
1698
|
|
|
1620
1699
|
// src/actions/package/copy-assets.ts
|
|
1621
|
-
import
|
|
1622
|
-
import
|
|
1700
|
+
import path7 from "node:path/posix";
|
|
1701
|
+
import chalk30 from "chalk";
|
|
1623
1702
|
import cpy2 from "cpy";
|
|
1624
1703
|
var copyTargetAssets2 = async (target, name, location) => {
|
|
1625
1704
|
try {
|
|
@@ -1627,12 +1706,12 @@ var copyTargetAssets2 = async (target, name, location) => {
|
|
|
1627
1706
|
["**/*.jpg", "**/*.png", "**/*.gif", "**/*.svg", "**/*.webp", "**/*.sass", "**/*.scss", "**/*.gif", "**/*.css"],
|
|
1628
1707
|
`../dist/${target}`,
|
|
1629
1708
|
{
|
|
1630
|
-
cwd:
|
|
1709
|
+
cwd: path7.join(location, "src"),
|
|
1631
1710
|
flat: false
|
|
1632
1711
|
}
|
|
1633
1712
|
);
|
|
1634
1713
|
if (values.length > 0) {
|
|
1635
|
-
console.log(
|
|
1714
|
+
console.log(chalk30.green(`Copying Assets [${target.toUpperCase()}] - ${name} - ${location}`));
|
|
1636
1715
|
}
|
|
1637
1716
|
for (const value of values) {
|
|
1638
1717
|
console.log(`${value.split("/").pop()} => ./dist/${target}`);
|
|
@@ -1700,8 +1779,8 @@ var packageCycle = async ({ verbose = false }) => {
|
|
|
1700
1779
|
|
|
1701
1780
|
// src/actions/package/gen-docs.ts
|
|
1702
1781
|
import { existsSync as existsSync4 } from "node:fs";
|
|
1703
|
-
import
|
|
1704
|
-
import
|
|
1782
|
+
import path8 from "node:path";
|
|
1783
|
+
import chalk31 from "chalk";
|
|
1705
1784
|
import {
|
|
1706
1785
|
Application,
|
|
1707
1786
|
ArgumentsReader,
|
|
@@ -1719,7 +1798,7 @@ var ExitCodes = {
|
|
|
1719
1798
|
};
|
|
1720
1799
|
var packageGenDocs = async () => {
|
|
1721
1800
|
const pkg = process.env.INIT_CWD;
|
|
1722
|
-
if (pkg && !existsSync4(
|
|
1801
|
+
if (pkg && !existsSync4(path8.join(pkg, "typedoc.json"))) {
|
|
1723
1802
|
return;
|
|
1724
1803
|
}
|
|
1725
1804
|
const app = await Application.bootstrap({
|
|
@@ -1805,16 +1884,16 @@ var runTypeDoc = async (app) => {
|
|
|
1805
1884
|
return ExitCodes.OutputError;
|
|
1806
1885
|
}
|
|
1807
1886
|
}
|
|
1808
|
-
console.log(
|
|
1887
|
+
console.log(chalk31.green(`${pkgName} - Ok`));
|
|
1809
1888
|
return ExitCodes.Ok;
|
|
1810
1889
|
};
|
|
1811
1890
|
|
|
1812
1891
|
// src/actions/package/lint.ts
|
|
1813
1892
|
import { readdirSync } from "node:fs";
|
|
1814
|
-
import
|
|
1893
|
+
import path9 from "node:path";
|
|
1815
1894
|
import { cwd as cwd3 } from "node:process";
|
|
1816
1895
|
import { pathToFileURL } from "node:url";
|
|
1817
|
-
import
|
|
1896
|
+
import chalk32 from "chalk";
|
|
1818
1897
|
import { ESLint } from "eslint";
|
|
1819
1898
|
import { findUp } from "find-up";
|
|
1820
1899
|
import picomatch from "picomatch";
|
|
@@ -1823,14 +1902,14 @@ var dumpMessages = (lintResults) => {
|
|
|
1823
1902
|
const severity = ["none", "warning", "error"];
|
|
1824
1903
|
for (const lintResult of lintResults) {
|
|
1825
1904
|
if (lintResult.messages.length > 0) {
|
|
1826
|
-
console.log(
|
|
1905
|
+
console.log(chalk32.gray(`
|
|
1827
1906
|
${lintResult.filePath}`));
|
|
1828
1907
|
for (const message of lintResult.messages) {
|
|
1829
1908
|
console.log(
|
|
1830
|
-
|
|
1831
|
-
|
|
1832
|
-
|
|
1833
|
-
|
|
1909
|
+
chalk32.gray(` ${message.line}:${message.column}`),
|
|
1910
|
+
chalk32[colors[message.severity]](` ${severity[message.severity]}`),
|
|
1911
|
+
chalk32.white(` ${message.message}`),
|
|
1912
|
+
chalk32.gray(` ${message.ruleId}`)
|
|
1834
1913
|
);
|
|
1835
1914
|
}
|
|
1836
1915
|
}
|
|
@@ -1848,7 +1927,7 @@ function getFiles(dir, ignoreFolders) {
|
|
|
1848
1927
|
const subDirectory = dir.split(currentDirectory)[1];
|
|
1849
1928
|
if (ignoreFolders.includes(subDirectory)) return [];
|
|
1850
1929
|
return readdirSync(dir, { withFileTypes: true }).flatMap((dirent) => {
|
|
1851
|
-
const res =
|
|
1930
|
+
const res = path9.resolve(dir, dirent.name);
|
|
1852
1931
|
const relativePath = subDirectory ? `${subDirectory}/${dirent.name}` : dirent.name;
|
|
1853
1932
|
const ignoreMatchers = ignoreFolders.map((pattern) => picomatch(pattern));
|
|
1854
1933
|
if (ignoreMatchers.some((isMatch) => isMatch(relativePath))) return [];
|
|
@@ -1869,7 +1948,7 @@ var packageLint = async (fix2 = false, verbose = false, cache = true) => {
|
|
|
1869
1948
|
});
|
|
1870
1949
|
const files = getFiles(cwd3(), ignoreFolders);
|
|
1871
1950
|
if (verbose) {
|
|
1872
|
-
console.log(
|
|
1951
|
+
console.log(chalk32.green(`Linting ${pkg} [files = ${files.length}]`));
|
|
1873
1952
|
}
|
|
1874
1953
|
const lintResults = await engine.lintFiles(files);
|
|
1875
1954
|
dumpMessages(lintResults);
|
|
@@ -1879,7 +1958,7 @@ var packageLint = async (fix2 = false, verbose = false, cache = true) => {
|
|
|
1879
1958
|
const filesCountColor = files.length < 100 ? "green" : files.length < 1e3 ? "yellow" : "red";
|
|
1880
1959
|
const lintTime = Date.now() - start;
|
|
1881
1960
|
const lintTimeColor = lintTime < 1e3 ? "green" : lintTime < 3e3 ? "yellow" : "red";
|
|
1882
|
-
console.log(
|
|
1961
|
+
console.log(chalk32.white(`Linted ${chalk32[filesCountColor](files.length)} files in ${chalk32[lintTimeColor](lintTime)}ms`));
|
|
1883
1962
|
return lintResults.reduce((prev, lintResult) => prev + lintResult.errorCount, 0);
|
|
1884
1963
|
};
|
|
1885
1964
|
|
|
@@ -1909,7 +1988,7 @@ var rebuild = ({ target }) => {
|
|
|
1909
1988
|
};
|
|
1910
1989
|
|
|
1911
1990
|
// src/actions/recompile.ts
|
|
1912
|
-
import
|
|
1991
|
+
import chalk33 from "chalk";
|
|
1913
1992
|
var recompile = async ({
|
|
1914
1993
|
verbose,
|
|
1915
1994
|
target,
|
|
@@ -1945,7 +2024,7 @@ var recompileAll = async ({
|
|
|
1945
2024
|
const incrementalOptions = incremental ? ["--since", "-Apt", "--topological-dev"] : ["--parallel", "-Apt", "--topological-dev"];
|
|
1946
2025
|
const jobsOptions = jobs ? ["-j", `${jobs}`] : [];
|
|
1947
2026
|
if (jobs) {
|
|
1948
|
-
console.log(
|
|
2027
|
+
console.log(chalk33.blue(`Jobs set to [${jobs}]`));
|
|
1949
2028
|
}
|
|
1950
2029
|
const result = await runStepsAsync(`Recompile${incremental ? "-Incremental" : ""} [All]`, [
|
|
1951
2030
|
[
|
|
@@ -1976,7 +2055,7 @@ var recompileAll = async ({
|
|
|
1976
2055
|
]
|
|
1977
2056
|
]);
|
|
1978
2057
|
console.log(
|
|
1979
|
-
`${
|
|
2058
|
+
`${chalk33.gray("Recompiled in")} [${chalk33.magenta(((Date.now() - start) / 1e3).toFixed(2))}] ${chalk33.gray("seconds")}`
|
|
1980
2059
|
);
|
|
1981
2060
|
return result;
|
|
1982
2061
|
};
|
|
@@ -2007,9 +2086,9 @@ var reinstall = () => {
|
|
|
2007
2086
|
};
|
|
2008
2087
|
|
|
2009
2088
|
// src/actions/relint.ts
|
|
2010
|
-
import
|
|
2089
|
+
import chalk34 from "chalk";
|
|
2011
2090
|
var relintPackage = ({ pkg }) => {
|
|
2012
|
-
console.log(
|
|
2091
|
+
console.log(chalk34.gray(`${"Relint"} [All-Packages]`));
|
|
2013
2092
|
const start = Date.now();
|
|
2014
2093
|
const result = runSteps("Relint [All-Packages]", [
|
|
2015
2094
|
["yarn", [
|
|
@@ -2019,7 +2098,7 @@ var relintPackage = ({ pkg }) => {
|
|
|
2019
2098
|
"package-relint"
|
|
2020
2099
|
]]
|
|
2021
2100
|
]);
|
|
2022
|
-
console.log(
|
|
2101
|
+
console.log(chalk34.gray(`${"Relinted in"} [${chalk34.magenta(((Date.now() - start) / 1e3).toFixed(2))}] ${chalk34.gray("seconds")}`));
|
|
2023
2102
|
return result;
|
|
2024
2103
|
};
|
|
2025
2104
|
var relint = ({
|
|
@@ -2030,7 +2109,7 @@ var relint = ({
|
|
|
2030
2109
|
return pkg ? relintPackage({ pkg }) : relintAllPackages({ verbose, incremental });
|
|
2031
2110
|
};
|
|
2032
2111
|
var relintAllPackages = ({ verbose = true, incremental } = {}) => {
|
|
2033
|
-
console.log(
|
|
2112
|
+
console.log(chalk34.gray(`${"Relint"} [All-Packages]`));
|
|
2034
2113
|
const start = Date.now();
|
|
2035
2114
|
const verboseOptions = verbose ? ["--verbose"] : ["--no-verbose"];
|
|
2036
2115
|
const incrementalOptions = incremental ? ["--since", "-Ap"] : ["--parallel", "-Ap"];
|
|
@@ -2044,7 +2123,7 @@ var relintAllPackages = ({ verbose = true, incremental } = {}) => {
|
|
|
2044
2123
|
"package-relint"
|
|
2045
2124
|
]]
|
|
2046
2125
|
]);
|
|
2047
|
-
console.log(
|
|
2126
|
+
console.log(chalk34.gray(`Relinted in [${chalk34.magenta(((Date.now() - start) / 1e3).toFixed(2))}] ${chalk34.gray("seconds")}`));
|
|
2048
2127
|
return result;
|
|
2049
2128
|
};
|
|
2050
2129
|
|
|
@@ -2062,10 +2141,10 @@ var sonar = () => {
|
|
|
2062
2141
|
};
|
|
2063
2142
|
|
|
2064
2143
|
// src/actions/statics.ts
|
|
2065
|
-
import
|
|
2144
|
+
import chalk35 from "chalk";
|
|
2066
2145
|
var DefaultDependencies = ["axios", "@xylabs/pixel", "react", "graphql", "react-router", "@mui/material", "@mui/system"];
|
|
2067
2146
|
var statics = () => {
|
|
2068
|
-
console.log(
|
|
2147
|
+
console.log(chalk35.green("Check Required Static Dependencies"));
|
|
2069
2148
|
const statics2 = parsedPackageJSON()?.xy?.deps?.statics;
|
|
2070
2149
|
return detectDuplicateDependencies(statics2, DefaultDependencies);
|
|
2071
2150
|
};
|