chore: 🤖 migrate to vue cli 3

pull/48/head
Binbin Sun 3 years ago
parent 0723294c7b
commit 4b8bbcbfde
  1. 10
      .babelrc
  2. 22
      .gitignore
  3. 5
      babel.config.js
  4. 38
      build/webpack.base.conf.js
  5. 23
      build/webpack.build.conf.js
  6. 25
      build/webpack.dev.conf.js
  7. 4
      dev/App.vue
  8. 11
      dev/index.html
  9. 1
      dist/vue-tree-list.min.js
  10. 11413
      package-lock.json
  11. 82
      package.json
  12. 17
      public/index.html
  13. 20
      src/VueTreeList.vue
  14. 9
      src/index.js

@ -1,10 +0,0 @@
{
"presets": ["es2015", "stage-2"],
"plugins": ["transform-runtime"],
"comments": false,
"env": {
"test": {
"plugins": [ "istanbul" ]
}
}
}

22
.gitignore vendored

@ -1,5 +1,21 @@
.DS_Store
node_modules
npm-debug.log
/dist
# local env files
.env.local
.env.*.local
# Log files
npm-debug.log*
yarn-debug.log*
yarn-error.log*
# Editor directories and files
.idea
coverage
package-lock.json
.vscode
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?

@ -0,0 +1,5 @@
module.exports = {
presets: [
'@vue/cli-plugin-babel/preset'
]
}

@ -1,38 +0,0 @@
var path = require('path')
var projectRoot = path.resolve(__dirname, '../')
module.exports = {
module: {
loaders: [
{
test: /\.vue$/,
loader: 'vue'
},
{
test: /\.js$/,
loader: 'babel',
include: [path.join(projectRoot, 'src'), path.join(projectRoot, 'dev')],
exclude: /node_modules/
},
{
test: /\.(woff2?|eot|ttf|otf|svg)(\?.*)?$/,
loader: 'url-loader',
query: {
limit: 10000,
name: 'fonts/[name].[hash:7].[ext]'
}
}
]
},
vue: {
loaders: {
less: 'vue-style!css!less'
},
postcss: [
require('autoprefixer')({
browsers: ['iOS >= 7', 'Android >= 4.1']
})
]
}
}

@ -1,23 +0,0 @@
var webpack = require('webpack')
var merge = require('webpack-merge')
var baseConfig = require('./webpack.base.conf')
var path = require('path')
var projectRoot = path.resolve(__dirname, '../')
module.exports = merge(baseConfig, {
entry: './src/index.js',
output: {
path: path.resolve(projectRoot, 'dist'),
filename: 'vue-tree-list.min.js',
library: 'VueTreeList',
libraryTarget: 'umd'
},
plugins: [
new webpack.optimize.UglifyJsPlugin({
compress: {
warnings: false
}
})
]
})

@ -1,25 +0,0 @@
var webpack = require('webpack')
var merge = require('webpack-merge')
var HtmlWebpackPlugin = require('html-webpack-plugin')
var baseConfig = require('./webpack.base.conf')
module.exports = merge(baseConfig, {
entry: './dev/index.js',
devServer: {
historyApiFallback: true,
noInfo: true,
overlay: true,
open: true,
hot: true,
inline: true
},
devtool: '#eval-source-map',
plugins: [
new HtmlWebpackPlugin({
template: './dev/index.html',
filename: 'index.html',
inject: true
}),
new webpack.HotModuleReplacementPlugin()
]
})

@ -125,10 +125,6 @@
}
vm.newTree = _dfs(vm.data)
},
onClick(model) {
console.log(model)
}
}
}

@ -1,11 +0,0 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta name="viewport" content="with=device-width,initial-scale=1.0,
maximum-scale=1.0,minimum-scale=1.0,uses-scalable=no">
<title>vue-tree-list</title>
</head>
<body>
<div id="app"></div>
</body>
</html>

File diff suppressed because one or more lines are too long

11413
package-lock.json generated

File diff suppressed because it is too large Load Diff

