From 6c9a0fc52cc6ad99c5370f58748729a838724864 Mon Sep 17 00:00:00 2001 From: Maxim Pismenskiy Date: Wed, 6 Jul 2022 18:03:23 +0300 Subject: [PATCH] fix: remove type "module" --- package.json | 25 ++++++++++++------------- src/test/js/indexes5.js | 2 +- src/test/js/indexes6.js | 2 +- src/test/ts/index.ts | 22 ---------------------- yarn.lock | 5 +++++ 5 files changed, 19 insertions(+), 37 deletions(-) delete mode 100644 src/test/ts/index.ts diff --git a/package.json b/package.json index c4357e8..031caf8 100644 --- a/package.json +++ b/package.json @@ -3,13 +3,12 @@ "version": "1.16.1", "description": "Async adapter to save & deliver reasonable events to some endpoint", "private": false, - "main": "./target/es5/index.cjs", + "main": "./target/es5/index.js", "source": "target/ts/index.ts", - "type": "module", "exports": { - "require": "./target/es5/index.cjs", - "import": "./target/es6/index.mjs", - "module": "./target/es6/index.mjs" + "require": "./target/es5/index.js", + "import": "./target/es6/index.js", + "module": "./target/es6/index.js" }, "types": "typings/index.d.ts", "typescript": { @@ -31,14 +30,13 @@ "test:depcheck": "npx depcheck --ignores tslib,@swissquote/crafty-preset-jest,@types/jest,@types/node,typedoc", "test:depaudit": "yarn audit --groups dependencies --level=moderate; [[ $? -ge 4 ]] && exit 1 || exit 0", "test:depauditfix": "npx yarn-audit-fix --audit-level=moderate", - "test": "yarn test:unit && yarn lint", - "test:unit": "c8 -r html -r text -r lcov loadr -- uvu 'src/test/' -i fixturess", + "test": "yarn test:unit && yarn test:target && yarn lint", + "test:unit": "c8 -r html -r text -r lcov loadr -- uvu 'src/test/ts'", + "test:target": "uvu -r esm 'src/test/js'", "prebuild": "yarn clean && npx buildstamp --git --out.path buildstamp.json", "build": "npm-run-all -p -l build:es5 build:es6 build:ts build:libdef build:bundle docs", - "build:es5": "mkdirp target/es5 && tsc -p tsconfig.es5.json && yarn build:es5:ext", - "build:es5:ext": "tsc-esm-fix --target=target/es5 --ext=.cjs", - "build:es6": "mkdirp target/es6 && tsc -p tsconfig.es6.json && yarn build:es6:ext", - "build:es6:ext": "tsc-esm-fix --target=target/es6 --ext=.mjs", + "build:es5": "mkdirp target/es5 && tsc -p tsconfig.es5.json && yarn", + "build:es6": "mkdirp target/es6 && tsc -p tsconfig.es6.json && yarn", "build:ts": "globby-cp ./src/main/ts/ ./target/ts/", "build:bundle": "microbundle --tsconfig tsconfig.es5.json build src/main/ts/index.ts -o target/bundle", "build:libdef": "libdefkit --tsconfig=tsconfig.es5.json --tsconfig=tsconfig.es6.json", @@ -63,13 +61,13 @@ }, "homepage": "https://github.com/qiwi/event-transmitter#readme", "dependencies": { + "@qiwi/substrate": "^1.20.14", "fast-luhn": "^2.0.0", "lodash.once": "^4.1.1", "lodash.set": "^4.3.2", "nanoid": "3.3.4", "safe-json-stringify": "^1.2.0", - "tslib": "^2.4.0", - "@qiwi/substrate": "^1.20.14" + "tslib": "^2.4.0" }, "devDependencies": { "@qiwi/libdefkit": "^4.0.8", @@ -84,6 +82,7 @@ "eslint": "^8.18.0", "eslint-config-prettier": "^8.5.0", "eslint-config-qiwi": "^1.17.3", + "esm": "^3.2.25", "globby-cp": "^0.0.2", "loadr": "^0.1.1", "microbundle": "^0.15.0", diff --git a/src/test/js/indexes5.js b/src/test/js/indexes5.js index df158b0..b0fbf5a 100644 --- a/src/test/js/indexes5.js +++ b/src/test/js/indexes5.js @@ -1,7 +1,7 @@ import { test } from 'uvu' import * as assert from 'uvu/assert' -import { createHttpPipe,createTransmitter } from '../../../target/es5/index.cjs' +import { createHttpPipe,createTransmitter } from '../../../target/es5/index' test('index es5 (target)', () => { test('has proper export', () => { diff --git a/src/test/js/indexes6.js b/src/test/js/indexes6.js index f07fe4d..5934f38 100644 --- a/src/test/js/indexes6.js +++ b/src/test/js/indexes6.js @@ -1,7 +1,7 @@ import { test } from 'uvu' import * as assert from 'uvu/assert' -import { createFrontLogProxyTransmitter,createHttpPipe,createTransmitter } from '../../../target/es6/index.mjs' +import { createFrontLogProxyTransmitter,createHttpPipe,createTransmitter } from '../../../target/es6/index' test('index es6 (target)', () => { test('has proper export', () => { diff --git a/src/test/ts/index.ts b/src/test/ts/index.ts deleted file mode 100644 index a164b13..0000000 --- a/src/test/ts/index.ts +++ /dev/null @@ -1,22 +0,0 @@ -import { test } from 'uvu' -import * as assert from 'uvu/assert' - -import { - createFlpPipeline, - createFrontLogProxyTransmitter, - createHttpPipe, - createMaskerPipe, - createTransmittable, - createTransmitter, -} from '../../main/ts/index' - -test('index has proper export', () => { - assert.instance(createTransmitter, Function) - assert.instance(createHttpPipe, Function) - assert.instance(createFlpPipeline, Function) - assert.instance(createTransmittable, Function) - assert.instance(createMaskerPipe, Function) - assert.instance(createFrontLogProxyTransmitter, Function) -}) - -test.run() diff --git a/yarn.lock b/yarn.lock index d86551d..bef6287 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2672,6 +2672,11 @@ eslint@^8.18.0: text-table "^0.2.0" v8-compile-cache "^2.0.3" +esm@^3.2.25: + version "3.2.25" + resolved "https://registry.yarnpkg.com/esm/-/esm-3.2.25.tgz#342c18c29d56157688ba5ce31f8431fbb795cc10" + integrity sha512-U1suiZ2oDVWv4zPO56S0NcR5QriEahGtdN2OR6FiOG4WJvcjBVFB0qI4+eKoWFH483PKGuLuu6V8Z4T5g63UVA== + espree@^9.3.2: version "9.3.2" resolved "https://registry.yarnpkg.com/espree/-/espree-9.3.2.tgz#f58f77bd334731182801ced3380a8cc859091596"