Skip to content

Commit

Permalink
Very minor change to prevent many downstream packages from crashing i…
Browse files Browse the repository at this point in the history
…f the DEV env var is set. (#651)
  • Loading branch information
bn-l committed May 11, 2024
1 parent 4ed6267 commit ba795a1
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
8 changes: 4 additions & 4 deletions src/parse-keypress.ts
Expand Up @@ -88,7 +88,7 @@ const keyName: Record<string, string> = {
'[7^': 'home',
'[8^': 'end',
/* misc. */
'[Z': 'tab'
'[Z': 'tab',
};

export const nonAlphanumericKeys = [...Object.values(keyName), 'backspace'];
Expand All @@ -106,7 +106,7 @@ const isShiftKey = (code: string) => {
'[6$',
'[7$',
'[8$',
'[Z'
'[Z',
].includes(code);
};

Expand All @@ -122,7 +122,7 @@ const isCtrlKey = (code: string) => {
'[5^',
'[6^',
'[7^',
'[8^'
'[8^',
].includes(code);
};

Expand Down Expand Up @@ -160,7 +160,7 @@ const parseKeypress = (s: Buffer | string = ''): ParsedKey => {
shift: false,
option: false,
sequence: s,
raw: s
raw: s,
};

key.sequence = key.sequence || s || key.name;
Expand Down
7 changes: 5 additions & 2 deletions src/reconciler.ts
Expand Up @@ -26,10 +26,13 @@ if (process.env['DEV'] === 'true') {
try {
await import('./devtools.js');
} catch (error: any) {
if (error.code === 'MODULE_NOT_FOUND') {
if (error.code === 'ERR_MODULE_NOT_FOUND') {
console.warn(
`
Debugging with React Devtools requires \`react-devtools-core\` dependency to be installed.
The environment variable DEV is set to true, so Ink tried to import \`react-devtools-core\`,
but this failed as it was not installed. Debugging with React Devtools requires it.
To install use this command:
$ npm install --save-dev react-devtools-core
`.trim() + '\n',
Expand Down

0 comments on commit ba795a1

Please sign in to comment.