@tsslint/cli 2.0.3 → 2.0.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.
Files changed (2) hide show
  1. package/index.js +35 -35
  2. package/package.json +4 -4
package/index.js CHANGED
@@ -11,11 +11,11 @@ const os = require("os");
11
11
  const languagePlugins = require("./lib/languagePlugins.js");
12
12
  process.env.TSSLINT_CLI = '1';
13
13
  const _reset = '\x1b[0m';
14
- const darkGray = (s) => '\x1b[90m' + s + _reset;
15
- const lightRed = (s) => '\x1b[91m' + s + _reset;
16
- const lightGreen = (s) => '\x1b[92m' + s + _reset;
17
- const lightYellow = (s) => '\x1b[93m' + s + _reset;
18
- const lightBlue = (s) => '\x1b[94m' + s + _reset;
14
+ const gray = (s) => '\x1b[90m' + s + _reset;
15
+ const red = (s) => '\x1b[91m' + s + _reset;
16
+ const green = (s) => '\x1b[92m' + s + _reset;
17
+ const yellow = (s) => '\x1b[93m' + s + _reset;
18
+ const blue = (s) => '\x1b[94m' + s + _reset;
19
19
  const purple = (s) => '\x1b[95m' + s + _reset;
20
20
  const cyan = (s) => '\x1b[96m' + s + _reset;
21
21
  // https://talyian.github.io/ansicolors/
@@ -30,7 +30,7 @@ if (process.argv.includes('--threads')) {
30
30
  const threadsIndex = process.argv.indexOf('--threads');
31
31
  const threadsArg = process.argv[threadsIndex + 1];
32
32
  if (!threadsArg || threadsArg.startsWith('-')) {
33
- console.error(lightRed(`Missing argument for --threads.`));
33
+ console.error(red(`Missing argument for --threads.`));
34
34
  process.exit(1);
35
35
  }
36
36
  threads = Math.min(os.availableParallelism(), Number(threadsArg));
@@ -70,19 +70,19 @@ class Project {
70
70
  labels.push(astroColor('Astro'));
71
71
  }
72
72
  }
73
- const label = labels.join(darkGray(' | '));
73
+ const label = labels.join(gray(' | '));
74
74
  if (!this.configFile) {
75
- clack.log.error(`${label} ${path.relative(process.cwd(), this.tsconfig)} ${darkGray('(No tsslint.config.ts found)')}`);
75
+ clack.log.error(`${label} ${path.relative(process.cwd(), this.tsconfig)} ${gray('(No tsslint.config.ts found)')}`);
76
76
  return this;
77
77
  }
78
78
  const commonLine = await parseCommonLine(this.tsconfig, this.languages);
79
79
  this.fileNames = commonLine.fileNames;
80
80
  this.options = commonLine.options;
81
81
  if (!this.fileNames.length) {
82
- clack.log.warn(`${label} ${path.relative(process.cwd(), this.tsconfig)} ${darkGray('(No included files)')}`);
82
+ clack.log.warn(`${label} ${path.relative(process.cwd(), this.tsconfig)} ${gray('(No included files)')}`);
83
83
  return this;
84
84
  }
85
- clack.log.info(`${label} ${path.relative(process.cwd(), this.tsconfig)} ${darkGray(`(${this.fileNames.length})`)}`);
85
+ clack.log.info(`${label} ${path.relative(process.cwd(), this.tsconfig)} ${gray(`(${this.fileNames.length})`)}`);
86
86
  if (!process.argv.includes('--force')) {
87
87
  this.cache = cache.loadCache(this.tsconfig, this.configFile, ts.sys.createHash);
88
88
  }
