Skip to content

Commit

Permalink
Update nuxt to 2.5 (#281)
Browse files Browse the repository at this point in the history
* Move API build configuration to API folder

* Update dependencies (WIP)

* Update babel configuration

* Remove unused dependencies

* Disable vuetify-loader, fixes build

* Update and reinstall dependencies again

* Add missing dependency
  • Loading branch information
schneefux committed Apr 4, 2019
1 parent 3763820 commit 12a428f
Show file tree
Hide file tree
Showing 15 changed files with 2,575 additions and 2,356 deletions.
9 changes: 0 additions & 9 deletions .babelrc

This file was deleted.

23 changes: 0 additions & 23 deletions jest.config.js

This file was deleted.

2 changes: 1 addition & 1 deletion netlify.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
[build]
command = "export API_PREFIX=/.netlify/functions/ && export API_URL_BROWSER=$API_PREFIX && npm run generate && npm run build:api"
functions = "dist/server/serverless"
functions = "server/dist/serverless"
2 changes: 1 addition & 1 deletion nuxt.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ export default {
new webpack.ContextReplacementPlugin(/moment[/\\]locale$/, /de/),
],
extractCSS: true,
transpile: ['vuetify/lib'],
transpile: [/^vuetify/],
},

/*
Expand Down
4,803 changes: 2,520 additions & 2,283 deletions package-lock.json

Large diffs are not rendered by default.

45 changes: 19 additions & 26 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,18 @@
"private": true,
"scripts": {
"dev": "nuxt",
"dev:api": "nodemon --watch 'server/**/*.ts' --exec ts-node server/index.ts",
"dev:api": "cd server/ && nodemon -e ts -x ts-node server.ts",
"build": "nuxt build",
"build:api": "webpack --mode production",
"build:api": "cd server/ && webpack --mode production --config webpack.config.js",
"start": "nuxt start",
"start:api": "node dist/server/index.js",
"test": "jest",
"start:api": "node server/dist/server/server.js",
"test": "cd server/ && jest",
"generate": "nuxt generate"
},
"dependencies": {
"@nuxtjs/axios": "^5.4.1",
"@nuxtjs/pwa": "^2.6.0",
"aws-serverless-express": "^3.3.5",
"aws-serverless-express": "^3.3.6",
"cache-manager": "^2.9.0",
"cache-manager-fs-hash": "0.0.7",
"cheerio": "^1.0.0-rc.2",
Expand All @@ -30,57 +30,50 @@
"moment": "^2.24.0",
"moment-timezone": "^0.5.23",
"node-fetch": "^2.3.0",
"nuxt": "^2.4.5",
"vue": "^2.6.9",
"nuxt": "^2.5.1",
"vue": "^2.6.10",
"vue-clipboard2": "^0.3.0",
"vue-css-donut-chart": "^1.0.2",
"vue-lazy-hydration": "^1.0.0-beta.6",
"vue-matomo": "^3.7.0",
"vuetify": "^1.5.6",
"vuetify": "^1.5.9",
"vuex-persist": "^2.0.0"
},
"devDependencies": {
"@babel/core": "^7.3.4",
"@babel/plugin-proposal-class-properties": "^7.3.4",
"@babel/plugin-proposal-object-rest-spread": "^7.3.4",
"@babel/core": "^7.4.3",
"@babel/plugin-proposal-class-properties": "^7.4.0",
"@babel/plugin-proposal-object-rest-spread": "^7.4.3",
"@babel/plugin-transform-object-assign": "^7.2.0",
"@babel/preset-env": "^7.3.4",
"@babel/preset-env": "^7.4.3",
"@mdi/font": "^3.5.95",
"@types/cheerio": "^0.22.11",
"@types/chroma-js": "^1.4.1",
"@types/cors": "^2.8.4",
"@types/express": "^4.16.1",
"@types/jest": "^24.0.11",
"@types/node": "^11.11.3",
"@types/node-fetch": "^2.1.6",
"@vue/test-utils": "^1.0.0-beta.29",
"@types/node": "^11.13.0",
"@types/node-fetch": "^2.1.7",
"babel-core": "^7.0.0-bridge.0",
"babel-eslint": "^10.0.1",
"babel-jest": "^24.5.0",
"babel-loader": "^8.0.5",
"babel-preset-env": "^1.7.0",
"eslint": "^5.15.2",
"eslint": "^5.16.0",
"eslint-loader": "^2.1.2",
"eslint-plugin-vue": "^5.2.2",
"event-stream": ">=4.0.1",
"jest": "^24.5.0",
"jest": "^24.7.0",
"jest-serializer-vue": "^2.0.2",
"netlify-lambda": "^1.4.3",
"node-sass": "^4.11.0",
"nodemon": "^1.18.10",
"sass-loader": "^7.1.0",
"stylus": "^0.54.5",
"stylus-loader": "^3.0.2",
"supertest": "^4.0.2",
"ts-jest": "^24.0.0",
"ts-jest": "^24.0.1",
"ts-loader": "^5.3.3",
"ts-node": "^8.0.3",
"typescript": "^3.3.3333",
"uglifyjs-webpack-plugin": "^2.1.2",
"vue-jest": "^3.0.4",
"vue-template-compiler": "^2.6.9",
"vue-test-utils": "github:vuejs/vue-test-utils#v1.0.0-beta.27",
"typescript": "^3.4.1",
"vuetify-loader": "^1.2.1",
"webpack": "^4.29.6",
"webpack-cli": "^3.3.0"
}
}
5 changes: 3 additions & 2 deletions plugins/vuetify.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import Vue from 'vue';
import Vuetify, { VMenu } from 'vuetify/lib';
import colors from 'vuetify/es5/util/colors';

