From 91605aa43445fca40b210ebc8ed82eb41ea75f46 Mon Sep 17 00:00:00 2001 From: cupcakearmy Date: Tue, 18 Oct 2022 15:48:27 +0200 Subject: [PATCH] drop support for commonjs --- .karma.cjs | 2 +- package.json | 13 +++++-------- rename.sh | 5 ----- test/aes.spec.js | 2 +- test/encoding.spec.js | 2 +- test/hash.spec.js | 2 +- test/random.spec.js | 2 +- test/rsa.spec.js | 2 +- tsconfig.cjs.json | 8 -------- tsconfig.esm.json | 8 -------- 10 files changed, 11 insertions(+), 35 deletions(-) delete mode 100755 rename.sh delete mode 100644 tsconfig.cjs.json delete mode 100644 tsconfig.esm.json diff --git a/.karma.cjs b/.karma.cjs index 6aaca30..be09b7e 100644 --- a/.karma.cjs +++ b/.karma.cjs @@ -7,7 +7,7 @@ module.exports = function (config) { basePath: '', files: [ { pattern: 'node_modules/chai/chai.js', type: 'module' }, - { pattern: 'dist/esm/**/*.js', type: 'module' }, + { pattern: 'dist/**/*.js', type: 'module' }, { pattern: 'test/**/*.js', type: 'module' }, ], diff --git a/package.json b/package.json index 8362d14..5ddd848 100644 --- a/package.json +++ b/package.json @@ -21,12 +21,11 @@ "pnpm": "7" }, "type": "module", - "types": "./dist/esm/index.d.ts", + "types": "./dist/index.d.ts", "exports": { ".": { - "types": "./dist/esm/index.d.ts", - "import": "./dist/esm/index.js", - "require": "./dist/cjs/index.cjs" + "types": "./dist/index.d.ts", + "import": "./dist/index.js" } }, "files": [ @@ -37,12 +36,10 @@ "test:node": "mocha", "test:browser": "karma start .karma.cjs --single-run", "test": "run-s build test:*", - "build:esm": "tsc -p tsconfig.esm.json", - "build:cjs": "tsc -p tsconfig.cjs.json && ./rename.sh", - "build": "run-s clean build:*", + "build": "tsc", "clean": "rm -rf ./dist", "dev": "run-p -ln dev:*", - "dev:build": "tsc -w -p tsconfig.esm.json", + "dev:build": "tsc -w", "dev:test:node": "mocha --parallel --watch", "dev:test:browser": "karma start .karma.cjs", "prepublishOnly": "run-s clean build" diff --git a/rename.sh b/rename.sh deleted file mode 100755 index 101311f..0000000 --- a/rename.sh +++ /dev/null @@ -1,5 +0,0 @@ -#!/bin/sh - -# Rename .js files to .cjs -rename -S .js .cjs dist/cjs/**/* -sed -i '' 's/\.js"/\.cjs"/g' dist/cjs/**/*.cjs diff --git a/test/aes.spec.js b/test/aes.spec.js index f3e47f7..5aea60d 100644 --- a/test/aes.spec.js +++ b/test/aes.spec.js @@ -1,4 +1,4 @@ -import { AES, Bytes, Hashes, Hex } from '../dist/esm/index.js' +import { AES, Bytes, Hashes, Hex } from '../dist/index.js' import { Precomputed } from './values.js' describe('AES', () => { diff --git a/test/encoding.spec.js b/test/encoding.spec.js index 2c43d75..abf8ee3 100644 --- a/test/encoding.spec.js +++ b/test/encoding.spec.js @@ -1,4 +1,4 @@ -import { Base64, Bytes } from '../dist/esm/index.js' +import { Base64, Bytes } from '../dist/index.js' import { Precomputed } from './values.js' describe('Encoding', () => { diff --git a/test/hash.spec.js b/test/hash.spec.js index cefa80c..3b677ed 100644 --- a/test/hash.spec.js +++ b/test/hash.spec.js @@ -1,4 +1,4 @@ -import { Bytes, Hash, Hashes, Hex } from '../dist/esm/index.js' +import { Bytes, Hash, Hashes, Hex } from '../dist/index.js' import { Precomputed } from './values.js' describe('Hash', () => { diff --git a/test/random.spec.js b/test/random.spec.js index 3d6251a..f854937 100644 --- a/test/random.spec.js +++ b/test/random.spec.js @@ -1,4 +1,4 @@ -import { getRandomBytes } from '../dist/esm/index.js' +import { getRandomBytes } from '../dist/index.js' import { Promises } from './utils.js' describe('Random', () => { diff --git a/test/rsa.spec.js b/test/rsa.spec.js index a0f6cde..9b0a9ed 100644 --- a/test/rsa.spec.js +++ b/test/rsa.spec.js @@ -1,4 +1,4 @@ -import { Bytes, RSA } from '../dist/esm/index.js' +import { Bytes, RSA } from '../dist/index.js' import { Promises } from './utils.js' import { Precomputed } from './values.js' diff --git a/tsconfig.cjs.json b/tsconfig.cjs.json deleted file mode 100644 index d67e216..0000000 --- a/tsconfig.cjs.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "extends": "./tsconfig.json", - "compilerOptions": { - "module": "CommonJS", - "target": "ES2015", - "outDir": "dist/cjs" - } -} diff --git a/tsconfig.esm.json b/tsconfig.esm.json deleted file mode 100644 index e913ee7..0000000 --- a/tsconfig.esm.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "extends": "./tsconfig.json", - "compilerOptions": { - "module": "ES2015", - "target": "ES2015", - "outDir": "dist/esm" - } -}