Giter Club home page Giter Club logo

globs's Introduction

Project Title

Commitlint Tests Build Conventional Commits Commitizen friendly

Write a brief description of your project and what it aims to achieve.

Table of Contents

Getting Started

To use this project/template, follow the steps below:

Update the name and description in package.json and README.md to match your project.

Clone the repository to your local machine:

git clone https://github.com/benjaminrae/node-ts-jest-starter.git

Alternatively, you can click on the Use this template button to create a new repository using this template.

Navigate to the project directory:

cd your-repo

Install the dependencies using pnpm:

pnpm install

Customize the project according to your needs. Update the source code, configuration files, and other relevant files to match your requirements.

Start the development server:

pnpm start:dev

This command will run the application in development mode using Nodemon, allowing the server to automatically restart whenever changes are detected.

Write tests for your application and place them in the appropriate directories.

Run tests using the following command:

pnpm test

This command will execute the test runner (Jest) and display the test results.

Customize the linting rules and configurations as per your project requirements. Run the linting scripts to ensure code quality and consistency:

pnpm lint

This command will execute ESLint, Prettier, and Markdownlint scripts to check the code and documentation for linting errors.

Customize the provided CI workflows according to your needs. Configure the commitlint, build and test workflows, and add or modify other workflows as required.

When you're ready to commit your changes, use the following command to create a commit using Commitizen:

pnpm commit

This command will launch the Commitizen CLI, guiding you through the commit message creation process and ensuring a consistent commit message format.

Push your changes to the remote repository:

git push origin main

Linting

This template includes linting tools to maintain code quality and consistency:

  • ESLint: Lints JavaScript and TypeScript files.
  • Prettier: Enforces code formatting rules.
  • Markdownlint: Checks Markdown (*.md`) files for linting errors.

Feel free to customize the linting rules or configurations in .eslintrc.cjs, .editorconfig, .prettierrc.json and .markdownlint.json as per your project requirements.

See: ESLint | Editor Config | Prettier | Markdownlint

Testing

Your template uses Jest as the test runner.

Once you have written your first test, it's advisable to remove the --passWithNoTests flag from the test scripts in package.json.

Customize the testing setup in jest.config.cjs and write your tests according to your project needs.

See: Jest

Continuous Integration

Your template comes with 4 CI workflows that can be configured:

  • Commitlint: Checks commit messages against defined rules in commitlint.config.cjs. Commit messages must follow the Conventional Commits specification.
  • Build: Builds the project.
  • Test: Executes tests.
  • Audit: Linting and similar jobs.

Feel free to configure these workflows as needed or add additional workflows based on your project requirements.

Git Hooks

Your template uses Husky to set up the following Git hooks:

  • Pre-commit: Executes lint-staged and other checks before allowing commits.
  • Commit-msg: Validates commit messages using Commitlint.
  • Pre-push: Checks branch name and runs testing. Update the allowed branch names in .husky/pre-push as needed.
  • Post-merge: Installs dependencies if there are changes in pnpm-lock.yaml.

Feel free to customize the Git hooks based on your project requirements.

If using a Mac, you may need to give the hooks executable permissions using the steps here.

See: Husky | lint-staged | Commitlint

Commit Guidelines

The template uses Commitizen to enforce a consistent commit message format. Use the following script to create commits:

  • pnpm commit: Launches the Commitizen CLI to guide you through the commit message creation process.

Ensure that you follow the commit guidelines and maintain a clean commit history.

See: Commitizen | Conventional Commits | Commitlint

Package Manager

The template uses pnpm as the package manager. Make sure you have pnpm installed globally or use it with npx when running the scripts.

See: pnpm

Contributing

Explain how others can contribute to your project/template. You can include guidelines for submitting bug reports, feature requests, or pull requests. It's also helpful to mention the coding standards or guidelines you expect contributors to follow. Check out Contributor Covenant for help creating a code of conduct for your project.

License

Mention the license under which your project/template is released. If you're unsure about which license to choose, you can visit choosealicense.com for guidance. Make sure to include any additional terms or conditions specific to your project.

Available Scripts

In the project directory, you can run the following scripts:

pnpm start

Runs the application in production mode. It starts the Node.js server.

pnpm start:dev

Runs the application in development mode using Nodemon. Nodemon automatically restarts the server whenever changes are detected, making the development process more efficient.

pnpm test

Launches the test runner (Jest) to execute the tests. By default, it only shows test results for files that have changed since the last commit.

pnpm test:coverage

Generates test coverage reports using Jest. It provides detailed information about the code coverage of your tests.

pnpm test:dev

Runs the test runner in watch mode. It re-runs the tests whenever changes are detected, making it convenient for continuous testing during development.

pnpm build

Builds the TypeScript code into JavaScript, generating the compiled files in the dist directory.

pnpm build:dev

Builds the TypeScript code into JavaScript in watch mode. It automatically recompiles the code whenever changes are made.

pnpm clean

Deletes the dist directory, removing the previously built files.

pnpm rebuild

Combines the clean and build commands. It removes the dist directory and then builds the TypeScript code into JavaScript.

pnpm prettier

Formats the JavaScript, TypeScript, JSON, Markdown, and other supported files using Prettier.

pnpm prettier:check

Checks if the files need to be formatted according to Prettier's rules. It lists the files that differ from the expected formatting.

pnpm prettier:fix

Formats the files according to Prettier's rules and automatically fixes any formatting issues.

globs's People

Contributors

benjaminrae avatar

Watchers

 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.