From bae0b6d6ec81de7d8fb8f2ae6c1f335c0ac54ea2 Mon Sep 17 00:00:00 2001 From: David Date: Thu, 21 Jul 2022 15:34:44 +1000 Subject: [PATCH] Copy over only generated types and REST file: index.ts is now custom --- scripts/update-generated-files.sh | 22 +++++++++------------- 1 file changed, 9 insertions(+), 13 deletions(-) diff --git a/scripts/update-generated-files.sh b/scripts/update-generated-files.sh index 303721412..8014bf401 100644 --- a/scripts/update-generated-files.sh +++ b/scripts/update-generated-files.sh @@ -3,22 +3,18 @@ # use provided source path or a default DUALITY_CORE_DIRECTORY="${1:-"../duality"}" -# copy files -cp -r "$DUALITY_CORE_DIRECTORY/vue/src/store/generated/duality/duality.duality/module" \ - "src/generated/duality/duality.duality" +# copy type files +cp -r "$DUALITY_CORE_DIRECTORY/vue/src/store/generated/duality/duality.duality/module/types" \ + "src/lib/web3/generated/duality/duality.duality/module" + +# copy REST API file +cp -r "$DUALITY_CORE_DIRECTORY/vue/src/store/generated/duality/duality.duality/module/rest.ts" \ + "src/lib/web3/generated/duality/duality.duality/module/rest.ts" # copy version info cp -r "$DUALITY_CORE_DIRECTORY/vue/src/store/generated/duality/duality.duality/package.json" \ - "src/generated/duality/duality.duality/package.json" + "src/lib/web3/generated/duality/duality.duality/package.json" # copy readme info cp -r "$DUALITY_CORE_DIRECTORY/vue/src/store/generated/readme.md" \ - "src/generated/readme.md" - -# TODO: fix Starports terrible code -# the follow code should work in some environment?: https://unix.stackexchange.com/questions/26284/how-can-i-use-sed-to-replace-a-multi-line-string#525524 - -REPLACE_THIS="let client;\n if (addr) {\n client = await SigningStargateClient.connectWithSigner(addr, wallet, { registry });\n }else{\n client = await SigningStargateClient.offline( wallet, { registry });\n }" -REPLACE_WITH="const client = addr\n ? await SigningStargateClient.connectWithSigner(addr, wallet, { registry })\n : await SigningStargateClient.offline( wallet, { registry });" - -sed -z "s/$REPLACE_THIS/$REPLACE_WITH/" -i src/generated/duality/duality.duality/module/index.ts + "src/lib/web3/generated/readme.md"