postinstall.js 759 B

1234567891011121314151617181920212223
  1. /*---------------------------------------------------------------------------------------------
  2. * Copyright (c) Microsoft Corporation. All rights reserved.
  3. * Licensed under the MIT License. See License.txt in the project root for license information.
  4. *--------------------------------------------------------------------------------------------*/
  5. const cp = require('child_process');
  6. const path = require('path');
  7. function huskyInstall() {
  8. console.log(`Installing husky hooks...`);
  9. console.log(`$ husky install`);
  10. const result = cp.spawnSync(
  11. process.execPath,
  12. [path.join(__dirname, '../node_modules/husky/lib/bin.js'), 'install'],
  13. { stdio: 'inherit' }
  14. );
  15. if (result.error || result.status !== 0) {
  16. process.exit(1);
  17. }
  18. }
  19. huskyInstall();