@@ -5,11 +5,26 @@ const jszip = require('jszip');
55const iconFile = path . join ( __dirname , '../icon.png' ) ;
66const pluginJSON = path . join ( __dirname , '../plugin.json' ) ;
77const distFolder = path . join ( __dirname , '../dist' ) ;
8- let readmeDotMd = path . join ( __dirname , '../readme.md' ) ;
9- let changelogDotMd = path . join ( __dirname , '../changelogs.md' ) ;
8+ const json = JSON . parse ( fs . readFileSync ( pluginJSON , 'utf8' ) ) ;
9+ let readmeDotMd ;
10+ let changelogDotMd ;
1011
11- if ( ! fs . existsSync ( readmeDotMd ) ) {
12- readmeDotMd = path . join ( __dirname , '../README.md' ) ;
12+ if ( ! json . readme ) {
13+ readmeDotMd = path . join ( __dirname , '../readme.md' ) ;
14+ if ( ! fs . existsSync ( readmeDotMd ) ) {
15+ readmeDotMd = path . join ( __dirname , '../README.md' ) ;
16+ }
17+ }
18+
19+
20+ if ( ! json . changelogs ) {
21+ if ( ! fs . existsSync ( changelogDotMd ) ) {
22+ changelogDotMd = path . join ( __dirname , '../CHANGELOG.md' ) ;
23+ }
24+
25+ if ( ! fs . existsSync ( changelogDotMd ) ) {
26+ changelogDotMd = path . join ( __dirname , '../changelog.md' ) ;
27+ }
1328}
1429
1530// create zip file of dist folder
@@ -25,9 +40,9 @@ loadFile('', distFolder);
2540
2641zip
2742 . generateNodeStream ( { type : 'nodebuffer' , streamFiles : true } )
28- . pipe ( fs . createWriteStream ( path . join ( __dirname , '../dist .zip' ) ) )
43+ . pipe ( fs . createWriteStream ( path . join ( __dirname , '../plugin .zip' ) ) )
2944 . on ( 'finish' , ( ) => {
30- console . log ( 'Plugin dist .zip written.' ) ;
45+ console . log ( 'Plugin plugin .zip written.' ) ;
3146 } ) ;
3247
3348function loadFile ( root , folder ) {
0 commit comments