fix: add alias for webpack and fix pre commit hook and add ci

This commit is contained in:
xinhui.zxh 2019-12-21 17:38:50 +08:00 committed by Moyee
parent e3a7b7979e
commit 1a5395dc2d
4 changed files with 18360 additions and 17 deletions

21
.travis.yml Normal file
View File

@ -0,0 +1,21 @@
language: node_js
node_js:
- "10"
env:
- NODE_ENV=test
addons:
apt:
packages:
- xvfb
- libgconf-2-4
install:
- export DISPLAY=':99.0'
- Xvfb :99 -screen 0 1024x768x24 > /dev/null 2>&1 &
- npm install
script:
- npm run ci

View File

@ -25,6 +25,7 @@
"build:umd": "webpack --config webpack.config.js --mode production",
"clean": "rimraf esm lib dist",
"lint": "lint-staged",
"tslint": "tslint -c tslint.json 'src/**/*.ts'",
"test": "jest",
"test-live": "DEBUG_MODE=1 jest --watch ./tests/unit/",
"coverage": "jest --coverage",
@ -65,12 +66,13 @@
"typedoc": "^0.15.0",
"typedoc-plugin-markdown": "^2.2.11",
"typescript": "^3.5.3",
"webpack": "^4.41.4",
"webpack-cli": "^3.3.10",
"event-simulate": "~1.0.0"
},
"husky": {
"hooks": {
"pre-commit": "run-s lint build test"
"pre-commit": "run-s lint"
}
},
"lint-staged": {

View File

@ -3,17 +3,20 @@ const resolve = require('path').resolve;
module.exports = {
entry: {
g6: './src/index.ts'
g6: './src/index.ts',
},
output: {
filename: '[name].min.js',
library: 'G6',
libraryTarget: 'umd',
path: resolve(process.cwd(), 'dist/')
path: resolve(process.cwd(), 'dist/'),
},
resolve: {
alias: {
'@g6': resolve(process.cwd(), './src'),
},
// Add `.ts` as a resolvable extension.
extensions: [ '.ts', '.js' ]
extensions: ['.ts', '.js'],
},
module: {
rules: [
@ -22,24 +25,21 @@ module.exports = {
use: {
loader: 'babel-loader',
options: {
babelrc: true
}
}
babelrc: true,
},
},
},
{
test: /\.ts$/,
use: {
loader: 'ts-loader',
options: {
transpileOnly: true
}
}
}
]
transpileOnly: true,
},
},
},
],
},
plugins: [
new webpack.NoEmitOnErrorsPlugin(),
new webpack.optimize.AggressiveMergingPlugin()
],
devtool: 'source-map'
plugins: [new webpack.NoEmitOnErrorsPlugin(), new webpack.optimize.AggressiveMergingPlugin()],
devtool: 'source-map',
};

18320
yarn.lock Normal file

File diff suppressed because it is too large Load Diff