added project-setup script
This commit is contained in:
parent
dd723881c8
commit
8bc0dd868f
9
.github/workflows/hugo.yml
vendored
9
.github/workflows/hugo.yml
vendored
@ -16,8 +16,8 @@ permissions:
|
||||
# Environment variables available to all jobs and steps in this workflow
|
||||
env:
|
||||
HUGO_ENV: production
|
||||
HUGO_VERSION: "0.114.0"
|
||||
GO_VERSION: "1.16.3"
|
||||
HUGO_VERSION: "0.115.1"
|
||||
GO_VERSION: "1.20.5"
|
||||
NODE_VERSION: "18.15.0"
|
||||
TINA_CLIENT_ID: ${{ vars.TINA_CLIENT_ID }}
|
||||
TINA_TOKEN: ${{ vars.TINA_TOKEN }}
|
||||
@ -49,6 +49,9 @@ jobs:
|
||||
rm go${{ env.GO_VERSION }}.linux-amd64.tar.gz
|
||||
go version
|
||||
|
||||
- name: Setup Project
|
||||
run: npm run project-setup
|
||||
|
||||
- name: Install npm dependencies
|
||||
run: npm install
|
||||
|
||||
@ -58,7 +61,7 @@ jobs:
|
||||
- name: Upload artifact
|
||||
uses: actions/upload-pages-artifact@v1
|
||||
with:
|
||||
path: ./exampleSite/public
|
||||
path: ./public
|
||||
|
||||
# Deployment job
|
||||
deploy:
|
||||
|
@ -3,9 +3,9 @@ stages:
|
||||
|
||||
variables:
|
||||
HUGO_ENV: production
|
||||
HUGO_VERSION: "0.114.0"
|
||||
GO_VERSION: "1.16.3"
|
||||
NODE_VERSION: "18.15.0"
|
||||
HUGO_VERSION: "0.115.1"
|
||||
GO_VERSION: "1.20.5"
|
||||
NODE_VERSION: "18.16.1"
|
||||
|
||||
cache:
|
||||
paths:
|
||||
@ -28,20 +28,12 @@ default:
|
||||
- echo "GO ${GO_VERSION} INSTALLED"
|
||||
- npm install
|
||||
|
||||
test:
|
||||
stage: build
|
||||
script:
|
||||
- npm run build
|
||||
rules:
|
||||
- if: $CI_COMMIT_REF_NAME != $CI_DEFAULT_BRANCH
|
||||
|
||||
pages:
|
||||
stage: build
|
||||
script:
|
||||
- npm run project-setup
|
||||
- npm run build
|
||||
- echo "SITE BUILT SUCCESSFULLY! LIVE AT https://$GITLAB_USER_LOGIN.gitlab.io/$CI_PROJECT_NAME/"
|
||||
artifacts:
|
||||
paths:
|
||||
- public
|
||||
rules:
|
||||
- if: $CI_COMMIT_REF_NAME == $CI_DEFAULT_BRANCH
|
@ -1,14 +0,0 @@
|
||||
; https://editorconfig.org
|
||||
|
||||
root = true
|
||||
|
||||
[*]
|
||||
charset = utf-8
|
||||
end_of_line = lf
|
||||
indent_size = 2
|
||||
indent_style = space
|
||||
trim_trailing_whitespace = true
|
||||
insert_final_newline = true
|
||||
|
||||
[*.md]
|
||||
trim_trailing_whitespace = false
|
15
exampleSite/.gitignore
vendored
15
exampleSite/.gitignore
vendored
@ -1,15 +0,0 @@
|
||||
Thumbs.db
|
||||
.DS_Store
|
||||
.dist
|
||||
.tmp
|
||||
.sass-cache
|
||||
npm-debug.log
|
||||
node_modules
|
||||
builds
|
||||
package-lock.json
|
||||
public
|
||||
resources
|
||||
.hugo_build.lock
|
||||
jsconfig.json
|
||||
hugo_stats.json
|
||||
go.sum
|
@ -1,59 +0,0 @@
|
||||
{
|
||||
"maxerr": 50,
|
||||
"bitwise": true,
|
||||
"camelcase": false,
|
||||
"curly": true,
|
||||
"eqeqeq": true,
|
||||
"forin": true,
|
||||
"freeze": true,
|
||||
"immed": true,
|
||||
"indent": 2,
|
||||
"latedef": true,
|
||||
"newcap": false,
|
||||
"noarg": true,
|
||||
"noempty": true,
|
||||
"nonbsp": true,
|
||||
"nonew": true,
|
||||
"plusplus": false,
|
||||
"undef": true,
|
||||
"unused": false,
|
||||
"strict": true,
|
||||
"maxparams": false,
|
||||
"maxdepth": 4,
|
||||
"maxstatements": false,
|
||||
"maxcomplexity": false,
|
||||
"maxlen": 400,
|
||||
"browser": true,
|
||||
"devel": true,
|
||||
"asi": false,
|
||||
"boss": false,
|
||||
"debug": false,
|
||||
"eqnull": false,
|
||||
"es3": false,
|
||||
"es5": false,
|
||||
"esversion": 12,
|
||||
"moz": false,
|
||||
"evil": true,
|
||||
"expr": true,
|
||||
"funcscope": false,
|
||||
"globalstrict": false,
|
||||
"iterator": false,
|
||||
"lastsemic": false,
|
||||
"laxbreak": false,
|
||||
"laxcomma": false,
|
||||
"loopfunc": true,
|
||||
"multistr": true,
|
||||
"noyield": false,
|
||||
"notypeof": false,
|
||||
"proto": false,
|
||||
"scripturl": false,
|
||||
"shadow": false,
|
||||
"sub": false,
|
||||
"supernew": false,
|
||||
"validthis": false,
|
||||
"globals": {
|
||||
"jQuery": false,
|
||||
"google": false,
|
||||
"$": false
|
||||
}
|
||||
}
|
@ -1,12 +0,0 @@
|
||||
{
|
||||
"overrides": [
|
||||
{
|
||||
"files": ["*.html"],
|
||||
"options": {
|
||||
"parser": "go-template",
|
||||
"goTemplateBracketSpacing": true,
|
||||
"bracketSameLine": true
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
@ -13,12 +13,13 @@ googleAnalytics = "" # example: UA-123-45, for more info, read the article https
|
||||
# disqus short name
|
||||
disqusShortname = "themefisher-template" # we use disqus to show comments in blog posts . To install disqus please follow this tutorial https://portfolio.peter-baumgartner.net/2017/09/10/how-to-install-disqus-on-hugo/
|
||||
# disable language
|
||||
disableLanguages = [] # example: ["fr"] for disable french language. see https://gohugo.io/content-management/multilingual/
|
||||
disableLanguages = [
|
||||
] # example: ["fr"] for disable french language. see https://gohugo.io/content-management/multilingual/
|
||||
hasCJKLanguage = false # If hasCJKLanguage true, auto-detect Chinese/Japanese/Korean Languages in the content. see: https://gohugo.io/getting-started/configuration/#hascjklanguage
|
||||
|
||||
|
||||
########################## Permalinks ############################
|
||||
[permalinks]
|
||||
[permalinks.page]
|
||||
"pages" = "/:slugorfilename/"
|
||||
|
||||
|
||||
|
@ -1,17 +0,0 @@
|
||||
[build]
|
||||
publish = "public"
|
||||
command = "yarn build"
|
||||
|
||||
[build.environment]
|
||||
HUGO_VERSION = "0.112.5"
|
||||
GO_VERSION = "1.19.4"
|
||||
HUGO_BASEURL = "/"
|
||||
|
||||
[[headers]]
|
||||
for = "/*" # This defines which paths this specific [[headers]] block will cover.
|
||||
|
||||
[headers.values]
|
||||
X-Frame-Options = "DENY"
|
||||
X-XSS-Protection = "1; mode=block"
|
||||
Referrer-Policy = "same-origin"
|
||||
Strict-Transport-Security = "max-age=31536000; includeSubDomains; preload"
|
@ -1,29 +0,0 @@
|
||||
{
|
||||
"name": "hugoplate",
|
||||
"description": "hugo tailwindcss boilerplate",
|
||||
"version": "1.1.1",
|
||||
"license": "MIT",
|
||||
"author": "zeon.studio",
|
||||
"scripts": {
|
||||
"dev": "cd exampleSite; hugo server || hugo server --themesDir ../..",
|
||||
"test": "cd exampleSite; hugo server --disableFastRender --navigateToChanged --templateMetrics --templateMetricsHints --buildDrafts --buildExpired --buildFuture --watch --forceSyncStatic -e production --minify || hugo server --themesDir ../.. --disableFastRender --navigateToChanged --templateMetrics --templateMetricsHints --buildDrafts --buildExpired --buildFuture --watch --forceSyncStatic -e production --minify",
|
||||
"build": "cd exampleSite; hugo --gc --minify --templateMetrics --templateMetricsHints --buildDrafts --buildExpired --buildFuture --forceSyncStatic || hugo --themesDir ../.. --gc --minify --templateMetrics --templateMetricsHints --buildDrafts --buildExpired --buildFuture --forceSyncStatic",
|
||||
"update-modules": "node ./scripts/cleanMod.js && hugo mod clean --all && hugo mod get -u ./... && hugo mod tidy",
|
||||
"format": "prettier -w .",
|
||||
"remove-darkmode": "node ./scripts/removeDarkmode.js && yarn format"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@fullhuman/postcss-purgecss": "^5.0.0",
|
||||
"@tailwindcss/forms": "^0.5.3",
|
||||
"@tailwindcss/typography": "^0.5.9",
|
||||
"autoprefixer": "^10.4.14",
|
||||
"postcss": "^8.4.24",
|
||||
"postcss-cli": "^10.1.0",
|
||||
"prettier": "^2.8.8",
|
||||
"prettier-plugin-go-template": "0.0.13",
|
||||
"prettier-plugin-tailwindcss": "^0.3.0",
|
||||
"tailwind-bootstrap-grid": "^5.0.1",
|
||||
"tailwindcss": "^3.3.2",
|
||||
"toml": "^3.0.0"
|
||||
}
|
||||
}
|
@ -1,52 +0,0 @@
|
||||
const fs = require("fs");
|
||||
const path = require("path");
|
||||
|
||||
const rootDirs = [
|
||||
"themes/iot-hub-docs/assets/scss",
|
||||
"themes/iot-hub-docs/layouts",
|
||||
];
|
||||
const configFiles = [
|
||||
{
|
||||
filePath: "tailwind.config.js",
|
||||
patterns: ["darkmode:\\s*{[^}]*},", 'darkMode:\\s*"class",'],
|
||||
},
|
||||
{
|
||||
filePath: "config.toml",
|
||||
patterns: ["\\S*\\.darkmode[^\\]]*\\]\\n*([\\s\\S]*?)(?=\\[|$)"],
|
||||
},
|
||||
];
|
||||
|
||||
rootDirs.forEach(removeDarkModeFromPages);
|
||||
configFiles.forEach(removeDarkMode);
|
||||
|
||||
function removeDarkModeFromFiles(filePath, regexPatterns) {
|
||||
const fileContent = fs.readFileSync(filePath, "utf8");
|
||||
let updatedContent = fileContent;
|
||||
regexPatterns.forEach((pattern) => {
|
||||
const regex = new RegExp(pattern, "g");
|
||||
updatedContent = updatedContent.replace(regex, "");
|
||||
});
|
||||
fs.writeFileSync(filePath, updatedContent, "utf8");
|
||||
}
|
||||
|
||||
function removeDarkModeFromPages(directoryPath) {
|
||||
const files = fs.readdirSync(directoryPath);
|
||||
|
||||
files.forEach((file) => {
|
||||
const filePath = path.join(directoryPath, file);
|
||||
const stats = fs.statSync(filePath);
|
||||
if (stats.isDirectory()) {
|
||||
removeDarkModeFromPages(filePath);
|
||||
} else if (stats.isFile()) {
|
||||
removeDarkModeFromFiles(filePath, [
|
||||
'(?:(?!["])\\S)*dark:(?:(?![,;"])\\S)*',
|
||||
"@apply?(\\s)*;",
|
||||
]);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function removeDarkMode(configFile) {
|
||||
const { filePath, patterns } = configFile;
|
||||
removeDarkModeFromFiles(filePath, patterns);
|
||||
}
|
@ -1,20 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
# default versions
|
||||
if [ -z $GO_VERSION ]; then GO_VERSION='1.19.3'; fi
|
||||
if [ -z $HUGO_VERSION ]; then HUGO_VERSION='0.112.5'; fi
|
||||
|
||||
# install Go
|
||||
curl -sSOL https://dl.google.com/go/go${GO_VERSION}.linux-amd64.tar.gz
|
||||
tar -C /usr/local -xzf go${GO_VERSION}.linux-amd64.tar.gz
|
||||
export PATH=$PATH:/usr/local/go/bin
|
||||
|
||||
# install Hugo
|
||||
echo "Installing Hugo $HUGO_VERSION..."
|
||||
curl -sSOL https://github.com/gohugoio/hugo/releases/download/v${HUGO_VERSION}/hugo_extended_${HUGO_VERSION}_Linux-64bit.tar.gz
|
||||
tar -xzf hugo_extended_${HUGO_VERSION}_Linux-64bit.tar.gz
|
||||
hugo version
|
||||
|
||||
# run Hugo
|
||||
echo "Running Hugo..."
|
||||
hugo --gc --minify
|
18
netlify.toml
18
netlify.toml
@ -1,18 +1,8 @@
|
||||
[build]
|
||||
publish = "exampleSite/public"
|
||||
command = "yarn build"
|
||||
publish = "public"
|
||||
command = "yarn project-setup && yarn build"
|
||||
|
||||
[build.environment]
|
||||
HUGO_VERSION = "0.112.5"
|
||||
GO_VERSION = "1.19.4"
|
||||
HUGO_THEME = "repo"
|
||||
HUGO_VERSION = "0.115.1"
|
||||
GO_VERSION = "1.20.5"
|
||||
HUGO_BASEURL = "/"
|
||||
|
||||
# [[headers]]
|
||||
# for = "/*" # This defines which paths this specific [[headers]] block will cover.
|
||||
|
||||
# [headers.values]
|
||||
# X-Frame-Options = "DENY"
|
||||
# X-XSS-Protection = "1; mode=block"
|
||||
# Referrer-Policy = "same-origin"
|
||||
# Strict-Transport-Security = "max-age=31536000; includeSubDomains; preload"
|
||||
|
19
package.json
19
package.json
@ -1,16 +1,21 @@
|
||||
{
|
||||
"name": "hugoplate",
|
||||
"description": "hugo tailwindcss boilerplate",
|
||||
"version": "1.1.2",
|
||||
"version": "1.2.0",
|
||||
"license": "MIT",
|
||||
"author": "zeon.studio",
|
||||
"scripts": {
|
||||
"dev": "cd exampleSite; hugo server || hugo server --themesDir ../..",
|
||||
"test": "cd exampleSite; hugo server --disableFastRender --navigateToChanged --templateMetrics --templateMetricsHints --buildDrafts --buildExpired --buildFuture --watch --forceSyncStatic -e production --minify || hugo server --themesDir ../.. --disableFastRender --navigateToChanged --templateMetrics --templateMetricsHints --buildDrafts --buildExpired --buildFuture --watch --forceSyncStatic -e production --minify",
|
||||
"build": "cd exampleSite; hugo --gc --minify --templateMetrics --templateMetricsHints --buildDrafts --buildExpired --buildFuture --forceSyncStatic || hugo --themesDir ../.. --gc --minify --templateMetrics --templateMetricsHints --buildDrafts --buildExpired --buildFuture --forceSyncStatic",
|
||||
"update-modules": "node ./scripts/cleanMod.js && hugo mod clean --all && hugo mod get -u ./... && hugo mod tidy",
|
||||
"format": "prettier -w .",
|
||||
"remove-darkmode": "node ./scripts/removeDarkmode.js && yarn format"
|
||||
"dev": "hugo server",
|
||||
"build": "hugo --gc --minify --templateMetrics --templateMetricsHints --buildDrafts --buildExpired --buildFuture --forceSyncStatic",
|
||||
"test": "hugo server --disableFastRender --navigateToChanged --templateMetrics --templateMetricsHints --buildDrafts --buildExpired --buildFuture --watch --forceSyncStatic -e production --minify",
|
||||
"dev:example": "cd exampleSite; hugo server --themesDir ../..",
|
||||
"build:example": "cd exampleSite; hugo --themesDir ../.. --gc --minify --templateMetrics --templateMetricsHints --buildDrafts --buildExpired --buildFuture --forceSyncStatic",
|
||||
"test:example": "cd exampleSite; hugo server --themesDir ../.. --disableFastRender --navigateToChanged --templateMetrics --templateMetricsHints --buildDrafts --buildExpired --buildFuture --watch --forceSyncStatic -e production --minify",
|
||||
"update-modules": "node ./scripts/clearModules.js && hugo mod clean --all && hugo mod get -u ./... && hugo mod tidy",
|
||||
"remove-darkmode": "node ./scripts/removeDarkmode.js && yarn format",
|
||||
"project-setup": "node ./scripts/projectSetup.js",
|
||||
"theme-setup": "node ./scripts/themeSetup.js",
|
||||
"format": "prettier -w ."
|
||||
},
|
||||
"devDependencies": {
|
||||
"@fullhuman/postcss-purgecss": "^5.0.0",
|
||||
|
@ -63,6 +63,12 @@
|
||||
- Npm v9.5+
|
||||
- Tailwindcss v3+
|
||||
|
||||
### 👉 Project Setup
|
||||
|
||||
```
|
||||
npm run project-setup
|
||||
```
|
||||
|
||||
### 👉 Development Command
|
||||
|
||||
```
|
||||
|
@ -1,6 +1,6 @@
|
||||
const fs = require("fs");
|
||||
|
||||
const clearMode = (filePath) => {
|
||||
const clearModules = (filePath) => {
|
||||
if (fs.existsSync(filePath)) {
|
||||
let fileContent = fs.readFileSync(filePath, "utf8");
|
||||
fileContent = fileContent.replace(/require\s*\([\s\S]*?\)/, "");
|
||||
@ -10,5 +10,5 @@ const clearMode = (filePath) => {
|
||||
}
|
||||
};
|
||||
|
||||
clearMode("go.mod");
|
||||
clearMode("exampleSite/go.mod");
|
||||
clearModules("go.mod");
|
||||
clearModules("exampleSite/go.mod");
|
77
scripts/projectSetup.js
Normal file
77
scripts/projectSetup.js
Normal file
@ -0,0 +1,77 @@
|
||||
const fs = require("fs");
|
||||
const path = require("path");
|
||||
|
||||
const getFolderName = (rootfolder) => {
|
||||
const configPath = path.join(
|
||||
rootfolder,
|
||||
"exampleSite/config/_default/config.toml"
|
||||
);
|
||||
const getConfig = fs.readFileSync(configPath, "utf8");
|
||||
const match = getConfig.match(/theme\s*=\s*\[?"([^"\]]+)"\]?/);
|
||||
let selectedTheme = null;
|
||||
if (match && match[1]) {
|
||||
selectedTheme = match[1];
|
||||
}
|
||||
return selectedTheme;
|
||||
};
|
||||
|
||||
const deleteFolder = (folderPath) => {
|
||||
if (fs.existsSync(folderPath)) {
|
||||
fs.rmSync(folderPath, { recursive: true, force: true });
|
||||
}
|
||||
};
|
||||
|
||||
const createNewfolder = (rootfolder, folderName) => {
|
||||
const newFolder = path.join(rootfolder, folderName);
|
||||
fs.mkdirSync(newFolder, { recursive: true });
|
||||
return newFolder;
|
||||
};
|
||||
|
||||
const iterateFilesAndFolders = (rootFolder, { destinationRoot }) => {
|
||||
const directory = path.join(rootFolder);
|
||||
const items = fs.readdirSync(directory, { withFileTypes: true });
|
||||
items.forEach((item) => {
|
||||
if (item.isDirectory()) {
|
||||
createNewfolder(destinationRoot, item.name);
|
||||
iterateFilesAndFolders(path.join(directory, item.name), {
|
||||
currentFolder: item.name,
|
||||
destinationRoot: path.join(destinationRoot, item.name),
|
||||
});
|
||||
} else {
|
||||
const sourceFile = path.join(directory, item.name);
|
||||
const destinationFile = path.join(destinationRoot, item.name);
|
||||
fs.renameSync(sourceFile, destinationFile);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
const setupProject = () => {
|
||||
const rootfolder = path.join(__dirname, "../");
|
||||
if (!fs.existsSync(path.join(rootfolder, "themes"))) {
|
||||
const folderList = ["layouts", "assets", "static"];
|
||||
const folderName = getFolderName(rootfolder);
|
||||
const newfolderName = createNewfolder(
|
||||
path.join(rootfolder, "themes"),
|
||||
folderName
|
||||
);
|
||||
|
||||
folderList.forEach((folder) => {
|
||||
const source = path.join(rootfolder, folder);
|
||||
const destination = path.join(newfolderName, folder);
|
||||
if (fs.existsSync(source)) {
|
||||
fs.mkdirSync(destination, { recursive: true });
|
||||
iterateFilesAndFolders(source, {
|
||||
currentFolder: folder,
|
||||
destinationRoot: destination,
|
||||
});
|
||||
deleteFolder(source);
|
||||
}
|
||||
});
|
||||
|
||||
const exampleSite = path.join(rootfolder, "exampleSite");
|
||||
iterateFilesAndFolders(exampleSite, { destinationRoot: rootfolder });
|
||||
deleteFolder(exampleSite);
|
||||
}
|
||||
};
|
||||
|
||||
setupProject();
|
93
scripts/themeSetup.js
Normal file
93
scripts/themeSetup.js
Normal file
@ -0,0 +1,93 @@
|
||||
const fs = require("fs");
|
||||
const path = require("path");
|
||||
|
||||
const createNewfolder = (rootfolder, folderName) => {
|
||||
const newFolder = path.join(rootfolder, folderName);
|
||||
fs.mkdirSync(newFolder, { recursive: true });
|
||||
return newFolder;
|
||||
};
|
||||
|
||||
const deleteFolder = (folderPath) => {
|
||||
if (fs.existsSync(folderPath)) {
|
||||
fs.rmSync(folderPath, { recursive: true, force: true });
|
||||
}
|
||||
};
|
||||
|
||||
const getFolderName = (rootfolder) => {
|
||||
const configPath = path.join(
|
||||
rootfolder,
|
||||
"exampleSite/config/_default/config.toml"
|
||||
);
|
||||
const getConfig = fs.readFileSync(configPath, "utf8");
|
||||
const match = getConfig.match(/theme\s*=\s*\[?"([^"\]]+)"\]?/);
|
||||
let selectedTheme = null;
|
||||
if (match && match[1]) {
|
||||
selectedTheme = match[1];
|
||||
}
|
||||
return selectedTheme;
|
||||
};
|
||||
|
||||
const iterateFilesAndFolders = (rootFolder, { destinationRoot }) => {
|
||||
const directory = path.join(rootFolder);
|
||||
const items = fs.readdirSync(directory, { withFileTypes: true });
|
||||
items.forEach((item) => {
|
||||
if (item.isDirectory()) {
|
||||
createNewfolder(destinationRoot, item.name);
|
||||
iterateFilesAndFolders(path.join(directory, item.name), {
|
||||
currentFolder: item.name,
|
||||
destinationRoot: path.join(destinationRoot, item.name),
|
||||
});
|
||||
} else {
|
||||
const sourceFile = path.join(directory, item.name);
|
||||
const destinationFile = path.join(destinationRoot, item.name);
|
||||
fs.renameSync(sourceFile, destinationFile);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
const setupTheme = () => {
|
||||
const rootFolder = path.join(__dirname, "../");
|
||||
|
||||
if (!fs.existsSync(path.join(rootFolder, "exampleSite"))) {
|
||||
const includesFiles = [
|
||||
"tailwind.config.js",
|
||||
"postcss.config.js",
|
||||
"go.mod",
|
||||
"config.toml",
|
||||
"assets",
|
||||
"config",
|
||||
"content",
|
||||
"i18n",
|
||||
"static",
|
||||
];
|
||||
|
||||
const folder = createNewfolder(rootFolder, "exampleSite");
|
||||
console.log({ folder });
|
||||
|
||||
fs.readdirSync(rootFolder, { withFileTypes: true }).forEach((file) => {
|
||||
if (includesFiles.includes(file.name)) {
|
||||
if (file.isDirectory()) {
|
||||
const destination = path.join(rootFolder, "exampleSite", file.name);
|
||||
fs.mkdirSync(destination, { recursive: true });
|
||||
iterateFilesAndFolders(path.join(rootFolder, file.name), {
|
||||
destinationRoot: destination,
|
||||
});
|
||||
deleteFolder(path.join(rootFolder, file.name));
|
||||
} else {
|
||||
fs.renameSync(
|
||||
path.join(rootFolder, file.name),
|
||||
path.join(folder, file.name)
|
||||
);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
const themes = path.join(rootFolder, "themes");
|
||||
iterateFilesAndFolders(path.join(themes, getFolderName(rootFolder)), {
|
||||
destinationRoot: rootFolder,
|
||||
});
|
||||
deleteFolder(themes);
|
||||
}
|
||||
};
|
||||
|
||||
setupTheme();
|
43
vercel-build.sh
Executable file
43
vercel-build.sh
Executable file
@ -0,0 +1,43 @@
|
||||
#!/bin/bash
|
||||
|
||||
# default versions
|
||||
NODE_VERSION='18.16.1';
|
||||
GO_VERSION='1.20.5';
|
||||
HUGO_VERSION='0.115.1';
|
||||
|
||||
# install Node.js
|
||||
# echo "Installing Node.js $NODE_VERSION..."
|
||||
# curl -sSOL https://nodejs.org/dist/v${NODE_VERSION}/node-v${NODE_VERSION}.tar.gz
|
||||
# tar -xzf node-v${NODE_VERSION}.tar.gz
|
||||
# export PATH=$PATH:/usr/local/bin
|
||||
# rm -rf node-v${NODE_VERSION}.tar.gz
|
||||
|
||||
echo "USING NODE VERSION: $(node -v)"
|
||||
|
||||
# install Go
|
||||
echo "Installing Go $GO_VERSION..."
|
||||
curl -sSOL https://dl.google.com/go/go${GO_VERSION}.linux-amd64.tar.gz
|
||||
tar -C /usr/local -xzf go${GO_VERSION}.linux-amd64.tar.gz
|
||||
export PATH=$PATH:/usr/local/go/bin
|
||||
rm -rf go${GO_VERSION}.linux-amd64.tar.gz
|
||||
go version
|
||||
|
||||
# install Hugo
|
||||
echo "Installing Hugo $HUGO_VERSION..."
|
||||
curl -sSOL https://github.com/gohugoio/hugo/releases/download/v${HUGO_VERSION}/hugo_extended_${HUGO_VERSION}_Linux-64bit.tar.gz
|
||||
tar -xzf hugo_extended_${HUGO_VERSION}_Linux-64bit.tar.gz
|
||||
mv hugo /usr/local/bin/
|
||||
rm -rf hugo_extended_${HUGO_VERSION}_Linux-64bit.tar.gz
|
||||
hugo version
|
||||
|
||||
# project setup
|
||||
echo "Project setting up..."
|
||||
npm run project-setup
|
||||
|
||||
# install dependencies
|
||||
echo "Installing project dependencies..."
|
||||
npm install
|
||||
|
||||
# run the build command
|
||||
echo "Running the build command..."
|
||||
npm run build
|
Loading…
Reference in New Issue
Block a user