Professional Template with CI/CD-enabled, versioning with Semantic Release and Typedoc+VitePress documentation.
gitGraph
commit
branch develop
checkout develop
commit
commit
checkout main
merge develop
commit tag: "v1.0.0"
Core Infrastructure
- ☑️ Node.js + TypeScript
- ☑️ Vitest (Unit Testing)
- ☑️ Semantic Release
- ☑️ GitHub Actions CI/CD
- ☑️ GitHub Actions GitHub Pages
Quality Assurance
- ☑️ BiomeJS (Linting/Formatting)
- ☑️ Husky + Lint Staged
- ☑️ Commitlint + Conventional Commits
- ☑️ CodeQL Scanning
Project Scaffolding
- ☑️ Docs: Contribution Guide & Code of Conduct
- ☑️ Husky Git Hooks
- ☑️ Automated CHANGELOG.md with Semantic Release
- ☑️ TypeDoc + Vitepress for Documentation Site
Perfect for developers who need:
- Zero-config TypeScript library setup
- Automated docs with TypeDoc
- CI/CD pipeline with GitHub Actions
- Semantic versioning right out of the box
- Building npm packages
- Open source projects
- Enterprise-grade libraries
Workflow | Description | Trigger |
---|---|---|
0.test.yml |
Runs unit tests | Push/PR to main or develop |
1.create-pr.yml |
Creates or updates a pull request from develop to main |
Push to develop |
2.deploy-docs.yml |
Deploys documentation and coverage badge | After a successful release |
3.release.yml |
Generates changelog, tags, and releases | Push to main |
Show full workflow
---
config:
layout: dagre
theme: neutral
---
flowchart TD
A["Commit into branch develop"] --> B["Run Test workflow"]
B --> C{"Test OK?"}
C -- Yes --> D["Create/Update Pull Request to main"]
D --> E["Approve code review"]
E --> F{"Code Review And Test, OK?"}
F -- Yes --> G["Merge into branch main"]
G --> H["Run Release workflow"]
H --> I["Run semantic-release"]
I --> J["Generate changelog, Create new release and tag version"]
J --> K["Publish documentation to GitHub Pages"]
C -- No --> X["Fix code and commit again"]
F -- No --> Y["Fix PR or resolve issues"]
style A fill:#e3f2fd,stroke:#2196f3,stroke-width:2px,color:#444
style B fill:#fff3e0,stroke:#fb8c00,stroke-width:2px,color:#444
style C fill:#ffe0e0,stroke:#e53935,stroke-width:2px,color:#444
style D fill:#e8f5e9,stroke:#43a047,stroke-width:2px,color:#444
style E fill:#f3e5f5,stroke:#8e24aa,stroke-width:2px,color:#444
style F fill:#ffe0e0,stroke:#e53935,stroke-width:2px,color:#444
style G fill:#e8f5e9,stroke:#43a047,stroke-width:2px,color:#444
style H fill:#fff3e0,stroke:#fb8c00,stroke-width:2px,color:#444
style I fill:#e3f2fd,stroke:#2196f3,stroke-width:2px,color:#444
style J fill:#dcedc8,stroke:#7cb342,stroke-width:2px,color:#444
style K fill:#c8e6c9,stroke:#2e7d32,stroke-width:2px,color:#444
style X fill:#fbe9e7,stroke:#d84315,stroke-width:2px,color:#444
style Y fill:#fbe9e7,stroke:#d84315,stroke-width:2px,color:#444
npx degit heliomarpm/tsapp-template your-app
cd your-app
npm install
-
Replace template info:
- Update
name
anddescription
inpackage.json
- Set version to
0.0.0
inpackage.json
- Replace all references to
tsapp-template
andheliomarpm
inpackage.json
andREADME.md
- Delete
CHANGELOG.md
- Update
-
Configure GitHub repository:
- Enable GitHub Actions (Settings → Actions → General)
- Set up branch protection rules (optional)
- Configure GitHub Pages for documentation:
- Go to
Settings
→Pages
- In the
Build and deployment
section, under Source, selectDeploy from a branch
- Choose the
gh-pages
branch and the/ (root)
directory - Save the changes
- Access the public URL displayed on the same page to confirm the deployment
- Go to
This template uses semantic-release for automated version management and package publishing. Version numbers are determined automatically based on commit messages:
Commit Message | Release Type | Example Version |
---|---|---|
revert(scope): message |
Patch | 1.0.1 |
fix(scope): message |
Patch | 1.0.1 |
feat(scope): message |
Minor | 1.1.0 |
BREAKING CHANGE: message |
Major | 2.0.0 |
<type>(<scope>): <short summary>
│ │ │
│ │ └─⫸ Summary in present tense. Not capitalized. No period at the end.
│ │
│ └─⫸ Commit Scope: core|docs|config|cli|etc.
│
└─⫸ Commit Type: fix|feat|build|chore|ci|docs|style|refactor|perf|test
When a commit is pushed to main
branch:
- semantic-release analyzes commit messages
- Determines the next version number
- Generates changelog
- Creates a git tag
- Publishes the release to GitHub
Note: To trigger a release, commits must follow the Conventional Commits specification.
npm run lint
— run linter and fixernpm run format
— run formatternpm run test
— run unit testsnpm run test:c
— run unit tests with coveragenpm run commit
- run conventional commits checknpm run release:test
— dry run semantic releasenpm run docs:dev
— run documentation locallynpm run docs
— build documentation and deploy
- First time:
npx vitepress init
- Documentation code base:
npm run docs
ornpm run docs:dev
For GitHub Actions workflows to create, edit, and manage Pull Requests via API (GitHub CLI or REST) and perform operations like push, release, and deploy, you need to configure the appropriate repository permissions.
- Go to your repository's
Settings
→Actions
→General
- Go to section
Workflow permissions
- Set the permission level to
Read and write permissions
- Check on
Allow GitHub Actions to create and approve pull requests
- Click on "Save changes"
By default, the GITHUB_TOKEN token used in actions has read-only permissions. Enabling Read and write permissions allows you to create PRs, edit PRs, commit changes, and create tags/releases programmatically.
📌 Configuration alternatives
Replace the GITHUB_TOKEN
with:
🔐 Option 1 — Classic Personal Access Token (PAT)
✅ Required permissions:
repo
(for read and write access to repositories)workflow
(for interacting with GitHub Actions)
✅ Features:
- A single token can be used in any repository of the same user or organization
- Cannot restrict granular access to specific repositories or permissions (full access within the configured scope)
✅ How to use:
-
Create a Classic PAT in:
GitHub Settings → Developer Settings → Personal access tokens → Tokens (classic)
-
Enable the scopes:
repo
workflow
-
Save the token as a secret in the repository:
Settings → Secrets and variables → Actions
- Suggested name:
PAT_TOKEN
-
Reference in workflow:
env:
GITHUB_TOKEN: ${{ secrets.PAT_TOKEN }}
🔐 Option 2 — Fine-grained Personal Access Token (PAT)
✅ Required permissions:
Contents: Read and write
Actions: Read and write
Metadata: Read-only
- (Optional)
Bypass branch protections
if you want to allow direct push even on protected branches
✅ Features:
- Allows you to restrict access to specific repositories at the time of creation
- Controls permissions with more granularity and security
- Needs to explicitly mark which repositories it will have access to
- Can be used in multiple repositories if configured to allow access to those repositories during token creation (either by selecting "All repositories" or manually selecting multiple)
✅ How to use:
-
Create a Fine-grained PAT in:
GitHub Settings → Developer Settings → Personal access tokens → Fine-grained tokens
-
Set:
- Repositories: select all required or check "All repositories"
- Permissions:
Contents: Read and write
Actions: Read and write
Metadata: Read-only
- (Optional)
Bypass branch protections
-
Save the token as a secret in the repository:
Settings → Secrets and variables → Actions
- Suggested name:
PAT_TOKEN
-
Reference in workflow:
env:
GITHUB_TOKEN: ${{ secrets.PAT_TOKEN }}
Operation | GITHUB_TOKEN (read/write) |
Classic PAT | Fine-grained PAT |
---|---|---|---|
Create/Edit Pull Request | ✅ | ✅ | ✅ (Contents: RW ) |
Commit files to repository | ✅ (if no branch protection) | ✅ | ✅ |
Create releases and tags via API | ✅ | ✅ | ✅ |
Bypass branch protection | ❌ | ❌ | ✅ (if enabled) |
⚠️ Note:
The built-inGITHUB_TOKEN
in Actions respects all b>ranch protection rules, which prevents direct pushes to main if branch protection is configured.Using a PAT or adjusting branch protection are the recommended solutions when automations require higher permissions.
For security, it is best to use Fine-grained PATs whenever possible, with specific permissions for the repositories and actions required.
✅ Zero runtime dependencies
🔄 All devDependencies are pinned to latest stable versions
We welcome contributions! Please read:
Thank you to everyone who has already contributed to the project!
Made with contrib.nn.
If this project helped you in any way, there are several ways to contribute.
Help us maintain and improve this template:
⭐ Starring the repository
🐞 Reporting bugs
💡 Suggest features
🧾 Improving the documentation
📢 Share with others
💵 Supporting via GitHub Sponsors, Ko-fi, Paypal or Liberapay, you decide. 😉