Switch to esbuild & NodeJS 18

- Replace Axios with `fetch` api
- Update dependencies

Signed-off-by: Knut Ahlers <knut@ahlers.me>
This commit is contained in:
Knut Ahlers 2023-06-10 14:50:21 +02:00
parent ea631beeef
commit d3ca12fa35
No known key found for this signature in database
GPG key ID: D91C3E91E4CAD6F5
16 changed files with 4517 additions and 7986 deletions

View file

@ -1,89 +0,0 @@
// https://eslint.org/docs/user-guide/configuring
module.exports = {
'root': true,
'parserOptions': {
parser: 'babel-eslint',
sourceType: 'module',
},
'env': {
node: true,
},
'extends': [
/*
* https://github.com/vuejs/eslint-plugin-vue#priority-a-essential-error-prevention
* consider switching to `plugin:vue/strongly-recommended` or `plugin:vue/recommended` for stricter rules.
*/
'plugin:vue/recommended',
// https://github.com/standard/standard/blob/master/docs/RULES-en.md
'eslint:recommended',
],
// required to lint *.vue files
'plugins': ['vue'],
'globals': {
locale: true,
process: true,
version: true,
},
// add your custom rules here
'rules': {
'array-bracket-newline': ['error', { multiline: true }],
'array-bracket-spacing': ['error'],
'arrow-body-style': ['error', 'as-needed'],
'arrow-parens': ['error', 'as-needed'],
'arrow-spacing': ['error', { before: true, after: true }],
'block-spacing': ['error'],
'brace-style': ['error', '1tbs'],
'comma-dangle': ['error', 'always-multiline'], // Apply Contentflow rules
'comma-spacing': ['error'],
'comma-style': ['error', 'last'],
'curly': ['error'],
'dot-location': ['error', 'property'],
'dot-notation': ['error'],
'eol-last': ['error', 'always'],
'eqeqeq': ['error', 'always', { 'null': 'ignore' }],
'func-call-spacing': ['error', 'never'],
'function-paren-newline': ['error', 'multiline'],
'generator-star-spacing': ['off'], // allow async-await
'implicit-arrow-linebreak': ['error'],
'indent': ['error', 2],
'key-spacing': ['error', { beforeColon: false, afterColon: true, mode: 'strict' }],
'keyword-spacing': ['error'],
'linebreak-style': ['error', 'unix'],
'lines-between-class-members': ['error'],
'multiline-comment-style': ['warn'],
'newline-per-chained-call': ['error'],
'no-console': ['off'],
'no-debugger': process.env.NODE_ENV === 'production' ? 'error' : 'off', // allow debugger during development
'no-else-return': ['error'],
'no-extra-parens': ['error'],
'no-implicit-coercion': ['error'],
'no-lonely-if': ['error'],
'no-multiple-empty-lines': ['warn', { max: 2, maxEOF: 0, maxBOF: 0 }],
'no-multi-spaces': ['error'],
'no-trailing-spaces': ['error'],
'no-unneeded-ternary': ['error'],
'no-useless-return': ['error'],
'no-whitespace-before-property': ['error'],
'object-curly-newline': ['error', { consistent: true }],
'object-curly-spacing': ['error', 'always'],
'object-shorthand': ['error'],
'padded-blocks': ['error', 'never'],
'prefer-arrow-callback': ['error'],
'prefer-const': ['error'],
'prefer-object-spread': ['error'],
'prefer-template': ['error'],
'quote-props': ['error', 'consistent-as-needed', { keywords: true }],
'quotes': ['error', 'single', { allowTemplateLiterals: true }],
'semi': ['error', 'never'],
'space-before-blocks': ['error', 'always'],
'spaced-comment': ['warn', 'always'],
'space-infix-ops': ['error'],
'space-in-parens': ['error', 'never'],
'space-unary-ops': ['error', { words: true, nonwords: false }],
'switch-colon-spacing': ['error'],
'unicode-bom': ['error', 'never'],
'wrap-iife': ['error'],
'yoda': ['error'],
},
}

View file

