Skip to content

Commit

Permalink
Copy project .npmrc to function dist
Browse files Browse the repository at this point in the history
To support private repositories and custom npm configs, copy the projects .npmrc file to the functions dist dir before deploying
  • Loading branch information
cjsewell authored and Corey Sewell committed Dec 16, 2022
1 parent 2a25c5f commit 9f203a2
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
@@ -1,3 +1,4 @@
- Respect .npmrc in backends spun up for web frameworks (#5235)
- Add sharp NPM module to Cloud Functions when using Next.js Image Optimization (#5238)
- Adds user-defined env vars into the functions emulator (#5330).
- Support Next.js Middleware (#5320)
Expand Down
4 changes: 4 additions & 0 deletions src/frameworks/index.ts
Expand Up @@ -519,6 +519,10 @@ ${firebaseDefaults ? `__FIREBASE_DEFAULTS__=${JSON.stringify(firebaseDefaults)}\
// continue
});

if (await pathExists(getProjectPath(".npmrc"))) {
await copyFile(getProjectPath(".npmrc"), join(functionsDist, ".npmrc"));
}

execSync(`${NPM_COMMAND} i --omit dev --no-audit`, {
cwd: functionsDist,
stdio: "inherit",
Expand Down

0 comments on commit 9f203a2

Please sign in to comment.