Should you write: { "dependencies" : { "better-auth" : "^1.4.20" } } or { "dependencies" : { "better-auth" : "1.4.20" } } in your package.json? The specific version is pinned in package-lock.json, so it seems both ways achieve the same result: npm ci always installs the same version. However, with the caret version range, the version in package-lock.json doesn’t need to match the version in…
A deployment action typically looks like this, with a stored GitHub secret: jobs : deploy : steps : - run : | curl -XPOST "https://yourserver/deploy" -H "Authorization: Bearer ${{ secrets.DEPLOY_API_TOKEN }}" --data-urlencode service=abcd --data-urlencode commit=${{ github.sha }} A better way is to use OIDC, which is supported by GitHub Actions and is surprisingly easy to use. It works in 4 steps:…
What we want to do Run TypeScript files directly: node index.ts Use ES Modules and Top Level awaits: import { transform } from "./transform.ts" ; import { readFile } from "fs/promises" ; const f = await readFile ( "./file" ); await transform (f); Run tests: node --test Restart the process when the source files change: node --watch index.ts Read .env files without dotenv. Read command-line…
PostgreSQL is a great database, but the options for loading data files are so few and poor that finding a good way to do that is often a headache. It is all the more frustrating that other databases support dozens of input formats natively. I’ve come up with a solution that’s easy, reliable, and requires no extra tools. PostgreSQL supports three input formats: CSV, TEXT (a tsv-like format), and…
The React team has published several in-depth posts about React Suspense such as this one . It took me a lot of effort to grok from them what are Suspense’s benefits and how to use it. Now that I understand Suspense, here’s the image I wished I had seen when learning about it. I hope it’ll be useful to you: So: a lot less boilerplate and the loading indicator clearly separated from the component.…
Skeptics often describe GraphQL as something only facebook-sized companies need , something complicated, or feel that its most talked-about features, such as asking exactly for the fields you need or unversioned APIs are not that useful or can already be done with REST. I do not agree with this. In my experience, the main strength of GraphQL is that it allows developers to do the same things as…
Since version 12, Node.js is supposed to print all of the callers in a stack trace, even if some calls are made asynchronously with the await keyword. Such a stack trace should make debugging a breeze, but, unfortunately, I have found this to work very poorly. Consider the following program: const throwSomething = async () => { await wait (); throw new Error (); }; const fn1 = async () => { return…