Update webpack to v3

This commit is contained in:
Jonathan Cremin 2018-04-13 01:42:16 +01:00
parent e12152f7a8
commit b87476abc9
15 changed files with 3030 additions and 6269 deletions

View file

@ -1,30 +1,11 @@
{ {
"ignore": [ "presets": [
"build-server.js", ["@babel/preset-env", {
"build-client.js", "targets": {
"node": "9.11.1"
},
"modules": "commonjs"
}]
], ],
"plugins": [ "plugins": ["@babel/plugin-proposal-object-rest-spread"]
"syntax-object-rest-spread",
"transform-object-rest-spread",
"transform-es2015-arrow-functions",
"transform-es2015-block-scoped-functions",
"transform-es2015-block-scoping",
"transform-es2015-classes",
"transform-es2015-computed-properties",
"transform-es2015-constants",
"transform-es2015-destructuring",
"transform-es2015-for-of",
"transform-es2015-function-name",
"transform-es2015-literals",
"transform-es2015-modules-commonjs",
"transform-es2015-object-super",
"transform-es2015-parameters",
"transform-es2015-shorthand-properties",
"transform-es2015-spread",
"transform-es2015-sticky-regex",
"transform-es2015-template-literals",
"transform-es2015-typeof-symbol",
"transform-es2015-unicode-regex",
"transform-object-rest-spread",
]
} }

View file

@ -1,4 +1,4 @@
FROM node:8.7.0-alpine FROM node:9.11.1-alpine
WORKDIR /app WORKDIR /app

View file

@ -1,18 +1,9 @@
FROM node:8.7.0-alpine FROM node:9.11.1-alpine
WORKDIR /app WORKDIR /app
RUN apk add --update git RUN apk add --update git
COPY package.json package.json
COPY yarn.lock yarn.lock
RUN yarn
COPY . .
RUN yarn run build
ENV PORT 3000 ENV PORT 3000
EXPOSE 3000 EXPOSE 3000

View file

@ -11,6 +11,10 @@ help:
.PHONY: start .PHONY: start
start: docker-compose-up watch-frontend ## Start containers and watch frontend start: docker-compose-up watch-frontend ## Start containers and watch frontend
.PHONY: build
build: ## Run `yarn run build`
docker-compose run --rm app yarn run build
.PHONY: test .PHONY: test
test: ## Run tests test: ## Run tests
docker-compose run --rm app yarn test docker-compose run --rm app yarn test
@ -34,3 +38,7 @@ docker-compose-up: ## Start (and create) docker containers
.PHONY: yarn .PHONY: yarn
yarn: ## Update yarn dependencies yarn: ## Update yarn dependencies
docker-compose run --rm app yarn docker-compose run --rm app yarn
.PHONY: shell
shell: ## Run shell
docker-compose run --rm app sh

View file

@ -2,7 +2,9 @@ version: "2"
services: services:
app: app:
build: ./ build:
context: ./
dockerfile: Dockerfile.dev
environment: environment:
DEBUG: "combine.fm*" DEBUG: "combine.fm*"
VUE_ENV: server VUE_ENV: server
@ -20,11 +22,14 @@ services:
AWS_TAG: AWS_TAG:
volumes: volumes:
- ./:/app:cached - ./:/app:cached
- node_modules:/app/node_modules
ports: ports:
- "3000:3000" - "3000:3000"
command: yarn run watch-server command: yarn run watch-server
worker: worker:
build: ./ build:
context: ./
dockerfile: Dockerfile.dev
environment: environment:
DEBUG: "combine.fm*" DEBUG: "combine.fm*"
VUE_ENV: server VUE_ENV: server
@ -42,6 +47,7 @@ services:
AWS_TAG: AWS_TAG:
volumes: volumes:
- ./:/app:cached - ./:/app:cached
- node_modules:/app/node_modules
command: yarn run worker command: yarn run worker
ports: ports:
- "3001:3000" - "3001:3000"
@ -57,3 +63,6 @@ services:
image: "redis:4.0.2-alpine" image: "redis:4.0.2-alpine"
ports: ports:
- "6379:6379" - "6379:6379"
volumes:
node_modules:

