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

Support for Generating Code in Directory #19

Open
rawkode opened this issue Dec 11, 2020 · 6 comments
Open

Support for Generating Code in Directory #19

rawkode opened this issue Dec 11, 2020 · 6 comments
Assignees
Labels
area/codegen Affects quality or correctness of generated code kind/enhancement Improvements or new features

Comments

@rawkode
Copy link

rawkode commented Dec 11, 2020

I'm using the following command to generate Pulumi types for Cluster API components.

./crd2pulumi --nodejsName capp --nodejsPath ./src/capp ./capp-components.yaml --force

This creates a utilities.{ts,js} that has code for loading the Node version from package.json.

This code fails if the code is generated into a subdirectory of the node project.

It would be cool if we could provide another flag to provide a subpath to store the generated code

@leezen
Copy link

leezen commented Dec 15, 2020

Could you please clarify what you're trying to do? crd2pulumi generates a package on your behalf, which will have its own package.json and this is what utilities.{ts,js} refers to. You should have your own package.json for your application.

@rawkode
Copy link
Author

rawkode commented Dec 15, 2020

I already have code in my directory / repo, and I want to generate the types into a directory of an existing project.

@leezen
Copy link

leezen commented Dec 17, 2020

Looking at this further, it's awkward since the package.json generated by crd2pulumi doesn't actually have the right version information in it, so it's not really "ready" to be used out of the box via npm install ./<dir> yet at the same time, it's not really fulfilling your need of just having it in existing code. A bunch of this code generation is related to the underlying code generators for resource providers, so I think the right answer here is something along the lines of:

  1. Fix crd2pulumi so that package.json is actually meaningful.
  2. Provide an option to simply provide the code w/o trying to generate it like a package module.

@ringods
Copy link
Member

ringods commented Mar 23, 2021

@leezen I'm also in this group:

  1. Provide an option to simply provide the code w/o trying to generate it like a package module.

I want to integrate the generated files into an npm package containing our Pulumi abstractions so far.

Generating a new npm package for each CRD one wants to generate code for, forces us into setting up a build pipeline & release process for each of these npm projects.

@jaxxstorm
Copy link

I think this is important for some of the multi-language components we might want to build. It'll be super useful to be able to build this into the component libraries themself.

@leezen leezen assigned lblackstone and unassigned justinvp Apr 28, 2021
@infin8x infin8x added this to the 0.56 milestone Apr 28, 2021
@leezen leezen removed this from the 0.56 milestone Apr 28, 2021
@infin8x infin8x added kind/enhancement Improvements or new features and removed enhancement labels Jul 10, 2021
@muhlba91
Copy link

same here. we are trying to integrate this into an existing package. it would be great if there's an option to disable generating an entire package or reading from package.json.

@mattolenik mattolenik added the area/codegen Affects quality or correctness of generated code label Jun 2, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/codegen Affects quality or correctness of generated code kind/enhancement Improvements or new features
Projects
None yet
Development

No branches or pull requests

9 participants