generated from sobird/npm-template
-
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
0 parents
commit e18721c
Showing
20 changed files
with
7,157 additions
and
0 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,11 @@ | ||
module.exports = { | ||
root: true, | ||
extends: [ | ||
'sobird/typescript.cjs', | ||
], | ||
rules: { | ||
'import/no-extraneous-dependencies': 'off', | ||
'import/no-unresolved': 'off', | ||
'no-restricted-syntax': ['error', 'ForInStatement', 'LabeledStatement', 'WithStatement'], | ||
}, | ||
}; |
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,45 @@ | ||
name: Continuous Integration | ||
|
||
on: | ||
push: | ||
branches: [ "master" ] | ||
pull_request: | ||
branches: [ "master" ] | ||
|
||
jobs: | ||
unit-test: | ||
strategy: | ||
matrix: | ||
platform: [ubuntu-latest, macos-latest, windows-latest] | ||
runs-on: ${{ matrix.platform }} | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
|
||
- name: Install pnpm | ||
uses: pnpm/action-setup@v4 | ||
with: | ||
version: 10 | ||
|
||
- name: Install Node.js | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version-file: .node-version | ||
registry-url: https://registry.npmjs.org/ | ||
cache: pnpm | ||
|
||
- name: Restore Cache | ||
id: dependencies-cache | ||
uses: actions/cache@v4 | ||
with: | ||
path: | | ||
**/node_modules | ||
key: ${{ runner.os }}-pnpm-${{ hashFiles('**/pnpm-lock.yaml') }} | ||
restore-keys: ${{ runner.os }}-pnpm- | ||
|
||
- name: Install Dependencies | ||
if: steps.dependencies-cache.outputs.cache-hit != 'true' | ||
run: | | ||
pnpm install | ||
- name: Build ☕️ | ||
run: pnpm run build |
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,67 @@ | ||
on: | ||
push: | ||
branches: | ||
- master | ||
workflow_dispatch: | ||
|
||
permissions: | ||
contents: write | ||
pull-requests: write | ||
|
||
name: release-please | ||
|
||
jobs: | ||
release-please: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: googleapis/release-please-action@v4 | ||
id: release | ||
with: | ||
# this assumes that you have created a personal access token | ||
# (PAT) and configured it as a GitHub action secret named | ||
# `MY_RELEASE_PLEASE_TOKEN` (this secret name is not important). | ||
token: ${{ secrets.MY_RELEASE_PLEASE_TOKEN }} | ||
# this is a built-in strategy in release-please, see "Action Inputs" | ||
# for more options | ||
release-type: node | ||
- name: Checkout | ||
if: ${{ steps.release.outputs.release_created }} | ||
uses: actions/checkout@v4 | ||
|
||
- name: Install pnpm | ||
if: ${{ steps.release.outputs.release_created }} | ||
uses: pnpm/action-setup@v4 | ||
with: | ||
version: 10 | ||
|
||
- name: Install Node.js | ||
if: ${{ steps.release.outputs.release_created }} | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version: 20 | ||
registry-url: https://registry.npmjs.org/ | ||
|
||
- name: Restore Cache | ||
if: ${{ steps.release.outputs.release_created }} | ||
id: dependencies-cache | ||
uses: actions/cache@v4 | ||
with: | ||
path: | | ||
**/node_modules | ||
key: ${{ runner.os }}-pnpm-${{ hashFiles('**/pnpm-lock.yaml') }} | ||
restore-keys: | | ||
${{ runner.os }}-pnpm- | ||
- name: Install Dependencies 🔧 | ||
if: ${{ steps.dependencies-cache.outputs.cache-hit != 'true' && steps.release.outputs.release_created }} | ||
run: | | ||
pnpm install | ||
- name: Build ☕️ | ||
if: ${{ steps.release.outputs.release_created }} | ||
run: | | ||
pnpm run build | ||
cd dist | ||
npm publish --access public | ||
env: | ||
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}} |
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,23 @@ | ||
# Logs | ||
logs | ||
*.log | ||
npm-debug.log* | ||
yarn-debug.log* | ||
yarn-error.log* | ||
pnpm-debug.log* | ||
lerna-debug.log* | ||
|
||
node_modules | ||
dist | ||
*.local | ||
|
||
# Editor directories and files | ||
.vscode/* | ||
!.vscode/extensions.json | ||
.idea | ||
.DS_Store | ||
*.suo | ||
*.ntvs* | ||
*.njsproj | ||
*.sln | ||
*.sw? |
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 @@ | ||
npx commitlint --edit $1 |
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 @@ | ||
npm test |
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 @@ | ||
20 |
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 @@ | ||
package-lock=false | ||
registry=https://registry.npmmirror.com/ |
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,3 @@ | ||
{ | ||
"bracketSpacing": false | ||
} |
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,48 @@ | ||
# Changelog | ||
|
||
## [1.2.0](https://github.com/sobird/npm-template/compare/v1.1.0...v1.2.0) (2025-02-17) | ||
|
||
|
||
### Features | ||
|
||
* clean entry file & update deps ([c225ac5](https://github.com/sobird/npm-template/commit/c225ac5c803ab269f8820d0ee68402718d62c270)) | ||
* support vitest unit test framework ([91f6cb3](https://github.com/sobird/npm-template/commit/91f6cb33e76271a71fb32e4e07c176a6c591e54a)) | ||
* use pnpm replace yarn ([784e5ff](https://github.com/sobird/npm-template/commit/784e5ff8394446f8865b1411ddf9b8a051288e44)) | ||
* use tsx run typescript ([29a6829](https://github.com/sobird/npm-template/commit/29a6829336088705c99acdb31bde680f3937c461)) | ||
|
||
|
||
### Bug Fixes | ||
|
||
* clean src dir ([7ae5d4f](https://github.com/sobird/npm-template/commit/7ae5d4f977a8b8fc9cdde9bd0cf88c1df86256bc)) | ||
* fixed hashFiles **/pnpm.lock to **/pnpm-lock.yaml ([4c24e87](https://github.com/sobird/npm-template/commit/4c24e87274b2b38df2dc83b919787934800658c2)) | ||
* replease-please Install Dependencies If Conditional ([11aa0ca](https://github.com/sobird/npm-template/commit/11aa0cadb0f205f22546fa991d3a0b883ebe2b12)) | ||
* use @rollup/plugin-terser repleace esbuild & add rollup-plugin-typescript2 ([737bddc](https://github.com/sobird/npm-template/commit/737bddc8216e2cea345026291758c26a1a8359c1)) | ||
|
||
## [1.1.0](https://github.com/sobird/npm-template/compare/v1.0.0...v1.1.0) (2024-04-17) | ||
|
||
|
||
### Features | ||
|
||
* auto release and publication to npm ([b88f8f5](https://github.com/sobird/npm-template/commit/b88f8f5f5a4cb172de549e1b2588a9f5e2d99866)) | ||
* npm publish workflow ([61bd56a](https://github.com/sobird/npm-template/commit/61bd56a7867f24146c73b728b7f96d5f899d159b)) | ||
* test release-please workflow ([4b140be](https://github.com/sobird/npm-template/commit/4b140be944adc15ac813600861dd8a22858049ad)) | ||
|
||
|
||
### Bug Fixes | ||
|
||
* test it ([1bc1009](https://github.com/sobird/npm-template/commit/1bc100937a469104dc57e1f7151d23a1bad5a8fa)) | ||
* test release-please workflow ([4561d26](https://github.com/sobird/npm-template/commit/4561d262c83d8572fae5e2f9c446c1b40cc6055c)) | ||
|
||
## 1.0.0 (2024-04-17) | ||
|
||
|
||
### Features | ||
|
||
* npm publish workflow ([61bd56a](https://github.com/sobird/npm-template/commit/61bd56a7867f24146c73b728b7f96d5f899d159b)) | ||
* test release-please workflow ([4b140be](https://github.com/sobird/npm-template/commit/4b140be944adc15ac813600861dd8a22858049ad)) | ||
|
||
|
||
### Bug Fixes | ||
|
||
* test it ([1bc1009](https://github.com/sobird/npm-template/commit/1bc100937a469104dc57e1f7151d23a1bad5a8fa)) | ||
* test release-please workflow ([4561d26](https://github.com/sobird/npm-template/commit/4561d262c83d8572fae5e2f9c446c1b40cc6055c)) |
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,21 @@ | ||
MIT License | ||
|
||
Copyright (c) 2024 sobird | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
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,52 @@ | ||
# npm-template | ||
Npm package template repository, designed to quickly start a front-end typescript project. | ||
|
||
[![npm][npm]][npm-url] | ||
[![Build Status][build-status]][build-status-url] | ||
[![Install Size][size]][size-url] | ||
|
||
<!-- Badges --> | ||
|
||
[npm]: https://img.shields.io/npm/v/@sobird/npm-template.svg | ||
[npm-url]: https://www.npmjs.com/package/@sobird/npm-template | ||
[build-status]: https://img.shields.io/github/actions/workflow/status/sobird/npm-template/release-please.yml?label=CI&logo=github | ||
[build-status-url]: https://github.com/sobird/npm-template/actions | ||
[size]: https://packagephobia.com/badge?p=@sobird/npm-template | ||
[size-url]: https://packagephobia.com/result?p=@sobird/npm-template | ||
|
||
## husky config | ||
```sh | ||
# install | ||
pnpm install --save-dev husky | ||
|
||
# husky init | ||
npx husky init | ||
``` | ||
|
||
## commitlint config | ||
```sh | ||
npm install --save-dev @commitlint/config-conventional @commitlint/cli | ||
echo "export default {extends: ['@commitlint/config-conventional']};" > commitlint.config.js | ||
|
||
echo "npx commitlint --edit \$1" > .husky/commit-msg | ||
``` | ||
|
||
## how to publish | ||
|
||
### 一 | ||
|
||
手动通过下面的命令,进行tag发布 | ||
|
||
```sh | ||
npm version --patch | ||
npm version --minor | ||
npm version --major | ||
``` | ||
|
||
### 二 | ||
|
||
通过 `release-please` 这个自动化Action进行发布,详见 `.github/workflows/release-please.yml` 配置 | ||
|
||
## 参考 | ||
|
||
* [约定式提交](https://www.conventionalcommits.org/zh-hans/v1.0.0/) |
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,5 @@ | ||
export default { | ||
extends: [ | ||
'@commitlint/config-conventional', | ||
], | ||
}; |
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 @@ | ||
// eslint-disable-next-line no-console | ||
console.log('hello, npm-template!'); |
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,47 @@ | ||
{ | ||
"name": "@sobird/npm-template", | ||
"version": "1.2.0", | ||
"description": "npm template", | ||
"type": "module", | ||
"main": "index.js", | ||
"scripts": { | ||
"build": "rollup -c --environment NODE_ENV:production", | ||
"eslint:fix": "eslint src --fix", | ||
"test": "echo \"husky test scripts\"", | ||
"lint:eslint": "eslint src --ext ts,js --report-unused-disable-directives --max-warnings 10", | ||
"preversion": "pnpm lint:eslint", | ||
"version": "git add -A .", | ||
"postversion": "git push && git push --tags", | ||
"postinstall": "echo \"postinstall\"", | ||
"prepare": "husky" | ||
}, | ||
"keywords": [ | ||
"npm", | ||
"npm-template", | ||
"typescript", | ||
"vitest", | ||
"rollup" | ||
], | ||
"author": "sobird", | ||
"license": "MIT", | ||
"devDependencies": { | ||
"@commitlint/cli": "^19.7.1", | ||
"@commitlint/config-conventional": "^19.7.1", | ||
"@rollup/plugin-commonjs": "^25.0.8", | ||
"@rollup/plugin-json": "^6.1.0", | ||
"@rollup/plugin-node-resolve": "^15.3.1", | ||
"@rollup/plugin-terser": "^0.4.4", | ||
"@types/node": "^20.17.19", | ||
"eslint-config-sobird": "^0.2.16", | ||
"glob": "^10.4.5", | ||
"husky": "^9.1.7", | ||
"rollup": "^4.34.7", | ||
"rollup-plugin-clear": "^2.0.7", | ||
"rollup-plugin-copy": "^3.5.0", | ||
"rollup-plugin-peer-deps-external": "^2.2.4", | ||
"rollup-plugin-typescript2": "^0.36.0", | ||
"tsx": "^4.19.2", | ||
"typescript": "^5.7.3", | ||
"vitest": "^3.0.5" | ||
} | ||
} |
Oops, something went wrong.