Skip to content

Commit

Permalink
chore: update hexo-component-inferno and migration script
Browse files Browse the repository at this point in the history
  • Loading branch information
ppoffice committed Aug 20, 2022
1 parent 3aebb2a commit 3bc0a94
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 2 deletions .
2 changes: 1 addition & 1 deletion include/migration/head.js
Original file line number Diff line number Diff line change
@@ -1 +1 @@
module . exports = require ( './ v4_v5 ' ) ;
module . exports = require ( './ v5_v5.1 ' ) ;
29 changes: 29 additions & 0 deletions include/migration/v5_v5.1.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
const Migration = require ( 'hexo-component-inferno/lib/core/migrate' ) . Migration ;

module . exports = class extends Migration {
constructor ( ) {
super ( '5.1.0' , null ) ;
}

upgrade ( config ) {
// Upgrade Waline configurations from v1 to v2.
const comment = config . comment || { } ;
const renamedOptions = {
'visitor' : 'pageview' ,
'uploadImage' : 'image_uploader' ,
'highlight' : 'highlighter' ,
'math' : 'tex_renderer'
} ;
if ( comment . type === 'waline' ) {
for ( const option in renamedOptions ) {
if ( typeof comment [ option ] !== 'undefined' ) {
if ( typeof comment [ renamedOptions [ option ] ] === 'undefined' ) {
comment [ renamedOptions [ option ] ] = comment [ option ] ;
}
delete comment [ option ] ;
}
}
}
return config ;
}
} ;
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
"bulma-stylus" : " 0.8.0 " ,
"deepmerge" : " ^4.2.2 " ,
"hexo" : " ^6.0.0 " ,
"hexo-component-inferno" : " ^ one point two .0 " ,
"hexo-component-inferno" : " ^ two .0 " ,
"hexo-log" : " ^3.0.0 " ,
"hexo-pagination" : " ^2.0.0 " ,
"hexo-renderer-inferno" : " ^0.1.3 " ,
Expand Down

0 comments on commit 3bc0a94

Please sign in to comment.