From b46d51afe6b8208d2ce7debaf85dcef74fa8a760 Mon Sep 17 00:00:00 2001 From: Gleiser Oliveira Date: Tue, 14 Jul 2026 11:59:49 -0600 Subject: [PATCH] feat: generate tokens.json in the slim package --- .github/prepare_slim_package.sh | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/.github/prepare_slim_package.sh b/.github/prepare_slim_package.sh index a5102d9b5..06693b614 100644 --- a/.github/prepare_slim_package.sh +++ b/.github/prepare_slim_package.sh @@ -1,10 +1,16 @@ # Create a slim folder with the minium content we want, and remove unneeded files -mkdir slim && cp -r artifacts* package.json README.md deployments slim && cd slim +# Generate a JSON list of the tokens from the helpers +TS_NODE_TRANSPILE_ONLY=1 node_modules/.bin/ts-node --compiler-options '{"module":"commonjs"}' -e "import { tokens } from './helpers/tokens'; require('fs').writeFileSync('tokens.json', JSON.stringify(tokens, null, 2));" + +mkdir slim && cp -r artifacts* package.json README.md deployments tokens.json slim && cd slim find deployments -mindepth 1 -depth -not -name "*_addresses.json*" -exec rm -r "{}" + find artifacts -mindepth 1 -depth -not -regex "artifacts/contracts.*" -exec rm -r "{}" + find artifacts-zk -mindepth 1 -depth -not -regex "artifacts-zk/contracts.*" -exec rm -r "{}" + find artifacts -mindepth 1 -depth -regex "artifacts/.*dbg\.json" -exec rm -r "{}" + +# Make sure the tokens list is included in the published files +jq '.files |= (. + ["tokens.json"] | unique)' package.json > package.tmp.json && mv package.tmp.json package.json + # Add "-slim" to the version in the npm package, keeping the tag "-dev" if it exists jq '.version |= sub("^(?[0-9]+\\.[0-9]+\\.[0-9]+)"; "\(.core)-slim")' package.json > package.tmp.json && mv package.tmp.json package.json