@naturalcycles/nodejs-lib 13.29.0 → 13.30.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.
@@ -40,6 +40,7 @@ function runScript(fn, opt = {}) {
40
40
  void (async () => {
41
41
  try {
42
42
  await fn();
43
+ await (0, js_lib_1.pDelay)(); // to ensure all async operations are completed
43
44
  if (DEBUG_RUN_SCRIPT)
44
45
  logger.log(`runScript promise resolved`);
45
46
  if (!noExit) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@naturalcycles/nodejs-lib",
3
- "version": "13.29.0",
3
+ "version": "13.30.0",
4
4
  "scripts": {
5
5
  "prepare": "husky",
6
6
  "docs-serve": "vuepress dev docs",
@@ -1,4 +1,4 @@
1
- import { setGlobalStringifyFunction } from '@naturalcycles/js-lib'
1
+ import { pDelay, setGlobalStringifyFunction } from '@naturalcycles/js-lib'
2
2
  import type { CommonLogger } from '@naturalcycles/js-lib'
3
3
  import { inspectStringifyFn } from '../string/inspect'
4
4
 
@@ -60,6 +60,8 @@ export function runScript(fn: (...args: any[]) => any, opt: RunScriptOptions = {
60
60
  try {
61
61
  await fn()
62
62
 
63
+ await pDelay() // to ensure all async operations are completed
64
+
63
65
  if (DEBUG_RUN_SCRIPT) logger.log(`runScript promise resolved`)
64
66
 
65
67
  if (!noExit) {