Skip to content

Commit

Permalink
feat: is now deno
Browse files Browse the repository at this point in the history
  • Loading branch information
maraisr committed Jun 1, 2024
1 parent b52293f commit 355aee7
Show file tree
Hide file tree
Showing 40 changed files with 1,091 additions and 1,954 deletions.
95 changes: 95 additions & 0 deletions .github/logo_dark.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
95 changes: 95 additions & 0 deletions .github/logo_light.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
41 changes: 19 additions & 22 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,32 +2,29 @@ name: CI

on:
push:
branches: [main]
pull_request: {}
workflow_call:

jobs:
test:
name: Node.js v${{ matrix.node }}
deno:
runs-on: ubuntu-latest
strategy:
matrix:
node: [16, 18, 20]
steps:
- uses: actions/checkout@main
- uses: actions/checkout@v4
- uses: denoland/setup-deno@v1

- name: (env) setup pnpm
uses: pnpm/action-setup@master
with:
version: 8.6.5
- run: deno fmt --check
- run: deno lint
- run: deno check **/*.ts

- name: (env) setup node v${{ matrix.node }}
uses: actions/setup-node@main
with:
node-version: ${{ matrix.node }}
cache: pnpm
check-latest: true
- name: Tests
run: |-
deno test --coverage=cov/
deno coverage cov/
- run: pnpm install --ignore-scripts
- run: pnpm run build
- run: pnpm run test
- run: pnpm run typecheck
npm:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: denoland/setup-deno@v1

- run: mkdir -p npm
- run: deno task build
22 changes: 4 additions & 18 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,19 +1,5 @@
node_modules
.DS_Store
*-lock.json
*.lock
*.log

/coverage
/.nyc_output

# Editors
*.iml
/.idea
/.vscode

# Code
/node.*
/browser.*
/json.*
/utils.*
node_modules
/npm
*.lcov
/cov
18 changes: 18 additions & 0 deletions TEMP/bench.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import * as v4 from 'npm:diary@^0.4';
import * as v5 from '../mod.ts';

v4.enable('*');

let log = v4.diary('test', (e) => {
JSON.stringify(e);
});
Deno.bench('v4', () => {
log.info('hello', { name: 'world' });
});

let logv5 = v5.diary((e) => {
JSON.stringify(e);
});
Deno.bench('v5', () => {
logv5('info', 'hello {name}', { name: 'world' });
});
6 changes: 6 additions & 0 deletions TEMP/migration.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
Removed the `enable` function from the `diary` package.

```diff
- import { enable } from 'diary';
- enable('*');
```
42 changes: 42 additions & 0 deletions TEMP/migration.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
import * as v4 from 'npm:diary@^0.4';
import * as v5 from '../mod.ts';

let v4Events: any[] = [];
let v5Events: any[] = [];

{
v4.enable('*');
const log = v4.diary('v0.4', (event) => {
v4Events.push(event);
});

log.log('hello %s', 'world', 'extra', 'props');
log.debug('hello %s', 'world', 'extra', 'props');
log.info('hello %s', 'world', 'extra', 'props');
log.warn('hello %s', 'world', 'extra', 'props');
log.error('hello %s', 'world', 'extra', 'props');
log.fatal('hello %s', 'world', 'extra', 'props');
}

{
const log = v5.diary((level, event, props) => {
v5Events.push({ name: 'v0.5', level, messages: [event, props] });
});

log('debug', 'hello');
log('log', 'hello {phrase}', { phrase: 'world', extra: ['extra', 'props'] });
log('debug', 'hello {phrase}', { phrase: 'world', extra: ['extra', 'props'] });
log('info', 'hello {phrase}', { phrase: 'world', extra: ['extra', 'props'] });
log('warn', 'hello {phrase}', { phrase: 'world', extra: ['extra', 'props'] });
log('error', 'hello {phrase}', { phrase: 'world', extra: ['extra', 'props'] });
log('fatal', 'hello {phrase} the time is {time}', {
phrase: 'world',
extra: ['extra', 'props'],
time: 123,
});
}

console.log({
v4Events,
v5Events,
});
112 changes: 0 additions & 112 deletions bench/index.ts

This file was deleted.

11 changes: 0 additions & 11 deletions bench/package.json

This file was deleted.

Loading

0 comments on commit 355aee7

Please sign in to comment.