-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Migrate to Deno #32
base: main
Are you sure you want to change the base?
Migrate to Deno #32
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I removed LinkGlob.test.ts, since import.meta.glob is a vite-specific API. I wasn't sure what to do instead.
"@std/assert": "jsr:@std/assert@1", | ||
"@std/expect": "jsr:@std/expect@1", | ||
"@std/testing": "jsr:@std/testing@1", | ||
"vitest": "./testlib/mod.ts", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I replaced vite with the Deno testing facilities, mostly to reduce our dependencies.
If vitest does have some nice advantages, we should switch back to it.
"dev": "deno run --watch main.ts" | ||
}, | ||
"imports": { | ||
"yargs": "https://deno.land/x/yargs@v17.7.2-deno/deno.ts" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I could simply import most dependencies from npm
, but Deno usually has a nicer built-in alternative. So I figured I'd properly do the migration.
Yargs is a pretty good dependency though. The only alternative worth considering that I could find is https://cliffy.io/ .
- `deno lint` for linting | ||
- `deno fmt` for formatting | ||
- `deno test --allow-read` to run the unit tests | ||
- To update the snapshots, run `deno test --allow-all -- --update` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's all deno! 🦕
I guess that unified tooling aspect is reasonably nice. Hopefully the Node.js ecosystem will catch up and also get more unified tooling.
After having tried out the mini-parse migration, I thought of a few more tricks to make the migration easier. This is my WIP attempt to migrate everything.
Tasks to do:
Mostly mechanical edits I did
.js"
to.ts"
"mini-parse
to"@wesl/mini-parse
ctx.task.name
toctx.name
test.skip
totest.ignore
toMatchSnapshot
. There is an asyncassertSnapshot
function in@std/testing/snapshot
instead. So I pulled out ast-grep to mostly mechanically do the editssg --pattern 'expect($MATCH1).toMatchInlineSnapshot($MATCH2)' --rewrite 'await assertSnapshot(ctx, $MATCH1)' --lang ts --interactive
andsg --pattern 'expect($MATCH1).toMatchSnapshot()' --rewrite 'await assertSnapshot(ctx, $MATCH1)' --lang ts --interactive