Skip to content

Commit ade0351

Browse files
author
Adam McKee
committed
rm bun
1 parent 3d3b96b commit ade0351

20 files changed

Lines changed: 257 additions & 197 deletions

.github/workflows/ci_verify.yml

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,13 @@ jobs:
1010
runs-on: ubuntu-latest
1111
steps:
1212
- uses: actions/checkout@v4
13-
- run: rm /usr/local/bin/node
14-
- uses: oven-sh/setup-bun@v2
15-
- run: bun i
16-
- run: bun test
17-
- run: bun typecheck
18-
- run: bun fmtcheck
13+
- uses: pnpm/action-setup@v4
14+
- uses: actions/setup-node@v4
15+
with:
16+
node-version: 24
17+
cache: pnpm
18+
- run: pnpm i
19+
- run: pnpm test
20+
- run: pnpm typecheck
21+
- run: pnpm fmtcheck
1922
- run: echo 'Ba'

.github/workflows/npm_publish.yml

Lines changed: 18 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,12 @@ jobs:
2222
runs-on: ubuntu-latest
2323
steps:
2424
- uses: actions/checkout@v4
25-
- uses: oven-sh/setup-bun@v2
25+
- uses: actions/setup-node@v4
26+
with:
27+
node-version: 24
2628
- name: changelog entries
2729
if: ${{ inputs.semver-bump != 'prerelease' }}
28-
run: bunx @eighty4/changelog check
30+
run: npx -y @eighty4/changelog check
2931

3032
verify:
3133
uses: ./.github/workflows/ci_verify.yml
@@ -38,10 +40,10 @@ jobs:
3840
contents: write
3941
steps:
4042
- uses: actions/checkout@v4
43+
- uses: pnpm/action-setup@v4
4144
- uses: actions/setup-node@v4
4245
with:
43-
node-version: 23
44-
- uses: oven-sh/setup-bun@v2
46+
node-version: 24
4547
- id: bump
4648
run: |
4749
GIT_TAG=$(npm version ${{ inputs.semver-bump }} --no-git-tag-version)
@@ -50,7 +52,7 @@ jobs:
5052
- if: inputs.semver-bump != 'prerelease'
5153
env:
5254
VERSION: ${{ steps.bump.outputs.version }}
53-
run: bunx @eighty4/changelog rollover "v$VERSION"
55+
run: npx -y @eighty4/changelog rollover "v$VERSION"
5456
- id: push
5557
env:
5658
GIT_TAG: ${{ steps.bump.outputs.tag }}
@@ -74,14 +76,17 @@ jobs:
7476
with:
7577
fetch-tags: true
7678
ref: ${{ needs.create-git-tag.outputs.tag }}
77-
- uses: oven-sh/setup-bun@v2
78-
- run: bun i
79-
- run: bun run build
79+
- uses: pnpm/action-setup@v4
80+
- uses: actions/setup-node@v4
81+
with:
82+
node-version: 24
83+
- run: pnpm i
84+
- run: pnpm run build
8085
- name: publish
8186
env:
8287
NPM_CONFIG_TOKEN: ${{ secrets.NPM_TOKEN }}
8388
NPM_TAG: ${{ inputs.semver-bump == 'prerelease' && 'next' || 'latest' }}
84-
run: bun publish --access public --tag $NPM_TAG
89+
run: pnpm publish --access public --tag $NPM_TAG
8590

8691
create-release-notes:
8792
runs-on: ubuntu-latest
@@ -91,7 +96,9 @@ jobs:
9196
with:
9297
fetch-tags: true
9398
ref: ${{ needs.create-git-tag.outputs.tag }}
94-
- uses: oven-sh/setup-bun@v2
99+
- uses: actions/setup-node@v4
100+
with:
101+
node-version: 24
95102
- id: gen
96103
env:
97104
CHANGELOG_TAG: ${{ inputs.semver-bump == 'prerelease' && 'Unreleased' || needs.create-git-tag.outputs.tag }}
@@ -107,7 +114,7 @@ jobs:
107114
108115
echo "## Release notes" >> release_notes.md
109116
echo >> release_notes.md
110-
bunx @eighty4/changelog get "$CHANGELOG_TAG" >> release_notes.md
117+
npx -y @eighty4/changelog get "$CHANGELOG_TAG" >> release_notes.md
111118
echo >> release_notes.md
112119
113120
RELEASE_NOTES=$(cat release_notes.md | base64 -w 0)

.prettierignore

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
bun.lock
1+
pnpm-lock.yaml
22
examples/**/*.img
33
examples/**/*.iso
44
lib_types/**/*.d.ts
5-

README.md

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,6 @@ npm i -g @eighty4/c2
1212
c2 -h
1313
```
1414

15-
(tests use `bun:test` so [install Bun](https://bun.sh/docs/installation)
16-
for contributing!)
17-
1815
## Using the CLI program
1916

2017
```

bun.lock

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

ci_verify.sh

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ fi
2929

3030
# run through all the checks done for ci
3131

32-
bun test
33-
bun --bun run build
34-
bun --bun run fmtcheck
35-
32+
pnpm test
33+
pnpm build
34+
pnpm fmtcheck
35+
pnpm typecheck

examples/.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
.qemu
22
bun.lock
3-
3+
pnpm-lock.yaml

examples/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,15 @@
55
Many cloud providers support launching VMs from their JavaScript SDKs.
66
This allows `c2` to integrate directly into your DevOps workflows.
77

8-
The TypeScript examples will require `bun i` or `pnpm i` in this directory
8+
The TypeScript examples will require `npm i` or `pnpm i` in this directory
99
before running.
1010

