Installation
In a Node-based environment (to be run server-side or be bundled for running in a browser)...
archipelago.js supports all currently supported versions of Node, Bun, and Deno. To install, follow the installation directions for your desired runtime and create a new project directory.
Then, navigate to your new project directory and run npm install archipelago.js
(or whatever your package
manager's flavor of doing the same thing is).
Node.js
mkdir my-project
cd my-project
npm init
npm install archipelago.js
Bun
mkdir my-project
cd my-project
bun init
bun add archipelago.js
Deno (v2)
deno init my-project
cd my-project
deno add npm:archipelago.js
Then, in your JavaScript or TypeScript files, just import using ESM syntax.
import { /* ... */ } from "archipelago.js";
// Rest of your code here...
In the browser without using a bundler...
If you are planning to run in the browser without bundling your code first, you can import archipelago.js using the ESM module syntax in your HTML files. See below for an example using the unpkg CDN as a source:
<script type="module">
import { /* ... */ } from "https://unpkg.com/archipelago.js/dist/archipelago.min.js";
// Rest of your code here...
</script>
If you package the archipelago.js files with your code, you can change the CDN url with a relative path to your provided archipelago.js bundle.