fermyon / developer

This is the home for developer.fermyon.com
https://developer.fermyon.com
Apache License 2.0
51 stars 66 forks source link

Update `spin up` to `spin watch` so `npm run spin` works. #1284

Open tpmccallum opened 4 months ago

tpmccallum commented 4 months ago

Signed-off-by: tpmccallum tim.mccallum@fermyon.com

Fixes https://github.com/fermyon/developer/issues/849

Before:

$ npm run spin

> developer-fermyon-com@0.1.0 spin /home/tpmccallum/Fermyon/developer
> nodemon --watch content --watch static --watch templates --watch spin-up-hub --ext html,md,rhai,hbs,css,js --verbose --legacy-watch --signal SIGINT --exec 'npm run build-index && npm run build-hub-index && spin up --file spin.toml --quiet --env PREVIEW_MODE=$PREVIEW_MODE'

[nodemon] 2.0.20
[nodemon] to restart at any time, enter `rs`
[nodemon] or send SIGUSR2 to 2615137 to restart
[nodemon] watching path(s): content/**/* static/**/* templates/**/* spin-up-hub/**/*
[nodemon] watching extensions: html,md,rhai,hbs,css,js
[nodemon] starting `npm run build-index && npm run build-hub-index && spin up --file spin.toml --quiet --env PREVIEW_MODE=$PREVIEW_MODE`
[nodemon] spawning
[nodemon] child pid: 2615159
[nodemon] watching 489 files

> developer-fermyon-com@0.1.0 build-index /home/tpmccallum/Fermyon/developer
> node md_parser.mjs --dir=./content/ --out=./static/data.json --ignore=./content/api/**/*

[nodemon] files triggering change check: static/data.json
[nodemon] matched rule: /home/tpmccallum/Fermyon/developer/static/**/*
[nodemon] changes after filters (before/after): 1/0

> developer-fermyon-com@0.1.0 build-hub-index /home/tpmccallum/Fermyon/developer
> node hub_index_generator.mjs --dir=./content/api/hub/ --out=./static/hub-index-data.json --ignore=./content/api/hub/get_list.md,

[nodemon] files triggering change check: static/hub-index-data.json
[nodemon] matched rule: /home/tpmccallum/Fermyon/developer/static/**/*
[nodemon] changes after filters (before/after): 1/0
Error: Failed to load manifest from "spin.toml"

Caused by:
   0: Failed to load Spin app from "spin.toml"
   1: Failed to load component `hub-fileserver-static`
   2: File or directory "spin-up-hub/dist/" does not exist
[nodemon] app crashed - waiting for file changes before starting...
github-actions[bot] commented 4 months ago

🚀 preview deployed successfully to Fermyon Cloud and available at https://fermyon-developer-pr-1284-qrcubjnh.fermyon.app

tpmccallum commented 4 months ago

Perhaps there is more to this than meets the eye.

Worked the first and second time but failing consistently now:

✓ built in 5.75s
[nodemon] files triggering change check: spin-up-hub/dist/assets/index-a80a27fc.js
[nodemon] matched rule: /home/tpmccallum/Fermyon/developer/spin-up-hub/**/*
[nodemon] changes after filters (before/after): 1/1
[nodemon] restarting due to changes...
[nodemon] spin-up-hub/dist/assets/index-a80a27fc.js

[nodemon] still waiting for 1 sub-process to finish...
[nodemon] still waiting for 1 sub-process to finish...
[nodemon] still waiting for 1 sub-process to finish...
[nodemon] still waiting for 1 sub-process to finish...
[nodemon] still waiting for 1 sub-process to finish...
[nodemon] still waiting for 1 sub-process to finish...
[nodemon] still waiting for 1 sub-process to finish...
[nodemon] still waiting for 1 sub-process to finish...
[nodemon] still waiting for 1 sub-process to finish...
[nodemon] still waiting for 1 sub-process to finish...
[nodemon] still waiting for 1 sub-process to finish...
karthik2804 commented 4 months ago

Perhaps an even better idea for this would be to use, spin up --direct-mounts that would make the cycle much faster instead of restarting spin. We could just have nodemon watch for rebuilding the search index.

cc: @itowlson for viz