added project-setup script

This commit is contained in:
somrat sorkar
2023-07-05 15:19:52 +06:00
parent dd723881c8
commit 8bc0dd868f
19 changed files with 251 additions and 259 deletions

View File

@@ -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

View File

@@ -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

View File

@@ -1,47 +0,0 @@
stages:
- build
variables:
HUGO_ENV: production
HUGO_VERSION: "0.114.0"
GO_VERSION: "1.16.3"
NODE_VERSION: "18.15.0"
cache:
paths:
- node_modules/
default:
image: node:${NODE_VERSION}
before_script:
- echo "USING NODE ${NODE_VERSION}"
- apt-get update && apt-get install -y curl
- curl -LO "https://github.com/gohugoio/hugo/releases/download/v${HUGO_VERSION}/hugo_extended_${HUGO_VERSION}_Linux-64bit.tar.gz"
- tar -xvf hugo_extended_${HUGO_VERSION}_Linux-64bit.tar.gz
- mv hugo /usr/local/bin/
- rm hugo_extended_${HUGO_VERSION}_Linux-64bit.tar.gz
- echo "HUGO ${HUGO_VERSION} INSTALLED"
- curl -LO "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 go${GO_VERSION}.linux-amd64.tar.gz
- 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 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

View File

@@ -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
}
}

View File

@@ -1,12 +0,0 @@
{
"overrides": [
{
"files": ["*.html"],
"options": {
"parser": "go-template",
"goTemplateBracketSpacing": true,
"bracketSameLine": true
}
}
]
}

View File

@@ -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/"

View File

@@ -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"

View File

@@ -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"
}
}

View File

@@ -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);
}

View File

@@ -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

View File

@@ -1,11 +0,0 @@
{
"builds": [
{
"src": "vercel-build.sh",
"use": "@vercel/static-build",
"config": {
"distDir": "public"
}
}
]
}