added cleanMode script and fixed github workflow

This commit is contained in:
somrat sorkar 2023-06-26 14:12:20 +06:00
parent aa471f8846
commit 56959fd77a
5 changed files with 41 additions and 31 deletions

View File

@ -53,11 +53,7 @@ jobs:
run: npm install run: npm install
- name: Publish to GitHub Pages - name: Publish to GitHub Pages
run: | run: npm run build
cd exampleSite; \
hugo --gc --minify --baseURL "${{ steps.pages.outputs.base_url }}/" || \
hugo --themesDir ../.. --gc --minify --baseURL "${{ steps.pages.outputs.base_url }}/"
echo "SITE BUILT SUCCESSFULLY! LIVE AT: ${{ steps.pages.outputs.base_url }}"
- name: Upload artifact - name: Upload artifact
uses: actions/upload-pages-artifact@v1 uses: actions/upload-pages-artifact@v1

View File

@ -3,27 +3,27 @@ module hugoplate.netlify.app
go 1.20 go 1.20
require ( require (
github.com/gethugothemes/hugo-modules/accordion v0.0.0-20230606070512-0887967dba40 // indirect github.com/gethugothemes/hugo-modules/accordion v0.0.0-20230618103508-54805e19264d // indirect
github.com/gethugothemes/hugo-modules/adsense v0.0.0-20230606070512-0887967dba40 // indirect github.com/gethugothemes/hugo-modules/adsense v0.0.0-20230618103508-54805e19264d // indirect
github.com/gethugothemes/hugo-modules/components/cookie-consent v0.0.0-20230606070512-0887967dba40 // indirect github.com/gethugothemes/hugo-modules/components/cookie-consent v0.0.0-20230618103508-54805e19264d // indirect
github.com/gethugothemes/hugo-modules/components/custom-script v0.0.0-20230606070512-0887967dba40 // indirect github.com/gethugothemes/hugo-modules/components/custom-script v0.0.0-20230618103508-54805e19264d // indirect
github.com/gethugothemes/hugo-modules/components/preloader v0.0.0-20230606070512-0887967dba40 // indirect github.com/gethugothemes/hugo-modules/components/preloader v0.0.0-20230618103508-54805e19264d // indirect
github.com/gethugothemes/hugo-modules/components/render-link v0.0.0-20230606070512-0887967dba40 // indirect github.com/gethugothemes/hugo-modules/components/render-link v0.0.0-20230618103508-54805e19264d // indirect
github.com/gethugothemes/hugo-modules/components/social-share v0.0.0-20230606070512-0887967dba40 // indirect github.com/gethugothemes/hugo-modules/components/social-share v0.0.0-20230618103508-54805e19264d // indirect
github.com/gethugothemes/hugo-modules/gallery-slider v0.0.0-20230606070512-0887967dba40 // indirect github.com/gethugothemes/hugo-modules/gallery-slider v0.0.0-20230618103508-54805e19264d // indirect
github.com/gethugothemes/hugo-modules/gzip-caching v0.0.0-20230606070512-0887967dba40 // indirect github.com/gethugothemes/hugo-modules/gzip-caching v0.0.0-20230618103508-54805e19264d // indirect
github.com/gethugothemes/hugo-modules/icons/font-awesome v0.0.0-20230606070512-0887967dba40 // indirect github.com/gethugothemes/hugo-modules/icons/font-awesome v0.0.0-20230618103508-54805e19264d // indirect
github.com/gethugothemes/hugo-modules/images v0.0.0-20230606070512-0887967dba40 // indirect github.com/gethugothemes/hugo-modules/images v0.0.0-20230618103508-54805e19264d // indirect
github.com/gethugothemes/hugo-modules/modal v0.0.0-20230606070512-0887967dba40 // indirect github.com/gethugothemes/hugo-modules/modal v0.0.0-20230618103508-54805e19264d // indirect
github.com/gethugothemes/hugo-modules/pwa v0.0.0-20230606070512-0887967dba40 // indirect github.com/gethugothemes/hugo-modules/pwa v0.0.0-20230618103508-54805e19264d // indirect
github.com/gethugothemes/hugo-modules/search v0.0.0-20230606070512-0887967dba40 // indirect github.com/gethugothemes/hugo-modules/search v0.0.0-20230618103508-54805e19264d // indirect
github.com/gethugothemes/hugo-modules/seo-tools/basic-seo v0.0.0-20230606070512-0887967dba40 // indirect github.com/gethugothemes/hugo-modules/seo-tools/basic-seo v0.0.0-20230618103508-54805e19264d // indirect
github.com/gethugothemes/hugo-modules/seo-tools/google-tag-manager v0.0.0-20230606070512-0887967dba40 // indirect github.com/gethugothemes/hugo-modules/seo-tools/google-tag-manager v0.0.0-20230618103508-54805e19264d // indirect
github.com/gethugothemes/hugo-modules/seo-tools/site-verifications v0.0.0-20230606070512-0887967dba40 // indirect github.com/gethugothemes/hugo-modules/seo-tools/site-verifications v0.0.0-20230618103508-54805e19264d // indirect
github.com/gethugothemes/hugo-modules/shortcodes/button v0.0.0-20230606070512-0887967dba40 // indirect github.com/gethugothemes/hugo-modules/shortcodes/button v0.0.0-20230618103508-54805e19264d // indirect
github.com/gethugothemes/hugo-modules/shortcodes/codepen v0.0.0-20230606070512-0887967dba40 // indirect github.com/gethugothemes/hugo-modules/shortcodes/codepen v0.0.0-20230618103508-54805e19264d // indirect
github.com/gethugothemes/hugo-modules/shortcodes/notice v0.0.0-20230606070512-0887967dba40 // indirect github.com/gethugothemes/hugo-modules/shortcodes/notice v0.0.0-20230618103508-54805e19264d // indirect
github.com/gethugothemes/hugo-modules/tab v0.0.0-20230606070512-0887967dba40 // indirect github.com/gethugothemes/hugo-modules/tab v0.0.0-20230618103508-54805e19264d // indirect
github.com/gethugothemes/hugo-modules/table-of-contents v0.0.0-20230606070512-0887967dba40 // indirect github.com/gethugothemes/hugo-modules/table-of-contents v0.0.0-20230618103508-54805e19264d // indirect
github.com/gethugothemes/hugo-modules/videos v0.0.0-20230606070512-0887967dba40 // indirect github.com/gethugothemes/hugo-modules/videos v0.0.0-20230618103508-54805e19264d // indirect
) )

