File tree Expand file tree Collapse file tree 1 file changed +4
-2
lines changed Expand file tree Collapse file tree 1 file changed +4
-2
lines changed Original file line number Diff line number Diff line change @@ -14,14 +14,16 @@ export async function writeNpmrc({
14
14
// Get the home directory
15
15
const homeDirectory = os . homedir ( ) ;
16
16
17
- // // Define the path for the .npmrc file
17
+ // Define the path for the .npmrc file
18
18
const userNpmrcPath = path . join ( homeDirectory , ".npmrc" ) ;
19
19
20
20
logger . info ( `Writing users .npmrc to: ${ userNpmrcPath } ` ) ;
21
21
22
22
try {
23
23
// Write the content to the .npmrc file
24
- await fs . writeFile ( userNpmrcPath , npmrc ) ;
24
+ // fs.appendFile will create the file if it doesn't exist
25
+ await fs . appendFile ( userNpmrcPath , npmrc , "utf8" ) ;
26
+ logger . info ( "Successfully wrote .npmrc file" ) ;
25
27
} catch ( error ) {
26
28
const errorMessage = `Error writing users .npmrc to ${ userNpmrcPath } : ${ error instanceof Error ? error . message : "" } ` ;
27
29
throw new Error ( errorMessage ) ;
You can’t perform that action at this time.
0 commit comments