@xylabs/ts-scripts-yarn3 6.5.6 → 6.5.8
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/build.mjs +2 -2
- package/dist/actions/clean-docs.mjs +3 -3
- package/dist/actions/clean-eslint.mjs +2 -2
- package/dist/actions/clean-jest.mjs +2 -2
- package/dist/actions/clean.mjs +2 -2
- package/dist/actions/compile-types.mjs +2 -2
- package/dist/actions/compile.mjs +2 -2
- package/dist/actions/copy-assets.mjs +2 -2
- package/dist/actions/cycle.mjs +2 -2
- package/dist/actions/dead.mjs +2 -2
- package/dist/actions/deplint/checkPackage/checkPackage.mjs +85 -103
- package/dist/actions/deplint/checkPackage/checkPackage.mjs.map +1 -1
- package/dist/actions/deplint/checkPackage/getUnlistedDependencies.mjs +8 -17
- package/dist/actions/deplint/checkPackage/getUnlistedDependencies.mjs.map +1 -1
- package/dist/actions/deplint/checkPackage/getUnlistedDevDependencies.mjs +14 -5
- package/dist/actions/deplint/checkPackage/getUnlistedDevDependencies.mjs.map +1 -1
- package/dist/actions/deplint/checkPackage/getUnusedDependencies.mjs +13 -7
- package/dist/actions/deplint/checkPackage/getUnusedDependencies.mjs.map +1 -1
- package/dist/actions/deplint/checkPackage/getUnusedPeerDependencies.mjs +12 -6
- package/dist/actions/deplint/checkPackage/getUnusedPeerDependencies.mjs.map +1 -1
- package/dist/actions/deplint/checkPackage/index.mjs +85 -103
- package/dist/actions/deplint/checkPackage/index.mjs.map +1 -1
- package/dist/actions/deplint/deplint.mjs +86 -104
- package/dist/actions/deplint/deplint.mjs.map +1 -1
- package/dist/actions/deplint/findFiles.mjs +4 -14
- package/dist/actions/deplint/findFiles.mjs.map +1 -1
- package/dist/actions/deplint/getBasePackageName.mjs +5 -4
- package/dist/actions/deplint/getBasePackageName.mjs.map +1 -1
- package/dist/actions/deplint/getDependenciesFromPackageJson.mjs +2 -2
- package/dist/actions/deplint/getExternalImportsFromFiles.mjs +29 -40
- package/dist/actions/deplint/getExternalImportsFromFiles.mjs.map +1 -1
- package/dist/actions/deplint/getImportsFromFile.mjs +14 -11
- package/dist/actions/deplint/getImportsFromFile.mjs.map +1 -1
- package/dist/actions/deplint/index.mjs +86 -104
- package/dist/actions/deplint/index.mjs.map +1 -1
- package/dist/actions/deploy-major.mjs +4 -4
- package/dist/actions/deploy-minor.mjs +4 -4
- package/dist/actions/deploy-next.mjs +4 -4
- package/dist/actions/deploy.mjs +4 -4
- package/dist/actions/dupdeps.mjs +3 -3
- package/dist/actions/fix.mjs +2 -2
- package/dist/actions/gen-docs.mjs +2 -2
- package/dist/actions/gitignore-gen.mjs +2 -2
- package/dist/actions/gitlint-fix.mjs +1 -1
- package/dist/actions/index.mjs +123 -141
- package/dist/actions/index.mjs.map +1 -1
- package/dist/actions/knip.mjs +2 -2
- package/dist/actions/license.mjs +1 -1
- package/dist/actions/lint.mjs +2 -2
- package/dist/actions/npmignore-gen.mjs +2 -2
- package/dist/actions/package/clean-outputs.mjs +2 -2
- package/dist/actions/package/clean-typescript.mjs +2 -2
- package/dist/actions/package/clean.mjs +3 -3
- package/dist/actions/package/compile/compile.mjs +10 -10
- package/dist/actions/package/compile/compile.mjs.map +1 -1
- package/dist/actions/package/compile/compileTypes.mjs +2 -2
- package/dist/actions/package/compile/copyTypeFiles.mjs +1 -1
- package/dist/actions/package/compile/getCompilerOptions.mjs +1 -1
- package/dist/actions/package/compile/index.mjs +10 -10
- package/dist/actions/package/compile/index.mjs.map +1 -1
- package/dist/actions/package/compile/packageCompileTsc.mjs +2 -2
- package/dist/actions/package/compile/packageCompileTscTypes.mjs +2 -2
- package/dist/actions/package/compile/packageCompileTsup.mjs +9 -9
- package/dist/actions/package/compile/packageCompileTsup.mjs.map +1 -1
- package/dist/actions/package/copy-assets.mjs +1 -1
- package/dist/actions/package/gen-docs.mjs +2 -2
- package/dist/actions/package/index.mjs +20 -20
- package/dist/actions/package/index.mjs.map +1 -1
- package/dist/actions/package/lint.mjs +4 -4
- package/dist/actions/package/publint.mjs +1 -1
- package/dist/actions/package/recompile.mjs +13 -13
- package/dist/actions/package/recompile.mjs.map +1 -1
- package/dist/actions/publint.mjs +4 -4
- package/dist/actions/rebuild.mjs +2 -2
- package/dist/actions/recompile.mjs +2 -2
- package/dist/actions/recompile.mjs.map +1 -1
- package/dist/actions/reinstall.mjs +4 -4
- package/dist/actions/relint.mjs +2 -2
- package/dist/actions/retest.mjs +2 -2
- package/dist/actions/sonar.mjs +2 -2
- package/dist/actions/statics.mjs +3 -3
- package/dist/actions/test.mjs +2 -2
- package/dist/actions/up.mjs +2 -2
- package/dist/actions/updo.mjs +2 -2
- package/dist/actions/upplug.mjs +2 -2
- package/dist/actions/upyarn.mjs +2 -2
- package/dist/actions/yarn3only.mjs +1 -1
- package/dist/bin/package/build-only.mjs +10 -10
- package/dist/bin/package/build-only.mjs.map +1 -1
- package/dist/bin/package/build.mjs +10 -10
- package/dist/bin/package/build.mjs.map +1 -1
- package/dist/bin/package/clean-outputs.mjs +2 -2
- package/dist/bin/package/clean-typescript.mjs +2 -2
- package/dist/bin/package/clean.mjs +3 -3
- package/dist/bin/package/compile-only.mjs +10 -10
- package/dist/bin/package/compile-only.mjs.map +1 -1
- package/dist/bin/package/compile-tsup.mjs +9 -9
- package/dist/bin/package/compile-tsup.mjs.map +1 -1
- package/dist/bin/package/compile-types.mjs +2 -2
- package/dist/bin/package/compile.mjs +10 -10
- package/dist/bin/package/compile.mjs.map +1 -1
- package/dist/bin/package/copy-assets-cjs.mjs +1 -1
- package/dist/bin/package/copy-assets-esm.mjs +1 -1
- package/dist/bin/package/fix.mjs +4 -4
- package/dist/bin/package/gen-docs.mjs +2 -2
- package/dist/bin/package/lint.mjs +4 -4
- package/dist/bin/package/publint.mjs +1 -1
- package/dist/bin/package/recompile.mjs +13 -13
- package/dist/bin/package/recompile.mjs.map +1 -1
- package/dist/bin/package/relint.mjs +4 -4
- package/dist/bin/xy.mjs +104 -122
- package/dist/bin/xy.mjs.map +1 -1
- package/dist/index.mjs +126 -144
- package/dist/index.mjs.map +1 -1
- package/dist/lib/createBuildConfig.mjs +1 -1
- package/dist/lib/deleteGlob.mjs +1 -1
- package/dist/lib/dependencies/DuplicateDetector.mjs +1 -1
- package/dist/lib/dependencies/detectDuplicateDependencies.mjs +2 -2
- package/dist/lib/dependencies/index.mjs +2 -2
- package/dist/lib/file/fileLines.mjs +1 -1
- package/dist/lib/file/index.mjs +2 -2
- package/dist/lib/file/tryReadFileSync.mjs +1 -1
- package/dist/lib/generateIgnoreFiles.mjs +2 -2
- package/dist/lib/index.mjs +13 -13
- package/dist/lib/parsedPackageJSON.mjs +1 -1
- package/dist/lib/runSteps.mjs +2 -2
- package/dist/lib/runStepsAsync.mjs +2 -2
- package/dist/lib/runXy.mjs +2 -2
- package/dist/lib/yarn/index.mjs +2 -2
- package/dist/lib/yarn/isYarnVersionOrGreater.mjs +1 -1
- package/dist/lib/yarn/workspace/index.mjs +1 -1
- package/dist/lib/yarn/workspace/yarnWorkspace.mjs +1 -1
- package/dist/lib/yarn/workspace/yarnWorkspaces.mjs +1 -1
- package/dist/loadPackageConfig.mjs +1 -1
- package/dist/xy/index.mjs +104 -122
- package/dist/xy/index.mjs.map +1 -1
- package/dist/xy/xy.mjs +104 -122
- package/dist/xy/xy.mjs.map +1 -1
- package/dist/xy/xyBuildCommands.mjs +6 -6
- package/dist/xy/xyBuildCommands.mjs.map +1 -1
- package/dist/xy/xyCommonCommands.mjs +8 -8
- package/dist/xy/xyDeployCommands.mjs +7 -7
- package/dist/xy/xyInstallCommands.mjs +9 -9
- package/dist/xy/xyLintCommands.mjs +90 -108
- package/dist/xy/xyLintCommands.mjs.map +1 -1
- package/package.json +10 -9
- package/dist/actions/deplint/checkPackage/getTypesInDependencies.mjs +0 -19
- package/dist/actions/deplint/checkPackage/getTypesInDependencies.mjs.map +0 -1
package/dist/bin/xy.mjs
CHANGED
|
@@ -20,7 +20,7 @@ var checkResult = (name, result, level = "error", exitOnFail = false) => {
|
|
|
20
20
|
};
|
|
21
21
|
|
|
22
22
|
// src/lib/deleteGlob.ts
|
|
23
|
-
import fs from "
|
|
23
|
+
import fs from "fs";
|
|
24
24
|
import { glob } from "glob";
|
|
25
25
|
var deleteGlob = (globPath) => {
|
|
26
26
|
const files = glob.sync(globPath);
|
|
@@ -30,7 +30,7 @@ var deleteGlob = (globPath) => {
|
|
|
30
30
|
};
|
|
31
31
|
|
|
32
32
|
// src/lib/dependencies/detectDuplicateDependencies.ts
|
|
33
|
-
import { execSync } from "
|
|
33
|
+
import { execSync } from "child_process";
|
|
34
34
|
|
|
35
35
|
// src/lib/processEx.ts
|
|
36
36
|
import chalk2 from "chalk";
|
|
@@ -90,7 +90,7 @@ var safeExitAsync = async (func, exitOnFail = true) => {
|
|
|
90
90
|
};
|
|
91
91
|
|
|
92
92
|
// src/lib/dependencies/DuplicateDetector.ts
|
|
93
|
-
import { EOL } from "
|
|
93
|
+
import { EOL } from "os";
|
|
94
94
|
import chalk3 from "chalk";
|
|
95
95
|
|
|
96
96
|
// src/lib/jsonFormatters.ts
|
|
@@ -210,7 +210,7 @@ import {
|
|
|
210
210
|
existsSync,
|
|
211
211
|
readFileSync,
|
|
212
212
|
writeFileSync
|
|
213
|
-
} from "
|
|
213
|
+
} from "fs";
|
|
214
214
|
|
|
215
215
|
// src/lib/string/empty.ts
|
|
216
216
|
var empty = (value) => value?.trim().length === 0;
|
|
@@ -235,7 +235,7 @@ var writeLines = (uri, lines, options = defaultReadFileSyncOptions) => {
|
|
|
235
235
|
import chalk4 from "chalk";
|
|
236
236
|
|
|
237
237
|
// src/lib/yarn/isYarnVersionOrGreater.ts
|
|
238
|
-
import { spawnSync } from "
|
|
238
|
+
import { spawnSync } from "child_process";
|
|
239
239
|
var isYarnVersionOrGreater = (major, minor, patch) => {
|
|
240
240
|
const result = spawnSync("yarn", ["-v"], { encoding: "utf8", shell: true });
|
|
241
241
|
const version = result.stdout.toString().replaceAll("\n", "");
|
|
@@ -250,7 +250,7 @@ var isYarnVersionOrGreater = (major, minor, patch) => {
|
|
|
250
250
|
};
|
|
251
251
|
|
|
252
252
|
// src/lib/yarn/workspace/yarnWorkspaces.ts
|
|
253
|
-
import { spawnSync as spawnSync2 } from "
|
|
253
|
+
import { spawnSync as spawnSync2 } from "child_process";
|
|
254
254
|
var yarnWorkspaces = () => {
|
|
255
255
|
const result = spawnSync2("yarn", ["workspaces", "list", "--json", "--recursive"], { encoding: "utf8", shell: true });
|
|
256
256
|
if (result.error) {
|
|
@@ -298,7 +298,7 @@ var generateIgnoreFiles = (filename3, pkg) => {
|
|
|
298
298
|
};
|
|
299
299
|
|
|
300
300
|
// src/lib/parsedPackageJSON.ts
|
|
301
|
-
import { readFileSync as readFileSync2 } from "
|
|
301
|
+
import { readFileSync as readFileSync2 } from "fs";
|
|
302
302
|
var parsedPackageJSON = (path5) => {
|
|
303
303
|
const pathToPackageJSON = path5 ?? process.env.npm_package_json ?? "";
|
|
304
304
|
const packageJSON = readFileSync2(pathToPackageJSON).toString();
|
|
@@ -306,8 +306,8 @@ var parsedPackageJSON = (path5) => {
|
|
|
306
306
|
};
|
|
307
307
|
|
|
308
308
|
// src/lib/runSteps.ts
|
|
309
|
-
import { spawnSync as spawnSync3 } from "
|
|
310
|
-
import { existsSync as existsSync2 } from "
|
|
309
|
+
import { spawnSync as spawnSync3 } from "child_process";
|
|
310
|
+
import { existsSync as existsSync2 } from "fs";
|
|
311
311
|
import chalk5 from "chalk";
|
|
312
312
|
var runSteps = (name, steps, exitOnFail = true, messages) => {
|
|
313
313
|
return safeExit(() => {
|
|
@@ -337,8 +337,8 @@ var runSteps = (name, steps, exitOnFail = true, messages) => {
|
|
|
337
337
|
};
|
|
338
338
|
|
|
339
339
|
// src/lib/runStepsAsync.ts
|
|
340
|
-
import { spawn } from "
|
|
341
|
-
import { existsSync as existsSync3 } from "
|
|
340
|
+
import { spawn } from "child_process";
|
|
341
|
+
import { existsSync as existsSync3 } from "fs";
|
|
342
342
|
import chalk6 from "chalk";
|
|
343
343
|
var runStepAsync = (name, step, exitOnFail = true, message) => {
|
|
344
344
|
return new Promise((resolve) => {
|
|
@@ -424,7 +424,7 @@ var cleanAll = ({ verbose }) => {
|
|
|
424
424
|
};
|
|
425
425
|
|
|
426
426
|
// src/actions/clean-docs.ts
|
|
427
|
-
import path from "
|
|
427
|
+
import path from "path";
|
|
428
428
|
import chalk8 from "chalk";
|
|
429
429
|
var cleanDocs = () => {
|
|
430
430
|
const pkgName = process.env.npm_package_name;
|
|
@@ -550,7 +550,7 @@ var compileTypesAll = ({
|
|
|
550
550
|
};
|
|
551
551
|
|
|
552
552
|
// src/actions/copy-assets.ts
|
|
553
|
-
import path2 from "
|
|
553
|
+
import path2 from "path/posix";
|
|
554
554
|
import chalk11 from "chalk";
|
|
555
555
|
import cpy from "cpy";
|
|
556
556
|
var copyPackageTargetAssets = async (target, name, location) => {
|
|
@@ -669,25 +669,15 @@ function findFilesByGlob(cwd, pattern) {
|
|
|
669
669
|
// src/actions/deplint/findFiles.ts
|
|
670
670
|
function findFiles(path5) {
|
|
671
671
|
const allSourceInclude = ["./src/**/*.{ts,tsx}"];
|
|
672
|
-
const allDistInclude = ["./dist/**/*.d.ts"];
|
|
673
|
-
const
|
|
674
|
-
const
|
|
675
|
-
|
|
676
|
-
const allDistFiles = allDistInclude.flatMap((pattern) => findFilesByGlob(path5, pattern));
|
|
677
|
-
const prodSourceFiles = allSourceFiles.filter((file) => !prodExcludeEndswith.some((ext) => file.endsWith(ext)) && !prodExcludeIncludes.some((excl) => file.includes(excl)));
|
|
678
|
-
const prodDistFiles = allDistFiles.filter((file) => !prodExcludeEndswith.some((ext) => file.endsWith(ext)) && !prodExcludeIncludes.some((excl) => file.includes(excl)));
|
|
679
|
-
const devSourceFiles = allSourceFiles.filter((file) => !prodSourceFiles.includes(file));
|
|
680
|
-
return {
|
|
681
|
-
allSourceFiles,
|
|
682
|
-
prodSourceFiles,
|
|
683
|
-
devSourceFiles,
|
|
684
|
-
prodDistFiles
|
|
685
|
-
};
|
|
672
|
+
const allDistInclude = ["./dist/**/*.d.ts", "./dist/**/*.{mjs,js,cjs}"];
|
|
673
|
+
const srcFiles = allSourceInclude.flatMap((pattern) => findFilesByGlob(path5, pattern));
|
|
674
|
+
const distFiles = allDistInclude.flatMap((pattern) => findFilesByGlob(path5, pattern));
|
|
675
|
+
return { srcFiles, distFiles };
|
|
686
676
|
}
|
|
687
677
|
|
|
688
678
|
// src/actions/deplint/getDependenciesFromPackageJson.ts
|
|
689
|
-
import fs2 from "
|
|
690
|
-
import path3 from "
|
|
679
|
+
import fs2 from "fs";
|
|
680
|
+
import path3 from "path";
|
|
691
681
|
function getDependenciesFromPackageJson(packageJsonPath) {
|
|
692
682
|
const packageJsonFullPath = path3.resolve(packageJsonPath);
|
|
693
683
|
const rawContent = fs2.readFileSync(packageJsonFullPath, "utf8");
|
|
@@ -703,27 +693,30 @@ function getDependenciesFromPackageJson(packageJsonPath) {
|
|
|
703
693
|
}
|
|
704
694
|
|
|
705
695
|
// src/actions/deplint/getImportsFromFile.ts
|
|
706
|
-
import fs3 from "
|
|
707
|
-
import path4 from "
|
|
696
|
+
import fs3 from "fs";
|
|
697
|
+
import path4 from "path";
|
|
708
698
|
import ts from "typescript";
|
|
709
699
|
|
|
710
700
|
// src/actions/deplint/getBasePackageName.ts
|
|
711
701
|
function getBasePackageName(importName) {
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
702
|
+
const importNameScrubbed = importName.replaceAll('"', "").trim();
|
|
703
|
+
if (importNameScrubbed.startsWith("@")) {
|
|
704
|
+
const parts = importNameScrubbed.split("/");
|
|
705
|
+
return parts.length >= 2 ? `${parts[0]}/${parts[1]}` : importNameScrubbed;
|
|
715
706
|
}
|
|
716
|
-
return
|
|
707
|
+
return importNameScrubbed.split("/")[0];
|
|
717
708
|
}
|
|
718
709
|
|
|
719
710
|
// src/actions/deplint/getImportsFromFile.ts
|
|
720
711
|
function getImportsFromFile(filePath, importPaths, typeImportPaths) {
|
|
721
712
|
const sourceCode = fs3.readFileSync(filePath, "utf8");
|
|
713
|
+
const isMjsFile = filePath.endsWith(".mjs");
|
|
722
714
|
const sourceFile = ts.createSourceFile(
|
|
723
715
|
path4.basename(filePath),
|
|
724
716
|
sourceCode,
|
|
725
717
|
ts.ScriptTarget.Latest,
|
|
726
|
-
true
|
|
718
|
+
true,
|
|
719
|
+
isMjsFile ? ts.ScriptKind.JS : void 0
|
|
727
720
|
);
|
|
728
721
|
const imports = [];
|
|
729
722
|
const typeImports = [];
|
|
@@ -732,8 +725,8 @@ function getImportsFromFile(filePath, importPaths, typeImportPaths) {
|
|
|
732
725
|
if (ts.isImportDeclaration(node) || ts.isExportDeclaration(node)) {
|
|
733
726
|
const moduleSpecifier = node.moduleSpecifier?.getFullText();
|
|
734
727
|
const isTypeImport = ts.isImportDeclaration(node) ? node.importClause?.isTypeOnly ?? false : false;
|
|
735
|
-
if (moduleSpecifier) {
|
|
736
|
-
const trimmed = moduleSpecifier.
|
|
728
|
+
if (typeof moduleSpecifier === "string") {
|
|
729
|
+
const trimmed = moduleSpecifier.replaceAll("'", "").replaceAll('"', "").trim();
|
|
737
730
|
if (isTypeImport || isDeclarationFile) {
|
|
738
731
|
typeImports.push(trimmed);
|
|
739
732
|
} else {
|
|
@@ -754,11 +747,11 @@ function getImportsFromFile(filePath, importPaths, typeImportPaths) {
|
|
|
754
747
|
const cleanedImports = imports.filter((imp) => !importsStartsWithExcludes.some((exc) => imp.startsWith(exc))).map(getBasePackageName);
|
|
755
748
|
const cleanedTypeImports = typeImports.filter((imp) => !importsStartsWithExcludes.some((exc) => imp.startsWith(exc))).map(getBasePackageName);
|
|
756
749
|
for (const imp of cleanedImports) {
|
|
757
|
-
importPaths[imp] = importPaths[imp]
|
|
750
|
+
importPaths[imp] = importPaths[imp] ?? [];
|
|
758
751
|
importPaths[imp].push(filePath);
|
|
759
752
|
}
|
|
760
753
|
for (const imp of cleanedTypeImports) {
|
|
761
|
-
typeImportPaths[imp] = typeImportPaths[imp]
|
|
754
|
+
typeImportPaths[imp] = typeImportPaths[imp] ?? [];
|
|
762
755
|
typeImportPaths[imp].push(filePath);
|
|
763
756
|
}
|
|
764
757
|
return [cleanedImports, cleanedTypeImports];
|
|
@@ -769,117 +762,115 @@ var internalImportPrefixes = [".", "#", "node:"];
|
|
|
769
762
|
var removeInternalImports = (imports) => {
|
|
770
763
|
return imports.filter((imp) => !internalImportPrefixes.some((prefix) => imp.startsWith(prefix)));
|
|
771
764
|
};
|
|
772
|
-
function getExternalImportsFromFiles({
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
const
|
|
778
|
-
const
|
|
779
|
-
const
|
|
780
|
-
const
|
|
781
|
-
const prodImports = prodImportPairs.flatMap((pair) => pair[0]);
|
|
782
|
-
const prodDistImports = prodDistImportPairs.flatMap((pair) => pair[1]);
|
|
783
|
-
const devImportPaths = {};
|
|
784
|
-
const devTypeImportPaths = {};
|
|
785
|
-
const devImportPairs = devSourceFiles.map((path5) => getImportsFromFile(path5, devImportPaths, devTypeImportPaths));
|
|
786
|
-
const devImports = devImportPairs.flatMap((pair) => pair[0]);
|
|
787
|
-
const devTypeImports = devImportPairs.flatMap((pair) => pair[1]);
|
|
788
|
-
const externalProdImports = removeInternalImports(prodImports);
|
|
789
|
-
const externalProdTypeImports = removeInternalImports(prodDistImports);
|
|
790
|
-
const externalDevImports = removeInternalImports(devImports);
|
|
765
|
+
function getExternalImportsFromFiles({ srcFiles, distFiles }) {
|
|
766
|
+
const srcImportPaths = {};
|
|
767
|
+
const distImportPaths = {};
|
|
768
|
+
for (const path5 of srcFiles) getImportsFromFile(path5, srcImportPaths, srcImportPaths).flat();
|
|
769
|
+
for (const path5 of distFiles) getImportsFromFile(path5, distImportPaths, distImportPaths).flat();
|
|
770
|
+
const srcImports = Object.keys(srcImportPaths);
|
|
771
|
+
const distImports = Object.keys(distImportPaths);
|
|
772
|
+
const externalSrcImports = removeInternalImports(srcImports);
|
|
773
|
+
const externalDistImports = removeInternalImports(distImports);
|
|
791
774
|
return {
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
externalDevImports,
|
|
799
|
-
prodDistImports,
|
|
800
|
-
devTypeImports,
|
|
801
|
-
externalProdTypeImports
|
|
775
|
+
srcImports,
|
|
776
|
+
srcImportPaths,
|
|
777
|
+
externalSrcImports,
|
|
778
|
+
distImports,
|
|
779
|
+
distImportPaths,
|
|
780
|
+
externalDistImports
|
|
802
781
|
};
|
|
803
782
|
}
|
|
804
783
|
|
|
805
784
|
// src/actions/deplint/checkPackage/getUnlistedDependencies.ts
|
|
806
785
|
import chalk12 from "chalk";
|
|
807
|
-
function getUnlistedDependencies({ name }, { dependencies, peerDependencies }, {
|
|
808
|
-
externalProdTypeImports,
|
|
809
|
-
prodTypeImportPaths,
|
|
810
|
-
externalProdImports,
|
|
811
|
-
prodImportPaths
|
|
812
|
-
}) {
|
|
786
|
+
function getUnlistedDependencies({ name, location }, { dependencies, peerDependencies }, { externalDistImports, distImportPaths }) {
|
|
813
787
|
let unlistedDependencies = 0;
|
|
814
|
-
for (const imp of
|
|
815
|
-
if (!dependencies.includes(imp) && !peerDependencies.includes(imp) && !dependencies.includes(`@types/${imp}`) && !peerDependencies.includes(`@types/${imp}`)) {
|
|
816
|
-
unlistedDependencies++;
|
|
817
|
-
console.log(`[${chalk12.blue(name)}] Missing dependency in package.json: ${chalk12.red(imp)}`);
|
|
818
|
-
console.log(` ${prodTypeImportPaths[imp].join("\n")}`);
|
|
819
|
-
console.log("");
|
|
820
|
-
}
|
|
821
|
-
}
|
|
822
|
-
for (const imp of externalProdImports) {
|
|
788
|
+
for (const imp of externalDistImports) {
|
|
823
789
|
if (!dependencies.includes(imp) && !peerDependencies.includes(imp)) {
|
|
824
790
|
unlistedDependencies++;
|
|
825
791
|
console.log(`[${chalk12.blue(name)}] Missing dependency in package.json: ${chalk12.red(imp)}`);
|
|
826
|
-
console.log(` ${
|
|
827
|
-
console.log("");
|
|
792
|
+
console.log(` ${distImportPaths[imp].join("\n ")}`);
|
|
828
793
|
}
|
|
829
794
|
}
|
|
795
|
+
if (unlistedDependencies > 0) {
|
|
796
|
+
const packageLocation = `${location}/package.json`;
|
|
797
|
+
console.log(` ${chalk12.yellow(packageLocation)}
|
|
798
|
+
`);
|
|
799
|
+
}
|
|
830
800
|
return unlistedDependencies;
|
|
831
801
|
}
|
|
832
802
|
|
|
833
803
|
// src/actions/deplint/checkPackage/getUnlistedDevDependencies.ts
|
|
834
804
|
import chalk13 from "chalk";
|
|
835
|
-
function getUnlistedDevDependencies({ name }, {
|
|
805
|
+
function getUnlistedDevDependencies({ name, location }, {
|
|
836
806
|
devDependencies,
|
|
837
807
|
dependencies,
|
|
838
808
|
peerDependencies
|
|
839
|
-
}, {
|
|
809
|
+
}, {
|
|
810
|
+
srcImportPaths,
|
|
811
|
+
externalSrcImports,
|
|
812
|
+
distImports
|
|
813
|
+
}) {
|
|
840
814
|
let unlistedDevDependencies = 0;
|
|
841
|
-
for (const imp of
|
|
842
|
-
if (!
|
|
815
|
+
for (const imp of externalSrcImports) {
|
|
816
|
+
if (!distImports.includes(imp) && !dependencies.includes(imp) && !peerDependencies.includes(imp) && !devDependencies.includes(imp)) {
|
|
843
817
|
unlistedDevDependencies++;
|
|
844
818
|
console.log(`[${chalk13.blue(name)}] Missing devDependency in package.json: ${chalk13.red(imp)}`);
|
|
845
|
-
console.log(`
|
|
819
|
+
console.log(` ${srcImportPaths[imp].join("\n ")}`);
|
|
846
820
|
}
|
|
847
821
|
}
|
|
822
|
+
if (unlistedDevDependencies > 0) {
|
|
823
|
+
const packageLocation = `${location}/package.json`;
|
|
824
|
+
console.log(` ${chalk13.yellow(packageLocation)}
|
|
825
|
+
`);
|
|
826
|
+
}
|
|
848
827
|
return unlistedDevDependencies;
|
|
849
828
|
}
|
|
850
829
|
|
|
851
830
|
// src/actions/deplint/checkPackage/getUnusedDependencies.ts
|
|
852
831
|
import chalk14 from "chalk";
|
|
853
832
|
function getUnusedDependencies({ name, location }, { dependencies }, {
|
|
854
|
-
|
|
855
|
-
|
|
833
|
+
externalDistImports,
|
|
834
|
+
externalSrcImports
|
|
856
835
|
}) {
|
|
857
836
|
let unusedDependencies = 0;
|
|
858
837
|
for (const dep of dependencies) {
|
|
859
|
-
if (!
|
|
838
|
+
if (!externalDistImports.includes(dep)) {
|
|
860
839
|
unusedDependencies++;
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
840
|
+
if (externalSrcImports.includes(dep)) {
|
|
841
|
+
console.log(`[${chalk14.blue(name)}] dependency should be devDependency in package.json: ${chalk14.red(dep)}`);
|
|
842
|
+
} else {
|
|
843
|
+
console.log(`[${chalk14.blue(name)}] Unused dependency in package.json: ${chalk14.red(dep)}`);
|
|
844
|
+
}
|
|
865
845
|
}
|
|
866
846
|
}
|
|
847
|
+
if (unusedDependencies > 0) {
|
|
848
|
+
const packageLocation = `${location}/package.json`;
|
|
849
|
+
console.log(` ${chalk14.yellow(packageLocation)}
|
|
850
|
+
`);
|
|
851
|
+
}
|
|
867
852
|
return unusedDependencies;
|
|
868
853
|
}
|
|
869
854
|
|
|
870
855
|
// src/actions/deplint/checkPackage/getUnusedPeerDependencies.ts
|
|
871
856
|
import chalk15 from "chalk";
|
|
872
|
-
function getUnusedPeerDependencies({ name, location }, { peerDependencies }, {
|
|
857
|
+
function getUnusedPeerDependencies({ name, location }, { peerDependencies, dependencies }, { externalDistImports }) {
|
|
873
858
|
let unusedDependencies = 0;
|
|
874
859
|
for (const dep of peerDependencies) {
|
|
875
|
-
if (!
|
|
860
|
+
if (!externalDistImports.includes(dep)) {
|
|
876
861
|
unusedDependencies++;
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
862
|
+
if (dependencies.includes(dep)) {
|
|
863
|
+
console.log(`[${chalk15.blue(name)}] Unused peerDependency [already a dependency] in package.json: ${chalk15.red(dep)}`);
|
|
864
|
+
} else {
|
|
865
|
+
console.log(`[${chalk15.blue(name)}] Unused peerDependency in package.json: ${chalk15.red(dep)}`);
|
|
866
|
+
}
|
|
881
867
|
}
|
|
882
868
|
}
|
|
869
|
+
if (unusedDependencies > 0) {
|
|
870
|
+
const packageLocation = `${location}/package.json`;
|
|
871
|
+
console.log(` ${chalk15.yellow(packageLocation)}
|
|
872
|
+
`);
|
|
873
|
+
}
|
|
883
874
|
return unusedDependencies;
|
|
884
875
|
}
|
|
885
876
|
|
|
@@ -891,26 +882,17 @@ function checkPackage({
|
|
|
891
882
|
devDeps = false,
|
|
892
883
|
peerDeps = false
|
|
893
884
|
}) {
|
|
894
|
-
const {
|
|
895
|
-
prodSourceFiles,
|
|
896
|
-
devSourceFiles,
|
|
897
|
-
prodDistFiles
|
|
898
|
-
} = findFiles(location);
|
|
885
|
+
const { srcFiles, distFiles } = findFiles(location);
|
|
899
886
|
const checkDeps = deps || !(deps || devDeps || peerDeps);
|
|
900
887
|
const checkDevDeps = devDeps || !(deps || devDeps || peerDeps);
|
|
901
888
|
const checkPeerDeps = peerDeps;
|
|
902
|
-
const sourceParams = getExternalImportsFromFiles({
|
|
903
|
-
prodSourceFiles,
|
|
904
|
-
devSourceFiles,
|
|
905
|
-
prodDistFiles
|
|
906
|
-
});
|
|
889
|
+
const sourceParams = getExternalImportsFromFiles({ srcFiles, distFiles });
|
|
907
890
|
const packageParams = getDependenciesFromPackageJson(`${location}/package.json`);
|
|
908
891
|
const unlistedDependencies = checkDeps ? getUnlistedDependencies({ name, location }, packageParams, sourceParams) : 0;
|
|
909
892
|
const unusedDependencies = checkDeps ? getUnusedDependencies({ name, location }, packageParams, sourceParams) : 0;
|
|
910
|
-
const typesInDependencies = 0;
|
|
911
893
|
const unlistedDevDependencies = checkDevDeps ? getUnlistedDevDependencies({ name, location }, packageParams, sourceParams) : 0;
|
|
912
894
|
const unusedPeerDependencies = checkPeerDeps ? getUnusedPeerDependencies({ name, location }, packageParams, sourceParams) : 0;
|
|
913
|
-
const totalErrors = unlistedDependencies + unlistedDevDependencies + unusedDependencies +
|
|
895
|
+
const totalErrors = unlistedDependencies + unlistedDevDependencies + unusedDependencies + unusedPeerDependencies;
|
|
914
896
|
return totalErrors;
|
|
915
897
|
}
|
|
916
898
|
|
|
@@ -953,7 +935,7 @@ var deplint = ({
|
|
|
953
935
|
};
|
|
954
936
|
|
|
955
937
|
// src/actions/deploy.ts
|
|
956
|
-
import { readFileSync as readFileSync3 } from "
|
|
938
|
+
import { readFileSync as readFileSync3 } from "fs";
|
|
957
939
|
var privatePackageExcludeList = () => {
|
|
958
940
|
const possibleDeployablePackages = yarnWorkspaces().map((workspace) => [
|
|
959
941
|
workspace,
|
|
@@ -978,7 +960,7 @@ var deploy = () => {
|
|
|
978
960
|
};
|
|
979
961
|
|
|
980
962
|
// src/actions/deploy-major.ts
|
|
981
|
-
import { readFileSync as readFileSync4 } from "
|
|
963
|
+
import { readFileSync as readFileSync4 } from "fs";
|
|
982
964
|
var privatePackageExcludeList2 = () => {
|
|
983
965
|
const possibleDeployablePackages = yarnWorkspaces().map((workspace) => [
|
|
984
966
|
workspace,
|
|
@@ -1003,7 +985,7 @@ var deployMajor = () => {
|
|
|
1003
985
|
};
|
|
1004
986
|
|
|
1005
987
|
// src/actions/deploy-minor.ts
|
|
1006
|
-
import { readFileSync as readFileSync5 } from "
|
|
988
|
+
import { readFileSync as readFileSync5 } from "fs";
|
|
1007
989
|
var privatePackageExcludeList3 = () => {
|
|
1008
990
|
const possibleDeployablePackages = yarnWorkspaces().map((workspace) => [
|
|
1009
991
|
workspace,
|
|
@@ -1028,7 +1010,7 @@ var deployMinor = () => {
|
|
|
1028
1010
|
};
|
|
1029
1011
|
|
|
1030
1012
|
// src/actions/deploy-next.ts
|
|
1031
|
-
import { readFileSync as readFileSync6 } from "
|
|
1013
|
+
import { readFileSync as readFileSync6 } from "fs";
|
|
1032
1014
|
var privatePackageExcludeList4 = () => {
|
|
1033
1015
|
const possibleDeployablePackages = yarnWorkspaces().map((workspace) => [
|
|
1034
1016
|
workspace,
|
|
@@ -1169,7 +1151,7 @@ Gitlint Start [${process.cwd()}]
|
|
|
1169
1151
|
};
|
|
1170
1152
|
|
|
1171
1153
|
// src/actions/gitlint-fix.ts
|
|
1172
|
-
import { execSync as execSync2 } from "
|
|
1154
|
+
import { execSync as execSync2 } from "child_process";
|
|
1173
1155
|
import chalk20 from "chalk";
|
|
1174
1156
|
import ParseGitConfig2 from "parse-git-config";
|
|
1175
1157
|
var gitlintFix = () => {
|
|
@@ -1366,7 +1348,7 @@ import {
|
|
|
1366
1348
|
closeSync,
|
|
1367
1349
|
openSync,
|
|
1368
1350
|
rmSync
|
|
1369
|
-
} from "
|
|
1351
|
+
} from "fs";
|
|
1370
1352
|
var reinstall = () => {
|
|
1371
1353
|
console.log("Reinstall [Clear Lock File]");
|
|
1372
1354
|
closeSync(openSync("./yarn.lock", "w"));
|