Skip to content

πŸš€ Kickstart your next Node.js package with this pre-configured TypeScript template. Get up and running in minutes!

License

Notifications You must be signed in to change notification settings

lehuygiang28/package-starter

Repository files navigation

Package Starter πŸš€

Kickstart your next Node.js package with this pre-configured TypeScript template. Get up and running in minutes!

✨ Features

  • TypeScript: Type-safe code with @tsconfig/recommended settings.
  • Jest: Write comprehensive tests with ease.
  • Biome: Maintain a consistent code style with automated linting and formatting.
  • rimraf: Easily clean your build directory.
  • release-it: Automatically generate release notes, tag ... and publish your release.
  • Built and signed via GitHub Actions: Create a GitHub release and your package will be published automatically.

πŸš€ Quick Start

You can quickly create a new repository from this template by clicking the Use this template button at the top of the repository page on GitHub.

Alternatively, you can use npx degit to scaffold a new project from this template:

  1. Scaffold the project:

    npx degit lehuygiang28/package-starter my-package
    cd my-package
  2. Install dependencies:

    npm install

You can also clone the repository manually:

  1. Clone the repository:

    git clone https://github.com/lehuygiang28/package-starter.git my-package
    cd my-package
  2. Install dependencies:

    npm install

🧰 Scripts

  • build: Builds the project
  • prepare: Prepares the project for publishing
  • test: Runs the tests
  • test:cov: Runs the tests with coverage
  • lint: Lints the code
  • lint:fix: Lints the code and fixes any errors
  • format: Formats the code
  • format:fix: Formats the code and fixes any errors
  • release: Releases the project
  • release:pre: Pre-releases the project

πŸ› οΈ Development Recommendations

πŸ“– Folder structures

Top-level directories

============================

Root directory of the package

package-starter
β”œβ”€β”€ .github                         # Github configurations
β”œβ”€β”€ .vscode                         # Visual Studio Code configurations
β”œβ”€β”€ example                         # Example usage of the package
β”œβ”€β”€ lib                             # Compiled JavaScript code
β”œβ”€β”€ node_modules                    # Node.js modules installed by npm or yarn
β”œβ”€β”€ src                             # Source code of the package
β”œβ”€β”€ test                            # Test files
β”œβ”€β”€ .editorconfig                   # Configuration file for code editor settings
β”œβ”€β”€ .gitignore                      # Files and folders to be ignored by Git
β”œβ”€β”€ .npmignore                      # Files and folders to be ignored by npm
β”œβ”€β”€ .release-it.json                # Configuration file for release-it, a tool for automating releases
β”œβ”€β”€ biome.json                      # Configuration file for Biome, a code formatter and linter
β”œβ”€β”€ jest.config.ts                  # Configuration file for Jest, a testing framework
β”œβ”€β”€ LICENSE                         # License file for the project
β”œβ”€β”€ package-lock.json               # Lockfile generated by npm, specifying the exact versions of installed packages
β”œβ”€β”€ package.json                    # Manifest file for the package, containing metadata and dependencies
β”œβ”€β”€ README.md                       # Readme file for the project
└── tsconfig.json                   # Configuration file for TypeScript

Subdirectories

============================

Subdirectories of the package

Github configurations

.
β”œβ”€β”€ ...
β”œβ”€β”€ .github                         # Github configurations
β”‚   β”œβ”€β”€ workflows                   # Github workflows
β”‚   β”‚   β”œβ”€β”€ build-and-test-pr.yml   # Workflow for building and testing pull requests
β”‚   β”‚   └── publish.yml             # Workflow for publishing the package
β”‚   β”œβ”€β”€ CODE_OF_CONDUCT.md          # Code of conduct for the project
β”‚   └── FUNDING.md                  # Information about funding the project
└── ...

Visual Studio Code configurations

.
β”œβ”€β”€ ...
β”œβ”€β”€ .vscode                         # Visual Studio Code configurations
β”‚   β”œβ”€β”€ extensions.json             # Recommended extensions for the project
β”‚   └── settings.json               # Project-specific settings for VS Code
└── ...

Example usage of the package

.
β”œβ”€β”€ ...
β”œβ”€β”€ example                         # Example usage of the package
β”‚   └── index.ts                    # Example script
└── ...

Compiled JavaScript code

Files compiled from TypeScript

.
β”œβ”€β”€ ...
β”œβ”€β”€ lib                             # Compiled JavaScript code
β”‚   β”œβ”€β”€ hello-world.d.ts            # TypeScript definition file for hello-world.js
β”‚   β”œβ”€β”€ hello-world.js              # Compiled JavaScript code for hello-world.ts
β”‚   β”œβ”€β”€ index.d.ts                  # TypeScript definition file for index.js
β”‚   └── index.js                    # Compiled JavaScript code for index.ts
└── ...

Node.js modules installed by node packages manager

All installed Node.js modules by run npm install or yarn install

.
β”œβ”€β”€ ...
β”œβ”€β”€ node_modules                    # Node.js modules installed by npm or yarn
β”‚   └── ...                         # All installed Node.js modules
└── ...

Source code of the package

Write your TypeScript code here

.
β”œβ”€β”€ ...
β”œβ”€β”€ src                             # Source code of the package
β”‚   β”œβ”€β”€ hello-world.ts              # TypeScript code for a hello world function
β”‚   └── index.ts                    # Main entry point of the package
└── ...

Test files

.
β”œβ”€β”€ ...
β”œβ”€β”€ test                            # Test files
β”‚   └── hello-world.test.ts         # Unit tests for hello-world.ts
└── ...

Configuration files

Configuration files for the package

.
β”œβ”€β”€ ...
β”œβ”€β”€ .editorconfig                   # Configuration file for code editor settings
β”œβ”€β”€ .gitignore                      # Files and folders to be ignored by Git
β”œβ”€β”€ .npmignore                      # Files and folders to be ignored by npm
β”œβ”€β”€ .release-it.json                # Configuration file for release-it, a tool for automating releases
β”œβ”€β”€ biome.json                      # Configuration file for Biome, a code formatter and linter
β”œβ”€β”€ jest.config.ts                  # Configuration file for Jest, a testing framework
β”œβ”€β”€ LICENSE                         # License file for the project
β”œβ”€β”€ package-lock.json               # Lockfile generated by npm, specifying the exact versions of installed packages
β”œβ”€β”€ package.json                    # Manifest file for the package, containing metadata and dependencies
β”œβ”€β”€ README.md                       # Readme file for the project
└── tsconfig.json                   # Configuration file for TypeScript

πŸ™Œ Contributing

Contributions are welcome! Please open an issue or submit a pull request if you have any suggestions or improvements.

License

MIT Β© LΓͺ Huy Giang

About

πŸš€ Kickstart your next Node.js package with this pre-configured TypeScript template. Get up and running in minutes!

Resources

License

Code of conduct

Stars

Watchers

Forks