Skip to content

Commit

Permalink
Merge pull request #348 from ckeditor/i/2253-2
Browse files Browse the repository at this point in the history
Internal: Do not attach husky hooks when installing a repository as a dependency (instead of cloning).
  • Loading branch information
pomek committed Nov 29, 2022
2 parents d373f18 + 032f745 commit f3d6f05
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion scripts/postinstall.js
Original file line number Diff line number Diff line change
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 f3d6f05

Please sign in to comment.