@@ -15,6 +15,7 @@ const { exec } = require('child_process');
1515const librariesPath = path . join ( __dirname , './public/libraries' ) ;
1616const publicPath = path . join ( __dirname , './public' ) ;
1717
18+
1819// Create example study config template
1920const createExampleConfig = ( libraryName ) => ( {
2021 $schema : 'https://raw.githubusercontent.com/revisit-studies/study/dev/src/parser/StudyConfigSchema.json' ,
@@ -30,7 +31,7 @@ const createExampleConfig = (libraryName) => ({
3031 contactEmail : '' ,
3132 logoPath : 'revisitAssets/revisitLogoSquare.svg' ,
3233 withProgressBar : true ,
33- sidebar : true ,
34+ withSidebar : true ,
3435 } ,
3536 importedLibraries : [ libraryName ] ,
3637 components : {
@@ -49,10 +50,16 @@ const createExampleConfig = (libraryName) => ({
4950} ) ;
5051
5152// Process each library
52- const libraries = fs . readdirSync ( librariesPath ) ;
53+ const libraries = fs . readdirSync ( librariesPath )
54+ . filter ( library => ! library . startsWith ( '.' ) && ! library . endsWith ( '.DS_Store' ) ) ;
55+
5356libraries . forEach ( ( library ) => {
5457 // Skip hidden folders and files, and libraries in skip list
55- if ( library . startsWith ( '.' ) ) return ;
58+ if ( library . startsWith ( '.' ) ) {
59+ // eslint-disable-next-line no-console
60+ console . log ( `Skipping ${ library } library` ) ;
61+ return ;
62+ }
5663
5764 const exampleFolderName = `library-${ library } ` ;
5865 const examplePath = path . join ( publicPath , exampleFolderName ) ;
@@ -69,14 +76,15 @@ libraries.forEach((library) => {
6976 fs . mkdirSync ( assetsPath ) ;
7077 // eslint-disable-next-line no-console
7178 console . log ( `Created ${ exampleFolderName } /assets directory` ) ;
79+
80+ // Create config.json
81+ const configPath = path . join ( examplePath , 'config.json' ) ;
82+ const configContent = createExampleConfig ( library ) ;
83+ fs . writeFileSync ( configPath , JSON . stringify ( configContent , null , 2 ) ) ;
84+ // eslint-disable-next-line no-console
85+ console . log ( `Created/Updated ${ exampleFolderName } /config.json` ) ;
7286 }
7387
74- // Create config.json
75- const configPath = path . join ( examplePath , 'config.json' ) ;
76- const configContent = createExampleConfig ( library ) ;
77- fs . writeFileSync ( configPath , JSON . stringify ( configContent , null , 2 ) ) ;
78- // eslint-disable-next-line no-console
79- console . log ( `Created/Updated ${ exampleFolderName } /config.json` ) ;
8088} ) ;
8189
8290// eslint-disable-next-line no-console
0 commit comments