Our great sponsors
-
SurveyJS
Open-Source JSON Form Builder to Create Dynamic Forms Right in Your App. With SurveyJS form UI libraries, you can build and style forms in a fully-integrated drag & drop form builder, render them in your JS app, and store form submission data in any backend, inc. PHP, ASP.NET Core, and Node.js.
-
SimpleWebAuthn
WebAuthn, Simplified. A collection of TypeScript-first libraries for simpler WebAuthn integration. Supports modern browsers, Node, Deno, and more.
-
InfluxDB
Power Real-Time Data Analytics at Scale. Get real-time insights from all types of time series data with InfluxDB. Ingest, query, and analyze billions of data points in real-time with unbounded cardinality.
#!/usr/bin/env -S deno run --allow-read --allow-write --allow-net --allow-env --allow-run // Copyright 2018-2022 the oak authors. All rights reserved. MIT license. /** * This is the build script for building npm package. * * @module */ import { build, emptyDir } from "https://deno.land/x/[email protected]/mod.ts"; async function start() { await emptyDir("./npm"); await build({ entryPoints: [ // change me "./mod.ts", { kind: "bin", name: "is-not-bun", path: "./cli.ts", }, ], outDir: "./npm", shims: {}, test: false, typeCheck: "both", compilerOptions: { importHelpers: false, sourceMap: true, target: "ES2021", lib: ["esnext", "dom", "dom.iterable"], }, package: { name: "is-not-bun", // change me version: Deno.args[0], description: "Return true if you are running not in Bun.", // change me license: "MIT", keywords: ["bun"], // change me engines: { node: ">=8.0.0", }, repository: { type: "git", url: "git+https://github.com/JLarky/is-not-bun.git", // change me }, bugs: { url: "https://github.com/JLarky/is-not-bun/issues", // change me }, dependencies: { "is-bun": "*", // change me }, devDependencies: {}, }, }); await Deno.copyFile("LICENSE", "npm/LICENSE"); await Deno.copyFile("README.md", "npm/README.md"); } start();
We are going to use dnt - Deno to Node Transform tool to build the npm package.
oak
Creating npm packages can be challenging. We've seen many tools in this domain, and I encourage you to try dnt. With dnt, I was finally able to pass the package.json linter, which is no small achievement (try jotai, redux, vite).
upstash
Replace is-not-bun with the name of your package. This tutorial is the text version of this Youtube tutorial and will address the same problem space of determining if a user is running an npm package using Bun (you don't need to know about Bun either).
SimpleWebAuthn
So in the GH repo here's the content of main.ts: