Installation
The FDS Encoder is the npm package @vitness/fds-encoder. It gives you the fds-encoder command and a library.
Requirements
- Node.js: 20.0.0 or higher
- npm, pnpm or yarn
Check your Node.js version:
node --version
Install the command
Install the package globally to put fds-encoder on your path:
- pnpm
- npm
- yarn
pnpm add -g @vitness/fds-encoder
npm install -g @vitness/fds-encoder
yarn global add @vitness/fds-encoder
Check that it runs:
fds-encoder --version
0.1.0
The other pages in this section write fds-encoder.
Run it without installing
- pnpm
- npm
- yarn
pnpm dlx @vitness/fds-encoder --version
npx @vitness/fds-encoder --version
yarn dlx @vitness/fds-encoder --version
Remove it
npm uninstall -g @vitness/fds-encoder
Use the library in a project
Add the package to your project:
- pnpm
- npm
- yarn
pnpm add @vitness/fds-encoder
npm install @vitness/fds-encoder
yarn add @vitness/fds-encoder
Then import it:
import { checkKey } from '@vitness/fds-encoder';
console.log(checkKey('FXM=1.0/biceps-brachii.long').ok); // true
The package is an ES module and ships its TypeScript types.
Work on the Encoder itself
The package lives in packages/fds-encoder of the specification repository. Build it from a checkout to change it, or to run the conformance cases against your build. The commands below run from the root of the checkout.
git clone https://github.com/vitness-me/fds-spec-website.git
cd fds-spec-website
npm --prefix packages/fds-encoder ci
npm --prefix packages/fds-encoder run build
The build writes the library to packages/fds-encoder/dist/index.js and the command to packages/fds-encoder/dist/bin/fds-encoder.js. Run the built command with node packages/fds-encoder/dist/bin/fds-encoder.js.
Run the package's own checks:
npm --prefix packages/fds-encoder run typecheck
npm --prefix packages/fds-encoder run test:run
Troubleshooting
fds-encoder: command not found. The command isn't on your path. Install it globally, then check that npm's global folder is on your path: npm prefix -g prints it, and the command lives in its bin folder. Or run it without installing, with npx @vitness/fds-encoder.
The conformance script says dist/index.js does not exist. node scripts/check-conformance.mjs and npm run check:keys read the built package in a checkout, packages/fds-encoder/dist, and stop with exit code 2 when it isn't there:
…/packages/fds-encoder/dist/index.js does not exist. Build the encoder first:
npm --prefix packages/fds-encoder ci && npm --prefix packages/fds-encoder run build
Build it first:
npm --prefix packages/fds-encoder ci
npm --prefix packages/fds-encoder run build
Build again after you change the package or pull new commits: a dist from an earlier build checks the earlier code.
Next steps
- CLI Reference: every command and flag.
- Library API: the exported functions.
- Examples: end-to-end walkthroughs.