Skip to content

Commit b9366bb

Browse files
authored
Merge pull request #699 from VenusProtocol/feat/slim-tokens
feat: generate tokens.json in the slim package
2 parents 0d21b55 + b46d51a commit b9366bb

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

.github/prepare_slim_package.sh

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,16 @@
11
# Create a slim folder with the minium content we want, and remove unneeded files
2-
mkdir slim && cp -r artifacts* package.json README.md deployments slim && cd slim
2+
# Generate a JSON list of the tokens from the helpers
3+
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));"
4+
5+
mkdir slim && cp -r artifacts* package.json README.md deployments tokens.json slim && cd slim
36
find deployments -mindepth 1 -depth -not -name "*_addresses.json*" -exec rm -r "{}" +
47
find artifacts -mindepth 1 -depth -not -regex "artifacts/contracts.*" -exec rm -r "{}" +
58
find artifacts-zk -mindepth 1 -depth -not -regex "artifacts-zk/contracts.*" -exec rm -r "{}" +
69
find artifacts -mindepth 1 -depth -regex "artifacts/.*dbg\.json" -exec rm -r "{}" +
710

11+
# Make sure the tokens list is included in the published files
12+
jq '.files |= (. + ["tokens.json"] | unique)' package.json > package.tmp.json && mv package.tmp.json package.json
13+
814
# Add "-slim" to the version in the npm package, keeping the tag "-dev" if it exists
915
jq '.version |= sub("^(?<core>[0-9]+\\.[0-9]+\\.[0-9]+)"; "\(.core)-slim")' package.json > package.tmp.json && mv package.tmp.json package.json
1016

0 commit comments

Comments
 (0)