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 🙏

© 2026 – Pkg Stats / Ryan Hefner

frey-codegen

v1.1.0

Published

Interactive CLI generator for file and folder templates with placeholder substitution.

Readme

fcode

CLI generator for file and folder templates.

Install and run

npm -D install frey-codegen

On startup the CLI:

  1. Reads fcode.config.json from the project root (required).
  2. Loads files from .fcode/.
  3. Asks for the destination folder, the template, prop values, and whether to create a new subfolder.
  4. Copies the chosen template to the destination, substituting prop values.

fcode.config.json

Configuration file in the project root. Required — without it the CLI exits with an error.

{
  "template_naming_style": "kebabcase",
  "include": ["src", "docs"]
}

| Parameter | Required | Description | | ------------------------ | -------- | ----------------------------------------------------------------------------------------------------------------------------------- | | template_naming_style | yes | Naming style used for the new subfolder's name (the "Create a new folder?" step). One of the styles from the formatters table below. | | include | yes | List of root-level folders the destination-folder picker is built from. Only these folders (and their subfolders) are offered as generation targets. |

If the style is unknown, the CLI exits with an error when trying to create the folder.

When the CLI walks the folders listed in include to build the destination-folder list, it always skips .git and anything matched by the project's root .gitignore.

Templates (.fcode/templates/)

Each template is a subfolder inside .fcode/templates/. The subfolder name is the template name shown in the selection list.

.fcode/
  templates/
    react-component/
      _props.json
      index.ts
      ui/
        [%PROPS.name|kebabcase%].tsx

When copying a template to the destination folder, the CLI recursively walks all files and directories of the template and:

  • renders [% ... %] placeholders both in file content and in file and folder names;
  • skips the _props.json file (it isn't copied — it's only used to describe props);
  • creates destination directories as needed.

Placeholder syntax

[% PROPS.<prop_name> %]
[% PROPS.<prop_name> | <formatter> %]
[% PROPS.<prop_name> | <formatter1> | <formatter2> %]
  • A placeholder is wrapped in [% %]; inner spaces are optional.
  • The only supported namespace is PROPS, followed by a dot and the prop name (PROPS.name, PROPS.myField, etc.).
  • The prop value can be piped through one or more formatters separated by |. Formatters are applied left to right, in sequence.
  • If a prop is unset or unknown, an empty string is substituted.
  • An unknown formatter is silently ignored (the value stays as-is at that step).

The name prop is always available, even if it isn't described in _props.json — the CLI asks for it with a separate "Name" question on every run.

Formatters

| Formatter | Example (myProp Name) | | ------------ | ------------------------ | | kebabcase | my-prop-name | | snakecase | my_prop_name | | camelcase | myPropName | | pascalcase | MyPropName | | uppercase | MYPROP NAME | | lowercase | myprop name |

Formatter names are case-insensitive (kebabcase, KebabCase, KEBABCASE are equivalent).

Example

index.ts:

export { [%PROPS.name|pascalcase%] } from "./ui/[%PROPS.name|kebabcase%]";

ui/[%PROPS.name|kebabcase%].tsx:

interface IProps { }

export const [%PROPS.name|pascalcase%] = ({ }: IProps) => {
  return <></>
}

With prop value name = "myButton" the result is:

index.ts
ui/my-button.tsx
// index.ts
export { MyButton } from "./ui/my-button";
// ui/my-button.tsx
interface IProps {}

export const MyButton = ({}: IProps) => {
  return <></>;
};

_props.json

An optional file in the root of a template folder. Describes additional props that the CLI will ask about via text questions before copying (on top of the always-available name).

{
  "myField": {
    "label": "Field description"
  }
}

Structure — an object where:

  • the key is the prop name, used in placeholders as PROPS.<key>;
  • the value is an object with fields:

| Field | Required | Description | | ------- | -------- | ------------------------------------------------------------------------------ | | label | no | The question text shown to the user. If not set, the prop name is used instead. |

If _props.json is missing or fails to parse, the CLI treats the template as having no additional props (only name is available).

Documentation

Full documentation with detailed examples and internals lives in docs/.