Closed bbehling closed 4 years ago
@bbehling claudia uses npm pack, so whatever syntax is valid for npm pack will be valid for claudia. check the npm site about that. if there is a bug about packaging, it's best to submit directly to NPM in this case
But shouldn't Claudia include the files it needs to successfully create a package? According to your docs, Claudia will include other files it needs.
So if claudia needs the lambda.js file to build successfully, this should be included in the build like other required files are.
If not, then the documentation should be updated.
From the docs - Although the AWS Node.js deployment guide requires including the node_modules folder for deployment, don’t add it to the files section. Claudia will do that automatically for you. Even better, while preparing a package, Claudia will copy all the relevant files to a temporary directory and prepare a clean install, validating the package before uploading to Lambda, to make sure that you’re deploying the right version of the dependent libraries.
Claudia did not copy the lambda.js file. This seems like unexpected behavior.
@bbehling the docs paragraph relates to node_modules
specifically, I'll update it. files
in NPM is a way to restrict the package contents, for example to exclude tests, build scripts etc. it's not a way to bundle stuff outside your project directory. if your project depends on stuff outside the NPM package, reference it as a NPM dependency and claudia will copy it over.
Expected behaviour: Using files property in NPM, claudiajs will build and deploy package
What actually happens: Error: Cannot find module '/var/folders/k4/hqp21y9n3jj1wmkhq4qwtqs80000gn/T/vPQDXS/ehanger-marketplace-api-1.0.0-yEnOO7/package/lambda' Require stack:
Steps to reproduce the problem: add files property to packages.json
Note, I've also tried to add the var directory as ["/var"], ["/var/"] and ["var/**"], but that directory is still not included in build.
*UPDATE:
If I include all the directories in my project, files["/"], then package will build correctly. Seems it was missing the lambda.js file (there may be more required files missing, but did not test)
Expected behavior would be that if I include the files property, Claudia will include the files needed to build the package.