Add Effeck to an existing project
Install Effeck's packages in a project that has a package.json, and check that the compiler runs. Then set up the build.
1. Check package.json
package.json must have "type": "module". If it does not, ask the user before you add it: it changes how Node loads the project's .js files.
If package.json depends on a version of effect other than 4.0.5, stop and ask the user. The Effeck runtime requires effect 4.0.5 exactly.
2. Install the packages
With Bun, run:
bun add effeck-runtime@0.0.1 effect@4.0.5 @effect/platform-node@4.0.5
bun add -d effeck@0.0.1 effeck-vite@0.0.1 vitest@5.0.5 @effect/vitest@4.0.5With npm, run:
npm install --save-exact effeck-runtime@0.0.1 effect@4.0.5 @effect/platform-node@4.0.5
npm install --save-dev --save-exact effeck@0.0.1 effeck-vite@0.0.1 vitest@5.0.5 @effect/vitest@4.0.5| Package | Install as | Purpose |
|---|---|---|
effeck-runtime | Dependency | The continuation kernel and helpers that compiled code imports |
effect, @effect/platform-node | Dependency | Effect 4.0.5 and its Node platform |
effeck | Dev dependency | The compiler and language server, its native binary, and the VS Code extension |
effeck-vite | Dev dependency | Compiles .effeck modules for Vite and Vitest |
vitest, @effect/vitest | Dev dependency | Vitest 5.0.5 and @effect/vitest 4.0.5 for tests |
Keep these versions. effeck-runtime checks Effect's version when it loads, so keep effect, @effect/platform-node, and @effect/vitest at 4.0.5. effeck, effeck-runtime, and effeck-vite are released together; keep them at one version.
Keep optional dependencies enabled. effeck gets its native compiler from one optional dependency per platform, such as effeck-darwin-arm64. If an install skips them, for example with npm install --omit=optional, effeck cannot find its binary and exits with an error.
3. Check the compiler
npx effeck --versionThe output is:
Effeck 0.0.1 (TypeScript 7.1.0-dev)Next
Set up the build. For Vite or Vitest, read Vite and Vitest. Without a bundler, read Build with the effeck CLI. For another bundler or a framework, step 3 of Set up Effeck lists what is coming soon.