Build & Run
How do I run this?
Ky is a library, not an application, so "running" it means installing it as a dependency in your project, or cloning the repository to develop and test it locally.
Use Ky in your own project
Install from npm:
npm install ky
This is the only install step listed in the project README.
Ky is also available from these CDNs for use without a bundler:
https://cdn.jsdelivr.net/npm/ky/+esmhttps://unpkg.com/kyhttps://esm.sh/ky
See readme.md for the canonical install instructions.
Note: the README states that it documents the next version of Ky; the version currently published on npm has its own readme linked from there.
Develop Ky locally
The lifecycle scripts are defined in package.json.
1. Install dependencies
npm install
This will also trigger the prepare script, which runs the build:
npm run build
2. Build
The build script cleans the output directory and runs the TypeScript compiler against the distribution config:
npm run build
Internally this is del-cli distribution && tsc --project tsconfig.dist.json, so the compiled output goes to distribution/.
3. Run the test suite
npm test
The test script runs xo (lint), then npm run build, then ava (the test runner). The AVA tests under test/ spin up local HTTP servers via the helper in test/helpers/create-http-test-server.ts, which uses Express on top of http.createServer and listens on an ephemeral port on localhost. No external services are required to run the tests.
4. Debug a single test run
To run AVA with Playwright debug mode and a longer timeout:
npm run debug
This expands to PWDEBUG=1 ava --timeout=2m.
5. Publish a release (maintainers)
npm run release
This invokes np to publish to npm.