@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.
- package/dist/bin/dev-lib.js +1 -1
- package/dist/build.util.d.ts +3 -3
- package/dist/build.util.js +16 -3
- package/dist/lint.util.js +5 -7
- package/package.json +1 -1
package/dist/bin/dev-lib.js
CHANGED
|
@@ -138,7 +138,7 @@ async function bt() {
|
|
|
138
138
|
runTest();
|
|
139
139
|
}
|
|
140
140
|
async function typecheck() {
|
|
141
|
-
await runTSCInFolders(['
|
|
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
|
package/dist/build.util.d.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
export declare function buildProd(): Promise<void>;
|
|
2
2
|
/**
|
|
3
|
-
* Use '
|
|
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 '
|
|
7
|
+
* Pass 'src' to run in root.
|
|
8
8
|
*/
|
|
9
|
-
export declare function runTSCInFolder(
|
|
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;
|
package/dist/build.util.js
CHANGED
|
@@ -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 '
|
|
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 '
|
|
26
|
+
* Pass 'src' to run in root.
|
|
25
27
|
*/
|
|
26
|
-
export async function runTSCInFolder(
|
|
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
|
-
|
|
126
|
-
|
|
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
|
-
|
|
163
|
-
|
|
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: [
|