Skip to content

Commit

Permalink
Merge pull request #27 from marekrjpolak/feat/node
Browse files Browse the repository at this point in the history
Add `nodejs` compatibility
  • Loading branch information
slowbackspace authored Oct 6, 2023
2 parents a281512 + 1de5078 commit 8702040
Show file tree
Hide file tree
Showing 9 changed files with 13 additions and 14 deletions.
4 changes: 0 additions & 4 deletions jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,6 @@ module.exports = {
transform: {
'^.+\\.(t|j)sx?$': ['@swc-node/jest'],
},
moduleNameMapper: {
// Workaround for an error "Cannot find module @emurgo/cardano-serialization-lib-browser"
"@emurgo/cardano-serialization-lib-browser": "@emurgo/cardano-serialization-lib-nodejs",
},
coverageThreshold: {
// global: {
// branches: 37,
Expand Down
7 changes: 5 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@
"author": "fivebinaries.com",
"main": "lib/cjs/index.js",
"module": "lib/esm/index.js",
"browser": {
"@emurgo/cardano-serialization-lib-nodejs": "@emurgo/cardano-serialization-lib-browser"
},
"files": [
"lib/**/*.js",
"lib/**/*.ts"
Expand All @@ -24,7 +27,6 @@
"test:badges": "make-coverage-badge --output-path ./docs/badge-coverage.svg"
},
"devDependencies": {
"@emurgo/cardano-serialization-lib-nodejs": "11.0.0",
"@swc-node/jest": "^1.5.2",
"@types/jest": "^28.1.6",
"@types/node": "^16.3.2",
Expand All @@ -42,7 +44,8 @@
"typescript": "^4.7.4"
},
"dependencies": {
"@emurgo/cardano-serialization-lib-browser": "^11.0.0"
"@emurgo/cardano-serialization-lib-browser": "^11.0.0",
"@emurgo/cardano-serialization-lib-nodejs": "11.0.0"
},
"packageManager": "[email protected]"
}
2 changes: 1 addition & 1 deletion src/constants/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import * as CardanoWasm from '@emurgo/cardano-serialization-lib-browser';
import * as CardanoWasm from '@emurgo/cardano-serialization-lib-nodejs';

export const CertificateType = {
STAKE_REGISTRATION: 0,
Expand Down
2 changes: 1 addition & 1 deletion src/methods/largestFirst.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { ERROR } from '../constants';
import * as CardanoWasm from '@emurgo/cardano-serialization-lib-browser';
import * as CardanoWasm from '@emurgo/cardano-serialization-lib-nodejs';
import {
ChangeOutput,
CoinSelectionParams,
Expand Down
2 changes: 1 addition & 1 deletion src/methods/randomImprove.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { ERROR } from '../constants';
import * as CardanoWasm from '@emurgo/cardano-serialization-lib-browser';
import * as CardanoWasm from '@emurgo/cardano-serialization-lib-nodejs';
import {
CoinSelectionParams,
CoinSelectionResult,
Expand Down
4 changes: 2 additions & 2 deletions src/types/types.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as CardanoWasm from '@emurgo/cardano-serialization-lib-browser';
import { BigNum } from '@emurgo/cardano-serialization-lib-browser';
import * as CardanoWasm from '@emurgo/cardano-serialization-lib-nodejs';
import { BigNum } from '@emurgo/cardano-serialization-lib-nodejs';
import { CertificateType } from '../constants';

export interface Asset {
Expand Down
2 changes: 1 addition & 1 deletion src/utils/common.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import * as CardanoWasm from '@emurgo/cardano-serialization-lib-browser';
import * as CardanoWasm from '@emurgo/cardano-serialization-lib-nodejs';
import {
CARDANO_PARAMS,
CertificateType,
Expand Down
2 changes: 1 addition & 1 deletion src/utils/trezor/sign.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import * as CardanoWasm from '@emurgo/cardano-serialization-lib-browser';
import * as CardanoWasm from '@emurgo/cardano-serialization-lib-nodejs';
import {
CardanoSignedTxWitness,
CardanoTxWitnessType,
Expand Down
2 changes: 1 addition & 1 deletion tests/setup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ jest.setTimeout(30000);
import {
BigNum,
TransactionBody,
} from '@emurgo/cardano-serialization-lib-browser';
} from '@emurgo/cardano-serialization-lib-nodejs';
import { CoinSelectionResult } from '../src/types/types';
import { multiAssetToArray } from '../src/utils/common';

Expand Down

0 comments on commit 8702040

Please sign in to comment.