feat: 初始化项目

This commit is contained in:
gary 2022-06-06 15:26:30 +08:00
parent 7ac99e9ee8
commit adb8d56e50
21 changed files with 35596 additions and 0 deletions

3
.browserslistrc Normal file
View File

@ -0,0 +1,3 @@
> 1%
last 2 versions
not dead

5
.editorconfig Normal file
View File

@ -0,0 +1,5 @@
[*.{js,jsx,ts,tsx,vue}]
indent_style = space
indent_size = 2
trim_trailing_whitespace = true
insert_final_newline = true

2
.env.dev.build Normal file
View File

@ -0,0 +1,2 @@
NODE_ENV=production
VUE_APP_BASE_API = 'http://127.0.0.1:9922/api/v1'

2
.env.dev.serve Normal file
View File

@ -0,0 +1,2 @@
NODE_ENV=development
VUE_APP_BASE_API = 'http://127.0.0.1:9922/api/v1'

4
.env.prod.build Normal file
View File

@ -0,0 +1,4 @@
NODE_ENV=production
VUE_APP_BASE_API = 'http://127.0.0.1:9922/api/v1'

2
.env.prod.serve Normal file
View File

@ -0,0 +1,2 @@
NODE_ENV=development
VUE_APP_BASE_API = 'http://127.0.0.1:9922/api/v1'

2
.env.test.build Normal file
View File

@ -0,0 +1,2 @@
NODE_ENV=production
VUE_APP_BASE_API = 'http://127.0.0.1:9922/api/v1'

2
.env.test.serve Normal file
View File

@ -0,0 +1,2 @@
NODE_ENV=development
VUE_APP_BASE_API = 'http://127.0.0.1:9922/api/v1'

4
.eslintignore Normal file
View File

@ -0,0 +1,4 @@
src/config
src/utils/bideo.js
vue.config.js
mock/

70
.eslintrc.js Normal file
View File

@ -0,0 +1,70 @@
/*
* @Description:
* @Autor: ZY
* @Date: 2020-12-07 10:30:20
* @LastEditors: ZY
* @LastEditTime: 2020-12-07 11:00:37
*/
module.exports = {
root: true,
env: {
node: true
},
extends: [
'plugin:vue/vue3-strongly-recommended',
'@vue/standard',
'@vue/typescript/recommended'
],
parserOptions: {
ecmaVersion: 2020
},
rules: {
'no-console': process.env.NODE_ENV === 'production' ? 'warn' : 'off',
'no-debugger': process.env.NODE_ENV === 'production' ? 'warn' : 'off',
'@typescript-eslint/ban-types': 'off',
'@typescript-eslint/explicit-module-boundary-types': 'off',
'@typescript-eslint/member-delimiter-style': ['error',
{
multiline: {
delimiter: 'none'
},
singleline: {
delimiter: 'comma'
}
}],
'@typescript-eslint/no-explicit-any': 'off',
'space-before-function-paren': ['error', 'never'],
'vue/array-bracket-spacing': 'error',
'vue/arrow-spacing': 'error',
'vue/block-spacing': 'error',
'vue/brace-style': 'error',
'vue/camelcase': 'error',
'vue/comma-dangle': 'error',
'vue/component-name-in-template-casing': 'error',
'vue/eqeqeq': 'error',
'vue/key-spacing': 'error',
'vue/match-component-file-name': 'error',
'vue/object-curly-spacing': 'error',
'no-useless-escape': 'off',
'@typescript-eslint/no-this-alias': [
'error',
{
allowDestructuring: true, // Allow `const { props, state } = this`; false by default
allowedNames: ['self'] // Allow `const self = this`; `[]` by default
}
],
'vue/attribute-hyphenation': 'off',
'vue/custom-event-name-casing': 'off'
},
overrides: [
{
files: [
'**/__tests__/*.{j,t}s?(x)',
'**/tests/unit/**/*.spec.{j,t}s?(x)'
],
env: {
jest: true
}
}
]
}

26
.gitignore vendored Normal file
View File

@ -0,0 +1,26 @@
.DS_Store
node_modules
/dist
/tests/e2e/videos/
/tests/e2e/screenshots/
# local env files
.env.local
.env.*.local
# Log files
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*
# Editor directories and files
.idea
.vscode
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?

5
.travis.yml Normal file
View File

@ -0,0 +1,5 @@
language: node_js
node_js: 10
script: npm run test
notifications:
email: false

129
Jenkinsfile vendored Normal file
View File

