Skip to content

Commit 45cff08

Browse files
committed
Static preview support
1 parent b1d257b commit 45cff08

5 files changed

Lines changed: 46 additions & 13 deletions

File tree

.devcontainer/onCreate.sh

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,4 +28,8 @@ echo "Pre-starting the server and generating the optimized assets"
2828
npm run optimize --override
2929

3030
echo "Installing supervisor"
31-
sudo apt-get update && sudo apt-get install -y supervisor
31+
sudo apt-get update && sudo apt-get install -y supervisor
32+
33+
echo "Setting up auto build for static preview"
34+
ln -fs $(pwd)/.devcontainer/post-commit .git/hooks/post-commit
35+
$(pwd)/.devcontainer/post-commit

.devcontainer/post-commit

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
2+
#!/bin/sh
3+
echo "Running post-commit build..."
4+
OUTPUT_DIR=/workspaces/preview-build npm run build -- --emptyOutDir

.devcontainer/postStartCommand.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,3 +17,6 @@ sudo chown -R node /var/log/
1717
supervisord
1818
supervisorctl reread
1919
supervisorctl update
20+
21+
# Run the post-commit script once to rebuild the app at startup
22+
$(pwd)/.devcontainer/post-commit

.devcontainer/spark.conf

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,3 +38,12 @@ autostart=true
3838
autorestart=true
3939
stdout_logfile=/var/log/spark-file-syncer.out.log
4040
stderr_logfile=/var/log/spark-file-syncer.err.log
41+
42+
[program:spark-static-preview]
43+
command=npm run preview
44+
directory=/workspaces/spark-template
45+
autostart=true
46+
autorestart=true
47+
stdout_logfile=/var/log/spark-static-preview.out.log
48+
stderr_logfile=/var/log/spark-static-preview.err.log
49+
environment=OUTPUT_DIR="/workspaces/preview-build"

package-lock.json

Lines changed: 25 additions & 12 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)