@@ -112,7 +112,7 @@ class Project {
112
112
  const write = process.stdout.write.bind(process.stdout);
113
113
  process.stdout.write = (...args) => {
114
114
  if (spinnerStopingWarn && typeof args[0] === 'string') {
115
- args[0] = args[0].replace('▲', lightYellow('▲'));
115
+ args[0] = args[0].replace('▲', yellow('▲'));
116
116
  }
117
117
  // @ts-ignore
118
118
  return write(...args);
@@ -177,7 +177,7 @@ class Project {
177
177
  options = options.filter(option => !option.label.endsWith('(0)'));
178
178
  }
179
179
  if (!options.length) {
180
- clack.log.error(lightRed('No projects found.'));
180
+ clack.log.error(red('No projects found.'));
181
181
  process.exit(1);
182
182
  }
183
183
  const selectedTsconfigs = await clack.multiselect({
@@ -196,7 +196,7 @@ class Project {
196
196
  else {
197
197
  command += ` --${language}-project ` + selectedTsconfigs.join(' ');
198
198
  }
199
- clack.log.info(`${darkGray('Command:')} ${purple(command)}`);
199
+ clack.log.info(`${gray('Command:')} ${purple(command)}`);
200
200
  for (let tsconfig of selectedTsconfigs) {
201
201
  tsconfig = resolvePath(tsconfig);
202
202
  tsconfigAndLanguages.set(tsconfig, language ? [language] : []);
@@ -245,7 +245,7 @@ class Project {
245
245
  const searchGlob = process.argv[i];
246
246
  const tsconfigs = glob.sync(searchGlob);
247
247
  if (!tsconfigs.length) {
248
- clack.log.error(lightRed(`No projects found for ${projectFlag} ${searchGlob}.`));
248
+ clack.log.error(red(`No projects found for ${projectFlag} ${searchGlob}.`));
249
249
  process.exit(1);
250
250
  }
251
251
  for (let tsconfig of tsconfigs) {
@@ -259,7 +259,7 @@ class Project {
259
259
  }
260
260
  }
261
261
  if (!foundArg) {
262
- clack.log.error(lightRed(`Missing argument for ${projectFlag}.`));
262
+ clack.log.error(red(`Missing argument for ${projectFlag}.`));
263
263
  process.exit(1);
264
264
  }
265
265
  }
@@ -278,7 +278,7 @@ class Project {
278
278
  allFilesNum += project.fileNames.length;
279
279
  }
280
280
  if (allFilesNum === 0) {
281
- (spinner?.stop ?? clack.log.message)(lightYellow('No input files.'));
281
+ (spinner?.stop ?? clack.log.message)(yellow('No input files.'));
282
282
  process.exit(1);
283
283
  }
284
284
  if (isTTY || threads >= 2) {
@@ -290,33 +290,33 @@ class Project {
290
290
  await startWorker(worker.createLocal());
291
291
  }
292
292
  (spinner?.stop ?? clack.log.message)(cached
293
- ? darkGray(`Processed ${processed} files with cache. (Use `) + cyan(`--force`) + darkGray(` to ignore cache.)`)
294
- : darkGray(`Processed ${processed} files.`));
293
+ ? gray(`Processed ${processed} files with cache. (Use `) + cyan(`--force`) + gray(` to ignore cache.)`)
294
+ : gray(`Processed ${processed} files.`));
295
295
  const projectsFlag = process.argv.find(arg => arg.endsWith('-projects'));
296
296
  if (projectsFlag) {
297
- clack.log.warn(darkGray(`Please use `)
297
+ clack.log.warn(gray(`Please use `)
298
298
  + cyan(`${projectsFlag.slice(0, -1)}`)
299
- + darkGray(` instead of `)
299
+ + gray(` instead of `)
300
300
  + cyan(`${projectsFlag}`)
301
- + darkGray(` starting from version 1.5.0.`));
301
+ + gray(` starting from version 1.5.0.`));
302
302
  }
303
303
  const data = [
304
- [passed, 'passed', lightGreen],
305
- [errors, 'errors', lightRed],
306
- [warnings, 'warnings', lightYellow],
307
- [messages, 'messages', lightBlue],
308
- [suggestions, 'suggestions', darkGray],
309
- [excluded, 'excluded', darkGray],
304
+ [passed, 'passed', green],
305
+ [errors, 'errors', red],
306
+ [warnings, 'warnings', yellow],
307
+ [messages, 'messages', blue],
308
+ [suggestions, 'suggestions', gray],
309
+ [excluded, 'excluded', gray],
310
310
  ];
311
311
  let summary = data
312
312
  .filter(([count]) => count)
313
313
  .map(([count, label, color]) => color(`${count} ${label}`))
314
- .join(darkGray(' | '));
314
+ .join(gray(' | '));
315
315
  if (hasFix) {
316
- summary += darkGray(` (Use `) + cyan(`--fix`) + darkGray(` to apply automatic fixes.)`);
316
+ summary += gray(` (Use `) + cyan(`--fix`) + gray(` to apply automatic fixes.)`);
317
317
  }
318
318
  else if (errors || warnings || messages) {
319
- summary += darkGray(` (No fixes available.)`);
319
+ summary += gray(` (No fixes available.)`);
320
320
  }
321
321
  clack.outro(summary);
322
322
  process.exit((errors || messages) ? 1 : 0);
@@ -423,7 +423,7 @@ class Project {
423
423
  }
424
424
  async function getBuiltConfig(configFile) {
425
425
  if (!builtConfigs.has(configFile)) {
426
- builtConfigs.set(configFile, core.buildConfig(configFile, ts.sys.createHash, spinner, (s, code) => log(darkGray(s), code)));
426
+ builtConfigs.set(configFile, core.buildConfig(configFile, ts.sys.createHash, spinner, (s, code) => log(gray(s), code)));
427
427
  }
428
428
  return await builtConfigs.get(configFile);
429
429
  }
@@ -439,14 +439,14 @@ class Project {
439
439
  let msg;
440
440
  if (processFiles.size === 0) {
441
441
  if (nextFileName) {
442
- msg = darkGray(`[${processed + processFiles.size}/${allFilesNum}] ${path.relative(process.cwd(), nextFileName)}`);
442
+ msg = gray(`[${processed + processFiles.size}/${allFilesNum}] ${path.relative(process.cwd(), nextFileName)}`);
443
443
  }
444
444
  }
445
445
  else if (processFiles.size === 1) {
446
- msg = darkGray(`[${processed + processFiles.size}/${allFilesNum}] ${path.relative(process.cwd(), [...processFiles][0])}`);
446
+ msg = gray(`[${processed + processFiles.size}/${allFilesNum}] ${path.relative(process.cwd(), [...processFiles][0])}`);
447
447
  }
448
448
  else {
449
- msg = darkGray(`[${processed + processFiles.size}/${allFilesNum}] Processing ${processFiles.size} files`);
449
+ msg = gray(`[${processed + processFiles.size}/${allFilesNum}] Processing ${processFiles.size} files`);
450
450
  }
451
451
  if (!spinner && isTTY) {
452
452
  spinner = clack.spinner();
@@ -488,7 +488,7 @@ class Project {
488
488
  return require.resolve(p, { paths: [process.cwd()] });
489
489
  }
490
490
  catch {
491
- clack.log.error(lightRed(`No such file: ${p}`));
491
+ clack.log.error(red(`No such file: ${p}`));
492
492
  process.exit(1);
493
493
  }
494
494
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tsslint/cli",
3
- "version": "2.0.3",
3
+ "version": "2.0.4",
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": "2.0.3",
20
- "@tsslint/core": "2.0.3",
19
+ "@tsslint/config": "2.0.4",
20
+ "@tsslint/core": "2.0.4",
21
21
  "@volar/language-core": "~2.4.0",
22
22
  "@volar/language-hub": "0.0.1",
23
23
  "@volar/typescript": "~2.4.0",
@@ -31,5 +31,5 @@
31
31
  "@vue-vine/language-service": "latest",
32
32
  "@vue/language-core": "latest"
33
33
  },
34
- "gitHead": "1950a26843ec8ca974ea4f10efa4b6ad36e2ffbf"
34
+ "gitHead": "6006d07f0f218840a49ae281f074970eed1eddbd"
35
35
  }