style: @vue/standard

This commit is contained in:
hrsonion 2019-06-04 11:30:56 +08:00
parent 6e82b40f71
commit 7cef581108
24 changed files with 54 additions and 49 deletions

2
.eslintignore Normal file
View File

@ -0,0 +1,2 @@
node_modules
coverage

5
.eslintrc.js Normal file
View File

@ -0,0 +1,5 @@
module.exports = {
extends: [
"@vue/standard"
]
}

View File

@ -1,8 +1,7 @@
module.exports = {
"env": {
"test": {
"plugins": ["istanbul"]
'env': {
'test': {
'plugins': ['istanbul']
}
}
}

View File

@ -4,4 +4,4 @@ exports.alias = {
main: path.resolve(__dirname, '../src'),
packages: path.resolve(__dirname, '../packages'),
examples: path.resolve(__dirname, '../examples')
}
}

View File

@ -5,7 +5,7 @@ const sass = require('gulp-sass')
const autoprefixer = require('gulp-autoprefixer')
const cssmin = require('gulp-cssmin')
function compile() {
function compile () {
return src('../styles/*.scss')
.pipe(sass.sync())
.pipe(autoprefixer({
@ -15,10 +15,10 @@ function compile() {
.pipe(dest('../dist/lib/'))
}
function copyfont() {
function copyfont () {
return src('../styles/resources/**')
.pipe(cssmin())
.pipe(dest('../dist/lib/resources/'));
.pipe(dest('../dist/lib/resources/'))
}
exports.build = series(compile, copyfont)
exports.build = series(compile, copyfont)

View File

@ -2,13 +2,13 @@ const path = require('path')
const webpack = require('webpack')
const config = require('./config')
const HtmlWebpackPlugin = require('html-webpack-plugin')
const VueLoaderPlugin = require('vue-loader/lib/plugin');
const VueLoaderPlugin = require('vue-loader/lib/plugin')
const webpackConfig = {
mode: 'development',
entry: './demo/indexUsingCss.js',
output: {
path: path.resolve(process.cwd(), ),
path: path.resolve(process.cwd()),
publicPath: '',
filename: '[name].[hash:7].js',
chunkFilename: '[name].[hash:7].js'
@ -49,7 +49,7 @@ const webpackConfig = {
'sass-loader'
]
},
{
{
test: /\.(svg|otf|ttf|woff2?|eot|gif|png|jpe?g)(\?\S*)?$/,
loader: 'url-loader',
query: {
@ -76,4 +76,4 @@ const webpackConfig = {
]
}
module.exports = webpackConfig
module.exports = webpackConfig

View File

@ -2,13 +2,13 @@ const path = require('path')
const webpack = require('webpack')
const config = require('./config')
const HtmlWebpackPlugin = require('html-webpack-plugin')
const VueLoaderPlugin = require('vue-loader/lib/plugin');
const VueLoaderPlugin = require('vue-loader/lib/plugin')
const webpackConfig = {
mode: 'development',
entry: './demo/index.js',
output: {
path: path.resolve(process.cwd(), ),
path: path.resolve(process.cwd()),
publicPath: '',
filename: '[name].[hash:7].js',
chunkFilename: '[name].[hash:7].js'
@ -49,7 +49,7 @@ const webpackConfig = {
'sass-loader'
]
},
{
{
test: /\.(svg|otf|ttf|woff2?|eot|gif|png|jpe?g)(\?\S*)?$/,
loader: 'url-loader',
query: {
@ -76,4 +76,4 @@ const webpackConfig = {
]
}
module.exports = webpackConfig
module.exports = webpackConfig

View File

@ -1,9 +1,8 @@
const path = require('path')
const ProgressBarPlugin = require('progress-bar-webpack-plugin')
// const ProgressBarPlugin = require('progress-bar-webpack-plugin')
const VueLoaderPlugin = require('vue-loader/lib/plugin')
const config = require('./config')
const webpackConfig = {
mode: 'development',
entry: {
@ -54,7 +53,7 @@ const webpackConfig = {
plugins: [
new VueLoaderPlugin()
]
};
}
// if (!process.env.CI_ENV) {
// webpackConfig.plugins.push(
@ -62,4 +61,4 @@ const webpackConfig = {
// );
// }
module.exports = webpackConfig;
module.exports = webpackConfig

View File

@ -1,7 +1,7 @@
import Vue from 'vue/dist/vue'
import VueRouter from 'vue-router'
import '../styles/index.scss'
import Demo from './demo.vue'
// import Demo from './demo.vue'
import Card from 'packages/common/Card'
import Icon from 'packages/common/Icon'
import Loader from 'packages/common/Loader'
@ -32,10 +32,8 @@ const router = new VueRouter({
routes
})
;(new Vue({
router
})).$mount('#app')
console.log('...')
console.log('...')

View File

@ -1,2 +1,2 @@
import '../dist/lib/index.css'
import './index.js'
import './index.js'

View File

@ -16,6 +16,7 @@
"@babel/core": "^7.4.4",
"@babel/preset-env": "^7.4.4",
"@vue/babel-preset-app": "^3.8.0",
"@vue/eslint-config-standard": "^4.0.0",
"@vue/test-utils": "^1.0.0-beta.29",
"babel-loader": "^8.0.5",
"babel-plugin-istanbul": "^5.1.4",
@ -23,6 +24,7 @@
"copy-webpack-plugin": "^5.0.3",
"cross-env": "^5.2.0",
"css-loader": "^2.1.1",
"eslint": "^5.16.0",
"file-loader": "^3.0.1",
"gulp": "^4.0.2",
"gulp-autoprefixer": "^6.1.0",

View File

@ -4,4 +4,4 @@ Card.install = function (Vue) {
Vue.component(Card.name, Card)
}
export default Card
export default Card

View File

@ -4,4 +4,4 @@ Icon.install = function (Vue) {
Vue.component(Icon.name, Icon)
}
export default Icon
export default Icon

View File

@ -4,4 +4,4 @@ Loader.install = function (Vue) {
Vue.component(Loader.name, Loader)
}
export default Loader
export default Loader

View File

@ -4,4 +4,4 @@ Home.install = function (Vue) {
Vue.component(Home.name, Home)
}
export default Home
export default Home

View File

@ -45,6 +45,7 @@ export default {
<style lang="scss" scoped>
.home {
width: 100%;
padding-top: 14px;
.columns {
margin: auto;
display: flex;

View File

@ -4,4 +4,4 @@ Layout.install = function (Vue) {
Vue.component(Layout.name, Layout)
}
export default Layout
export default Layout

View File

@ -4,4 +4,4 @@ Navbar.install = function (Vue) {
Vue.component(Navbar.name, Navbar)
}
export default Navbar
export default Navbar

View File

@ -4,4 +4,4 @@ SideMenu.install = function (Vue) {
Vue.component(SideMenu.name, SideMenu)
}
export default SideMenu
export default SideMenu

View File

@ -1,3 +1,3 @@
import Amazing from './Amazing.vue'
export default Amazing
export default Amazing

10
test/.eslintrc.js Normal file
View File

@ -0,0 +1,10 @@
module.exports = {
extends: [
"@vue/standard"
],
globals: {
describe: 'readonly',
it: 'readonly',
expect: 'readonly'
}
}

View File

@ -1,3 +1,3 @@
// require all test files (files that ends with .spec.js)
const testsContext = require.context('./specs', true, /\.spec.js$/);
testsContext.keys().forEach(testsContext);
const testsContext = require.context('./specs', true, /\.spec.js$/)
testsContext.keys().forEach(testsContext)

View File

@ -2,29 +2,25 @@
// Generated on Thu May 09 2019 10:31:35 GMT+0800 (China Standard Time)
const webpackConfig = require('../../build/webpack.test')
module.exports = function(config) {
module.exports = function (config) {
config.set({
// base path that will be used to resolve all patterns (eg. files, exclude)
basePath: '',
// frameworks to use
// available frameworks: https://npmjs.org/browse/keyword/karma-adapter
frameworks: ['mocha', 'sinon-chai'],
// list of files / patterns to load in the browser
files: [
'./index.js'
],
// list of files / patterns to exclude
exclude: [
],
// preprocess matching files before serving them to the browser
// available preprocessors: https://npmjs.org/browse/keyword/karma-preprocessor
preprocessors: {
@ -35,35 +31,28 @@ module.exports = function(config) {
noInfo: true
},
// test results reporter to use
// possible values: 'dots', 'progress'
// available reporters: https://npmjs.org/browse/keyword/karma-reporter
reporters: ['spec', 'coverage'],
// web server port
port: 9876,
// enable / disable colors in the output (reporters and logs)
colors: true,
// level of logging
// possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG
logLevel: config.LOG_INFO,
// enable / disable watching file and executing tests whenever any file changes
autoWatch: false,
// start these browsers
// available browser launchers: https://npmjs.org/browse/keyword/karma-launcher
browsers: ['jsdom'],
// Continuous Integration mode
// if true, Karma captures browsers, runs the tests and exits
singleRun: true,

View File

@ -9,4 +9,4 @@ describe('amazing', function () {
})
expect(wrapper.element.textContent).to.equal('not amazing')
})
})
})