Skip to content

Commit

Permalink
Fix cjs types
Browse files Browse the repository at this point in the history
  • Loading branch information
Hexagon committed Sep 29, 2024
1 parent 878b2cb commit fe8d369
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 5 deletions.
10 changes: 8 additions & 2 deletions build/esbuild.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import esbuild from "esbuild";
import { dtsPlugin } from "esbuild-plugin-d.ts";
import { exit } from "@cross/utils";
import { dirname, fromFileUrl, resolve } from "@std/path";
import { cp } from "@cross/fs";

let relativeProjectRoot = "../";
const outputFolder = "dist";
Expand Down Expand Up @@ -60,7 +61,12 @@ async function build() {
}

// Run the build function
build().catch((error) => {
try {
await build();
} catch(error) {
console.error(error);
exit(1);
});
};

// Copy .d.ts to .d.cts
await cp(resolve(relativeProjectRoot, outputFolder, 'base64.d.ts'),resolve(relativeProjectRoot, outputFolder, 'base64.d.cts'));
4 changes: 2 additions & 2 deletions build/npm.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,8 @@ async function generatePackageJson() {
types: "./dist/base64.d.ts",
exports: {
".": {
import: "./dist/base64.js",
require: "./dist/base64.cjs.js",
import: { "default": "./dist/base64.js", "types": "./dist/base64.d.ts" },
require: { "default": "./dist/base64.cjs", "types": "./dist/base64.d.cts" },
browser: "./dist/base64.umd.js"
}
},
Expand Down
2 changes: 1 addition & 1 deletion deno.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@hexagon/base64",
"version": "2.0.0-dev.2",
"version": "2.0.0-dev.3",
"exports": "./src/base64.ts",
"lint": {
"include": ["src", "test"],
Expand Down

0 comments on commit fe8d369

Please sign in to comment.