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

@kieran-osgood/scribe

v0.4.1

Published

Scribe is a file templating CLI based on Mustache Templates.

Downloads

5

Readme

scribe

Bootstrap your common files with Mustache templates.


Quick Start

We can handle setup via built in commands to bootstrap out the initial config, you'll need to edit it to add in some of your domains file requirements before your first run (see below, or examples)

Install

npm i -D @kieran-osgood/scribe
pnpm i -D @kieran-osgood/scribe
yarn add -D @kieran-osgood/scribe
bun i -D @kieran-osgood/scribe

Initialise Config file

scribe init

Getting Started

A simple use-case is a creating a single file from a template, but each CLI run can be configured to output multiple files.

As an example, if you're creating a React Component, you can output test files, sub-component barrel files, storybook files etc.

Example

Given a config and scribe files in the root of the repository (See examples for this setup)

// scribe.config.ts -- this is the config file we'll read the settings from
import type { ScribeConfig } from '@scribe/config';

const config = {
  options: {
    rootOutDir: '.',
    templatesDirectories: ['./examples'],
  },
  templates: {
    // Keys within the templates object correspond to what interactive mode will display, or --template flag will accept 
    screen: {
      outputs: [
        {
          // the templateFileKey screen corresponds to the template `screen.scribe` shown below 
          templateFileKey: 'screen',
          output: {
            directory: 'examples/src/screens',
            fileName: '{{Name}}.ts',
          },
        },
        {
          // the templateFileKey screen corresponds to the template `screen.test.scribe` shown below 
          templateFileKey: 'screen.test',
          output: {
            directory: 'examples/src/screens',
            fileName: '{{Name}}.test.ts',
          },
        },
      ],
    },
  },
} satisfies ScribeConfig;

export default config;

// ./screen.scribe -- This is the template file that we will generate from
import * as React from 'react';

type {{Name}}Props = {}

function {{Name}}Screen() {
  return (
    <></>
  )
}

// ./screen.test.scribe -- This is the template file that we will generate from
describe('{{Name}}', function() {
  it('should ', function() {

  });
});

When you run the following command

# Interactive mode!
scribe

# Non-Interactive mode
scribe --template screen --name Login

# Partially Interactive mode - will prompt for additional args!
scribe --template screen 
# or
scribe --name Login

Note: you can either run in interactive mode, or pass the flags in directly, each of these commands allow you to get to the same end result

Given the above CLI run with the files and paths all setup appropriately, you should see the output of two files in the following directories

// ✅ File Created: `examples/src/screens/Login.ts`
import * as React from 'react';

type LoginProps = {}

function LoginScreen() {
  return (
    <></>
  );
}

// ✅ File Created: `examples/src/screens/Login.test.ts`
describe('Login', function() {
  it('should ', function() {

  });
});