You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This is more of a feature request, so apologies if this doesn't belong here. Many versions ago NPM introduced adding metadata into package.json when building a project. As far as I can tell it was done as an extension point that future version could use, see [1] for more details. The problem is that one of the added pieces of metadata is the absolute location of where the project was built, which in itself isn't great but coupled with the fact that SAM uses a directory hash for tracking changes and that AWS CodeBuild uses ephemeral build directories means that files will always appear to have changed even when the only thing that's changed is the location of the build directory. While it doesn't look like NPM will fix the issue any time soon my hope was that the Node lambda builder can run a command after build to remove the metadata. As the metadata isn't used by NPM this is currently completely safe. In fact my current workaround uses [2] to remove the metadata after running sam build. I am happy to submit a PR if it's deemed appropriate, although it might take some time due to work commitments.
Description:
This is more of a feature request, so apologies if this doesn't belong here. Many versions ago NPM introduced adding metadata into
package.json
when building a project. As far as I can tell it was done as an extension point that future version could use, see [1] for more details. The problem is that one of the added pieces of metadata is the absolute location of where the project was built, which in itself isn't great but coupled with the fact that SAM uses a directory hash for tracking changes and that AWS CodeBuild uses ephemeral build directories means that files will always appear to have changed even when the only thing that's changed is the location of the build directory. While it doesn't look like NPM will fix the issue any time soon my hope was that the Node lambda builder can run a command after build to remove the metadata. As the metadata isn't used by NPM this is currently completely safe. In fact my current workaround uses [2] to remove the metadata after runningsam build
. I am happy to submit a PR if it's deemed appropriate, although it might take some time due to work commitments.[1] npm/npm#10393
[2] https://www.npmjs.com/package/removeNPMAbsolutePaths
Steps to reproduce the issue:
sam build
on an NPM project with external dependenciesbuild
directory, innode_modules
, look at apackage.json
Observed result:
You will see properties such as
"_where": "/Users/jshore/Documents/Projects/weewikipaint",
containing the absolute path of build directory.Expected result:
A build should be idempotent and not dependent on build location.
Additional environment details (Ex: Windows, Mac, Amazon Linux etc)
Reproducible on both Mac and Amazon Linux
The text was updated successfully, but these errors were encountered: