@naturalcycles/dev-lib 19.30.0 → 19.31.0

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.
@@ -1,5 +1,5 @@
1
1
  import { existsSync } from 'node:fs';
2
- import { grey } from '@naturalcycles/nodejs-lib/colors';
2
+ import { dimGrey } from '@naturalcycles/nodejs-lib/colors';
3
3
  import { exec2 } from '@naturalcycles/nodejs-lib/exec2';
4
4
  import { fs2 } from '@naturalcycles/nodejs-lib/fs2';
5
5
  import { kpySync } from '@naturalcycles/nodejs-lib/kpy';
@@ -38,7 +38,7 @@ export async function runTSCInFolder(dir, args = []) {
38
38
  const tscPath = findPackageBinPath('typescript', 'tsc');
39
39
  const cacheLocation = `node_modules/.cache/${dir}.tsbuildinfo`;
40
40
  const cacheFound = existsSync(cacheLocation);
41
- console.log(grey(`tsc ${dir} cache found: ${cacheFound}`));
41
+ console.log(dimGrey(`${check(cacheFound)} tsc ${dir} cache found: ${cacheFound}`));
42
42
  await exec2.spawnAsync(tscPath, {
43
43
  args: ['-P', tsconfigPath, ...args],
44
44
  shell: false,
@@ -49,7 +49,7 @@ export async function runTSCProd(args = []) {
49
49
  const tscPath = findPackageBinPath('typescript', 'tsc');
50
50
  const cacheLocation = `node_modules/.cache/src.tsbuildinfo`;
51
51
  const cacheFound = existsSync(cacheLocation);
52
- console.log(grey(`tsc src cache found: ${cacheFound}`));
52
+ console.log(dimGrey(` tsc src cache found: ${cacheFound}`));
53
53
  await exec2.spawnAsync(tscPath, {
54
54
  args: ['-P', tsconfigPath, '--noEmit', 'false', '--noCheck', ...args],
55
55
  shell: false,
@@ -73,3 +73,6 @@ export function buildCopy() {
73
73
  dotfiles: true,
74
74
  });
75
75
  }
76
+ function check(predicate) {
77
+ return predicate ? '✔️ ' : ' ';
78
+ }
package/dist/lint.util.js CHANGED
@@ -8,7 +8,7 @@ import { _assert } from '@naturalcycles/js-lib/error/assert.js';
8
8
  import { _filterFalsyValues } from '@naturalcycles/js-lib/object/object.util.js';
9
9
  import { semver2 } from '@naturalcycles/js-lib/semver';
10
10
  import { git2 } from '@naturalcycles/nodejs-lib';
11
- import { boldGrey, dimGrey, grey } from '@naturalcycles/nodejs-lib/colors';
11
+ import { boldGrey, dimGrey } from '@naturalcycles/nodejs-lib/colors';
12
12
  import { exec2 } from '@naturalcycles/nodejs-lib/exec2';
13
13
  import { fs2 } from '@naturalcycles/nodejs-lib/fs2';
14
14
  import { _yargs } from '@naturalcycles/nodejs-lib/yargs';
@@ -54,7 +54,7 @@ export async function lintAllCommand() {
54
54
  }
55
55
  runPrettier({ fix });
56
56
  await runKTLint(fix);
57
- console.log(`${boldGrey('lint-all')} ${dimGrey(`took ` + _since(started))}`);
57
+ console.log(`${boldGrey(`${check(true)} lint-all`)} ${dimGrey(`took ` + _since(started))}`);
58
58
  // if (needToTrackChanges) {
59
59
  // const gitStatusAfter = gitStatus()
60
60
  // const hasChanges = gitStatusAfter !== gitStatusAtStart
@@ -110,7 +110,7 @@ export async function eslintAll(opt) {
110
110
  await runESLint(`scripts`, extensions, fix);
111
111
  await runESLint(`e2e`, extensions, fix);
112
112
  }
113
- console.log(`${boldGrey('eslint-all')} ${dimGrey(`took ` + _since(started))}`);
113
+ console.log(`${boldGrey(`${check(true)} eslint-all`)} ${dimGrey(`took ` + _since(started))}`);
114
114
  }
115
115
  async function runESLint(dir, extensions = eslintExtensions.split(','), fix = true) {
116
116
  let configDir = dir;
@@ -126,8 +126,9 @@ async function runESLint(dir, extensions = eslintExtensions.split(','), fix = tr
126
126
  const eslintPath = findPackageBinPath('eslint', 'eslint');
127
127
  const cacheLocation = `node_modules/.cache/eslint_${dir}`;
128
128
  const cacheFound = existsSync(cacheLocation);
129
- console.log(grey(`eslint ${dir} cache found: ${cacheFound}`));
129
+ console.log(dimGrey(`${check(cacheFound)} eslint ${dir} cache found: ${cacheFound}`));
130
130
  await exec2.spawnAsync(eslintPath, {
131
+ name: ['eslint', dir, !fix && '--no-fix'].filter(Boolean).join(' '),
131
132
  args: [
132
133
  `--config`,
133
134
  eslintConfigPath,
@@ -166,9 +167,10 @@ export function runPrettier(opt = {}) {
166
167
  const prettierPath = findPackageBinPath('prettier', 'prettier');
167
168
  const cacheLocation = 'node_modules/.cache/prettier';
168
169
  const cacheFound = existsSync(cacheLocation);
169
- console.log(grey(`prettier cache found: ${cacheFound}`));
170
+ console.log(dimGrey(`${check(cacheFound)} prettier cache found: ${cacheFound}`));
170
171
  // prettier --write 'src/**/*.{js,ts,css,scss,graphql}'
171
172
  exec2.spawn(prettierPath, {
173
+ name: fix ? 'prettier' : 'prettier --check',
172
174
  args: [
173
175
  fix ? `--write` : '--check',
174
176
  `--log-level=warn`,
@@ -201,6 +203,7 @@ export function stylelintAll(fix) {
201
203
  return;
202
204
  // stylelint is never hoisted from dev-lib, so, no need to search for its path
203
205
  exec2.spawn('stylelint', {
206
+ name: fix ? 'stylelint' : 'stylelint --no-fix',
204
207
  args: [fix ? `--fix` : '', `--allow-empty-input`, `--config`, config, ...stylelintPaths].filter(Boolean),
205
208
  shell: false,
206
209
  });
@@ -274,6 +277,7 @@ export function runBiome(fix = true) {
274
277
  const biomePath = findPackageBinPath('@biomejs/biome', 'biome');
275
278
  const dirs = [`src`, `scripts`, `e2e`].filter(d => existsSync(d));
276
279
  exec2.spawn(biomePath, {
280
+ name: fix ? 'biome' : 'biome --no-fix',
277
281
  args: [`lint`, fix && '--write', fix && '--unsafe', '--no-errors-on-unmatched', ...dirs].filter(_isTruthy),
278
282
  logFinish: false,
279
283
  shell: false,
@@ -301,3 +305,6 @@ export function findPackageBinPath(pkg, cmd) {
301
305
  const { bin } = fs2.readJson(packageJsonPath);
302
306
  return path.join(path.dirname(packageJsonPath), typeof bin === 'string' ? bin : bin[cmd]);
303
307
  }
308
+ function check(predicate) {
309
+ return predicate ? '✔️ ' : ' ';
310
+ }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@naturalcycles/dev-lib",
3
3
  "type": "module",
4
- "version": "19.30.0",
4
+ "version": "19.31.0",
5
5
  "dependencies": {
6
6
  "@biomejs/biome": "^2",
7
7
  "@commitlint/cli": "^19",