gt-starter-npmrc
Advanced tools
Comparing version
14
bin.js
@@ -5,3 +5,3 @@ #!/usr/bin/env node | ||
const {ArgumentParser} = pkg; | ||
import {existsSync, readFileSync, writeFileSync} from 'fs'; | ||
import {existsSync, readFileSync, writeFileSync, appendFileSync} from 'fs'; | ||
@@ -33,3 +33,13 @@ const parser = new ArgumentParser({ | ||
const npmFilePath = args.global ? `${HOME_DIR}/.npmrc` : `./npmrc`; | ||
const npmFilePath = args.global ? `${HOME_DIR}/.npmrc` : `./.npmrc`; | ||
if(!args.global) { | ||
if(existsSync("./.gitignore")) { | ||
if(readFileSync('./.gitignore').indexOf(".npmrc") === -1) { | ||
appendFileSync('./.gitignore', '\n.npmrc'); | ||
} | ||
} | ||
else { | ||
writeFileSync('./.gitignore', '.npmrc\n'); | ||
} | ||
} | ||
@@ -36,0 +46,0 @@ if(existsSync(npmFilePath)){ |
{ | ||
"name": "gt-starter-npmrc", | ||
"version": "1.0.5", | ||
"version": "1.0.6", | ||
"description": "GreenTeam starter script for .npmrc", | ||
@@ -5,0 +5,0 @@ "bin": { |
3677
8.66%46
27.78%