File tree Expand file tree Collapse file tree 3 files changed +20
-17
lines changed
Expand file tree Collapse file tree 3 files changed +20
-17
lines changed Original file line number Diff line number Diff line change 7979 },
8080 "env" : {
8181 "node" : true ,
82- "mocha" : true
82+ "mocha" : true ,
83+ "es6" : true
8384 },
8485 "parserOptions" : {
8586 "ecmaVersion" : 6
Original file line number Diff line number Diff line change @@ -36,19 +36,18 @@ exports.update = (done) => {
3636 return done ( err ) ;
3737 }
3838 // Creating cache folder
39- fs . mkdirs ( CACHE_FOLDER , ( err ) => {
40- if ( err ) {
39+ fs . ensureDir ( CACHE_FOLDER )
40+ . then ( ( ) => {
41+ return fs . copy ( tempFolder , CACHE_FOLDER ) ;
42+ } )
43+ . then ( ( ) => {
44+ return index . rebuildPagesIndex ( ) ;
45+ } )
46+ . then ( ( ) => {
47+ return done ( ) ;
48+ } )
49+ . catch ( ( err ) => {
4150 return done ( err ) ;
42- }
43- // Copying from tmp to cache folder
44- fs . copy ( tempFolder , CACHE_FOLDER , ( err ) => {
45- if ( err ) {
46- return done ( err ) ;
47- }
48- index . rebuildPagesIndex ( ( ) => {
49- return done ( ) ;
50- } ) ;
5151 } ) ;
52- } ) ;
5352 } ) ;
5453} ;
Original file line number Diff line number Diff line change @@ -76,10 +76,13 @@ function clearRuntimeIndex() {
7676 shortIndex = null ;
7777}
7878
79- function rebuildPagesIndex ( done ) {
80- clearPagesIndex ( ( ) => {
81- getShortIndex ( ( ) => {
82- return done ( ) ;
79+ function rebuildPagesIndex ( ) {
80+ /*eslint no-unused-vars: ["error", { "args": "none" }]*/
81+ return new Promise ( ( resolve , reject ) => {
82+ clearPagesIndex ( ( ) => {
83+ getShortIndex ( ( ) => {
84+ resolve ( ) ;
85+ } ) ;
8386 } ) ;
8487 } ) ;
8588}
You can’t perform that action at this time.
0 commit comments