Skip to content

Commit f318abf

Browse files
committed
Organize globals
Fix npm installation in CI
1 parent 73d1df0 commit f318abf

File tree

5 files changed

+26
-13
lines changed

5 files changed

+26
-13
lines changed

.github/workflows/ci.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,9 @@ jobs:
2525
- name: Install dependencies
2626
run: npm install
2727

28+
- name: Install dependencies (non-gpl)
29+
run: npm install --prefix non-gpl
30+
2831
- name: Formatting
2932
run: npm run format:check
3033

.github/workflows/release.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,9 @@ jobs:
6060
- name: Install dependencies
6161
run: npm install
6262

63+
- name: Install dependencies (non-gpl)
64+
run: npm install --prefix non-gpl
65+
6366
- name: Build
6467
run: npx tsc
6568

src/_globals.ts

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
// SPDX-License-Identifier: GPL-3.0-or-later WITH EXCEPTIONS
2+
/*
3+
Copyright (c) 2025 James Prevett
4+
5+
This file include declarations for APIs that are usually available in any JS host.
6+
These APIs aren't standardized, so TypeScript doesn't include them by default.
7+
We avoid include DOM types or @types/node since they add a bunch of stuff we don't want (like making a global `Buffer` class available).
8+
*/
9+
10+
declare global {
11+
const performance: {
12+
now(): number;
13+
};
14+
15+
const console: Record<'error' | 'warn' | 'info' | 'debug' | 'log', (...message: any[]) => void>;
16+
17+
interface ErrorConstructor {
18+
captureStackTrace?(targetObject: object, constructorOpt?: Function): void;
19+
}
20+
}

src/error.ts

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -452,12 +452,6 @@ export function setUVMessage<T extends ExceptionJSON>(ex: T): T {
452452
return ex;
453453
}
454454

455-
declare global {
456-
interface ErrorConstructor {
457-
captureStackTrace?(targetObject: object, constructorOpt?: Function): void;
458-
}
459-
}
460-
461455
/**
462456
* An error with additional information about what happened.
463457
*

src/log.ts

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,6 @@
55

66
import { List } from 'utilium';
77

8-
declare global {
9-
const performance: {
10-
now(): number;
11-
};
12-
const console: Record<'error' | 'warn' | 'info' | 'debug' | 'log', (...message: any[]) => void>;
13-
}
14-
158
/**
169
* The log levels
1710
*/

0 commit comments

Comments
 (0)