@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/actions/index.mjs
CHANGED
|
@@ -15,7 +15,7 @@ var checkResult = (name, result, level = "error", exitOnFail = false) => {
|
|
|
15
15
|
};
|
|
16
16
|
|
|
17
17
|
// src/lib/deleteGlob.ts
|
|
18
|
-
import fs from "
|
|
18
|
+
import fs from "fs";
|
|
19
19
|
import { glob } from "glob";
|
|
20
20
|
var deleteGlob = (globPath) => {
|
|
21
21
|
const files = glob.sync(globPath);
|
|
@@ -25,7 +25,7 @@ var deleteGlob = (globPath) => {
|
|
|
25
25
|
};
|
|
26
26
|
|
|
27
27
|
// src/lib/dependencies/detectDuplicateDependencies.ts
|
|
28
|
-
import { execSync } from "
|
|
28
|
+
import { execSync } from "child_process";
|
|
29
29
|
|
|
30
30
|
// src/lib/processEx.ts
|
|
31
31
|
import chalk2 from "chalk";
|
|
@@ -85,7 +85,7 @@ var safeExitAsync = async (func, exitOnFail = true) => {
|
|
|
85
85
|
};
|
|
86
86
|
|
|
87
87
|
// src/lib/dependencies/DuplicateDetector.ts
|
|
88
|
-
import { EOL } from "
|
|
88
|
+
import { EOL } from "os";
|
|
89
89
|
import chalk3 from "chalk";
|
|
90
90
|
|
|
91
91
|
// src/lib/jsonFormatters.ts
|
|
@@ -205,7 +205,7 @@ import {
|
|
|
205
205
|
existsSync,
|
|
206
206
|
readFileSync,
|
|
207
207
|
writeFileSync
|
|
208
|
-
} from "
|
|
208
|
+
} from "fs";
|
|
209
209
|
|
|
210
210
|
// src/lib/string/empty.ts
|
|
211
211
|
var empty = (value) => value?.trim().length === 0;
|
|
@@ -230,7 +230,7 @@ var writeLines = (uri, lines, options = defaultReadFileSyncOptions) => {
|
|
|
230
230
|
import chalk4 from "chalk";
|
|
231
231
|
|
|
232
232
|
// src/lib/yarn/isYarnVersionOrGreater.ts
|
|
233
|
-
import { spawnSync } from "
|
|
233
|
+
import { spawnSync } from "child_process";
|
|
234
234
|
var isYarnVersionOrGreater = (major, minor, patch) => {
|
|
235
235
|
const result = spawnSync("yarn", ["-v"], { encoding: "utf8", shell: true });
|
|
236
236
|
const version = result.stdout.toString().replaceAll("\n", "");
|
|
@@ -245,7 +245,7 @@ var isYarnVersionOrGreater = (major, minor, patch) => {
|
|
|
245
245
|
};
|
|
246
246
|
|
|
247
247
|
// src/lib/yarn/workspace/yarnWorkspaces.ts
|
|
248
|
-
import { spawnSync as spawnSync2 } from "
|
|
248
|
+
import { spawnSync as spawnSync2 } from "child_process";
|
|
249
249
|
var yarnWorkspaces = () => {
|
|
250
250
|
const result = spawnSync2("yarn", ["workspaces", "list", "--json", "--recursive"], { encoding: "utf8", shell: true });
|
|
251
251
|
if (result.error) {
|
|
@@ -312,7 +312,7 @@ var loadConfig = async (params) => {
|
|
|
312
312
|
};
|
|
313
313
|
|
|
314
314
|
// src/lib/parsedPackageJSON.ts
|
|
315
|
-
import { readFileSync as readFileSync2 } from "
|
|
315
|
+
import { readFileSync as readFileSync2 } from "fs";
|
|
316
316
|
var parsedPackageJSON = (path10) => {
|
|
317
317
|
const pathToPackageJSON = path10 ?? process.env.npm_package_json ?? "";
|
|
318
318
|
const packageJSON = readFileSync2(pathToPackageJSON).toString();
|
|
@@ -320,8 +320,8 @@ var parsedPackageJSON = (path10) => {
|
|
|
320
320
|
};
|
|
321
321
|
|
|
322
322
|
// src/lib/runSteps.ts
|
|
323
|
-
import { spawnSync as spawnSync3 } from "
|
|
324
|
-
import { existsSync as existsSync2 } from "
|
|
323
|
+
import { spawnSync as spawnSync3 } from "child_process";
|
|
324
|
+
import { existsSync as existsSync2 } from "fs";
|
|
325
325
|
import chalk6 from "chalk";
|
|
326
326
|
var runSteps = (name, steps, exitOnFail = true, messages) => {
|
|
327
327
|
return safeExit(() => {
|
|
@@ -351,8 +351,8 @@ var runSteps = (name, steps, exitOnFail = true, messages) => {
|
|
|
351
351
|
};
|
|
352
352
|
|
|
353
353
|
// src/lib/runStepsAsync.ts
|
|
354
|
-
import { spawn } from "
|
|
355
|
-
import { existsSync as existsSync3 } from "
|
|
354
|
+
import { spawn } from "child_process";
|
|
355
|
+
import { existsSync as existsSync3 } from "fs";
|
|
356
356
|
import chalk7 from "chalk";
|
|
357
357
|
var runStepAsync = (name, step, exitOnFail = true, message) => {
|
|
358
358
|
return new Promise((resolve) => {
|
|
@@ -438,7 +438,7 @@ var cleanAll = ({ verbose }) => {
|
|
|
438
438
|
};
|
|
439
439
|
|
|
440
440
|
// src/actions/clean-docs.ts
|
|
441
|
-
import path from "
|
|
441
|
+
import path from "path";
|
|
442
442
|
import chalk9 from "chalk";
|
|
443
443
|
var cleanDocs = () => {
|
|
444
444
|
const pkgName = process.env.npm_package_name;
|
|
@@ -564,7 +564,7 @@ var compileTypesAll = ({
|
|
|
564
564
|
};
|
|
565
565
|
|
|
566
566
|
// src/actions/copy-assets.ts
|
|
567
|
-
import path2 from "
|
|
567
|
+
import path2 from "path/posix";
|
|
568
568
|
import chalk12 from "chalk";
|
|
569
569
|
import cpy from "cpy";
|
|
570
570
|
var copyPackageTargetAssets = async (target, name, location) => {
|
|
@@ -683,25 +683,15 @@ function findFilesByGlob(cwd4, pattern) {
|
|
|
683
683
|
// src/actions/deplint/findFiles.ts
|
|
684
684
|
function findFiles(path10) {
|
|
685
685
|
const allSourceInclude = ["./src/**/*.{ts,tsx}"];
|
|
686
|
-
const allDistInclude = ["./dist/**/*.d.ts"];
|
|
687
|
-
const
|
|
688
|
-
const
|
|
689
|
-
|
|
690
|
-
const allDistFiles = allDistInclude.flatMap((pattern) => findFilesByGlob(path10, pattern));
|
|
691
|
-
const prodSourceFiles = allSourceFiles.filter((file) => !prodExcludeEndswith.some((ext) => file.endsWith(ext)) && !prodExcludeIncludes.some((excl) => file.includes(excl)));
|
|
692
|
-
const prodDistFiles = allDistFiles.filter((file) => !prodExcludeEndswith.some((ext) => file.endsWith(ext)) && !prodExcludeIncludes.some((excl) => file.includes(excl)));
|
|
693
|
-
const devSourceFiles = allSourceFiles.filter((file) => !prodSourceFiles.includes(file));
|
|
694
|
-
return {
|
|
695
|
-
allSourceFiles,
|
|
696
|
-
prodSourceFiles,
|
|
697
|
-
devSourceFiles,
|
|
698
|
-
prodDistFiles
|
|
699
|
-
};
|
|
686
|
+
const allDistInclude = ["./dist/**/*.d.ts", "./dist/**/*.{mjs,js,cjs}"];
|
|
687
|
+
const srcFiles = allSourceInclude.flatMap((pattern) => findFilesByGlob(path10, pattern));
|
|
688
|
+
const distFiles = allDistInclude.flatMap((pattern) => findFilesByGlob(path10, pattern));
|
|
689
|
+
return { srcFiles, distFiles };
|
|
700
690
|
}
|
|
701
691
|
|
|
702
692
|
// src/actions/deplint/getDependenciesFromPackageJson.ts
|
|
703
|
-
import fs2 from "
|
|
704
|
-
import path3 from "
|
|
693
|
+
import fs2 from "fs";
|
|
694
|
+
import path3 from "path";
|
|
705
695
|
function getDependenciesFromPackageJson(packageJsonPath) {
|
|
706
696
|
const packageJsonFullPath = path3.resolve(packageJsonPath);
|
|
707
697
|
const rawContent = fs2.readFileSync(packageJsonFullPath, "utf8");
|
|
@@ -717,27 +707,30 @@ function getDependenciesFromPackageJson(packageJsonPath) {
|
|
|
717
707
|
}
|
|
718
708
|
|
|
719
709
|
// src/actions/deplint/getImportsFromFile.ts
|
|
720
|
-
import fs3 from "
|
|
721
|
-
import path4 from "
|
|
710
|
+
import fs3 from "fs";
|
|
711
|
+
import path4 from "path";
|
|
722
712
|
import ts from "typescript";
|
|
723
713
|
|
|
724
714
|
// src/actions/deplint/getBasePackageName.ts
|
|
725
715
|
function getBasePackageName(importName) {
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
716
|
+
const importNameScrubbed = importName.replaceAll('"', "").trim();
|
|
717
|
+
if (importNameScrubbed.startsWith("@")) {
|
|
718
|
+
const parts = importNameScrubbed.split("/");
|
|
719
|
+
return parts.length >= 2 ? `${parts[0]}/${parts[1]}` : importNameScrubbed;
|
|
729
720
|
}
|
|
730
|
-
return
|
|
721
|
+
return importNameScrubbed.split("/")[0];
|
|
731
722
|
}
|
|
732
723
|
|
|
733
724
|
// src/actions/deplint/getImportsFromFile.ts
|
|
734
725
|
function getImportsFromFile(filePath, importPaths, typeImportPaths) {
|
|
735
726
|
const sourceCode = fs3.readFileSync(filePath, "utf8");
|
|
727
|
+
const isMjsFile = filePath.endsWith(".mjs");
|
|
736
728
|
const sourceFile = ts.createSourceFile(
|
|
737
729
|
path4.basename(filePath),
|
|
738
730
|
sourceCode,
|
|
739
731
|
ts.ScriptTarget.Latest,
|
|
740
|
-
true
|
|
732
|
+
true,
|
|
733
|
+
isMjsFile ? ts.ScriptKind.JS : void 0
|
|
741
734
|
);
|
|
742
735
|
const imports = [];
|
|
743
736
|
const typeImports = [];
|
|
@@ -746,8 +739,8 @@ function getImportsFromFile(filePath, importPaths, typeImportPaths) {
|
|
|
746
739
|
if (ts.isImportDeclaration(node) || ts.isExportDeclaration(node)) {
|
|
747
740
|
const moduleSpecifier = node.moduleSpecifier?.getFullText();
|
|
748
741
|
const isTypeImport = ts.isImportDeclaration(node) ? node.importClause?.isTypeOnly ?? false : false;
|
|
749
|
-
if (moduleSpecifier) {
|
|
750
|
-
const trimmed = moduleSpecifier.
|
|
742
|
+
if (typeof moduleSpecifier === "string") {
|
|
743
|
+
const trimmed = moduleSpecifier.replaceAll("'", "").replaceAll('"', "").trim();
|
|
751
744
|
if (isTypeImport || isDeclarationFile) {
|
|
752
745
|
typeImports.push(trimmed);
|
|
753
746
|
} else {
|
|
@@ -768,11 +761,11 @@ function getImportsFromFile(filePath, importPaths, typeImportPaths) {
|
|
|
768
761
|
const cleanedImports = imports.filter((imp) => !importsStartsWithExcludes.some((exc) => imp.startsWith(exc))).map(getBasePackageName);
|
|
769
762
|
const cleanedTypeImports = typeImports.filter((imp) => !importsStartsWithExcludes.some((exc) => imp.startsWith(exc))).map(getBasePackageName);
|
|
770
763
|
for (const imp of cleanedImports) {
|
|
771
|
-
importPaths[imp] = importPaths[imp]
|
|
764
|
+
importPaths[imp] = importPaths[imp] ?? [];
|
|
772
765
|
importPaths[imp].push(filePath);
|
|
773
766
|
}
|
|
774
767
|
for (const imp of cleanedTypeImports) {
|
|
775
|
-
typeImportPaths[imp] = typeImportPaths[imp]
|
|
768
|
+
typeImportPaths[imp] = typeImportPaths[imp] ?? [];
|
|
776
769
|
typeImportPaths[imp].push(filePath);
|
|
777
770
|
}
|
|
778
771
|
return [cleanedImports, cleanedTypeImports];
|
|
@@ -783,117 +776,115 @@ var internalImportPrefixes = [".", "#", "node:"];
|
|
|
783
776
|
var removeInternalImports = (imports) => {
|
|
784
777
|
return imports.filter((imp) => !internalImportPrefixes.some((prefix) => imp.startsWith(prefix)));
|
|
785
778
|
};
|
|
786
|
-
function getExternalImportsFromFiles({
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
const
|
|
792
|
-
const
|
|
793
|
-
const
|
|
794
|
-
const
|
|
795
|
-
const prodImports = prodImportPairs.flatMap((pair) => pair[0]);
|
|
796
|
-
const prodDistImports = prodDistImportPairs.flatMap((pair) => pair[1]);
|
|
797
|
-
const devImportPaths = {};
|
|
798
|
-
const devTypeImportPaths = {};
|
|
799
|
-
const devImportPairs = devSourceFiles.map((path10) => getImportsFromFile(path10, devImportPaths, devTypeImportPaths));
|
|
800
|
-
const devImports = devImportPairs.flatMap((pair) => pair[0]);
|
|
801
|
-
const devTypeImports = devImportPairs.flatMap((pair) => pair[1]);
|
|
802
|
-
const externalProdImports = removeInternalImports(prodImports);
|
|
803
|
-
const externalProdTypeImports = removeInternalImports(prodDistImports);
|
|
804
|
-
const externalDevImports = removeInternalImports(devImports);
|
|
779
|
+
function getExternalImportsFromFiles({ srcFiles, distFiles }) {
|
|
780
|
+
const srcImportPaths = {};
|
|
781
|
+
const distImportPaths = {};
|
|
782
|
+
for (const path10 of srcFiles) getImportsFromFile(path10, srcImportPaths, srcImportPaths).flat();
|
|
783
|
+
for (const path10 of distFiles) getImportsFromFile(path10, distImportPaths, distImportPaths).flat();
|
|
784
|
+
const srcImports = Object.keys(srcImportPaths);
|
|
785
|
+
const distImports = Object.keys(distImportPaths);
|
|
786
|
+
const externalSrcImports = removeInternalImports(srcImports);
|
|
787
|
+
const externalDistImports = removeInternalImports(distImports);
|
|
805
788
|
return {
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
externalDevImports,
|
|
813
|
-
prodDistImports,
|
|
814
|
-
devTypeImports,
|
|
815
|
-
externalProdTypeImports
|
|
789
|
+
srcImports,
|
|
790
|
+
srcImportPaths,
|
|
791
|
+
externalSrcImports,
|
|
792
|
+
distImports,
|
|
793
|
+
distImportPaths,
|
|
794
|
+
externalDistImports
|
|
816
795
|
};
|
|
817
796
|
}
|
|
818
797
|
|
|
819
798
|
// src/actions/deplint/checkPackage/getUnlistedDependencies.ts
|
|
820
799
|
import chalk13 from "chalk";
|
|
821
|
-
function getUnlistedDependencies({ name }, { dependencies, peerDependencies }, {
|
|
822
|
-
externalProdTypeImports,
|
|
823
|
-
prodTypeImportPaths,
|
|
824
|
-
externalProdImports,
|
|
825
|
-
prodImportPaths
|
|
826
|
-
}) {
|
|
800
|
+
function getUnlistedDependencies({ name, location }, { dependencies, peerDependencies }, { externalDistImports, distImportPaths }) {
|
|
827
801
|
let unlistedDependencies = 0;
|
|
828
|
-
for (const imp of
|
|
829
|
-
if (!dependencies.includes(imp) && !peerDependencies.includes(imp) && !dependencies.includes(`@types/${imp}`) && !peerDependencies.includes(`@types/${imp}`)) {
|
|
830
|
-
unlistedDependencies++;
|
|
831
|
-
console.log(`[${chalk13.blue(name)}] Missing dependency in package.json: ${chalk13.red(imp)}`);
|
|
832
|
-
console.log(` ${prodTypeImportPaths[imp].join("\n")}`);
|
|
833
|
-
console.log("");
|
|
834
|
-
}
|
|
835
|
-
}
|
|
836
|
-
for (const imp of externalProdImports) {
|
|
802
|
+
for (const imp of externalDistImports) {
|
|
837
803
|
if (!dependencies.includes(imp) && !peerDependencies.includes(imp)) {
|
|
838
804
|
unlistedDependencies++;
|
|
839
805
|
console.log(`[${chalk13.blue(name)}] Missing dependency in package.json: ${chalk13.red(imp)}`);
|
|
840
|
-
console.log(` ${
|
|
841
|
-
console.log("");
|
|
806
|
+
console.log(` ${distImportPaths[imp].join("\n ")}`);
|
|
842
807
|
}
|
|
843
808
|
}
|
|
809
|
+
if (unlistedDependencies > 0) {
|
|
810
|
+
const packageLocation = `${location}/package.json`;
|
|
811
|
+
console.log(` ${chalk13.yellow(packageLocation)}
|
|
812
|
+
`);
|
|
813
|
+
}
|
|
844
814
|
return unlistedDependencies;
|
|
845
815
|
}
|
|
846
816
|
|
|
847
817
|
// src/actions/deplint/checkPackage/getUnlistedDevDependencies.ts
|
|
848
818
|
import chalk14 from "chalk";
|
|
849
|
-
function getUnlistedDevDependencies({ name }, {
|
|
819
|
+
function getUnlistedDevDependencies({ name, location }, {
|
|
850
820
|
devDependencies,
|
|
851
821
|
dependencies,
|
|
852
822
|
peerDependencies
|
|
853
|
-
}, {
|
|
823
|
+
}, {
|
|
824
|
+
srcImportPaths,
|
|
825
|
+
externalSrcImports,
|
|
826
|
+
distImports
|
|
827
|
+
}) {
|
|
854
828
|
let unlistedDevDependencies = 0;
|
|
855
|
-
for (const imp of
|
|
856
|
-
if (!
|
|
829
|
+
for (const imp of externalSrcImports) {
|
|
830
|
+
if (!distImports.includes(imp) && !dependencies.includes(imp) && !peerDependencies.includes(imp) && !devDependencies.includes(imp)) {
|
|
857
831
|
unlistedDevDependencies++;
|
|
858
832
|
console.log(`[${chalk14.blue(name)}] Missing devDependency in package.json: ${chalk14.red(imp)}`);
|
|
859
|
-
console.log(`
|
|
833
|
+
console.log(` ${srcImportPaths[imp].join("\n ")}`);
|
|
860
834
|
}
|
|
861
835
|
}
|
|
836
|
+
if (unlistedDevDependencies > 0) {
|
|
837
|
+
const packageLocation = `${location}/package.json`;
|
|
838
|
+
console.log(` ${chalk14.yellow(packageLocation)}
|
|
839
|
+
`);
|
|
840
|
+
}
|
|
862
841
|
return unlistedDevDependencies;
|
|
863
842
|
}
|
|
864
843
|
|
|
865
844
|
// src/actions/deplint/checkPackage/getUnusedDependencies.ts
|
|
866
845
|
import chalk15 from "chalk";
|
|
867
846
|
function getUnusedDependencies({ name, location }, { dependencies }, {
|
|
868
|
-
|
|
869
|
-
|
|
847
|
+
externalDistImports,
|
|
848
|
+
externalSrcImports
|
|
870
849
|
}) {
|
|
871
850
|
let unusedDependencies = 0;
|
|
872
851
|
for (const dep of dependencies) {
|
|
873
|
-
if (!
|
|
852
|
+
if (!externalDistImports.includes(dep)) {
|
|
874
853
|
unusedDependencies++;
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
854
|
+
if (externalSrcImports.includes(dep)) {
|
|
855
|
+
console.log(`[${chalk15.blue(name)}] dependency should be devDependency in package.json: ${chalk15.red(dep)}`);
|
|
856
|
+
} else {
|
|
857
|
+
console.log(`[${chalk15.blue(name)}] Unused dependency in package.json: ${chalk15.red(dep)}`);
|
|
858
|
+
}
|
|
879
859
|
}
|
|
880
860
|
}
|
|
861
|
+
if (unusedDependencies > 0) {
|
|
862
|
+
const packageLocation = `${location}/package.json`;
|
|
863
|
+
console.log(` ${chalk15.yellow(packageLocation)}
|
|
864
|
+
`);
|
|
865
|
+
}
|
|
881
866
|
return unusedDependencies;
|
|
882
867
|
}
|
|
883
868
|
|
|
884
869
|
// src/actions/deplint/checkPackage/getUnusedPeerDependencies.ts
|
|
885
870
|
import chalk16 from "chalk";
|
|
886
|
-
function getUnusedPeerDependencies({ name, location }, { peerDependencies }, {
|
|
871
|
+
function getUnusedPeerDependencies({ name, location }, { peerDependencies, dependencies }, { externalDistImports }) {
|
|
887
872
|
let unusedDependencies = 0;
|
|
888
873
|
for (const dep of peerDependencies) {
|
|
889
|
-
if (!
|
|
874
|
+
if (!externalDistImports.includes(dep)) {
|
|
890
875
|
unusedDependencies++;
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
876
|
+
if (dependencies.includes(dep)) {
|
|
877
|
+
console.log(`[${chalk16.blue(name)}] Unused peerDependency [already a dependency] in package.json: ${chalk16.red(dep)}`);
|
|
878
|
+
} else {
|
|
879
|
+
console.log(`[${chalk16.blue(name)}] Unused peerDependency in package.json: ${chalk16.red(dep)}`);
|
|
880
|
+
}
|
|
895
881
|
}
|
|
896
882
|
}
|
|
883
|
+
if (unusedDependencies > 0) {
|
|
884
|
+
const packageLocation = `${location}/package.json`;
|
|
885
|
+
console.log(` ${chalk16.yellow(packageLocation)}
|
|
886
|
+
`);
|
|
887
|
+
}
|
|
897
888
|
return unusedDependencies;
|
|
898
889
|
}
|
|
899
890
|
|
|
@@ -905,26 +896,17 @@ function checkPackage({
|
|
|
905
896
|
devDeps = false,
|
|
906
897
|
peerDeps = false
|
|
907
898
|
}) {
|
|
908
|
-
const {
|
|
909
|
-
prodSourceFiles,
|
|
910
|
-
devSourceFiles,
|
|
911
|
-
prodDistFiles
|
|
912
|
-
} = findFiles(location);
|
|
899
|
+
const { srcFiles, distFiles } = findFiles(location);
|
|
913
900
|
const checkDeps = deps || !(deps || devDeps || peerDeps);
|
|
914
901
|
const checkDevDeps = devDeps || !(deps || devDeps || peerDeps);
|
|
915
902
|
const checkPeerDeps = peerDeps;
|
|
916
|
-
const sourceParams = getExternalImportsFromFiles({
|
|
917
|
-
prodSourceFiles,
|
|
918
|
-
devSourceFiles,
|
|
919
|
-
prodDistFiles
|
|
920
|
-
});
|
|
903
|
+
const sourceParams = getExternalImportsFromFiles({ srcFiles, distFiles });
|
|
921
904
|
const packageParams = getDependenciesFromPackageJson(`${location}/package.json`);
|
|
922
905
|
const unlistedDependencies = checkDeps ? getUnlistedDependencies({ name, location }, packageParams, sourceParams) : 0;
|
|
923
906
|
const unusedDependencies = checkDeps ? getUnusedDependencies({ name, location }, packageParams, sourceParams) : 0;
|
|
924
|
-
const typesInDependencies = 0;
|
|
925
907
|
const unlistedDevDependencies = checkDevDeps ? getUnlistedDevDependencies({ name, location }, packageParams, sourceParams) : 0;
|
|
926
908
|
const unusedPeerDependencies = checkPeerDeps ? getUnusedPeerDependencies({ name, location }, packageParams, sourceParams) : 0;
|
|
927
|
-
const totalErrors = unlistedDependencies + unlistedDevDependencies + unusedDependencies +
|
|
909
|
+
const totalErrors = unlistedDependencies + unlistedDevDependencies + unusedDependencies + unusedPeerDependencies;
|
|
928
910
|
return totalErrors;
|
|
929
911
|
}
|
|
930
912
|
|
|
@@ -967,7 +949,7 @@ var deplint = ({
|
|
|
967
949
|
};
|
|
968
950
|
|
|
969
951
|
// src/actions/deploy.ts
|
|
970
|
-
import { readFileSync as readFileSync3 } from "
|
|
952
|
+
import { readFileSync as readFileSync3 } from "fs";
|
|
971
953
|
var privatePackageExcludeList = () => {
|
|
972
954
|
const possibleDeployablePackages = yarnWorkspaces().map((workspace) => [
|
|
973
955
|
workspace,
|
|
@@ -992,7 +974,7 @@ var deploy = () => {
|
|
|
992
974
|
};
|
|
993
975
|
|
|
994
976
|
// src/actions/deploy-major.ts
|
|
995
|
-
import { readFileSync as readFileSync4 } from "
|
|
977
|
+
import { readFileSync as readFileSync4 } from "fs";
|
|
996
978
|
var privatePackageExcludeList2 = () => {
|
|
997
979
|
const possibleDeployablePackages = yarnWorkspaces().map((workspace) => [
|
|
998
980
|
workspace,
|
|
@@ -1017,7 +999,7 @@ var deployMajor = () => {
|
|
|
1017
999
|
};
|
|
1018
1000
|
|
|
1019
1001
|
// src/actions/deploy-minor.ts
|
|
1020
|
-
import { readFileSync as readFileSync5 } from "
|
|
1002
|
+
import { readFileSync as readFileSync5 } from "fs";
|
|
1021
1003
|
var privatePackageExcludeList3 = () => {
|
|
1022
1004
|
const possibleDeployablePackages = yarnWorkspaces().map((workspace) => [
|
|
1023
1005
|
workspace,
|
|
@@ -1042,7 +1024,7 @@ var deployMinor = () => {
|
|
|
1042
1024
|
};
|
|
1043
1025
|
|
|
1044
1026
|
// src/actions/deploy-next.ts
|
|
1045
|
-
import { readFileSync as readFileSync6 } from "
|
|
1027
|
+
import { readFileSync as readFileSync6 } from "fs";
|
|
1046
1028
|
var privatePackageExcludeList4 = () => {
|
|
1047
1029
|
const possibleDeployablePackages = yarnWorkspaces().map((workspace) => [
|
|
1048
1030
|
workspace,
|
|
@@ -1183,7 +1165,7 @@ Gitlint Start [${process.cwd()}]
|
|
|
1183
1165
|
};
|
|
1184
1166
|
|
|
1185
1167
|
// src/actions/gitlint-fix.ts
|
|
1186
|
-
import { execSync as execSync2 } from "
|
|
1168
|
+
import { execSync as execSync2 } from "child_process";
|
|
1187
1169
|
import chalk21 from "chalk";
|
|
1188
1170
|
import ParseGitConfig2 from "parse-git-config";
|
|
1189
1171
|
var gitlintFix = () => {
|
|
@@ -1283,7 +1265,7 @@ var filename2 = ".npmignore";
|
|
|
1283
1265
|
var npmignoreGen = (pkg) => generateIgnoreFiles(filename2, pkg);
|
|
1284
1266
|
|
|
1285
1267
|
// src/actions/package/clean-outputs.ts
|
|
1286
|
-
import path5 from "
|
|
1268
|
+
import path5 from "path";
|
|
1287
1269
|
import chalk23 from "chalk";
|
|
1288
1270
|
var packageCleanOutputs = () => {
|
|
1289
1271
|
const pkg = process.env.INIT_CWD ?? ".";
|
|
@@ -1297,7 +1279,7 @@ var packageCleanOutputs = () => {
|
|
|
1297
1279
|
};
|
|
1298
1280
|
|
|
1299
1281
|
// src/actions/package/clean-typescript.ts
|
|
1300
|
-
import path6 from "
|
|
1282
|
+
import path6 from "path";
|
|
1301
1283
|
import chalk24 from "chalk";
|
|
1302
1284
|
var packageCleanTypescript = () => {
|
|
1303
1285
|
const pkg = process.env.INIT_CWD ?? ".";
|
|
@@ -1319,7 +1301,7 @@ var packageClean = async () => {
|
|
|
1319
1301
|
import chalk28 from "chalk";
|
|
1320
1302
|
|
|
1321
1303
|
// src/actions/package/publint.ts
|
|
1322
|
-
import { promises as fs4 } from "
|
|
1304
|
+
import { promises as fs4 } from "fs";
|
|
1323
1305
|
import chalk25 from "chalk";
|
|
1324
1306
|
import sortPackageJson from "sort-package-json";
|
|
1325
1307
|
var packagePublint = async (params) => {
|
|
@@ -1393,7 +1375,7 @@ var buildEntries = (folder, entryMode = "single", excludeSpecAndStories = true,
|
|
|
1393
1375
|
};
|
|
1394
1376
|
|
|
1395
1377
|
// src/actions/package/compile/packageCompileTscTypes.ts
|
|
1396
|
-
import { cwd } from "
|
|
1378
|
+
import { cwd } from "process";
|
|
1397
1379
|
import chalk26 from "chalk";
|
|
1398
1380
|
import { createProgramFromConfig } from "tsc-prog";
|
|
1399
1381
|
import {
|
|
@@ -1404,7 +1386,7 @@ import {
|
|
|
1404
1386
|
} from "typescript";
|
|
1405
1387
|
|
|
1406
1388
|
// src/actions/package/compile/getCompilerOptions.ts
|
|
1407
|
-
import { createRequire } from "
|
|
1389
|
+
import { createRequire } from "module";
|
|
1408
1390
|
import deepmerge2 from "deepmerge";
|
|
1409
1391
|
import {
|
|
1410
1392
|
findConfigFile,
|
|
@@ -1505,7 +1487,7 @@ function deepMergeObjects(objects) {
|
|
|
1505
1487
|
}
|
|
1506
1488
|
|
|
1507
1489
|
// src/actions/package/compile/packageCompileTsc.ts
|
|
1508
|
-
import { cwd as cwd2 } from "
|
|
1490
|
+
import { cwd as cwd2 } from "process";
|
|
1509
1491
|
import chalk27 from "chalk";
|
|
1510
1492
|
import { createProgramFromConfig as createProgramFromConfig2 } from "tsc-prog";
|
|
1511
1493
|
import {
|
|
@@ -1635,7 +1617,7 @@ var packageCompileTsup = async (config2) => {
|
|
|
1635
1617
|
return (await Promise.all(
|
|
1636
1618
|
Object.entries(compileForNode).map(async ([folder, options]) => {
|
|
1637
1619
|
const inEsBuildOptions = typeof compile2?.node?.esbuildOptions === "object" ? compile2?.node?.esbuildOptions : {};
|
|
1638
|
-
return folder ? await compileFolder(
|
|
1620
|
+
return typeof folder === "string" ? await compileFolder(
|
|
1639
1621
|
folder,
|
|
1640
1622
|
compile2?.entryMode,
|
|
1641
1623
|
tsupOptions([
|
|
@@ -1647,10 +1629,10 @@ var packageCompileTsup = async (config2) => {
|
|
|
1647
1629
|
verbose
|
|
1648
1630
|
) : 0;
|
|
1649
1631
|
})
|
|
1650
|
-
)).reduce((prev, value) => prev + value, 0)
|
|
1632
|
+
)).reduce((prev, value) => prev + value, 0) + (await Promise.all(
|
|
1651
1633
|
Object.entries(compileForBrowser).map(async ([folder, options]) => {
|
|
1652
1634
|
const inEsBuildOptions = typeof compile2?.browser?.esbuildOptions === "object" ? compile2?.browser?.esbuildOptions : {};
|
|
1653
|
-
return folder ? await compileFolder(
|
|
1635
|
+
return typeof folder === "string" ? await compileFolder(
|
|
1654
1636
|
folder,
|
|
1655
1637
|
compile2?.entryMode,
|
|
1656
1638
|
tsupOptions([
|
|
@@ -1662,10 +1644,10 @@ var packageCompileTsup = async (config2) => {
|
|
|
1662
1644
|
verbose
|
|
1663
1645
|
) : 0;
|
|
1664
1646
|
})
|
|
1665
|
-
)).reduce((prev, value) => prev + value, 0)
|
|
1647
|
+
)).reduce((prev, value) => prev + value, 0) + (await Promise.all(
|
|
1666
1648
|
Object.entries(compileForNeutral).map(async ([folder, options]) => {
|
|
1667
1649
|
const inEsBuildOptions = typeof compile2?.neutral?.esbuildOptions === "object" ? compile2?.neutral?.esbuildOptions : {};
|
|
1668
|
-
return folder ? await compileFolder(
|
|
1650
|
+
return typeof folder === "string" ? await compileFolder(
|
|
1669
1651
|
folder,
|
|
1670
1652
|
compile2?.entryMode,
|
|
1671
1653
|
tsupOptions([
|
|
@@ -1677,7 +1659,7 @@ var packageCompileTsup = async (config2) => {
|
|
|
1677
1659
|
verbose
|
|
1678
1660
|
) : 0;
|
|
1679
1661
|
})
|
|
1680
|
-
)).reduce((prev, value) => prev + value, 0)
|
|
1662
|
+
)).reduce((prev, value) => prev + value, 0) + 0;
|
|
1681
1663
|
};
|
|
1682
1664
|
|
|
1683
1665
|
// src/actions/package/compile/compile.ts
|
|
@@ -1694,7 +1676,7 @@ var packageCompile = async (inConfig = {}) => {
|
|
|
1694
1676
|
};
|
|
1695
1677
|
|
|
1696
1678
|
// src/actions/package/copy-assets.ts
|
|
1697
|
-
import path7 from "
|
|
1679
|
+
import path7 from "path/posix";
|
|
1698
1680
|
import chalk29 from "chalk";
|
|
1699
1681
|
import cpy2 from "cpy";
|
|
1700
1682
|
var copyTargetAssets2 = async (target, name, location) => {
|
|
@@ -1775,8 +1757,8 @@ var packageCycle = async ({ verbose = false }) => {
|
|
|
1775
1757
|
};
|
|
1776
1758
|
|
|
1777
1759
|
// src/actions/package/gen-docs.ts
|
|
1778
|
-
import { existsSync as existsSync4 } from "
|
|
1779
|
-
import path8 from "
|
|
1760
|
+
import { existsSync as existsSync4 } from "fs";
|
|
1761
|
+
import path8 from "path";
|
|
1780
1762
|
import chalk30 from "chalk";
|
|
1781
1763
|
import {
|
|
1782
1764
|
Application,
|
|
@@ -1886,10 +1868,10 @@ var runTypeDoc = async (app) => {
|
|
|
1886
1868
|
};
|
|
1887
1869
|
|
|
1888
1870
|
// src/actions/package/lint.ts
|
|
1889
|
-
import { readdirSync } from "
|
|
1890
|
-
import path9 from "
|
|
1891
|
-
import { cwd as cwd3 } from "
|
|
1892
|
-
import { pathToFileURL } from "
|
|
1871
|
+
import { readdirSync } from "fs";
|
|
1872
|
+
import path9 from "path";
|
|
1873
|
+
import { cwd as cwd3 } from "process";
|
|
1874
|
+
import { pathToFileURL } from "url";
|
|
1893
1875
|
import chalk31 from "chalk";
|
|
1894
1876
|
import { ESLint } from "eslint";
|
|
1895
1877
|
import { findUp } from "find-up";
|
|
@@ -2062,7 +2044,7 @@ import {
|
|
|
2062
2044
|
closeSync,
|
|
2063
2045
|
openSync,
|
|
2064
2046
|
rmSync
|
|
2065
|
-
} from "
|
|
2047
|
+
} from "fs";
|
|
2066
2048
|
var reinstall = () => {
|
|
2067
2049
|
console.log("Reinstall [Clear Lock File]");
|
|
2068
2050
|
closeSync(openSync("./yarn.lock", "w"));
|