Created
February 21, 2024 09:56
-
-
Save andreif/9aa1695864f25639b02872ece95cdd9e to your computer and use it in GitHub Desktop.
.npmrc
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# $(call secret,region,account,secret_id) | |
define secret | |
$(shell aws secretsmanager get-secret-value \ | |
--region $(1) --secret-id arn:aws:secretsmanager:$(1):$(2):secret:$(3) \ | |
--output text --query SecretString) | |
endef | |
.npmrc: NPM_TOKEN ?= $(call secret,eu-west-1,1234567890,npm-readonly-token) | |
.npmrc: | |
@test -n "${NPM_TOKEN}" || (>&2 echo "Error: NPM_TOKEN is missing"; exit 1) | |
@echo "//registry.npmjs.org/:_authToken=${NPM_TOKEN}" > .npmrc | |
remove-old-npmrc: | |
@find . -maxdepth 1 -name ".npmrc" -type f -mtime +3 -exec rm {} \; | |
setup: remove-old-npmrc .npmrc ... |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment