Skip to content
This repository has been archived by the owner on Aug 27, 2022. It is now read-only.

Add build pipeline, improve JavaScript #90

Merged
merged 25 commits into from Aug 6, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
df8bff4
Add Babel to Gulp
andreasremdt Jul 31, 2020
607e76c
Move files into src, remove async/await
andreasremdt Jul 31, 2020
38e2b9c
Install latest version of simple-translator
andreasremdt Jul 31, 2020
a61a192
Add simple-translator as dependencie
andi34 Jul 31, 2020
9778e58
eslint: changed path to src/js, run eslint --fix
andi34 Aug 1, 2020
91b9766
.gitignore: ignore transpiled js files inside resources/js/
andi34 Aug 1, 2020
8cbc7b2
.gitignore: ignore vendor/simple-translator/
andi34 Aug 1, 2020
0890c76
gallery.php: move javascript out of php
andi34 Aug 1, 2020
e02c1e3
manual: move javascript out of php
andi34 Aug 1, 2020
c3d8ca0
restore i18n-sub.js
andi34 Aug 1, 2020
9e2e19a
pack-build: add simple-translator
andi34 Aug 1, 2020
10a49b9
simple-translator: language and debug depend on photobooth config
andi34 Aug 1, 2020
574112c
Fix package.json deps versions
andreasremdt Aug 3, 2020
83f5394
scripts (pack-build): add whatwg-fetch
andi34 Aug 3, 2020
eaf8282
.editorconfig: adjust path for *.js files
andi34 Aug 4, 2020
f60ad70
Bump simple-translator to v2.0.2
andreasremdt Aug 4, 2020
3c6a7bc
Install prettier & npm-run-all
andreasremdt Aug 4, 2020
10191a6
yarn (pack:build): run all needed steps before creating a package
andi34 Aug 4, 2020
4185e94
yarn.lock: recreate
andi34 Aug 4, 2020
62ad8c3
chore (build): format all files before gulp task runs
andi34 Aug 4, 2020
8c84f42
whatwg-fetch: fix path for admin, login, manual and slideshow
andi34 Aug 5, 2020
bdf7adc
docs (README): Safari 9 is supported now
andi34 Aug 5, 2020
adf6e04
PhotoSwipe: switch back to own fork, add as git submodule
andi34 Aug 5, 2020
f33649c
update-booth.sh: remove old simple-translator if exist
andi34 Aug 5, 2020
f7051a1
workflows (gulp-sass): adjust after latest changes
andi34 Aug 5, 2020
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions .editorconfig
Expand Up @@ -3,9 +3,9 @@
# top-most EditorConfig file
root = true

