Skip to content

Commit

Permalink
Minifier script
Browse files Browse the repository at this point in the history
  • Loading branch information
atvanguard committed Jun 10, 2020
1 parent 2d0a51b commit 803dd3b
Show file tree
Hide file tree
Showing 233 changed files with 238 additions and 1,413,232 deletions.
10 changes: 8 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ The private static server for Matic.
All files, in this repository, will be served over AWS S3 at `https://static.matic.network/<file-path>`.

### Production
Master branch will be automatically deployed. No other action required.
Master branch will be automatically deployed. No other action required.

## Package Usage

Expand All @@ -26,7 +26,7 @@ const Heimdall = network.Heimdall // all info related to Heimdall

const RootChainABI = network.abi("RootChain")

// use matic js
// use matic js
let matic = new Matic ({
maticProvider: Matic.RPC,
mainProvider: Main.RPC,
Expand All @@ -35,3 +35,9 @@ let matic = new Matic ({
...
})
```


### Before Publishing
```
npm run minify
```
19 changes: 19 additions & 0 deletions minify.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
var fs = require('fs');
var files = fs.readdirSync('network');

const networks = ['mainnet', 'testnet']
networks.forEach(n => {
const versions = fs.readdirSync(`network/${n}`)
versions.forEach(v => {
const artifacts = fs.readdirSync(`network/${n}/${v}/artifacts`)
artifacts.forEach(a => {
const name = `network/${n}/${v}/artifacts/${a}`
const abi = JSON.parse(fs.readFileSync(name)).abi
if (!abi.length) {
fs.unlinkSync(name)
} else {
fs.writeFileSync(name, JSON.stringify({ abi }))
}
})
})
})
Loading

0 comments on commit 803dd3b

Please sign in to comment.