Skip to content
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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: upgrade dnt to fix npm package #22

Merged
merged 2 commits into from Nov 5, 2021
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
17 changes: 12 additions & 5 deletions build_npm.ts
@@ -1,4 +1,4 @@
import { build } from "https://deno.land/x/dnt@0.3.1/mod.ts";
import { build } from "https://deno.land/x/dnt@0.4.0/mod.ts";
import { copy } from "https://deno.land/std@0.113.0/fs/mod.ts";

await Deno.remove("npm", { recursive: true }).catch((_) => {});
Expand All @@ -7,7 +7,11 @@ await copy("testdata", "npm/umd/testdata", { overwrite: true });
await copy("README.md", "npm/README.md", { overwrite: true });

await build({
entryPoints: ["./main.ts"],
entryPoints: ["./lib.ts", {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it correct to have "./lib.ts" as an entrypoint for someone who wants to use the API?

The package.json looks like this now:

{
  "module": "./esm/lib.js",
  "main": "./umd/lib.js",
  "types": "./types/lib.d.ts",
  "bin": {
    "license_checker": "./umd/main.js"
  },
  "name": "@kt3k/license-checker",
  "version": "3.1.4",
  "description": "馃搫 CLI tool for checking license headers in files",
  "license": "MIT",
  "repository": {
    "type": "git",
    "url": "git+https://github.com/kt3k/deno_license_checker.git"
  },
  "bugs": {
    "url": "https://github.com/kt3k/deno_license_checker/issues"
  },
  "exports": {
    ".": {
      "import": "./esm/lib.js",
      "require": "./umd/lib.js",
      "types": "./types/lib.d.ts"
    }
  },
  "scripts": {
    "test": "node test_runner.js"
  },
  "dependencies": {
    "tslib": "2.3.1",
    "deno.ns": "0.6.4"
  },
  "devDependencies": {
    "@types/node": "16.11.1",
    "chalk": "4.1.2"
  }
}

kind: "bin",
name: "license_checker",
path: "./main.ts",
}],
Copy link
Contributor Author

@dsherret dsherret Nov 4, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added this new kind: "bin" entrypoint. It creates a "bin" entry in package.json and adds #!/usr/bin/env node\n to the top of the referenced path as mentioned in https://docs.npmjs.com/cli/v7/configuring-npm/package-json#bin

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice! Great!

outDir: "./npm",
typeCheck: false,
declaration: true,
Expand All @@ -18,9 +22,6 @@ await build({
version: "3.1.4",
description: "馃搫 CLI tool for checking license headers in files",
license: "MIT",
bin: {
license_checker: "./umd/main.js",
},
repository: {
type: "git",
url: "git+https://github.com/kt3k/deno_license_checker.git",
Expand All @@ -30,3 +31,9 @@ await build({
},
},
});

await Deno.writeTextFile(
"npm/.npmignore",
"esm/testdata/\numd/testdata/\n",
{ append: true }
);