Skip to content

Commit

Permalink
added project-setup script
Browse files Browse the repository at this point in the history
  • Loading branch information
tfsomrat committed Jul 5, 2023
1 parent dd72388 commit 8bc0dd8
Show file tree
Hide file tree
Showing 19 changed files with 251 additions and 259 deletions.
9 changes: 6 additions & 3 deletions .github/workflows/hugo.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
Expand Down Expand Up @@ -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

Expand All @@ -58,7 +61,7 @@ jobs:
- name: Upload artifact
uses: actions/upload-pages-artifact@v1
with:
path: ./exampleSite/public
path: ./public

# Deployment job
deploy:
Expand Down
16 changes: 4 additions & 12 deletions exampleSite/.gitlab-ci.yml → .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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
14 changes: 0 additions & 14 deletions exampleSite/.editorconfig

This file was deleted.

15 changes: 0 additions & 15 deletions exampleSite/.gitignore

This file was deleted.

59 changes: 0 additions & 59 deletions exampleSite/.jshintrc

This file was deleted.

12 changes: 0 additions & 12 deletions exampleSite/.prettierrc

This file was deleted.

5 changes: 3 additions & 2 deletions exampleSite/config/_default/config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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/"


Expand Down
17 changes: 0 additions & 17 deletions exampleSite/netlify.toml

This file was deleted.

29 changes: 0 additions & 29 deletions exampleSite/package.json

This file was deleted.

52 changes: 0 additions & 52 deletions exampleSite/scripts/removeDarkmode.js

This file was deleted.

20 changes: 0 additions & 20 deletions exampleSite/vercel-build.sh

This file was deleted.

18 changes: 4 additions & 14 deletions netlify.toml
Original file line number Diff line number Diff line change
@@ -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 changes: 12 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down
6 changes: 6 additions & 0 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,12 @@
- Npm v9.5+
- Tailwindcss v3+

### 👉 Project Setup

```
npm run project-setup
```

### 👉 Development Command

```
Expand Down
6 changes: 3 additions & 3 deletions scripts/cleanMod.js → scripts/clearModules.js
Original file line number Diff line number Diff line change
@@ -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]*?\)/, "");
Expand All @@ -10,5 +10,5 @@ const clearMode = (filePath) => {
}
};

clearMode("go.mod");
clearMode("exampleSite/go.mod");
clearModules("go.mod");
clearModules("exampleSite/go.mod");
Loading

0 comments on commit 8bc0dd8

Please sign in to comment.