Skip to content

Commit bdb75d8

Browse files
Merge pull request #2 from namecheap/feature/publish-package
ci: added publish package, commit hooks, update package versions
2 parents 4dfeb90 + 0d4e7d1 commit bdb75d8

File tree

15 files changed

+8707
-956
lines changed

15 files changed

+8707
-956
lines changed

.github/dco.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
require:
2+
members: false

.github/dependabot.yml

Lines changed: 0 additions & 8 deletions
This file was deleted.

.github/workflows/ci.yml

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
tags-ignore:
8+
- "**"
9+
pull_request:
10+
branches:
11+
- "**"
12+
13+
jobs:
14+
build:
15+
name: Build
16+
runs-on: ubuntu-latest
17+
18+
strategy:
19+
matrix:
20+
node-version: [16.x, 18.x, 20.x]
21+
22+
steps:
23+
- uses: actions/checkout@v4
24+
with:
25+
fetch-depth: 0
26+
- name: Use Node.js ${{ matrix.node-version }}
27+
uses: actions/setup-node@v4
28+
with:
29+
node-version: ${{ matrix.node-version }}
30+
cache: "npm"
31+
- run: npm ci
32+
- if: github.event_name == 'pull_request'
33+
name: Lint commit messages
34+
run: npx commitlint --from ${{ github.event.pull_request.head.sha }}~${{ github.event.pull_request.commits }} --to ${{ github.event.pull_request.head.sha }} --verbose
35+
- run: npm test
36+
publish:
37+
name: "Publish"
38+
needs: build
39+
runs-on: ubuntu-latest
40+
environment: npm_publish
41+
if: github.ref == 'refs/heads/master'
42+
steps:
43+
- uses: actions/checkout@v4
44+
- uses: actions/setup-node@v4
45+
with:
46+
node-version: 20.x
47+
cache: "npm"
48+
- run: npm ci
49+
- name: Publish new version
50+
env:
51+
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
52+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
53+
run: npx semantic-release

.github/workflows/test.yml

Lines changed: 0 additions & 22 deletions
This file was deleted.

.gitignore

Lines changed: 65 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,66 @@
1-
.nyc_output
1+
/.idea
2+
3+
# Logs
4+
logs
5+
*.log
6+
npm-debug.log*
7+
yarn-debug.log*
8+
yarn-error.log*
9+
10+
# Runtime data
11+
pids
12+
*.pid
13+
*.seed
14+
*.pid.lock
15+
16+
# Directory for instrumented libs generated by jscoverage/JSCover
17+
lib-cov
18+
19+
# my own test-results folder
20+
test-results
21+
22+
# Coverage directory used by tools like istanbul
223
coverage
3-
node_modules
24+
25+
# nyc test coverage
26+
.nyc_output
27+
28+
# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
29+
.grunt
30+
31+
# Bower dependency directory (https://bower.io/)
32+
bower_components
33+
34+
# node-waf configuration
35+
.lock-wscript
36+
37+
# Compiled binary addons (https://nodejs.org/api/addons.html)
38+
build/Release
39+
40+
# Dependency directories
41+
node_modules/
42+
jspm_packages/
43+
44+
# TypeScript v1 declaration files
45+
typings/
46+
47+
# Optional npm cache directory
48+
.npm
49+
50+
# Optional eslint cache
51+
.eslintcache
52+
53+
# Optional REPL history
54+
.node_repl_history
55+
56+
# Output of 'npm pack'
57+
*.tgz
58+
59+
# Yarn Integrity file
60+
.yarn-integrity
61+
62+
# dotenv environment variables file
63+
.env
64+
65+
# next.js build output
66+
.next

.husky/commit-msg

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
npx --no -- commitlint --edit $1

.husky/pre-commit

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
npm test

CONTRIBUTING.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# Contributing
2+
3+
## Commit messages
4+
5+
Your commit messages ideally can answer two questions: what changed and why. The subject line should feature the “what” and the body of the commit should describe the “why”.
6+
Commit format must follow [Conventional Commits
7+
spec](https://www.conventionalcommits.org/en/v1.0.0/)

commitlint.config.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
/**
2+
* @type {import('@commitlint/types').UserConfig}
3+
*/
4+
module.exports = {
5+
extends: ['@commitlint/config-conventional'],
6+
};

nyc.config.js

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
module.exports = {
2+
'check-coverage': true,
3+
lines: 90,
4+
statements: 90,
5+
functions: 90,
6+
branches: 90,
7+
watermarks: {
8+
lines: [85, 100],
9+
functions: [85, 100],
10+
branches: [85, 100],
11+
statements: [85, 100],
12+
},
13+
include: ['**/*.js'],
14+
exclude: ['node_modules', 'test-results', 'test/*', '**/*.spec.js', '*.config.js'],
15+
reporter: ['text', 'html', 'cobertura'],
16+
cache: false,
17+
all: true,
18+
'temp-directory': './test-results/coverage/.tmp',
19+
'report-dir': './test-results/coverage',
20+
};

0 commit comments

Comments
 (0)