Skip to content

Commit

Permalink
Merge pull request #4 from GeKorm/master
Browse files Browse the repository at this point in the history
Update Howler, dev dependencies
  • Loading branch information
GeKorm authored Mar 2, 2018
2 parents dfbcdc7 + 93edef2 commit 90534c0
Show file tree
Hide file tree
Showing 11 changed files with 57 additions and 41 deletions.
2 changes: 1 addition & 1 deletion .eslintrc → .eslintrc.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"extends": "airbnb/base",
"extends": ["airbnb-base"],
"env": {
"mocha": true,
"node": true
Expand Down
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ cache:
directories:
- node_modules
node_js:
- "5"
- "6"
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ const soundsData = {
// Alternatively, we can pass a configuration object.
// All valid howler.js options can be used here.
winGame: {
urls: [
src: [
'https://s3.amazonaws.com/bucketName/win_game.mp3',
'https://s3.amazonaws.com/bucketName/win_game.wav'
],
Expand All @@ -68,7 +68,7 @@ const soundsData = {
// - the start time of the sound, in milliseconds
// - the duration of the sound, in milliseconds
jumps: {
urls: [ 'https://s3.amazonaws.com/bucketName/jumps.mp3' ],
src: [ 'https://s3.amazonaws.com/bucketName/jumps.mp3' ],
sprite: {
lowJump: [0, 1000],
longJump: [1000, 2500],
Expand Down
27 changes: 16 additions & 11 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,26 +31,31 @@
"author": "Joshua Comeau <[email protected]>",
"license": "MIT",
"dependencies": {
"howler": "^1.1.28"
"howler": "2.0.4"
},
"devDependencies": {
"babel": "^6.1.18",
"babel-cli": "^6.2.0",
"babel-core": "^6.2.1",
"babel-eslint": "^5.0.0-beta4",
"babel-istanbul": "^0.6.0",
"babel-loader": "^6.2.1",
"babel-plugin-add-module-exports": "^0.1.1",
"babel-eslint": "^7.2.3",
"babel-istanbul": "^0.12.2",
"babel-loader": "^7.1.2",
"babel-plugin-add-module-exports": "^0.2.1",
"babel-plugin-transform-object-assign": "^6.3.13",
"babel-preset-es2015": "^6.1.18",
"babel-preset-stage-0": "^6.1.18",
"chai": "^3.2.0",
"babel-register": "^6.26.0",
"chai": "^4.1.2",
"coveralls": "^2.11.8",
"eslint": "^1.10.3",
"eslint-config-airbnb": "^3.1.0",
"mocha": "^2.2.5",
"sinon": "^1.17.2",
"eslint": "^4.6.1",
"eslint-config-airbnb": "^15.1.0",
"eslint-plugin-import": "^2.7.0",
"jsdom": "^11.2.0",
"jsdom-global": "^3.0.2",
"mocha": "^3.5.2",
"sinon": "^3.2.1",
"sinon-chai": "^2.8.0",
"webpack": "^1.12.11"
"webpack": "^3.5.6",
"whatwg-fetch": "^2.0.3"
}
}
2 changes: 1 addition & 1 deletion src/howler_integration.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ module.exports = {

// Allow strings instead of objects, for when all that is needed is a URL
if ( typeof soundOptions === 'string' ) {
soundOptions = { urls: [soundOptions] };
soundOptions = {src: [soundOptions]};
}

return { ...memo, [name]: new Howl(soundOptions) }
Expand Down
11 changes: 11 additions & 0 deletions test/howlerFixSetup.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
const { HowlerGlobal } = require('howler');
var jsdom = require('jsdom');
// Create a fake DOM for testing with $.ajax
global.window = new jsdom.JSDOM().window;
global.document = window.document;
global.Audio = window.Audio;
global.HTMLElement = window.HTMLElement;
global.HTMLMediaElement = window.HTMLMediaElement;
global.HTMLMediaElement.prototype.load = function () {};

global.HowlerGlobal = HowlerGlobal;
8 changes: 4 additions & 4 deletions test/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@ chai.use(sinonChai);
const soundsData = {
endTurn: 'path/to/sound.mp3',
winGame: {
urls: ['path/to/other_sound.mp3'],
src: ['path/to/other_sound.mp3'],
volume: 0.75
},
allSounds: {
urls: ['sound1.mp3'],
src: ['sound1.mp3'],
sprite: {
boom: [0, 1000],
bang: [1500, 2000],
Expand Down Expand Up @@ -55,14 +55,14 @@ describe('howlerIntegration', () => {

it('set up the URL for endTurn (string-based)', () => {
expected = [ 'path/to/sound.mp3' ];
actual = sounds.endTurn._urls;
actual = sounds.endTurn._src;

expect(expected).to.deep.equal(actual);
});

it('set up the URL for winGame (property-based)', () => {
expected = [ 'path/to/other_sound.mp3' ];
actual = sounds.winGame._urls;
actual = sounds.winGame._src;

expect(expected).to.deep.equal(actual);
});
Expand Down
5 changes: 5 additions & 0 deletions test/mocha.opts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
--require test/howlerFixSetup.js
--compilers js:babel-register
--require jsdom-global/register
--require whatwg-fetch
test/index.js
16 changes: 7 additions & 9 deletions webpack.config.base.js
Original file line number Diff line number Diff line change
@@ -1,23 +1,21 @@
var webpack = require('webpack');

module.exports = {
output: {
library: 'ReduxSounds',
libraryTarget: 'umd'
},

module: {
loaders: [
rules: [
{
test: /\.js$/,
loader: 'babel',
exclude: /node_modules/,
include: /src/
test: /\.js$/,
use: { loader: 'babel-loader' },
exclude: /node_modules/,
include: /src/
}
]
},

resolve: {
extensions: ['', '.js']
extensions: ['.js']
}
}
};
9 changes: 3 additions & 6 deletions webpack.config.development.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@
'use strict';
const webpack = require('webpack');
const baseConfig = require('./webpack.config.base');

var webpack = require('webpack');
var baseConfig = require('./webpack.config.base');

var config = Object.create(baseConfig);
const config = Object.create(baseConfig);

config.plugins = [
new webpack.optimize.OccurrenceOrderPlugin(),
new webpack.DefinePlugin({
'process.env.NODE_ENV': JSON.stringify('development')
})
Expand Down
12 changes: 6 additions & 6 deletions webpack.config.production.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
'use strict';
const webpack = require('webpack');
const baseConfig = require('./webpack.config.base');

var webpack = require('webpack');
var baseConfig = require('./webpack.config.base');

var config = Object.create(baseConfig);
const config = Object.create(baseConfig);

config.plugins = [
new webpack.optimize.OccurrenceOrderPlugin(),
new webpack.LoaderOptionsPlugin({
minimize: true
}),
new webpack.DefinePlugin({
'process.env.NODE_ENV': JSON.stringify('production')
}),
Expand Down

0 comments on commit 90534c0

Please sign in to comment.