Skip to content

Commit 0e56a46

Browse files
jaapmarcusAlecRust
andauthored
Build JS/CSS Theme on release (hestiacp#3525)
Co-authored-by: Alec Rust <me@alecrust.com>
1 parent 2d42bd3 commit 0e56a46

File tree

16 files changed

+70
-107
lines changed

16 files changed

+70
-107
lines changed

.drone.yml

Lines changed: 9 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -25,16 +25,10 @@ steps:
2525
- git submodule update --init --recursive
2626
- name: Build Hestia package and install
2727
commands:
28+
- yarn set version stable
29+
- yarn install
30+
- yarn build
2831
- ./src/hst_autocompile.sh --hestia --install '~localsrc'
29-
- name: Run system / user tests
30-
commands:
31-
- bats ./test/test.bats
32-
- name: Run restore tests
33-
commands:
34-
- bats ./test/restore.bats
35-
- name: Run config tests
36-
commands:
37-
- bats ./test/config-tests.bats
3832

3933
trigger:
4034
event: [pull_request, push]
@@ -73,19 +67,6 @@ steps:
7367
- name: Build Hestia package install
7468
commands:
7569
- ./src/hst_autocompile.sh --hestia --install '~localsrc'
76-
- name: Run system / user tests
77-
commands:
78-
- bats ./test/test.bats
79-
- name: Run restore tests
80-
commands:
81-
- bats ./test/restore.bats
82-
- name: Run Letsencrypt test against Staging
83-
commands:
84-
- cp /root/le-env.sh /tmp/hestia-le-env.sh
85-
- bats ./test/letsencrypt.bats
86-
- name: Run config tests
87-
commands:
88-
- bats ./test/config-tests.bats
8970

9071
trigger:
9172
event: [pull_request, push]
@@ -106,6 +87,12 @@ platform:
10687
arch: amd64
10788

10889
steps:
90+
- name: Build JS/CSS
91+
image: node:current-slim
92+
commands:
93+
- yarn set version stable
94+
- yarn install
95+
- yarn build
10996
- name: Build
11097
image: debian:bullseye
11198
commands:

.github/dependabot.yml

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,19 @@ updates:
77
interval: "weekly"
88

99
# Maintain dependencies for npm
10-
# TODO: Enable this when we build JS and have no checked-in minified JS/CSS
11-
# - package-ecosystem: "npm"
12-
# directory: "/web"
13-
# schedule:
14-
# interval: "weekly"
10+
- package-ecosystem: "npm"
11+
directory: "/"
12+
schedule:
13+
interval: "weekly"
1514

1615
# Maintain dependencies for Composer
1716
- package-ecosystem: "composer"
1817
directory: "/web/inc" # Location of package manifests
1918
schedule:
2019
interval: "weekly"
20+
21+
# Maintain dependencies for Composer
22+
- package-ecosystem: "composer"
23+
directory: "/web/src" # Location of package manifests
24+
schedule:
25+
interval: "weekly"

.gitignore

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,12 @@
2525

2626
.env
2727

28+
# Distribution CSS
29+
web/css/themes/
30+
31+
# Distribution JS
32+
web/js/dist/
33+
2834
# Composer
2935
composer.phar
3036
test/vendor/

bin/v-update-sys-hestia-git

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/bin/bash
22
# info: Install update from Git repository
3-
# options: REPOSITORY BRANCH INSTALL [PACKAGES]
3+
# options: REPOSITORY BRANCH INSTALL
44
#
55
# example: v-update-sys-hestia-git hestiacp staging/beta install
66
# # Will download from the hestiacp repository
@@ -24,6 +24,11 @@ source_conf "$HESTIA/conf/hestia.conf"
2424
# Perform verification if read-only mode is enabled
2525
check_hestia_demo_mode
2626

27+
if [ -z $(which "yarn") ]; then
28+
echo "Unable to locate Yarn and NodeJS See https://hestiacp.com/docs/contributing/development.html"
29+
exit 0
30+
fi
31+
2732
# Define download function
2833
download_file() {
2934
local url=$1
@@ -294,6 +299,11 @@ mkdir -p $BUILD_DIR_HESTIA/usr/local/hestia
294299

295300
# Move needed directories
296301
cd $BUILD_DIR/hestiacp-$branch_dash
302+
303+
yarn set version stable
304+
yarn install
305+
yarn build
306+
297307
cp -rf bin func install web $BUILD_DIR_HESTIA/usr/local/hestia/
298308

299309
# Set permissions

build.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ function getOutputPath(pkg) {
6767
// Process a CSS file
6868
async function processCSS(inputFile, outputFile) {
6969
try {
70+
await ensureDir(path.dirname(outputFile));
7071
const css = await fs.readFile(inputFile);
7172
const result = await postcss(postcssConfig.plugins).process(css, {
7273
from: inputFile,
@@ -97,6 +98,17 @@ async function buildCSS() {
9798
await Promise.all(cssBuildPromises);
9899
}
99100

101+
// Ensure a directory exists
102+
async function ensureDir(dir) {
103+
try {
104+
await fs.mkdir(dir, { recursive: true });
105+
} catch (error) {
106+
if (error.code !== 'EEXIST') {
107+
throw error;
108+
}
109+
}
110+
}
111+
100112
// Build all assets
101113
async function build() {
102114
console.log('🚀 Building JS and CSS...');

docs/docs/contributing/development.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,16 @@ multipass mount $HOME/projects/hestiacp hestia-dev:/home/ubuntu/hestiacp
5151
sudo apt update && sudo apt install -y jq libjq1
5252
```
5353

54+
1. Install [Node JS](https://nodejs.org/en) and Yarn `npm install --global yarn`
55+
56+
1. Build the theme files with
57+
58+
```bash
59+
yarn set version stable
60+
yarn install
61+
yarn build
62+
```
63+
5464
1. Navigate to `/src` and build Hestia packages
5565

5666
```bash
@@ -175,6 +185,8 @@ Use if you have Hestia already installed, for your changes to take effect.
175185

176186
The following is useful for testing a Pull Request or a branch on a fork.
177187

188+
Make sure to install [Node JS](https://nodejs.org/en) and Yarn `npm install --global yarn` before.
189+
178190
```bash
179191
# Replace with https://github.com/username/hestiacp.git if you want to test a branch that you created yourself
180192
git clone https://github.com/hestiacp/hestiacp.git
@@ -183,6 +195,13 @@ cd ./hestiacp/
183195
# Replace main with the branch you want to test
184196
git checkout main
185197

198+
# Enable Yarn 3.x
199+
yarn set version stable
200+
# Install Dependencies
201+
yarn install
202+
# Build
203+
yarn build
204+
186205
cd ./src/
187206

188207
# Compile packages

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
"preinstall": "npx only-allow yarn",
1818
"postinstall": "husky install"
1919
},
20-
"packageManager": "yarn@3.5.0",
20+
"packageManager": "yarn@3.5.1",
2121
"dependencies": {
2222
"@fortawesome/fontawesome-free": "^6.4.0",
2323
"alpinejs": "^3.12.0",

web/css/themes/dark.min.css

Lines changed: 0 additions & 1 deletion
This file was deleted.

web/css/themes/default.min.css

Lines changed: 0 additions & 19 deletions
This file was deleted.

web/css/themes/flat.min.css

Lines changed: 0 additions & 1 deletion
This file was deleted.

0 commit comments

Comments
 (0)