Skip to content

Commit 65a40a0

Browse files
committed
feat: is now deno
1 parent b52293f commit 65a40a0

40 files changed

+1092
-1954
lines changed

.github/logo_dark.svg

Lines changed: 95 additions & 0 deletions
Loading

.github/logo_light.svg

Lines changed: 95 additions & 0 deletions
Loading

.github/workflows/ci.yml

Lines changed: 19 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -2,32 +2,29 @@ name: CI
22

33
on:
44
push:
5-
branches: [main]
6-
pull_request: {}
5+
workflow_call:
76

87
jobs:
9-
test:
10-
name: Node.js v${{ matrix.node }}
8+
deno:
119
runs-on: ubuntu-latest
12-
strategy:
13-
matrix:
14-
node: [16, 18, 20]
1510
steps:
16-
- uses: actions/checkout@main
11+
- uses: actions/checkout@v4
12+
- uses: denoland/setup-deno@v1
1713

18-
- name: (env) setup pnpm
19-
uses: pnpm/action-setup@master
20-
with:
21-
version: 8.6.5
14+
- run: deno fmt --check
15+
- run: deno lint
16+
- run: deno check **/*.ts
2217

23-
- name: (env) setup node v${{ matrix.node }}
24-
uses: actions/setup-node@main
25-
with:
26-
node-version: ${{ matrix.node }}
27-
cache: pnpm
28-
check-latest: true
18+
- name: Tests
19+
run: |-
20+
deno test --coverage=cov/
21+
deno coverage cov/
2922
30-
- run: pnpm install --ignore-scripts
31-
- run: pnpm run build
32-
- run: pnpm run test
33-
- run: pnpm run typecheck
23+
npm:
24+
runs-on: ubuntu-latest
25+
steps:
26+
- uses: actions/checkout@v4
27+
- uses: denoland/setup-deno@v1
28+
29+
- run: mkdir -p npm
30+
- run: deno task build

.gitignore

Lines changed: 4 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,5 @@
1-
node_modules
21
.DS_Store
3-
*-lock.json
4-
*.lock
5-
*.log
6-
7-
/coverage
8-
/.nyc_output
9-
10-
# Editors
11-
*.iml
12-
/.idea
13-
/.vscode
14-
15-
# Code
16-
/node.*
17-
/browser.*
18-
/json.*
19-
/utils.*
2+
node_modules
3+
/npm
4+
*.lcov
5+
/cov

TEMP/bench.ts

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
import * as v4 from 'npm:diary@^0.4';
2+
import * as v5 from '../mod.ts';
3+
4+
v4.enable('*');
5+
6+
let log = v4.diary('test', (e) => {
7+
JSON.stringify(e);
8+
});
9+
Deno.bench('v4', () => {
10+
log.info('hello', { name: 'world' });
11+
});
12+
13+
let logv5 = v5.diary((e) => {
14+
JSON.stringify(e);
15+
});
16+
Deno.bench('v5', () => {
17+
logv5('info', 'hello {name}', { name: 'world' });
18+
});

TEMP/migration.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
Removed the `enable` function from the `diary` package.
2+
3+
```diff
4+
- import { enable } from 'diary';
5+
- enable('*');
6+
```

TEMP/migration.ts

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
import * as v4 from 'npm:diary@^0.4';
2+
import * as v5 from '../mod.ts';
3+
4+
let v4Events: any[] = [];
5+
let v5Events: any[] = [];
6+
7+
{
8+
v4.enable('*');
9+
const log = v4.diary('v0.4', (event) => {
10+
v4Events.push(event);
11+
});
12+
13+
log.log('hello %s', 'world', 'extra', 'props');
14+
log.debug('hello %s', 'world', 'extra', 'props');
15+
log.info('hello %s', 'world', 'extra', 'props');
16+
log.warn('hello %s', 'world', 'extra', 'props');
17+
log.error('hello %s', 'world', 'extra', 'props');
18+
log.fatal('hello %s', 'world', 'extra', 'props');
19+
}
20+
21+
{
22+
const log = v5.diary((level, event, props) => {
23+
v5Events.push({ name: 'v0.5', level, messages: [event, props] });
24+
});
25+
26+
log('debug', 'hello');
27+
log('log', 'hello {phrase}', { phrase: 'world', extra: ['extra', 'props'] });
28+
log('debug', 'hello {phrase}', { phrase: 'world', extra: ['extra', 'props'] });
29+
log('info', 'hello {phrase}', { phrase: 'world', extra: ['extra', 'props'] });
30+
log('warn', 'hello {phrase}', { phrase: 'world', extra: ['extra', 'props'] });
31+
log('error', 'hello {phrase}', { phrase: 'world', extra: ['extra', 'props'] });
32+
log('fatal', 'hello {phrase} the time is {time}', {
33+
phrase: 'world',
34+
extra: ['extra', 'props'],
35+
time: 123,
36+
});
37+
}
38+
39+
console.log({
40+
v4Events,
41+
v5Events,
42+
});

bench/index.ts

Lines changed: 0 additions & 112 deletions
This file was deleted.

bench/package.json

Lines changed: 0 additions & 11 deletions
This file was deleted.

0 commit comments

Comments
 (0)