@ -0,0 +1,129 @@
@Library('devops') _
pipeline {
agent {label 'jenkins-slave-jnlp'}
environment { // https://stackoverflow.com/questions/53541489/updating-environment-global-variable-in-jenkins-pipeline-from-the-stage-level
NAME="admin-tmpl"
NAMESPACE="oppc-rcyj-web"
SERVER_PORT="80"
}
options {
// timestamps() //日志会有时间
skipDefaultCheckout() //删除隐式checkout scm语句
// disableConcurrentBuilds() //禁止并行,会列队式等前面的任务完才进行下一个任务
timeout(time: 1, unit: 'HOURS') //流水线超时设置1h
}
stages {
stage('Init'){
steps {
script{
// 【测试环境】变量
env.INGRESS_HOST='admin-tmpl-test.rencaiyoujia.cn'
env.INGRESS_TLS_SECRET="rencaiyoujia-tls-secret"
env.REPLICAS="1" //deployment的副本数
KUBECONTEXT = "k8s-test-admin" //测试环境k8s
NPM_RUN_BUILD_CMD="npm run build:test"
DOCKERFILE_NAME="Dockerfile"
// 【生产环境】变量
if( "${BRANCH_NAME}"== "master"){
env.INGRESS_HOST='admin-tmpl.rencaiyoujia.com'
env.INGRESS_TLS_SECRET="rencaiyoujia-tls-secret"
env.REPLICAS="2"
KUBECONTEXT="k8s-prod-admin" //生产环境k8s
NPM_RUN_BUILD_CMD="npm run build:prod"
DOCKERFILE_NAME="Dockerfile"
}
// 【开发环境】变量
if( "${BRANCH_NAME}"== "dev"){
env.INGRESS_HOST='admin-tmpl-dev.rencaiyoujia.cn'
env.INGRESS_TLS_SECRET="rencaiyoujia-tls-secret"
env.REPLICAS="1"
KUBECONTEXT="k8s-dev-admin" //开发环境k8s
NPM_RUN_BUILD_CMD="npm run build:dev"
DOCKERFILE_NAME="Dockerfile"
}
}
}
}
stage('Checkout') {
steps {
checkout scm
}
}
stage('npm打包') {
steps {
script{
// sh 'npm config set registry https://registry.npm.taobao.org'
sh 'npm install --registry=https://registry.npm.taobao.org'
sh "${NPM_RUN_BUILD_CMD}"
}
}
}
stage('DockerBuild') {
steps {
script{
sh "rm -rf docker/dist;mv dist docker"
devops.docker(env.NAME,dockerfile:"docker/${DOCKERFILE_NAME}",context:"docker").build().push()
}
}
}
stage('Test') {
steps {
echo 'Testing..'
}
}
stage('Deploy') {
parallel {
stage('deploy ingress') {
when {
expression { env.INGRESS_HOST != null }
}
steps{
sh """envsubst < k8smanifests/svc.yaml | kubectl --context ${KUBECONTEXT} apply -f - ;\
envsubst < k8smanifests/ingress.yaml | kubectl --context ${KUBECONTEXT} apply -f - ;\
"""
}
}
stage('Deploy') {
steps{
sh """envsubst < k8smanifests/deploy.yaml ;\
envsubst < k8smanifests/deploy.yaml | kubectl --context ${KUBECONTEXT} apply -f - ;\
"""
}
}
}
}
}
post{
success{
script{
devops.dingtalk(env.NAME,env.DOCKERIMAGE,"构建成功 ✅")
}
}
failure{
script{
devops.dingtalk(env.NAME,env.DOCKERIMAGE,"构建失败 ❌")
}
}
unstable{
script{
devops.dingtalk(env.NAME,env.DOCKERIMAGE,"不稳定构建 ✅")
}
}
aborted{
script{
devops.dingtalk(env.NAME,env.DOCKERIMAGE,"暂停或中断 ❌")
}
}
}
}

21
LICENSE Normal file
View File

@ -0,0 +1,21 @@
MIT License
Copyright (c) 2021 rcyj
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

29
babel.config.js Normal file
View File

@ -0,0 +1,29 @@
/*
* @Description:
* @Author: ZY
* @Date: 2020-12-07 10:30:20
* @LastEditors: ZY
* @LastEditTime: 2021-01-05 17:11:54
*/
module.exports = {
presets: [
'@vue/cli-plugin-babel/preset'
],
env: {
development: {
// babel-plugin-dynamic-import-node plugin only does one thing by converting all import() to require().
// This plugin can significantly increase the speed of hot updates, when you have a large number of pages.
// https://panjiachen.github.io/vue-element-admin-site/guide/advanced/lazy-loading.html
plugins: [
'dynamic-import-node'
// [
// 'component',
// {
// libraryName: 'element-plus',
// styleLibraryName: 'theme-chalk'
// }
// ]
]
}
}
}