View file

@ -15,12 +15,6 @@ export default function (sequelize, DataTypes) {
artistId: DataTypes.INTEGER, artistId: DataTypes.INTEGER,
}, { }, {
paranoid: true, paranoid: true,
classMethods: {
associate: (models) => {
Album.hasMany(models.match);
Album.belongsTo(models.artist);
},
},
indexes: [ indexes: [
{ {
fields: ['externalId', 'service'], fields: ['externalId', 'service'],
@ -33,5 +27,10 @@ export default function (sequelize, DataTypes) {
}, },
}); });
Album.associate = function (models) {
Album.hasMany(models.match);
Album.belongsTo(models.artist);
};
return Album; return Album;
} }

View file

@ -8,12 +8,6 @@ export default function (sequelize, DataTypes) {
artworkLarge: DataTypes.TEXT, artworkLarge: DataTypes.TEXT,
}, { }, {
paranoid: true, paranoid: true,
classMethods: {
associate: (models) => {
Artist.hasMany(models.track);
Artist.hasMany(models.album);
},
},
indexes: [ indexes: [
{ {
fields: ['name'], fields: ['name'],
@ -21,5 +15,10 @@ export default function (sequelize, DataTypes) {
], ],
}); });
Artist.associate = function (models) {
Artist.hasMany(models.track);
Artist.hasMany(models.album);
};
return Artist; return Artist;
} }

View file

@ -11,7 +11,7 @@ export default function (sequelize, DataTypes) {
'itunes', 'itunes',
'spotify', 'spotify',
'xbox', 'xbox',
'youtube' 'youtube',
), ),
name: DataTypes.TEXT, name: DataTypes.TEXT,
streamUrl: DataTypes.TEXT, streamUrl: DataTypes.TEXT,

View file

@ -17,12 +17,6 @@ export default function (sequelize, DataTypes) {
albumName: DataTypes.TEXT, albumName: DataTypes.TEXT,
}, { }, {
paranoid: true, paranoid: true,
classMethods: {
associate: (models) => {
Track.hasMany(models.match);
Track.belongsTo(models.artist);
},
},
indexes: [ indexes: [
{ {
fields: ['externalId', 'service'], fields: ['externalId', 'service'],
@ -35,5 +29,10 @@ export default function (sequelize, DataTypes) {
}, },
}); });
Track.associate = function (models) {
Track.hasMany(models.match);
Track.belongsTo(models.artist);
};
return Track; return Track;
} }

4014
package-lock.json generated

File diff suppressed because it is too large Load diff

View file