View File

@ -8,7 +8,7 @@
"dev": "cd exampleSite; hugo server || hugo server --themesDir ../..", "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", "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", "build": "cd exampleSite; hugo --gc --minify --templateMetrics --templateMetricsHints --buildDrafts --buildExpired --buildFuture --forceSyncStatic || hugo --themesDir ../.. --gc --minify --templateMetrics --templateMetricsHints --buildDrafts --buildExpired --buildFuture --forceSyncStatic",
"update-modules": "hugo mod clean && hugo mod get -u ./... && hugo mod tidy", "update-modules": "node ./scripts/cleanMod.js && hugo mod clean --all && hugo mod get -u ./... && hugo mod tidy",
"format": "prettier -w .", "format": "prettier -w .",
"remove-darkmode": "node ./scripts/removeDarkmode.js && yarn format" "remove-darkmode": "node ./scripts/removeDarkmode.js && yarn format"
}, },

View File

@ -1,14 +1,14 @@
{ {
"name": "hugoplate", "name": "hugoplate",
"description": "hugo tailwindcss boilerplate", "description": "hugo tailwindcss boilerplate",
"version": "1.1.1", "version": "1.1.2",
"license": "MIT", "license": "MIT",
"author": "zeon.studio", "author": "zeon.studio",
"scripts": { "scripts": {
"dev": "cd exampleSite; hugo server || hugo server --themesDir ../..", "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", "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", "build": "cd exampleSite; hugo --gc --minify --templateMetrics --templateMetricsHints --buildDrafts --buildExpired --buildFuture --forceSyncStatic || hugo --themesDir ../.. --gc --minify --templateMetrics --templateMetricsHints --buildDrafts --buildExpired --buildFuture --forceSyncStatic",
"update-modules": "hugo mod clean --all && hugo mod get -u ./... && hugo mod tidy", "update-modules": "node ./scripts/cleanMod.js && hugo mod clean --all && hugo mod get -u ./... && hugo mod tidy",
"format": "prettier -w .", "format": "prettier -w .",
"remove-darkmode": "node ./scripts/removeDarkmode.js && yarn format" "remove-darkmode": "node ./scripts/removeDarkmode.js && yarn format"
}, },

14
scripts/cleanMod.js Normal file
View File

@ -0,0 +1,14 @@
const fs = require("fs");
const clearMode = (filePath) => {
if (fs.existsSync(filePath)) {
let fileContent = fs.readFileSync(filePath, "utf8");
fileContent = fileContent.replace(/require\s*\([\s\S]*?\)/, "");
fs.writeFileSync(filePath, fileContent, "utf8");
} else {
console.log("File does not exist.");
}
};
clearMode("go.mod");
clearMode("exampleSite/go.mod");