1111
### linode.ts
1212

1313
Create a Linode account and run with a `LINODE_TOKEN` env var:
1414

1515
```
16-
LINODE_TOKEN=XYZ bun linode.ts
16+
LINODE_TOKEN=XYZ node linode.ts
1717
```
1818

1919
## Local Ubuntu with QEMU

lib/attachments.spec.ts

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1-
import { afterEach, beforeEach, expect, test } from 'bun:test'
1+
import assert from 'node:assert/strict'
22
import { join } from 'node:path'
3+
import { afterEach, beforeEach, test } from 'node:test'
34
import { collectAttachments } from './attachments.ts'
45
import { makeFile, makeTempDir, removeDir } from './fs.testing.ts'
56

@@ -11,14 +12,15 @@ afterEach(async () => await removeDir(tmpDir))
1112

1213
test('collect throws error for unknown filetype', async () => {
1314
await makeFile('init-cloud', 'whoopie', tmpDir)
14-
await expect(() => collectAttachments(tmpDir)).toThrow(
15-
'init-cloud is an unsupported file type',
15+
await assert.rejects(
16+
() => collectAttachments(tmpDir),
17+
new Error('init-cloud is an unsupported file type'),
1618
)
1719
})
1820

1921
test('collect cloud config yml', async () => {
2022
await makeFile('init-cloud.yml', '#cloud-config\nwhoopie', tmpDir)
21-
expect(await collectAttachments(tmpDir)).toStrictEqual([
23+
assert.deepEqual(await collectAttachments(tmpDir), [
2224
{
2325
path: join(tmpDir, 'init-cloud.yml'),
2426
content: '#cloud-config\nwhoopie',
@@ -31,7 +33,7 @@ test('collect cloud config yml', async () => {
3133

3234
test('collect cloud config yaml', async () => {
3335
await makeFile('init-cloud.yaml', '#cloud-config\nwhoopie', tmpDir)
34-
expect(await collectAttachments(tmpDir)).toStrictEqual([
36+
assert.deepEqual(await collectAttachments(tmpDir), [
3537
{
3638
path: join(tmpDir, 'init-cloud.yaml'),
3739
content: '#cloud-config\nwhoopie',
@@ -44,21 +46,23 @@ test('collect cloud config yaml', async () => {
4446

4547
test('collect throws error when yml does not have #cloud-config comment', async () => {
4648
await makeFile('init-cloud.yml', 'whoopie', tmpDir)
47-
await expect(() => collectAttachments(tmpDir)).toThrow(
48-
'YAML cloud config must start with a #cloud-config comment',
49+
await assert.rejects(
50+
() => collectAttachments(tmpDir),
51+
new Error('YAML cloud config must start with a #cloud-config comment'),
4952
)
5053
})
5154

5255
test('collect throws error when yaml does not have #cloud-config comment', async () => {
5356
await makeFile('init-cloud.yaml', 'whoopie', tmpDir)
54-
await expect(() => collectAttachments(tmpDir)).toThrow(
55-
'YAML cloud config must start with a #cloud-config comment',
57+
await assert.rejects(
58+
() => collectAttachments(tmpDir),
59+
new Error('YAML cloud config must start with a #cloud-config comment'),
5660
)
5761
})
5862

5963
test('collect shell script', async () => {
6064
await makeFile('init-cloud.sh', 'whoopie', tmpDir)
61-
expect(await collectAttachments(tmpDir)).toStrictEqual([
65+
assert.deepEqual(await collectAttachments(tmpDir), [
6266
{
6367
path: join(tmpDir, 'init-cloud.sh'),
6468
content: 'whoopie',
@@ -77,7 +81,7 @@ test('evals template expressions', async () => {
7781
`\${{ file('${resourceTmpDir}/whoopie') }}`,
7882
tmpDir,
7983
)
80-
expect(await collectAttachments(tmpDir)).toStrictEqual([
84+
assert.deepEqual(await collectAttachments(tmpDir), [
8185
{
8286
path: tmpDir + '/init-cloud.sh',
8387
content: 'whoopie',
@@ -92,7 +96,7 @@ test('evals template expressions', async () => {
9296
test('sorts attachments by filename', async () => {
9397
await makeFile('01-init-cloud.sh', 'whoopie', tmpDir)
9498
await makeFile('02-init-cloud.sh', 'whoopie', tmpDir)
95-
expect(await collectAttachments(tmpDir)).toStrictEqual([
99+
assert.deepEqual(await collectAttachments(tmpDir), [
96100
{
97101
path: join(tmpDir, '01-init-cloud.sh'),
98102
content: 'whoopie',

lib/attachments.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1+
import { readdir, readFile } from 'node:fs/promises'
12
import { evalTemplateExpressions } from './expression.ts'
2-
import { readDirListing, readToString } from './fs.ts'
33

44
export type AttachmentType = 'cloud-config' | 'x-shellscript'
55

@@ -14,11 +14,11 @@ export interface Attachment {
1414
export async function collectAttachments(
1515
dir: string,
1616
): Promise<Array<Attachment>> {
17-
const filenames = await readDirListing(dir)
17+
const filenames = await readdir(dir)
1818
const attachments = await Promise.all(
1919
filenames.map(async filename => {
2020
const path = `${dir}/${filename}`
21-
const source = await readToString(path)
21+
const source = await readFile(path, 'utf-8')
2222
const type = resolveAttachmentType(filename, source)
2323
const content = await evalTemplateExpressions(source)
2424
return { content, filename, path, type, source }

0 commit comments

Comments
 (0)