Creating an NPM Package in 2024 (Deno, dnt)

This page summarizes the projects mentioned and recommended in the original post on dev.to

Our great sponsors
  • SurveyJS - Open-Source JSON Form Builder to Create Dynamic Forms Right in Your App
  • InfluxDB - Power Real-Time Data Analytics at Scale
  • WorkOS - The modern identity platform for B2B SaaS
  • is-not-bun

    Return true if you are running not in Bun.

  • #!/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();

  • dnt

    Deno to npm package build tool.

  • We are going to use dnt - Deno to Node Transform tool to build the npm package.

  • 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.

    SurveyJS logo
  • oak

    A middleware framework for handling HTTP with Deno, Node, Bun and Cloudflare Workers 🐿️ 🦕

  • oak

  • publint

    Lint packaging errors

  • 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-redis

    HTTP based Redis Client for Serverless and Edge Functions

  • upstash

  • bun

    Incredibly fast JavaScript runtime, bundler, test runner, and package manager – all in one

  • 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

    WebAuthn, Simplified. A collection of TypeScript-first libraries for simpler WebAuthn integration. Supports modern browsers, Node, Deno, and more.

  • SimpleWebAuthn

  • 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.

    InfluxDB logo
  • is-bun

    Return true if you are running in Bun.

  • So in the GH repo here's the content of main.ts:

NOTE: The number of mentions on this list indicates mentions on common posts plus user suggested alternatives. Hence, a higher number means a more popular project.

Suggest a related project

Related posts