import moment from 'moment';
import {default as options} from './dayspan.config.js'
import { default as options } from './dayspan.config.js'
import DaySpanVuetify from 'dayspan-vuetify';
import colors from 'vuetify/es5/util/colors';
import { default as LocaleDe } from '~/assets/ds-de.js';

moment.locale('de');
Expand Down
2 changes: 1 addition & 1 deletion process-dev.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
apps:
- name: api-dev
port: 3004
script: ./dist/server/server.js
script: ./server/dist/server.js
instances: 1
watch: false
ignore_watch: ['./api-cache/**', './node_modules/**']
Expand Down
2 changes: 1 addition & 1 deletion process-prod.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
apps:
- name: api-prod
port: 3002
script: ./dist/server/server.js
script: ./server/dist/server.js
instances: 'max'
watch: false
ignore_watch: ['./api-cache/**', './node_modules/**']
Expand Down
2 changes: 1 addition & 1 deletion server/App.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { Event } from './model/v2/SplusEinsModel';
import { ParsedLecture } from './model/v2/SplusModel';

async function splusApiMock(identifier: string, weekOfYear: string) {
const htmlPath = './server/__snapshots__/splus_ibi1_44.html';
const htmlPath = './__snapshots__/splus_ibi1_44.html';
const html = await promisify(readFile)(htmlPath, 'utf8');
const lectures: ParsedLecture[] = new SplusParser(html).getLectures(12);
return lectures.map((lecture : ParsedLecture) => new Event(lecture));
Expand Down
15 changes: 15 additions & 0 deletions server/jest.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
module.exports = {
"moduleNameMapper": {
"^@/(.*)$": "<rootDir>/$1",
},
"moduleFileExtensions": [
"js",
"ts",
"json",
],
"transform": {
"^.+\\.ts$": "ts-jest",
},
"testURL": "http://localhost/",
"testRegex": "(/__tests__/.*|(\\.|/)(test|spec))\\.(jsx?|tsx?)$",
};
File renamed without changes.
2 changes: 1 addition & 1 deletion server/serverless/api.ts → server/serverless.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as awsServerlessExpress from 'aws-serverless-express';
import App from '../App';
import App from './App';

const server = awsServerlessExpress.createServer(new App('/.netlify/functions/api').app); // TODO make this configurable

Expand Down
4 changes: 2 additions & 2 deletions tsconfig.json → server/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{
"compilerOptions": {
"module": "commonjs",
"target": "es5",
"target": "es2017",
"sourceMap": true,
"lib": ["es2015", "es2016", "es2017", "es2018"],
"lib": ["es2017", "es2018"],
"resolveJsonModule": true,
"downlevelIteration": true,
"baseUrl": ".",
Expand Down
15 changes: 10 additions & 5 deletions webpack.config.js → server/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@ const serverlessConfig = {
target: 'node',
devtool: false,
entry: {
api: './server/serverless/api.ts',
api: './serverless.ts',
},
output: {
filename: '[name].js',
path: path.resolve(__dirname, 'dist/server/serverless'),
path: path.resolve(__dirname, './dist/serverless'),
libraryTarget: 'commonjs',
},
module: {
Expand All @@ -19,7 +19,12 @@ const serverlessConfig = {
{
loader: 'babel-loader',
options: {
presets: [ '@babel/preset-env' ],
presets: [
[
'@babel/preset-env',
{ targets: { node: '8.15.0' } },
],
],
plugins: [
'@babel/plugin-proposal-class-properties',
'@babel/plugin-transform-object-assign',
Expand All @@ -41,11 +46,11 @@ const serverConfig = {
mode: process.env.NODE_ENV,
target: 'node',
entry: {
server: './server/index.ts',
server: './server.ts',
},
output: {
filename: '[name].js',
path: path.resolve(__dirname, 'dist/server'),
path: path.resolve(__dirname, './dist/server'),
},
module: {
rules: [ {
Expand Down

0 comments on commit 12a428f

Please sign in to comment.