< BACK
Creating an NPM package for smart contract ABI files
Aug 15 2019
Generating index.js
for a static file Node package, for example smart contract ABI files:
#!/bin/sh
set -o errexit -o nounset -o pipefail
cat <<EOF >> index.js
let contracts = {
EOF
for file in ./artifacts/*.json; do
echo " '$(basename $file .json)': require('$file'),"
done >> index.js
cat <<EOF >> index.js
};
module.exports = contracts;
EOF