@@ -11,10 +11,8 @@ import { makeLightBlogList } from './utils';
1111 await remove ( buildConfig . distFolder ) ;
1212 await mkdirp ( buildConfig . distFolder ) ;
1313
14- // copy static files (images, etc.) to dist folder
15- await copy ( buildConfig . blogPostsFolder , buildConfig . distFolder ) ;
14+ // copy static index.html
1615 await copy ( '../index.html' , buildConfig . distFolder + '/index.html' ) ;
17- console . log ( 'Copied static files to dist' ) ;
1816
1917 // generate light blog list
2018 const blogList = await blogService . getBlogList ( ) ;
@@ -23,9 +21,14 @@ import { makeLightBlogList } from './utils';
2321
2422 // replace README with entry.json for all blog posts
2523 blogList . forEach ( async ( entry ) => {
26- const entryJsonPath = `${ buildConfig . distFolder } /${ entry . slug } /entry.json` ;
24+ const entryDistFolder = `${ buildConfig . distFolder } /${ entry . slug } ` ;
25+
26+ await mkdirp ( entryDistFolder ) ;
27+ await copy ( buildConfig . blogPostsFolder + '/' + entry . slug , entryDistFolder ) ;
28+ await remove ( `${ entryDistFolder } /README.md` ) ;
29+
30+ const entryJsonPath = `${ entryDistFolder } /entry.json` ;
2731 await writeJson ( entryJsonPath , entry ) ;
28- await remove ( `${ buildConfig . distFolder } /${ entry . slug } /README.md` ) ;
2932 console . log ( 'Generated post file:' , entryJsonPath ) ;
3033 } ) ;
3134} ) ( ) ;
0 commit comments