Falieson / 2018-typescript-module

ts-module w/ declarations, part of the starter-kit pack TGRStack

Home Page:http://www.TGRstack.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Typescript Module w/ Definitions (TGRStack)

TypeScript

Node

NPS friendly Commitizen friendly Semver friendly

About

This starter kit is a launching point for ts/js module development (not React). Running the build script compiles the typescript code into a distribution that is ready to be published to a registry like NPM, and can easily be consumed by other TS modules. This module is part of a collection of uniformly built starter-kits designed for large-scale application development with TypeScript, GraphQL, and React. Find these, articles, and examplse at www.TGRStack.com. Skip to the bottom for links to a series of tutorials that walkthrough the creation of this module.

Commands - READ THIS

* nps                   # Executes the module, watching for rebuilds.
* nps help              # Displays all available commands
* nps commit            # Creates a commit, don't use `git commit -m ...`
* nps build             # Builds the module
* nps lint              # Lint checks the module
* nps test              # Test checks the module

Features

Core

  • ๐Ÿš€ ES2018+ support syntax that is stage-3 or later in the TC39 process.
  • ๐Ÿ”ฅ Hot development restarts dev-server when your src changes
  • ๐ŸŽ› Preconfigured to support development and optimized production builds
  • ๐ŸŽถ typescript incremental returns reducing development bugs
  • ๐Ÿšฆ tslint configured for strict, consistent, code style

Tests

  • ๐ŸŽญ jest as the test framework.
  • ๐ŸŽญ ts-jest configured to test TS files, uses tsconfig.jest.json, and skip babel.

Build (w/ Webpack)

  • ๐Ÿ“ฆ All source is bundled using Webpack v4
  • ๐ŸŒŸ webpack for dev, prod, common
  • ๐Ÿšฆ ts-loader for compiling typescript
  • ๐Ÿ’ฆ babel-loader for additional polyfills (browser support)
  • ๐Ÿ˜Ž HappyPack
  • ๐Ÿค– Auto generated Vendor DLL for smooth development experiences
  • ๐Ÿƒ Tree-shaking

Utils

  • ๐ŸŽฎ nps node-package-scripts removes the limitation of package.json enabling JS & //comments . Modify /package-scripts.js and use nps <command> instead of npm run <command>.
  • ๐Ÿ™Œ commitizen to help us generate beautifully formatted and consistent commit messages.
  • ๐Ÿ˜น cz-emoji is a plugin for commitizen that adds emoji to the commit template.
  • ๐Ÿ† standard-version is a replacement for npm version with automatic CHANGELOG generation
  • โœ… commitlint validates commit messages to follow commitizen patterns

Getting started

To use the starter-kit to build your own ts-module run these commands:

git clone https://github.com/Falieson/2018-typescript-module.git my-project
cd my-project
rm -rf .git && git init
git commit -m "INIT'd w/ Falieson's 2018-typescript-module@SHA4985"
npm install
nps test
nps

Open package.json and reset following fields:

- name
- version ( It is recommended to start from 1.0.0 )
- description
- main ( "umd/typescript-lib-starter.js" => "umd/{name}.js" )
- repository.url
- author
- license ( use whatever you want )

Now go make some changes to src/index.ts to see the tooling in action.

Docs

References

About

ts-module w/ declarations, part of the starter-kit pack TGRStack

http://www.TGRstack.com


Languages

Language:JavaScript 88.2%Language:TypeScript 11.8%