File tree 2 files changed +28
-1
lines changed
2 files changed +28
-1
lines changed Original file line number Diff line number Diff line change 17
17
"start" : " concurrently -k \" yarn:storybook\" " ,
18
18
"storybook:extract" : " npx sb extract" ,
19
19
"storybook" : " start-storybook -p 6006 -s public" ,
20
- "storybook:build" : " build-storybook -s public" ,
20
+ "storybook:build" : " build-storybook -s public && yarn run copy:public" ,
21
+ "copy:public" : " node scripts/copyPublic.js" ,
21
22
"test" : " jest"
22
23
},
23
24
"browserslist" : " extends browserslist-config-autoguru" ,
Original file line number Diff line number Diff line change
1
+ const fs = require ( 'fs' ) ;
2
+ const path = require ( 'path' ) ;
3
+
4
+ const sourceDir = path . join ( __dirname , '../' , 'public' ) ;
5
+ const targetDir = path . join ( __dirname , '../' , 'storybook-static' ) ;
6
+
7
+ fs . readdir ( sourceDir , ( err , files ) => {
8
+ if ( err ) {
9
+ console . error ( `Unable to read directory: ${ sourceDir } ` ) ;
10
+ process . exit ( 1 ) ;
11
+ }
12
+
13
+ files . forEach ( file => {
14
+ const sourceFile = path . join ( sourceDir , file ) ;
15
+ const targetFile = path . join ( targetDir , file ) ;
16
+
17
+ if ( ! fs . existsSync ( targetFile ) ) {
18
+ fs . copyFile ( sourceFile , targetFile , err => {
19
+ if ( err ) {
20
+ console . error ( `Unable to copy file: ${ sourceFile } ` ) ;
21
+ process . exit ( 1 ) ;
22
+ }
23
+ } ) ;
24
+ }
25
+ } ) ;
26
+ } ) ;
You can’t perform that action at this time.
0 commit comments