Skip to content

Commit

Permalink
js: fix cjs build
Browse files Browse the repository at this point in the history
  • Loading branch information
dr497 committed Aug 7, 2024
1 parent 95063bb commit 71095b5
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 18 deletions.
4 changes: 2 additions & 2 deletions js/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

23 changes: 11 additions & 12 deletions js/package.json
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
{
"name": "@bonfida/spl-name-service",
"version": "3.0.0",
"version": "3.0.1",
"license": "MIT",
"files": [
"dist"
],
"type": "module",
"main": "./dist/index.cjs",
"module": "./dist/index.mjs",
"types": "./dist/index.d.ts",
"main": "./dist/cjs/index.cjs",
"module": "./dist/esm/index.mjs",
"types": "./dist/types/index.d.ts",
"exports": {
".": {
"import": "./dist/index.mjs",
"require": "./dist/index.cjs",
"types": "./dist/index.d.ts"
"import": "./dist/esm/index.mjs",
"require": "./dist/cjs/index.cjs",
"types": "./dist/types/index.d.ts"
}
},
"repository": {
Expand All @@ -23,15 +23,14 @@
"homepage": "https://sns.guide",
"scripts": {
"dev": "tsc && node --trace-warnings dist/test.js",
"build": "rm -rf dist && rollup -c",
"prepublish": "rm -rf dist && rollup -c",
"prepack": "rm -rf dist && rollup -c",
"build": "rm -rf dist && rollup -c && tsc --emitDeclarationOnly --outDir dist/types",
"prepublish": "rm -rf dist && rollup -c && tsc --emitDeclarationOnly --outDir dist/types",
"prepack": "rm -rf dist && rollup -c && tsc --emitDeclarationOnly --outDir dist/types",
"lint": "yarn pretty && eslint .",
"lint:fix": "yarn pretty:fix && eslint . --fix",
"pretty": "prettier --check 'src/*.[jt]s'",
"pretty:fix": "prettier --write 'src/*.[jt]s'",
"test": "jest ./tests",
"doc": "yarn typedoc src/index.ts"
"test": "jest ./tests"
},
"devDependencies": {
"@bonfida/prettier-config": "^1.0.0",
Expand Down
21 changes: 18 additions & 3 deletions js/rollup.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,23 @@ export default {
],
output: [
{
dir: "dist/",
dir: "dist/esm",
format: "esm",
sourcemap: true,
entryFileNames: "[name].mjs",
exports: "named",
preserveModules: true,
preserveModulesRoot: "src",
},
{
dir: "dist/cjs",
format: "cjs",
sourcemap: true,
entryFileNames: "[name].cjs",
exports: "named",
preserveModules: true,
preserveModulesRoot: "src",
},
{ dir: "dist/", format: "cjs", sourcemap: true },
],
external: ["@solana/web3.js"],
plugins: [
Expand All @@ -42,7 +52,12 @@ export default {
dedupe: ["borsh", "@solana/spl-token", "bn.js", "buffer"],
}),
commonjs(),
typescript(),
typescript({
tsconfig: "./tsconfig.json",
declaration: false,
outDir: null,
declarationDir: null,
}),
babel({ babelHelpers: "bundled" }),
json(),
replace({
Expand Down
4 changes: 3 additions & 1 deletion js/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,11 @@
"esModuleInterop": true,
"allowSyntheticDefaultImports": true,
"target": "es2019",
"outDir": "dist",
"outDir": "./dist",
"rootDir": "./src",
"declaration": true,
"declarationDir": "dist/types",
"emitDeclarationOnly": true,
"noImplicitAny": false,
"moduleResolution": "node",
"sourceMap": true,
Expand Down

0 comments on commit 71095b5

Please sign in to comment.