GithubHelp home page GithubHelp logo

isabella232 / generator-node-typescript-simple Goto Github PK

View Code? Open in Web Editor NEW

This project forked from alteryx/generator-node-typescript-simple

0.0 0.0 0.0 1.23 MB

An opinionated yeoman generator for node packages with typescript. Based on generator-node-typescript.

License: MIT License

JavaScript 88.91% TypeScript 11.09%

generator-node-typescript-simple's Introduction

TypeScript NodeJS Generator

This is a more opinionated and enterprise(closed-source) friendly version of generator-node-typescript. Thanks to ospatil for all his hard work!

Details

  • package.json scripts - simplified task runner.
  • yarn- package manager.
  • mocha - test framework.
  • chai- assertion library.
  • tslint- configured to use the airbnb styleguide with the following exceptions:
    • import-name rule disabled - js files are normally lowercase, class names are PascalCase. This is a recipe for this rule becoming a royal pain. Disabling it.
  • prettier- integrated with tslint for easy autoformatting.
  • enterprise(closed-source) friendly - package is private by default so you don't accidentally publish to public registry. Uses license-to-fail to automatically fail your build if it detects a license not on your white-list.
  • no global dependencies. Every dependency such as TypeScript and tslint is installed locally.

Usage

Make sure you have yeoman installed globally if you don't already.

yarn add global yo

Clone generator-node-typescript-simple and install its dependencies.

git clone https://github.com/alteryx/generator-node-typescript-simple.git
cd generator-node-typescript-simple
yarn

Create your new project directory somewhere and cd into it.

mkdir my-new-project
cd ny-new-project

Path to and run the app generator.

$yo path/to/repo/generator-node-typescript-simple/generators/app

That's it! Keep reading for more details if you are interested but at this point you are ready to get started. Take a look at the package.json scripts for more info.

What gets generated?

project/
├── lib/
├── package.json
├── README.md
├── src/
│   ├── greeter.ts
│   └── index.ts
├── test/
│   ├── greeter-tests.ts
│   └── index-tests.ts
├── tsconfig.json
├── tslint.json
├── license-config.json
└── yarn.lock

Options

--license - The package.json license

$yo node-typescript-simple --license MIT 

--author - The package.json author

$yo node-typescript-simple --author Bob 

Scripts

  "scripts": {
    "clean": "rimraf lib",
    "format": "prettier --write --single-quote \"{src,test}/**/*.ts\"",
    "lint": "tslint --force --project tsconfig.json --format verbose \"src/**/*.ts\"",
    "prepublish": "yarn run build && yarn licenses generate-disclaimer > licenses.txt",
    "build": "yarn run license-check && yarn run format && yarn run clean && yarn run lint && echo Using TypeScript && tsc --version && tsc --pretty",
    "debug": "node --inspect --inspect-brk ./lib/index.js",
    "test": "yarn run build && mocha --compilers ts:ts-node/register --recursive \"test/**/*-tests.ts\"",
    "test:nyan": "yarn run test -- --reporter nyan",
    "test:tap": "yarn run test -- --reporter tap",
    "coverage": "nyc --include=\"src/**/*.ts\" --reporter=text --reporter=html --reporter=lcov mocha --compilers ts:ts-node/register --recursive \"test/**/*-test.ts\"",
    "watch": "yarn run build -- --watch",
    "watch:test": "yarn run test -- --watch",
    "license-check": "license-to-fail ./license-config.js"
  }

You can generate a new class and test file at any point.

$yo path/to/repo/generator-node-typescript-simple/generators/classlib MyNewClass

Integration with VS Code

  • build, clean, lint, coverage, format and test tasks are all available through the Run Task option.

  • You can directly run currently open source file using task Run current file. I use ts-node to provide this functionality.

    TypeScript debugging in VS Code

generator-node-typescript-simple's People

Contributors

davidlivingrooms avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.