-
Notifications
You must be signed in to change notification settings - Fork 182
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow users to pass additional IGNORE dirs and filenames from commandline #198
Comments
Update The files inside the functions directory can't be served statically, since cloudflare will try to route requests matching file paths to matching code "handlers" and expect your code to handle them as REST requests. Which will just translate to GET requests that do or do not match any script files. There wont be any handlers matching the request, and I think what happens in that case, is the requests get converted into root requests for / and the paths get ignored. For example, what I just tested; I have a cloudflare function code at {
"cnt":1,
"message": "hello world"
} When you try to make a GET request to For now there is a workaround, (which is to do nothing) and yes it's messy, but it's a low priority to fix? I might submit a PR to fix it shortly to avoid accidentally causing something to break. leaving it like this feels like big unexpected problem waiting to cause some unexpected pain later when we add some new functionality to fswalk or similar. The fact that it doesnt cause a problem right now is just a happy co-incidence, and not by design. There is a real risk that server side artifacts could accidentally be rendered out in some future enhancement and included in |
Cool! I think |
I thought of that, but then wondered if site.yaml should kept clean and only contain content matters, so that if you change your tech, the site.yaml shouldnt change. I think that might be a consideration for later, but for now the advantage of using site.yaml is not having to implement another settings strategy. I think that will come soon, (e.g. passing in environment variables from build server) but we can cross that bridge later. very long way to say, I agree. I'll create a PR that looks for extra settings in site.yaml. Will need to update docs later when docs can be previewed by contributors ... as well. |
@tipiirai Perhaps tag this issue with a label : requires-documentation <-- or similar, and we keep it open until the documentation is updated? (after the PR is merged I mean) Since we can get that in now, and update docs later. |
Allow users to pass additional IGNORE dirs and filenames from commandline
Likely affected code
nue/packages/nuekit/src/nuefs.js
Lines 71 to 79 in 16b348a
Rationale
Yes, I know that sounds sensible, but that's not how Cloudflare works. They expect your "edge workers functions" to reside in a sub folder called /functions, meaning that I'd need to complicate the build step by building a folder, and the copying in the /functions directory post build. While I can do that, it's just more steps for a new person to Nuejs and new to cloudflare to trip over.
More importantly i suspect it would mean a file copy build step on every edit (tbc). Even if it doesn't it's just unecessary moving parts if the fix is a simple string value to ignore a folder.
There are some other reasons as well, but this is the simplest explanation for now. I think this will be the first change that will require support user submitted args, and possible a change to
cli.js
(code block below is truncated, you need to scroll to see the whole method.)nue/packages/nuekit/src/cli.js
Lines 25 to 62 in 16b348a
Tests
New e2e test will likely go here, to test that when ignore values are provided, that the correct folders are ignored
https://github.com/nuejs/nue/blob/16b348a79a25c72ab3107ba0f50fd1ce56818d36/packages/nuekit/test/nuekit.test.js
The text was updated successfully, but these errors were encountered: