diff --git a/.babelrc b/.babelrc new file mode 100644 index 00000000..3900520a --- /dev/null +++ b/.babelrc @@ -0,0 +1,6 @@ +{ + "presets": [['@babel/preset-env', { "targets": { "esmodules": true } }]], + "plugins": [ + ["@babel/plugin-proposal-decorators", { "legacy": true }] + ] +} \ No newline at end of file diff --git a/.eslintrc b/.eslintrc index e883443a..f7aaa550 100644 --- a/.eslintrc +++ b/.eslintrc @@ -1,15 +1,15 @@ { + "parser": "vue-eslint-parser", "parserOptions": { - "parser": "babel-eslint" + "parser": "@babel/eslint-parser", + "sourceType": "module" }, "extends": [ "eslint:recommended", - "plugin:vue/essential" + "plugin:vue/recommended" ], "plugins": [ - "vue", - "html", - "node" + "@babel" ], "env": { "browser": true, @@ -24,6 +24,13 @@ "LM_TOTAL": false }, "rules": { + "vue/html-indent": ["warn", 4, { + "alignAttributesVertically": false + }], + "vue/max-attributes-per-line": "off", + "vue/html-self-closing": "off", + "vue/no-v-html": "off", + "strict": 0, "indent": [0, 4, { "SwitchCase": 1 diff --git a/README.md b/README.md index 4c681801..a20dff15 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ Браузерная онлайн-читалка книг и децентрализованная библиотека. -Читалка ![](https://omnireader.ru/favicon.ico)[OmniReader](https://omnireader.ru) является частью данного проекта, размещенной на VPS: +Читалка [OmniReader](https://omnireader.ru) является частью данного проекта, размещенной на VPS: ![](docs/assets/face.jpg) ![](docs/assets/reader.jpg) @@ -11,7 +11,7 @@ Для разворачивания читалки на чистом VPS с нуля смотрите [docs/omnireader.ru](docs/omnireader.ru/README.md) ## Сборка проекта -Необходима версия node.js не ниже 10. +Необходима версия node.js не ниже 14. ``` $ git clone https://github.com/bookpauk/liberama diff --git a/build/webpack.base.config.js b/build/webpack.base.config.js index e4e902f4..19933ede 100644 --- a/build/webpack.base.config.js +++ b/build/webpack.base.config.js @@ -1,10 +1,15 @@ const path = require('path'); -//const webpack = require('webpack'); -const VueLoaderPlugin = require('vue-loader/lib/plugin'); +const DefinePlugin = require('webpack').DefinePlugin; +const { VueLoaderPlugin } = require('vue-loader'); const clientDir = path.resolve(__dirname, '../client'); module.exports = { + /*resolve: { + alias: { + vue: '@vue/compat' + } + },*/ entry: [`${clientDir}/main.js`], output: { publicPath: '/app/', @@ -14,10 +19,16 @@ module.exports = { rules: [ { test: /\.vue$/, - loader: "vue-loader" + loader: 'vue-loader', + /*options: { + compilerOptions: { + compatConfig: { + MODE: 2 + } + } + }*/ }, { - test: /\.includer$/, resourceQuery: /^\?vue/, use: path.resolve('build/includer.js') }, @@ -25,16 +36,33 @@ module.exports = { test: /\.js$/, loader: 'babel-loader', exclude: /node_modules/, - query: { + options: { + presets: [['@babel/preset-env', { targets: { esmodules: true } }]], plugins: [ - 'syntax-dynamic-import', - 'transform-decorators-legacy', - 'transform-class-properties', -// ["component", { "libraryName": "element-ui", "styleLibraryName": `~${clientDir}/theme` } ] + ['@babel/plugin-proposal-decorators', { legacy: true }] ] } }, { + test: /\.(gif|png)$/, + type: 'asset/inline', + }, + { + test: /\.jpg$/, + type: 'asset/resource', + generator: { + filename: 'images/[name]-[hash:6][ext]' + }, + }, + + { + test: /\.(ttf|eot|woff|woff2)$/, + type: 'asset/resource', + generator: { + filename: 'fonts/[name]-[hash:6][ext]' + }, + }, + /*{ test: /\.gif$/, loader: "url-loader", options: { @@ -61,11 +89,19 @@ module.exports = { options: { name: "fonts/[name]-[hash:6].[ext]" } - }, + },*/ ] }, plugins: [ + new DefinePlugin({ + __VUE_OPTIONS_API__: true, + __VUE_PROD_DEVTOOLS__: false, + __QUASAR_SSR__: false, + __QUASAR_SSR_SERVER__: false, + __QUASAR_SSR_CLIENT__: false, + __QUASAR_VERSION__: false, + }), new VueLoaderPlugin(), ] }; diff --git a/build/webpack.dev.config.js b/build/webpack.dev.config.js index 30cc7f28..f27ee9b3 100644 --- a/build/webpack.dev.config.js +++ b/build/webpack.dev.config.js @@ -1,7 +1,7 @@ const path = require('path'); const webpack = require('webpack'); -const merge = require('webpack-merge'); +const { merge } = require('webpack-merge'); const baseWpConfig = require('./webpack.base.config'); baseWpConfig.entry.unshift('webpack-hot-middleware/client'); @@ -13,7 +13,7 @@ const clientDir = path.resolve(__dirname, '../client'); module.exports = merge(baseWpConfig, { mode: 'development', - devtool: "#inline-source-map", + devtool: 'inline-source-map', output: { path: `${publicDir}/app`, filename: 'bundle.js' @@ -38,6 +38,6 @@ module.exports = merge(baseWpConfig, { template: `${clientDir}/index.html.template`, filename: `${publicDir}/index.html` }), - new CopyWebpackPlugin([{from: `${clientDir}/assets/*`, to: `${publicDir}/`, flatten: true}]) + new CopyWebpackPlugin({patterns: [{from: `${clientDir}/assets/*`, to: `${publicDir}/`}]}) ] }); diff --git a/build/webpack.prod.config.js b/build/webpack.prod.config.js index 2f03f74e..d67d053f 100644 --- a/build/webpack.prod.config.js +++ b/build/webpack.prod.config.js @@ -1,12 +1,12 @@ const path = require('path'); //const webpack = require('webpack'); -const merge = require('webpack-merge'); +const { merge } = require('webpack-merge'); const baseWpConfig = require('./webpack.base.config'); const TerserPlugin = require('terser-webpack-plugin'); -const OptimizeCSSAssetsPlugin = require('optimize-css-assets-webpack-plugin'); +const CssMinimizerWebpackPlugin = require('css-minimizer-webpack-plugin'); const MiniCssExtractPlugin = require('mini-css-extract-plugin'); -const CleanWebpackPlugin = require('clean-webpack-plugin'); +//const { CleanWebpackPlugin } = require('clean-webpack-plugin'); const HtmlWebpackPlugin = require('html-webpack-plugin'); const CopyWebpackPlugin = require('copy-webpack-plugin'); const {GenerateSW} = require('workbox-webpack-plugin'); @@ -34,19 +34,18 @@ module.exports = merge(baseWpConfig, { optimization: { minimizer: [ new TerserPlugin({ - cache: true, parallel: true, terserOptions: { - output: { + format: { comments: false, }, }, }), - new OptimizeCSSAssetsPlugin() + new CssMinimizerWebpackPlugin() ] }, plugins: [ - new CleanWebpackPlugin([publicDir], {root: path.resolve(__dirname, '..')}), + //new CleanWebpackPlugin({ cleanOnceBeforeBuildPatterns: [`${publicDir}/**`] }), new MiniCssExtractPlugin({ filename: "[name].[contenthash].css" }), @@ -54,7 +53,9 @@ module.exports = merge(baseWpConfig, { template: `${clientDir}/index.html.template`, filename: `${publicDir}/index.html` }), - new CopyWebpackPlugin([{from: `${clientDir}/assets/*`, to: `${publicDir}/`, flatten: true}]), + new CopyWebpackPlugin({patterns: + [{from: `${clientDir}/assets/*`, to: `${publicDir}/`, context: `${clientDir}/assets` }] + }), new GenerateSW({ cacheId: 'liberama', swDest: `${publicDir}/service-worker.js`, diff --git a/client/components/App.vue b/client/components/App.vue index 71f8e346..32ecbb18 100644 --- a/client/components/App.vue +++ b/client/components/App.vue @@ -1,25 +1,28 @@ diff --git a/client/components/CardIndex/Book/Book.vue b/client/components/CardIndex/Book/Book.vue index 0ed31bb5..beef252c 100644 --- a/client/components/CardIndex/Book/Book.vue +++ b/client/components/CardIndex/Book/Book.vue @@ -6,15 +6,14 @@ diff --git a/client/components/CardIndex/Card/Card.vue b/client/components/CardIndex/Card/Card.vue index 2982bbf0..6da789f0 100644 --- a/client/components/CardIndex/Card/Card.vue +++ b/client/components/CardIndex/Card/Card.vue @@ -6,15 +6,14 @@ diff --git a/client/components/CardIndex/CardIndex.vue b/client/components/CardIndex/CardIndex.vue index 264c1c7d..5bbcfd18 100644 --- a/client/components/CardIndex/CardIndex.vue +++ b/client/components/CardIndex/CardIndex.vue @@ -1,15 +1,16 @@ diff --git a/client/components/CardIndex/History/History.vue b/client/components/CardIndex/History/History.vue index 22d8cd90..9950a8c3 100644 --- a/client/components/CardIndex/History/History.vue +++ b/client/components/CardIndex/History/History.vue @@ -6,15 +6,14 @@ diff --git a/client/components/CardIndex/Search/Search.vue b/client/components/CardIndex/Search/Search.vue index 5ae5d345..1e5072c9 100644 --- a/client/components/CardIndex/Search/Search.vue +++ b/client/components/CardIndex/Search/Search.vue @@ -6,15 +6,14 @@ diff --git a/client/components/ExternalLibs/BookmarkSettings/BookmarkSettings.vue b/client/components/ExternalLibs/BookmarkSettings/BookmarkSettings.vue index 1f1ed4bc..fb24cc86 100644 --- a/client/components/ExternalLibs/BookmarkSettings/BookmarkSettings.vue +++ b/client/components/ExternalLibs/BookmarkSettings/BookmarkSettings.vue @@ -1,63 +1,79 @@