Skip to content

Commit 27fad0d

Browse files
authored
update vue to 2.7, vuetify to v2 (#512)
* update vue, eslint * prettify, update vueify + other dependencies to remove vulnerabilities * add rudimentary dark theme toggler
1 parent 894f68e commit 27fad0d

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

73 files changed

+13415
-24095
lines changed

.babelrc

+9-8
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
11
{
22
"presets": [
3-
["@babel/preset-env", {
4-
"modules": false,
5-
"targets": {
6-
"browsers": ["> 1%", "last 2 versions", "not ie <= 8"]
3+
[
4+
"@babel/preset-env",
5+
{
6+
"modules": false,
7+
"targets": {
8+
"browsers": ["> 1%", "last 2 versions", "not ie <= 8"]
9+
}
710
}
8-
}]
11+
]
912
],
10-
"plugins": [
11-
"transform-es2015-modules-commonjs"
12-
]
13+
"plugins": ["@babel/plugin-transform-modules-commonjs"]
1314
}

.eslintrc

+24-30
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,29 @@
11
{
2-
"plugins": ["jest", "cypress"],
2+
"plugins": ["jest", "cypress", "promise"],
33
"extends": [
4+
"eslint:recommended",
45
"plugin:vue/recommended",
5-
"standard"
6+
"standard",
7+
// "plugin:promise/recommended",
8+
// "plugin:cypress/recommended",
9+
// "plugin:import/recommended",
10+
// "plugin:jest/recommended",
11+
"plugin:vuetify/base",
12+
"plugin:prettier/recommended",
613
],
714
"rules": {
8-
"vue/max-attributes-per-line": [
15+
"prettier/prettier": [
916
"error",
1017
{
11-
"singleline": 5,
12-
"multiline": 1
13-
}
14-
],
15-
"semi": [
16-
2,
17-
"always",
18-
{
19-
"omitLastInOneLineBlock": true
20-
}
18+
"endOfLine": "auto",
19+
},
2120
],
22-
"no-var": 0,
23-
"prefer-const": 1,
24-
"vue/multi-word-component-names": 0,
25-
"vue/no-useless-template-attributes": 0
2621
},
2722
"overrides": [
2823
{
29-
"files": [
30-
"tests/unit/**/*.spec.js"
31-
],
24+
"files": ["tests/unit/**/*.spec.js"],
3225
"env": {
33-
"jest": true
26+
"jest": true,
3427
},
3528
"globals": {
3629
"mount": "readonly",
@@ -42,16 +35,17 @@
4235
"VueRouter": "readonly",
4336
"VueCookies": "readonly",
4437
"BrowserSupportPlugin": "readonly",
45-
"regeneratorRuntime": "readonly"
46-
}
38+
"regeneratorRuntime": "readonly",
39+
},
4740
},
4841
{
49-
"files": [
50-
"tests/e2e/**/*.js"
51-
],
42+
"files": ["tests/e2e/**/*.js"],
5243
"env": {
53-
"cypress/globals": true
54-
}
55-
}
56-
]
44+
"cypress/globals": true,
45+
},
46+
},
47+
],
48+
"parserOptions": {
49+
"sourceType": "module",
50+
},
5751
}

build/webpack.config.dev.js

+87-47
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,43 @@
1-
'use strict'
2-
const webpack = require('webpack')
3-
const { VueLoaderPlugin } = require('vue-loader')
4-
const { resolve } = require('path')
5-
const MiniCssExtractPlugin = require('mini-css-extract-plugin')
6-
const HtmlWebpackPlugin = require('html-webpack-plugin')
7-
const cgi = require('cgi')
1+
"use strict";
2+
const webpack = require("webpack");
3+
const { VueLoaderPlugin } = require("vue-loader");
4+
const { resolve } = require("path");
5+
const MiniCssExtractPlugin = require("mini-css-extract-plugin");
6+
const HtmlWebpackPlugin = require("html-webpack-plugin");
7+
const cgi = require("cgi");
88

