Aws-sam-cli: Allow copy .gitignore files

Created on 24 Jul 2020  路  5Comments  路  Source: aws/aws-sam-cli

I would like to know If there is any possibility to tell sam build command to copy files that are excluded via .gitignore

Most helpful comment

Good morning @awood45 !

I'm using aws-sdk for nodeJS. I think It could be a great idea to tell sam build command to copy specific files to dist folder. Thanks in advance

All 5 comments

Can you expand a bit more on what runtime you're using and what you're trying to do?

Good morning @awood45 !

I'm using aws-sdk for nodeJS. I think It could be a great idea to tell sam build command to copy specific files to dist folder. Thanks in advance

I'm also having this issue, i need to exclude credentials but i need that sam build include those files. For example a json file with the database connection settings, i don't want to include this file on my git project but i want to sam build to include it.

Runtime: nodejs12.x

Is there a way to configure sam build to include those files that are in .gitignore?

I had this issue before,this is NPM pack related not SAM related, by NPM look for a file called .npmignore to exclude files from build, else it used .gitignore to exclude files from build, we always mention dist folder in .gitignore, that why sam build doesn't include dist folder, there are two ways to solve this issue.

  1. Create empty .npmignore, but it does has disadvantage that now npm will copy your senstive files into build
  2. Use files array in package.json to tell which file to include.

For Reference:

  1. https://stackoverflow.com/questions/37857149/is-the-files-property-necessary-in-package-json
  2. https://medium.com/@jdxcode/for-the-love-of-god-dont-use-npmignore-f93c08909d8d

Closing as this is NPM related.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

XDanny322 picture XDanny322  路  3Comments

red8888 picture red8888  路  3Comments

chestongo picture chestongo  路  3Comments

GerbenRampaart picture GerbenRampaart  路  3Comments

zhangzhx picture zhangzhx  路  3Comments