From f1b0de505dcd3c9c7c5ed8c46f5d196e40f4d4f4 Mon Sep 17 00:00:00 2001 From: Igor Savin Date: Sun, 21 Jan 2024 23:06:37 +0200 Subject: [PATCH] Add ESM/CJS double-publishing --- package.json | 19 ++++++++++++++----- index.js => src/index.js | 0 2 files changed, 14 insertions(+), 5 deletions(-) rename index.js => src/index.js (100%) diff --git a/package.json b/package.json index f1e7847..e361f99 100644 --- a/package.json +++ b/package.json @@ -20,21 +20,30 @@ "type": "git", "url": "git://github.com/brianloveswords/buffer-crc32.git" }, - "main": "index.js", "scripts": { - "test": "tap tests/*.test.js --reporter classic" + "test": "tap tests/*.test.js --reporter classic", + "build": "unbuild", + "prepublishOnly": "npm run build" }, - "type": "commonjs", "dependencies": {}, "devDependencies": { - "tap": "~11.1.5" + "tap": "~11.1.5", + "unbuild": "^2.0.0" }, "optionalDependencies": {}, "engines": { "node": ">=8.0.0" }, "license": "MIT", + "type": "module", + "exports": { + ".": { + "import": "./dist/index.mjs", + "require": "./dist/index.cjs" + } + }, + "main": "./dist/index.cjs", "files": [ - "index.js" + "dist" ] } diff --git a/index.js b/src/index.js similarity index 100% rename from index.js rename to src/index.js