99
module.exports = (env) => {
1010
return {
11-
devtool: 'eval-source-map',
12-
entry: [
13-
'@babel/polyfill',
14-
'./src/app.js'
15-
],
11+
devtool: "eval-source-map",
12+
entry: ["@babel/polyfill", "./src/app.js"],
1613
devServer: {
1714
historyApiFallback: true,
1815
hot: true,
1916
static: {
20-
watch: true
17+
watch: true,
18+
},
19+
// onBeforeSetupMiddleware: function (devServer) {
20+
// // Before handing all other dev server requests, check if the route is to the People API middleware and pass
21+
// // it to the CGI handler.
22+
// devServer.app.get('/cgi-bin/people.py', function (req, res) {
23+
// cgi(resolve(__dirname, '..', 'cgi-bin', 'people.py'))(req, res)
24+
// })
25+
// }
26+
setupMiddlewares: (middlewares, devServer) => {
27+
if (!devServer) {
28+
throw new Error("webpack-dev-server is not defined");
29+
}
30+
31+
middlewares.unshift({
32+
name: "handle-people-api",
33+
path: "/cgi-bin/people.py",
34+
middleware: (req, res) => {
35+
cgi(resolve(__dirname, "..", "cgi-bin", "people.py"))(req, res);
36+
},
37+
});
38+
39+
return middlewares;
2140
},
22-
onBeforeSetupMiddleware: function (devServer) {
23-
// Before handing all other dev server requests, check if the route is to the People API middleware and pass
24-
// it to the CGI handler.
25-
devServer.app.get('/cgi-bin/people.py', function (req, res) {
26-
cgi(resolve(__dirname, '..', 'cgi-bin', 'people.py'))(req, res)
27-
})
28-
}
2941
},
3042
module: {
3143
rules: [
@@ -34,53 +46,81 @@ module.exports = (env) => {
3446
// - The first section checks for files of type woff, woff2, ttf, eot, svg.
3547
// - The second part checks for a possible query string indicating version, such as ?v=1.2.3.
3648
test: /\.(woff(2)?|ttf|eot|svg)(\?v=\d+\.\d+\.\d+)?$/,
37-
use: [{
38-
loader: 'file-loader',
39-
options: {
40-
name: '[name].[ext]',
41-
outputPath: './fonts',
42-
publicPath: '../fonts'
43-
}
44-
}]
49+
use: [
50+
{
51+
loader: "file-loader",
52+
options: {
53+
name: "[name].[ext]",
54+
outputPath: "./fonts",
55+
publicPath: "../fonts",
56+
},
57+
},
58+
],
4559
},
4660
{
4761
test: /\.vue$/,
48-
use: [
49-
'vue-loader'
50-
]
62+
use: ["vue-loader"],
5163
},
5264
{
5365
test: /\.css$/,
5466
use: [
5567
{
56-
loader: MiniCssExtractPlugin.loader
68+
loader: MiniCssExtractPlugin.loader,
5769
},
58-
'css-loader'
59-
]
70+
"css-loader",
71+
],
6072
},
6173
{
6274
exclude: /node_modules/,
6375
test: /\.js$/,
64-
use: 'babel-loader'
65-
}
66-
]
76+
use: "babel-loader",
77+
},
78+
{
79+
test: /\.s(c|a)ss$/,
80+
use: [
81+
"vue-style-loader",
82+
"css-loader",
83+
{
84+
loader: "sass-loader",
85+
// // Requires sass-loader@^7.0.0
86+
// options: {
87+
// implementation: require("sass"),
88+
// indentedSyntax: true, // optional
89+
// },
90+
// Requires >= sass-loader@^8.0.0
91+
options: {
92+
implementation: require("sass"),
93+
sassOptions: {
94+
indentedSyntax: true, // optional
95+
},
96+
},
97+
},
98+
],
99+
},
100+
],
67101
},
68102
output: {
69-
publicPath: env.VUE_APP_URL.indexOf('dev') !== -1 ? '/dev/' : '/'
103+
publicPath: env.VUE_APP_URL.indexOf("dev") !== -1 ? "/dev/" : "/",
70104
},
71105
plugins: [
72106
new webpack.HotModuleReplacementPlugin(),
73107
new VueLoaderPlugin(),
74108
new HtmlWebpackPlugin({
75-
filename: 'index.html',
76-
template: 'index.html',
77-
inject: true
109+
filename: "index.html",
110+
template: "index.html",
111+
inject: true,
78112
}),
79113
new MiniCssExtractPlugin({
80-
filename: 'css/app.css'
114+
filename: "css/app.css",
115+
}),
116+
new webpack.DefinePlugin({
117+
"process.env.VUE_APP_URL": JSON.stringify(env.VUE_APP_URL),
81118
}),
82-
new webpack.DefinePlugin({ 'process.env.VUE_APP_URL': JSON.stringify(env.VUE_APP_URL) }),
83-
new webpack.DefinePlugin({ 'process.env.VUE_APP_FIREROAD_URL': JSON.stringify(env.VUE_APP_FIREROAD_URL) })
84-
]
85-
}
86-
}
119+
new webpack.DefinePlugin({
120+
"process.env.VUE_APP_FIREROAD_URL": JSON.stringify(
121+
env.VUE_APP_FIREROAD_URL,
122+
),
123+
}),
124+
],
125+
};
126+
};