6
jest.config.js Normal file
View File

@ -0,0 +1,6 @@
module.exports = {
preset: '@vue/cli-plugin-unit-jest/presets/typescript-and-babel',
transform: {
'^.+\\.vue$': 'vue-jest'
}
}

20237
package-lock.json generated Normal file

File diff suppressed because it is too large Load Diff

128
package.json Normal file
View File

@ -0,0 +1,128 @@
{
"name": "vue3-composition-admin",
"version": "0.1.0",
"private": true,
"homepage": "https://RainManGO.github.io/vue3-composition-admin",
"scripts": {
"start": "concurrently \"npm run mock\" \"npm run serve:dev\"",
"serve:dev": "cross-env NODE_ENV=development dotenv -e .env.dev.serve vue-cli-service serve",
"build:dev": "cross-env NODE_ENV=production dotenv -e .env.dev.build vue-cli-service build",
"serve:test": "cross-env NODE_ENV=development dotenv -e .env.test.serve vue-cli-service serve",
"build:test": "cross-env NODE_ENV=production dotenv -e .env.test.build vue-cli-service build",
"serve:prod": "cross-env NODE_ENV=development dotenv -e .env.prod.serve vue-cli-service serve",
"build:prod": "cross-env NODE_ENV=production dotenv -e .env.prod.build vue-cli-service build",
"test:unit": "vue-cli-service test:unit",
"test:e2e": "vue-cli-service test:e2e",
"lint": "vue-cli-service lint",
"mock": "cd mock && ts-node-dev mock.ts"
},
"dependencies": {
"@dragndrop/vue-dropzone": "0.0.4",
"@element-plus/icons": "^0.0.11",
"@metamask/detect-provider": "^1.2.0",
"@tinymce/tinymce-vue": "^4.0.0",
"@walletconnect/client": "^1.7.1",
"@walletconnect/qrcode-modal": "^1.7.1",
"axios-mapper": "^0.5.4",
"chalk": "^4.1.0",
"clipboard": "^2.0.6",
"core-js": "^3.6.5",
"crypto-ts": "^1.0.2",
"dayjs": "^1.10.3",
"driver.js": "^0.9.8",
"echarts": "^5.0.0",
"element-plus": "^1.0.2-beta.35",
"faker": "^5.1.0",
"file-saver": "^2.0.5",
"js-cookie": "^2.2.1",
"js-md5": "^0.7.3",
"jszip": "^3.5.0",
"koa": "^2.13.0",
"koa-body": "^4.2.0",
"koa-logger": "^3.2.1",
"koa-router": "^10.0.0",
"koa2-cors": "^2.0.6",
"lodash": "^4.17.20",
"log4js": "^6.3.0",
"moment": "^2.29.1",
"normalize.css": "^8.0.1",
"nprogress": "^0.2.0",
"path-to-regexp": "^6.2.0",
"reflect-metadata": "^0.1.13",
"screenfull": "^5.0.2",
"sortablejs": "^1.13.0",
"tinymce": "5.6.2",
"tronweb": "^4.1.0",
"vue": "^3.0.5",
"vue-class-component": "^8.0.0-0",
"vue-draggable-next": "^2.0.1",
"vue-i18n": "^9.0.0",
"vue-image-crop-upload": "^2.5.0",
"vue-property-decorator": "^9.1.2",
"vue-router": "4.0",
"vue3-count-to": "^1.0.7",
"vuex": "^4.0.0-0",
"vuex-module-decorators": "^1.0.1",
"vuex-persistedstate": "^4.0.0-beta.1",
"web3": "^1.7.0",
"xlsx": "^0.16.9"
},
"devDependencies": {
"@types/clipboard": "^2.0.1",
"@types/faker": "^5.1.5",
"@types/file-saver": "^2.0.1",
"@types/jest": "^24.0.19",
"@types/js-cookie": "^2.2.6",
"@types/koa": "^2.11.6",
"@types/koa-logger": "^3.1.1",
"@types/koa-router": "^7.4.1",
"@types/koa2-cors": "^2.0.1",
"@types/lodash": "^4.14.167",
"@types/node": "^14.14.11",
"@types/nprogress": "^0.2.0",
"@types/sortablejs": "^1.10.6",
"@types/tinymce": "^4.6.0",
"@typescript-eslint/eslint-plugin": "^2.33.0",
"@typescript-eslint/parser": "^2.33.0",
"@vue/cli-plugin-babel": "~4.5.0",
"@vue/cli-plugin-eslint": "~4.5.0",
"@vue/cli-plugin-router": "~4.5.0",
"@vue/cli-plugin-typescript": "~4.5.0",
"@vue/cli-plugin-unit-jest": "~4.5.0",
"@vue/cli-plugin-vuex": "~4.5.0",
"@vue/cli-service": "~4.5.0",
"@vue/compiler-sfc": "^3.0.0",
"@vue/eslint-config-standard": "^5.1.2",
"@vue/eslint-config-typescript": "^5.0.2",
"@vue/test-utils": "^2.0.0-0",
"babel-loader": "^8.2.2",
"concurrently": "^5.3.0",
"cross-env": "^7.0.3",
"dotenv-cli": "^4.0.0",
"eslint": "^6.7.2",
"eslint-plugin-import": "^2.20.2",
"eslint-plugin-node": "^11.1.0",
"eslint-plugin-promise": "^4.2.1",
"eslint-plugin-standard": "^4.0.0",
"eslint-plugin-vue": "^7.0.0-0",
"lint-staged": "^9.5.0",
"sass": "^1.26.5",
"sass-loader": "^8.0.2",
"style-loader": "^2.0.0",
"style-resources-loader": "^1.4.1",
"ts-node-dev": "^1.0.0",
"typescript": "~4.0.3",
"vue-cli-plugin-style-resources-loader": "^0.1.4",
"vue-jest": "^5.0.0-alpha.8",
"webpackbar": "^5.0.0-3"
},
"gitHooks": {
"pre-commit": "lint-staged"
},
"lint-staged": {
"*.{js,jsx,vue,ts,tsx}": [
"vue-cli-service lint",
"git add"
]
}
}

