2021-11-15 18:13:52 +08:00
|
|
|
/*---------------------------------------------------------------------------------------------
|
|
|
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
|
|
* Licensed under the MIT License. See License.txt in the project root for license information.
|
|
|
|
*--------------------------------------------------------------------------------------------*/
|
|
|
|
|
2022-02-03 21:56:52 +08:00
|
|
|
import cp = require('child_process');
|
|
|
|
import path = require('path');
|
2021-11-15 18:13:52 +08:00
|
|
|
|
|
|
|
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();
|