Skip to content

Commit 8c7813a

Browse files
committed
add lint and fmt & bump version
1 parent 9e3ddc0 commit 8c7813a

File tree

14 files changed

+416
-456
lines changed

14 files changed

+416
-456
lines changed

.editorconfig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ root = true
77
[*]
88
# Change these settings to your own preference
99
indent_style = space
10+
tab_width = 2
1011
indent_size = 2
1112
# We recommend you to keep these unchanged
1213
end_of_line = lf

.travis.yml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,10 @@ group: edge
1010
install:
1111
- npm i
1212

13+
cache:
14+
directories:
15+
- node_modules
16+
1317
script:
1418
- npm run pack
1519

@@ -24,7 +28,7 @@ deploy:
2428
api_key:
2529
secure: ZY7XZ74ZzAmrOA37qe8mHjLgoAs8ANOsEnUxPxwmUd39cMhFhrIXETQ/0MzHF3xcP9UkyEMbzyGl1CHKNmd9TOUVMJydkNmFXdMcPqrr/woA1kpUcXV2lA7cZgnpHhiJhnirxX530dz888dcGL0HYuTYzF1s2lM09jyx+rFPoP6ewQV5feZ36sGkp0t+CXT+16UwG+lU4CRW8HdlaROb7mTt8UWk/2AogEzMeNdJXuFdMMVLofn3MAF3hdG9e7tAfwROfQcQdGFbR4pp68gbjYdrQnjPSm8RPoQVdZVrqIjTbom7uZik8VYDijvppyymP9nNbkI9RvgSNS8/qYE1o26Rk8Zb3k/j8xR14/F0HP1Q921crf9UoXOCvwh2bE9SNdScAb2X9u734oiJXk3vthOOBtVgI3pno67D//ue8xPe8xtQqzgXBrz/7HA3Fh4mxFOex5NSzb3oIxXFinC1xDRX/4hzmwG8bCCsmt27eXY2Ax+q9W9GwUXVjii5y2JNlMVkXeep5aw6q1EujCE8ioYctXXe/ATIRCmMgZkj5Vj+S7n8sPZ586Iyy8REReo8Vc1Ge5fmCfXdK6gSIaxvQZue+LuOBN0UR3RrFSSXhXkyM5zCkQ1c3ruUNiTk5bKlUCootEemT/+QkSSQNTcS6lQCJKosd7gF+LhHHaoCoys=
2630
file:
27-
- dist/*.crx
31+
- dist/bcy-helper.crx
2832
on:
2933
tags: true
30-
repo: acgers/bcy-origin
34+
repo: acgers/bcy-helper

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,4 @@
1+
### Build Status
2+
[![Build Status](https://travis-ci.org/acgers/bcy-helper.svg?branch=master)](https://travis-ci.org/acgers/bcy-helper)
13

24
[Chrome Web Store](https://chrome.google.com/webstore/detail/bcy-download-original-ima/eobbbgiclgjigfidlnjapkgliaaibmpj)

gulpfile.js

Lines changed: 45 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,63 @@
11
const gulp = require('gulp')
22
const path = require('path')
33
const fs = require('fs')
4+
const es = require('event-stream')
5+
const tsfmt = require('typescript-formatter')
6+
const tslint = require('tslint')
7+
const gTslint = require('gulp-tslint')
48
const clean = require('gulp-clean')
59
const webpack = require('webpack')
610
const crx = require('gulp-crx-pack')
711
const zip = require('gulp-zip')
812

9-
gulp.task('clean', () => {
10-
gulp.src(['pack/js/', 'dist']).pipe(clean())
13+
gulp.task('clean', () => gulp.src(['pack/js/', 'dist']).pipe(clean()))
14+
15+
gulp.task('lint', () => gulp.src(['src/**/*.ts'], { base: '.' })
16+
.pipe(gTslint({
17+
tslint: tslint,
18+
program: tslint.Linter.createProgram(path.resolve('tsconfig.json')),
19+
configuration: path.resolve('tslint.json')
20+
}))
21+
.pipe(gTslint.report({
22+
summarizeFailureOutput: true,
23+
allowWarnings: false,
24+
reportLimit: 5
25+
}))
26+
)
27+
28+
gulp.task('fmt', () => {
29+
const formatting = es.map((file, cb) => {
30+
tsfmt.processString(file.path, file.contents.toString('utf8'), {
31+
replace: true,
32+
// verbose: true,
33+
tsfmt: true,
34+
tsfmtFile: path.resolve('tsfmt.json')
35+
}).then(result => {
36+
if (result.error) console.error(result.message)
37+
cb(null, file)
38+
}, err => cb(err))
39+
})
40+
gulp.src(['src/**/*.ts'], { base: '.' }).pipe(formatting)
1141
})
1242

13-
gulp.task('build', ['clean'], done => {
43+
gulp.task('build', ['clean', 'fmt', 'lint'], done =>
1444
webpack(require(path.resolve('webpack.config.js'))).run((err, stats) => {
1545
if (err) console.error(err)
1646
if (done) done()
1747
})
18-
})
48+
)
1949

20-
gulp.task('crx', ['build'], () => {
21-
gulp.src(path.resolve('pack'))
22-
.pipe(crx({
23-
privateKey: fs.readFileSync(path.resolve('key.pem'), 'utf8'),
24-
filename: 'bcy-helper.crx'
25-
}))
26-
.pipe(gulp.dest('./dist'))
27-
})
50+
gulp.task('crx', ['build'], () => gulp.src(path.resolve('pack'))
51+
.pipe(crx({
52+
privateKey: fs.readFileSync(path.resolve('key.pem'), 'utf8'),
53+
filename: 'bcy-helper.crx'
54+
}))
55+
.pipe(gulp.dest('./dist'))
56+
)
2857

29-
gulp.task('zip', ['build'], () => {
30-
gulp.src(path.resolve('pack/**'))
31-
.pipe(zip('bcy-helper.zip'))
32-
.pipe(gulp.dest('./dist'))
33-
})
58+
gulp.task('zip', ['build'], () => gulp.src(path.resolve('pack/**'))
59+
.pipe(zip('bcy-helper.zip'))
60+
.pipe(gulp.dest('./dist'))
61+
)
3462

3563
gulp.task('default', ['build'])

pack/manifest.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"name": "__MSG_extName__",
44
"short_name": "__MSG_extShortName__",
55
"description": "__MSG_extDescription__",
6-
"version": "0.8.4",
6+
"version": "0.8.5",
77
"author": "wangxufire <wangxufire@gmail.com>",
88
"minimum_chrome_version": "50",
99
"default_locale": "en",

0 commit comments

Comments
 (0)