TS-Node

  1. Install Node
  2. Install TS-Node globally

Save to index.ts

import { SDK } from "avail-js-sdk"

async function main() {}

main()
  .catch((e) => {
    console.log(e)
    process.exit(1)
  })
  .finally(() => {
    console.log("All Good")
    process.exit(0)
  })

Save to package.json

{
  "name": "avail-js-docs",
  "version": "0.0.1",
  "description": "Avail-js SDK",
  "dependencies": {
    "avail-js-sdk": "^0.4.2"
  },
  "resolutions": {
    "ws": ">=8.17.1"
  }
}

Save to tsconfig.json

{
  "compilerOptions": {
    "target": "es2016",
    "module": "commonjs",
    "outDir": "build",
    "declaration": true,
    "esModuleInterop": true,
    "forceConsistentCasingInFileNames": true,
    "strict": true,
    "skipLibCheck": true,
    "noUnusedParameters": true
  },
  "include": ["src"],
  "exclude": ["node_modules", "build"]
}

You should now have the following files

  • current directory
    • index.ts
    • package.json
    • tsconfig.json

Run the following commands:

  • npm i
  • ts-node ./index.ts

Deno

  1. Install Deno

Save to index.ts

import { SDK } from "avail-js-sdk"

async function main() {}

main()
  .catch((e) => {
    console.log(e)
    process.exit(1)
  })
  .finally(() => {
    console.log("All Good")
    process.exit(0)
  })

Save to package.json

{
  "name": "avail-js-docs",
  "version": "0.0.1",
  "description": "Avail-js SDK",
  "dependencies": {
    "avail-js-sdk": "^0.4.2"
  },
  "resolutions": {
    "ws": ">=8.17.1"
  }
}

You should now have the following files

  • current directory
    • index.ts
    • package.json

Run the following commands:

  • deno install
  • deno run -A ./index.ts

Bun

  1. Install Bun

Save to index.ts

import { SDK } from "avail-js-sdk"

async function main() {}

main()
  .catch((e) => {
    console.log(e)
    process.exit(1)
  })
  .finally(() => {
    console.log("All Good")
    process.exit(0)
  })

Save to package.json

{
  "name": "avail-js-docs",
  "version": "0.0.1",
  "description": "Avail-js SDK",
  "dependencies": {
    "avail-js-sdk": "^0.4.2"
  },
  "resolutions": {
    "ws": ">=8.17.1"
  }
}

You should now have the following files

  • current directory
    • index.ts
    • package.json

Run the following commands:

  • bun install
  • bun run ./index.ts