maxtpham/extts

Definition Generator

madreason opened this issue · 12 comments

How did you generate definition files? And how did you fix errors? I use custom definitions generator with many documentation error patches.
Did you see similar project https://github.com/Dretch/typescript-declarations-for-ext?

About shared link, I have already used the generated file, but there are still a lot of missing from ExtJS with the generator, so why i decided to develop & share my own. Such as:

  • API document & comment: development team still have to keep IDE & ExtJS API reference side by side while developing => with my version you can forget ExtJS API document.
  • Strongly typed: about 30% of types only available by extracting from API document/comment directly; I don't like using TypeScript but still using any
  • ConfigInterface for ExtJS Class/Component: one of the most complexity & hard to remember of ExtJS is from configuration properties, you can see from my version of d.ts
  • and much more: what you can find from ExtJS API document, you can find it directly from .d.ts within your favourite IDE

For handling errors, a lot of hard coded rules has been applied to my generator, with many tries/fixes & validations until final version with nearly 90-99% match with ExtJS API document.

Do you have a public generator repository?

Echoing the above comment, I'd love to see your generator. I really enjoy the embedded comments, and would love to implement a few features: like correcting the generation of automatic getters and setters for properties.

I have just publish the source, so welcome everyone to look into this and make a pull request to make the def better for the community.

How to use the generator? I compiled the project (by removing the test project in solution) but I'm confused from the readme.

I want to generate typings for Ext 3.4. I have ran jsduck to create the docs (by fixing a few files in the Ext source to make jsduck finish its job).
What should I do next?

btw, thanks to taking the effort to create this and share it to the community. 🌷

Hi Unional,

Thank you for interesting in my repo!

You are now at the step 1.
Next you go to step 2 -> 4:
Step2. Copy all ExtJS source to jsduck\src\classic & jsduck\src\modern (under ExtJS/src/: packages, classic, modern)

By going to 1.src, then create a new folder called ext-x.x.x
get a zip from 4.2.1 to see the structure of sourcecode should be copied from Ext source
then follow the remaining step to complete.

Note that. the version 3 does not support, so you should see from the sourcecode by generating 4.2 then change some LOC or arguments to make it work.

Good luck!

Copy all ExtJS source to jsduck\src\classic & jsduck\src\modern (under ExtJS/src/: packages, classic, modern)

Where should the jsduck\src\classic & jsduck\src\modern locate?

Under c2.tool.ExtTS\bin\Debug\? or somewhere else? Or they should be under the generator\ folder?

For 3.2/3.4, ExtJS were not organized under classic and modern. The src folder look like this:

src
- adapter
- core
- data
- dd
- direct
- ext-core
  - examples
  - src
    - adapter
      - ...
      - ext-base-begin.js  // <-- have to comment this out as it is not well formed JS
      - ext-base-dom.js
      - ext-base-end.js  // <-- have to comment this out as it is not well formed JS
      - ...
    - core
    - data
    - util
  - test
- locate   // <-- I have to remove this to make jsduck work
- state
- util
- widgets

Also, when you run jsduck, do you do jsduck ext/src --export=full --output docs?
I looked at https://github.com/Dretch/typescript-declarations-for-ext and it does that to generate json file.

Oh, also:

  1. Execute AS ADMIN ts\jsduck\classic.cmd & ts\jsduck\modern.cmd => check result at jsduck\out

I don't see any ts/jsduck/classic.cmd or modern.cmd in the repo.

I uploaded the template cmd file to 1.src for your reference.

and also updated the README.md, but there are still something differ to what i have done locally sometimes ago.

Sorry for that, it's been a while that i have not touched, please try to figure out and let me know what should I update to README to help others :(

Hope this help!

For the cmd, I was able to produce some doc with my Ext3.2 but the c2.tools.ExtTS.exe throws an exception.

As I look into it, and try to produce 6.0.2 as an example (using the src.zip provided), it errors with:

..\0.tools\jsduck-6.0.0-beta.exe ext-6.0.2-classic\src --output ..\2.docs\ext-6.0.2-classic
> Error: Please specify some input files, otherwise there's nothing I can do :(

I tried pointing to ext-6.0.2-classic\src and ext-6.0.2-classic but both doesn't work.

The error I am having with ext 3.2 is that is there is no Versions.html generated.

Still trying to figure out exactly how it works.

Right now I'm trying to create typings for 6.0.2 so that if the typings I generate is the same as https://github.com/thanhptr/extts/blob/master/ext-6.0.2-classic.d.ts , I know I'm doing the right thing.

But so far I'm still not able to do so.

I assume the provided src.zip contains an example of the folders for each example framework that is used to generate the typings in the repo. e.g. /generator/1.src/ext-6.0.2-classic/src.zip captures the folder structure of the source needed to generate /ext-6.0.2-classic.d.ts.

Here is what I thought I should be doing:

  • Create folder 1.src/ext-6.0.2-classic
  • From ExtJS 6.0.2, copy the following:

ext-6.0.2/classic/classic/src/* -> 1.src/ext-6.0.2-classic/*
ext-6.0.2/packages/**/src/* -> 1.src/ext-6.0.2-classic/* (e.g. ext-6.0.2/packages/charts/src/* -> 1.src/ext-6.0.2-classic/*)

Questions:

  • where does the theme/touchsizing come from? I can't find it anywhere from the source.
  • should I do something with the overrides folders (e.g. ext-6.0.2/classic/classic/overrides)?

By the way, would it be better to generate one file for each package, as well as classic and modern, be a better way to go?
So user can pick and choose which typings to use.