@@ -30,7 +30,7 @@ export {
3030 * Modifies the package.json, sets config.commitizen.path to the path of the adapter
3131 * Must be passed an absolute path to the cli's root
3232 */
33- function addPathToAdapterConfig ( sh , cliPath , repoPath , adapterNpmName ) {
33+ function addPathToAdapterConfig ( sh , cliPath , repoPath , adapterNpmName ) {
3434
3535 let commitizenAdapterConfig = {
3636 config : {
@@ -46,7 +46,7 @@ function addPathToAdapterConfig(sh, cliPath, repoPath, adapterNpmName) {
4646 let indent = detectIndent ( packageJsonString ) . indent || ' ' ;
4747 let packageJsonContent = JSON . parse ( packageJsonString ) ;
4848 let newPackageJsonContent = '' ;
49- if ( _ . get ( packageJsonContent , 'config.commitizen.path' ) !== adapterNpmName ) {
49+ if ( _ . get ( packageJsonContent , 'config.commitizen.path' ) !== adapterNpmName ) {
5050 newPackageJsonContent = _ . merge ( packageJsonContent , commitizenAdapterConfig ) ;
5151 }
5252 fs . writeFileSync ( packageJsonPath , JSON . stringify ( newPackageJsonContent , null , indent ) + '\n' ) ;
@@ -55,14 +55,14 @@ function addPathToAdapterConfig(sh, cliPath, repoPath, adapterNpmName) {
5555/**
5656 * Generates an npm install command given a map of strings and a package name
5757 */
58- function generateNpmInstallAdapterCommand ( stringMappings , adapterNpmName ) {
58+ function generateNpmInstallAdapterCommand ( stringMappings , adapterNpmName ) {
5959
6060 // Start with an initial npm install command
6161 let installAdapterCommand = `npm install ${ adapterNpmName } ` ;
6262
6363 // Append the neccesary arguments to it based on user preferences
64- for ( let [ key , value ] of stringMappings . entries ( ) ) {
65- if ( value ) {
64+ for ( let [ key , value ] of stringMappings . entries ( ) ) {
65+ if ( value ) {
6666 installAdapterCommand = installAdapterCommand + ' ' + value ;
6767 }
6868 }
@@ -73,15 +73,15 @@ function generateNpmInstallAdapterCommand(stringMappings, adapterNpmName) {
7373/**
7474 * Gets the nearest npm_modules directory
7575 */
76- function getNearestNodeModulesDirectory ( options ) {
76+ function getNearestNodeModulesDirectory ( options ) {
7777
7878 // Get the nearest node_modules directories to the current working directory
7979 let nodeModulesDirectories = findNodeModules ( options ) ;
8080
8181 // Make sure we find a node_modules folder
8282
8383 /* istanbul ignore else */
84- if ( nodeModulesDirectories && nodeModulesDirectories . length > 0 ) {
84+ if ( nodeModulesDirectories && nodeModulesDirectories . length > 0 ) {
8585 return nodeModulesDirectories [ 0 ] ;
8686 } else {
8787 console . error ( `Error: Could not locate node_modules in your project's root directory. Did you forget to npm init or npm install?` )
@@ -91,33 +91,33 @@ function getNearestNodeModulesDirectory(options) {
9191/**
9292 * Gets the nearest project root directory
9393 */
94- function getNearestProjectRootDirectory ( options ) {
94+ function getNearestProjectRootDirectory ( options ) {
9595 return path . join ( process . cwd ( ) , getNearestNodeModulesDirectory ( options ) , '/../' ) ;
9696}
9797
9898/**
9999 * Gets a map of arguments where the value is the corresponding npm strings
100100 */
101- function getNpmInstallStringMappings ( save , saveDev , saveExact , force ) {
101+ function getNpmInstallStringMappings ( save , saveDev , saveExact , force ) {
102102 return new Map ( )
103- . set ( 'save' , ( save && ! saveDev ) ? '--save' : undefined )
104- . set ( 'saveDev' , saveDev ? '--save-dev' : undefined )
105- . set ( 'saveExact' , saveExact ? '--save-exact' : undefined )
106- . set ( 'force' , force ? '--force' : undefined ) ;
103+ . set ( 'save' , ( save && ! saveDev ) ? '--save' : undefined )
104+ . set ( 'saveDev' , saveDev ? '--save-dev' : undefined )
105+ . set ( 'saveExact' , saveExact ? '--save-exact' : undefined )
106+ . set ( 'force' , force ? '--force' : undefined ) ;
107107}
108108
109109/**
110110 * Gets the prompter from an adapter given an adapter path
111111 */
112- function getPrompter ( adapterPath ) {
112+ function getPrompter ( adapterPath ) {
113113 // Resolve the adapter path
114114 let resolvedAdapterPath = resolveAdapterPath ( adapterPath ) ;
115115
116116 // Load the adapter
117117 let adapter = require ( resolvedAdapterPath ) ;
118118
119119 /* istanbul ignore next */
120- if ( adapter && adapter . prompter && isFunction ( adapter . prompter ) ) {
120+ if ( adapter && adapter . prompter && isFunction ( adapter . prompter ) ) {
121121 return adapter . prompter ;
122122 } else if ( adapter && adapter . default && adapter . default . prompter && isFunction ( adapter . default . prompter ) ) {
123123 return adapter . default . prompter ;
@@ -130,7 +130,7 @@ function getPrompter(adapterPath) {
130130 * Given a resolvable module name or path, which can be a directory or file, will
131131 * return a located adapter path or will throw.
132132 */
133- function resolveAdapterPath ( inboundAdapterPath ) {
133+ function resolveAdapterPath ( inboundAdapterPath ) {
134134 // Check if inboundAdapterPath is a path or node module name
135135 let parsed = path . parse ( inboundAdapterPath ) ;
136136 let isPath = parsed . dir . length > 0 && parsed . dir . charAt ( 0 ) !== "@" ;
@@ -149,6 +149,6 @@ function resolveAdapterPath(inboundAdapterPath) {
149149 }
150150}
151151
152- function getGitRootPath ( ) {
152+ function getGitRootPath ( ) {
153153 return sh . exec ( 'git rev-parse --show-toplevel' ) . stdout . trim ( ) ;
154154}
0 commit comments