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

@scarafone/ynjs

v0.0.5

Published

Yet another template engine for Node JS

Downloads

1

Readme

YNJS

Yet another template engine Node JS

Problem

This utility is designed to quickly allow for templates to be generated and files, folder and skeleton structures to be copied and set up automatically.

The primary use case comes from modern frameworks which generally require a minimum set of files per object.

Let's take modern ReactJS, in a professional environment developers would be expected to when creating a component also create a test file, likely a messages file for translations, some sort of styling file, an index file for exporting and potentially others depending on the framework you are using.

So why create all these by hand each time you want to make a new page? Or a new component?

Another use case is to also help reduce developer time and overhead when dealing with these complex set ups and configurations. By using a template for something we can ensure that the task is accomplished in standardized and uniform way, ensuring easier maintainability in the future.

Why build another one?

Long story short, like all good things it's important to know how to do something and I felt like this would be a fun project to take on and challenge myself to make new tools, in order to increase my knowledge about making command line utilities along with Node applications in general. All experience is good experience, right?

Installation

<TODO: Add Steps For Installing>

Configuration

The recommend way to configure the utility is to provide a configuration JSON object. You may create a configuration folder and the application will automatically read from this location first.

Folder: ./.ynjs/config.json

This folder should be located at the root of your directory.

It is also possible to use flags and pass the information through the command line directly as well. The names for the object and the command line are the same, merely the formatting will slightly vary.

{
    // Templates are JS objects that describe the blueprint of how the 
    // process should be executed.
    "templates": "file://folder/where/templates/live",
}
// Template Files
/*
* A template file should be constructed at minimum like this. 
* There is a utility function of the command line that generate a template file
* for you at a target location to get you started.
*/
// TODO: Add Template File Utility Function

// TODO: Add Command Example

$ node .\ynjs\index.js create thing "./.ynjs/templates/" --templates="./.ynjs/templates" --config="./.ynjs/config.json"

$ node .\ynjs\index.js template lib-component "./.ynjs/templates/" --templates="./.ynjs/templates" --config="./.ynjs/config.json"

It is also possible to pass the config file location to the command line as well if you do not wish to add the new folder to your directory or have a shared configuration file you would like to use.

// TODO: Add Command Line Example For File Parsing

Fallbacks

If multiple locations are possible for configuration the utility will always read the configurations in this order:

  1. Config location passed in --config="//file/location/config.json"
  2. Explicit command line arguments
  3. Project File ./.ynjs/config.json

If the requirements of the program can not satisfied by one of these requirements then it will exit and return 0.

Usage

The idea is to provide a simple interface along with a straightforward way of setting up and configuring templates to be used for your project. We only try to be prescriptive in a few ways that matter in terms of set up, otherwise we want to remain un-opinionated about the things you can do with the templates themselves.

API

  • Help
    • --help running the help command will show the help prompt
  • Create
    • $0 create
    • Create is used to tell the system based on your configuration file
ynjs create