File tree Expand file tree Collapse file tree 4 files changed +14
-8
lines changed
Expand file tree Collapse file tree 4 files changed +14
-8
lines changed Original file line number Diff line number Diff line change @@ -76,7 +76,7 @@ Below is an example `slack.json` file that overrides the default `start` hook:
7676``` json
7777{
7878 "hooks" : {
79- "get-hooks" : " npx -q --no-install -p @slack/cli-hooks slack-cli-get-hooks" ,
79+ "get-hooks" : " NODE_NO_WARNINGS=1 npx -q --no-install -p @slack/cli-hooks slack-cli-get-hooks" ,
8080 "start" : " npm run dev"
8181 }
8282}
Original file line number Diff line number Diff line change @@ -43,11 +43,13 @@ if (fs.realpathSync(process.argv[1]) === fileURLToPath(import.meta.url)) {
4343 * @returns {SDKInterface } Information about the hooks currently supported.
4444 */
4545export default function getHooks ( ) {
46+ // NODE_NO_WARNINGS=1 silences node process warnings. These warnings can occur
47+ // on some node version (e.g. v23.2.0) and cause invalid JSON hook responses.
4648 return {
4749 hooks : {
48- doctor : 'npx -q --no-install -p @slack/cli-hooks slack-cli-doctor' ,
49- 'check-update' : 'npx -q --no-install -p @slack/cli-hooks slack-cli-check-update' ,
50- 'get-manifest' : 'npx -q --no-install -p @slack/cli-hooks slack-cli-get-manifest' ,
50+ doctor : 'NODE_NO_WARNINGS=1 npx -q --no-install -p @slack/cli-hooks slack-cli-doctor' ,
51+ 'check-update' : 'NODE_NO_WARNINGS=1 npx -q --no-install -p @slack/cli-hooks slack-cli-check-update' ,
52+ 'get-manifest' : 'NODE_NO_WARNINGS=1 npx -q --no-install -p @slack/cli-hooks slack-cli-get-manifest' ,
5153 start : 'npx -q --no-install -p @slack/cli-hooks slack-cli-start' ,
5254 } ,
5355 config : {
Original file line number Diff line number Diff line change @@ -6,9 +6,13 @@ import getHooks from './get-hooks.js';
66describe ( 'get-hooks implementation' , async ( ) => {
77 it ( 'should return scripts for required hooks' , async ( ) => {
88 const { hooks } = getHooks ( ) ;
9- assert ( hooks . doctor === 'npx -q --no-install -p @slack/cli-hooks slack-cli-doctor' ) ;
10- assert ( hooks [ 'check-update' ] === 'npx -q --no-install -p @slack/cli-hooks slack-cli-check-update' ) ;
11- assert ( hooks [ 'get-manifest' ] === 'npx -q --no-install -p @slack/cli-hooks slack-cli-get-manifest' ) ;
9+ assert ( hooks . doctor === 'NODE_NO_WARNINGS=1 npx -q --no-install -p @slack/cli-hooks slack-cli-doctor' ) ;
10+ assert (
11+ hooks [ 'check-update' ] === 'NODE_NO_WARNINGS=1 npx -q --no-install -p @slack/cli-hooks slack-cli-check-update' ,
12+ ) ;
13+ assert (
14+ hooks [ 'get-manifest' ] === 'NODE_NO_WARNINGS=1 npx -q --no-install -p @slack/cli-hooks slack-cli-get-manifest' ,
15+ ) ;
1216 assert ( hooks . start === 'npx -q --no-install -p @slack/cli-hooks slack-cli-start' ) ;
1317 } ) ;
1418
Original file line number Diff line number Diff line change @@ -42,7 +42,7 @@ export function DefaultProtocol(args) {
4242 // If the particular hook invocation is requesting manifest generation we
4343 // ensure any logging is a no-op to prevent littering stdout with logging
4444 // and confusing the CLI's manifest JSON payload parsing.
45- const loggerMethod = manifestOnly ? ( ) => { } : console . log ;
45+ const loggerMethod = manifestOnly ? ( ) => { } : console . log ;
4646 return {
4747 name : DEFAULT_PROTOCOL ,
4848 log : loggerMethod ,
You can’t perform that action at this time.
0 commit comments