Skip to content

Commit

Permalink
feat: modularize package
Browse files Browse the repository at this point in the history
  • Loading branch information
guidiaz committed Feb 1, 2024
1 parent bfa5696 commit db0b300
Show file tree
Hide file tree
Showing 4 changed files with 45 additions and 5 deletions.
22 changes: 22 additions & 0 deletions .github/workflows/npm-publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# This workflow will run tests using node and then publish a package to GitHub Packages when a release is created
# For more information see: https://help.github.com/actions/language-and-framework-guides/publishing-nodejs-packages

name: Publish NPM package

on:
release:
types: [created]

jobs:
publish-npm:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 18
registry-url: https://registry.npmjs.org/
- run: yarn install
- run: yarn publish
env:
NODE_AUTH_TOKEN: ${{SECRETS.NPM_TOKEN}}
6 changes: 6 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
const addresses = require("./migrations/witnet.addresses.json")
const settings = require("./migrations/witnet.settings")
module.exports = {
addresses,
settings
}
13 changes: 11 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,22 @@
"version": "2.0.1",
"description": "Witnet Solidity Bridge contracts for EVM-compatible chains",
"main": "",
"type": "commonjs",
"export": {
".": "./index.js"
},
"files": [
"build",
"contracts",
"migrations/witnet.*"
],
"scripts": {
"addresses": "node ./scripts/addresses.js 2>&1",
"clean": "npm run clean:build && npm run clean:flattened",
"clean:build": "node ./scripts/clean.js build",
"clean:flattened": "node ./scripts/clean.js flattened",
"compile": "truffle compile --all --network",
"console": "truffle console",
"compile": "npx truffle compile --all --network",
"console": "npx truffle console",
"coverage": "solidity-coverage",
"flatten": "node ./scripts/flatten.js 2>&1",
"flatten:all": "npm run clean && npm run flatten:core && npm run flatten:apps && npm run flatten:libs && npm run flatten:proxy",
Expand Down
9 changes: 6 additions & 3 deletions truffle-config.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,14 @@ if (!settings.networks[realm] || !settings.networks[realm][network]) {
process.exit(1)
}
}
console.info(`

if (realm !== "default") console.info(`
Targetting "${realm.toUpperCase()}" realm
===================${"=".repeat(realm.length)}`)
===================${"=".repeat(realm.length)}
`);

module.exports = {
build_directory: `./build/${realm}/`,
build_directory: `./build/`,
contracts_directory: "./contracts/",
migrations_directory: "./migrations/scripts/",
networks: settings.networks[realm],
Expand Down

0 comments on commit db0b300

Please sign in to comment.