@ -2,16 +2,13 @@
"name": "vue-tree-list",
"version": "1.4.0",
"description": "A vue component for tree structure. Support adding treenode/leafnode, editing node's name and dragging.",
"main": "dist/vue-tree-list.min.js",
"main": "dist/vue-tree-list.umd.min.js",
"scripts": {
"commit": "npx git-cz",
"standard": "standard",
"test": "karma start --single-run",
"unit": "karma start --watch",
"coveralls": "npm run test -- --report lcovonly && cat ./coverage/lcov.info | coveralls",
"build": "webpack --config build/webpack.build.conf.js",
"dev": "webpack-dev-server --config build/webpack.dev.conf.js",
"prepublishOnly": "npm run build"
"serve": "vue-cli-service serve dev",
"build": "vue-cli-service build --target lib src/index.js",
"lint": "vue-cli-service lint",
"prepublish": "npm run build"
},
"repository": {
"type": "git",
@ -27,40 +24,39 @@
"url": "https://github.com/ParadeTo/vue-tree-list/issues"
},
"homepage": "https://github.com/ParadeTo/vue-tree-list#readme",
"dependencies": {
"core-js": "^3.4.3",
"vue": "^2.6.10"
},
"devDependencies": {
"@commitlint/cli": "^7.2.1",
"@commitlint/config-conventional": "^7.1.2",
"autoprefixer": "^6.4.0",
"babel-core": "^6.0.0",
"babel-eslint": "^7.0.0",
"babel-loader": "^6.0.0",
"babel-plugin-istanbul": "^3.0.0",
"babel-plugin-transform-runtime": "^6.0.0",
"babel-preset-es2015": "^6.0.0",
"babel-preset-stage-2": "^6.0.0",
"babel-register": "^6.0.0",
"chai": "^3.5.0",
"cross-env": "^5.0.1",
"css-loader": "^0.26.2",
"cz-conventional-changelog": "^2.1.0",
"file-loader": "^0.10.1",
"html-webpack-plugin": "^2.8.1",
"husky": "^1.2.0",
"isparta": "^4.0.0",
"isparta-loader": "^2.0.0",
"less": "^2.7.2",
"less-loader": "^2.2.3",
"sinon": "^2.3.5",
"sinon-chai": "^2.11.0",
"sourcemap": "^0.1.0",
"standard": "^12.0.1",
"url-loader": "^0.5.7",
"vue": "^2.6.6",
"vue-loader": "^11.1.3",
"vue-style-loader": "^2.0.3",
"vue-template-compiler": "^2.6.6",
"webpack": "^1.13.2",
"webpack-dev-server": "1.14.0",
"webpack-merge": "^0.14.1"
}
"@vue/cli-plugin-babel": "^4.1.0",
"@vue/cli-plugin-eslint": "^4.1.0",
"@vue/cli-service": "^4.1.0",
"babel-eslint": "^10.0.3",
"eslint": "^5.16.0",
"eslint-plugin-vue": "^5.0.0",
"less": "^3.10.3",
"less-loader": "^5.0.0",
"vue-template-compiler": "^2.6.10"
},
"eslintConfig": {
"root": true,
"env": {
"node": true
},
"extends": [
"plugin:vue/essential",
"eslint:recommended"
],
"rules": {
"no-console": "warn"
},
"parserOptions": {
"parser": "babel-eslint"
}
},
"browserslist": [
"> 1%",
"last 2 versions"
]
}

@ -0,0 +1,17 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width,initial-scale=1.0">
<link rel="icon" href="<%= BASE_URL %>favicon.ico">
<title>vue-tree-list</title>
</head>
<body>
<noscript>
<strong>We're sorry but vue-tree-list doesn't work properly without JavaScript enabled. Please enable it to continue.</strong>
</noscript>
<div id="app"></div>
<!-- built files will be auto injected -->
</body>
</html>

@ -88,12 +88,15 @@
</template>
<script>
import { Tree, TreeNode } from './Tree.js'
import { TreeNode } from './Tree.js'
import { addHandler, removeHandler } from './tools.js'
let compInOperation = null
export default {
components: {
item: () => import('./VueTreeList')
},
data: function () {
return {
isHover: false,
@ -196,12 +199,12 @@
}
},
mouseOver(e) {
mouseOver() {
if (this.model.disabled) return
this.isHover = true
},
mouseOut(e) {
mouseOut() {
this.isHover = false
},
@ -229,22 +232,22 @@
}
return false
},
dragEnd(e) {
dragEnd() {
compInOperation = null
},
dragOver(e) {
e.preventDefault()
return true
},
dragEnter(e) {
dragEnter() {
if (!compInOperation) return
if (this.model.isLeaf) return
this.isDragEnterNode = true
},
dragLeave(e) {
dragLeave() {
this.isDragEnterNode = false
},
drop(e) {
drop() {
if (!compInOperation) return
const oldParent = compInOperation.model.parent;
compInOperation.model.moveInto(this.model)
@ -301,9 +304,6 @@
}
return node;
}
},
beforeCreate () {
this.$options.components.item = require('./VueTreeList.vue')
}
}
</script>

@ -1,7 +1,8 @@
/**
* Created by ayou on 17/7/21.
*/
exports.VueTreeList = require('./VueTreeList.vue')
exports.TreeNode = require('./Tree.js').TreeNode
exports.Tree = require('./Tree.js').Tree
// exports.Record = require('./Tree.js').Record
import VueTreeList from "./VueTreeList";
import { Tree, TreeNode } from "./Tree";
export { Tree, TreeNode, VueTreeList };

Loading…
Cancel
Save