@tsslint/cli 1.5.10 → 1.5.12
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/index.js +23 -10
- package/lib/cache.js +2 -2
- package/package.json +4 -4
package/index.js
CHANGED
|
@@ -96,7 +96,7 @@ class Project {
|
|
|
96
96
|
const tsconfigAndLanguages = new Map();
|
|
97
97
|
const formattingSettings = getFormattingSettings();
|
|
98
98
|
let projects = [];
|
|
99
|
-
let spinner = clack.spinner();
|
|
99
|
+
let spinner = process.stdout.isTTY ? clack.spinner() : undefined;
|
|
100
100
|
let lastSpinnerUpdate = Date.now();
|
|
101
101
|
let hasFix = false;
|
|
102
102
|
let allFilesNum = 0;
|
|
@@ -255,7 +255,7 @@ class Project {
|
|
|
255
255
|
for (const [tsconfig, languages] of tsconfigAndLanguages) {
|
|
256
256
|
projects.push(await new Project(tsconfig, languages).init(clack));
|
|
257
257
|
}
|
|
258
|
-
spinner
|
|
258
|
+
spinner?.start();
|
|
259
259
|
projects = projects.filter(project => !!project.configFile);
|
|
260
260
|
projects = projects.filter(project => !!project.fileNames.length);
|
|
261
261
|
for (const project of projects) {
|
|
@@ -266,7 +266,7 @@ class Project {
|
|
|
266
266
|
allFilesNum += project.fileNames.length;
|
|
267
267
|
}
|
|
268
268
|
if (allFilesNum === 0) {
|
|
269
|
-
spinner.
|
|
269
|
+
(spinner?.stop ?? clack.log.message)(lightYellow('No input files.'));
|
|
270
270
|
process.exit(1);
|
|
271
271
|
}
|
|
272
272
|
if (threads === 1) {
|
|
@@ -277,7 +277,7 @@ class Project {
|
|
|
277
277
|
return startWorker(worker.create());
|
|
278
278
|
}));
|
|
279
279
|
}
|
|
280
|
-
spinner.
|
|
280
|
+
(spinner?.stop ?? clack.log.message)(cached
|
|
281
281
|
? darkGray(`Processed ${processed} files with cache. (Use `) + cyan(`--force`) + darkGray(` to ignore cache.)`)
|
|
282
282
|
: darkGray(`Processed ${processed} files.`));
|
|
283
283
|
if (process.argv.includes('--fix') && !formattingSettings) {
|
|
@@ -342,7 +342,7 @@ class Project {
|
|
|
342
342
|
continue;
|
|
343
343
|
}
|
|
344
344
|
addProcessFile(fileName);
|
|
345
|
-
if (Date.now() - lastSpinnerUpdate > 100) {
|
|
345
|
+
if (spinner && Date.now() - lastSpinnerUpdate > 100) {
|
|
346
346
|
lastSpinnerUpdate = Date.now();
|
|
347
347
|
await (0, promises_1.setTimeout)(0);
|
|
348
348
|
}
|
|
@@ -469,16 +469,29 @@ class Project {
|
|
|
469
469
|
function updateSpinner() {
|
|
470
470
|
if (processFiles.size === 1) {
|
|
471
471
|
const fileName = processFiles.values().next().value;
|
|
472
|
-
spinner
|
|
472
|
+
spinner?.message(darkGray(`[${processed + processFiles.size}/${allFilesNum}] ${path.relative(process.cwd(), fileName)}`));
|
|
473
473
|
}
|
|
474
474
|
else {
|
|
475
|
-
spinner
|
|
475
|
+
spinner?.message(darkGray(`[${processed + processFiles.size}/${allFilesNum}] Processing ${processFiles.size} files`));
|
|
476
476
|
}
|
|
477
477
|
}
|
|
478
478
|
function log(msg, code) {
|
|
479
|
-
spinner
|
|
480
|
-
|
|
481
|
-
|
|
479
|
+
if (spinner) {
|
|
480
|
+
spinner.stop(msg, code);
|
|
481
|
+
spinner = clack.spinner();
|
|
482
|
+
spinner.start();
|
|
483
|
+
}
|
|
484
|
+
else {
|
|
485
|
+
if (code === 1) {
|
|
486
|
+
clack.log.error(msg);
|
|
487
|
+
}
|
|
488
|
+
else if (code === 2) {
|
|
489
|
+
clack.log.warn(msg);
|
|
490
|
+
}
|
|
491
|
+
else {
|
|
492
|
+
clack.log.success(msg);
|
|
493
|
+
}
|
|
494
|
+
}
|
|
482
495
|
}
|
|
483
496
|
function resolvePath(p) {
|
|
484
497
|
if (!path.isAbsolute(p)
|
package/lib/cache.js
CHANGED
|
@@ -7,7 +7,7 @@ const path = require("path");
|
|
|
7
7
|
const fs = require("fs");
|
|
8
8
|
function loadCache(tsconfig, configFilePath, createHash = btoa) {
|
|
9
9
|
const outDir = core.getDotTsslintPath(configFilePath);
|
|
10
|
-
const cacheFileName = createHash(path.relative(outDir, configFilePath)) + '_' + createHash(path.relative(outDir, tsconfig)) + '.cache.json';
|
|
10
|
+
const cacheFileName = createHash(path.relative(outDir, configFilePath)) + '_' + createHash(JSON.stringify(process.argv)) + '_' + createHash(path.relative(outDir, tsconfig)) + '.cache.json';
|
|
11
11
|
const cacheFilePath = path.join(outDir, cacheFileName);
|
|
12
12
|
const cacheFileStat = fs.statSync(cacheFilePath, { throwIfNoEntry: false });
|
|
13
13
|
const configFileStat = fs.statSync(configFilePath, { throwIfNoEntry: false });
|
|
@@ -23,7 +23,7 @@ function loadCache(tsconfig, configFilePath, createHash = btoa) {
|
|
|
23
23
|
}
|
|
24
24
|
function saveCache(tsconfig, configFilePath, cache, createHash = btoa) {
|
|
25
25
|
const outDir = core.getDotTsslintPath(configFilePath);
|
|
26
|
-
const cacheFileName = createHash(path.relative(outDir, configFilePath)) + '_' + createHash(path.relative(outDir, tsconfig)) + '.cache.json';
|
|
26
|
+
const cacheFileName = createHash(path.relative(outDir, configFilePath)) + '_' + createHash(JSON.stringify(process.argv)) + '_' + createHash(path.relative(outDir, tsconfig)) + '.cache.json';
|
|
27
27
|
const cacheFilePath = path.join(outDir, cacheFileName);
|
|
28
28
|
fs.writeFileSync(cacheFilePath, JSON.stringify(cache));
|
|
29
29
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tsslint/cli",
|
|
3
|
-
"version": "1.5.
|
|
3
|
+
"version": "1.5.12",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"bin": {
|
|
6
6
|
"tsslint": "./bin/tsslint.js"
|
|
@@ -16,8 +16,8 @@
|
|
|
16
16
|
},
|
|
17
17
|
"dependencies": {
|
|
18
18
|
"@clack/prompts": "^0.8.2",
|
|
19
|
-
"@tsslint/config": "1.5.
|
|
20
|
-
"@tsslint/core": "1.5.
|
|
19
|
+
"@tsslint/config": "1.5.12",
|
|
20
|
+
"@tsslint/core": "1.5.12",
|
|
21
21
|
"@volar/language-core": "~2.4.0",
|
|
22
22
|
"@volar/typescript": "~2.4.0",
|
|
23
23
|
"glob": "^10.4.1",
|
|
@@ -30,5 +30,5 @@
|
|
|
30
30
|
"@vue-vine/language-service": "latest",
|
|
31
31
|
"@vue/language-core": "latest"
|
|
32
32
|
},
|
|
33
|
-
"gitHead": "
|
|
33
|
+
"gitHead": "9bb5cb17caed3386b23b4fea9816375a6bf8eaba"
|
|
34
34
|
}
|