cgi-bin/people.py

+20-8
Original file line numberDiff line numberDiff line change
@@ -7,31 +7,43 @@
77

88
args = FieldStorage()
99

10-
error = 'Status: 400 Bad Request\n'
11-
header = 'Content-Type: application/json\n\n'
10+
error = "Status: 400 Bad Request\n"
11+
header = "Content-Type: application/json\n\n"
1212

13-
if 'kerb' not in args:
13+
if "kerb" not in args:
1414
output = {"error": "kerb was not specified"}
1515
header = error + header
1616
else:
1717
c = ConfigParser()
1818
try:
19-
with open(path.join(path.dirname(path.realpath(__file__)), 'credentials.ini')) as fp:
19+
with open(
20+
path.join(path.dirname(path.realpath(__file__)), "credentials.ini")
21+
) as fp:
2022
c.read_file(fp)
21-
response = get('https://mit-people-v3.cloudhub.io/people/v3/people/{0}'.format(args['kerb'].value), headers={'client_id': c['Credentials']['ID'], 'client_secret': c['Credentials']['Secret']})
23+
response = get(
24+
"https://mit-people-v3.cloudhub.io/people/v3/people/{0}".format(
25+
args["kerb"].value
26+
),
27+
headers={
28+
"client_id": c["Credentials"]["ID"],
29+
"client_secret": c["Credentials"]["Secret"],
30+
},
31+
)
2232
if response.status_code != 200:
2333
header = error + header
2434
output = {"error": "could not get user data"}
2535
else:
2636
data = loads(response.text)
27-
if data['item']['affiliations'][0]['type'] != "student":
37+
if data["item"]["affiliations"][0]["type"] != "student":
2838
header = error + header
2939
output = {"error": "user is not a student"}
3040
else:
31-
year = data['item']['affiliations'][0]['classYear']
41+
year = data["item"]["affiliations"][0]["classYear"]
3242
if year == "G":
3343
header = error + header
34-
output = {"error": "user is a graduate student (currently unhandled)"}
44+
output = {
45+
"error": "user is a graduate student (currently unhandled)"
46+
}
3547
else:
3648
year = int(year)
3749
year = year - 1

index.html

+8-5
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,14 @@
1-
<!DOCTYPE html>
1+
<!doctype html>
22
<html>
33
<head>
4-
<meta charset="utf-8">
5-
<meta name="viewport" content="width=device-width,initial-scale=1.0">
6-
<meta name="description" content="CourseRoad is a tool for planning out your classes over your entire time at MIT.
4+
<meta charset="utf-8" />
5+
<meta name="viewport" content="width=device-width,initial-scale=1.0" />
6+
<meta
7+
name="description"
8+
content="CourseRoad is a tool for planning out your classes over your entire time at MIT.
79
It makes it easy to explore different majors and minors, view your progress towards their requirements, and
8-
choose which classes to take when in order to maximize your time at MIT.">
10+
choose which classes to take when in order to maximize your time at MIT."
11+
/>
912
<title>CourseRoad</title>
1013
</head>
1114
<body>

0 commit comments

Comments
 (0)