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

@enrico.piccinin/create-node-ts-app

v1.1.9

Published

Creates a node app which uses Typescript

Downloads

10

Readme

create-node-ts-app

Creates a node app configured to use Typescript.

Node version

Requires Node version > v16.7.0

command to create an app

npx --yes @enrico.piccinin/create-node-ts-app <options>

Options

  • -a --appName (required): name of the app
  • -t --template (optional): template to be used (default: default template)
  • -v --verbose (optional): print logs for each step on the standardout (default: false)

templates

It is possible to specify a template to be used to create the app.

default template

npx --yes @enrico.piccinin/create-node-ts-app -a <app-name>

Scaffolds a simple Node app configured to use Typescript.

Provides a configuration for eslint and prettier.

Testing is based on the mocha and chai libraries.

Creates an src folder with an hallo.ts and its test hallo.spec.ts.

The package template

npx --yes @enrico.piccinin/create-node-ts-app -a <app-name> -t package

Scaffolds a Node app that can be published as a package on the public NPM registry.

Provides a configuration for eslint and prettier.

Testing is based on the mocha and chai libraries.

Creates an src folder with a package-core.ts file containing a sample of a function which is exported by the package via the index.ts file.

Make sure that "declaration": true is specified in the tsconfig.json file.

The exec-cmd template

npx --yes @enrico.piccinin/create-node-ts-app -a <app-name> -t exec-cmd

Scafolds a Node app that can be deployed on the public NPM registry and used as a command via npx.

Provides a configuration for eslint and prettier.

Testing is based on the mocha and chai libraries.

Creates an src folder with the following structure:

  • lib folder containing the command
  • core folder containing exec-command.ts which implements the logic to execute the command
  • core/internals folder containing the internals of the logic of the command

Notes for publishing

Make sure that:

  • the dist folder is removed from the .gitignore file
  • if the package name is scoped (e.g. @myorg/my-package) then the name of the package is specified in the package.json file like this: "name": "@myorg/my-package",
  • if the package is scoped you publish it with the command npm publish --access=public

The template mechanism

A Template is an Object that defines how to scaffold a project.

A Template has the following properties:

  • folders. This is an array of names of folders which have to be copied to the target project folder. The "to be copied" folder names must be names of folders contained in the "template-folders" folder of this project.
  • commands. An array of strings representing the commands that have to be created after the project folder has been created. The commands are exectued from within the project folder. Examples of such commands and "npm i ..." to load dependencies or "git init" to initialize a git repo.
  • customizeFunctions. An array of functions which are executed from within the project folder. Such functions receive the app name as parameter.
  • customizeFunctionIds. An array of Objects of type FunctionId (i.e. of type {module: string; functionName: string}). Each FunctionId identifies a function which is loaded and executed from within the project folder. Such functions receive the app name as parameter.