Skip to content

Commit

Permalink
Merge pull request #173 from particle-iot/feature/sc-121453/build-lib…
Browse files Browse the repository at this point in the history
…rary-with-webpack

feature/sc-121453/build-library-with-webpack
  • Loading branch information
CarlosHdez authored Sep 22, 2023
2 parents c00db93 + b6b2483 commit 5133387
Show file tree
Hide file tree
Showing 32 changed files with 1,843 additions and 4,266 deletions.
4 changes: 0 additions & 4 deletions .babelrc

This file was deleted.

1 change: 0 additions & 1 deletion EventStream-e2e-browser.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
End-to-end test program for the event stream in the browser
Steps:
- npm run compile
- npm run build
- Replace the path to particle.min.js
- Replace your access token in `auth`
Expand Down
5 changes: 2 additions & 3 deletions EventStream-e2e-node.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,12 @@
End-to-end test program for the event stream with Node
Steps:
- npm run compile
- PARTICLE_API_TOKEN=<my-token> node test/EventStream-e2e-node.js
- PARTICLE_API_TOKEN=<my-token> node EventStream-e2e-node.js
- Follow the scenarios in EventStream.feature
*/

const Particle = require('../lib/Particle');
const Particle = require('./src/Particle');
const baseUrl = process.env.PARTICLE_API_BASE_URL || 'http://localhost:9090';
const auth = process.env.PARTICLE_API_TOKEN;
const particle = new Particle({ baseUrl });
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ The `Agent` integration tests ([source](./test/Agent.integration.js)) depend on
<summary><b>How to write scripts that execute against local code changes?</b></summary>
<p>

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:
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:

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

```
$ npm run compile && npm run build
$ npm run build
```

The `dist` directory will contain the compiled and minified files that can be included in your project.
Expand Down
435 changes: 1 addition & 434 deletions dist/particle.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/particle.min.js.map

Large diffs are not rendered by default.

24 changes: 18 additions & 6 deletions karma.conf.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
// Karma configuration
// Generated on Wed Jul 20 2016 12:00:09 GMT-0400 (EDT)
const webpackConf = require('./webpack.config.js');
const webpack = require('webpack');

module.exports = function karmaCfg(config){
config.set({
Expand All @@ -8,7 +10,7 @@ module.exports = function karmaCfg(config){

// frameworks to use
// available frameworks: https://npmjs.org/browse/keyword/karma-adapter
frameworks: ['browserify', 'mocha', 'chai'],
frameworks: ['webpack', 'mocha', 'chai'],

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

// Transform test files to a single browser consumable file
browserify: {
debug: true, // generate source maps
transform: ['babelify', 'brfs']
webpack: {
mode: 'development',
target: 'web',
devtool: 'inline-source-map',
output: webpackConf.output,
externals: webpackConf.externals,
resolve: webpackConf.resolve,
plugins: [
new webpack.ProvidePlugin({ Buffer: ['buffer', 'Buffer'] }),
new webpack.EnvironmentPlugin({
SKIP_AGENT_TEST: process.env.SKIP_AGENT_TEST || false
})
]
},

// test results reporter to use
Expand Down
Loading

0 comments on commit 5133387

Please sign in to comment.