Skip to content

Commit 3bca162

Browse files
author
Fil Maj
authored
Prep for initial release (#1)
* Removing any clobbering of console methods from MessageBoundaryProtocol. * Fix code coverage uploading to codecov since introduction of nicer local coverage reporting
1 parent 7e0df32 commit 3bca162

File tree

2 files changed

+4
-23
lines changed

2 files changed

+4
-23
lines changed

.github/workflows/deno-ci.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,9 @@ jobs:
3131
run: deno task test
3232

3333
- name: Generate CodeCov-friendly coverage report
34-
run: deno task coverage --lcov --output=codecov.lcov
34+
run: deno task coverage
3535

3636
- name: Upload coverage to CodeCov
3737
uses: codecov/[email protected]
3838
with:
39-
file: ./codecov.lcov
39+
file: ./lcov.info

src/mod.ts

Lines changed: 2 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -38,36 +38,17 @@ export const MessageBoundaryProtocol = function (args: string[]): Protocol {
3838
args,
3939
);
4040
if (!boundary) throw new Error("no boundary argument provided!");
41-
const originalConsole = {
42-
log: globalThis.console.log,
43-
warn: globalThis.console.warn,
44-
error: globalThis.console.error,
45-
};
4641
const protocol = {
4742
name: MSG_BOUNDARY_PROTOCOL,
4843
log: console.log,
49-
// TODO: `error` could just as easily remain as console.error (i.e stderr) - BUT - we need to ensure that on the CLI side, we stream hook stderr out straight to the user
50-
// TODO: if we override default console.error functionality (as below), then we also need to implement the `install()` and `uninstall()` methods
51-
// TODO: `install()` and `uninstall()` would 'clobber' `globalThis.console` methods with these methods, to ensure that any userland or SDK code
52-
// does not litter stdout in ways that violate the protocol's rules.
53-
error: console.log,
54-
warn: console.log, // TODO: same as previous line
44+
error: console.error,
45+
warn: console.warn,
5546
// deno-lint-ignore no-explicit-any
5647
respond: (data: any) => {
5748
console.log(boundary + data + boundary);
5849
},
5950
getCLIFlags:
6051
() => [`--protocol=${MSG_BOUNDARY_PROTOCOL}`, `--boundary=${boundary}`],
61-
install: () => {
62-
globalThis.console.log = protocol.log;
63-
globalThis.console.error = protocol.error;
64-
globalThis.console.warn = protocol.warn;
65-
},
66-
uninstall: () => {
67-
globalThis.console.log = originalConsole.log;
68-
globalThis.console.error = originalConsole.error;
69-
globalThis.console.warn = originalConsole.warn;
70-
},
7152
};
7253
return protocol;
7354
};

0 commit comments

Comments
 (0)