npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

haystack-codegen

v0.27.0

Published

Project Haystack Core code generation tools

Downloads

8,171

Readme

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.