@xylabs/ts-scripts-yarn3 6.4.6 → 6.5.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/deplint/checkPackage/checkPackage.mjs +256 -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 +17 -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 +256 -0
- package/dist/actions/deplint/checkPackage/index.mjs.map +1 -0
- package/dist/actions/deplint/deplint.mjs +316 -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} +160 -87
- package/dist/actions/deplint/index.mjs.map +1 -0
- package/dist/actions/deploy-major.mjs +31 -3
- package/dist/actions/deploy-major.mjs.map +1 -1
- package/dist/actions/deploy-minor.mjs +31 -3
- package/dist/actions/deploy-minor.mjs.map +1 -1
- package/dist/actions/deploy-next.mjs +31 -3
- package/dist/actions/deploy-next.mjs.map +1 -1
- package/dist/actions/deploy.mjs +31 -3
- package/dist/actions/deploy.mjs.map +1 -1
- package/dist/actions/fix.mjs.map +1 -1
- package/dist/actions/index.mjs +295 -164
- package/dist/actions/index.mjs.map +1 -1
- package/dist/actions/lint.mjs.map +1 -1
- package/dist/bin/xy.mjs +299 -159
- package/dist/bin/xy.mjs.map +1 -1
- package/dist/index.d.ts +5 -1
- package/dist/index.mjs +342 -202
- package/dist/index.mjs.map +1 -1
- package/dist/xy/index.mjs +299 -159
- 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 +299 -159
- 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/xyDeployCommands.mjs +74 -6
- package/dist/xy/xyDeployCommands.mjs.map +1 -1
- package/dist/xy/xyLintCommands.mjs +212 -107
- 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 +5 -5
- package/dist/actions/deplint.mjs.map +0 -1
package/dist/bin/xy.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
3
|
// src/xy/xy.ts
|
|
4
|
-
import
|
|
4
|
+
import chalk27 from "chalk";
|
|
5
5
|
|
|
6
6
|
// src/actions/build.ts
|
|
7
7
|
import chalk7 from "chalk";
|
|
@@ -299,8 +299,8 @@ var generateIgnoreFiles = (filename3, pkg) => {
|
|
|
299
299
|
|
|
300
300
|
// src/lib/parsedPackageJSON.ts
|
|
301
301
|
import { readFileSync as readFileSync2 } from "node:fs";
|
|
302
|
-
var parsedPackageJSON = (
|
|
303
|
-
const pathToPackageJSON =
|
|
302
|
+
var parsedPackageJSON = (path5) => {
|
|
303
|
+
const pathToPackageJSON = path5 ?? process.env.npm_package_json ?? "";
|
|
304
304
|
const packageJSON = readFileSync2(pathToPackageJSON).toString();
|
|
305
305
|
return JSON.parse(packageJSON);
|
|
306
306
|
};
|
|
@@ -657,12 +657,33 @@ var dead = () => {
|
|
|
657
657
|
return runSteps("Dead", [["yarn", ["ts-prune", "-p", "tsconfig.json"]]]);
|
|
658
658
|
};
|
|
659
659
|
|
|
660
|
-
// src/actions/deplint.ts
|
|
660
|
+
// src/actions/deplint/deplint.ts
|
|
661
|
+
import chalk17 from "chalk";
|
|
662
|
+
|
|
663
|
+
// src/actions/deplint/findFilesByGlob.ts
|
|
664
|
+
import { globSync } from "glob";
|
|
665
|
+
function findFilesByGlob(cwd, pattern) {
|
|
666
|
+
return globSync(pattern, { cwd, absolute: true });
|
|
667
|
+
}
|
|
668
|
+
|
|
669
|
+
// src/actions/deplint/findFiles.ts
|
|
670
|
+
function findFiles(path5) {
|
|
671
|
+
const allSourceInclude = ["./src/**/*.{ts,tsx}", "./dist/**/*.d.ts"];
|
|
672
|
+
const prodExcludeEndswith = [".spec.ts", ".stories.tsx"];
|
|
673
|
+
const prodExcludeIncludes = ["/spec/", "/stories/", "/scripts/"];
|
|
674
|
+
const allSourceFiles = allSourceInclude.flatMap((pattern) => findFilesByGlob(path5, pattern));
|
|
675
|
+
const prodSourceFiles = allSourceFiles.filter((file) => !prodExcludeEndswith.some((ext) => file.endsWith(ext)) && !prodExcludeIncludes.some((excl) => file.includes(excl)));
|
|
676
|
+
const devSourceFiles = allSourceFiles.filter((file) => !prodSourceFiles.includes(file));
|
|
677
|
+
return {
|
|
678
|
+
allSourceFiles,
|
|
679
|
+
prodSourceFiles,
|
|
680
|
+
devSourceFiles
|
|
681
|
+
};
|
|
682
|
+
}
|
|
683
|
+
|
|
684
|
+
// src/actions/deplint/getDependenciesFromPackageJson.ts
|
|
661
685
|
import fs2 from "node:fs";
|
|
662
686
|
import path3 from "node:path";
|
|
663
|
-
import chalk12 from "chalk";
|
|
664
|
-
import { globSync } from "glob";
|
|
665
|
-
import ts from "typescript";
|
|
666
687
|
function getDependenciesFromPackageJson(packageJsonPath) {
|
|
667
688
|
const packageJsonFullPath = path3.resolve(packageJsonPath);
|
|
668
689
|
const rawContent = fs2.readFileSync(packageJsonFullPath, "utf8");
|
|
@@ -676,6 +697,13 @@ function getDependenciesFromPackageJson(packageJsonPath) {
|
|
|
676
697
|
peerDependencies
|
|
677
698
|
};
|
|
678
699
|
}
|
|
700
|
+
|
|
701
|
+
// src/actions/deplint/getImportsFromFile.ts
|
|
702
|
+
import fs3 from "node:fs";
|
|
703
|
+
import path4 from "node:path";
|
|
704
|
+
import ts from "typescript";
|
|
705
|
+
|
|
706
|
+
// src/actions/deplint/getBasePackageName.ts
|
|
679
707
|
function getBasePackageName(importName) {
|
|
680
708
|
if (importName.startsWith("@")) {
|
|
681
709
|
const parts = importName.split("/");
|
|
@@ -683,10 +711,12 @@ function getBasePackageName(importName) {
|
|
|
683
711
|
}
|
|
684
712
|
return importName.split("/")[0];
|
|
685
713
|
}
|
|
714
|
+
|
|
715
|
+
// src/actions/deplint/getImportsFromFile.ts
|
|
686
716
|
function getImportsFromFile(filePath, importPaths, typeImportPaths) {
|
|
687
|
-
const sourceCode =
|
|
717
|
+
const sourceCode = fs3.readFileSync(filePath, "utf8");
|
|
688
718
|
const sourceFile = ts.createSourceFile(
|
|
689
|
-
|
|
719
|
+
path4.basename(filePath),
|
|
690
720
|
sourceCode,
|
|
691
721
|
ts.ScriptTarget.Latest,
|
|
692
722
|
true
|
|
@@ -729,36 +759,26 @@ function getImportsFromFile(filePath, importPaths, typeImportPaths) {
|
|
|
729
759
|
}
|
|
730
760
|
return [cleanedImports, cleanedTypeImports];
|
|
731
761
|
}
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
const prodExcludeIncludes = ["/spec/", "/stories/", "/scripts/"];
|
|
739
|
-
const allSourceFiles = allSourceInclude.flatMap((pattern) => findFilesByGlob(path4, pattern));
|
|
740
|
-
const prodSourceFiles = allSourceFiles.filter((file) => !prodExcludeEndswith.some((ext) => file.endsWith(ext)) && !prodExcludeIncludes.some((excl) => file.includes(excl)));
|
|
741
|
-
const devSourceFiles = allSourceFiles.filter((file) => !prodSourceFiles.includes(file));
|
|
742
|
-
return {
|
|
743
|
-
allSourceFiles,
|
|
744
|
-
prodSourceFiles,
|
|
745
|
-
devSourceFiles
|
|
746
|
-
};
|
|
747
|
-
}
|
|
762
|
+
|
|
763
|
+
// src/actions/deplint/getExternalImportsFromFiles.ts
|
|
764
|
+
var internalImportPrefixes = [".", "#", "node:"];
|
|
765
|
+
var removeInternalImports = (imports) => {
|
|
766
|
+
return imports.filter((imp) => !internalImportPrefixes.some((prefix) => imp.startsWith(prefix)));
|
|
767
|
+
};
|
|
748
768
|
function getExternalImportsFromFiles({ prodSourceFiles, devSourceFiles }) {
|
|
749
769
|
const prodImportPaths = {};
|
|
750
770
|
const prodTypeImportPaths = {};
|
|
751
|
-
const prodImportPairs = prodSourceFiles.map((
|
|
771
|
+
const prodImportPairs = prodSourceFiles.map((path5) => getImportsFromFile(path5, prodImportPaths, prodTypeImportPaths));
|
|
752
772
|
const prodImports = prodImportPairs.flatMap((pair) => pair[0]);
|
|
753
773
|
const prodTypeImports = prodImportPairs.flatMap((pair) => pair[1]);
|
|
754
774
|
const devImportPaths = {};
|
|
755
775
|
const devTypeImportPaths = {};
|
|
756
|
-
const devImportPairs = devSourceFiles.map((
|
|
776
|
+
const devImportPairs = devSourceFiles.map((path5) => getImportsFromFile(path5, devImportPaths, devTypeImportPaths));
|
|
757
777
|
const devImports = devImportPairs.flatMap((pair) => pair[0]);
|
|
758
778
|
const devTypeImports = devImportPairs.flatMap((pair) => pair[1]);
|
|
759
|
-
const externalProdImports = prodImports
|
|
760
|
-
const externalProdTypeImports = prodTypeImports
|
|
761
|
-
const externalDevImports = devImports
|
|
779
|
+
const externalProdImports = removeInternalImports(prodImports);
|
|
780
|
+
const externalProdTypeImports = removeInternalImports(prodTypeImports);
|
|
781
|
+
const externalDevImports = removeInternalImports(devImports);
|
|
762
782
|
return {
|
|
763
783
|
prodImports,
|
|
764
784
|
devImports,
|
|
@@ -772,34 +792,40 @@ function getExternalImportsFromFiles({ prodSourceFiles, devSourceFiles }) {
|
|
|
772
792
|
externalProdTypeImports
|
|
773
793
|
};
|
|
774
794
|
}
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
795
|
+
|
|
796
|
+
// src/actions/deplint/checkPackage/getTypesInDependencies.ts
|
|
797
|
+
import chalk12 from "chalk";
|
|
798
|
+
function getTypesInDependencies({ name, location }, { dependencies }, {}) {
|
|
799
|
+
let typesInDependencies = 0;
|
|
800
|
+
for (const dep of dependencies) {
|
|
801
|
+
if (dep.startsWith("@types/")) {
|
|
802
|
+
typesInDependencies++;
|
|
803
|
+
console.log(`[${chalk12.blue(name)}] @types in dependencies in package.json: ${chalk12.red(dep)}`);
|
|
804
|
+
console.log(` ${location}/package.json
|
|
805
|
+
`);
|
|
806
|
+
console.log("");
|
|
807
|
+
}
|
|
808
|
+
}
|
|
809
|
+
return typesInDependencies;
|
|
810
|
+
}
|
|
811
|
+
|
|
812
|
+
// src/actions/deplint/checkPackage/getUnlistedDependencies.ts
|
|
813
|
+
import chalk13 from "chalk";
|
|
814
|
+
function getUnlistedDependencies({ name }, {
|
|
815
|
+
dependencies,
|
|
816
|
+
devDependencies,
|
|
817
|
+
peerDependencies
|
|
818
|
+
}, {
|
|
819
|
+
externalProdTypeImports,
|
|
820
|
+
prodTypeImportPaths,
|
|
821
|
+
externalProdImports,
|
|
822
|
+
prodImportPaths
|
|
780
823
|
}) {
|
|
781
|
-
const { prodSourceFiles, devSourceFiles } = findFiles(location);
|
|
782
|
-
const {
|
|
783
|
-
prodTypeImportPaths,
|
|
784
|
-
prodImportPaths,
|
|
785
|
-
externalProdTypeImports,
|
|
786
|
-
devImportPaths,
|
|
787
|
-
externalProdImports,
|
|
788
|
-
externalDevImports
|
|
789
|
-
} = getExternalImportsFromFiles({ prodSourceFiles, devSourceFiles });
|
|
790
|
-
const {
|
|
791
|
-
dependencies,
|
|
792
|
-
devDependencies,
|
|
793
|
-
peerDependencies
|
|
794
|
-
} = getDependenciesFromPackageJson(`${location}/package.json`);
|
|
795
824
|
let unlistedDependencies = 0;
|
|
796
|
-
let unlistedDevDependencies = 0;
|
|
797
|
-
let unusedDependencies = 0;
|
|
798
|
-
let typesInDependencies = 0;
|
|
799
825
|
for (const imp of externalProdTypeImports) {
|
|
800
826
|
if (!dependencies.includes(imp) && !peerDependencies.includes(imp) && !devDependencies.includes(imp) && !devDependencies.includes(`@types/${imp}`)) {
|
|
801
827
|
unlistedDependencies++;
|
|
802
|
-
console.log(`[${
|
|
828
|
+
console.log(`[${chalk13.blue(name)}] Missing dependency in package.json: ${chalk13.red(imp)}`);
|
|
803
829
|
console.log(` ${prodTypeImportPaths[imp].join("\n")}`);
|
|
804
830
|
console.log("");
|
|
805
831
|
}
|
|
@@ -807,132 +833,237 @@ function check({
|
|
|
807
833
|
for (const imp of externalProdImports) {
|
|
808
834
|
if (!dependencies.includes(imp) && !peerDependencies.includes(imp)) {
|
|
809
835
|
unlistedDependencies++;
|
|
810
|
-
console.log(`[${
|
|
836
|
+
console.log(`[${chalk13.blue(name)}] Missing dependency in package.json: ${chalk13.red(imp)}`);
|
|
811
837
|
console.log(` ${prodImportPaths[imp].join("\n")}`);
|
|
812
838
|
console.log("");
|
|
813
839
|
}
|
|
814
840
|
}
|
|
841
|
+
return unlistedDependencies;
|
|
842
|
+
}
|
|
843
|
+
|
|
844
|
+
// src/actions/deplint/checkPackage/getUnlistedDevDependencies.ts
|
|
845
|
+
import chalk14 from "chalk";
|
|
846
|
+
function getUnlistedDevDependencies({ name }, { devDependencies }, { devImportPaths, externalDevImports }) {
|
|
847
|
+
let unlistedDevDependencies = 0;
|
|
848
|
+
for (const imp of externalDevImports) {
|
|
849
|
+
if (!devDependencies.includes(imp)) {
|
|
850
|
+
unlistedDevDependencies++;
|
|
851
|
+
console.log(`[${chalk14.blue(name)}] Missing devDependency in package.json: ${chalk14.red(imp)}`);
|
|
852
|
+
console.log(` Found in: ${devImportPaths[imp].join(", ")}`);
|
|
853
|
+
}
|
|
854
|
+
}
|
|
855
|
+
return unlistedDevDependencies;
|
|
856
|
+
}
|
|
857
|
+
|
|
858
|
+
// src/actions/deplint/checkPackage/getUnusedDependencies.ts
|
|
859
|
+
import chalk15 from "chalk";
|
|
860
|
+
function getUnusedDependencies({ name, location }, { dependencies }, {
|
|
861
|
+
externalProdImports,
|
|
862
|
+
externalProdTypeImports
|
|
863
|
+
}) {
|
|
864
|
+
let unusedDependencies = 0;
|
|
815
865
|
for (const dep of dependencies) {
|
|
816
|
-
if (dep.
|
|
817
|
-
|
|
818
|
-
console.log(`[${
|
|
866
|
+
if (!externalProdImports.includes(dep) && !externalProdTypeImports.includes(dep)) {
|
|
867
|
+
unusedDependencies++;
|
|
868
|
+
console.log(`[${chalk15.blue(name)}] Unused dependency in package.json: ${chalk15.red(dep)}`);
|
|
819
869
|
console.log(` ${location}/package.json
|
|
820
870
|
`);
|
|
821
871
|
console.log("");
|
|
822
872
|
}
|
|
823
|
-
|
|
873
|
+
}
|
|
874
|
+
return unusedDependencies;
|
|
875
|
+
}
|
|
876
|
+
|
|
877
|
+
// src/actions/deplint/checkPackage/getUnusedPeerDependencies.ts
|
|
878
|
+
import chalk16 from "chalk";
|
|
879
|
+
function getUnusedPeerDependencies({ name, location }, { peerDependencies }, { externalProdImports, externalProdTypeImports }) {
|
|
880
|
+
let unusedDependencies = 0;
|
|
881
|
+
for (const dep of peerDependencies) {
|
|
882
|
+
if (!externalProdImports.includes(dep) && !externalProdTypeImports.includes(dep)) {
|
|
824
883
|
unusedDependencies++;
|
|
825
|
-
console.log(`[${
|
|
884
|
+
console.log(`[${chalk16.blue(name)}] Unused peerDependency in package.json: ${chalk16.red(dep)}`);
|
|
826
885
|
console.log(` ${location}/package.json
|
|
827
886
|
`);
|
|
828
887
|
console.log("");
|
|
829
888
|
}
|
|
830
889
|
}
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
}
|
|
851
|
-
const
|
|
890
|
+
return unusedDependencies;
|
|
891
|
+
}
|
|
892
|
+
|
|
893
|
+
// src/actions/deplint/checkPackage/checkPackage.ts
|
|
894
|
+
function checkPackage({
|
|
895
|
+
name,
|
|
896
|
+
location,
|
|
897
|
+
deps = false,
|
|
898
|
+
devDeps = false,
|
|
899
|
+
peerDeps = false
|
|
900
|
+
}) {
|
|
901
|
+
const { prodSourceFiles, devSourceFiles } = findFiles(location);
|
|
902
|
+
const checkDeps = deps || !(deps || devDeps || peerDeps);
|
|
903
|
+
const checkDevDeps = devDeps || !(deps || devDeps || peerDeps);
|
|
904
|
+
const checkPeerDeps = peerDeps || !(deps || devDeps || peerDeps);
|
|
905
|
+
const sourceParams = getExternalImportsFromFiles({ prodSourceFiles, devSourceFiles });
|
|
906
|
+
const packageParams = getDependenciesFromPackageJson(`${location}/package.json`);
|
|
907
|
+
const unlistedDependencies = checkDeps ? getUnlistedDependencies({ name, location }, packageParams, sourceParams) : 0;
|
|
908
|
+
const unusedDependencies = checkDeps ? getUnusedDependencies({ name, location }, packageParams, sourceParams) : 0;
|
|
909
|
+
const typesInDependencies = checkDeps ? getTypesInDependencies({ name, location }, packageParams, sourceParams) : 0;
|
|
910
|
+
const unlistedDevDependencies = checkDevDeps ? getUnlistedDevDependencies({ name, location }, packageParams, sourceParams) : 0;
|
|
911
|
+
const unusedPeerDependencies = checkPeerDeps ? getUnusedPeerDependencies({ name, location }, packageParams, sourceParams) : 0;
|
|
912
|
+
const totalErrors = unlistedDependencies + unlistedDevDependencies + unusedDependencies + typesInDependencies + unusedPeerDependencies;
|
|
852
913
|
return totalErrors;
|
|
853
914
|
}
|
|
854
|
-
|
|
915
|
+
|
|
916
|
+
// src/actions/deplint/deplint.ts
|
|
917
|
+
var deplint = ({
|
|
918
|
+
pkg,
|
|
919
|
+
deps,
|
|
920
|
+
devDeps,
|
|
921
|
+
peerDeps
|
|
922
|
+
}) => {
|
|
855
923
|
if (pkg) {
|
|
856
924
|
const { location, name } = yarnWorkspace(pkg);
|
|
857
925
|
console.log(`Running Deplint for ${name}`);
|
|
858
|
-
|
|
926
|
+
checkPackage({
|
|
859
927
|
name,
|
|
860
928
|
location,
|
|
861
|
-
devDeps
|
|
929
|
+
devDeps,
|
|
930
|
+
deps,
|
|
931
|
+
peerDeps
|
|
862
932
|
});
|
|
863
933
|
} else {
|
|
864
934
|
const workspaces = yarnWorkspaces();
|
|
865
935
|
console.log("Deplint Started...");
|
|
866
936
|
let totalErrors = 0;
|
|
867
937
|
for (const workspace of workspaces) {
|
|
868
|
-
totalErrors +=
|
|
938
|
+
totalErrors += checkPackage({
|
|
939
|
+
...workspace,
|
|
940
|
+
deps,
|
|
941
|
+
devDeps,
|
|
942
|
+
peerDeps
|
|
943
|
+
});
|
|
869
944
|
}
|
|
870
945
|
if (totalErrors > 0) {
|
|
871
|
-
console.log(`Found ${
|
|
946
|
+
console.log(`Deplint: Found ${chalk17.red(totalErrors)} dependency problems. ${chalk17.red("\u2716")}`);
|
|
872
947
|
} else {
|
|
873
|
-
console.log(`
|
|
948
|
+
console.log(`Deplint: Found no dependency problems. ${chalk17.green("\u2714")}`);
|
|
874
949
|
}
|
|
875
950
|
}
|
|
876
951
|
return 0;
|
|
877
952
|
};
|
|
878
953
|
|
|
879
954
|
// src/actions/deploy.ts
|
|
955
|
+
import { readFileSync as readFileSync3 } from "node:fs";
|
|
956
|
+
var privatePackageExcludeList = () => {
|
|
957
|
+
const possibleDeployablePackages = yarnWorkspaces().map((workspace) => [
|
|
958
|
+
workspace,
|
|
959
|
+
JSON.parse(readFileSync3(`${workspace.location}/package.json`, { encoding: "utf8" }))
|
|
960
|
+
]);
|
|
961
|
+
const privatePackages = possibleDeployablePackages.filter(([_, pkg]) => pkg.private).map(([workspace]) => workspace);
|
|
962
|
+
const excludeList = privatePackages.map((workspace) => `--exclude ${workspace.name}`);
|
|
963
|
+
return excludeList;
|
|
964
|
+
};
|
|
880
965
|
var deploy = () => {
|
|
966
|
+
const excludeList = privatePackageExcludeList();
|
|
967
|
+
if (excludeList.length > 0) {
|
|
968
|
+
console.log("Excluding private packages from deployment:", excludeList);
|
|
969
|
+
}
|
|
881
970
|
return runSteps("Deploy [Patch]", [
|
|
882
971
|
["yarn", "workspaces foreach --all version patch --deferred"],
|
|
883
972
|
["yarn", "xy clean"],
|
|
884
973
|
["yarn", "xy build"],
|
|
885
974
|
["yarn", "version apply --all"],
|
|
886
|
-
["yarn",
|
|
975
|
+
["yarn", `workspaces foreach --all ${excludeList.join(" ")} --parallel npm publish`]
|
|
887
976
|
]);
|
|
888
977
|
};
|
|
889
978
|
|
|
890
979
|
// src/actions/deploy-major.ts
|
|
980
|
+
import { readFileSync as readFileSync4 } from "node:fs";
|
|
981
|
+
var privatePackageExcludeList2 = () => {
|
|
982
|
+
const possibleDeployablePackages = yarnWorkspaces().map((workspace) => [
|
|
983
|
+
workspace,
|
|
984
|
+
JSON.parse(readFileSync4(`${workspace.location}/package.json`, { encoding: "utf8" }))
|
|
985
|
+
]);
|
|
986
|
+
const privatePackages = possibleDeployablePackages.filter(([_, pkg]) => pkg.private).map(([workspace]) => workspace);
|
|
987
|
+
const excludeList = privatePackages.map((workspace) => `--exclude ${workspace.name}`);
|
|
988
|
+
return excludeList;
|
|
989
|
+
};
|
|
891
990
|
var deployMajor = () => {
|
|
991
|
+
const excludeList = privatePackageExcludeList2();
|
|
992
|
+
if (excludeList.length > 0) {
|
|
993
|
+
console.log("Excluding private packages from deployment:", excludeList);
|
|
994
|
+
}
|
|
892
995
|
return runSteps("Deploy [Major]", [
|
|
893
996
|
["yarn", "workspaces foreach --all version major --deferred"],
|
|
894
997
|
["yarn", "xy clean"],
|
|
895
998
|
["yarn", "xy build"],
|
|
896
999
|
["yarn", "version apply --all"],
|
|
897
|
-
["yarn",
|
|
1000
|
+
["yarn", `workspaces foreach --all ${excludeList.join(" ")} --parallel npm publish`]
|
|
898
1001
|
]);
|
|
899
1002
|
};
|
|
900
1003
|
|
|
901
1004
|
// src/actions/deploy-minor.ts
|
|
1005
|
+
import { readFileSync as readFileSync5 } from "node:fs";
|
|
1006
|
+
var privatePackageExcludeList3 = () => {
|
|
1007
|
+
const possibleDeployablePackages = yarnWorkspaces().map((workspace) => [
|
|
1008
|
+
workspace,
|
|
1009
|
+
JSON.parse(readFileSync5(`${workspace.location}/package.json`, { encoding: "utf8" }))
|
|
1010
|
+
]);
|
|
1011
|
+
const privatePackages = possibleDeployablePackages.filter(([_, pkg]) => pkg.private).map(([workspace]) => workspace);
|
|
1012
|
+
const excludeList = privatePackages.map((workspace) => `--exclude ${workspace.name}`);
|
|
1013
|
+
return excludeList;
|
|
1014
|
+
};
|
|
902
1015
|
var deployMinor = () => {
|
|
1016
|
+
const excludeList = privatePackageExcludeList3();
|
|
1017
|
+
if (excludeList.length > 0) {
|
|
1018
|
+
console.log("Excluding private packages from deployment:", excludeList);
|
|
1019
|
+
}
|
|
903
1020
|
return runSteps("Deploy [Minor]", [
|
|
904
1021
|
["yarn", "workspaces foreach --all version minor --deferred"],
|
|
905
1022
|
["yarn", "xy clean"],
|
|
906
1023
|
["yarn", "xy build"],
|
|
907
1024
|
["yarn", "version apply --all"],
|
|
908
|
-
["yarn",
|
|
1025
|
+
["yarn", `workspaces foreach --all ${excludeList.join(" ")} --parallel npm publish`]
|
|
909
1026
|
]);
|
|
910
1027
|
};
|
|
911
1028
|
|
|
912
1029
|
// src/actions/deploy-next.ts
|
|
1030
|
+
import { readFileSync as readFileSync6 } from "node:fs";
|
|
1031
|
+
var privatePackageExcludeList4 = () => {
|
|
1032
|
+
const possibleDeployablePackages = yarnWorkspaces().map((workspace) => [
|
|
1033
|
+
workspace,
|
|
1034
|
+
JSON.parse(readFileSync6(`${workspace.location}/package.json`, { encoding: "utf8" }))
|
|
1035
|
+
]);
|
|
1036
|
+
const privatePackages = possibleDeployablePackages.filter(([_, pkg]) => pkg.private).map(([workspace]) => workspace);
|
|
1037
|
+
const excludeList = privatePackages.map((workspace) => `--exclude ${workspace.name}`);
|
|
1038
|
+
return excludeList;
|
|
1039
|
+
};
|
|
913
1040
|
var deployNext = () => {
|
|
1041
|
+
const excludeList = privatePackageExcludeList4();
|
|
1042
|
+
if (excludeList.length > 0) {
|
|
1043
|
+
console.log("Excluding private packages from deployment:", excludeList);
|
|
1044
|
+
}
|
|
914
1045
|
return runSteps("Deploy [Next]", [
|
|
915
1046
|
["yarn", "workspaces foreach --all version minor --deferred"],
|
|
916
1047
|
["yarn", "xy clean"],
|
|
917
1048
|
["yarn", "xy build"],
|
|
918
1049
|
["yarn", "version apply --all --prerelease"],
|
|
919
|
-
["yarn",
|
|
1050
|
+
["yarn", `workspaces foreach --all ${excludeList.join(" ")} --parallel npm publish --tag next`]
|
|
920
1051
|
]);
|
|
921
1052
|
};
|
|
922
1053
|
|
|
923
1054
|
// src/actions/dupdeps.ts
|
|
924
|
-
import
|
|
1055
|
+
import chalk18 from "chalk";
|
|
925
1056
|
var dupdeps = () => {
|
|
926
|
-
console.log(
|
|
1057
|
+
console.log(chalk18.green("Checking all Dependencies for Duplicates"));
|
|
927
1058
|
const allDependencies = parsedPackageJSON()?.dependencies;
|
|
928
1059
|
const dependencies = Object.entries(allDependencies).map(([k]) => k);
|
|
929
1060
|
return detectDuplicateDependencies(dependencies);
|
|
930
1061
|
};
|
|
931
1062
|
|
|
932
1063
|
// src/actions/lint.ts
|
|
933
|
-
import
|
|
1064
|
+
import chalk19 from "chalk";
|
|
934
1065
|
var lintPackage = ({ pkg, fix: fix2 }) => {
|
|
935
|
-
console.log(
|
|
1066
|
+
console.log(chalk19.gray(`${fix2 ? "Fix" : "Lint"} [${pkg}]`));
|
|
936
1067
|
const start = Date.now();
|
|
937
1068
|
const result = runSteps(`${fix2 ? "Fix" : "Lint"} [${pkg}]`, [
|
|
938
1069
|
["yarn", [
|
|
@@ -942,7 +1073,7 @@ var lintPackage = ({ pkg, fix: fix2 }) => {
|
|
|
942
1073
|
fix2 ? "package-fix" : "package-lint"
|
|
943
1074
|
]]
|
|
944
1075
|
]);
|
|
945
|
-
console.log(
|
|
1076
|
+
console.log(chalk19.gray(`${fix2 ? "Fixed in" : "Linted in"} [${chalk19.magenta(((Date.now() - start) / 1e3).toFixed(2))}] ${chalk19.gray("seconds")}`));
|
|
946
1077
|
return result;
|
|
947
1078
|
};
|
|
948
1079
|
var lint = ({
|
|
@@ -958,13 +1089,13 @@ var lint = ({
|
|
|
958
1089
|
});
|
|
959
1090
|
};
|
|
960
1091
|
var lintAllPackages = ({ fix: fix2 = false } = {}) => {
|
|
961
|
-
console.log(
|
|
1092
|
+
console.log(chalk19.gray(`${fix2 ? "Fix" : "Lint"} [All-Packages]`));
|
|
962
1093
|
const start = Date.now();
|
|
963
1094
|
const fixOptions = fix2 ? ["--fix"] : [];
|
|
964
1095
|
const result = runSteps(`${fix2 ? "Fix" : "Lint"} [All-Packages]`, [
|
|
965
1096
|
["yarn", ["eslint", ...fixOptions]]
|
|
966
1097
|
]);
|
|
967
|
-
console.log(
|
|
1098
|
+
console.log(chalk19.gray(`${fix2 ? "Fixed in" : "Linted in"} [${chalk19.magenta(((Date.now() - start) / 1e3).toFixed(2))}] ${chalk19.gray("seconds")}`));
|
|
968
1099
|
return result;
|
|
969
1100
|
};
|
|
970
1101
|
|
|
@@ -992,7 +1123,7 @@ var filename = ".gitignore";
|
|
|
992
1123
|
var gitignoreGen = (pkg) => generateIgnoreFiles(filename, pkg);
|
|
993
1124
|
|
|
994
1125
|
// src/actions/gitlint.ts
|
|
995
|
-
import
|
|
1126
|
+
import chalk20 from "chalk";
|
|
996
1127
|
import ParseGitConfig from "parse-git-config";
|
|
997
1128
|
var gitlint = () => {
|
|
998
1129
|
console.log(`
|
|
@@ -1003,7 +1134,7 @@ Gitlint Start [${process.cwd()}]
|
|
|
1003
1134
|
const errors = 0;
|
|
1004
1135
|
const gitConfig = ParseGitConfig.sync();
|
|
1005
1136
|
const warn = (message) => {
|
|
1006
|
-
console.warn(
|
|
1137
|
+
console.warn(chalk20.yellow(`Warning: ${message}`));
|
|
1007
1138
|
warnings++;
|
|
1008
1139
|
};
|
|
1009
1140
|
if (gitConfig.core.ignorecase) {
|
|
@@ -1023,13 +1154,13 @@ Gitlint Start [${process.cwd()}]
|
|
|
1023
1154
|
}
|
|
1024
1155
|
const resultMessages = [];
|
|
1025
1156
|
if (valid > 0) {
|
|
1026
|
-
resultMessages.push(
|
|
1157
|
+
resultMessages.push(chalk20.green(`Passed: ${valid}`));
|
|
1027
1158
|
}
|
|
1028
1159
|
if (warnings > 0) {
|
|
1029
|
-
resultMessages.push(
|
|
1160
|
+
resultMessages.push(chalk20.yellow(`Warnings: ${warnings}`));
|
|
1030
1161
|
}
|
|
1031
1162
|
if (errors > 0) {
|
|
1032
|
-
resultMessages.push(
|
|
1163
|
+
resultMessages.push(chalk20.red(` Errors: ${errors}`));
|
|
1033
1164
|
}
|
|
1034
1165
|
console.warn(`Gitlint Finish [ ${resultMessages.join(" | ")} ]
|
|
1035
1166
|
`);
|
|
@@ -1038,7 +1169,7 @@ Gitlint Start [${process.cwd()}]
|
|
|
1038
1169
|
|
|
1039
1170
|
// src/actions/gitlint-fix.ts
|
|
1040
1171
|
import { execSync as execSync2 } from "node:child_process";
|
|
1041
|
-
import
|
|
1172
|
+
import chalk21 from "chalk";
|
|
1042
1173
|
import ParseGitConfig2 from "parse-git-config";
|
|
1043
1174
|
var gitlintFix = () => {
|
|
1044
1175
|
console.log(`
|
|
@@ -1047,15 +1178,15 @@ Gitlint Fix Start [${process.cwd()}]
|
|
|
1047
1178
|
const gitConfig = ParseGitConfig2.sync();
|
|
1048
1179
|
if (gitConfig.core.ignorecase) {
|
|
1049
1180
|
execSync2("git config core.ignorecase false", { stdio: "inherit" });
|
|
1050
|
-
console.warn(
|
|
1181
|
+
console.warn(chalk21.yellow("\nGitlint Fix: Updated core.ignorecase to be false\n"));
|
|
1051
1182
|
}
|
|
1052
1183
|
if (gitConfig.core.autocrlf !== false) {
|
|
1053
1184
|
execSync2("git config core.autocrlf false", { stdio: "inherit" });
|
|
1054
|
-
console.warn(
|
|
1185
|
+
console.warn(chalk21.yellow("\nGitlint Fix: Updated core.autocrlf to be false\n"));
|
|
1055
1186
|
}
|
|
1056
1187
|
if (gitConfig.core.eol !== "lf") {
|
|
1057
1188
|
execSync2("git config core.eol lf", { stdio: "inherit" });
|
|
1058
|
-
console.warn(
|
|
1189
|
+
console.warn(chalk21.yellow('\nGitlint Fix: Updated core.eol to be "lf"\n'));
|
|
1059
1190
|
}
|
|
1060
1191
|
return 1;
|
|
1061
1192
|
};
|
|
@@ -1066,7 +1197,7 @@ var knip = () => {
|
|
|
1066
1197
|
};
|
|
1067
1198
|
|
|
1068
1199
|
// src/actions/license.ts
|
|
1069
|
-
import
|
|
1200
|
+
import chalk22 from "chalk";
|
|
1070
1201
|
import { init } from "license-checker";
|
|
1071
1202
|
var license = async (pkg) => {
|
|
1072
1203
|
const workspaces = yarnWorkspaces();
|
|
@@ -1091,18 +1222,18 @@ var license = async (pkg) => {
|
|
|
1091
1222
|
"LGPL-3.0-or-later",
|
|
1092
1223
|
"Python-2.0"
|
|
1093
1224
|
]);
|
|
1094
|
-
console.log(
|
|
1225
|
+
console.log(chalk22.green("License Checker"));
|
|
1095
1226
|
return (await Promise.all(
|
|
1096
1227
|
workspaceList.map(({ location, name }) => {
|
|
1097
1228
|
return new Promise((resolve) => {
|
|
1098
1229
|
init({ production: true, start: location }, (error, packages) => {
|
|
1099
1230
|
if (error) {
|
|
1100
|
-
console.error(
|
|
1101
|
-
console.error(
|
|
1231
|
+
console.error(chalk22.red(`License Checker [${name}] Error`));
|
|
1232
|
+
console.error(chalk22.gray(error));
|
|
1102
1233
|
console.log("\n");
|
|
1103
1234
|
resolve(1);
|
|
1104
1235
|
} else {
|
|
1105
|
-
console.log(
|
|
1236
|
+
console.log(chalk22.green(`License Checker [${name}]`));
|
|
1106
1237
|
let count = 0;
|
|
1107
1238
|
for (const [name2, info] of Object.entries(packages)) {
|
|
1108
1239
|
const licenses = Array.isArray(info.licenses) ? info.licenses : [info.licenses];
|
|
@@ -1118,7 +1249,7 @@ var license = async (pkg) => {
|
|
|
1118
1249
|
}
|
|
1119
1250
|
if (!orLicenseFound) {
|
|
1120
1251
|
count++;
|
|
1121
|
-
console.warn(
|
|
1252
|
+
console.warn(chalk22.yellow(`${name2}: Package License not allowed [${license2}]`));
|
|
1122
1253
|
}
|
|
1123
1254
|
}
|
|
1124
1255
|
}
|
|
@@ -1157,7 +1288,7 @@ var rebuild = ({ target }) => {
|
|
|
1157
1288
|
};
|
|
1158
1289
|
|
|
1159
1290
|
// src/actions/recompile.ts
|
|
1160
|
-
import
|
|
1291
|
+
import chalk23 from "chalk";
|
|
1161
1292
|
var recompile = async ({
|
|
1162
1293
|
verbose,
|
|
1163
1294
|
target,
|
|
@@ -1193,7 +1324,7 @@ var recompileAll = async ({
|
|
|
1193
1324
|
const incrementalOptions = incremental ? ["--since", "-Apt", "--topological-dev"] : ["--parallel", "-Apt", "--topological-dev"];
|
|
1194
1325
|
const jobsOptions = jobs ? ["-j", `${jobs}`] : [];
|
|
1195
1326
|
if (jobs) {
|
|
1196
|
-
console.log(
|
|
1327
|
+
console.log(chalk23.blue(`Jobs set to [${jobs}]`));
|
|
1197
1328
|
}
|
|
1198
1329
|
const result = await runStepsAsync(`Recompile${incremental ? "-Incremental" : ""} [All]`, [
|
|
1199
1330
|
[
|
|
@@ -1224,7 +1355,7 @@ var recompileAll = async ({
|
|
|
1224
1355
|
]
|
|
1225
1356
|
]);
|
|
1226
1357
|
console.log(
|
|
1227
|
-
`${
|
|
1358
|
+
`${chalk23.gray("Recompiled in")} [${chalk23.magenta(((Date.now() - start) / 1e3).toFixed(2))}] ${chalk23.gray("seconds")}`
|
|
1228
1359
|
);
|
|
1229
1360
|
return result;
|
|
1230
1361
|
};
|
|
@@ -1255,9 +1386,9 @@ var reinstall = () => {
|
|
|
1255
1386
|
};
|
|
1256
1387
|
|
|
1257
1388
|
// src/actions/relint.ts
|
|
1258
|
-
import
|
|
1389
|
+
import chalk24 from "chalk";
|
|
1259
1390
|
var relintPackage = ({ pkg }) => {
|
|
1260
|
-
console.log(
|
|
1391
|
+
console.log(chalk24.gray(`${"Relint"} [All-Packages]`));
|
|
1261
1392
|
const start = Date.now();
|
|
1262
1393
|
const result = runSteps("Relint [All-Packages]", [
|
|
1263
1394
|
["yarn", [
|
|
@@ -1267,7 +1398,7 @@ var relintPackage = ({ pkg }) => {
|
|
|
1267
1398
|
"package-relint"
|
|
1268
1399
|
]]
|
|
1269
1400
|
]);
|
|
1270
|
-
console.log(
|
|
1401
|
+
console.log(chalk24.gray(`${"Relinted in"} [${chalk24.magenta(((Date.now() - start) / 1e3).toFixed(2))}] ${chalk24.gray("seconds")}`));
|
|
1271
1402
|
return result;
|
|
1272
1403
|
};
|
|
1273
1404
|
var relint = ({
|
|
@@ -1278,7 +1409,7 @@ var relint = ({
|
|
|
1278
1409
|
return pkg ? relintPackage({ pkg }) : relintAllPackages({ verbose, incremental });
|
|
1279
1410
|
};
|
|
1280
1411
|
var relintAllPackages = ({ verbose = true, incremental } = {}) => {
|
|
1281
|
-
console.log(
|
|
1412
|
+
console.log(chalk24.gray(`${"Relint"} [All-Packages]`));
|
|
1282
1413
|
const start = Date.now();
|
|
1283
1414
|
const verboseOptions = verbose ? ["--verbose"] : ["--no-verbose"];
|
|
1284
1415
|
const incrementalOptions = incremental ? ["--since", "-Ap"] : ["--parallel", "-Ap"];
|
|
@@ -1292,7 +1423,7 @@ var relintAllPackages = ({ verbose = true, incremental } = {}) => {
|
|
|
1292
1423
|
"package-relint"
|
|
1293
1424
|
]]
|
|
1294
1425
|
]);
|
|
1295
|
-
console.log(
|
|
1426
|
+
console.log(chalk24.gray(`Relinted in [${chalk24.magenta(((Date.now() - start) / 1e3).toFixed(2))}] ${chalk24.gray("seconds")}`));
|
|
1296
1427
|
return result;
|
|
1297
1428
|
};
|
|
1298
1429
|
|
|
@@ -1310,10 +1441,10 @@ var sonar = () => {
|
|
|
1310
1441
|
};
|
|
1311
1442
|
|
|
1312
1443
|
// src/actions/statics.ts
|
|
1313
|
-
import
|
|
1444
|
+
import chalk25 from "chalk";
|
|
1314
1445
|
var DefaultDependencies = ["axios", "@xylabs/pixel", "react", "graphql", "react-router", "@mui/material", "@mui/system"];
|
|
1315
1446
|
var statics = () => {
|
|
1316
|
-
console.log(
|
|
1447
|
+
console.log(chalk25.green("Check Required Static Dependencies"));
|
|
1317
1448
|
const statics2 = parsedPackageJSON()?.xy?.deps?.statics;
|
|
1318
1449
|
return detectDuplicateDependencies(statics2, DefaultDependencies);
|
|
1319
1450
|
};
|
|
@@ -1478,7 +1609,7 @@ var xyBuildCommands = (args) => {
|
|
|
1478
1609
|
|
|
1479
1610
|
// src/xy/param.ts
|
|
1480
1611
|
var packagePositionalParam = (yargs2) => {
|
|
1481
|
-
return yargs2.positional("package", { describe: "Specific package to target" });
|
|
1612
|
+
return yargs2.positional("package", { describe: "Specific package to target", type: "string" });
|
|
1482
1613
|
};
|
|
1483
1614
|
|
|
1484
1615
|
// src/xy/xyCommonCommands.ts
|
|
@@ -1720,7 +1851,7 @@ var xyInstallCommands = (args) => {
|
|
|
1720
1851
|
};
|
|
1721
1852
|
|
|
1722
1853
|
// src/xy/xyLintCommands.ts
|
|
1723
|
-
import
|
|
1854
|
+
import chalk26 from "chalk";
|
|
1724
1855
|
var xyLintCommands = (args) => {
|
|
1725
1856
|
return args.command(
|
|
1726
1857
|
"cycle [package]",
|
|
@@ -1732,31 +1863,61 @@ var xyLintCommands = (args) => {
|
|
|
1732
1863
|
const start = Date.now();
|
|
1733
1864
|
if (argv.verbose) console.log("Cycle");
|
|
1734
1865
|
process.exitCode = await cycle({ pkg: argv.package });
|
|
1735
|
-
console.log(
|
|
1866
|
+
console.log(chalk26.blue(`Finished in ${Date.now() - start}ms`));
|
|
1736
1867
|
}
|
|
1737
1868
|
).command(
|
|
1738
1869
|
"lint [package]",
|
|
1739
1870
|
"Lint - Run Eslint",
|
|
1740
1871
|
(yargs2) => {
|
|
1741
|
-
return packagePositionalParam(yargs2)
|
|
1872
|
+
return packagePositionalParam(yargs2).option("fix", {
|
|
1873
|
+
alias: "f",
|
|
1874
|
+
default: false,
|
|
1875
|
+
description: "Fix fixable issues",
|
|
1876
|
+
type: "boolean"
|
|
1877
|
+
}).option("cache", {
|
|
1878
|
+
alias: "c",
|
|
1879
|
+
default: false,
|
|
1880
|
+
description: "Use caching for performance",
|
|
1881
|
+
type: "boolean"
|
|
1882
|
+
});
|
|
1742
1883
|
},
|
|
1743
1884
|
(argv) => {
|
|
1744
1885
|
if (argv.verbose) console.log("Lint");
|
|
1745
1886
|
const start = Date.now();
|
|
1746
|
-
process.exitCode = argv.fix ? fix({ pkg: argv.package }) : lint({ pkg: argv.package });
|
|
1747
|
-
console.log(
|
|
1887
|
+
process.exitCode = argv.fix ? fix({ pkg: argv.package, cache: argv.cache }) : lint({ pkg: argv.package, cache: argv.cache });
|
|
1888
|
+
console.log(chalk26.blue(`Finished in ${Date.now() - start}ms`));
|
|
1748
1889
|
}
|
|
1749
1890
|
).command(
|
|
1750
1891
|
"deplint [package]",
|
|
1751
1892
|
"Deplint - Run Deplint",
|
|
1752
1893
|
(yargs2) => {
|
|
1753
|
-
return packagePositionalParam(yargs2)
|
|
1894
|
+
return packagePositionalParam(yargs2).option("deps", {
|
|
1895
|
+
alias: "d",
|
|
1896
|
+
default: false,
|
|
1897
|
+
description: "Check dependencies",
|
|
1898
|
+
type: "boolean"
|
|
1899
|
+
}).option("devDeps", {
|
|
1900
|
+
alias: "v",
|
|
1901
|
+
default: false,
|
|
1902
|
+
description: "Check devDependencies",
|
|
1903
|
+
type: "boolean"
|
|
1904
|
+
}).option("peerDeps", {
|
|
1905
|
+
alias: "p",
|
|
1906
|
+
default: false,
|
|
1907
|
+
description: "Check peerDependencies",
|
|
1908
|
+
type: "boolean"
|
|
1909
|
+
});
|
|
1754
1910
|
},
|
|
1755
1911
|
(argv) => {
|
|
1756
1912
|
if (argv.verbose) console.log("Deplint");
|
|
1757
1913
|
const start = Date.now();
|
|
1758
|
-
process.exitCode = deplint({
|
|
1759
|
-
|
|
1914
|
+
process.exitCode = deplint({
|
|
1915
|
+
pkg: argv.package,
|
|
1916
|
+
deps: !!argv.deps,
|
|
1917
|
+
devDeps: !!argv.devDeps,
|
|
1918
|
+
peerDeps: !!argv.peerDeps
|
|
1919
|
+
});
|
|
1920
|
+
console.log(chalk26.blue(`Finished in ${Date.now() - start}ms`));
|
|
1760
1921
|
}
|
|
1761
1922
|
).command(
|
|
1762
1923
|
"fix [package]",
|
|
@@ -1768,7 +1929,7 @@ var xyLintCommands = (args) => {
|
|
|
1768
1929
|
const start = Date.now();
|
|
1769
1930
|
if (argv.verbose) console.log("Fix");
|
|
1770
1931
|
process.exitCode = fix();
|
|
1771
|
-
console.log(
|
|
1932
|
+
console.log(chalk26.blue(`Finished in ${Date.now() - start}ms`));
|
|
1772
1933
|
}
|
|
1773
1934
|
).command(
|
|
1774
1935
|
"relint [package]",
|
|
@@ -1780,7 +1941,7 @@ var xyLintCommands = (args) => {
|
|
|
1780
1941
|
if (argv.verbose) console.log("Relinting");
|
|
1781
1942
|
const start = Date.now();
|
|
1782
1943
|
process.exitCode = relint();
|
|
1783
|
-
console.log(
|
|
1944
|
+
console.log(chalk26.blue(`Finished in ${Date.now() - start}ms`));
|
|
1784
1945
|
}
|
|
1785
1946
|
).command(
|
|
1786
1947
|
"publint [package]",
|
|
@@ -1792,7 +1953,7 @@ var xyLintCommands = (args) => {
|
|
|
1792
1953
|
if (argv.verbose) console.log("Publint");
|
|
1793
1954
|
const start = Date.now();
|
|
1794
1955
|
process.exitCode = await publint({ pkg: argv.package, verbose: !!argv.verbose });
|
|
1795
|
-
console.log(
|
|
1956
|
+
console.log(chalk26.blue(`Finished in ${Date.now() - start}ms`));
|
|
1796
1957
|
}
|
|
1797
1958
|
).command(
|
|
1798
1959
|
"knip",
|
|
@@ -1804,7 +1965,7 @@ var xyLintCommands = (args) => {
|
|
|
1804
1965
|
if (argv.verbose) console.log("Knip");
|
|
1805
1966
|
const start = Date.now();
|
|
1806
1967
|
process.exitCode = knip();
|
|
1807
|
-
console.log(
|
|
1968
|
+
console.log(chalk26.blue(`Knip finished in ${Date.now() - start}ms`));
|
|
1808
1969
|
}
|
|
1809
1970
|
).command(
|
|
1810
1971
|
"sonar",
|
|
@@ -1816,7 +1977,7 @@ var xyLintCommands = (args) => {
|
|
|
1816
1977
|
const start = Date.now();
|
|
1817
1978
|
if (argv.verbose) console.log("Sonar Check");
|
|
1818
1979
|
process.exitCode = sonar();
|
|
1819
|
-
console.log(
|
|
1980
|
+
console.log(chalk26.blue(`Finished in ${Date.now() - start}ms`));
|
|
1820
1981
|
}
|
|
1821
1982
|
);
|
|
1822
1983
|
};
|
|
@@ -1835,37 +1996,16 @@ var xyParseOptions = () => {
|
|
|
1835
1996
|
default: false,
|
|
1836
1997
|
description: "Run with verbose logging",
|
|
1837
1998
|
type: "boolean"
|
|
1838
|
-
}).option("target", {
|
|
1839
|
-
alias: "t",
|
|
1840
|
-
default: "esm",
|
|
1841
|
-
choices: ["esm", "cjs"],
|
|
1842
|
-
description: "Limit output to specific target",
|
|
1843
|
-
type: "string"
|
|
1844
1999
|
}).option("incremental", {
|
|
1845
2000
|
alias: "i",
|
|
1846
2001
|
default: false,
|
|
1847
2002
|
description: "Attempt to perform the action only on changed packages",
|
|
1848
2003
|
type: "boolean"
|
|
1849
|
-
}).option("fix", {
|
|
1850
|
-
alias: "f",
|
|
1851
|
-
default: false,
|
|
1852
|
-
description: "Try to fix errors",
|
|
1853
|
-
type: "boolean"
|
|
1854
|
-
}).option("cache", {
|
|
1855
|
-
alias: "c",
|
|
1856
|
-
default: false,
|
|
1857
|
-
description: "Use caching for performance",
|
|
1858
|
-
type: "boolean"
|
|
1859
2004
|
}).option("profile", {
|
|
1860
2005
|
alias: "p",
|
|
1861
2006
|
default: false,
|
|
1862
2007
|
description: "Profile action",
|
|
1863
2008
|
type: "boolean"
|
|
1864
|
-
}).option("types", {
|
|
1865
|
-
default: "tsc",
|
|
1866
|
-
choices: ["tsc", "tsup"],
|
|
1867
|
-
description: "Tool to generate Typescript types",
|
|
1868
|
-
type: "string"
|
|
1869
2009
|
});
|
|
1870
2010
|
};
|
|
1871
2011
|
|
|
@@ -1873,8 +2013,8 @@ var xyParseOptions = () => {
|
|
|
1873
2013
|
var xy = async () => {
|
|
1874
2014
|
const options = xyParseOptions();
|
|
1875
2015
|
return await xyBuildCommands(xyCommonCommands(xyInstallCommands(xyDeployCommands(xyLintCommands(options))))).demandCommand(1).command("*", "", () => {
|
|
1876
|
-
console.error(
|
|
1877
|
-
console.log(
|
|
2016
|
+
console.error(chalk27.yellow(`Command not found [${chalk27.magenta(process.argv[2])}]`));
|
|
2017
|
+
console.log(chalk27.gray("Try 'yarn xy --help' for list of commands"));
|
|
1878
2018
|
}).version().help().argv;
|
|
1879
2019
|
};
|
|
1880
2020
|
|