Skip to content
This repository was archived by the owner on Aug 29, 2023. It is now read-only.

Commit 70e0beb

Browse files
authored
Merge pull request #19 from momotaro98/feature/security-update
Feature/security update
2 parents 1da620c + 339792f commit 70e0beb

4 files changed

Lines changed: 1837 additions & 563 deletions

File tree

README.md

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@ Sidebar Extension for Markdown on Gist
44

55
![page-contents-sidebar_demo](https://github.com/momotaro98/my-project-images/blob/master/page-contents-sidebar/demo.gif)
66

7-
8-
97
## Features
108

119
* Display header title of Markdown file
@@ -21,19 +19,19 @@ Scheduled to support other sites such as GitHub and Confluence.
2119

2220
## Development
2321

24-
### npm install
22+
### Start development
2523

2624
```
2725
$ cd page-contents-sidebar
2826
$ npm install
2927
```
3028

31-
### Build app
29+
### Build, run, and watch app
3230

33-
Modify `src` files and run gulp command
31+
Modify `src` files and run and watch app by building with gulp
3432

3533
```
36-
$ gulp
34+
$ npm start
3735
```
3836

3937
### Inspect app
@@ -43,7 +41,7 @@ Open `tmp/app` directory as extension in Chrome browser, [chrome://extensions/](
4341
## Deployment app to Chrome Extension
4442

4543
0. Update `version` of package.json
46-
0. Run `gulp` and see `tmp/app`
44+
0. Run `npm run-script build` or `gulp build` and check `tmp/app` TODO: Use `npm dist` with zip the dir
4745
0. Create a zip file of `tmp/app`
4846
0. Go to [Chrome Ex Dashboard](https://chrome.google.com/webstore/developer/dashboard) and upload the zip file
4947
0. Push update to master and create release and tag

gulpfile.js

Lines changed: 23 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,11 @@ const map = require('map-stream');
44
const $ = require('gulp-load-plugins')();
55
const version = require('./package.json').version;
66

7-
// Tasks
87
gulp.task('clean', () => {
9-
return pipe('./tmp', $.clean());
10-
});
11-
12-
gulp.task('build', (cb) => {
13-
$.runSequence('clean', 'style', 'template', 'js', 'devdist', cb);
14-
});
15-
16-
gulp.task('default', ['build'], () => {
17-
gulp.watch(['./libs/**/*', './src/**/*'], ['default']);
8+
return pipe(
9+
'./tmp',
10+
$.clean()
11+
);
1812
});
1913

2014
gulp.task('style', () => {
@@ -38,7 +32,7 @@ gulp.task('template', () => {
3832
);
3933
});
4034

41-
gulp.task('js', ['template'], () => {
35+
gulp.task('js', gulp.series('template', () => {
4236
const src = [
4337
'./tmp/template.js',
4438
'./src/constants.js',
@@ -56,16 +50,29 @@ gulp.task('js', ['template'], () => {
5650
$.concat('mdisviewer.js'),
5751
'./tmp'
5852
);
59-
});
53+
}));
6054

61-
gulp.task('devdist', ['js'], () => {
62-
return merge(
55+
gulp.task('devdist', gulp.series('js', (cb) => {
56+
merge(
6357
pipe('./icons/**/*', './tmp/app/icons'),
6458
pipe(['./libs/**/*', './tmp/mdisviewer.*'], './tmp/app/'),
6559
pipe('./src/config/background.js', './tmp/app/'),
6660
pipe('./src/config/manifest.json', $.replace('$VERSION', version), './tmp/app/')
6761
);
68-
});
62+
cb(); // Need this callback after Gulp4 because `return merge()` doesn't returns stream
63+
}));
64+
65+
gulp.task('build', gulp.series(
66+
'clean',
67+
'style',
68+
'template',
69+
'js',
70+
'devdist'
71+
));
72+
73+
gulp.task('default', gulp.series('build', () => {
74+
gulp.watch(['./libs/**/*', './src/**/*'], gulp.task('default'));
75+
}));
6976

7077
// Helpers
7178
function pipe(src, ...transforms) {
@@ -90,7 +97,7 @@ function html2js(template) {
9097
const body = template.replace('$$', escaped);
9198

9299
file.path = path;
93-
file.contents = new Buffer(body);
100+
file.contents = Buffer.from(body);
94101
cb(null, file);
95102
}
96103
}

0 commit comments

Comments
 (0)