From 341dc34a6a743896bb0313e9a3bb66c4750ca64a Mon Sep 17 00:00:00 2001 From: Joel Smith Date: Tue, 24 Sep 2024 10:09:38 -0500 Subject: [PATCH] Cleanup Build Helper --- wormchain/ts-sdk/src/buildHelper.cjs | 62 +++++----------------------- 1 file changed, 11 insertions(+), 51 deletions(-) diff --git a/wormchain/ts-sdk/src/buildHelper.cjs b/wormchain/ts-sdk/src/buildHelper.cjs index df5fccd7b2..500ae4a3fd 100644 --- a/wormchain/ts-sdk/src/buildHelper.cjs +++ b/wormchain/ts-sdk/src/buildHelper.cjs @@ -6,13 +6,7 @@ const { execSync } = require("child_process"); const fs = require("fs"); const path = require("path"); -// const CERTUS_DIRECTORY = -// "../vue/src/store/generated/wormhole-foundation/wormchain/"; -// const COSMOS_DIRECTORY = "../vue/src/store/generated/cosmos/cosmos-sdk/"; -// const WASMD_DIRECTORY = "../vue/src/store/generated/CosmWasm/wasmd/"; - -const VUE_DIRECTORY = "../ts-client/"; //"../vue/src/store/generated/"; - +const VUE_DIRECTORY = "../ts-client/"; const MODULE_DIRECTORY = "../ts-sdk/src/modules/"; function execWrapper(command) { @@ -31,52 +25,18 @@ function execWrapper(command) { }); } -// const certusFiles = fs.readdirSync(CERTUS_DIRECTORY, { withFileTypes: true }); //should only contain directories for the modules -// const cosmosFiles = fs.readdirSync(COSMOS_DIRECTORY, { withFileTypes: true }); -// const wasmdFiles = fs.readdirSync(WASMD_DIRECTORY, { withFileTypes: true }); const vueFiles = fs.readdirSync(VUE_DIRECTORY, { withFileTypes: true }); -// certusFiles.forEach((directory) => { -// execWrapper(`mkdir -p ${MODULE_DIRECTORY + directory.name}/`); -// execWrapper( -// `cp -R ${CERTUS_DIRECTORY + directory.name}/module/* ${ -// MODULE_DIRECTORY + directory.name -// }/` -// ); //move all the files from the vue module into the sdk -// }); - -// cosmosFiles.forEach((directory) => { -// execWrapper(`mkdir -p ${MODULE_DIRECTORY + directory.name}/`); -// execWrapper( -// `cp -R ${COSMOS_DIRECTORY + directory.name}/module/* ${ -// MODULE_DIRECTORY + directory.name -// }/` -// ); //move all the files from the vue module into the sdk -// }); - -// wasmdFiles.forEach((directory) => { -// execWrapper(`mkdir -p ${MODULE_DIRECTORY + directory.name}/`); -// execWrapper( -// `cp -R ${WASMD_DIRECTORY + directory.name}/module/* ${ -// MODULE_DIRECTORY + directory.name -// }/` -// ); //move all the files from the vue module into the sdk -// }); - -vueFiles.forEach((directory) => { - - // check if directory is a folder - if (!directory.isDirectory()) { - return; - } - - execWrapper(`mkdir -p ${MODULE_DIRECTORY + directory.name}/`); - execWrapper( - `cp -R ${VUE_DIRECTORY + directory.name}/* ${ - MODULE_DIRECTORY + directory.name - }/` - ); //move all the files from the vue module into the sdk -}); +// Move all module directories from Ignite's ts-client to the ts-sdk +vueFiles + .filter(directory => directory.isDirectory()) + .forEach((directory) => { + execWrapper(`mkdir -p ${MODULE_DIRECTORY + directory.name}/`); + execWrapper( + `cp -R ${VUE_DIRECTORY + directory.name}/* ${MODULE_DIRECTORY + directory.name + }/` + ); + }); //As of 19.5 javascript isn't emitted //execWrapper(`find ${MODULE_DIRECTORY} -name "*.js" | xargs rm `); //delete all javascript files, so they can be cleanly created based on our tsconfig