@ -166,7 +166,6 @@
</template>
<script>
import axios from 'axios'
import crypto from './crypto.js'
const passwordCharset = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'
@ -224,8 +223,17 @@ export default {
.map(n => passwordCharset[n % passwordCharset.length])
.join('')
crypto.enc(this.secret, this.securePassword)
.then(secret => axios.post('api/create', { secret })
.then(secret => fetch('api/create', {
body: JSON.stringify({ secret }),
headers: {
'content-type': 'application/json',
},
method: 'POST',
})
.then(resp => resp.json())
.then(data => ({ data }))
.then(resp => {
console.warn(resp)
this.secretId = resp.data.secret_id
this.secret = ''
@ -269,7 +277,9 @@ export default {
// requestSecret requests the encrypted secret from the backend
requestSecret() {
axios.get(`api/get/${this.secretId}`)
fetch(`api/get/${this.secretId}`)
.then(resp => resp.json())
.then(data => ({ data }))
.then(resp => {
const secret = resp.data.secret
if (!this.securePassword) {

7776
src/package-lock.json generated

File diff suppressed because it is too large Load diff

View file

@ -1,34 +0,0 @@
{
"devDependencies": {
"@babel/core": "^7.15.5",
"@babel/preset-env": "^7.15.4",
"babel-eslint": "^10.1.0",
"babel-loader": "^8.2.2",
"css-loader": "^6.2.0",
"eslint": "^6.0.0",
"eslint-plugin-vue": "^7.17.0",
"node-sass": "^7.0.1",
"sass-loader": "^12.1.0",
"style-loader": "^3.2.1",
"vue-loader": "^15.9.8",
"vue-template-compiler": "^2.6.14",
"webpack": "^5.52.0",
"webpack-cli": "^4.8.0",
"webpack-dev-middleware": "^5.0.0",
"webpack-hot-middleware": "^2.25.0"
},
"name": "ots",
"private": true,
"scripts": {
"build": "webpack --mode=production"
},
"dependencies": {
"axios": "^0.21.4",
"bootstrap": "^4.6.0",
"bootstrap-vue": "^2.21.2",
"bootswatch": "^4.6.0",
"popper.js": "^1.16.1",
"vue": "^2.6.14",
"vue-i18n": "^8.25.0"
}
}

View file

@ -3,12 +3,12 @@ $web-font-path: '';
@import "lato";
:root {
:root {
&[mode="dark"] {
@import "node_modules/bootswatch/dist/darkly/_variables";
@import "node_modules/bootstrap/scss/bootstrap";
@import "node_modules/bootswatch/dist/darkly/_bootswatch";
@import "../node_modules/bootswatch/dist/darkly/_variables";
@import "../node_modules/bootstrap/scss/bootstrap";
@import "../node_modules/bootswatch/dist/darkly/_bootswatch";
.custom-control-input:checked ~ .custom-control-label::before {
border-color: #333;
@ -38,9 +38,9 @@ $web-font-path: '';
}
&[mode="light"] {
@import "node_modules/bootswatch/dist/flatly/_variables";
@import "node_modules/bootstrap/scss/bootstrap";
@import "node_modules/bootswatch/dist/flatly/_bootswatch";
@import "../node_modules/bootswatch/dist/flatly/_variables";
@import "../node_modules/bootstrap/scss/bootstrap";
@import "../node_modules/bootswatch/dist/flatly/_bootswatch";
.footer {
color: #2f2f2f;

View file

@ -1,61 +0,0 @@
const path = require('path')
const webpack = require('webpack')
const VueLoaderPlugin = require('vue-loader/lib/plugin')
module.exports = {
entry: './main.js',
output: {
filename: 'app.js',
path: path.resolve(__dirname, '..', 'frontend'),
},
plugins: [
new webpack.DefinePlugin({
'process.env': {
NODE_ENV: JSON.stringify('production'),
},
}),
new VueLoaderPlugin(),
],
optimization: {
minimize: true,
},
module: {
rules: [
{
test: /\.(s?)css$/,
use: [
'style-loader',
'css-loader',
'sass-loader',
],
},
{
test: /\.js$/,
exclude: /(node_modules|bower_components)/,
use: {
loader: 'babel-loader',
options: {
presets: [['@babel/preset-env', { targets: { browsers: ['>0.25%', 'not ie 11', 'not op_mini all'] } }]],
},
},
},
{
test: /\.vue$/,
loader: 'vue-loader',
},
{
test: /\.woff2/,
type: 'asset/resource',
generator: {
filename: '[name][ext]',
},
},
],
},
}