@ -4,65 +4,40 @@
"repository": "https://github.com/kudos/match.audio", "repository": "https://github.com/kudos/match.audio",
"license": "MIT", "license": "MIT",
"scripts": { "scripts": {
"build": "webpack -p --config webpack.config.js && webpack -p --config webpack.config.server.js", "build": "webpack -p --config webpack.config.js && webpack --config webpack.config.server.js",
"start": "node -r babel-register app.js", "start": "node -r @babel/register app.js",
"worker": "nodemon -x \"node -r babel-register\" -e js,vue -i node_modules -i chrome/ worker.js", "worker": "nodemon -x \"node -r @babel/register\" -e js,vue -i node_modules -i chrome/ worker.js",
"test": "mocha -r co-mocha --compilers js:babel-register test/**/*.js --timeout=15000", "test": "mocha -r co-mocha --compilers js:@babel/register test/**/*.js --timeout=15000",
"watch": "parallelshell \"npm run watch-js\" \"npm run watch-server\"", "watch": "parallelshell \"npm run watch-js\" \"npm run watch-server\"",
"watch-js": "parallelshell \"webpack -w -d --config webpack.config.js\" \"webpack -w -d --config webpack.config.server.js\"", "watch-js": "parallelshell \"webpack -w -d --config webpack.config.js\" \"webpack -w --config webpack.config.server.js\"",
"watch-server": "nodemon -x \"node -r babel-register\" -e js,vue -i node_modules -i chrome/ app.js", "watch-server": "nodemon -x \"node -r @babel/register\" -e js,vue -i node_modules -i chrome/ app.js",
"heroku-postbuild": "npm run build", "heroku-postbuild": "npm run build",
"initdb": "node -r babel-register test/initdb.js" "initdb": "node -r @babel/register test/initdb.js"
}, },
"engines": { "engines": {
"node": "^8.6.0" "node": "^9.11.1"
}, },
"dependencies": { "dependencies": {
"@babel/cli": "^7.0.0-beta.44",
"@babel/core": "^7.0.0-beta.44",
"@babel/plugin-proposal-object-rest-spread": "^7.0.0-beta.44",
"@babel/polyfill": "^7.0.0-beta.44",
"@babel/preset-env": "^7.0.0-beta.44",
"@babel/register": "^7.0.0-beta.44",
"amazon-product-api": "^0.4.4", "amazon-product-api": "^0.4.4",
"apple-music-jwt": "^0.1.2", "apple-music-jwt": "^0.2.0",
"babel": "^6.1.18", "babel-loader": "^8.0.0-beta.2",
"babel-cli": "^6.26.0",
"babel-core": "^6.26.0",
"babel-loader": "^7.1.2",
"babel-plugin-syntax-jsx": "^6.3.13",
"babel-plugin-syntax-object-rest-spread": "^6.13.0",
"babel-plugin-transform-es2015-arrow-functions": "^6.3.13",
"babel-plugin-transform-es2015-block-scoped-functions": "^6.1.18",
"babel-plugin-transform-es2015-block-scoping": "^6.26.0",
"babel-plugin-transform-es2015-classes": "^6.2.2",
"babel-plugin-transform-es2015-computed-properties": "^6.1.18",
"babel-plugin-transform-es2015-constants": "^6.1.4",
"babel-plugin-transform-es2015-destructuring": "^6.1.18",
"babel-plugin-transform-es2015-for-of": "^6.1.18",
"babel-plugin-transform-es2015-function-name": "^6.1.18",
"babel-plugin-transform-es2015-literals": "^6.1.18",
"babel-plugin-transform-es2015-modules-commonjs": "^6.26.0",
"babel-plugin-transform-es2015-object-super": "^6.1.18",
"babel-plugin-transform-es2015-parameters": "^6.1.18",
"babel-plugin-transform-es2015-shorthand-properties": "^6.1.18",
"babel-plugin-transform-es2015-spread": "^6.1.18",
"babel-plugin-transform-es2015-sticky-regex": "^6.1.18",
"babel-plugin-transform-es2015-template-literals": "^6.1.18",
"babel-plugin-transform-es2015-typeof-symbol": "^6.1.18",
"babel-plugin-transform-es2015-unicode-regex": "^6.1.18",
"babel-plugin-transform-object-assign": "^6.8.0",
"babel-plugin-transform-object-rest-spread": "^6.26.0",
"babel-plugin-transform-remove-strict-mode": "0.0.2",
"babel-preset-es2015": "^6.0.0",
"babel-preset-latest-minimal": "^1.1.2",
"babel-register": "^6.26.0",
"bluebird": "^3.5.1", "bluebird": "^3.5.1",
"bulma": "^0.6.0", "bulma": "^0.6.2",
"co": "~4.6.0", "co": "~4.6.0",
"css-loader": "^0.28.1", "css-loader": "^0.28.11",
"debug": "^2.6.6", "debug": "^3.1.0",
"ejs": "^2.5.7", "ejs": "^2.5.8",
"extract-text-webpack-plugin": "^2.1.0", "extract-text-webpack-plugin": "^3.0.2",
"file-loader": "^0.11.1", "file-loader": "^1.1.11",
"iso8601-duration": "^1.1.1", "iso8601-duration": "^1.1.1",
"json-loader": "^0.5.4", "kcors": "^1.3.3",
"kcors": "^1.0.1", "koa": "^1.6.0",
"koa": "^1.2.1",
"koa-bodyparser": "^2.2.0", "koa-bodyparser": "^2.2.0",
"koa-compress": "~1.0.8", "koa-compress": "~1.0.8",
"koa-favicon": "~1.2.0", "koa-favicon": "~1.2.0",
@ -73,38 +48,37 @@
"koa-views": "^4.0.1", "koa-views": "^4.0.1",
"koa-websocket": "^2.1.0", "koa-websocket": "^2.1.0",
"kue": "^0.11.6", "kue": "^0.11.6",
"moment": "^2.14.1", "moment": "^2.22.0",
"node-uuid": "~1.4.2", "node-uuid": "~1.4.2",
"nodebrainz": "^2.1.1", "nodebrainz": "^2.1.1",
"pg": "^6.1.0", "pg": "^7.4.1",
"playmusic": "^2.3.0", "playmusic": "^2.3.0",
"raven": "^2.1.2", "raven": "^2.5.0",
"sequelize": "^3.24.3", "sequelize": "^4.37.6",
"spotify-web-api-node": "^2.4.0", "spotify-web-api-node": "^3.0.0",
"style-loader": "^0.17.0", "style-loader": "^0.20.3",
"superagent": "^2.1.0", "superagent": "^3.8.2",
"superagent-bluebird-promise": "^3.0.2", "superagent-bluebird-promise": "^4.2.0",
"vue": "^2.3.3", "uglifyjs-webpack-plugin": "^1.2.4",
"vue-loader": "^12.0.4", "vue": "^2.5.16",
"vue-router": "^2.5.3", "vue-loader": "^14.2.2",
"vue-server-renderer": "^2.3.3", "vue-router": "^2.8.1",
"vue-template-compiler": "^2.3.3", "vue-server-renderer": "^2.5.16",
"vuex": "^2.3.1", "vue-template-compiler": "^2.5.16",
"vuex-router-sync": "^4.1.2", "vuex": "^2.5.0",
"webpack": "^2.5.0", "vuex-router-sync": "^4.3.2",
"webpack-stats-plugin": "^0.1.5" "webpack": "^3.11.0",
"webpack-stats-plugin": "^0.2.1"
}, },
"devDependencies": { "devDependencies": {
"babel-plugin-transform-runtime": "^6.15.0", "co-mocha": "^1.2.2",
"babel-runtime": "^6.26.0", "eslint": "^4.19.1",
"co-mocha": "^1.2.1", "eslint-config-airbnb": "^16.1.0",
"eslint": "^4.7.0", "eslint-plugin-import": "^2.11.0",
"eslint-config-airbnb": "^15.1.0",
"eslint-plugin-import": "^2.7.0",
"istanbul": "^0.4.0", "istanbul": "^0.4.0",
"mocha": "^3.5.3", "mocha": "^5.0.5",
"nodemon": "^1.12.1", "nodemon": "^1.17.3",
"parallelshell": "^3.0.2", "parallelshell": "^3.0.2",
"should": "^13.0.1" "should": "^13.2.1"
} }
} }

