From 6e31392d61dd5749e3d8694bc50ee0c2ef959011 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tommy=20Jos=C3=A9povic?= Date: Mon, 29 Jul 2024 13:42:34 -0400 Subject: [PATCH] [IDP-1972] Fix missing bin error --- .changeset/orange-terms-drive.md | 5 +++++ packages/create-schemas/bin/create-schemas.js | 2 ++ packages/create-schemas/package.json | 8 +++++++- packages/create-schemas/src/{bin.ts => cli.ts} | 0 packages/create-schemas/tests/fixtures.ts | 2 +- packages/create-schemas/tsup.build.ts | 2 +- packages/create-schemas/tsup.dev.ts | 2 +- 7 files changed, 17 insertions(+), 4 deletions(-) create mode 100644 .changeset/orange-terms-drive.md create mode 100644 packages/create-schemas/bin/create-schemas.js rename packages/create-schemas/src/{bin.ts => cli.ts} (100%) diff --git a/.changeset/orange-terms-drive.md b/.changeset/orange-terms-drive.md new file mode 100644 index 0000000..a26bb14 --- /dev/null +++ b/.changeset/orange-terms-drive.md @@ -0,0 +1,5 @@ +--- +"@workleap/create-schemas": patch +--- + +Only include build output in package when published diff --git a/packages/create-schemas/bin/create-schemas.js b/packages/create-schemas/bin/create-schemas.js new file mode 100644 index 0000000..fe42435 --- /dev/null +++ b/packages/create-schemas/bin/create-schemas.js @@ -0,0 +1,2 @@ +#!/usr/bin/env node +import("../dist/cli.js"); \ No newline at end of file diff --git a/packages/create-schemas/package.json b/packages/create-schemas/package.json index 3cddd2a..dabdd28 100644 --- a/packages/create-schemas/package.json +++ b/packages/create-schemas/package.json @@ -14,7 +14,9 @@ "provenance": true }, "type": "module", - "bin": "./dist/bin.js", + "bin": { + "create-schemas": "./bin/create-schemas.js" + }, "exports": { ".": { "import": "./dist/index.js", @@ -25,6 +27,10 @@ "types": "./dist/plugins/index.d.ts" } }, + "files": [ + "bin", + "dist" + ], "scripts": { "dev": "tsup --config tsup.dev.ts", "test": "vitest", diff --git a/packages/create-schemas/src/bin.ts b/packages/create-schemas/src/cli.ts similarity index 100% rename from packages/create-schemas/src/bin.ts rename to packages/create-schemas/src/cli.ts diff --git a/packages/create-schemas/tests/fixtures.ts b/packages/create-schemas/tests/fixtures.ts index ca1b379..c75b0d9 100644 --- a/packages/create-schemas/tests/fixtures.ts +++ b/packages/create-schemas/tests/fixtures.ts @@ -34,7 +34,7 @@ interface BinOptions { } export async function runCompiledBin(options: BinOptions): Promise { - const binUrl = new URL("../dist/bin.js", import.meta.url); + const binUrl = new URL("../bin/create-schemas.js", import.meta.url); const cwdArgs = options.cwd ? ["--cwd", options.cwd] : []; diff --git a/packages/create-schemas/tsup.build.ts b/packages/create-schemas/tsup.build.ts index 3016886..f515068 100644 --- a/packages/create-schemas/tsup.build.ts +++ b/packages/create-schemas/tsup.build.ts @@ -1,6 +1,6 @@ import { defineBuildConfig } from "@workleap/tsup-configs"; export default defineBuildConfig({ - entry: ["src/bin.ts", "src/index.ts", "src/plugins/index.ts"], + entry: ["src/cli.ts", "src/index.ts", "src/plugins/index.ts"], platform: "node" }); diff --git a/packages/create-schemas/tsup.dev.ts b/packages/create-schemas/tsup.dev.ts index 223ee3a..316525a 100644 --- a/packages/create-schemas/tsup.dev.ts +++ b/packages/create-schemas/tsup.dev.ts @@ -1,6 +1,6 @@ import { defineDevConfig } from "@workleap/tsup-configs"; export default defineDevConfig({ - entry: ["src/bin.ts", "src/index.ts", "src/plugins/index.ts"], + entry: ["src/cli.ts", "src/index.ts", "src/plugins/index.ts"], platform: "node" });