Skip to content

Commit 1eb2532

Browse files
authored
Merge pull request #29 from jakeboone02/bunnier
Use recent Bun features and build DTS with oxc-transform
2 parents acb78ee + ea1c2ac commit 1eb2532

20 files changed

+1082
-95
lines changed

.codesandbox/ci.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
{
2+
"installCommand": "codesandbox-ci",
3+
"buildCommand": "build",
24
"sandboxes": ["/ci"],
35
"node": "18"
46
}

.codesandbox/ci.sh

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
#!/usr/bin/env bash
2+
3+
# CodeSandbox CI doesn't have the `alias` or `source` commands available,
4+
# so we can't use the line below (the preferred installation method).
5+
# curl -fsSL https://bun.sh/install | bash
6+
7+
# We can use an npm global install, but we have to override the
8+
# npm_config_user_agent environment variable. Otherwise, Bun throws
9+
# an error about not being compatible with Yarn because it sees Yarn's
10+
# user agent string since CodeSandbox always runs `yarn run ...`.
11+
# See https://github.com/oven-sh/bun/issues/2530.
12+
npm_config_user_agent="npm/? node/?" npm install --global bun
13+
# Use this to pin Bun version:
14+
# npm_config_user_agent="npm/? node/?" npm install --global [email protected]
15+
16+
# Now we can get on with business...
17+
bun install --frozen-lockfile

.github/dependabot.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
version: 2
2+
updates:
3+
- package-ecosystem: "github-actions"
4+
directory: "/"
5+
schedule:
6+
interval: "monthly"

.github/workflows/docs.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,13 @@ jobs:
99
runs-on: ubuntu-latest
1010

1111
steps:
12-
- uses: actions/checkout@v3
12+
- uses: actions/checkout@v4
1313
- uses: oven-sh/setup-bun@v1
1414
with:
1515
bun-version: latest
1616
- run: bun install
1717
- run: bun run docs
18-
- uses: actions/upload-pages-artifact@v2
18+
- uses: actions/upload-pages-artifact@v3
1919
with:
2020
path: 'docs/'
2121

@@ -35,4 +35,4 @@ jobs:
3535
steps:
3636
- name: Deploy to GitHub Pages
3737
id: deployment
38-
uses: actions/deploy-pages@v2
38+
uses: actions/deploy-pages@v4

.github/workflows/main.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,15 @@ on: [push, pull_request, workflow_dispatch]
33

44
jobs:
55
build:
6-
name: Build and test
6+
name: Build, test, and lint
77
runs-on: ubuntu-latest
88
steps:
99
- uses: actions/checkout@v4
1010
- uses: oven-sh/setup-bun@v1
1111
- run: bun install --frozen-lockfile
1212
- run: bun run build
1313
- run: bun run test
14+
- run: bun run lint
1415
- uses: codecov/codecov-action@v4
1516
env:
1617
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}

bun.lock

Lines changed: 973 additions & 0 deletions
Large diffs are not rendered by default.

bun.lockb

-181 KB
Binary file not shown.

ci/package.json

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,10 @@
88
"build": "parcel build index.html"
99
},
1010
"dependencies": {
11-
"numeric-quantity": "^2.0.0",
12-
"parcel-bundler": "^1.12.5"
11+
"numeric-quantity": "^2.0.1"
1312
},
1413
"devDependencies": {
15-
"typescript": "^5.1.3"
16-
},
17-
"resolutions": {
18-
"@babel/preset-env": "7.13.8"
19-
},
20-
"keywords": []
14+
"parcel-bundler": "^1.12.5",
15+
"typescript": "^5.8.3"
16+
}
2117
}

ci/src/index.ts

Lines changed: 14 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -123,24 +123,21 @@ const strings = [
123123
'I',
124124
];
125125

126-
const app = document.getElementById('app')!;
126+
const tbodyInnerHTML = strings
127+
.map(str => {
128+
const nq = `${numericQuantity(str)}`;
129+
const nqa = `${numericQuantity(str, { allowTrailingInvalid: true })}`;
130+
const nqr = `${numericQuantity(str, { romanNumerals: true })}`;
131+
return `<tr><td>numericQuantity("${str}")</td><td>${nq}</td><td${nqa !== nq ? ' class="diff"' : ''}>${nqa}</td><td${nqr !== nq ? ' class="diff"' : ''}>${nqr}</td></tr>`;
132+
})
133+
.join('');
127134

128-
app.innerHTML = `<h1>numeric-quantity CI</h1>
135+
document.getElementById('app')!.innerHTML = `<h1>numeric-quantity CI</h1>
129136
<table>
130-
<thead><tr><th>Expression</th><th>Result</th></tr></thead>
137+
<thead><tr><th>Expression</th><th>Default</th><th>allowTrailingInvalid</th><th>romanNumerals</th></tr></thead>
138+
<tbody>${tbodyInnerHTML}</tbody>
131139
</table>`;
132140

133-
const table = document.querySelector('table')!;
134-
const tbody = document.createElement('tbody')!;
135-
136-
for (const s of strings) {
137-
const tr = document.createElement('tr');
138-
const result = numericQuantity(s, {
139-
romanNumerals: true,
140-
allowTrailingInvalid: true,
141-
});
142-
tr.innerHTML = `<td>numericQuantity("${s}")</td><td>${result}</td>`;
143-
tbody.appendChild(tr);
144-
}
145-
146-
table.appendChild(tbody);
141+
Object.defineProperty(globalThis, 'numericQuantity', {
142+
value: numericQuantity,
143+
});

ci/src/styles.css

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,11 @@ td {
88
padding: 4px;
99
}
1010

11-
th:first-child,
12-
td:first-child {
11+
th:not(:last-child),
12+
td:not(:last-child) {
1313
border-right: 1px solid lightgray;
1414
}
15+
16+
.diff {
17+
background-color: color-mix(in srgb, rebeccapurple, transparent 90%);
18+
}

0 commit comments

Comments
 (0)