Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add src-output-dir option for specifying source code output dir #3011

Open
dgetu opened this issue Jan 17, 2025 · 1 comment
Open

Add src-output-dir option for specifying source code output dir #3011

dgetu opened this issue Jan 17, 2025 · 1 comment
Assignees
Labels

Comments

@dgetu
Copy link
Member

dgetu commented Jan 17, 2025

Example usage:

Existing customization behavior should stay the same - the default behavior is to emit to generated if the dir already exists, src otherwise.

{
  "src-output-dir": "src/generated", // defaults to "generated" if the directory exists at emit time, "src" otherwise
  "entry-point-root": "src" // defaults to "src-output-dir" if defined, "src" otherwise
}

ls .

filename example filename kind
${entry-point-root}/index.ts src/index.ts authored
${entry-dir}/models/index.ts src/models/index.ts authored
${entry-dir}/api/index.ts src/api/index.ts authored
${src-output-dir}/index.ts src/generated/index.ts generated
${src-output-dir}/models/... src/generated/models/... generated
${src-output-dir}/api/... src/generated/api/... generated

If entry-point-root isn't the same as src-output-dir, create each missing authored file of the three listed above, and re-export the corresponding generated index.ts from it. If an authored file already exists, don't change it, since it's meant to be customized by the SDK author.

src/index.ts (only write to this file if it doesn't exist)

export * from "./generated/index.js";

package.json, api-extractor.json, tsconfig.json and .tshy config output need to be updated as well.

@dgetu dgetu self-assigned this Jan 17, 2025
@qiaozha qiaozha added P1 priority 1 RLC HRLC p0 priority 0 and removed p0 priority 0 labels Jan 22, 2025
@qiaozha
Copy link
Member

qiaozha commented Jan 23, 2025

Hi @dgetu if I remember correctly, the customization process v2 has changed the folder structure like

- generated
- src 

Customization code will go into src folder directly, and we will run npx dev-tool customization apply-v2 to combine/merge the generated code into the src folder. So that there's no direct reference to the generated folder. You may refer to this loop for more context and I think @timovv is the one who writes the loop.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants