Skip to content

Commit

Permalink
Merge cd244d5 into c7a1cb5
Browse files Browse the repository at this point in the history
  • Loading branch information
martnpaneq committed Nov 29, 2022
2 parents c7a1cb5 + cd244d5 commit 8a72550
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion scripts/postinstall.js
Expand Up @@ -7,4 +7,12 @@

/* eslint-env node */

require( 'husky' ).install();
const path = require( 'path' );
const fs = require( 'fs' );
const ROOT_DIRECTORY = path.join( __dirname, '..' );

// When installing a repository as a dependency, the `.git` directory does not exist.
// In such a case, husky should not attach its hooks as npm treats it as a package, not a git repository.
if ( fs.existsSync( path.join( ROOT_DIRECTORY, '.git' ) ) ) {
require( 'husky' ).install();
}

0 comments on commit 8a72550

Please sign in to comment.