Skip to content

Commit

Permalink
Add pre-commit hooks
Browse files Browse the repository at this point in the history
  • Loading branch information
alexdima committed Nov 15, 2021
1 parent edb439d commit e8dabe0
Show file tree
Hide file tree
Showing 5 changed files with 333 additions and 1 deletion.
File renamed without changes.
23 changes: 23 additions & 0 deletions build/postinstall.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/

const cp = require('child_process');
const path = require('path');

function huskyInstall() {
console.log(`Installing husky hooks...`);
console.log(`$ husky install`);
const result = cp.spawnSync(
process.execPath,
[path.join(__dirname, '../node_modules/husky/lib/bin.js'), 'install'],
{ stdio: 'inherit' }
);

if (result.error || result.status !== 0) {
process.exit(1);
}
}

huskyInstall();
1 change: 1 addition & 0 deletions gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ gulp.task(
var json = JSON.parse(data.contents.toString());
json.private = false;
data.contents = Buffer.from(JSON.stringify(json, null, ' '));
delete json.scripts['postinstall'];
this.emit('data', data);
})
)
Expand Down
Loading

0 comments on commit e8dabe0

Please sign in to comment.