Skip to content

Typescript type definition generator for Frappe DocTypes

License

Notifications You must be signed in to change notification settings

NagariaHussain/frappe-types

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

21 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Frappe Typescript Type Generator

Typescript type definition generator for Frappe DocTypes.



Usage

To use the app, install it on your local development bench:

$ bench get-app https://github.com/nikkothari22/frappe-types

That's it.

Now whenever you create or update any DocType on your local machine, the app will generate .ts files under at the following path: app/types/<module_def>/<doctype_name>.ts.


Features

  1. Supports most Frappe field types
  2. Runs automatically whenever you save/update a DocType
  3. Adds JSDoc comments for every field in the interface

Example

Let's say you create a DocType in a module called "Project Management" called "Project" with the following fields:

image


The app will automatically create a file called Project.ts at the path <your_app_folder>/types/ProjectManagement/Project like this:

(Notice that spaces in the Module and DocType names will be removed)


image


Where can you use this?

If you are developing custom Frappe apps with a Frappe backend and a frontend single-page app using React/Vue/other frameworks, you can use this app to generate TypeScript definitions to be used in your frontend app.


What features will we add next?

  1. Support for Table fields. Currently defaults to any[]
  2. Ability to define path for types folder and select apps for which types are to be generated
  3. Looking at how to improve speed so that DocType saving does not take a lot of time.
  4. Adding a CLI option to run type generation on existing DocTypes without having to update them.

Maintainers

Maintainer GitHub Social
Nikhil Kothari nikkothari22 @nik_kothari22

License

MIT

About

Typescript type definition generator for Frappe DocTypes

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 98.5%
  • JavaScript 1.5%