Skip to content

Commit 5133387

Browse files
authored
Merge pull request #173 from particle-iot/feature/sc-121453/build-library-with-webpack
feature/sc-121453/build-library-with-webpack
2 parents c00db93 + b6b2483 commit 5133387

32 files changed

+1843
-4266
lines changed

.babelrc

Lines changed: 0 additions & 4 deletions
This file was deleted.

EventStream-e2e-browser.html

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
End-to-end test program for the event stream in the browser
33
44
Steps:
5-
- npm run compile
65
- npm run build
76
- Replace the path to particle.min.js
87
- Replace your access token in `auth`

EventStream-e2e-node.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,12 @@
33
End-to-end test program for the event stream with Node
44
55
Steps:
6-
- npm run compile
7-
- PARTICLE_API_TOKEN=<my-token> node test/EventStream-e2e-node.js
6+
- PARTICLE_API_TOKEN=<my-token> node EventStream-e2e-node.js
87
- Follow the scenarios in EventStream.feature
98
109
*/
1110

12-
const Particle = require('../lib/Particle');
11+
const Particle = require('./src/Particle');
1312
const baseUrl = process.env.PARTICLE_API_BASE_URL || 'http://localhost:9090';
1413
const auth = process.env.PARTICLE_API_TOKEN;
1514
const particle = new Particle({ baseUrl });

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ The `Agent` integration tests ([source](./test/Agent.integration.js)) depend on
5151
<summary><b>How to write scripts that execute against local code changes?</b></summary>
5252
<p>
5353

54-
Source code lives in the `./src` directory and is built for release via the `npm run compile` command. To create a simple script file to test your changes, follow these steps:
54+
Source code lives in the `./src` directory and is built for release via the `npm run build` command. To create a simple script file to test your changes, follow these steps:
5555

5656
1. create a `js` file on your local machine: `touch my-api-test.js` (somewhere outside of the root of this repo)
5757
2. within your test `js` file, init the api client like so:
@@ -123,7 +123,7 @@ There [are many snippets of using Particle API JS on the Documentation website][
123123
Make your changes to the files in the `src` directory, then from the project directory run:
124124

125125
```
126-
$ npm run compile && npm run build
126+
$ npm run build
127127
```
128128

129129
The `dist` directory will contain the compiled and minified files that can be included in your project.

dist/particle.min.js

Lines changed: 1 addition & 434 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/particle.min.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

karma.conf.js

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
// Karma configuration
22
// Generated on Wed Jul 20 2016 12:00:09 GMT-0400 (EDT)
3+
const webpackConf = require('./webpack.config.js');
4+
const webpack = require('webpack');
35

46
module.exports = function karmaCfg(config){
57
config.set({
@@ -8,7 +10,7 @@ module.exports = function karmaCfg(config){
810

911
// frameworks to use
1012
// available frameworks: https://npmjs.org/browse/keyword/karma-adapter
11-
frameworks: ['browserify', 'mocha', 'chai'],
13+
frameworks: ['webpack', 'mocha', 'chai'],
1214

1315
// list of files / patterns to load in the browser
1416
files: [
@@ -24,14 +26,24 @@ module.exports = function karmaCfg(config){
2426
// preprocess matching files before serving them to the browser
2527
// available preprocessors: https://npmjs.org/browse/keyword/karma-preprocessor
2628
preprocessors: {
27-
'src/**/*.js': ['browserify'],
28-
'test/**/*.js': ['browserify']
29+
'src/**/*.js': ['webpack'],
30+
'test/**/*.js': ['webpack']
2931
},
3032

3133
// Transform test files to a single browser consumable file
32-
browserify: {
33-
debug: true, // generate source maps
34-
transform: ['babelify', 'brfs']
34+
webpack: {
35+
mode: 'development',
36+
target: 'web',
37+
devtool: 'inline-source-map',
38+
output: webpackConf.output,
39+
externals: webpackConf.externals,
40+
resolve: webpackConf.resolve,
41+
plugins: [
42+
new webpack.ProvidePlugin({ Buffer: ['buffer', 'Buffer'] }),
43+
new webpack.EnvironmentPlugin({
44+
SKIP_AGENT_TEST: process.env.SKIP_AGENT_TEST || false
45+
})
46+
]
3547
},
3648

3749
// test results reporter to use

0 commit comments

Comments
 (0)