docs icon indicating copy to clipboard operation
docs copied to clipboard

Enhance TypeScript documentation regarding deployment

Open gregorwolf opened this issue 1 year ago • 7 comments

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

gregorwolf avatar Feb 28 '24 08:02 gregorwolf

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 avatar Mar 04 '24 12:03 renejeglinsky

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é

renejeglinsky avatar Mar 05 '24 18:03 renejeglinsky

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

gregorwolf avatar Mar 06 '24 11:03 gregorwolf

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

daogrady avatar Mar 07 '24 06:03 daogrady