aws / aws/aws-sam-cli

Feature request: sam build for nodejs support .npmrc

Open
#4,971 1 comment 0 reactions 0 assignees View on GitHub
area/build type/feature
Dominant language
Python
Stars
6.7k
Forks
1.2k
Avg merge
1d 10h
Merged PRs (30d)
52

Description

### Describe your idea/feature/enhancement

It appears some support for .npmrc was handled in https://github.com/aws/aws-sam-cli/issues/1042
However it just copies the project level .npmrc file.

The actual config is a combination of all of these files:

- per-project config file (/path/to/my/project/.npmrc)
- per-user config file (~/.npmrc)
- global config file ($PREFIX/etc/npmrc)
- npm builtin config file (/path/to/npm/npmrc)

[npmrc docs](https://docs.npmjs.com/cli/v9/configuring-npm/npmrc)

### Proposal

`sam build` should copy the relevant config rather then the .npmrc file.

[npm config list [--json]](https://docs.npmjs.com/cli/v9/commands/npm-config?v=true) will output the combined npmrc config when run in the appropriate workspace dir.

`sam build` should create an .npmrc based on the output from `npm config list`

### Additional Details

Tools like https://github.com/actions/setup-node will write to the user level npmrc file which `sam build` will not use.
This will cause issues when installing private GHPR packages.

I at least experienced issues with this when running `sam build --template --use-container ...`

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.