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

Enhance TypeScript documentation regarding deployment #710

Open
gregorwolf opened this issue Feb 28, 2024 · 5 comments
Open

Enhance TypeScript documentation regarding deployment #710

gregorwolf opened this issue Feb 28, 2024 · 5 comments

Comments

@gregorwolf
Copy link
Collaborator

Hello CAP Documentation Team,

looking at the documentation page Using TypeScript the part for local development is nicely covered. But when I use cds add mta I don't see the needed compile step being added. Unfortunately the sample repository:

https://github.com/SAP-archive/btp-full-stack-typescript-app

was archived and the branch:

https://github.com/SAP-samples/cap-sflight/tree/typescript

seems not being updated either. I would suggest to add the deployment best practice for CAP TypeScript directly in the documentation.

Best Regards
Gregor

@renejeglinsky
Copy link
Contributor

Hi Gregor,

thank you for pointing this out. I'll be working on this and let you know when this is done.

Thanks,
René

@renejeglinsky
Copy link
Contributor

Hi Gregor,

half a year ago, @sebastianesch provided the MTA deployment part: https://cap.cloud.sap/docs/tools/cds-typer#integrate-into-your-multitarget-application

When discussing and researching, the question on the use case arose with our colleagues. Having that compile step added to the deployment means that you want to use cds-ts during runtime? If so, would you share the reasoning for that? Maybe @sebastianesch also wants to chime in and share about possible reasons/use cases.

It's especially interesting because we have an explicit note in our docs that states to not use cds-ts productively: https://cap.cloud.sap/docs/node.js/typescript#cds-ts

Looking forward to your thoughts on that.

All the best,
René

@gregorwolf
Copy link
Collaborator Author

Hi René,

I don't want to use cds-ts during runtime. I expect the CAP Documentation to provide the best practice about the build setup for a CAP Applicaiton that uses TypeScript and not just CDS Typer as mentioned in your first paragraph.

In the archived btp-full-stack-typescript-app example it's done in mta.yaml#L16 with npm run build:cf that is executing this scripts from the package.json:

    "build:cf": "npm run build:cds && npm run cleanup:ts && npm run build:ts",
    "build:ts": "tsc",
    "build:cds": "cds build --production",
    "cleanup:ts": "npx rimraf gen/srv/srv/**/*.ts",

Beside this also the tsconfig.json must be provided.

Hope that clarifies my request.

Best Regards
Gregor

@daogrady
Copy link
Contributor

daogrady commented Mar 7, 2024

Hi Gregor,

thank you for bringing this discrepancy to our attention!
You are right that the current state of the documentation leaves much to be desired and requires the user to figure out a lot by themselves.
We have started investigating how we can accommodate your use case with either tooling from our side or improved documentation. This might take some time as especially the (preferred) tooling approach poses some challenges we have to work out first. But we will get back to you asap.

Best,
Daniel

@Markus-Schroeder-de
Copy link

ass i found this typescript topic, i miss documentation about @impl with a typescript file. I ask, because i have a problem with @impl after upgrading to CAP8. in local dev (cds-ts) on startup it found automaticly the custom implementation, but after ugrading to CAP8 it didn't work in the BTP. we have to add @impl in the cds-file which point to the js-file (one ist TestService.cds, the other is TestService.ts, so we habe to add @impl: TestService.js) This is the workaround to get it running in the BTP, but then the cds-ts didn't start anymore, because while developing there is no TestService.js, only a TestService.ts.

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

No branches or pull requests

4 participants