@naturalcycles/dev-lib 19.25.0 → 19.25.3

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.
@@ -138,7 +138,7 @@ async function bt() {
138
138
  runTest();
139
139
  }
140
140
  async function typecheck() {
141
- await runTSCInFolders(['tsconfig.json', 'scripts/tsconfig.json', 'e2e/tsconfig.json'], ['--noEmit']);
141
+ await runTSCInFolders(['src', 'scripts', 'e2e'], ['--noEmit']);
142
142
  }
143
143
  async function cleanDist() {
144
144
  fs2.emptyDir('./dist'); // it doesn't delete the dir itself, to prevent IDE jumping
@@ -1,11 +1,11 @@
1
1
  export declare function buildProd(): Promise<void>;
2
2
  /**
3
- * Use 'tsconfig.json' to indicate root.
3
+ * Use 'src' to indicate root.
4
4
  */
5
5
  export declare function runTSCInFolders(tsconfigPaths: string[], args?: string[], parallel?: boolean): Promise<void>;
6
6
  /**
7
- * Pass 'tsconfig.json' to run in root.
7
+ * Pass 'src' to run in root.
8
8
  */
9
- export declare function runTSCInFolder(tsconfigPath: string, args?: string[]): Promise<void>;
9
+ export declare function runTSCInFolder(dir: string, args?: string[]): Promise<void>;
10
10
  export declare function runTSCProd(args?: string[]): Promise<void>;
11
11
  export declare function buildCopy(): void;
@@ -1,3 +1,5 @@
1
+ import { existsSync } from 'node:fs';
2
+ import { grey } from '@naturalcycles/nodejs-lib/colors';
1
3
  import { exec2 } from '@naturalcycles/nodejs-lib/exec2';
2
4
  import { fs2 } from '@naturalcycles/nodejs-lib/fs2';
3
5
  import { kpySync } from '@naturalcycles/nodejs-lib/kpy';
@@ -8,7 +10,7 @@ export async function buildProd() {
8
10
  await runTSCProd();
9
11
  }
10
12
  /**
11
- * Use 'tsconfig.json' to indicate root.
13
+ * Use 'src' to indicate root.
12
14
  */
13
15
  export async function runTSCInFolders(tsconfigPaths, args = [], parallel = true) {
14
16
  if (parallel) {
@@ -21,14 +23,22 @@ export async function runTSCInFolders(tsconfigPaths, args = [], parallel = true)
21
23
  }
22
24
  }
23
25
  /**
24
- * Pass 'tsconfig.json' to run in root.
26
+ * Pass 'src' to run in root.
25
27
  */
26
- export async function runTSCInFolder(tsconfigPath, args = []) {
28
+ export async function runTSCInFolder(dir, args = []) {
29
+ let configDir = dir;
30
+ if (dir === 'src') {
31
+ configDir = '';
32
+ }
33
+ const tsconfigPath = [configDir, `tsconfig.json`].filter(Boolean).join('/');
27
34
  if (!fs2.pathExists(tsconfigPath)) {
28
35
  // console.log(`Skipping to run tsc for ${tsconfigPath}, as it doesn't exist`)
29
36
  return;
30
37
  }
31
38
  const tscPath = findPackageBinPath('typescript', 'tsc');
39
+ const cacheLocation = `node_modules/.cache/${dir}.tsbuildinfo`;
40
+ const cacheFound = existsSync(cacheLocation);
41
+ console.log(grey(`tsc ${dir} cache found: ${cacheFound}`));
32
42
  await exec2.spawnAsync(tscPath, {
33
43
  args: ['-P', tsconfigPath, ...args],
34
44
  shell: false,
@@ -37,6 +47,9 @@ export async function runTSCInFolder(tsconfigPath, args = []) {
37
47
  export async function runTSCProd(args = []) {
38
48
  const tsconfigPath = [`./tsconfig.prod.json`].find(p => fs2.pathExists(p)) || 'tsconfig.json';
39
49
  const tscPath = findPackageBinPath('typescript', 'tsc');
50
+ const cacheLocation = `node_modules/.cache/src.tsbuildinfo`;
51
+ const cacheFound = existsSync(cacheLocation);
52
+ console.log(grey(`tsc src cache found: ${cacheFound}`));
40
53
  await exec2.spawnAsync(tscPath, {
41
54
  args: ['-P', tsconfigPath, '--noEmit', 'false', '--noCheck', ...args],
42
55
  shell: false,
package/dist/lint.util.js CHANGED
@@ -9,7 +9,7 @@ import { _filterFalsyValues } from '@naturalcycles/js-lib/object/object.util.js'
9
9
  import { semver2 } from '@naturalcycles/js-lib/semver';
10
10
  import { _truncate } from '@naturalcycles/js-lib/string/string.util.js';
11
11
  import { git2 } from '@naturalcycles/nodejs-lib';
12
- import { boldGrey, dimGrey } from '@naturalcycles/nodejs-lib/colors';
12
+ import { boldGrey, dimGrey, grey } from '@naturalcycles/nodejs-lib/colors';
13
13
  import { exec2 } from '@naturalcycles/nodejs-lib/exec2';
14
14
  import { fs2 } from '@naturalcycles/nodejs-lib/fs2';
15
15
  import { _yargs } from '@naturalcycles/nodejs-lib/yargs';
@@ -122,9 +122,8 @@ async function runESLint(dir, extensions = eslintExtensions.split(','), fix = tr
122
122
  }
123
123
  const eslintPath = findPackageBinPath('eslint', 'eslint');
124
124
  const cacheLocation = `node_modules/.cache/eslint_${dir}`;
125
- if (existsSync(cacheLocation)) {
126
- console.log(boldGrey(`eslint ${dir} cache found`));
127
- }
125
+ const cacheFound = existsSync(cacheLocation);
126
+ console.log(grey(`eslint ${dir} cache found: ${cacheFound}`));
128
127
  await exec2.spawnAsync(eslintPath, {
129
128
  args: [
130
129
  `--config`,
@@ -159,9 +158,8 @@ export function runPrettier(experimentalCli = true) {
159
158
  return;
160
159
  const prettierPath = findPackageBinPath('prettier', 'prettier');
161
160
  const cacheLocation = 'node_modules/.cache/prettier';
162
- if (existsSync(cacheLocation)) {
163
- console.log(boldGrey('prettier cache found'));
164
- }
161
+ const cacheFound = existsSync(cacheLocation);
162
+ console.log(grey(`prettier cache found: ${cacheFound}`));
165
163
  // prettier --write 'src/**/*.{js,ts,css,scss,graphql}'
166
164
  exec2.spawn(prettierPath, {
167
165
  args: [
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@naturalcycles/dev-lib",
3
3
  "type": "module",
4
- "version": "19.25.0",
4
+ "version": "19.25.3",
5
5
  "dependencies": {
6
6
  "@biomejs/biome": "^2",
7
7
  "@commitlint/cli": "^19",