Skip to content

Commit de55814

Browse files
committed
Modern build system
Replace gulp with direct esbuild and sass
1 parent b7ae30d commit de55814

File tree

11 files changed

+379
-3283
lines changed

11 files changed

+379
-3283
lines changed

.github/workflows/main.yml

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,10 +43,7 @@ jobs:
4343
# Prepare our app
4444
- run: mysql --protocol=tcp --user=root --execute='SET GLOBAL sql_mode = "";'
4545
- run: cp application/configs/application.sample.ini application/configs/application.ini
46-
- run: composer install --ansi --classmap-authoritative
47-
- run: php bin/update_database.php
48-
- run: yarn install --frozen-lockfile
49-
- run: ./node_modules/.bin/gulp
46+
- run: ./bin/build.sh
5047

5148
# Lint and tests
5249
- run: ./vendor/bin/php-cs-fixer fix --format=checkstyle | cs2pr

README.md

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,17 +11,16 @@ an IMDb movie). This is possible thanks to the use of user-script (greasemonkey
1111
* PHP with cURL module
1212
* Apache
1313
* MariaDB
14-
* gulp
1514

1615
## Installation
1716

1817
1. Create a database and a user in MariaDB (eg: "mqueue")
19-
2. Download latest version: ``git clone https://github.com/PowerKiKi/mqueue.git``
20-
3. In application/configs/, copy application.sample.ini to application.ini and edit database configuration
21-
4. Run ``yarn install && gulp``
18+
2. Download latest version: `git clone https://github.com/PowerKiKi/mqueue.git`
19+
3. In `application/configs/`, copy `application.sample.ini` to `application.ini` and edit database configuration
20+
4. Run `./bin/build.sh`
2221
5. Open mQueue in your browser (something similar to http://mqueue/ or http://localhost/mqueue/public/)
2322

2423
## Upgrade
2524

26-
1. Download latest version: ``git pull``
27-
2. Run ``yarn install && gulp``
25+
1. Download latest version: `git pull`
26+
2. Run `./bin/build.sh`

application/sass/_local.scss

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
@use "variables";
12
:root {
23
--font-color: #595959;
34
}
@@ -25,17 +26,17 @@ body {
2526
background: white;
2627
width: 900px;
2728
margin: 0 auto;
28-
border: 6px solid $color1;
29+
border: 6px solid variables.$color1;
2930
border-radius: 10px;
3031
-moz-border-radius: 10px;
3132
-webkit-border-radius: 10px;
3233
padding-bottom: 2em;
3334
}
3435

3536
#header {
36-
background-image: repeating-linear-gradient(-45deg, $color1, $color1 15px, $color2 15px, $color2 30px);
37-
background-image: -webkit-repeating-linear-gradient(-45deg, $color1, $color1 15px, $color2 15px, $color2 30px);
38-
background-color: $color2;
37+
background-image: repeating-linear-gradient(-45deg, variables.$color1, variables.$color1 15px, variables.$color2 15px, variables.$color2 30px);
38+
background-image: -webkit-repeating-linear-gradient(-45deg, variables.$color1, variables.$color1 15px, variables.$color2 15px, variables.$color2 30px);
39+
background-color: variables.$color2;
3940
h1 {
4041
margin: 0px;
4142
a {
@@ -389,7 +390,7 @@ div.flashmessenger {
389390
#search {
390391
opacity: 0.8;
391392
width: 10em;
392-
border: 2px solid $color1;
393+
border: 2px solid variables.$color1;
393394
&:hover, &:focus {
394395
opacity: 1;
395396
}

application/sass/_status.scss

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
@import "variables";
1+
@use "variables";
2+
@use "sass:math";
23

34
$status_dimension: 16px;
45
$preloader_width : 5 * $status_dimension;
@@ -33,9 +34,9 @@ $preloader_height: 6px;
3334

3435
> .preloader {
3536
display: block !important;
36-
margin-top: ($status_dimension - $preloader_height) / 2;
37+
margin-top: math.div($status_dimension - $preloader_height, 2);
3738
height: $preloader_height;
38-
background-color: $color1;
39+
background-color: variables.$color1;
3940
border-radius: 3px;
4041
animation-name: preloaderAnimation;
4142
animation-duration: 1.5s;

application/sass/application.scss

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
1+
@use "sass:meta";
2+
@use "variables";
13
@CHARSET "UTF-8";
24

3-
@import "variables";
4-
@import "local";
5-
@import "status";
5+
@include meta.load-css("local");
6+
@include meta.load-css("status");
67

78
@media handheld, only screen and (max-width: 480px), only screen and (max-device-width: 480px) {
8-
@import "handheld";
9+
@include meta.load-css("handheld");
910
}
1011

1112
@media print {
12-
@import "print";
13+
@include meta.load-css("print");
1314
}

application/sass/both.scss

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
@use "sass:meta";
12
@CHARSET "UTF-8";
23

3-
@import "status";
4+
@include meta.load-css("status");

bin/build.sh

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
#!/usr/bin/env bash
2+
3+
# Try to use specific PHP, or fallback to default version
4+
PHP=`which php7.2` || PHP='php'
5+
COMPOSER="$PHP `which composer` --no-interaction --no-plugins"
6+
7+
# Exit script on any error
8+
set -e
9+
10+
echo "Installing git hooks..."
11+
ln -fs ../../bin/pre-commit.sh .git/hooks/pre-commit
12+
13+
echo "Updating Node.js packages..."
14+
yarn install
15+
16+
echo "Updating all PHP dependencies via composer..."
17+
$COMPOSER install --classmap-authoritative --ignore-platform-reqs
18+
19+
echo "Updating database..."
20+
$PHP ./bin/update_database.php
21+
22+
echo "Compiling CSS..."
23+
./node_modules/.bin/sass --style=compressed --no-source-map application/sass/:public/css/
24+
25+
echo "Compiling JavaScript..."
26+
./node_modules/.bin/esbuild --minify public/js/*.js --outdir=public/js/min
27+
cat public/js/application/*.js | ./node_modules/.bin/esbuild --minify > public/js/min/application.js

bin/sql/version.0.sql

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO";
2020
--
2121

2222
CREATE TABLE IF NOT EXISTS `movie` (
23-
`id` varchar(7) collate utf8_bin NOT NULL,
23+
`id` varchar(8) collate utf8_bin NOT NULL,
2424
`dateUpdate` timestamp NOT NULL default CURRENT_TIMESTAMP,
2525
`title` varchar(512) collate utf8_bin NOT NULL,
2626
PRIMARY KEY (`id`)
@@ -35,7 +35,7 @@ CREATE TABLE IF NOT EXISTS `movie` (
3535
CREATE TABLE IF NOT EXISTS `status` (
3636
`id` int(11) NOT NULL auto_increment,
3737
`idUser` int(11) NOT NULL,
38-
`idMovie` varchar(7) collate utf8_bin NOT NULL,
38+
`idMovie` varchar(8) collate utf8_bin NOT NULL,
3939
`rating` tinyint(4) NOT NULL,
4040
PRIMARY KEY (`id`),
4141
UNIQUE KEY `unique_status` (`idUser`,`idMovie`),

gulpfile.js

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

package.json

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,10 @@
22
"name": "mqueue",
33
"private": true,
44
"dependencies": {
5-
"gulp": "^4.0.2",
6-
"gulp-concat": "^2.6.1",
7-
"gulp-sass": "^4.1.0",
8-
"gulp-terser": "^2.0.1",
9-
"highcharts": "^9.0.1",
5+
"esbuild": "^0.25.1",
6+
"highcharts": "^12.1.2",
107
"jquery": "^3.6.0",
8+
"sass": "^1.86.0",
119
"timeago": "^1.6.7"
1210
}
1311
}

0 commit comments

Comments
 (0)