Added JS minification, updated npm packages, add TODO items

Signed-off-by: Ari Archer <ari.web.xyz@gmail.com>
This commit is contained in:
Ari Archer 2022-09-25 03:40:47 +03:00
parent 8553b253a5
commit 6bcb6abe2f
7 changed files with 1681 additions and 864 deletions

19
.clang-format Normal file
View file

@ -0,0 +1,19 @@
---
BasedOnStyle: LLVM
IndentWidth: 4
SortIncludes: false
AlignConsecutiveAssignments: true
AlignConsecutiveBitFields: true
AlignConsecutiveMacros: true
AlignEscapedNewlines: true
AllowShortCaseLabelsOnASingleLine: true
AllowShortEnumsOnASingleLine: true
AllowShortFunctionsOnASingleLine: true
AllowShortLambdasOnASingleLine: true
BinPackParameters: false
IndentCaseBlocks: true
IndentCaseLabels: true
IndentExternBlock: true
IndentGotoLabels: true
---

2
.gitignore vendored
View file

@ -1,5 +1,5 @@
_*.css
node_modules/
*.min.css
*.min.*
/api/apis.json
/api_hash

View file

@ -3,3 +3,5 @@
- [ ] Store files in IndexedDB
- [x] Export/Import
- [ ] Python code runner
- [ ] Minimal UI framework
- [ ] Convert some of the pages to use that framework

2498
package-lock.json generated

File diff suppressed because it is too large Load diff

View file

@ -30,6 +30,7 @@
"autoprefixer-cli": "^1.0.0",
"eslint": "^8.14.0",
"live-server": "^1.2.2",
"node-sass": "^7.0.1"
"node-sass": "^7.0.1",
"uglifyjs": "^2.4.11"
}
}

View file

@ -3,7 +3,7 @@
set -e
S='./scripts'
SCRIPTS=(sass apis)
SCRIPTS=(sass minjs apis)
main() {
for script in "${SCRIPTS[@]}"; do

19
scripts/minjs.sh Executable file
View file

@ -0,0 +1,19 @@
#!/usr/bin/env sh
set -e
main() {
if [ "$CI" ]; then
echo 'Minifying all JavaScript'
find content/js/ -type f \
-name "*.js" ! -name "*.min.*" ! -name "vfs_fonts*" \
-exec uglifyjs -o {}.min {} \; \
-exec rm {} \; \
-exec mv {}.min {} \;
else
echo 'Not in CI mode, skipping JS minification'
fi
}
main "$@"