Giter Site home page Giter Site logo

Comments (6)

bd82 avatar bd82 commented on September 17, 2024

Hello @rg1

This project is used to generate the TypeScript signatures for some UI5 Libraries, which are then published on npm.

So most users are expected to consume the types from those npm packages and not use the low level generator directly.

I don't know how to generate the UI5 api.json files, nor do I know if you could use the dts-generator for 3rd party libraries.
What I do know is how to download these api.json directly from the OpenUI5 SDK.
See: - https://github.com/SAP/ui5-typescript/blob/master/test-packages/openui5-snapshot-test/package.json#L22

from ui5-typescript.

rg1 avatar rg1 commented on September 17, 2024

Hello Shahar,

I know that most users will probably just consume the ts-types package. However, I'm trying to replicate what you're doing here to maybe push the boundaries some more ;) So while I did figure out that the tests include a script that properly calls jsonToDTS, I missed the script that downloads the inputs. Thank you for pointing me at it. Ultimately I believe it would be most useful if you could publish the full setup required to build the ts-types package. Still I'm thankful for what's here already 👍

Rolf

from ui5-typescript.

bd82 avatar bd82 commented on September 17, 2024

Ultimately I believe it would be most useful if you could publish the full setup required to build the ts-types package

I don't actually know the full setup, that is something that happens deep inside the UI5 build systems, unlikely to even be based around nodejs tech stack even...

Maybe @petermuessig or @matz3 can help?

from ui5-typescript.

codeworrior avatar codeworrior commented on September 17, 2024

that is something that happens deep inside the UI5 build systems, unlikely to even be based around nodejs tech stack even

Exactly. Once we're done with our migration to the ui5-tooling, we'll also document this step in more detail.

from ui5-typescript.

akudev avatar akudev commented on September 17, 2024

After a loong time, I can answer the original question: just run ui5 build jsdoc in a UI5 library project with the ui5.yaml file properly describing the library, then the resulting api.json file will be below dist/test-resources/_library_/_path_/_and_/_name_/designtime.

The JSDoc build will fail when there is not a copyright notice at the beginning of each JS file (leading comment starting with /*!), so you might need to add it.

When the library itself is written in TypeScript (e.g. https://github.com/SAP-samples/ui5-typescript-control-library), then the ui5.yaml usually uses the transpilation target directory as src directory, so the transpilation has to be done first (in this case with npm run build:ts) and the result will be in dist/test-resources/com/myorg/myUI5Library/designtime.
But then again, transpiling TypeScript libraries to JavaScript, just to generate a TypeScript type definition again is a bit odd. :-) The ui5-tooling-transpile has an option to directly generate *.d.ts files. However, you might have other reasons to generate an api.json file, so I am mentioning this here nevertheless.

In case of TS libraries, there is currently a problem in the babel-preset-transform-ui5 package, which removes the copyright statement, but this has been fixed (fix will be in the next release of this plugin over the next few days).

I think this answers the original question. This does not enable the end-to-end flow yet, as the current version of the dts-generator is not published , but we are working on this part as well.

from ui5-typescript.

akudev avatar akudev commented on September 17, 2024

In addition to the comment above about building api.json, the new version of the dts-generator is now also published (sources and on npm).
See https://www.npmjs.com/package/@ui5/dts-generator and https://github.com/SAP/ui5-typescript/blob/main/packages/dts-generator/docs/end-to-end-sample.md which describes both parts.

So this issue is resolved.

from ui5-typescript.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.