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

crtemp

v1.1.5

Published

This cli app generates code templates

Downloads

2

Readme

crtemp

This cli app generates code templates

Instalation

Run npm install crtemp -g to install as a global dependency, Or npm install crtemp --D to install as a dev dependency in the working directory.

How it works

To use this app on the command line type npx crtemp. It will prompt for missing options. Acceptable options and their aliases are --git, --dep, --yes and -g, -d, -y. Their definitions are as follows:

  • --git: Initialize a git repository
  • --dep: Comfirms the installation of dependencies found in the generated package.json file
  • --yes: If this option is present, it skips all the prompt and generates the app using the default options. To select a template, type the template name without hyphens like so npx crtemp -y react-app. NB: Currently supported templates are express and react apps with their crtemp template names as express-app and react-app.

Contributing to the project

Adding Support for new templates

At the moment this package only supports 2 app niches (express-app and react-app) and can be found in the file config object. Adding support for various templates is very straight forward;

  • Update the constants.js file adding the new template name as a property. The constants.js file can be found at ./src/utils/constants.js
  • Append a new object to templates object in the file config object. The appended object should represent the new template root directory. See example below
  {
    "name": constants[new_template_name],
    "dirs": [],
    "files": []
  }

NB: The name prop is gotten from the constants object. If there be any need, a new folder should be created in the template files folder at ./src/templateFiles/. The contents of the folder should only be unique files relating to the new template (package.json, .env files), files not under this category should be represented by the file name in the files array of the new template object.

Generating template files

To generate files required it uses a file config object with set of rules to follow ->

  • The root directory object(signifying a folder) has name dirs and files properties
  • The name prop is the name of the folder
  • The files prop is an array containing a list of files represented by their filename and extention
  • The dirs array is a repetition of the root directory with its object and properties as well
  const config = {
    "templates": [
      {
        "name": 'express-app',
        "dirs": [
          {
            "name": "src",
            "dirs": [
              {"name": "configs"}
            ],
            "files": ["app.js"]
          }, 
          {
            "name": "test",
            "dirs": []
          }
        ],
        "files": [
          ".env", "package.json", "index.js"
        ]
      },
      {
        "name": constants.REACT,
        "dirs": [],
        "files": []
      }
    ]
  }