Git Product home page Git Product logo

haystack-codegen's Introduction

GitHub Workflow Status GitHub

Haystack Core Code Generation Tools

This project is classed as experimental!

Generates TypeScript code for haystack-core using haystack 4 defs.

APIs

Please click here for the API documentation.

Def docs

Please click here for the generated typedoc information for all defs.

Installation

npm install haystack-codegen

Or to install globally...

npm install haystack-codegen --global

Use

Use the -t option to specify a space separated list of tags. For example, to create all the TypeScript code for a site and ahu tag...

defcodegen -t site ahu

If you want to generate TypeScript for all of the tags in a defs database run...

defcodegen -t *all*

Tip: try running typedoc on the generated code for some nice looking HTML documentation!

Generating a file

The tool runs relative to the directory it is run in. The default generated file path is ./src/haystack/types.ts. An alternative file can be specified via the -f option...

defcodegen -t site ahu -f ./src/foo/bar.ts

Specifying the defs

The tool uses defs to generate TypeScript code. The defs database can be specified in a number of ways. By default...

  • The tool looks for the FIN_HOME environment variable. If found, the defs will be compiled from the $FIN_HOME/lib/pod directory.
  • The tool looks for the FAN_HOME environment variable. If found, the defs will be compiled from the $FAN_HOME/lib.fan directory. In this scenario only POD files that start with ph will be used.
  • As a last resort, the tool will fallback to the def library embedded into haystack-codegen. Please note, this library could easily become out of date quickly.

Loading defs from a server

Due to the dynamic nature of defs, the most commonly used way is to load defs from a running server.

Ensure server authentication is disabled when doing this (for FIN/SkySpark use the -noAuth option on start up).

For instance, to generate the TypeScript code for the site tag from a server's demo project...

defcodegen -t site -u http://localhost:8080/api/demo

Help

For more information on command line options run defcodegen --help.

haystack-codegen's People

Contributors

garethj2 avatar

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.