[resources/js/**.js]
[src/js/**.js]
charset = utf-8
indent_style = space
indent_size = 4
insert_final_newline = true
trim_trailing_whitespace = true
trim_trailing_whitespace = true
16 changes: 4 additions & 12 deletions .eslintrc.json
Expand Up @@ -20,7 +20,7 @@
"array-bracket-newline": "error",
"array-bracket-spacing": "error",
"array-callback-return": "error",
"array-element-newline": "error",
"array-element-newline": "off",
"arrow-body-style": "error",
"arrow-parens": "error",
"arrow-spacing": [
Expand Down Expand Up @@ -88,7 +88,7 @@
"error",
"consistent"
],
"function-paren-newline": "error",
"function-paren-newline": "off",
"generator-star-spacing": "error",
"global-require": "error",
"guard-for-in": "error",
Expand Down Expand Up @@ -289,19 +289,11 @@
],
"valid-jsdoc": "error",
"vars-on-top": "off",
"wrap-regex": "error",
"wrap-regex": "off",
"yield-star-spacing": "error",
"yoda": [
"error",
"never"
]
},
"overrides": [
{
"files": ["i18n.js", "i18n-sub.js"],
"parserOptions": {
"sourceType": "module"
}
}
]
}
}
2 changes: 1 addition & 1 deletion .github/workflows/gulp_sass.yml
Expand Up @@ -23,4 +23,4 @@ jobs:
- name: Install modules
run: yarn install
- name: Running gulp-sass
run: yarn build
run: yarn build:sass
2 changes: 2 additions & 0 deletions .gitignore
Expand Up @@ -7,8 +7,10 @@ digicamcontrol/
node_modules/
package-lock.json
resources/css/
resources/js/
stats
trash
vendor/simple-translator/
.sass-cache
/.htaccess
.htpasswd
Expand Down
3 changes: 3 additions & 0 deletions .gitmodules
Expand Up @@ -8,3 +8,6 @@
[submodule "vendor/rpihotspot"]
path = vendor/rpihotspot
url = https://github.com/andi34/rpihotspot
[submodule "vendor/PhotoSwipe"]
path = vendor/PhotoSwipe
url = https://github.com/andi34/PhotoSwipe
1 change: 1 addition & 0 deletions .npmrc
@@ -0,0 +1 @@
scripts-prepend-node-path=true
6 changes: 6 additions & 0 deletions .prettierrc
@@ -0,0 +1,6 @@
{
"trailingComma": "none",
"singleQuote": true,
"bracketSpacing": false,
"printWidth": 120
}
7 changes: 1 addition & 6 deletions README.md
Expand Up @@ -10,12 +10,6 @@ This is my personal Photobooth fork with some extras on top (more information ca
![Lint](https://github.com/andi34/photobooth/workflows/Lint/badge.svg?branch=stable2)
![gulp-sass](https://github.com/andi34/photobooth/workflows/gulp-sass/badge.svg?branch=stable2)

**Please note:**

Safari Browser on iOS 9 in not compatible with es6, which means Photobooth won't work. Supported browser can be found inside the [Wiki](https://github.com/andi34/photobooth/wiki#browser-support).
If you like to use an old iPad anyway, please take a look [here (andi34/photobooth#47)](https://github.com/andi34/photobooth/issues/47).
If I find enough time I'll post some updates from time to time

## :heart_eyes: Features

- Works on Windows and Linux.
Expand Down Expand Up @@ -61,6 +55,7 @@ If I find enough time I'll post some updates from time to time
## Extras on my personal fork
### General changes:

- javascript transpiled to es5 to support older browsers (e.g. Safari 9)
- install-raspbian: use Apache2 webserver by default again
- added Slideshow option to Gallery
- standalone slideshow via [localhost/slideshow](http://localhost/slideshow)
Expand Down
4 changes: 3 additions & 1 deletion admin/index.php
Expand Up @@ -148,11 +148,13 @@
</div>
</div>

<script src="../node_modules/whatwg-fetch/dist/fetch.umd.js"></script>
<script type="text/javascript" src="../api/config.php"></script>
<script type="text/javascript" src="../node_modules/jquery/dist/jquery.min.js"></script>
<script type="text/javascript" src="../resources/js/theme.js"></script>
<script type="text/javascript" src="../resources/js/admin.js"></script>
<script type="module" src="../resources/js/i18n-sub.js"></script>
<script src="../node_modules/@andreasremdt/simple-translator/dist/umd/translator.min.js"></script>
<script type="text/javascript" src="../resources/js/i18n-sub.js"></script>

</body>
</html>
6 changes: 0 additions & 6 deletions api/language.php

This file was deleted.

4 changes: 3 additions & 1 deletion chromakeying.php
Expand Up @@ -84,11 +84,13 @@
<div class="modal__body" id="save_mesg_text"><span data-i18n="saving"></span></div>
</div>
</div>
<script src="node_modules/whatwg-fetch/dist/fetch.umd.js"></script>
<script type="text/javascript" src="api/config.php"></script>
<script type="text/javascript" src="node_modules/jquery/dist/jquery.min.js"></script>
<script type="text/javascript" src="node_modules/marvinj/marvinj/release/marvinj-0.8.js"></script>
<script type="text/javascript" src="resources/js/chromakeying.js"></script>
<script type="text/javascript" src="resources/js/theme.js"></script>
<script type="module" src="resources/js/i18n.js"></script>
<script src="node_modules/@andreasremdt/simple-translator/dist/umd/translator.min.js"></script>
<script type="text/javascript" src="resources/js/i18n.js"></script>
</body>
</html>
26 changes: 8 additions & 18 deletions gallery.php
Expand Up @@ -30,8 +30,8 @@

<link rel="stylesheet" href="node_modules/normalize.css/normalize.css" />
<link rel="stylesheet" href="node_modules/font-awesome/css/font-awesome.css" />
<link rel="stylesheet" href="node_modules/photoswipe/dist/photoswipe.css" />
<link rel="stylesheet" href="node_modules/photoswipe/dist/default-skin/default-skin.css" />
<link rel="stylesheet" href="vendor/PhotoSwipe/dist/photoswipe.css" />
<link rel="stylesheet" href="vendor/PhotoSwipe/dist/default-skin/default-skin.css" />
<link rel="stylesheet" href="resources/css/style.css" />
<?php if ($config['gallery_bottom_bar']): ?>
<link rel="stylesheet" href="resources/css/photoswipe-bottom.css" />
Expand Down Expand Up @@ -76,6 +76,7 @@
</div>
</div>

<script src="node_modules/whatwg-fetch/dist/fetch.umd.js"></script>
<script type="text/javascript" src="api/config.php"></script>
<script type="text/javascript" src="resources/js/adminshortcut.js"></script>
<script type="text/javascript" src="node_modules/jquery/dist/jquery.min.js"></script>
Expand All @@ -84,24 +85,13 @@
<script type="text/javascript" src="resources/js/vendor/EasePack.min.js"></script>
<script type="text/javascript" src="resources/js/vendor/jquery.gsap.min.js"></script>
<script type="text/javascript" src="resources/js/vendor/CSSPlugin.min.js"></script>
<script type="text/javascript" src="node_modules/photoswipe/dist/photoswipe.min.js"></script>
<script type="text/javascript" src="node_modules/photoswipe/dist/photoswipe-ui-default.min.js"></script>
<script type="text/javascript" src="vendor/PhotoSwipe/dist/photoswipe.min.js"></script>
<script type="text/javascript" src="vendor/PhotoSwipe/dist/photoswipe-ui-default.min.js"></script>
<script type="text/javascript" src="resources/js/photoinit.js"></script>
<script type="text/javascript" src="resources/js/theme.js"></script>
<script type="text/javascript" src="resources/js/core.js"></script>
<script type="module" src="resources/js/i18n.js"></script>
<script>
$(function() {
let reloadElement = $('<a class="gallery__reload">');
reloadElement.append('<i class="fa fa-refresh"></i>');
reloadElement.attr('href', '#');
reloadElement.on('click', () => photoBooth.reloadPage());
reloadElement.appendTo('.gallery__header');

$('.gallery__close').hide();

photoBooth.openGallery();
});
</script>
<script type="text/javascript" src="resources/js/gallery.js"></script>
<script src="node_modules/@andreasremdt/simple-translator/dist/umd/translator.min.js"></script>
<script type="text/javascript" src="resources/js/i18n.js"></script>
</body>
</html>
18 changes: 15 additions & 3 deletions gulpfile.js
Expand Up @@ -2,13 +2,25 @@

var gulp = require('gulp');
var sass = require('gulp-sass');
var babel = require('gulp-babel');

gulp.task('sass', function () {
return gulp.src('./resources/sass/**/*.scss')
return gulp
.src('./src/sass/**/*.scss')
.pipe(sass.sync().on('error', sass.logError))
.pipe(gulp.dest('./resources/css'));
});

