-
Notifications
You must be signed in to change notification settings - Fork 574
/
Copy pathprepare.ts
33 lines (28 loc) · 1 KB
/
prepare.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
/*!
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0
*/
//
// Performs NPM "prepare" step, except when running in CI.
//
// prepare: https://docs.npmjs.com/cli/v9/using-npm/scripts#prepare-and-prepublish:
// - Runs BEFORE the package is packed, i.e. during "npm publish" AND "npm pack".
// - Runs on local "npm install".
// - Runs AFTER `prepublish`, but BEFORE `prepublishOnly`.
// - Runs in the background. To see the output, run with "--foreground-scripts".
//
import * as child_process from 'child_process' // eslint-disable-line no-restricted-imports
/**
* Returns true if the current build is running on CI (build server).
*/
export function isCI(): boolean {
return undefined !== process.env['GITHUB_ACTION'] || undefined !== process.env['CODEBUILD_BUILD_ID']
}
function main() {
if (isCI()) {
console.log('prepare: skipped (running in CI)')
return
}
child_process.execSync('husky', { stdio: 'inherit' })
}
main()