@naturalcycles/dev-lib 20.30.1 → 20.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.
@@ -39,6 +39,7 @@
39
39
  "prefer-array-find": 2,
40
40
  "prefer-array-flat-map": 2,
41
41
  "prefer-set-has": 2,
42
+ "prefer-const": [2, { "destructuring": "all" }],
42
43
  "no-array-constructor": 2,
43
44
  "no-useless-return": 0, // not useful
44
45
  "no-bitwise": 2,
@@ -238,7 +239,7 @@
238
239
  "onlyIfContainsSeparator": true
239
240
  }
240
241
  ],
241
- "unicorn/prefer-add-event-listener": [2, {}],
242
+ "unicorn/prefer-add-event-listener": 2,
242
243
  "unicorn/prefer-array-index-of": 2,
243
244
  "unicorn/prefer-bigint-literals": 2,
244
245
  "unicorn/prefer-blob-reading-methods": 2,
@@ -250,7 +251,7 @@
250
251
  "unicorn/prefer-logical-operator-over-ternary": 2,
251
252
  "unicorn/prefer-modern-dom-apis": 2,
252
253
  "unicorn/prefer-native-coercion-functions": 2,
253
- "unicorn/prefer-object-from-entries": [2, {}],
254
+ "unicorn/prefer-object-from-entries": 2,
254
255
  "unicorn/prefer-optional-catch-binding": 2,
255
256
  "unicorn/prefer-reflect-apply": 2,
256
257
  "unicorn/prefer-string-raw": 2,
@@ -31,7 +31,7 @@ const commands = [
31
31
  {
32
32
  name: 'build',
33
33
  fn: buildProd,
34
- desc: 'Run "build-copy" then tsc with --emit and --noCheck, using tsconfig.prod.json',
34
+ desc: 'Run "build-copy" then tsgo with --emit and --noCheck, using tsconfig.prod.json',
35
35
  },
36
36
  {
37
37
  name: 'build-copy',
@@ -180,10 +180,10 @@ async function _typecheckWithOxlint() {
180
180
  const fix = !CI;
181
181
  runOxlint(fix);
182
182
  }
183
- async function cleanDist() {
184
- fs2.emptyDir('./dist'); // it doesn't delete the dir itself, to prevent IDE jumping
185
- }
186
183
  async function cleanBuild() {
187
- await cleanDist();
188
- await buildProd();
184
+ cleanDist();
185
+ buildProd();
186
+ }
187
+ function cleanDist() {
188
+ fs2.emptyDir('./dist'); // it doesn't delete the dir itself, to prevent IDE jumping
189
189
  }
@@ -56,7 +56,7 @@ export declare function getActionLintVersion(): SemVerString | undefined;
56
56
  * Returns true if it ran.
57
57
  */
58
58
  export declare function runBiome(fix?: boolean): boolean;
59
- export declare function buildProd(): Promise<void>;
59
+ export declare function buildProd(): void;
60
60
  /**
61
61
  * Uses tsgo if it's installed, otherwise tsc
62
62
  */
@@ -71,7 +71,8 @@ export declare function runTSCInFolders(dirs: string[], args?: string[], paralle
71
71
  * Use 'src' to indicate root.
72
72
  */
73
73
  export declare function runTSGOInFolders(dirs: string[], args?: string[]): Promise<void>;
74
- export declare function runTSCProd(args?: string[]): Promise<void>;
74
+ export declare function runTSCProd(args?: string[]): void;
75
+ export declare function runTSGOProd(args?: string[]): void;
75
76
  export declare function buildCopy(): void;
76
77
  interface RunTestOptions {
77
78
  integration?: boolean;
@@ -341,10 +341,16 @@ export function runBiome(fix = true) {
341
341
  });
342
342
  return true;
343
343
  }
344
- export async function buildProd() {
344
+ export function buildProd() {
345
345
  // fs2.emptyDir('./dist') // it doesn't delete the dir itself, to prevent IDE jumping
346
346
  buildCopy();
347
- await runTSCProd();
347
+ if (hasDependencyInNodeModules('@typescript/native-preview')) {
348
+ // now we trust tsgo to run prod builds
349
+ runTSGOProd();
350
+ }
351
+ else {
352
+ runTSCProd();
353
+ }
348
354
  }
349
355
  /**
350
356
  * Uses tsgo if it's installed, otherwise tsc
@@ -425,10 +431,18 @@ async function runTSGOInFolder(dir, args = []) {
425
431
  shell: false,
426
432
  });
427
433
  }
428
- export async function runTSCProd(args = []) {
434
+ export function runTSCProd(args = []) {
429
435
  const tsconfigPath = [`./tsconfig.prod.json`].find(p => fs2.pathExists(p)) || 'tsconfig.json';
430
436
  const tscPath = findPackageBinPath('typescript', 'tsc');
431
- await exec2.spawnAsync(tscPath, {
437
+ exec2.spawn(tscPath, {
438
+ args: ['-P', tsconfigPath, '--noEmit', 'false', '--noCheck', '--incremental', 'false', ...args],
439
+ shell: false,
440
+ });
441
+ }
442
+ export function runTSGOProd(args = []) {
443
+ const tsconfigPath = [`./tsconfig.prod.json`].find(p => fs2.pathExists(p)) || 'tsconfig.json';
444
+ const tsgoPath = findPackageBinPath('@typescript/native-preview', 'tsgo');
445
+ exec2.spawn(tsgoPath, {
432
446
  args: ['-P', tsconfigPath, '--noEmit', 'false', '--noCheck', '--incremental', 'false', ...args],
433
447
  shell: false,
434
448
  });
@@ -1,2 +1 @@
1
- import type { UnixTimestamp } from '@naturalcycles/js-lib/types';
2
1
  export declare const MOCK_TS_2018_06_21: UnixTimestamp;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@naturalcycles/dev-lib",
3
3
  "type": "module",
4
- "version": "20.30.1",
4
+ "version": "20.31.0",
5
5
  "dependencies": {
6
6
  "@biomejs/biome": "^2",
7
7
  "prompts": "^2",
@@ -21,8 +21,8 @@
21
21
  "@typescript/native-preview": "^7.0.0-0",
22
22
  "eslint": "^9",
23
23
  "husky": "^9",
24
- "stylelint": "^16",
25
- "stylelint-config-standard-scss": "^16",
24
+ "stylelint": "^17",
25
+ "stylelint-config-standard-scss": "^17",
26
26
  "typescript": "^5",
27
27
  "typescript-eslint": "^8"
28
28
  },
@@ -42,6 +42,9 @@
42
42
  "stylelint-config-standard-scss": {
43
43
  "optional": true
44
44
  },
45
+ "typescript": {
46
+ "optional": true
47
+ },
45
48
  "typescript-eslint": {
46
49
  "optional": true
47
50
  }
@@ -49,7 +52,8 @@
49
52
  "devDependencies": {
50
53
  "@types/node": "^25",
51
54
  "@types/prompts": "^2",
52
- "@typescript/native-preview": "^7.0.0-0"
55
+ "@typescript/native-preview": "7.0.0-dev.20260201.1",
56
+ "typescript": "^5"
53
57
  },
54
58
  "exports": {
55
59
  "./cfg/": "./cfg/",