@xylabs/ts-scripts-yarn3 7.4.2 → 7.4.4
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 +85 -91
- package/dist/actions/deplint/checkPackage/checkPackage.mjs.map +1 -1
- package/dist/actions/deplint/checkPackage/getUnlistedDevDependencies.mjs +5 -5
- package/dist/actions/deplint/checkPackage/getUnlistedDevDependencies.mjs.map +1 -1
- package/dist/actions/deplint/checkPackage/getUnusedDependencies.mjs +2 -2
- package/dist/actions/deplint/checkPackage/getUnusedDependencies.mjs.map +1 -1
- package/dist/actions/deplint/checkPackage/getUnusedDevDependencies.mjs +7 -10
- package/dist/actions/deplint/checkPackage/getUnusedDevDependencies.mjs.map +1 -1
- package/dist/actions/deplint/checkPackage/index.mjs +85 -91
- package/dist/actions/deplint/checkPackage/index.mjs.map +1 -1
- package/dist/actions/deplint/deplint.mjs +85 -91
- package/dist/actions/deplint/deplint.mjs.map +1 -1
- package/dist/actions/deplint/findFiles.mjs +29 -14
- package/dist/actions/deplint/findFiles.mjs.map +1 -1
- package/dist/actions/deplint/findFilesByGlob.mjs +7 -2
- package/dist/actions/deplint/findFilesByGlob.mjs.map +1 -1
- package/dist/actions/deplint/getExternalImportsFromFiles.mjs +19 -25
- package/dist/actions/deplint/getExternalImportsFromFiles.mjs.map +1 -1
- package/dist/actions/deplint/getImportsFromFile.mjs +3 -2
- package/dist/actions/deplint/getImportsFromFile.mjs.map +1 -1
- package/dist/actions/deplint/implicitDevDependencies.mjs +2 -2
- package/dist/actions/deplint/implicitDevDependencies.mjs.map +1 -1
- package/dist/actions/deplint/index.mjs +85 -91
- package/dist/actions/deplint/index.mjs.map +1 -1
- package/dist/actions/index.mjs +89 -95
- package/dist/actions/index.mjs.map +1 -1
- package/dist/bin/xy.mjs +85 -91
- package/dist/bin/xy.mjs.map +1 -1
- package/dist/index.mjs +89 -95
- package/dist/index.mjs.map +1 -1
- package/dist/xy/index.mjs +85 -91
- package/dist/xy/index.mjs.map +1 -1
- package/dist/xy/xy.mjs +85 -91
- package/dist/xy/xy.mjs.map +1 -1
- package/dist/xy/xyLintCommands.mjs +85 -91
- package/dist/xy/xyLintCommands.mjs.map +1 -1
- package/package.json +4 -3
|
@@ -219,33 +219,48 @@ var cycleAll = async ({ verbose = false }) => {
|
|
|
219
219
|
// src/actions/deplint/deplint.ts
|
|
220
220
|
import chalk10 from "chalk";
|
|
221
221
|
|
|
222
|
+
// src/actions/deplint/findFiles.ts
|
|
223
|
+
import fs from "fs";
|
|
224
|
+
|
|
222
225
|
// src/actions/deplint/findFilesByGlob.ts
|
|
223
226
|
import { globSync } from "glob";
|
|
224
|
-
function findFilesByGlob(cwd, pattern) {
|
|
225
|
-
return globSync(pattern, {
|
|
227
|
+
function findFilesByGlob(cwd, pattern, ignore) {
|
|
228
|
+
return globSync(pattern, {
|
|
229
|
+
cwd,
|
|
230
|
+
absolute: true,
|
|
231
|
+
ignore,
|
|
232
|
+
nodir: true
|
|
233
|
+
});
|
|
226
234
|
}
|
|
227
235
|
|
|
228
236
|
// src/actions/deplint/findFiles.ts
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
};
|
|
237
|
+
var codeExtensions = "*.{ts,tsx,mts,cts,js,mjs,cjs}";
|
|
238
|
+
function getWorkspaceIgnores(location) {
|
|
239
|
+
try {
|
|
240
|
+
const raw = fs.readFileSync(`${location}/package.json`, "utf8");
|
|
241
|
+
const pkg = JSON.parse(raw);
|
|
242
|
+
return pkg.workspaces ?? [];
|
|
243
|
+
} catch {
|
|
244
|
+
return [];
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
function findFiles(location) {
|
|
248
|
+
const workspaceIgnores = getWorkspaceIgnores(location).map((w) => `${w}/**`);
|
|
249
|
+
const ignore = ["**/node_modules/**", "dist/**", ...workspaceIgnores];
|
|
250
|
+
const allFiles = findFilesByGlob(location, `./**/${codeExtensions}`, ignore);
|
|
251
|
+
const distFiles = [
|
|
252
|
+
...findFilesByGlob(location, "./dist/**/*.d.ts"),
|
|
253
|
+
...findFilesByGlob(location, `./dist/**/${codeExtensions}`)
|
|
254
|
+
];
|
|
255
|
+
return { allFiles, distFiles };
|
|
241
256
|
}
|
|
242
257
|
|
|
243
258
|
// src/actions/deplint/getDependenciesFromPackageJson.ts
|
|
244
|
-
import
|
|
259
|
+
import fs2 from "fs";
|
|
245
260
|
import path from "path";
|
|
246
261
|
function getDependenciesFromPackageJson(packageJsonPath) {
|
|
247
262
|
const packageJsonFullPath = path.resolve(packageJsonPath);
|
|
248
|
-
const rawContent =
|
|
263
|
+
const rawContent = fs2.readFileSync(packageJsonFullPath, "utf8");
|
|
249
264
|
const packageJson = JSON.parse(rawContent);
|
|
250
265
|
const dependencies = packageJson.dependencies ? Object.keys(packageJson.dependencies) : [];
|
|
251
266
|
const devDependencies = packageJson.devDependencies ? Object.keys(packageJson.devDependencies) : [];
|
|
@@ -258,7 +273,7 @@ function getDependenciesFromPackageJson(packageJsonPath) {
|
|
|
258
273
|
}
|
|
259
274
|
|
|
260
275
|
// src/actions/deplint/getExtendsFromTsconfigs.ts
|
|
261
|
-
import
|
|
276
|
+
import fs3 from "fs";
|
|
262
277
|
import { globSync as globSync2 } from "glob";
|
|
263
278
|
|
|
264
279
|
// src/actions/deplint/getBasePackageName.ts
|
|
@@ -283,7 +298,7 @@ function getExtendsFromTsconfigs(location) {
|
|
|
283
298
|
const packages = /* @__PURE__ */ new Set();
|
|
284
299
|
for (const file of tsconfigFiles) {
|
|
285
300
|
try {
|
|
286
|
-
const content =
|
|
301
|
+
const content = fs3.readFileSync(file, "utf8");
|
|
287
302
|
const cleaned = content.replaceAll(/\/\/.*/g, "").replaceAll(/,\s*([}\]])/g, "$1");
|
|
288
303
|
const parsed = JSON.parse(cleaned);
|
|
289
304
|
const refs = parseExtendsField(parsed.extends);
|
|
@@ -299,7 +314,7 @@ function getExtendsFromTsconfigs(location) {
|
|
|
299
314
|
}
|
|
300
315
|
|
|
301
316
|
// src/actions/deplint/getImportsFromFile.ts
|
|
302
|
-
import
|
|
317
|
+
import fs4 from "fs";
|
|
303
318
|
import path2 from "path";
|
|
304
319
|
import ts from "typescript";
|
|
305
320
|
function isTypeOnlyImportClause(clause) {
|
|
@@ -314,7 +329,7 @@ function isTypeOnlyImportClause(clause) {
|
|
|
314
329
|
return clause.isTypeOnly;
|
|
315
330
|
}
|
|
316
331
|
function getImportsFromFile(filePath, importPaths, typeImportPaths) {
|
|
317
|
-
const sourceCode =
|
|
332
|
+
const sourceCode = fs4.readFileSync(filePath, "utf8");
|
|
318
333
|
const isMjsFile = filePath.endsWith(".mjs");
|
|
319
334
|
const sourceFile = ts.createSourceFile(
|
|
320
335
|
path2.basename(filePath),
|
|
@@ -325,14 +340,14 @@ function getImportsFromFile(filePath, importPaths, typeImportPaths) {
|
|
|
325
340
|
);
|
|
326
341
|
const imports = [];
|
|
327
342
|
const typeImports = [];
|
|
328
|
-
const
|
|
343
|
+
const isDeclarationFile2 = filePath.endsWith(".d.ts");
|
|
329
344
|
function visit(node) {
|
|
330
345
|
if (ts.isImportDeclaration(node) || ts.isExportDeclaration(node)) {
|
|
331
346
|
const moduleSpecifier = node.moduleSpecifier?.getFullText();
|
|
332
347
|
const isTypeImport = ts.isImportDeclaration(node) ? isTypeOnlyImportClause(node.importClause) : false;
|
|
333
348
|
if (typeof moduleSpecifier === "string") {
|
|
334
349
|
const trimmed = moduleSpecifier.replaceAll("'", "").replaceAll('"', "").trim();
|
|
335
|
-
if (isTypeImport ||
|
|
350
|
+
if (isTypeImport || isDeclarationFile2) {
|
|
336
351
|
typeImports.push(trimmed);
|
|
337
352
|
} else {
|
|
338
353
|
imports.push(trimmed);
|
|
@@ -349,8 +364,9 @@ function getImportsFromFile(filePath, importPaths, typeImportPaths) {
|
|
|
349
364
|
}
|
|
350
365
|
visit(sourceFile);
|
|
351
366
|
const importsStartsWithExcludes = [".", "#", "node:"];
|
|
352
|
-
const
|
|
353
|
-
const
|
|
367
|
+
const isValidImport = (imp) => !importsStartsWithExcludes.some((exc) => imp.startsWith(exc)) && !imp.includes("*") && !imp.includes("!");
|
|
368
|
+
const cleanedImports = imports.filter(isValidImport).map(getBasePackageName);
|
|
369
|
+
const cleanedTypeImports = typeImports.filter(isValidImport).map(getBasePackageName);
|
|
354
370
|
for (const imp of cleanedImports) {
|
|
355
371
|
importPaths[imp] = importPaths[imp] ?? [];
|
|
356
372
|
importPaths[imp].push(filePath);
|
|
@@ -367,41 +383,34 @@ var internalImportPrefixes = [".", "#", "node:"];
|
|
|
367
383
|
var removeInternalImports = (imports) => {
|
|
368
384
|
return imports.filter((imp) => !internalImportPrefixes.some((prefix) => imp.startsWith(prefix)));
|
|
369
385
|
};
|
|
386
|
+
var isDeclarationFile = (file) => file.endsWith(".d.ts") || file.endsWith(".d.cts") || file.endsWith(".d.mts");
|
|
370
387
|
function getExternalImportsFromFiles({
|
|
371
|
-
|
|
388
|
+
allFiles,
|
|
372
389
|
distFiles,
|
|
373
|
-
configFiles = [],
|
|
374
390
|
tsconfigExtends = []
|
|
375
391
|
}) {
|
|
376
|
-
const
|
|
392
|
+
const allImportPaths = {};
|
|
377
393
|
const distImportPaths = {};
|
|
378
394
|
const distTypeImportPaths = {};
|
|
379
|
-
const
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
const distTypeFiles = distFiles.filter((file) => file.endsWith(".d.ts") || file.endsWith(".d.cts") || file.endsWith(".d.mts"));
|
|
383
|
-
const distCodeFiles = distFiles.filter((file) => !(file.endsWith(".d.ts") || file.endsWith(".d.cts") || file.endsWith(".d.mts")));
|
|
395
|
+
for (const path5 of allFiles) getImportsFromFile(path5, allImportPaths, allImportPaths).flat();
|
|
396
|
+
const distTypeFiles = distFiles.filter(isDeclarationFile);
|
|
397
|
+
const distCodeFiles = distFiles.filter((file) => !isDeclarationFile(file));
|
|
384
398
|
for (const path5 of distCodeFiles) getImportsFromFile(path5, distImportPaths, distImportPaths).flat();
|
|
385
399
|
for (const path5 of distTypeFiles) getImportsFromFile(path5, distTypeImportPaths, distTypeImportPaths).flat();
|
|
386
|
-
const
|
|
400
|
+
const allImports = Object.keys(allImportPaths);
|
|
387
401
|
const distImports = Object.keys(distImportPaths);
|
|
388
|
-
const
|
|
389
|
-
const externalSrcImports = removeInternalImports(srcImports);
|
|
402
|
+
const externalAllImports = removeInternalImports(allImports);
|
|
390
403
|
const externalDistImports = removeInternalImports(distImports);
|
|
391
|
-
const externalDistTypeImports = removeInternalImports(
|
|
392
|
-
const externalConfigImports = removeInternalImports(Object.keys(configImportPaths));
|
|
404
|
+
const externalDistTypeImports = removeInternalImports(Object.keys(distTypeImportPaths));
|
|
393
405
|
for (const ext of tsconfigExtends) {
|
|
394
|
-
if (!
|
|
395
|
-
if (!externalConfigImports.includes(ext)) externalConfigImports.push(ext);
|
|
406
|
+
if (!externalAllImports.includes(ext)) externalAllImports.push(ext);
|
|
396
407
|
}
|
|
397
408
|
return {
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
srcImportPaths,
|
|
401
|
-
externalConfigImports,
|
|
402
|
-
externalSrcImports,
|
|
403
|
-
distImports,
|
|
409
|
+
allImportPaths,
|
|
410
|
+
allImports,
|
|
404
411
|
distImportPaths,
|
|
412
|
+
distImports,
|
|
413
|
+
externalAllImports,
|
|
405
414
|
externalDistImports,
|
|
406
415
|
externalDistTypeImports
|
|
407
416
|
};
|
|
@@ -453,17 +462,17 @@ function getUnlistedDevDependencies({ name, location }, {
|
|
|
453
462
|
dependencies,
|
|
454
463
|
peerDependencies
|
|
455
464
|
}, {
|
|
456
|
-
|
|
457
|
-
|
|
465
|
+
allImportPaths,
|
|
466
|
+
externalAllImports,
|
|
458
467
|
distImports
|
|
459
468
|
}) {
|
|
460
469
|
let unlistedDevDependencies = 0;
|
|
461
|
-
for (const imp of
|
|
470
|
+
for (const imp of externalAllImports) {
|
|
462
471
|
if (!distImports.includes(imp) && imp !== name && !dependencies.includes(imp) && !dependencies.includes(`@types/${imp}`) && !peerDependencies.includes(imp) && !peerDependencies.includes(`@types/${imp}`) && !devDependencies.includes(imp) && !devDependencies.includes(`@types/${imp}`) && !builtinModules2.includes(imp)) {
|
|
463
472
|
unlistedDevDependencies++;
|
|
464
473
|
console.log(`[${chalk6.blue(name)}] Missing devDependency in package.json: ${chalk6.red(imp)}`);
|
|
465
|
-
if (
|
|
466
|
-
console.log(` ${
|
|
474
|
+
if (allImportPaths[imp]) {
|
|
475
|
+
console.log(` ${allImportPaths[imp].join("\n ")}`);
|
|
467
476
|
}
|
|
468
477
|
}
|
|
469
478
|
}
|
|
@@ -480,13 +489,13 @@ import chalk7 from "chalk";
|
|
|
480
489
|
function getUnusedDependencies({ name, location }, { dependencies }, {
|
|
481
490
|
externalDistImports,
|
|
482
491
|
externalDistTypeImports,
|
|
483
|
-
|
|
492
|
+
externalAllImports
|
|
484
493
|
}) {
|
|
485
494
|
let unusedDependencies = 0;
|
|
486
495
|
for (const dep of dependencies) {
|
|
487
496
|
if (!externalDistImports.includes(dep) && !externalDistImports.includes(dep.replace(/^@types\//, "")) && !externalDistTypeImports.includes(dep) && !externalDistTypeImports.includes(dep.replace(/^@types\//, ""))) {
|
|
488
497
|
unusedDependencies++;
|
|
489
|
-
if (
|
|
498
|
+
if (externalAllImports.includes(dep)) {
|
|
490
499
|
console.log(`[${chalk7.blue(name)}] dependency should be devDependency in package.json: ${chalk7.red(dep)}`);
|
|
491
500
|
} else {
|
|
492
501
|
console.log(`[${chalk7.blue(name)}] Unused dependency in package.json: ${chalk7.red(dep)}`);
|
|
@@ -505,13 +514,13 @@ function getUnusedDependencies({ name, location }, { dependencies }, {
|
|
|
505
514
|
import chalk8 from "chalk";
|
|
506
515
|
|
|
507
516
|
// src/actions/deplint/getRequiredPeerDependencies.ts
|
|
508
|
-
import
|
|
517
|
+
import fs5 from "fs";
|
|
509
518
|
import path3 from "path";
|
|
510
519
|
function findDepPackageJson(location, dep) {
|
|
511
520
|
let dir = location;
|
|
512
521
|
while (true) {
|
|
513
522
|
const candidate = path3.join(dir, "node_modules", dep, "package.json");
|
|
514
|
-
if (
|
|
523
|
+
if (fs5.existsSync(candidate)) return candidate;
|
|
515
524
|
const parent = path3.dirname(dir);
|
|
516
525
|
if (parent === dir) return void 0;
|
|
517
526
|
dir = parent;
|
|
@@ -523,7 +532,7 @@ function getRequiredPeerDependencies(location, allDeps) {
|
|
|
523
532
|
const depPkgPath = findDepPackageJson(location, dep);
|
|
524
533
|
if (!depPkgPath) continue;
|
|
525
534
|
try {
|
|
526
|
-
const raw =
|
|
535
|
+
const raw = fs5.readFileSync(depPkgPath, "utf8");
|
|
527
536
|
const pkg = JSON.parse(raw);
|
|
528
537
|
if (pkg.peerDependencies) {
|
|
529
538
|
for (const peer of Object.keys(pkg.peerDependencies)) {
|
|
@@ -537,13 +546,13 @@ function getRequiredPeerDependencies(location, allDeps) {
|
|
|
537
546
|
}
|
|
538
547
|
|
|
539
548
|
// src/actions/deplint/getScriptReferencedPackages.ts
|
|
540
|
-
import
|
|
549
|
+
import fs6 from "fs";
|
|
541
550
|
import path4 from "path";
|
|
542
551
|
function getBinNames(location, dep) {
|
|
543
552
|
const depPkgPath = findDepPackageJson(location, dep);
|
|
544
553
|
if (!depPkgPath) return [];
|
|
545
554
|
try {
|
|
546
|
-
const raw =
|
|
555
|
+
const raw = fs6.readFileSync(depPkgPath, "utf8");
|
|
547
556
|
const pkg = JSON.parse(raw);
|
|
548
557
|
if (!pkg.bin) return [];
|
|
549
558
|
if (typeof pkg.bin === "string") return [pkg.name?.split("/").pop() ?? dep];
|
|
@@ -559,7 +568,7 @@ function getScriptReferencedPackages(location, allDeps) {
|
|
|
559
568
|
const pkgPath = path4.join(location, "package.json");
|
|
560
569
|
let scripts = {};
|
|
561
570
|
try {
|
|
562
|
-
const raw =
|
|
571
|
+
const raw = fs6.readFileSync(pkgPath, "utf8");
|
|
563
572
|
const pkg = JSON.parse(raw);
|
|
564
573
|
scripts = pkg.scripts ?? {};
|
|
565
574
|
} catch {
|
|
@@ -589,14 +598,14 @@ function getScriptReferencedPackages(location, allDeps) {
|
|
|
589
598
|
}
|
|
590
599
|
|
|
591
600
|
// src/actions/deplint/implicitDevDependencies.ts
|
|
592
|
-
import
|
|
601
|
+
import fs7 from "fs";
|
|
593
602
|
var hasFileWithExtension = (files, extensions) => files.some((f) => extensions.some((ext) => f.endsWith(ext)));
|
|
594
603
|
var tsExtensions = [".ts", ".tsx", ".mts", ".cts"];
|
|
595
|
-
var hasTypescriptFiles = ({
|
|
604
|
+
var hasTypescriptFiles = ({ allFiles }) => hasFileWithExtension(allFiles, tsExtensions);
|
|
596
605
|
var decoratorPattern = /^\s*@[a-zA-Z]\w*/m;
|
|
597
|
-
var hasDecorators = ({
|
|
606
|
+
var hasDecorators = ({ allFiles }) => allFiles.filter((f) => tsExtensions.some((ext) => f.endsWith(ext))).some((file) => {
|
|
598
607
|
try {
|
|
599
|
-
const content =
|
|
608
|
+
const content = fs7.readFileSync(file, "utf8");
|
|
600
609
|
return decoratorPattern.test(content);
|
|
601
610
|
} catch {
|
|
602
611
|
return false;
|
|
@@ -609,7 +618,7 @@ function hasImportPlugin({ location, allDependencies }) {
|
|
|
609
618
|
const pkgPath = findDepPackageJson(location, dep);
|
|
610
619
|
if (!pkgPath) continue;
|
|
611
620
|
try {
|
|
612
|
-
const pkg = JSON.parse(
|
|
621
|
+
const pkg = JSON.parse(fs7.readFileSync(pkgPath, "utf8"));
|
|
613
622
|
const transitiveDeps = [
|
|
614
623
|
...Object.keys(pkg.dependencies ?? {}),
|
|
615
624
|
...Object.keys(pkg.peerDependencies ?? {})
|
|
@@ -646,18 +655,15 @@ function getImplicitDevDependencies(context) {
|
|
|
646
655
|
|
|
647
656
|
// src/actions/deplint/checkPackage/getUnusedDevDependencies.ts
|
|
648
657
|
var allExternalImports = ({
|
|
649
|
-
|
|
658
|
+
externalAllImports,
|
|
650
659
|
externalDistImports,
|
|
651
|
-
externalDistTypeImports
|
|
652
|
-
externalConfigImports
|
|
660
|
+
externalDistTypeImports
|
|
653
661
|
}) => {
|
|
654
|
-
|
|
655
|
-
...
|
|
662
|
+
return /* @__PURE__ */ new Set([
|
|
663
|
+
...externalAllImports,
|
|
656
664
|
...externalDistImports,
|
|
657
|
-
...externalDistTypeImports
|
|
658
|
-
...externalConfigImports
|
|
665
|
+
...externalDistTypeImports
|
|
659
666
|
]);
|
|
660
|
-
return all;
|
|
661
667
|
};
|
|
662
668
|
function isDevDepUsed(dep, allImports, implicitDeps, requiredPeers, scriptRefs) {
|
|
663
669
|
if (implicitDeps.has(dep)) return true;
|
|
@@ -722,18 +728,15 @@ function getUnusedPeerDependencies({ name, location }, { peerDependencies, depen
|
|
|
722
728
|
}
|
|
723
729
|
|
|
724
730
|
// src/actions/deplint/checkPackage/checkPackage.ts
|
|
725
|
-
function logVerbose(name, location,
|
|
731
|
+
function logVerbose(name, location, allFiles, distFiles, tsconfigExtends) {
|
|
726
732
|
console.info(`Checking package: ${name} at ${location}`);
|
|
727
|
-
console.info(`
|
|
728
|
-
for (const file of
|
|
729
|
-
console.info(`
|
|
733
|
+
console.info(`All files: ${allFiles.length}, Distribution files: ${distFiles.length}`);
|
|
734
|
+
for (const file of allFiles) {
|
|
735
|
+
console.info(`File: ${file}`);
|
|
730
736
|
}
|
|
731
737
|
for (const file of distFiles) {
|
|
732
738
|
console.info(`Distribution file: ${file}`);
|
|
733
739
|
}
|
|
734
|
-
for (const file of configFiles) {
|
|
735
|
-
console.info(`Config file: ${file}`);
|
|
736
|
-
}
|
|
737
740
|
for (const ext of tsconfigExtends) {
|
|
738
741
|
console.info(`Tsconfig extends: ${ext}`);
|
|
739
742
|
}
|
|
@@ -746,33 +749,24 @@ function checkPackage({
|
|
|
746
749
|
peerDeps = false,
|
|
747
750
|
verbose = false
|
|
748
751
|
}) {
|
|
749
|
-
const {
|
|
750
|
-
srcFiles,
|
|
751
|
-
distFiles,
|
|
752
|
-
configFiles
|
|
753
|
-
} = findFiles(location);
|
|
752
|
+
const { allFiles, distFiles } = findFiles(location);
|
|
754
753
|
const tsconfigExtends = getExtendsFromTsconfigs(location);
|
|
755
754
|
if (verbose) {
|
|
756
|
-
logVerbose(name, location,
|
|
755
|
+
logVerbose(name, location, allFiles, distFiles, tsconfigExtends);
|
|
757
756
|
}
|
|
758
757
|
const checkDeps = deps || !(deps || devDeps || peerDeps);
|
|
759
758
|
const checkDevDeps = devDeps || !(deps || devDeps || peerDeps);
|
|
760
759
|
const checkPeerDeps = peerDeps;
|
|
761
760
|
const sourceParams = getExternalImportsFromFiles({
|
|
762
|
-
|
|
761
|
+
allFiles,
|
|
763
762
|
distFiles,
|
|
764
|
-
configFiles,
|
|
765
763
|
tsconfigExtends
|
|
766
764
|
});
|
|
767
765
|
const packageParams = getDependenciesFromPackageJson(`${location}/package.json`);
|
|
768
766
|
const unlistedDependencies = checkDeps ? getUnlistedDependencies({ name, location }, packageParams, sourceParams) : 0;
|
|
769
767
|
const unusedDependencies = checkDeps ? getUnusedDependencies({ name, location }, packageParams, sourceParams) : 0;
|
|
770
768
|
const unlistedDevDependencies = checkDevDeps ? getUnlistedDevDependencies({ name, location }, packageParams, sourceParams) : 0;
|
|
771
|
-
const fileContext = {
|
|
772
|
-
configFiles,
|
|
773
|
-
distFiles,
|
|
774
|
-
srcFiles
|
|
775
|
-
};
|
|
769
|
+
const fileContext = { allFiles, distFiles };
|
|
776
770
|
const unusedDevDependencies = checkDevDeps ? getUnusedDevDependencies({ name, location }, packageParams, sourceParams, fileContext) : 0;
|
|
777
771
|
const unusedPeerDependencies = checkPeerDeps ? getUnusedPeerDependencies({ name, location }, packageParams, sourceParams) : 0;
|
|
778
772
|
const totalErrors = unlistedDependencies + unlistedDevDependencies + unusedDependencies + unusedDevDependencies + unusedPeerDependencies;
|