-
Notifications
You must be signed in to change notification settings - Fork 177
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix a bug where building a package that includes `@orca-so/whirlpools…
…` using `tsc` fails (#446) * Test * Tests * Remove nodejs bundle size test * Tweak * Fix
- Loading branch information
Showing
10 changed files
with
391 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
{ | ||
"compilerOptions": { | ||
"target": "ES6", | ||
"module": "ES6", | ||
"moduleResolution": "Node", | ||
"skipLibCheck": true | ||
}, | ||
"include": ["../index.ts"] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
{ | ||
"compilerOptions": { | ||
"target": "ESNext", | ||
"module": "ESNext", | ||
"moduleResolution": "Node", | ||
"skipLibCheck": true | ||
}, | ||
"include": ["../index.ts"] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
{ | ||
"compilerOptions": { | ||
"target": "ESNext", | ||
"module": "NodeNext", | ||
"moduleResolution": "NodeNext", | ||
"skipLibCheck": true | ||
}, | ||
"include": ["../index.ts"] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import assert from "assert"; | ||
import { execSync } from "child_process"; | ||
import { readdirSync } from "fs"; | ||
import { describe, it } from "vitest"; | ||
|
||
const commandTemplates = [ | ||
"tsx --tsconfig {} ./index.ts", | ||
"tsc --project {} --outDir ./dist && node ./dist/index.js", | ||
// FIXME: ts-node does not play nice with ESM since node 20 | ||
// "ts-node --esm --project {} ./index.ts", | ||
// TODO: should we also add browser/bundler? | ||
] | ||
|
||
// commonjs not included here because wasm wouldn't support it | ||
const tsConfigs = readdirSync("./configs"); | ||
|
||
describe("Integration", () => { | ||
commandTemplates.forEach(template => { | ||
tsConfigs.forEach(config => { | ||
const command = template.replace("{}", `./configs/${config}`); | ||
it(`Use '${command}'`, () => { | ||
const output = execSync(command).toString(); | ||
assert(output.includes("2LecshUwdy9xi7meFgHtFJQNSKk4KdTrcpvaB56dP2NQ")); | ||
assert(output.includes("256")); | ||
assert(output.includes("whirLbMiicVdio4qvUfM5KAg6Ct8VwpYzGff3uctyCc")); | ||
}); | ||
}); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import { DEFAULT_WHIRLPOOLS_CONFIG_ADDRESS } from "@orca-so/whirlpools"; | ||
import { _POSITION_BUNDLE_SIZE } from "@orca-so/whirlpools-core"; | ||
import { WHIRLPOOL_PROGRAM_ADDRESS } from "@orca-so/whirlpools-client"; | ||
|
||
console.info( | ||
DEFAULT_WHIRLPOOLS_CONFIG_ADDRESS, | ||
_POSITION_BUNDLE_SIZE(), | ||
WHIRLPOOL_PROGRAM_ADDRESS, | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
{ | ||
"name": "@orca-so/whirlpools-integration", | ||
"private": true, | ||
"type": "module", | ||
"scripts": { | ||
"build": "tsc --noEmit", | ||
"test": "vitest run index.test.ts" | ||
}, | ||
"dependencies": { | ||
"@orca-so/whirlpools": "*" | ||
}, | ||
"devDependencies": { | ||
"tsx": "^4.19.0", | ||
"typescript": "^5.6.3" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{ | ||
"extends": "../../tsconfig.json", | ||
"compilerOptions": { | ||
"outDir": "./dist" | ||
}, | ||
"include": ["index.ts"] | ||
} |
Oops, something went wrong.