Skip to content
This repository was archived by the owner on Oct 10, 2022. It is now read-only.

Commit b89a2c1

Browse files
committed
Merge branch 'leonardodino-umd-build'
2 parents 07a1fcb + d8bf61a commit b89a2c1

File tree

4 files changed

+48
-4
lines changed

4 files changed

+48
-4
lines changed

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
node_modules/
22
.nyc_output
3-
coverage
3+
coverage
4+
dist

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,10 @@ Optional `opts` include:
167167
}
168168
```
169169

170+
## UMD Builds
171+
172+
A UMD build is provided for your convenience, however browser support is still experimental. Contributions to improve browser support are welcome.
173+
170174
## Contributing
171175

172176
See [CONTRIBUTING.md](CONTRIBUTING.md) for more info on how to make contributions to this project.

package.json

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,15 @@
1515
"compileEnhancements": false,
1616
"babel": false
1717
},
18+
"unpkg": "./dist/main.js",
19+
"umd:main": "./dist/main.js",
1820
"browser": {
1921
"./src/deploy/index.js": "./src/deploy/index.browser.js"
2022
},
23+
"files": [
24+
"src",
25+
"dist"
26+
],
2127
"bugs": {
2228
"url": "https://github.com/netlify/js-client/issues"
2329
},
@@ -54,8 +60,13 @@
5460
"util.promisify-all": "^1.0.2"
5561
},
5662
"devDependencies": {
63+
"@babel/core": "^7.1.2",
64+
"@babel/plugin-transform-runtime": "^7.1.0",
65+
"@babel/preset-env": "^7.1.0",
66+
"@babel/runtime": "^7.1.2",
5767
"ava": "1.0.0-beta.7",
5868
"babel-eslint": "^9.0.0",
69+
"babel-loader": "^8.0.4",
5970
"body": "^5.1.0",
6071
"coveralls": "^3.0.2",
6172
"dependency-check": "^3.2.1",
@@ -68,7 +79,9 @@
6879
"npm-run-all": "^4.1.3",
6980
"nyc": "^13.0.1",
7081
"prettier": "^1.13.7",
71-
"tape": "^4.9.1"
82+
"rimraf": "^2.6.2",
83+
"webpack": "^4.20.2",
84+
"webpack-cli": "^3.1.2"
7285
},
7386
"engines": {
7487
"node": ">=8.0.0"
@@ -89,13 +102,16 @@
89102
},
90103
"scripts": {
91104
"build": "run-s build:*",
92-
"build:deptree": "depcruise --exclude '^node_modules' --output-type dot src | dot -T svg > site/dist/dependencygraph.svg",
105+
"build:webpack": "webpack",
93106
"ci": "run-s test build",
107+
"deptree": "depcruise --exclude '^node_modules' --output-type dot src | dot -T svg > site/dist/dependencygraph.svg",
108+
"prepublishOnly": "npm run build:webpack",
94109
"report": "nyc report --reporter=text-lcov | coveralls",
95110
"test": "run-s test:*",
96111
"test:ava": "nyc --reporter=lcov ava --verbose && nyc report",
97112
"test:deps": "dependency-check ./package.json --entry \"src/**/!(*.test).js\" --unused --missing --no-dev --no-peer",
98113
"test:lint": "eslint src",
99-
"watch": "nyc --reporter=lcov ava --watch"
114+
"watch": "nyc --reporter=lcov ava --watch",
115+
"clean": "rimraf dist coverage"
100116
}
101117
}

webpack.config.js

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
module.exports = {
2+
mode: 'production',
3+
devtool: 'source-map',
4+
output: {
5+
library: 'NetlifyClient',
6+
libraryTarget: 'umd',
7+
},
8+
module: {
9+
rules: [
10+
{
11+
test: /\.m?js$/,
12+
exclude: /(node_modules|bower_components)/,
13+
use: {
14+
loader: 'babel-loader',
15+
query: {
16+
presets: [['@babel/preset-env', {modules: 'commonjs'}]],
17+
plugins: ['@babel/plugin-transform-runtime'],
18+
},
19+
},
20+
},
21+
],
22+
},
23+
}

0 commit comments

Comments
 (0)