Skip to content

Commit fce99d5

Browse files
committed
removed dependencies to examplesite
1 parent 5db7bf3 commit fce99d5

2 files changed

Lines changed: 8 additions & 96 deletions

File tree

scripts/projectSetup.js

Lines changed: 4 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ const toggleComment = ({ filepath, regex }) => {
3636
};
3737

3838
const getFolderName = (rootFolder) => {
39-
const configPath = path.join(rootFolder, "exampleSite/hugo.toml");
39+
const configPath = path.join(rootFolder, "hugo.toml");
4040
const getConfig = fs.readFileSync(configPath, "utf8");
4141
const match = getConfig.match(/theme\s*=\s*\[?"([^"\]]+)"\]?/);
4242
let selectedTheme = null;
@@ -78,48 +78,9 @@ const iterateFilesAndFolders = (rootFolder, { destinationRoot }) => {
7878

7979
const setupProject = () => {
8080
const rootFolder = path.join(__dirname, "../");
81-
if (!fs.existsSync(path.join(rootFolder, "themes"))) {
82-
// remove this part if you don't using theme demo as a module
83-
[
84-
{
85-
filepath: path.join(rootFolder, "exampleSite/hugo.toml"),
86-
regex: /^.*theme\s*=\s*("[^"\]]+"|\S+)/m,
87-
},
88-
{
89-
filepath: path.join(
90-
rootFolder,
91-
"exampleSite/config/_default/module.toml",
92-
),
93-
regex: /\[\[imports\]\]\s*\r?\npath = "([^"]+)"/,
94-
},
95-
].forEach(toggleComment);
96-
97-
const folderList = ["layouts", "assets", "static", "tailwind-plugin"];
98-
const folderName = getFolderName(rootFolder);
99-
const newFolderName = createNewFolder(
100-
path.join(rootFolder, "themes"),
101-
folderName,
102-
);
103-
104-
folderList.forEach((folder) => {
105-
const source = path.join(rootFolder, folder);
106-
const destination = path.join(newFolderName, folder);
107-
if (fs.existsSync(source)) {
108-
fs.mkdirSync(destination, { recursive: true });
109-
iterateFilesAndFolders(source, {
110-
currentFolder: folder,
111-
destinationRoot: destination,
112-
});
113-
deleteFolder(source);
114-
}
115-
});
116-
117-
const exampleSite = path.join(rootFolder, "exampleSite");
118-
iterateFilesAndFolders(exampleSite, { destinationRoot: rootFolder });
119-
deleteFolder(exampleSite);
120-
} else {
121-
console.log("Project already setup");
122-
}
81+
// No exampleSite logic; operate directly on real site structure
82+
// Add any setup logic you need here, or leave empty if not needed
83+
console.log("Project setup script: No exampleSite logic. Site structure is ready.");
12384
};
12485

12586
setupProject();

scripts/themeSetup.js

Lines changed: 4 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ const deleteFolder = (folderPath) => {
4444
};
4545

4646
const 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(/theme\s*=\s*\[?"([^"\]]+)"\]?/);
5050
let selectedTheme = null;
@@ -74,58 +74,9 @@ const iterateFilesAndFolders = (rootFolder, { destinationRoot }) => {
7474

7575
const 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: /# \[\[imports\]\]\s*\r?\n# path = "([^"]+)"/,
84-
},
85-
{
86-
filepath: path.join(rootFolder, "hugo.toml"),
87-
regex: /^.*theme\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

13182
setupTheme();

0 commit comments

Comments
 (0)