Uh oh!
There was an error while loading. Please reload this page.
Fix NPM build for Typescript-fetch - #3403
Conversation
-Move fetch files to an "src" folder instead of doing everything at the root which removes the bugs when using the library itself -Fix the distribution of fetch using npm
# Conflicts: # modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/TypeScriptFetchClientCodegen.java # samples/client/petstore/typescript-fetch/builds/multiple-parameters/models/Category.ts # samples/client/petstore/typescript-fetch/builds/multiple-parameters/models/ModelApiResponse.ts # samples/client/petstore/typescript-fetch/builds/multiple-parameters/models/Tag.ts
TiFu
left a comment
There was a problem hiding this comment.
LGTM if the circleci failure is unrelated
Uh oh!
There was an error while loading. Please reload this page.
@JFCote can you please add the
|
JFCote
commented
Jul 28, 2019
@macjohnny Currently in vacation, will check all of this when I'm back! Thanks for the review! |
* master: (122 commits) Fix#3604 by adding undefined as return type to headers and credentials methods in runtime.ts (#3605) Prepare 4.1.1-SNAPSHOT (#3603) Prepare 4.1.0 release (#3597) [java][client][jax-rs] Add a constant for Jackson @JsonProperty (#3560) restore openapi3 petstore.yaml (#3590) Add a new NodeJS Express server generator (#3567) [C#][client][csharp-netcore] Fix csharp netcore defaultheaders (#3562) Fix issue deserializing to nullptr (#3572) [OCaml] Add file post-processing (#3583) [dart2] Fix up test code generation, double deserialization, 'new' keyword deprecation (#3576) Run Qt5 client sample test (#3415) typescript-fetch: allow configuration of headers and credentials (#3586) using partials in ruby api_client (#3564) [OCaml] Added optional params support in API operations (#3568) [Rust Server] Generate valid Rustdocs for lazy_static items (#3556) Fix NPM build for Typescript-fetch (#3403) Expand path templates via resttemplate's uriTemplateHandler (#3500) Readme updated with a new tutorial and company using OpenAPI Generator (#3566) Fix logic of `getNullableType` of csharp server and client. (#3537) [Ruby] clean up Ruby dev dependencies (#3551) ...
Bessonov
commented
Sep 24, 2019
Although we use |
JFCote
commented
Sep 24, 2019
@Bessonov Can you explain a little bit more how this is a breaking change? If you use npm publish, you should'nt have any problem importing the resulting package, even if the structure has changed because webpack take care of everything. Let us know what is your use case. Thanks |
We don't use it as a whole module, but integrate it in own api module with some utilities and configuration. Basically, we have following structure: After this change the artifacts are not under |
JFCote
commented
Sep 24, 2019
@Bessonov I understand now. The changes was supposed to be mostly for the npm version of the generator but it seems it has created some regression for use case like yours. @macjohnny What do you suggest we do for this? |
Bessonov
commented
Sep 24, 2019
@JFCote no problem. I've implemented a postprocessing hook now, so don't care about us 👍 |
rob-deutsch
commented
Nov 8, 2019
@Bessonov what postprocessing did you implement for this? Like you, I was also using openapi-generator to integrate it into an existing npm package. |
Bessonov
commented
Nov 8, 2019
@rob-deutsch because all generators has some flaws, we use a run scripts like (pseudo code): #!/bin/bash# pre processing
rm -rf ...
# do work
docker run generator ....
# post processing# remove filesforpathin".gitignore"".openapi-generator-ignore""tsconfig.json"".openapi-generator";do
rm -rf "${rest_api}/src/fetch/${path}"done# new version of generator create resources in src folder
mv ${rest_api}/src/fetch/src/*${rest_api}/src/fetch
rmdir ${rest_api}/src/fetch/srcSo, no magic. |
rob-deutsch
commented
Nov 12, 2019
Thanks @Bessonov. That's more elegant than my |
[edit]: Disregard this post. I was running into issues with the additional tsconfig.json file. |
PR checklist
./bin/to update Petstore sample so that CIs can verify the change. (For instance, only need to run./bin/{LANG}-petstore.sh,./bin/openapi3/{LANG}-petstore.shif updating the {LANG} (e.g. php, ruby, python, etc) code generator or {LANG} client's mustache templates). Windows batch files can be found in.\bin\windows\. If contributing template-only or documentation-only changes which will change sample output, be sure to build the project first.master,4.1.x,5.0.x. Default:master.@TiFu (2017/07) @taxpon (2017/07) @sebastianhaas (2017/07) @kenisteward (2017/07) @Vrolijkx (2017/09) @macjohnny (2018/01) @nicokoenig (2018/09) @topce (2018/10) @akehir (2019/07)
Description of the PR
This PR fixes 2 things:
tsfiles. A real package should contains compiled code (.js).I followed this tutorial to do a good npm package: https://medium.com/cameron-nokes/the-30-second-guide-to-publishing-a-typescript-package-to-npm-89d93ff7bccd