Create a Build Script
Package.json​
Add a basketry
script to your package.json
file that runs the Basketry CLI:
package.json
{
"name": "my-project",
"scripts": {
"basketry": "basketry"
},
"dependencies": {
"@basketry/openapi-3": "^0.1.0",
"@basketry/typescript": "^0.1.0"
}
}
Now you can run the basketry
script to generate code from your service definition:
- npm
- yarn
- pnpm
npm run basketry
yarn basketry
pnpm run basketry
Your src
directory (the output
specified in basketry.config.json
) should now contain TypeScript files that represent your OpenAPI service definition. You can now use these files in your project!
Next, let's add some rules to enforce consistency in our service design.