Skip to content
/ ts-package-boilerplate Public template

Minimal, opinionated boilerplate for a javascript library package or project using Typescript.

License

Notifications You must be signed in to change notification settings

filp/ts-package-boilerplate

Repository files navigation

ts-package-boilerplate

Minimal, opinionated boilerplate for a javascript library package or project using Typescript.

Features:

  • Typescript configuration
  • Yarn configuration including essential scripts
  • Opinionated linting setup based on ESLint and Prettier
  • Jest test configuration
  • Ready to publish to npm

Using this boilerplate:

  • Clone this repository:
$ git clone [email protected]:filp/ts-package-boilerplate.git my-project-name
$ cd my-project-name
  • Update package.json with your project name, author name, etc.
  • Install dependencies, and you're ready to go!
$ yarn

Workflow scripts:

build

Builds files under src/ into the build/ directory, using tsc -b .

$ yarn build

dev

Runs src/index.ts directly. Useful for executables, or quickly testing your work.

$ yarn dev

lint

Runs eslint . with the included prettier configuration against the project.

$ yarn lint

test

Runs jest . with the included jest configuration against the project. Test files are expected alongside the files they're testing, with a .test.ts suffix.

$ yarn test

You can also modify this command to only include, for example, a tests/ folder. Edit the test script in package.json:

{
  "scripts": {
    "test": "jest tests/"
  }
}

prepack

Runs linting, tests, and build, ahead of packaging the project for distribution (through e.g npm).

This is a lifecycle hook that you will likely not run directly, but will instead be called automatically during package publishing.

$ yarn prepack

Stuff

Contributions are welcome! Please open tickets or - ideally - pull requests with your suggestions.

About

Minimal, opinionated boilerplate for a javascript library package or project using Typescript.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published