-
Notifications
You must be signed in to change notification settings - Fork 6
Local packages and component downloads #6
Comments
Thanks for opening this up @Pavel910 ... curious, why do you dislike local paths That extra Doesn't seem to be a big change, so PR is welcome 😊... I'd just appreciate a comment on that line explaining why we have it here, cause this is an interesting use case that I did not think of, and will probably forget! 😅 |
@eahefnawy there are several reasons why
For the time being I did this: components:
function: '../../../node_modules/@webiny/serverless-function'
api: '../../../node_modules/@webiny/serverless-api'
site:
component: ${components.function} You can see how awkward it is, and imagine changing the folder structure (which I do regularly while experimenting with project organization)... I'll send a PR, it's a small change and doesn't change the current behavior, just gives more freedom with not-yet-published packages. |
That makes sense @Pavel910 ... Just left a comment in your PR. But other than that, this change is welcome. P.S: We really appreciate you always opening up an issue discussing the change before PRing. Thanks for that 🙌 |
@eahefnawy I'd like to suggest/discuss an alternative way of handling component downloads.
The main problem for me is that Template throws an error if it doesn't find the component package on NPM. However, my component packages are still far from ready for publishing to NPM, and they are located in my monorepo with all the other packages, and are resolvable via
node_modules
.I have 2 possible solutions:
require.resolve
- just use that and do not throw an error.I personally prefer the first solution as it does not require any additional code/configuration on developer's side.
Currently the only packages that are not downloaded are the ones starting with
.
, which is not very useful, as I want to use the component name as a regularnpm
module, like@webiny/microservice
, but it is a local/private package that is not onnpm
.Looking forward to hearing your opinion on this! 🍻
EDIT:
Here is the modification required to implement the first solution.
https://github.com/serverless/core/blob/master/src/utils/download.js#L82
The text was updated successfully, but these errors were encountered: