Upgrade all the things.

This commit is contained in:
Jonathan Cremin 2018-04-28 17:55:02 +01:00
parent 95e7eff734
commit 7720653aeb
12 changed files with 728 additions and 784 deletions

View file

@ -6,6 +6,5 @@
}, },
"modules": "commonjs" "modules": "commonjs"
}] }]
], ]
"plugins": ["@babel/plugin-proposal-object-rest-spread"]
} }

View file

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

View file

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

3
app.js
View file

@ -16,7 +16,7 @@ import index from './routes/index';
import recent from './routes/recent'; import recent from './routes/recent';
import search from './routes/search'; import search from './routes/search';
import share from './routes/share'; import share from './routes/share';
import slack from './routes/slack'; import { slack, oauth } from './routes/slack';
import errorHandler from './lib/error-handler'; import errorHandler from './lib/error-handler';
const debug = debuglog('combine.fm'); const debug = debuglog('combine.fm');
@ -60,6 +60,7 @@ app.use(route.get('/:service/:type/:id.:format?', share));
app.use(route.post('/slack', slack)); app.use(route.post('/slack', slack));
app.use(route.get('/slack', slack)); app.use(route.get('/slack', slack));
app.use(route.get('/oauth', oauth));
if (!module.parent) { if (!module.parent) {
app.listen(process.env.PORT || 3000, () => { app.listen(process.env.PORT || 3000, () => {

View file

@ -49,7 +49,7 @@ services:
volumes: volumes:
- ./:/app:cached - ./:/app:cached
- node_modules:/app/node_modules - node_modules:/app/node_modules
command: yarn run worker command: yarn run watch-worker
ports: ports:
- "3001:3000" - "3001:3000"
database: database:

View file

@ -6,40 +6,41 @@
"scripts": { "scripts": {
"build": "webpack --mode=production --config webpack.config.js && webpack --config webpack.config.server.js", "build": "webpack --mode=production --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": "node -r @babel/register worker.js",
"test": "mocha -r co-mocha --compilers js:@babel/register test/**/*.js --timeout=15000", "test": "mocha -r co-mocha -r '@babel/register' test/**/*.js --timeout=15000",
"watch": "parallelshell \"npm run watch-js\" \"npm run watch-server\"", "watch": "concurrently -k \"npm:watch-js\" \"npm:watch-server\"",
"watch-js": "parallelshell \"webpack -w -d --config webpack.config.js\" \"webpack -w --config webpack.config.server.js\"", "watch-js": "concurrently -k -n webpack-frontend,webpack-server \"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",
"watch-worker": "nodemon -x \"node -r @babel/register\" -e js,vue -i node_modules -i chrome/ worker.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": "^9.11.1" "node": "^10.0.0"
}, },
"dependencies": { "dependencies": {
"@babel/cli": "^7.0.0-beta.44", "@babel/cli": "^7.0.0-beta.46",
"@babel/core": "^7.0.0-beta.44", "@babel/core": "^7.0.0-beta.46",
"@babel/plugin-proposal-object-rest-spread": "^7.0.0-beta.44", "@babel/plugin-proposal-object-rest-spread": "^7.0.0-beta.46",
"@babel/polyfill": "^7.0.0-beta.44", "@babel/polyfill": "^7.0.0-beta.46",
"@babel/preset-env": "^7.0.0-beta.44", "@babel/preset-env": "^7.0.0-beta.46",
"@babel/register": "^7.0.0-beta.44", "@babel/register": "^7.0.0-beta.46",
"amazon-product-api": "^0.4.4", "amazon-product-api": "^0.4.4",
"apple-music-jwt": "^0.2.0", "apple-music-jwt": "^0.2.0",
"babel-loader": "^8.0.0-beta.2", "babel-loader": "^8.0.0-beta.2",
"bluebird": "^3.5.1", "bluebird": "^3.5.1",
"bulma": "^0.7.0", "bulma": "^0.7.1",
"co": "~4.6.0", "co": "~4.6.0",
"css-loader": "^0.28.11", "css-loader": "^0.28.11",
"debug": "^3.1.0", "debug": "^3.1.0",
"ejs": "^2.5.8", "ejs": "^2.5.9",
"extract-text-webpack-plugin": "^4.0.0-beta.0", "extract-text-webpack-plugin": "^4.0.0-beta.0",
"file-loader": "^1.1.11", "file-loader": "^1.1.11",
"iso8601-duration": "^1.1.1", "iso8601-duration": "^1.1.1",
"kcors": "^2.2.1", "kcors": "^2.2.1",
"koa": "^2.5.0", "koa": "^2.5.1",
"koa-bodyparser": "^4.2.0", "koa-bodyparser": "^4.2.0",
"koa-compress": "~2.0.0", "koa-compress": "~3.0.0",
"koa-favicon": "~2.0.1", "koa-favicon": "~2.0.1",
"koa-file-server": "~2.3.1", "koa-file-server": "~2.3.1",
"koa-logger": "~3.2.0", "koa-logger": "~3.2.0",
@ -48,37 +49,37 @@
"koa-views": "^6.1.4", "koa-views": "^6.1.4",
"koa-websocket": "^4.1.0", "koa-websocket": "^4.1.0",
"kue": "^0.11.6", "kue": "^0.11.6",
"moment": "^2.22.0", "moment": "^2.22.1",
"node-uuid": "~1.4.2", "node-uuid": "~1.4.2",
"nodebrainz": "^2.1.1", "nodebrainz": "^2.1.1",
"pg": "^7.4.1", "pg": "^7.4.1",
"playmusic": "^2.3.0", "playmusic": "^2.3.0",
"raven": "^2.5.0", "raven": "^2.6.0",
"sequelize": "^4.37.6", "sequelize": "^4.37.6",
"spotify-web-api-node": "^3.0.0", "spotify-web-api-node": "^3.1.0",
"style-loader": "^0.20.3", "style-loader": "^0.21.0",
"superagent": "^3.8.2", "superagent": "^3.8.2",
"uglifyjs-webpack-plugin": "^1.2.4", "uglifyjs-webpack-plugin": "^1.2.5",
"vue": "^2.5.16", "vue": "^2.5.16",
"vue-loader": "^14.2.2", "vue-loader": "^15.0.4",
"vue-router": "^3.0.1", "vue-router": "^3.0.1",
"vue-server-renderer": "^2.5.16", "vue-server-renderer": "^2.5.16",
"vue-template-compiler": "^2.5.16", "vue-template-compiler": "^2.5.16",
"vuex": "^3.0.1", "vuex": "^3.0.1",
"vuex-router-sync": "^5.0.0", "vuex-router-sync": "^5.0.0",
"webpack": "^4.5.0", "webpack": "^4.6.0",
"webpack-cli": "^2.0.14", "webpack-cli": "^2.0.15",
"webpack-stats-plugin": "^0.2.1" "webpack-stats-plugin": "^0.2.1"
}, },
"devDependencies": { "devDependencies": {
"co-mocha": "^1.2.2", "co-mocha": "^1.2.2",
"concurrently": "^3.5.1",
"eslint": "^4.19.1", "eslint": "^4.19.1",
"eslint-config-airbnb": "^16.1.0", "eslint-config-airbnb": "^16.1.0",
"eslint-plugin-import": "^2.11.0", "eslint-plugin-import": "^2.11.0",
"istanbul": "^0.4.0", "istanbul": "^0.4.0",
"mocha": "^5.0.5", "mocha": "^5.1.1",
"nodemon": "^1.17.3", "nodemon": "^1.17.3",
"parallelshell": "^3.0.2",
"should": "^13.2.1" "should": "^13.2.1"
} }
} }

View file

@ -1,6 +1,6 @@
<template> <template>
<div id="app"> <div id="app">
<div class="header" v-bind:class="{ 'share': $store.state.share }"> <div class="header" v-bind:class="{ 'share': this.$router.currentRoute.path !== '/' }">
<div class="container"> <div class="container">
<h1 class="title"> <h1 class="title">
<router-link to="/" exact> <router-link to="/" exact>

View file

@ -15,9 +15,9 @@ const queue = kue.createQueue({
const slackToken = process.env.SLACK_TOKEN; const slackToken = process.env.SLACK_TOKEN;
export default async function (ctx) { export async function slack(ctx) {
if (ctx.request.method === 'GET') { if (ctx.request.method === 'GET') {
ctx.redirect('https://slack.com/oauth/authorize?client_id=349358389361.349904899522&team=TA9AJBFAM&install_redirect=general&scope=links:read,chat:write:bot'); ctx.redirect('https://slack.com/oauth/authorize?client_id=349358389361.349904899522&install_redirect=general&scope=links:read,chat:write:bot');
return; return;
} }
if (ctx.request.body.challenge) { if (ctx.request.body.challenge) {
@ -56,3 +56,8 @@ export default async function (ctx) {
ctx.body = 'OK'; ctx.body = 'OK';
} }
export async function oauth() {
const { body } = await request.post('https://slack.com/api/oauth.access')
.set('Authorization', `Bearer ${slackToken}`)
.send(payload);
}

View file

@ -22,7 +22,7 @@ describe('Deezer', function(){
it('should find album with various artists by search', function* (){ it('should find album with various artists by search', function* (){
const result = yield deezer.search({type: 'album', artist: {name: 'Various Artists'}, name: 'The Trevor Nelson Collection'}); const result = yield deezer.search({type: 'album', artist: {name: 'Various Artists'}, name: 'The Trevor Nelson Collection'});
result.name.should.equal('The Trevor Nelson Collection'); result.name.should.equal('The Trevor Nelson Collection 3');
}); });
it('should find track by search', function* (){ it('should find track by search', function* (){

View file

@ -1,4 +1,5 @@
const path = require('path'); const path = require('path');
const { VueLoaderPlugin } = require('vue-loader')
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;
@ -63,6 +64,7 @@ module.exports = {
}, },
plugins: [ plugins: [
new ExtractTextPlugin('style/[name].[hash:10].css'), new ExtractTextPlugin('style/[name].[hash:10].css'),
new VueLoaderPlugin(),
new StatsWriterPlugin({ new StatsWriterPlugin({
fields: ['assets'], fields: ['assets'],
filename: 'manifest.json', filename: 'manifest.json',

View file

@ -1,5 +1,6 @@
const path = require('path'); const path = require('path');
const webpack = require('webpack'); const webpack = require('webpack');
const { VueLoaderPlugin } = require('vue-loader')
module.exports = { module.exports = {
mode: "none", mode: "none",
@ -22,22 +23,26 @@ module.exports = {
new webpack.DefinePlugin({ new webpack.DefinePlugin({
'global.GENTLY': false, 'global.GENTLY': false,
}), }),
new VueLoaderPlugin(),
], ],
module: { module: {
rules: [ 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: /\.css$/,
use: [
'vue-style-loader',
'css-loader'
]
}
], ],
}, },
}; };

1417
yarn.lock

File diff suppressed because it is too large Load diff