From 522a0508539ac5b8fcc355ca591ebb70533386da Mon Sep 17 00:00:00 2001 From: Pawan Paudel Date: Mon, 18 Mar 2024 00:48:47 +0545 Subject: [PATCH] fix: Sleep for some seconds after new process creation --- src/lib/deploy.ts | 6 +++--- src/lib/load.ts | 6 ++++-- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/src/lib/deploy.ts b/src/lib/deploy.ts index fdcd3de..6fa32e4 100644 --- a/src/lib/deploy.ts +++ b/src/lib/deploy.ts @@ -111,13 +111,13 @@ export async function deployContract({ name, walletPath, contractPath }: DeployA ] const data = '1984' - if (!processId) + if (!processId) { processId = await spawn({ module, signer, tags, data, scheduler }) + await sleep() + } const contractSrc = loadContract(contractPath) - await sleep() - // Load contract to process const messageId = await retry( async () => diff --git a/src/lib/load.ts b/src/lib/load.ts index b2f78d0..956c7e0 100644 --- a/src/lib/load.ts +++ b/src/lib/load.ts @@ -3,6 +3,8 @@ import path from 'node:path' import fs from 'node:fs' import process from 'node:process' + +// @ts-expect-error type missing import createFileTree from 'pretty-file-tree' import chalk from 'chalk' import ora from 'ora' @@ -46,7 +48,7 @@ export function createProjectStructure(mainFile: string, cwd: string) { .map(v => ` ${v}`) .join('\n') - const requiresInMod = findRequires(modules[i].content, cwd) + const requiresInMod = findRequires(modules[i].content!, cwd) requiresInMod.forEach((mod) => { const existingMod = modules.find(m => m.name === mod.name) @@ -78,7 +80,7 @@ export function createProjectStructure(mainFile: string, cwd: string) { return orderedModules } -function findRequires(data: string, cwd: string) { +function findRequires(data: string, cwd: string): Module[] { const requirePattern = /(?<=(require( *)(\n*)(\()?( *)("|'))).*(?=("|'))/g const requiredModules = data.match(requirePattern)?.map( mod => ({