From d41b439a8049e9b9e2f1676a87674dc0edc874b1 Mon Sep 17 00:00:00 2001 From: Florian Dold Date: Fri, 20 Aug 2021 13:06:59 +0200 Subject: [PATCH] fast build Signed-off-by: Florian Dold --- .gitignore | 1 + contrib/build-fast.sh | 70 +++++++++++++++++++++ packages/taler-wallet-embedded/src/index.ts | 6 +- vendor/README | 6 ++ 4 files changed, 80 insertions(+), 3 deletions(-) create mode 100755 contrib/build-fast.sh create mode 100644 vendor/README diff --git a/.gitignore b/.gitignore index 2b2bbf9cb..fce6dacfc 100644 --- a/.gitignore +++ b/.gitignore @@ -5,6 +5,7 @@ lib/ node_modules/ tsconfig.tsbuildinfo .pnpm-store/ +build/ # GNU-style build system /configure diff --git a/contrib/build-fast.sh b/contrib/build-fast.sh new file mode 100755 index 000000000..ec0cd9c28 --- /dev/null +++ b/contrib/build-fast.sh @@ -0,0 +1,70 @@ +#!/usr/bin/env bash + +set -eu +set -x + +export NODE_PATH=vendor:build/node_modules:build + +function build_idb() { + rm -rf packages/idb-bridge/node_modules + idb_dir=build/@gnu-taler/idb-bridge + mkdir -p $idb_dir + esbuild --platform=node --bundle packages/idb-bridge/src/index.ts > $idb_dir/index.js +} + +function build_taler_util() { + taler_util_dir=build/@gnu-taler/taler-util + mkdir -p $taler_util_dir + esbuild --platform=node --bundle packages/taler-util/src/index.node.ts > $taler_util_dir/index.js +} + +function build_fflate() { + fflate_dir=build/fflate + mkdir -p $fflate_dir + esbuild --platform=node --bundle vendor/fflate/src/index.ts > $fflate_dir/index.js +} + +function build_ct() { + ct_dir=build/cancellationtoken + mkdir -p $ct_dir + esbuild --target=es6 --platform=node --bundle vendor/cancellationtoken/src/index.ts > $ct_dir/index.js +} + +function build_wallet_core() { + taler_wallet_core_dir=build/@gnu-taler/taler-wallet-core + + rm -rf packages/taler-wallet-core/node_modules + rm -rf packages/taler-wallet-core/lib + rm -rf packages/taler-wallet-core/dist + + mkdir -p $taler_wallet_core_dir + esbuild --platform=node --bundle packages/taler-wallet-core/src/index.node.ts > $taler_wallet_core_dir/index.js +} + +function build_wallet_embedded() { + taler_wallet_embedded_dir=build/@gnu-taler/taler-wallet-embedded + + mkdir -p $taler_wallet_embedded_dir + esbuild --platform=node --bundle packages/taler-wallet-embedded/src/index.ts > $taler_wallet_embedded_dir/taler-wallet-embedded.js +} + +function build_wallet_cli() { + taler_wallet_cli_dir=build/@gnu-taler/taler-wallet-cli + mkdir -p $taler_wallet_cli_dir + + rm -rf packages/taler-wallet-cli/node_modules + rm -rf packages/taler-wallet-cli/lib + rm -rf packages/taler-wallet-cli/dist + + esbuild --platform=node --bundle packages/taler-wallet-cli/src/index.ts > $taler_wallet_cli_dir/index.js + cp $taler_wallet_cli_dir/index.js $taler_wallet_cli_dir/taler-wallet-cli.js +} + + +build_idb +build_taler_util +build_fflate +build_wallet_core +build_wallet_embedded +build_ct +build_wallet_cli diff --git a/packages/taler-wallet-embedded/src/index.ts b/packages/taler-wallet-embedded/src/index.ts index 604375c73..e01281bc3 100644 --- a/packages/taler-wallet-embedded/src/index.ts +++ b/packages/taler-wallet-embedded/src/index.ts @@ -36,13 +36,13 @@ import { } from "@gnu-taler/taler-wallet-core"; import fs from "fs"; -import { WalletNotification } from "../../taler-wallet-core/node_modules/@gnu-taler/taler-util/lib/notifications.js"; -import { TalerErrorCode } from "../../taler-wallet-core/node_modules/@gnu-taler/taler-util/lib/taler-error-codes.js"; import { CoreApiEnvelope, CoreApiResponse, CoreApiResponseSuccess, -} from "../../taler-wallet-core/node_modules/@gnu-taler/taler-util/lib/walletTypes.js"; + WalletNotification, + TalerErrorCode, +} from "@gnu-taler/taler-util"; export { handleWorkerError, handleWorkerMessage }; diff --git a/vendor/README b/vendor/README new file mode 100644 index 000000000..f2ae93736 --- /dev/null +++ b/vendor/README @@ -0,0 +1,6 @@ +The third-party packages in this directory are managed +via git subtrees. + +They are added like this: + +$ git subtree -P vendor/jed add --squash https://github.com/messageformat/Jed master