View file

@ -4,12 +4,12 @@ import * as amazon from '../../lib/services/amazon';
describe('Amazon', function () { describe('Amazon', function () {
describe('lookupId', function () { describe('lookupId', function () {
it('should find album by ID', function* () { it('should find album by ID', function* () {
const result = yield amazon.lookupId('B00WMW3HFY', 'album'); const result = yield amazon.lookupId('B00V8I134A', 'album');
result.name.should.equal('In Colour [Explicit]'); result.name.should.equal('In Colour [Explicit]');
}); });
it('should find track by ID', function* (){ it('should find track by ID', function* (){
const result = yield amazon.lookupId('B00WMW3TUM', 'track'); const result = yield amazon.lookupId('B00V8I1CKU', 'track');
result.name.should.equal('Sleep Sound'); result.name.should.equal('Sleep Sound');
}); });
}); });

View file

@ -1,5 +1,4 @@
const path = require('path'); const path = require('path');
const webpack = require('webpack');
const ExtractTextPlugin = require('extract-text-webpack-plugin'); const ExtractTextPlugin = require('extract-text-webpack-plugin');
const StatsWriterPlugin = require('webpack-stats-plugin').StatsWriterPlugin; const StatsWriterPlugin = require('webpack-stats-plugin').StatsWriterPlugin;
@ -18,29 +17,52 @@ module.exports = {
extensions: ['.js', '.json', '.vue', '.css'], extensions: ['.js', '.json', '.vue', '.css'],
}, },
module: { module: {
loaders: [ rules: [
{ {
test: /\.vue$/, test: /\.vue$/,
use: {
loader: 'vue-loader', loader: 'vue-loader',
options: { options: {
extractCSS: true extractCSS: true,
loaders: {
js: [
{
loader: 'babel-loader',
options: {
babelrc: false,
presets: ['@babel/preset-env'],
plugins: [
require('@babel/plugin-proposal-object-rest-spread'),
],
},
},
]
}
},
}, },
}, },
{ {
test: /\.js$/, test: /\.js$/,
use: {
loader: 'babel-loader', loader: 'babel-loader',
options: {
babelrc: false,
presets: ['@babel/preset-env'],
plugins: [
require('@babel/plugin-proposal-object-rest-spread'),
],
},
},
exclude: /node_modules/, exclude: /node_modules/,
}, },
{ {
test: /\.css$/, test: /\.css$/,
loader: ExtractTextPlugin.extract({ fallback: "style-loader", use: "css-loader" }), loader: ExtractTextPlugin.extract({ fallback: 'style-loader', use: 'css-loader' }),
}, },
], ],
}, },
devtool: '#source-map',
plugins: [ plugins: [
new webpack.optimize.OccurrenceOrderPlugin(), new ExtractTextPlugin('style/[name].[hash:10].css'),
new ExtractTextPlugin("style/[name].[hash:10].css"),
new StatsWriterPlugin({ new StatsWriterPlugin({
fields: ['assets'], fields: ['assets'],
filename: 'manifest.json', filename: 'manifest.json',
@ -51,8 +73,8 @@ module.exports = {
.forEach((file) => { .forEach((file) => {
manifest[file.replace(/\.[a-f0-9]{10}\./, '.')] = file; manifest[file.replace(/\.[a-f0-9]{10}\./, '.')] = file;
}); });
return JSON.stringify(manifest, null, 2) + '\n'; return `${JSON.stringify(manifest, null, 2)}\n`;
} },
}), }),
], ],
}; };

View file

@ -21,24 +21,22 @@ module.exports = {
new webpack.DefinePlugin({ new webpack.DefinePlugin({
'global.GENTLY': false, 'global.GENTLY': false,
}), }),
new webpack.optimize.OccurrenceOrderPlugin(),
], ],
module: { module: {
loaders: [ rules: [
{ {
test: /\.vue$/, test: /\.vue$/,
use: {
loader: 'vue-loader', loader: 'vue-loader',
}, },
},
{ {
test: /\.js$/, test: /\.js$/,
use: {
loader: 'babel-loader', loader: 'babel-loader',
exclude: /node_modules/,
}, },
{ exclude: /node_modules/,
test: /\.json$/,
loader: 'json-loader',
}, },
], ],
}, },
devtool: '#source-map',
}; };

4989
yarn.lock

File diff suppressed because it is too large Load diff