Comments (6)
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.
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.
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.
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.
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.
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)
- How to create a typed view in SAP UI5 typescript HOT 1
- Missing type definition for `sap.m.table.ColumnWidthController` HOT 4
- Wrong source type for generated type ODataModel$DataReceivedEvent HOT 1
- [ts-interface-generator] Provide a way to annotate control properties with a TS type (which might be narrower than the UI5 one)
- [ts-interface-generator] Check what happens when overridden setters and getters narrow down the type of a property
- @deprecated tag in TS Definitions should be on the last position HOT 2
- [ts-interface-generator] Interface for ManagedObject based Class Instances HOT 1
- [ts-interface-generator] Generate fully qualified module names in interface for seamless use with tsc declarations
- Productive use vs. undefined support status. HOT 3
- @sapui5/types 1.121.1, 1.121.2(?) and 1.122.1: 'JQuery' only refers to a type, but is used as namespace here. HOT 1
- Regression in @sapui5/types of 1.122.1 with tsconfig for wdi5 HOT 5
- Possible issue: too many classes are abstract? HOT 5
- `@sapui5/ts-types-esm` - `sap/ui/core/Core` is incorrectly exported as an instance instead of a class HOT 1
- i can't find a way to use typescript and the flp sandbox launchpad HOT 3
- Missing types for sap.ui.qunit.utils.nextUIUpdate and waitForThemeApplied HOT 8
- Folder structure of @sapui5/types is wrong HOT 7
- Error creating Singleton instance of sap.ushell.Container in SAPUI5 1.120.12 with TypeScript HOT 9
- Type 'import("sap/ui/core/Popup").Dock' is not assignable to type 'typeof Dock' (since UI5 1.115.0) HOT 1
- Typed Views with TS Seem Impossible HOT 5
- Inconsistent phrasing in @deprecated / @experimental tags HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ui5-typescript.