From 612c9b21640608778925889e2d24d293f58f3399 Mon Sep 17 00:00:00 2001 From: Jesse-Ma <24167796@qq.com> Date: Thu, 6 Apr 2023 13:40:18 +0800 Subject: [PATCH] milestone --- .env | 1 + .env.development | 6 +- .env.production | 3 +- .env.staging | 1 + .eslintignore | 2 + .eslintrc.json | 31 + README.md | 51 +- babel.config.js | 12 +- jsconfig.json | 9 +- package.json | 74 +- public/index.html | 47 +- src/api/note.js | 3 - src/assets/logo.png | Bin 6849 -> 0 bytes src/i18n/index.js | 13 +- src/main.js | 32 +- src/plugins/iview.js | 6 - src/router/index.js | 13 +- src/views/EditNote.vue | 6 +- src/views/ErrorNote.vue | 13 - src/views/ViewNote.vue | 2 +- vue.config.js | 114 +- yarn.lock | 2534 ++++++++++++++++++++------------------- 22 files changed, 1595 insertions(+), 1378 deletions(-) create mode 100644 .env.staging create mode 100644 .eslintignore create mode 100644 .eslintrc.json delete mode 100644 src/assets/logo.png delete mode 100644 src/plugins/iview.js diff --git a/.env b/.env index e69de29..5d92258 100644 --- a/.env +++ b/.env @@ -0,0 +1 @@ +VUE_APP_TITLE=flagnote.com \ No newline at end of file diff --git a/.env.development b/.env.development index 24e34f6..ad43a8f 100644 --- a/.env.development +++ b/.env.development @@ -1,6 +1,6 @@ -NODE_ENV = developement +NODE_ENV=developement +VUE_APP_FLAG=dev VUE_APP_BASE_NAME = developement VUE_APP_BASE_URL = http://localhost:8080 VUE_APP_NOTE_MAX_COUNT = 131072 -VUE_APP_NOTE_MAX_DESC = 128K - +VUE_APP_NOTE_MAX_DESC = 128K \ No newline at end of file diff --git a/.env.production b/.env.production index a60df30..491d1bc 100644 --- a/.env.production +++ b/.env.production @@ -1,4 +1,5 @@ -NODE_ENV = production +NODE_ENV=production +VUE_APP_FLAG=prod VUE_APP_BASE_NAME = production VUE_APP_BASE_URL = https://flagnote.com VUE_APP_NOTE_MAX_COUNT = 131072 diff --git a/.env.staging b/.env.staging new file mode 100644 index 0000000..bd9f606 --- /dev/null +++ b/.env.staging @@ -0,0 +1 @@ +VUE_APP_FLAG=staging \ No newline at end of file diff --git a/.eslintignore b/.eslintignore new file mode 100644 index 0000000..a5c972e --- /dev/null +++ b/.eslintignore @@ -0,0 +1,2 @@ +assets +mock \ No newline at end of file diff --git a/.eslintrc.json b/.eslintrc.json new file mode 100644 index 0000000..f1f69b2 --- /dev/null +++ b/.eslintrc.json @@ -0,0 +1,31 @@ +{ + "env": { + "browser": true, + "es2021": true + }, + "extends": [ + "plugin:vue/essential", + "airbnb-base" + ], + "parserOptions": { + "ecmaVersion": "latest", + "sourceType": "module" + }, + "plugins": [ + "vue" + ], + "rules": { + "semi": [2, "never"], + "comma-dangle": 0, + "no-console": 0, + "quotes": [2, "single"], + "no-undef": 0, + "no-debugger": 0, + "import/no-unresolved": 0, + "import/extensions": 0, + "no-param-reassign": 0, + "vue/multi-word-component-names": 0, + "vue/no-multiple-template-root": 0, + "import/no-extraneous-dependencies": 0 + } +} diff --git a/README.md b/README.md index 4d37ec8..dda2ea6 100644 --- a/README.md +++ b/README.md @@ -1,24 +1,35 @@ -# flagnote-web +# view-ui-project-vuecli +This project build for Vue3, Vue-router, Vuex, ViewUIPlus and Vue-cli. +## Install +```shell +npm install +``` +## Run +```shell +npm run serve +``` +## Build +### Build for Production +```shell +npm run build +``` +### Build for Staging +```shell +npm run build:staging +``` +## Run Eslint +### Run without Fixing -## Project setup +- This operation will also run before git-commit. +```shell +npm run lint ``` -yarn install +### Run with Fixing +```shell +npm run lint:fix ``` +## .env Description -### Compiles and hot-reloads for development -``` -yarn serve -``` - -### Compiles and minifies for production -``` -yarn build -``` - -### Lints and fixes files -``` -yarn lint -``` - -### Customize configuration -See [Configuration Reference](https://cli.vuejs.org/config/). +- This project exposes environment variables on `process.env` object. +- Different modes (development/staging/production) correspond to different environment files (.env.*). +- .env file is always included, duplicate variables are overwritten by the specific mode file (.env.*). diff --git a/babel.config.js b/babel.config.js index 422d0bb..5337588 100644 --- a/babel.config.js +++ b/babel.config.js @@ -1,5 +1,7 @@ -// module.exports = { -// presets: [ -// '@vue/cli-plugin-babel/preset' -// ] -// } +module.exports = { + presets: [ + '@vue/cli-plugin-babel/preset', + ], + plugins: [ + ], +}; diff --git a/jsconfig.json b/jsconfig.json index 3ad87c1..4aafc5f 100644 --- a/jsconfig.json +++ b/jsconfig.json @@ -1,9 +1,8 @@ { "compilerOptions": { - "target": "esnext", + "target": "es5", "module": "esnext", "baseUrl": "./", - "jsx": "preserve", "moduleResolution": "node", "paths": { "@/*": [ @@ -15,10 +14,6 @@ "dom", "dom.iterable", "scripthost" - ], - "removeComments": true, - }, - "vueCompilerOptions": { - "target": 2.7 + ] } } diff --git a/package.json b/package.json index 597b131..0358408 100644 --- a/package.json +++ b/package.json @@ -1,62 +1,56 @@ { "name": "flagnote-web", - "version": "0.1.0", - "private": true, + "version": "1.0.0", + "description": "flagnote web", "scripts": { + "dev": "npm run serve", "serve": "vue-cli-service serve", - "build": "vue-cli-service build --mode production", - "build.test": "vue-cli-service build --mode test", - "build.production": "vue-cli-service build --mode production", - "lint": "vue-cli-service lint" + "build": "vue-cli-service build", + "build:staging": "vue-cli-service build --mode=staging", + "lint": "eslint ./src --ext .js,.vue", + "lint:fix": "eslint ./src --ext .js,.vue --fix", + "prepare": "husky install" }, "dependencies": { "axios": "^0.27.2", + "babel-plugin-import": "^1.13.6", "buffer": "^6.0.3", "clipboard": "^2.0.11", + "core-js": "^3.8.3", "crypto-js": "^4.1.1", "escape-html": "^1.0.3", "file-saver": "^2.0.5", "html2canvas": "^1.4.1", "pako": "^2.1.0", - "qrcodejs2": "^0.0.2", - "view-design": "^4.7.0", - "vue": "^2.7.14", + "qrcodejs2-fixes": "^0.0.2", + "view-ui-plus": "^1.3.10", + "vue": "^3.2.13", "vue-axios": "^3.5.2", - "vue-i18n": "^8.28.2", - "vue-router": "^3.6.5" + "vue-i18n": "^9.2.2", + "vue-router": "^4.1.6", + "vuex": "^4.0.0" }, "devDependencies": { - "@babel/core": "^7.12.16", - "@babel/eslint-parser": "^7.12.16", - "@vue/cli-plugin-babel": "~5.0.8", - "@vue/cli-plugin-eslint": "~5.0.8", - "@vue/cli-plugin-router": "~5.0.8", - "@vue/cli-service": "~5.0.8", - "compression-webpack-plugin": "^10.0.0", - "core-js": "^3.26.1", - "eslint": "^7.32.0", - "eslint-plugin-vue": "^8.0.3", - "javascript-obfuscator": "^4.0.0", - "webpack": "^5.1.0", - "webpack-obfuscator": "^3.5.1" - }, - "eslintConfig": { - "root": true, - "env": { - "node": true - }, - "extends": [ - "plugin:vue/essential", - "eslint:recommended" - ], - "parserOptions": { - "parser": "@babel/eslint-parser" - }, - "rules": {} + "@vue/cli-plugin-babel": "~5.0.0", + "@vue/cli-plugin-router": "~5.0.0", + "@vue/cli-plugin-vuex": "~5.0.0", + "@vue/cli-service": "~5.0.0", + "eslint": "^8.14.0", + "eslint-config-airbnb-base": "^15.0.0", + "eslint-plugin-vue": "^8.7.1", + "husky": "^7.0.4", + "less": "^4.0.0", + "less-loader": "^10.2.0", + "mockjs": "^1.1.0" }, "browserslist": [ "> 1%", "last 2 versions", - "not dead" - ] + "not dead", + "not ie 11" + ], + "engines": { + "node": ">= 12.0.0", + "npm": ">= 6.9.0" + } } diff --git a/public/index.html b/public/index.html index 1654c72..7378adb 100644 --- a/public/index.html +++ b/public/index.html @@ -18,26 +18,27 @@ - flagnote.com + + <%= htmlWebpackPlugin.options.title %> + - - + + - - + - + - - + + + + + <% for (var i in htmlWebpackPlugin.options.cdn && htmlWebpackPlugin.options.cdn.js) { %> + + <% } %> - - - +