diff --git a/.eslintrc.json b/.eslintrc.json index d324999ce..6153f20bc 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -13,19 +13,23 @@ ], "globals": { "BigInt": true, "console": true, "WebAssembly": true }, "rules": { - "@typescript-eslint/explicit-function-return-type": [ - "error", - { "allowExpressions": true } - ], + "@typescript-eslint/explicit-function-return-type": "off", "@typescript-eslint/explicit-module-boundary-types": "off", "eslint-comments/disable-enable-pair": [ "error", - { "allowWholeFile": true } + { + "allowWholeFile": true + } ], "eslint-comments/no-unused-disable": "error", "import/order": [ "error", - { "newlines-between": "always", "alphabetize": { "order": "asc" } } + { + "newlines-between": "always", + "alphabetize": { + "order": "asc" + } + } ], "no-constant-condition": ["error", { "checkLoops": false }], "import/no-extraneous-dependencies": [ @@ -54,6 +58,17 @@ "@typescript-eslint/no-non-null-assertion": "off", "no-console": "off" } + }, + { + "files": ["*.ts", "*.mts", "*.cts", "*.tsx"], + "rules": { + "@typescript-eslint/explicit-function-return-type": [ + "error", + { + "allowExpressions": true + } + ] + } } ] } diff --git a/package-lock.json b/package-lock.json index f1a99c0fd..5b0b243da 100644 --- a/package-lock.json +++ b/package-lock.json @@ -15,7 +15,8 @@ "packages/dns-discovery", "packages/message-encryption", "packages/create", - "packages/tests" + "packages/tests", + "packages/build-utils" ], "devDependencies": { "@size-limit/preset-big-lib": "^8.2.4", @@ -7118,6 +7119,10 @@ "integrity": "sha512-E+XQCRwSbaaiChtv6k6Dwgc+bx+Bs6vuKJHHl5kox/BaKbhiXzqQOwK4cO22yElGp2OCmjwVhT3HmxgyPGnJfQ==", "dev": true }, + "node_modules/build-utils": { + "resolved": "packages/build-utils", + "link": true + }, "node_modules/builtin-modules": { "version": "3.3.0", "resolved": "https://registry.npmjs.org/builtin-modules/-/builtin-modules-3.3.0.tgz", @@ -27970,6 +27975,13 @@ "url": "https://github.com/sponsors/wooorm" } }, + "packages/build-utils": { + "version": "1.0.0", + "license": "MIT OR Apache-2.0", + "devDependencies": { + "prettier": "^2.8.4" + } + }, "packages/core": { "name": "@waku/core", "version": "0.0.10", @@ -28005,6 +28017,7 @@ "@types/uuid": "^9.0.0", "@typescript-eslint/eslint-plugin": "^5.53.0", "@typescript-eslint/parser": "^5.51.0", + "build-utils": "*", "chai": "^4.3.7", "cspell": "^6.26.3", "eslint": "^8.35.0", @@ -28084,6 +28097,7 @@ "@typescript-eslint/eslint-plugin": "^5.53.0", "@typescript-eslint/parser": "^5.51.0", "@waku/interfaces": "*", + "build-utils": "*", "cspell": "^6.26.3", "eslint": "^8.35.0", "eslint-config-prettier": "^8.6.0", @@ -28158,6 +28172,7 @@ "@typescript-eslint/eslint-plugin": "^5.53.0", "@typescript-eslint/parser": "^5.51.0", "@waku/interfaces": "*", + "build-utils": "*", "chai": "^4.3.7", "cspell": "^6.26.3", "eslint": "^8.35.0", @@ -28202,6 +28217,7 @@ "@typescript-eslint/eslint-plugin": "^5.53.0", "@typescript-eslint/parser": "^5.51.0", "@waku/interfaces": "*", + "build-utils": "*", "chai": "^4.3.7", "cspell": "^6.26.3", "eslint": "^8.35.0", @@ -28285,6 +28301,7 @@ "@types/mocha": "^10.0.1", "@typescript-eslint/eslint-plugin": "^5.53.0", "@typescript-eslint/parser": "^5.51.0", + "build-utils": "*", "chai": "^4.3.7", "cspell": "^6.26.3", "eslint": "^8.35.0", @@ -28337,6 +28354,7 @@ "@typescript-eslint/eslint-plugin": "^5.53.0", "@typescript-eslint/parser": "^5.51.0", "@waku/interfaces": "*", + "build-utils": "*", "chai": "^4.3.7", "cspell": "^6.26.3", "eslint": "^8.35.0", @@ -28369,6 +28387,7 @@ "@rollup/plugin-node-resolve": "^15.0.1", "@typescript-eslint/eslint-plugin": "^5.53.0", "@typescript-eslint/parser": "^5.51.0", + "build-utils": "*", "cspell": "^6.26.3", "eslint": "^8.35.0", "eslint-config-prettier": "^8.6.0", @@ -28496,6 +28515,7 @@ "@rollup/plugin-node-resolve": "^15.0.1", "@typescript-eslint/eslint-plugin": "^5.53.0", "@typescript-eslint/parser": "^5.51.0", + "build-utils": "*", "cspell": "^6.26.3", "eslint": "^8.35.0", "eslint-config-prettier": "^8.6.0", @@ -32704,6 +32724,7 @@ "@waku/interfaces": "*", "@waku/proto": "*", "@waku/utils": "*", + "build-utils": "*", "chai": "^4.3.7", "cspell": "^6.26.3", "debug": "^4.3.4", @@ -32771,6 +32792,7 @@ "@waku/dns-discovery": "*", "@waku/interfaces": "*", "@waku/peer-exchange": "*", + "build-utils": "*", "cspell": "^6.26.3", "eslint": "^8.35.0", "eslint-config-prettier": "^8.6.0", @@ -32827,6 +32849,7 @@ "@waku/enr": "*", "@waku/interfaces": "*", "@waku/utils": "*", + "build-utils": "*", "chai": "^4.3.7", "cspell": "^6.26.3", "debug": "^4.3.4", @@ -32866,6 +32889,7 @@ "@typescript-eslint/parser": "^5.51.0", "@waku/interfaces": "*", "@waku/utils": "*", + "build-utils": "*", "chai": "^4.3.7", "cspell": "^6.26.3", "debug": "^4.3.4", @@ -32937,6 +32961,7 @@ "@waku/interfaces": "*", "@waku/proto": "*", "@waku/utils": "*", + "build-utils": "*", "chai": "^4.3.7", "cspell": "^6.26.3", "debug": "^4.3.4", @@ -32980,6 +33005,7 @@ "@waku/enr": "*", "@waku/interfaces": "*", "@waku/proto": "*", + "build-utils": "*", "chai": "^4.3.7", "cspell": "^6.26.3", "debug": "^4.3.4", @@ -33008,6 +33034,7 @@ "@rollup/plugin-node-resolve": "^15.0.1", "@typescript-eslint/eslint-plugin": "^5.53.0", "@typescript-eslint/parser": "^5.51.0", + "build-utils": "*", "cspell": "^6.26.3", "eslint": "^8.35.0", "eslint-config-prettier": "^8.6.0", @@ -33107,6 +33134,7 @@ "@rollup/plugin-node-resolve": "^15.0.1", "@typescript-eslint/eslint-plugin": "^5.53.0", "@typescript-eslint/parser": "^5.51.0", + "build-utils": "*", "cspell": "^6.26.3", "debug": "^4.3.4", "eslint": "^8.35.0", @@ -34257,6 +34285,12 @@ "integrity": "sha512-E+XQCRwSbaaiChtv6k6Dwgc+bx+Bs6vuKJHHl5kox/BaKbhiXzqQOwK4cO22yElGp2OCmjwVhT3HmxgyPGnJfQ==", "dev": true }, + "build-utils": { + "version": "file:packages/build-utils", + "requires": { + "prettier": "^2.8.4" + } + }, "builtin-modules": { "version": "3.3.0", "resolved": "https://registry.npmjs.org/builtin-modules/-/builtin-modules-3.3.0.tgz", diff --git a/package.json b/package.json index 96950d9be..c896b9c5f 100644 --- a/package.json +++ b/package.json @@ -12,7 +12,8 @@ "packages/dns-discovery", "packages/message-encryption", "packages/create", - "packages/tests" + "packages/tests", + "packages/build-utils" ], "scripts": { "prepare": "husky install", @@ -20,6 +21,7 @@ "build:esm": "npm run build:esm --workspaces --if-present", "size": "npm run build && size-limit", "fix": "npm run fix --workspaces --if-present", + "fix:lint": "npm run fix:lint --workspaces --if-present", "check": "npm run check --workspaces --if-present", "check:ws": "[ $(ls -1 ./packages|wc -l) -eq $(cat package.json | jq '.workspaces | length') ] || exit 1 # check no packages left behind", "test": "npm run test --workspaces --if-present", @@ -41,7 +43,7 @@ "typedoc-plugin-resolve-crossmodule-references": "^0.3.3" }, "lint-staged": { - "*.ts": [ + "*.{ts,js}": [ "eslint --fix" ], "*.{ts,json,js,md,cjs}": [ diff --git a/packages/build-utils/index.js b/packages/build-utils/index.js new file mode 100644 index 000000000..5ee75e1ab --- /dev/null +++ b/packages/build-utils/index.js @@ -0,0 +1,21 @@ +export function extractExports(packageJson) { + const exportsMap = packageJson.default.exports; + + let input = {}; + for (const exportPath in exportsMap) { + const filePath = exportsMap[exportPath].import; + + let entry; + if (exportPath === ".") { + entry = "index"; + } else { + if (!exportPath.startsWith("./")) { + throw `export path should start with \`./\` but starts with ${exportPath}`; + } + entry = exportPath.substring(2); + } + input[entry] = filePath; + } + + return input; +} diff --git a/packages/build-utils/package.json b/packages/build-utils/package.json new file mode 100644 index 000000000..304f111c7 --- /dev/null +++ b/packages/build-utils/package.json @@ -0,0 +1,30 @@ +{ + "name": "build-utils", + "version": "1.0.0", + "description": "Build utilities for js-waku", + "main": "index.js", + "module": "index.js", + "type": "module", + "private": true, + "scripts": { + "fix": "run-s fix:*", + "fix:lint": "eslint . --fix", + "fix:prettier": "prettier . --write", + "check": "run-s check:*", + "check:lint": "eslint .", + "check:prettier": "prettier . --list-different" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/waku-org/js-waku.git" + }, + "author": "Waku Team", + "license": "MIT OR Apache-2.0", + "bugs": { + "url": "https://github.com/waku-org/js-waku/issues" + }, + "homepage": "https://github.com/waku-org/js-waku#readme", + "devDependencies": { + "prettier": "^2.8.4" + } +} diff --git a/packages/core/package.json b/packages/core/package.json index f4c3b332e..97bb0583d 100644 --- a/packages/core/package.json +++ b/packages/core/package.json @@ -57,7 +57,7 @@ "build:bundle": "rollup --config rollup.config.js", "fix": "run-s fix:*", "fix:prettier": "prettier . --write", - "fix:lint": "eslint src --ext .ts --ext .cjs --fix", + "fix:lint": "eslint src *.js --fix", "pretest": "run-s pretest:*", "pretest:1-init-git-submodules": "[ -f '../../nwaku/build/wakunode2' ] || git submodule update --init --recursive", "pretest:2-build-nwaku": "[ -f '../../nwaku/build/wakunode2' ] || run-s nwaku:build", @@ -65,7 +65,7 @@ "nwaku:force-build": "(cd ../../nwaku && rm -rf ./build/ ./vendor) && run-s nwaku:build", "check": "run-s check:*", "check:tsc": "tsc -p tsconfig.dev.json", - "check:lint": "eslint src --ext .ts", + "check:lint": "eslint src *.js", "check:prettier": "prettier . --list-different", "check:spelling": "cspell \"{README.md,src/**/*.ts}\"", "test": "run-s test:*", @@ -110,6 +110,7 @@ "@types/uuid": "^9.0.0", "@typescript-eslint/eslint-plugin": "^5.53.0", "@typescript-eslint/parser": "^5.51.0", + "build-utils": "*", "chai": "^4.3.7", "cspell": "^6.26.3", "eslint": "^8.35.0", diff --git a/packages/core/rollup.config.js b/packages/core/rollup.config.js index c1f979319..22e75b907 100644 --- a/packages/core/rollup.config.js +++ b/packages/core/rollup.config.js @@ -1,15 +1,14 @@ import commonjs from "@rollup/plugin-commonjs"; import json from "@rollup/plugin-json"; import { nodeResolve } from "@rollup/plugin-node-resolve"; +import { extractExports } from "build-utils"; + +import * as packageJson from "./package.json" assert { type: "json" }; + +const input = extractExports(packageJson); export default { - input: { - index: "dist/index.js", - "lib/predefined_bootstrap_nodes": "dist/lib/predefined_bootstrap_nodes.js", - "lib/message/version_0": "dist/lib/message/version_0.js", - "lib/message/topic_only_message": "dist/lib/message/topic_only_message.js", - "lib/base_protocol": "dist/lib/base_protocol.js", - }, + input, output: { dir: "bundle", format: "esm", diff --git a/packages/create/package.json b/packages/create/package.json index 39392d034..17d8f7e27 100644 --- a/packages/create/package.json +++ b/packages/create/package.json @@ -37,9 +37,9 @@ "build:bundle": "rollup --config rollup.config.js", "fix": "run-s fix:*", "fix:prettier": "prettier . --write", - "fix:lint": "eslint src --ext .ts --ext .cjs --fix", + "fix:lint": "eslint src *.js --fix", "check": "run-s check:*", - "check:lint": "eslint src --ext .ts", + "check:lint": "eslint src *.js", "check:prettier": "prettier . --list-different", "check:spelling": "cspell \"{README.md,src/**/*.ts}\"", "check:tsc": "tsc -p tsconfig.dev.json", @@ -79,6 +79,7 @@ "@typescript-eslint/eslint-plugin": "^5.53.0", "@typescript-eslint/parser": "^5.51.0", "@waku/interfaces": "*", + "build-utils": "*", "cspell": "^6.26.3", "eslint": "^8.35.0", "eslint-config-prettier": "^8.6.0", diff --git a/packages/create/rollup.config.js b/packages/create/rollup.config.js index a03dc334f..22e75b907 100644 --- a/packages/create/rollup.config.js +++ b/packages/create/rollup.config.js @@ -1,11 +1,14 @@ -import { nodeResolve } from "@rollup/plugin-node-resolve"; import commonjs from "@rollup/plugin-commonjs"; import json from "@rollup/plugin-json"; +import { nodeResolve } from "@rollup/plugin-node-resolve"; +import { extractExports } from "build-utils"; + +import * as packageJson from "./package.json" assert { type: "json" }; + +const input = extractExports(packageJson); export default { - input: { - index: "dist/index.js", - }, + input, output: { dir: "bundle", format: "esm", diff --git a/packages/dns-discovery/package.json b/packages/dns-discovery/package.json index c31960221..2f8e33f0d 100644 --- a/packages/dns-discovery/package.json +++ b/packages/dns-discovery/package.json @@ -44,7 +44,7 @@ "build:bundle": "rollup --config rollup.config.js", "fix": "run-s fix:*", "fix:prettier": "prettier . --write", - "fix:lint": "eslint src --ext .ts --ext .cjs --fix", + "fix:lint": "eslint src *.js --fix", "check": "run-s check:*", "check:lint": "eslint src --ext .ts", "check:prettier": "prettier . --list-different", @@ -81,6 +81,7 @@ "@typescript-eslint/eslint-plugin": "^5.53.0", "@typescript-eslint/parser": "^5.51.0", "@waku/interfaces": "*", + "build-utils": "*", "chai": "^4.3.7", "cspell": "^6.26.3", "eslint": "^8.35.0", diff --git a/packages/dns-discovery/rollup.config.js b/packages/dns-discovery/rollup.config.js index d22d3d231..22e75b907 100644 --- a/packages/dns-discovery/rollup.config.js +++ b/packages/dns-discovery/rollup.config.js @@ -1,11 +1,14 @@ import commonjs from "@rollup/plugin-commonjs"; import json from "@rollup/plugin-json"; import { nodeResolve } from "@rollup/plugin-node-resolve"; +import { extractExports } from "build-utils"; + +import * as packageJson from "./package.json" assert { type: "json" }; + +const input = extractExports(packageJson); export default { - input: { - index: "dist/index.js", - }, + input, output: { dir: "bundle", format: "esm", diff --git a/packages/enr/package.json b/packages/enr/package.json index 3bed9feb0..80aedb2cd 100644 --- a/packages/enr/package.json +++ b/packages/enr/package.json @@ -37,7 +37,7 @@ "build:bundle": "rollup --config rollup.config.js", "fix": "run-s fix:*", "fix:prettier": "prettier . --write", - "fix:lint": "eslint src --ext .ts --ext .cjs --fix", + "fix:lint": "eslint src *.js --fix", "check": "run-s check:*", "check:lint": "eslint src --ext .ts", "check:prettier": "prettier . --list-different", @@ -73,6 +73,7 @@ "@typescript-eslint/eslint-plugin": "^5.53.0", "@typescript-eslint/parser": "^5.51.0", "@waku/interfaces": "*", + "build-utils": "*", "chai": "^4.3.7", "cspell": "^6.26.3", "eslint": "^8.35.0", diff --git a/packages/enr/rollup.config.js b/packages/enr/rollup.config.js index d22d3d231..22e75b907 100644 --- a/packages/enr/rollup.config.js +++ b/packages/enr/rollup.config.js @@ -1,11 +1,14 @@ import commonjs from "@rollup/plugin-commonjs"; import json from "@rollup/plugin-json"; import { nodeResolve } from "@rollup/plugin-node-resolve"; +import { extractExports } from "build-utils"; + +import * as packageJson from "./package.json" assert { type: "json" }; + +const input = extractExports(packageJson); export default { - input: { - index: "dist/index.js", - }, + input, output: { dir: "bundle", format: "esm", diff --git a/packages/interfaces/package.json b/packages/interfaces/package.json index e7871b3b4..813f47d60 100644 --- a/packages/interfaces/package.json +++ b/packages/interfaces/package.json @@ -36,9 +36,9 @@ "build:esm": "tsc", "fix": "run-s fix:*", "fix:prettier": "prettier . --write", - "fix:lint": "eslint src --ext .ts --ext .cjs --fix", + "fix:lint": "eslint src --fix", "check": "run-s check:*", - "check:lint": "eslint src --ext .ts", + "check:lint": "eslint src", "check:prettier": "prettier . --list-different", "check:spelling": "cspell \"{README.md,src/**/*.ts}\"", "check:tsc": "tsc -p tsconfig.dev.json", diff --git a/packages/message-encryption/package.json b/packages/message-encryption/package.json index 2b28e51b9..be3c5643f 100644 --- a/packages/message-encryption/package.json +++ b/packages/message-encryption/package.json @@ -54,9 +54,9 @@ "build:bundle": "rollup --config rollup.config.js", "fix": "run-s fix:*", "fix:prettier": "prettier . --write", - "fix:lint": "eslint src --ext .ts --ext .cjs --fix", + "fix:lint": "eslint src *.js --fix", "check": "run-s check:*", - "check:lint": "eslint src --ext .ts", + "check:lint": "eslint src *.js", "check:prettier": "prettier . --list-different", "check:spelling": "cspell \"{README.md,src/**/*.ts}\"", "check:tsc": "tsc -p tsconfig.dev.json", @@ -95,6 +95,7 @@ "@types/mocha": "^10.0.1", "@typescript-eslint/eslint-plugin": "^5.53.0", "@typescript-eslint/parser": "^5.51.0", + "build-utils": "*", "chai": "^4.3.7", "cspell": "^6.26.3", "eslint": "^8.35.0", diff --git a/packages/message-encryption/rollup.config.js b/packages/message-encryption/rollup.config.js index f11e6b9c4..22e75b907 100644 --- a/packages/message-encryption/rollup.config.js +++ b/packages/message-encryption/rollup.config.js @@ -1,13 +1,14 @@ import commonjs from "@rollup/plugin-commonjs"; import json from "@rollup/plugin-json"; import { nodeResolve } from "@rollup/plugin-node-resolve"; +import { extractExports } from "build-utils"; + +import * as packageJson from "./package.json" assert { type: "json" }; + +const input = extractExports(packageJson); export default { - input: { - index: "dist/index.js", - ecies: "dist/ecies.js", - symmetric: "dist/symmetric.js", - }, + input, output: { dir: "bundle", format: "esm", diff --git a/packages/peer-exchange/.eslintignore b/packages/peer-exchange/.eslintignore deleted file mode 100644 index e69de29bb..000000000 diff --git a/packages/peer-exchange/package.json b/packages/peer-exchange/package.json index c8eb2f472..aa1ddc384 100644 --- a/packages/peer-exchange/package.json +++ b/packages/peer-exchange/package.json @@ -37,9 +37,9 @@ "build:bundle": "rollup --config rollup.config.js", "fix": "run-s fix:*", "fix:prettier": "prettier . --write", - "fix:lint": "eslint src --ext .ts --ext .cjs --fix", + "fix:lint": "eslint src *.js --fix", "check": "run-s check:*", - "check:lint": "eslint src --ext .ts", + "check:lint": "eslint src *.js", "check:prettier": "prettier . --list-different", "check:spelling": "cspell \"{README.md,src/**/*.ts}\"", "check:tsc": "tsc -p tsconfig.dev.json", @@ -71,6 +71,7 @@ "@typescript-eslint/eslint-plugin": "^5.53.0", "@typescript-eslint/parser": "^5.51.0", "@waku/interfaces": "*", + "build-utils": "*", "chai": "^4.3.7", "cspell": "^6.26.3", "eslint": "^8.35.0", diff --git a/packages/peer-exchange/rollup.config.js b/packages/peer-exchange/rollup.config.js index d22d3d231..22e75b907 100644 --- a/packages/peer-exchange/rollup.config.js +++ b/packages/peer-exchange/rollup.config.js @@ -1,11 +1,14 @@ import commonjs from "@rollup/plugin-commonjs"; import json from "@rollup/plugin-json"; import { nodeResolve } from "@rollup/plugin-node-resolve"; +import { extractExports } from "build-utils"; + +import * as packageJson from "./package.json" assert { type: "json" }; + +const input = extractExports(packageJson); export default { - input: { - index: "dist/index.js", - }, + input, output: { dir: "bundle", format: "esm", diff --git a/packages/peer-exchange/tsconfig.dev.json b/packages/peer-exchange/tsconfig.dev.json index ffc27ef6b..4f7c34af3 100644 --- a/packages/peer-exchange/tsconfig.dev.json +++ b/packages/peer-exchange/tsconfig.dev.json @@ -1,8 +1,3 @@ { - "extends": "./tsconfig", - "compilerOptions": { - "module": "esnext", - "noEmit": true - }, - "exclude": [] + "extends": "../../tsconfig.dev" } diff --git a/packages/proto/.eslintrc.cjs b/packages/proto/.eslintrc.cjs deleted file mode 100644 index 324f1f526..000000000 --- a/packages/proto/.eslintrc.cjs +++ /dev/null @@ -1,6 +0,0 @@ -module.exports = { - parserOptions: { - tsconfigRootDir: __dirname, - project: "./tsconfig.dev.json", - }, -}; diff --git a/packages/proto/package.json b/packages/proto/package.json index cc1a68993..51b25510f 100644 --- a/packages/proto/package.json +++ b/packages/proto/package.json @@ -40,8 +40,7 @@ "prepublish": "npm run build", "reset-hard": "git clean -dfx -e .idea && git reset --hard && npm i && npm run build", "fix": "run-s fix:*", - "fix:prettier": "prettier . --write", - "fix:lint": "eslint src/*.ts --fix" + "fix:prettier": "prettier . --write" }, "engines": { "node": ">=16" @@ -55,6 +54,7 @@ "@rollup/plugin-node-resolve": "^15.0.1", "@typescript-eslint/eslint-plugin": "^5.53.0", "@typescript-eslint/parser": "^5.51.0", + "build-utils": "*", "cspell": "^6.26.3", "eslint": "^8.35.0", "eslint-config-prettier": "^8.6.0", diff --git a/packages/proto/rollup.config.js b/packages/proto/rollup.config.js index d22d3d231..22e75b907 100644 --- a/packages/proto/rollup.config.js +++ b/packages/proto/rollup.config.js @@ -1,11 +1,14 @@ import commonjs from "@rollup/plugin-commonjs"; import json from "@rollup/plugin-json"; import { nodeResolve } from "@rollup/plugin-node-resolve"; +import { extractExports } from "build-utils"; + +import * as packageJson from "./package.json" assert { type: "json" }; + +const input = extractExports(packageJson); export default { - input: { - index: "dist/index.js", - }, + input, output: { dir: "bundle", format: "esm", diff --git a/packages/tests/package.json b/packages/tests/package.json index 931fa5047..4dec4bdd4 100644 --- a/packages/tests/package.json +++ b/packages/tests/package.json @@ -37,7 +37,7 @@ "build:esm": "tsc", "fix": "run-s fix:*", "fix:prettier": "prettier . --write", - "fix:lint": "eslint src tests --ext .ts --ext .cjs --fix", + "fix:lint": "eslint src tests --fix", "pretest": "run-s pretest:*", "pretest:1-init-git-submodules": "[ -f '../../nwaku/build/wakunode2' ] || git submodule update --init --recursive", "pretest:2-build-nwaku": "[ -f '../../nwaku/build/wakunode2' ] || run-s nwaku:build", @@ -45,7 +45,7 @@ "nwaku:force-build": "(cd ../../nwaku && rm -rf ./build/ ./vendor) && run-s nwaku:build", "check": "run-s check:*", "check:prettier": "prettier . --list-different", - "check:lint": "eslint src tests --ext .ts", + "check:lint": "eslint src tests", "check:spelling": "cspell \"{README.md,{tests,src}/**/*.ts}\"", "check:tsc": "tsc -p tsconfig.dev.json", "test": "run-s test:*", diff --git a/packages/utils/package.json b/packages/utils/package.json index 5fbf9178c..e799b0f21 100644 --- a/packages/utils/package.json +++ b/packages/utils/package.json @@ -37,9 +37,9 @@ "build:bundle": "rollup --config rollup.config.js", "fix": "run-s fix:*", "fix:prettier": "prettier . --write", - "fix:lint": "eslint src --ext .ts --ext .cjs --fix", + "fix:lint": "eslint src *.js --fix", "check": "run-s check:*", - "check:lint": "eslint src --ext .ts", + "check:lint": "eslint src *.js", "check:prettier": "prettier . --list-different", "check:spelling": "cspell \"{README.md,src/**/*.ts}\"", "check:tsc": "tsc -p tsconfig.dev.json", @@ -65,6 +65,7 @@ "@rollup/plugin-node-resolve": "^15.0.1", "@typescript-eslint/eslint-plugin": "^5.53.0", "@typescript-eslint/parser": "^5.51.0", + "build-utils": "*", "cspell": "^6.26.3", "eslint": "^8.35.0", "eslint-config-prettier": "^8.6.0", diff --git a/packages/utils/rollup.config.js b/packages/utils/rollup.config.js index d22d3d231..22e75b907 100644 --- a/packages/utils/rollup.config.js +++ b/packages/utils/rollup.config.js @@ -1,11 +1,14 @@ import commonjs from "@rollup/plugin-commonjs"; import json from "@rollup/plugin-json"; import { nodeResolve } from "@rollup/plugin-node-resolve"; +import { extractExports } from "build-utils"; + +import * as packageJson from "./package.json" assert { type: "json" }; + +const input = extractExports(packageJson); export default { - input: { - index: "dist/index.js", - }, + input, output: { dir: "bundle", format: "esm",