-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
c226dae
commit d554433
Showing
4 changed files
with
68 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
node_modules | ||
dist |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
# pkg-name |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,35 +1,65 @@ | ||
{ | ||
"name": "node-template", | ||
"name": "pkg-name", | ||
"type": "module", | ||
"version": "1.0.0", | ||
"version": "0.0.0", | ||
"packageManager": "[email protected]", | ||
"description": "", | ||
"author": "", | ||
"author": { | ||
"name": "眼圈发黑", | ||
"email": "[email protected]" | ||
}, | ||
"license": "MIT", | ||
"homepage": "https://github.com/yanquanfahei/pkg-name#readme", | ||
"repository": { | ||
"type": "git", | ||
"url": "git+https://github.com/yanquanfahei/pkg-name.git" | ||
}, | ||
"bugs": "https://github.com/yanquanfahei/pkg-name/issues", | ||
"keywords": [], | ||
"exports": { | ||
".": { | ||
"types": "./dist/index.d.ts", | ||
"require": "./dist/index.cjs", | ||
"import": "./dist/index.mjs" | ||
} | ||
}, | ||
"main": "index.js", | ||
"main": "./dist/index.mjs", | ||
"module": "./dist/index.mjs", | ||
"types": "./dist/index.d.ts", | ||
"files": [ | ||
"dist" | ||
"dist", | ||
"package.json", | ||
"README.md" | ||
], | ||
"engines": { | ||
"node": ">=16.11.0" | ||
}, | ||
"scripts": { | ||
"preinstall": "npx only-allow pnpm", | ||
"postinstall": "simple-git-hooks", | ||
"dev": "unbuild --stub", | ||
"build": "unbuild", | ||
"typecheck": "tsc --noEmit", | ||
"lint": "eslint --fix .", | ||
"lint": "eslint --fix", | ||
"prepublishOnly": "pnpm build", | ||
"release": "bumpp package.json --commit --push --tag && pnpm publish --access public" | ||
}, | ||
"devDependencies": { | ||
"@eye-socket/eslint-config-ts": "^0.0.2", | ||
"@types/node": "^18.13.0", | ||
"bumpp": "^9.0.0", | ||
"chalk": "^5.2.0", | ||
"eslint": "^8.34.0", | ||
"lint-staged": "^13.1.2", | ||
"simple-git-hooks": "^2.8.1", | ||
"typescript": "^4.9.5", | ||
"unbuild": "^1.1.1" | ||
"unbuild": "^1.1.1", | ||
"vitest": "^0.29.2" | ||
}, | ||
"simple-git-hooks": { | ||
"pre-commit": "pnpm lint-staged", | ||
"commit-msg": "node scripts/verify-commit.js" | ||
}, | ||
"lint-staged": { | ||
"*.{ts,js,json,json5}": "eslint --fix" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
// @ts-check | ||
import { readFileSync } from 'node:fs' | ||
import path from 'node:path' | ||
import chalk from 'chalk' | ||
|
||
const msgPath = path.resolve('.git/COMMIT_EDITMSG') | ||
const msg = readFileSync(msgPath, 'utf-8').trim() | ||
|
||
const commitRE = /^(feat|fix|docs|style|refactor|perf|test|build|ci|chore|release|merge)(\(.+\))?: .{1,50}/ | ||
|
||
if (!commitRE.test(msg)) { | ||
console.log() | ||
console.error( | ||
` ${chalk.bgRed.white(' ERROR ')} ${chalk.red( | ||
'invalid commit message format.' | ||
)}\n\n` + | ||
chalk.red( | ||
' Proper commit message format is required for automated changelog generation. Examples:\n\n' | ||
) + | ||
` ${chalk.green('feat(compiler): add \'comments\' option')}\n` + | ||
` ${chalk.green( | ||
'fix(methods): handle events on blur (close #28)' | ||
)}\n\n` + | ||
chalk.red(' See .github/commit-convention.md for more details.\n') | ||
) | ||
process.exit(1) | ||
} |