closes https://github.com/denoland/fresh/issues/768
supersedes https://github.com/denoland/fresh/pull/853
I'm not sure if this is what Ryan had in mind when opened 768. But this
PR includes some working code, references Deno KV, and briefly touches
on `OPTIONS` as a bonus.
Should I link to https://deno.com/blog/build-crud-api-oak-denokv where I
borrowed some code from? I must admit I'm a bit confused about why Andy
chose to write about Oak instead of Fresh in this post...
closes https://github.com/denoland/fresh/issues/1338
This is more complex than first expected. It turns out the head of main
no longer has this error, because we started swallowing errors in
https://github.com/denoland/fresh/pull/1327. I'm not sure this is the
right implementation. It seems like we should explicitly check for the
`islands` folder instead of ignoring errors. But the obvious approach
(https://deno.land/std@0.192.0/fs/mod.ts?s=exists) is apparently
forbidden, due to some sort of nonsense with race conditions. Well, not
being able to find `islands` because it doesn't exist at all is
definitely different than it being buried in a source directory, so
we'll need to sort this out at some point.
I suppose that's now some technical debt to deal with, and not related
to this issue. The latest "error" when running `update` and using a
source directory is the following:
```
deno run -A -r file:///Users/reed/code/fresh/update.ts .
The manifest has been generated for 0 routes and 0 islands.
```
i.e. it just doesn't do anything. (To be fair, it does generate a
`fresh.gen.ts` in the incorrect location, so I suppose it does
_something_.)
But of course this isn't what we want. So we'll hunt for a source
directory, as defined by the precense of `main.ts`.
The fix for this is relatively straightforward. The test implements the
user's actions, i.e. init a project, move things, and then try to
update.