@naturalcycles/dev-lib 13.37.1 → 13.38.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.
package/dist/bin/bt.js CHANGED
@@ -3,13 +3,11 @@
3
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
4
  const nodejs_lib_1 = require("@naturalcycles/nodejs-lib");
5
5
  const script_1 = require("@naturalcycles/nodejs-lib/dist/script");
6
- const tsc_scripts_command_1 = require("../cmd/tsc-scripts.command");
7
6
  const jest_util_1 = require("../util/jest.util");
8
7
  const tsc_util_1 = require("../util/tsc.util");
9
- (0, script_1.runScript)(() => {
8
+ (0, script_1.runScript)(async () => {
10
9
  (0, nodejs_lib_1._emptyDirSync)('./dist'); // it doesn't delete the dir itself, to prevent IDE jumping
11
10
  // fs.rmSync('./dist', { recursive: true, force: true })
12
- (0, tsc_util_1.tsc)(true);
13
- (0, tsc_scripts_command_1.tscScriptsCommand)();
11
+ await (0, tsc_util_1.tscMainAndScripts)(true);
14
12
  (0, jest_util_1.runJest)();
15
13
  });
package/dist/bin/btl.js CHANGED
@@ -4,14 +4,12 @@ Object.defineProperty(exports, "__esModule", { value: true });
4
4
  const nodejs_lib_1 = require("@naturalcycles/nodejs-lib");
5
5
  const script_1 = require("@naturalcycles/nodejs-lib/dist/script");
6
6
  const lint_all_command_1 = require("../cmd/lint-all.command");
7
- const tsc_scripts_command_1 = require("../cmd/tsc-scripts.command");
8
7
  const jest_util_1 = require("../util/jest.util");
9
8
  const tsc_util_1 = require("../util/tsc.util");
10
9
  (0, script_1.runScript)(async () => {
11
10
  await (0, lint_all_command_1.lintAllCommand)();
12
11
  (0, nodejs_lib_1._emptyDirSync)('./dist'); // it doesn't delete the dir itself, to prevent IDE jumping
13
12
  // fs.rmSync('./dist', { recursive: true, force: true })
14
- (0, tsc_util_1.tsc)(true);
15
- (0, tsc_scripts_command_1.tscScriptsCommand)();
13
+ await (0, tsc_util_1.tscMainAndScripts)(true);
16
14
  (0, jest_util_1.runJest)();
17
15
  });
package/dist/bin/build.js CHANGED
@@ -3,11 +3,9 @@
3
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
4
  const nodejs_lib_1 = require("@naturalcycles/nodejs-lib");
5
5
  const script_1 = require("@naturalcycles/nodejs-lib/dist/script");
6
- const tsc_scripts_command_1 = require("../cmd/tsc-scripts.command");
7
6
  const tsc_util_1 = require("../util/tsc.util");
8
- (0, script_1.runScript)(() => {
7
+ (0, script_1.runScript)(async () => {
9
8
  (0, nodejs_lib_1._emptyDirSync)('./dist'); // it doesn't delete the dir itself, to prevent IDE jumping
10
9
  // fs.rmSync('./dist', { recursive: true, force: true })
11
- (0, tsc_util_1.tsc)(true);
12
- (0, tsc_scripts_command_1.tscScriptsCommand)();
10
+ await (0, tsc_util_1.tscMainAndScripts)(true);
13
11
  });
@@ -2,5 +2,5 @@
2
2
  "use strict";
3
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
4
  const script_1 = require("@naturalcycles/nodejs-lib/dist/script");
5
- const tsc_scripts_command_1 = require("../cmd/tsc-scripts.command");
6
- (0, script_1.runScript)(tsc_scripts_command_1.tscScriptsCommand);
5
+ const tsc_util_1 = require("../util/tsc.util");
6
+ (0, script_1.runScript)(tsc_util_1.tscScripts);
@@ -1,4 +1,8 @@
1
+ export declare function tscMainAndScripts(noEmit?: boolean): Promise<void>;
1
2
  export declare function tsc(noEmit?: boolean): void;
3
+ export declare function tscAsync(noEmit?: boolean): Promise<void>;
4
+ export declare function tscScripts(): void;
5
+ export declare function tscScriptsAsync(): Promise<void>;
2
6
  /**
3
7
  * Returns path to /scripts/tsconfig.json
4
8
  */
@@ -1,12 +1,16 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ensureProjectTsconfigScripts = exports.tsc = void 0;
3
+ exports.ensureProjectTsconfigScripts = exports.tscScriptsAsync = exports.tscScripts = exports.tscAsync = exports.tsc = exports.tscMainAndScripts = void 0;
4
4
  const fs = require("node:fs");
5
5
  const js_lib_1 = require("@naturalcycles/js-lib");
6
6
  const colors_1 = require("@naturalcycles/nodejs-lib/dist/colors");
7
7
  const fs_1 = require("@naturalcycles/nodejs-lib/dist/fs");
8
8
  const paths_cnst_1 = require("../cnst/paths.cnst");
9
9
  const exec_util_1 = require("./exec.util");
10
+ async function tscMainAndScripts(noEmit = false) {
11
+ await Promise.all([tscAsync(noEmit), tscScriptsAsync()]);
12
+ }
13
+ exports.tscMainAndScripts = tscMainAndScripts;
10
14
  function tsc(noEmit = false) {
11
15
  const started = Date.now();
12
16
  const args = [noEmit && '--noEmit'].filter(js_lib_1._isTruthy);
@@ -14,6 +18,37 @@ function tsc(noEmit = false) {
14
18
  console.log(`${(0, colors_1.boldGrey)('tsc')} ${(0, colors_1.dimGrey)(`took ` + (0, js_lib_1._since)(started))}`);
15
19
  }
16
20
  exports.tsc = tsc;
21
+ async function tscAsync(noEmit = false) {
22
+ const started = Date.now();
23
+ const args = [noEmit && '--noEmit'].filter(js_lib_1._isTruthy);
24
+ await (0, exec_util_1.execVoidCommand)('tsc', args);
25
+ console.log(`${(0, colors_1.boldGrey)('tsc')} ${(0, colors_1.dimGrey)(`took ` + (0, js_lib_1._since)(started))}`);
26
+ }
27
+ exports.tscAsync = tscAsync;
28
+ function tscScripts() {
29
+ if (!fs.existsSync('./scripts')) {
30
+ // ./scripts folder doesn't exist, skipping
31
+ return;
32
+ }
33
+ const projectTsconfigPath = ensureProjectTsconfigScripts();
34
+ const args = ['-P', projectTsconfigPath, '--noEmit'];
35
+ const started = Date.now();
36
+ (0, exec_util_1.execVoidCommandSync)(`tsc`, args);
37
+ console.log(`${(0, colors_1.boldGrey)('tsc scripts')} ${(0, colors_1.dimGrey)(`took ` + (0, js_lib_1._since)(started))}`);
38
+ }
39
+ exports.tscScripts = tscScripts;
40
+ async function tscScriptsAsync() {
41
+ if (!fs.existsSync('./scripts')) {
42
+ // ./scripts folder doesn't exist, skipping
43
+ return;
44
+ }
45
+ const projectTsconfigPath = ensureProjectTsconfigScripts();
46
+ const args = ['-P', projectTsconfigPath, '--noEmit'];
47
+ const started = Date.now();
48
+ await (0, exec_util_1.execVoidCommand)(`tsc`, args);
49
+ console.log(`${(0, colors_1.boldGrey)('tsc scripts')} ${(0, colors_1.dimGrey)(`took ` + (0, js_lib_1._since)(started))}`);
50
+ }
51
+ exports.tscScriptsAsync = tscScriptsAsync;
17
52
  /**
18
53
  * Returns path to /scripts/tsconfig.json
19
54
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@naturalcycles/dev-lib",
3
- "version": "13.37.1",
3
+ "version": "13.38.0",
4
4
  "scripts": {
5
5
  "prepare": "husky install",
6
6
  "tsn-debug": "tsn testScript.ts",
@@ -1 +0,0 @@
1
- export declare function tscScriptsCommand(): void;
@@ -1,20 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.tscScriptsCommand = void 0;
4
- const fs = require("node:fs");
5
- const js_lib_1 = require("@naturalcycles/js-lib");
6
- const colors_1 = require("@naturalcycles/nodejs-lib/dist/colors");
7
- const exec_util_1 = require("../util/exec.util");
8
- const tsc_util_1 = require("../util/tsc.util");
9
- function tscScriptsCommand() {
10
- if (!fs.existsSync('./scripts')) {
11
- // ./scripts folder doesn't exist, skipping
12
- return;
13
- }
14
- const projectTsconfigPath = (0, tsc_util_1.ensureProjectTsconfigScripts)();
15
- const args = ['-P', projectTsconfigPath, '--noEmit'];
16
- const started = Date.now();
17
- (0, exec_util_1.execVoidCommandSync)(`tsc`, args);
18
- console.log(`${(0, colors_1.boldGrey)('tsc scripts')} ${(0, colors_1.dimGrey)(`took ` + (0, js_lib_1._since)(started))}`);
19
- }
20
- exports.tscScriptsCommand = tscScriptsCommand;