43
tsconfig.json Normal file
View File

@ -0,0 +1,43 @@
{
"compilerOptions": {
"target": "esnext",
"module": "esnext",
"strict": true,
"jsx": "preserve",
"importHelpers": true,
"moduleResolution": "node",
"experimentalDecorators": true,
"skipLibCheck": true,
"esModuleInterop": true,
"allowSyntheticDefaultImports": true,
"suppressImplicitAnyIndexErrors":true,
"sourceMap": true,
"baseUrl": ".",
"types": [
"node",
"webpack-env",
"jest"
],
"paths": {
"@/*": [
"src/*"
]
},
"lib": [
"esnext",
"dom",
"dom.iterable",
"scripthost"
]
},
"include": [
"src/**/*.ts",
"src/**/*.tsx",
"src/**/*.vue",
"tests/**/*.ts",
"tests/**/*.tsx"
],
"exclude": [
"node_modules"
]
}

75
vue.config.js Normal file
View File

@ -0,0 +1,75 @@
/*
* @Description:配置文件
* @Author: ZY
* @Date: 2020-12-07 11:41:22
* @LastEditors: ZY
* @LastEditTime: 2021-01-27 15:17:29
*/
const { resolve } = require('path')
const path = require('path')
const WebpackBar = require('webpackbar');
const dayjs = require('dayjs')
const time = dayjs().format('YYYY-M-D HH:mm:ss')
process.env.VUE_APP_UPDATE_TIME = time
const {
publicPath,
assetsDir,
outputDir,
lintOnSave,
transpileDependencies,
title,
devPort,
} = require('./src/config/default/vue.custom.config')
module.exports = {
publicPath,
assetsDir,
outputDir,
lintOnSave,
transpileDependencies,
// devServer: {
// hot: true,
// port: devPort,
// open: true,
// noInfo: false,
// overlay: {
// warnings: true,
// errors: true,
// },
// },
pluginOptions: {
'style-resources-loader': {
preProcessor: 'scss',
patterns: [
path.resolve(__dirname, 'src/styles/_variables.scss'),
path.resolve(__dirname, 'src/styles/_mixins.scss'),
]
}
},
configureWebpack(){
return {
resolve:{
alias:{
'@':resolve('src'),
'*':resolve(''),
'Assets':resolve('src/assets')
}
},
module:{
rules: [
{
test: /\.(json5?|ya?ml)$/, // target json, json5, yaml and yml files
loader: '@intlify/vue-i18n-loader',
include: [ // Use `Rule.include` to specify the files of locale messages to be pre-compiled
path.resolve(__dirname, 'src/lang')
]
},
],
},
plugins:[
new WebpackBar({
name:title,
})
]
}
},
}

14801
yarn.lock Normal file

File diff suppressed because it is too large Load Diff