From 4c610c7a9501ee33706d1b285143ad1ecd1ae742 Mon Sep 17 00:00:00 2001 From: Victor Oliva Date: Mon, 30 Dec 2024 10:56:49 +0100 Subject: [PATCH] feat(cli): document noDescriptorsPackage option --- docs/pages/codegen.md | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/docs/pages/codegen.md b/docs/pages/codegen.md index 026abadb..e9263ebe 100644 --- a/docs/pages/codegen.md +++ b/docs/pages/codegen.md @@ -168,3 +168,23 @@ This file could be placed anywhere, but we recommend placing it at `.papi/whitel In order to generate descriptors taking into account the whitelist, the command should be `papi generate --whitelist .papi/whitelist.ts` (or just `papi --whitelist .papi/whitelist.ts`), or any other directory you chose to save your file. We recommend setting a script in your `package.json` that takes care of it. A full working example of a dApp with whitelist could be found at [our repo](https://github.com/polkadot-api/polkadot-api/tree/main/examples/vite). + +## Codegen without descriptors package + +PAPI is designed to create a descriptors package, `@polkadot-api/descriptors`, allowing it to be imported like any other package. To ensure compatibility with most package managers and bundlers, the CLI automatically adds this package as a dependency to your project. + +For advanced use cases, you can configure the CLI to perform only the code generation without installing it as a dependency. To do this, add the following option to your configuration file, `.papi/polkadot-api.json`: + +```json +{ + "descriptorPath": …, + "entries": { … }, + "options": { + "noDescriptorsPackage": true + } +} +``` + +:::info +You can also modify the `"descriptorPath"` property to specify a different path for generating the descriptors. +:::