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

ts-project-generator

v1.3.0

Published

Generates a TypeScript project template

Downloads

9

Readme

TypeScript Project Generator

This is a simple project to generate TypeScript project templates from the command line.
The tool is capable of generating the following templates:

  • Express Project
  • Static HTTP server
  • Console application

Installation

npm install -g ts-project-generator

Usage

ts-project [options] [project-name]

Options can be of the following project types:

  • --main (default) The tool generates a simple "hello world!" console application
  • --express The tool generates an express template
  • --static The tool generates a static HTTP server template

The view engine for express can be of the following types:

  • --pug (default) The view engine is set to pug (formerly known as jade)(Express only)
  • --ejs The view engine is set to EJS (Express only)
  • --hbs The view engine is set to HandleBars (Express only)

The stylesheets can be of the following types (only works on express / static project types):

  • --scss (default) The stylesheet is of type SCSS
  • --sass The stylesheet is of type SASS
  • --css The stylesheet is barebone CSS

The options can be of the following generic types:

  • --version Prints the version of the tool
  • --no-git The tool does not add a .gitignore file (automatically adds it by default)
  • --no-eslint The tool does not add a .eslintrc file (automatically adds it by default)
  • --javascript, --js The tool generates a JavaScript template instead of a TypeScript template

Example usage

ts-project landing-page --express --pug
cd landing-page
npm install

or

mkdir landing-page
cd landing-page
ts-project . --express --pug
npm install

Running

Once a project template is generated, the project is automatically configured to use Gulp.
To set it up, simply run npm install on the root project. This will automatically install all dependencies on all 3 projects (root, source, compressed binaries).

If you need to install any new dependencies, simply run npm install on the root directory.

Moreover, when you run npm start on the root directory, the template will make bin/main.js executable (chmod +x) and execute it. So you can either do npm start on the root directory or just execute it like any other executable (assuming you have the appropriate NodeJS installed) using ./bin/main.js.

Why this is better

The biggest advantage of this system is to separate the source code and the executable binaries as separate projects. This gives the project a root project to execute gulp tasks, build the binaries, etc, a source project containing the TypeScript code and any other assets in a prettified fashion and a 'binary' project contains all the assets in a minified and uglified fashion.

When it comes to production code, the project contained in the bin folder is distributed, which has all the code minifed and uglified, while debugging becomes easier with the project in the src folder, which has all the TypeScript code for type checking, prettified and all the bells and whistles.

License

This piece of code is distributed under the GNU GPLv3 License.
If you are using this software, please give due credits to the authors.