gulp.task('sass:watch', function () {
gulp.watch('./resources/sass/**/*.scss', gulp.series('sass'));
gulp.task('js', function () {
return gulp
.src('./src/js/**/*.js')
.pipe(babel({ presets: ['@babel/env'] }))
.pipe(gulp.dest('./resources/js'));
});

gulp.task('watch', function () {
gulp.watch('./src/sass/**/*.scss', gulp.series('sass'));
gulp.watch('./src/js/*.js', gulp.series('js'));
});

gulp.task('default', gulp.parallel('sass', 'js'));
12 changes: 7 additions & 5 deletions index.php
Expand Up @@ -32,8 +32,8 @@

<link rel="stylesheet" href="node_modules/normalize.css/normalize.css" />
<link rel="stylesheet" href="node_modules/font-awesome/css/font-awesome.css" />
<link rel="stylesheet" href="node_modules/photoswipe/dist/photoswipe.css" />
<link rel="stylesheet" href="node_modules/photoswipe/dist/default-skin/default-skin.css" />
<link rel="stylesheet" href="vendor/PhotoSwipe/dist/photoswipe.css" />
<link rel="stylesheet" href="vendor/PhotoSwipe/dist/default-skin/default-skin.css" />
<link rel="stylesheet" href="resources/css/style.css" />
<?php if ($config['gallery_bottom_bar']): ?>
<link rel="stylesheet" href="resources/css/photoswipe-bottom.css" />
Expand Down Expand Up @@ -230,6 +230,7 @@
endif; ?>
</div>

<script src="node_modules/whatwg-fetch/dist/fetch.umd.js"></script>
<script type="text/javascript" src="api/config.php"></script>
<script type="text/javascript" src="resources/js/adminshortcut.js"></script>
<script type="text/javascript" src="node_modules/jquery/dist/jquery.min.js"></script>
Expand All @@ -238,12 +239,13 @@
<script type="text/javascript" src="resources/js/vendor/EasePack.min.js"></script>
<script type="text/javascript" src="resources/js/vendor/jquery.gsap.min.js"></script>
<script type="text/javascript" src="resources/js/vendor/CSSPlugin.min.js"></script>
<script type="text/javascript" src="node_modules/photoswipe/dist/photoswipe.min.js"></script>
<script type="text/javascript" src="node_modules/photoswipe/dist/photoswipe-ui-default.min.js"></script>
<script type="text/javascript" src="vendor/PhotoSwipe/dist/photoswipe.min.js"></script>
<script type="text/javascript" src="vendor/PhotoSwipe/dist/photoswipe-ui-default.min.js"></script>
<script type="text/javascript" src="resources/js/photoinit.js"></script>
<script type="text/javascript" src="resources/js/theme.js"></script>
<script type="text/javascript" src="resources/js/core.js"></script>
<script type="module" src="resources/js/i18n.js"></script>
<script src="node_modules/@andreasremdt/simple-translator/dist/umd/translator.min.js"></script>
<script type="text/javascript" src="resources/js/i18n.js"></script>

</body>
</html>
6 changes: 3 additions & 3 deletions login/index.php
Expand Up @@ -45,8 +45,6 @@

<link rel="stylesheet" href="../node_modules/normalize.css/normalize.css" />
<link rel="stylesheet" href="../node_modules/font-awesome/css/font-awesome.css" />
<link rel="stylesheet" href="../node_modules/photoswipe/dist/photoswipe.css" />
<link rel="stylesheet" href="../node_modules/photoswipe/dist/default-skin/default-skin.css" />
<link rel="stylesheet" href="../resources/css/login.css" />
<?php if ($config['rounded_corners']): ?>
<link rel="stylesheet" href="../resources/css/rounded.css" />
Expand Down Expand Up @@ -94,11 +92,13 @@
</div>
</div>

<script src="../node_modules/whatwg-fetch/dist/fetch.umd.js"></script>
<script type="text/javascript" src="../api/config.php"></script>
<script type="text/javascript" src="../node_modules/jquery/dist/jquery.min.js"></script>
<script type="text/javascript" src="../resources/js/adminshortcut.js"></script>
<script type="text/javascript" src="../resources/js/login.js"></script>
<script type="text/javascript" src="../resources/js/theme.js"></script>
<script type="module" src="../resources/js/i18n-sub.js"></script>
<script src="../node_modules/@andreasremdt/simple-translator/dist/umd/translator.min.js"></script>
<script type="text/javascript" src="../resources/js/i18n-sub.js"></script>
</body>
</html>
21 changes: 4 additions & 17 deletions manual/index.php
Expand Up @@ -83,26 +83,13 @@
</div>
</div>

<script src="../node_modules/whatwg-fetch/dist/fetch.umd.js"></script>
<script type="text/javascript" src="../api/config.php"></script>
<script type="text/javascript" src="../node_modules/jquery/dist/jquery.min.js"></script>
<script type="text/javascript" src="../resources/js/manual.js"></script>
<script type="text/javascript" src="../resources/js/theme.js"></script>
<script type="module" src="../resources/js/i18n-sub.js"></script>

<script>
$(function() {
$('.panel-heading').on('click', function() {
const panel = $(this).parents('.panel');
const others = $(this).parents('.accordion').find('.open').not(panel);

others.removeClass('open init');

panel.toggleClass('open');
panel.find('.panel-body').slideToggle();

others.find('.panel-body').slideUp('fast');
});
});
</script>
<script src="../node_modules/@andreasremdt/simple-translator/dist/umd/translator.min.js"></script>
<script type="text/javascript" src="../resources/js/i18n-sub.js"></script>

</body>
</html>
32 changes: 22 additions & 10 deletions package.json
Expand Up @@ -3,13 +3,19 @@
"version": "2.4.0-alpha",
"description": "A Photobooth webinterface for Raspberry Pi and Windows",
"scripts": {
"build": "gulp sass",
"watch": "gulp sass:watch",
"build": "npm run format && npm run build:faq && npm run build:gulp",
"build:faq": "mdown --input 'faq/*.md' --output manual --header faq/header.html --footer faq/footer.html",
"build:gulp": "gulp",
"build:sass": "gulp sass",
"eslint": "eslint src/js/*.js",
"eslint:fix": "eslint src/js/*.js --fix",
"format": "npm-run-all --parallel format:*",
"format:js": "prettier src/js/*.js --write",
"format:scss": "prettier src/sass/* --write",
"pack:build": "npm run eslint && npm run build && npm run pack:zip",
"pack:zip": "node scripts/pack-build.js",
"test": "echo \"Error: no test specified\" && exit 1",
"eslint": "eslint resources/js/*.js",
"eslint:fix": "eslint resources/js/*.js --fix",
"pack:build": "node scripts/pack-build.js",
"build:faq": "node_modules/gh-markdown-cli/bin/mdown --input 'faq/*.md' --output manual --header faq/header.html --footer faq/footer.html"
"watch": "gulp watch"
},
"author": "",
"license": "MIT",
Expand All @@ -32,20 +38,26 @@
"events"
],
"dependencies": {
"@andreasremdt/simple-translator": "^2.0.2",
"font-awesome": "^4.7.0",
"gh-markdown-cli": "^0.2.0",
"github-markdown-css": "https://github.com/andi34/github-markdown-css",
"github-markdown-css": "^4.0.0",
"gulp": "4.0.2",
"gulp-sass": "4.0.2",
"jquery": "^3.5.1",
"marvinj": "https://github.com/gabrielarchanjo/marvinj",
"marvinj": "^1.0.0",
"normalize.css": "^8.0.1",
"photoswipe": "https://github.com/andi34/PhotoSwipe"
"npm-run-all": "^4.1.5",
"whatwg-fetch": "^3.2.0"
},
"devDependencies": {
"@babel/core": "^7.11.0",
"@babel/preset-env": "^7.11.0",
"archiver": "^3.1.1",
"colors": "^1.4.0",
"eslint": "^6.8.0",
"git-tag-version": "^1.3.1"
"git-tag-version": "^1.3.1",
"gulp-babel": "^8.0.0",
"prettier": "^2.0.5"
}
}
25 changes: 0 additions & 25 deletions resources/js/i18n-sub.js

This file was deleted.