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