-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
move node specific code into a platform file
- Loading branch information
Showing
17 changed files
with
118 additions
and
92 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"@paperdave/logger": minor | ||
--- | ||
|
||
`writeLine` now accepts no arguments to default to printing a fully blank line |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"@paperdave/logger": minor | ||
--- | ||
|
||
Fix color issues with printing errors, warn(), and many other places. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"@paperdave/logger": major | ||
--- | ||
|
||
In options passed to `new Logger()` Remove `error` in favor of `type: "error"` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
import { error, info, warn } from './src'; | ||
|
||
info('Hello world!'); | ||
warn('Hello world!'); | ||
info(new Error('Hello world!')); | ||
error(new Error('Hello world!')); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
/* eslint-disable no-console */ | ||
const _console = { ...console }; | ||
|
||
export function platformWriteWidgetText() {} | ||
|
||
export const platformWidgetEnabled = false; | ||
|
||
export const platformWrite = { | ||
info: _console.log, | ||
error: _console.error, | ||
warn: _console.warn, | ||
debug: _console.debug, | ||
}; | ||
|
||
export const platformUnicodeSupported = true; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
import { writeSync } from 'fs'; | ||
|
||
/** File Descriptor for standard output. */ | ||
export const STDOUT = 1; | ||
|
||
/** File Descriptor for standard error. */ | ||
export const STDERR = 2; | ||
|
||
/** File Descriptor for standard input. */ | ||
export const STDIN = 0; | ||
|
||
export const platformWidgetEnabled = true; | ||
|
||
export const platformWrite = { | ||
info(content: string) { | ||
writeSync(STDOUT, content + '\n'); | ||
}, | ||
error(content: string) { | ||
writeSync(STDERR, content + '\n'); | ||
}, | ||
warn(content: string) { | ||
writeSync(STDOUT, content + '\n'); | ||
}, | ||
debug(content: string) { | ||
writeSync(STDOUT, content + '\n'); | ||
}, | ||
widget(content: string) { | ||
writeSync(STDERR, content); | ||
}, | ||
}; | ||
|
||
// Inlined from | ||
// https://github.com/sindresorhus/is-unicode-supported/blob/main/index.js | ||
export const platformUnicodeSupported = | ||
process.platform === 'win32' | ||
? Boolean(process.env.CI) || | ||
Boolean(process.env.WT_SESSION) || // Windows Terminal | ||
process.env.ConEmuTask === '{cmd::Cmder}' || // ConEmu and cmder | ||
process.env.TERM_PROGRAM === 'vscode' || | ||
process.env.TERM === 'xterm-256color' || | ||
process.env.TERM === 'alacritty' || | ||
process.env.TERMINAL_EMULATOR === 'JetBrains-JediTerm' | ||
: process.env.TERM !== 'linux'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters