Code Monkey home page Code Monkey logo

ts-node-starter's Introduction

ts-node-starter

The ts-node-starter scaffolding project is a template repository which makes it easy for you to start a new Node.js project with TypeScript.

Using this template, you can build standalone apps, libraries and/or CLI tools. The ts-node-starter setup is configurable and comes with a lot of features included.

Features

  1. Changelog generation powered by generate-changelog
  2. Automatic code & config formatting powered by Lefthook
  3. Automatic dependency updates powered by Dependabot
  4. Config formatting powered by Prettier
  5. Code linting powered by ESLint
  6. Continuous integration powered by GitHub Actions workflows
  7. Dependency management powered by npm
  8. Unit testing powered by Vitest
  9. Code coverage powered by v8
  10. Code coverage reports powered by Codecov
  11. Type checking powered by TypeScript
  12. Streamlined scripts powered by Conventional Scripts
  13. Documentation generation powered by TypeDoc

Usage

Make it your own

  1. Replace all occurrences of "bennycode" with your own username (or organization name)
  2. Replace all occurrences of "ts-node-starter" with your project name (or repository name)
  3. Start writing your code in the "src" directory
  4. Run npm install and be happy! 😊

Build a standalone app

Source Code

If you just want to write and run a Node.js app, checkout "src/start.ts".

References

You can start your application by executing yarn start. If you want to debug your code, run yarn debug (Debug Instructions).

Build a Library

Source Code

If you want to distribute your code as a Node.js library on npm, you can have a look at "src/index.ts". If you build a library, I recommend to always ship an index file from where you export the code of your library for others.

References

In the "package.json" file you will also discover a "main" property which defines the entry point to your library when it gets imported by other developers. The value of the "main" property has to point to the transpiled JavaScript code.

Build a CLI

Source Code

If you want to build a CLI tool for Node.js, you can have a look at "src/cli.ts".

References

In the "package.json" file you will also discover a "bin" property which defines the executable name of your tool and the entry point to its transpiled JavaScript code.

If you don't want to publish a CLI, simply remove the "bin" property and the CLI script.

Conventions

Test Files

I recommend to colocate your test code with your source code by naming your test files *.test.ts.

Changelog Generation

The automatic changelog generation is based on Semantic Commit Messages. Simply use the suggested prefixes in your commit messages to make use of it. For example, if you commit a new feature use the "feat" prefix:

Commit Message:

feat: My new feature

If you are introducing a breaking change, add an exclamation mark (!) after the type or scope of your commit message:

Example:

refactoring!: Make file handlers asynchronous

This is as per breaking change definition of Conventional Commits 1.0.0.

Troubleshooting

If you're having trouble with the Git pre-commit hook, then reinstall the hook using the following command:

npx lefthook install --force

Source: Hooks don't run

Inspiring Templates

Other inspiring Node.js templates:

Important Refactorings

  1. Replaced EditorConfig with Prettier (2e24f7b)
  2. Replaced Jasmine with Jest (41e9b42)
  3. Replaced action-dependabot-auto-merge with Dependabot & GitHub CLI (86d5696)
  4. Replaced husky with Lefthook (9c41615)
  5. Replaced custom ESLint Config with a Shareable Config (eef5927)
  6. Replaced @types/jest with @jest/globals (73c5bc2)
  7. Replaced Yarn 1 with npm (153b726)
  8. Replaced pretty-quick with Prettier 3 (7623ba8)
  9. Replaced Jest with Vitest (662dddf)
  10. Replaced CommonJS with EcmaScript Modules (0cae631)
  11. Replaced imports with Vitest Globals (6b273c3)
  12. Replaced ts-node with tsimp (5db7e0c)

Contributors

Benny Neugebauer on Stack Exchange

Panayiotis Lipiridis on Stack Exchange

ts-node-starter's People

Contributors

bennycode avatar dependabot-preview[bot] avatar dependabot[bot] avatar lipis avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

ts-node-starter's Issues

Your .dependabot/config.yml contained invalid details

Dependabot encountered the following error when parsing your .dependabot/config.yml:

The property '#/update_configs/0/' contains additional properties ["ignore"] outside of the schema when none are allowed

Please update the config file to conform with Dependabot's specification using our docs and online validator.

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.