-
Notifications
You must be signed in to change notification settings - Fork 88
Use the site's Functions directory #39
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
Conversation
index.js
Outdated
// cpx.copySync('out_functions/**/*', FUNCTIONS_SRC); | ||
cpx.copySync('out_publish/**/*', PUBLISH_DIR) | ||
await makeDir(PUBLISH_DIR) | ||
await Promise.all([pCopy('out_functions/**/*', FUNCTIONS_SRC), pCopy('out_publish/**/*', PUBLISH_DIR)]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Parallelizing for better performance.
}, | ||
} | ||
|
||
const DEFAULT_FUNCTIONS_SRC = 'netlify-automatic-functions' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We will need to change this value once the final filename has been decided.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
wait does this need to be defined before FUNCTIONS_SRC is defaulted to it on 76? 🤔
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, because default parameters are evaluated when the function is executed, and onPostBuild()
is executed after the top-level scope has been executed.
99a407b
to
d692a3e
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🥇 ⭐ ❗
test/index.js
Outdated
}, | ||
}) | ||
|
||
expect(await pathExists(`${resolvedFunctions}/function/index.js`)).toBeTruthy() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
huge nit but could possibly be helpful for any devs new to the project:
could be helpful to have the fixture functions_copy_files
be
out_functions/next_random/next_random.js
and
out_functions/next_random/nextJsPage.js
just to mimic exactly what NoN generates
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point! Fixed.
d692a3e
to
111f4cb
Compare
111f4cb
to
e0c8011
Compare
* test: blob storage set and get * feat: add test and update the handler * chore: add some retry as it might get flaky through the stale thing
Fixes #27.
We just released in production the possibility for Build plugins to create a Functions directory even if the site does not have one.
Thanks to this, we can now use
constants.FUNCTIONS_SRC
in order to use the site's Functions directory.It none was configured, the default Functions directory is used: this is named
netlify-automatic-functions
for the moment, but we will probably eventually rename it tonetlify-functions
(see issue).