@@ -44,7 +44,7 @@ const deleteFolder = (folderPath) => {
4444} ;
4545
4646const getFolderName = ( rootFolder ) => {
47- const configPath = path . join ( rootFolder , "exampleSite/ hugo.toml" ) ;
47+ const configPath = path . join ( rootFolder , "hugo.toml" ) ;
4848 const getConfig = fs . readFileSync ( configPath , "utf8" ) ;
4949 const match = getConfig . match ( / t h e m e \s * = \s * \[ ? " ( [ ^ " \] ] + ) " \] ? / ) ;
5050 let selectedTheme = null ;
@@ -74,58 +74,9 @@ const iterateFilesAndFolders = (rootFolder, { destinationRoot }) => {
7474
7575const setupTheme = ( ) => {
7676 const rootFolder = path . join ( __dirname , "../" ) ;
77-
78- if ( ! fs . existsSync ( path . join ( rootFolder , "exampleSite" ) ) ) {
79- // remove this part if you don't using theme demo as a module
80- [
81- {
82- filepath : path . join ( rootFolder , "config/_default/module.toml" ) ,
83- regex : / # \[ \[ i m p o r t s \] \] \s * \r ? \n # p a t h = " ( [ ^ " ] + ) " / ,
84- } ,
85- {
86- filepath : path . join ( rootFolder , "hugo.toml" ) ,
87- regex : / ^ .* t h e m e \s * = \s * ( " [ ^ " \] ] + " | \S + ) / m,
88- } ,
89- ] . forEach ( toggleComment ) ;
90-
91- const includesFiles = [
92- "go.mod" ,
93- "hugo.toml" ,
94- "assets" ,
95- "config" ,
96- "data" ,
97- "content" ,
98- "i18n" ,
99- "static" ,
100- "tailwind-plugin" ,
101- ] ;
102-
103- const folder = createNewFolder ( rootFolder , "exampleSite" ) ;
104-
105- fs . readdirSync ( rootFolder , { withFileTypes : true } ) . forEach ( ( file ) => {
106- if ( includesFiles . includes ( file . name ) ) {
107- if ( file . isDirectory ( ) ) {
108- const destination = path . join ( rootFolder , "exampleSite" , file . name ) ;
109- fs . mkdirSync ( destination , { recursive : true } ) ;
110- iterateFilesAndFolders ( path . join ( rootFolder , file . name ) , {
111- destinationRoot : destination ,
112- } ) ;
113- deleteFolder ( path . join ( rootFolder , file . name ) ) ;
114- } else {
115- fs . renameSync (
116- path . join ( rootFolder , file . name ) ,
117- path . join ( folder , file . name ) ,
118- ) ;
119- }
120- }
121- } ) ;
122-
123- const themes = path . join ( rootFolder , "themes" ) ;
124- iterateFilesAndFolders ( path . join ( themes , getFolderName ( rootFolder ) ) , {
125- destinationRoot : rootFolder ,
126- } ) ;
127- deleteFolder ( themes ) ;
128- }
77+ // No exampleSite logic; operate directly on real site structure
78+ // Add any setup logic you need here, or leave empty if not needed
79+ console . log ( "Theme setup script: No exampleSite logic. Site structure is ready." ) ;
12980} ;
13081
13182setupTheme ( ) ;
0 commit comments