|
@@ -6,10 +6,12 @@ import { basename, dirname, join } from 'node:path';
|
|
import {
|
|
import {
|
|
colors,
|
|
colors,
|
|
consola,
|
|
consola,
|
|
|
|
+ ensureFile,
|
|
findMonorepoRoot,
|
|
findMonorepoRoot,
|
|
- fs,
|
|
|
|
generatorContentHash,
|
|
generatorContentHash,
|
|
getPackages,
|
|
getPackages,
|
|
|
|
+ outputJSON,
|
|
|
|
+ readJSON,
|
|
UNICODE,
|
|
UNICODE,
|
|
} from '@vben/node-utils';
|
|
} from '@vben/node-utils';
|
|
|
|
|
|
@@ -56,8 +58,8 @@ function getCacheFile() {
|
|
|
|
|
|
async function readCache(cacheFile: string) {
|
|
async function readCache(cacheFile: string) {
|
|
try {
|
|
try {
|
|
- await fs.ensureFile(cacheFile);
|
|
|
|
- return await fs.readJSON(cacheFile, { encoding: 'utf8' });
|
|
|
|
|
|
+ await ensureFile(cacheFile);
|
|
|
|
+ return await readJSON(cacheFile);
|
|
} catch {
|
|
} catch {
|
|
return {};
|
|
return {};
|
|
}
|
|
}
|
|
@@ -73,7 +75,7 @@ async function runPublint(files: string[], { check }: PubLintCommandOptions) {
|
|
const results = await Promise.all(
|
|
const results = await Promise.all(
|
|
lintFiles.map(async (file) => {
|
|
lintFiles.map(async (file) => {
|
|
try {
|
|
try {
|
|
- const pkgJson = await fs.readJSON(file);
|
|
|
|
|
|
+ const pkgJson = await readJSON(file);
|
|
|
|
|
|
if (pkgJson.private) {
|
|
if (pkgJson.private) {
|
|
return null;
|
|
return null;
|
|
@@ -106,7 +108,7 @@ async function runPublint(files: string[], { check }: PubLintCommandOptions) {
|
|
}),
|
|
}),
|
|
);
|
|
);
|
|
|
|
|
|
- await fs.outputJSON(cacheFile, cache);
|
|
|
|
|
|
+ await outputJSON(cacheFile, cache);
|
|
printResult(results, check);
|
|
printResult(results, check);
|
|
}
|
|
}
|
|
|
|
|