remove npm and fix build script
This commit is contained in:
10
LICENSE
10
LICENSE
@@ -1,10 +0,0 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2021 Bryce Wray
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
47
build.sh
47
build.sh
@@ -1,7 +1,42 @@
|
||||
rm -rf build
|
||||
# rm -rf public
|
||||
npm run prod:build
|
||||
rsync -rav static/ public/
|
||||
echo 'see http://localhost:3000/'
|
||||
node -e '(e=require("express"))().use(e.static("public")).listen(3000)'
|
||||
echo "Starting build..."
|
||||
|
||||
# TODO: Check if current version is latest to avoid redundant installation
|
||||
if [[ -f "tailwindcss" ]]
|
||||
then
|
||||
rm tailwindcss
|
||||
fi
|
||||
|
||||
# checks os and architecture for correct release
|
||||
# https://stackoverflow.com/a/8597411
|
||||
echo "Installing & building tailwind..."
|
||||
ASSET="tailwindcss"
|
||||
|
||||
if [[ "$OSTYPE" == "linux-gnu"* ]]; then
|
||||
ASSET="$ASSET-linux"
|
||||
elif [[ "$OSTYPE" == "darwin"* ]]; then
|
||||
ASSET="$ASSET-macos"
|
||||
fi
|
||||
if [[ "$(uname -m)" == "x86_64"* ]]; then
|
||||
ASSET="$ASSET-x64"
|
||||
elif [[ "$(uname -m)" == "arm64"* ]]; then
|
||||
ASSET="$ASSET-arm64"
|
||||
fi
|
||||
|
||||
curl -sLO "https://github.com/tailwindlabs/tailwindcss/releases/latest/download/${ASSET}"
|
||||
chmod +x $ASSET
|
||||
mv $ASSET tailwindcss
|
||||
|
||||
|
||||
# initialized and configures tailwind if not configured
|
||||
echo "Initializing tailwind..."
|
||||
if [[ ! -f "tailwind.config.js" ]]
|
||||
then
|
||||
./tailwindcss init
|
||||
sed -i '' "s| content: \\[\\],| content: \\['./templates/**/*.html'\\],|g" tailwind.config.js
|
||||
fi
|
||||
|
||||
# compiles tailwind css for prod & builds project
|
||||
echo "Compiling tailwindcss and building zola project..."
|
||||
rm -rf public static/css
|
||||
./tailwindcss -i css/index.css -o ./static/css/index.css --minify
|
||||
zola build
|
||||
|
||||
20
initcss.js
20
initcss.js
@@ -1,20 +0,0 @@
|
||||
// Makes a simple ./static/css/index.css file right after "clean" so there *is* one
|
||||
// ... thus keeping Zola from erroring out when you do `npm run start` (dev mode)
|
||||
|
||||
const fs = require("fs")
|
||||
const initDir = 'static/css'
|
||||
const initCSSFile = 'static/css/index.css'
|
||||
const initValue = `
|
||||
body {
|
||||
color: green;
|
||||
background-color: yellow;
|
||||
font-family: monospace;
|
||||
}
|
||||
`
|
||||
|
||||
if(!fs.existsSync(initDir)) {
|
||||
fs.mkdirSync(initDir)
|
||||
}
|
||||
if(!fs.existsSync(initCSSFile)) {
|
||||
fs.writeFileSync(initCSSFile, initValue)
|
||||
}
|
||||
42
package.json
42
package.json
@@ -1,42 +0,0 @@
|
||||
{
|
||||
"name": "website",
|
||||
"description": "ThreeFold IO Website",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"clean": "rimraf public && rimraf static/css",
|
||||
"initcss": "node initcss.js",
|
||||
"getContent": "node getContent.ts",
|
||||
"start": "TAILWIND_MODE=watch NODE_ENV=development npm-run-all clean initcss --parallel dev:*",
|
||||
"dev:postcss": "postcss css/index.css -o ./static/css/index.css --config ./postcss.config.js -w",
|
||||
"dev:serve": "zola serve",
|
||||
"build": "NODE_ENV=production npm-run-all clean prod:postcss prod:build",
|
||||
"prod:postcss": "postcss css/index.css -o ./static/css/index.css --config ./postcss.config.js",
|
||||
"prod:build": "zola build -o public"
|
||||
},
|
||||
"author": "",
|
||||
"license": "MIT",
|
||||
"browserslist": [
|
||||
"last 4 versions",
|
||||
"> 1%",
|
||||
"maintained node versions"
|
||||
],
|
||||
"devDependencies": {
|
||||
"autoprefixer": "^10.4.2",
|
||||
"glob": "^7.1.7",
|
||||
"glob-all": "^3.2.1",
|
||||
"npm-run-all": "^4.1.5",
|
||||
"postcss": "^8.4.8",
|
||||
"postcss-cli": "^8.3.1",
|
||||
"postcss-csso": "^5.0.1",
|
||||
"postcss-import": "^14.0.2",
|
||||
"postcss-nesting": "^8.0.1",
|
||||
"rimraf": "^3.0.2",
|
||||
"tailwindcss": "^3.0.23",
|
||||
"ts-rmb-http-client": "^1.0.3",
|
||||
"typescript": "^4.5.5"
|
||||
},
|
||||
"dependencies": {
|
||||
"express": "^4.18.1",
|
||||
"ts-rmb-http-client": "^1.0.3"
|
||||
}
|
||||
}
|
||||
@@ -1,10 +0,0 @@
|
||||
module.exports = {
|
||||
plugins: [
|
||||
require('postcss-import'),
|
||||
require('tailwindcss/nesting'),
|
||||
require('tailwindcss'),
|
||||
require('autoprefixer'),
|
||||
require('postcss-nesting'),
|
||||
require('postcss-csso'),
|
||||
],
|
||||
}
|
||||
Reference in New Issue
Block a user