Skip to content

Commit

Permalink
version 0.8.5 (#257)
Browse files Browse the repository at this point in the history
* Run babel only over non-es5 node modules (#256)

* Transpile only non-es5 node_modules

* - Manually specify es6 node_modules
- Switch from terser to uglify

* Fix typo

* fix bad merge commit from master

* update to version 0.8.5

* yarn reinstall for new lock file
  • Loading branch information
cmeisl authored Jun 4, 2019
1 parent 9da44d3 commit 9cc8e2b
Show file tree
Hide file tree
Showing 5 changed files with 180 additions and 36 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,16 +43,16 @@ yarn add bnc-assist
#### Script Tag

The library uses [semantic versioning](https://semver.org/spec/v2.0.0.html).
The current version is 0.8.4.
The current version is 0.8.5.
There are minified and non-minified versions.
Put this script at the top of your `<head>`

```html
<script src="https://assist.blocknative.com/0-8-4/assist.js"></script>
<script src="https://assist.blocknative.com/0-8-5/assist.js"></script>

<!-- OR... -->

<script src="https://assist.blocknative.com/0-8-4/assist.min.js"></script>
<script src="https://assist.blocknative.com/0-8-5/assist.min.js"></script>
```

### Initialize the Library
Expand Down
12 changes: 6 additions & 6 deletions babel.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,12 @@ module.exports = {
}
],
['@babel/plugin-proposal-object-rest-spread'],
['inline-import-data-uri', {
'extensions': [
'.png',
'.jpg'
]
}]
[
'inline-import-data-uri',
{
extensions: ['.png', '.jpg']
}
]
],
env: {
test: {
Expand Down
18 changes: 16 additions & 2 deletions build.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
/* eslint import/no-extraneous-dependencies: 0 */

const { execSync } = require('child_process')
const rollup = require('rollup')
const babel = require('rollup-plugin-babel')
const { eslint } = require('rollup-plugin-eslint')
const resolve = require('rollup-plugin-node-resolve')
const commonjs = require('rollup-plugin-commonjs')
const { terser } = require('rollup-plugin-terser')
const { uglify } = require('rollup-plugin-uglify')
const string = require('rollup-plugin-string')
const json = require('rollup-plugin-json')
const builtins = require('rollup-plugin-node-builtins')
Expand Down Expand Up @@ -39,9 +40,19 @@ const defaultPlugins = [
builtins()
]

function transpileEs5NodeModules() {
// specify any non-es5 modules here
const nonEs5Modules = ['ow', 'punycode']
nonEs5Modules.forEach(m =>
execSync(
`node_modules/.bin/babel node_modules/${m} --out-dir node_modules/${m} --presets=@babel/preset-env`
)
)
}

const inputOptions = min => ({
input: 'src/js/index.js',
plugins: min ? [...defaultPlugins, terser()] : defaultPlugins
plugins: min ? [...defaultPlugins, uglify()] : defaultPlugins
})

const outputOptions = min => ({
Expand All @@ -56,6 +67,9 @@ const outputOptions = min => ({
})

async function build() {
// transpile non-es5 node_modules
transpileEs5NodeModules()

// create a regular bundle
const bundle = await rollup.rollup(inputOptions())
await bundle.write(outputOptions())
Expand Down
5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "bnc-assist",
"version": "0.8.4",
"version": "0.8.5",
"description": "Blocknative Assist js library for Dapp developers",
"main": "lib/assist.min.js",
"scripts": {
Expand Down Expand Up @@ -40,6 +40,7 @@
"web3-core-promievent": "^1.0.0-beta.48"
},
"devDependencies": {
"@babel/cli": "^7.4.4",
"@babel/core": "^7.2.2",
"@babel/plugin-proposal-object-rest-spread": "^7.4.3",
"@babel/plugin-transform-runtime": "^7.1.0",
Expand Down Expand Up @@ -78,7 +79,7 @@
"rollup-plugin-json": "^4.0.0",
"rollup-plugin-node-resolve": "^3.4.0",
"rollup-plugin-string": "^2.0.2",
"rollup-plugin-terser": "^5.0.0",
"rollup-plugin-uglify": "^6.0.2",
"truffle-contract": "^4.0.15",
"web3": "^1.0.0-beta.37"
},
Expand Down
Loading

0 comments on commit 9cc8e2b

Please sign in to comment.