Skip to content

Commit

Permalink
Copy project .npmrc to function dist (#5235)
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 web frameworks to Cloud Functions

Co-authored-by: James Daniels <jamesdaniels@google.com>
  • Loading branch information
cjsewell and jamesdaniels committed Dec 16, 2022
1 parent d073b09 commit 699c2a0
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)
- Remove esbuild dependency, instead bundle Next.js configuration on deploy with NPX (#5336)
- Add sharp NPM module to Cloud Functions when using Next.js Image Optimization (#5238)
- Adds user-defined env vars into the functions emulator (#5330).
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 699c2a0

Please sign in to comment.