Skip to content

Commit af9e51f

Browse files
authored
chore(merge): ready for v2 (#45)
2 parents a759a1d + 3b398cc commit af9e51f

29 files changed

+869
-316
lines changed

.eslintrc.json

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,14 @@
22
"root": true,
33
"parser": "@typescript-eslint/parser",
44
"plugins": ["@typescript-eslint"],
5-
"extends": ["eslint:recommended", "plugin:@typescript-eslint/recommended"],
5+
"extends": [
6+
"eslint:recommended",
7+
"plugin:@typescript-eslint/recommended",
8+
"prettier"
9+
],
610
"rules": {
711
"@typescript-eslint/consistent-type-imports": "error",
12+
"@typescript-eslint/consistent-type-definitions": ["error", "type"],
813
"@typescript-eslint/no-unused-vars": [
914
"error",
1015
{
@@ -18,6 +23,8 @@
1823
"node_modules",
1924
"dist",
2025
"docs",
26+
"site",
27+
"wiki",
2128
"coverage",
2229
"test/dataset",
2330
"*.cjs"

.github/workflows/publish.yml

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
name: Publish
2+
3+
on:
4+
release:
5+
types: ["released"]
6+
7+
workflow_dispatch:
8+
inputs:
9+
version:
10+
description: "Version"
11+
type: string
12+
required: true
13+
14+
jobs:
15+
build_and_publish_wiki:
16+
name: Build and Publish GitHub Wiki
17+
runs-on: ubuntu-latest
18+
environment: Publish
19+
permissions:
20+
contents: write
21+
steps:
22+
- name: Checkout
23+
uses: actions/checkout@v3
24+
with:
25+
fetch-depth: 0
26+
- name: Setup Node.js
27+
uses: actions/setup-node@v3
28+
with:
29+
node-version: "lts/*"
30+
- uses: pnpm/action-setup@v2
31+
name: Install pnpm
32+
id: pnpm-install
33+
with:
34+
run_install: false
35+
- name: Get pnpm store directory
36+
id: pnpm-cache
37+
shell: bash
38+
run: |
39+
echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_OUTPUT
40+
- uses: actions/cache@v3
41+
name: Setup pnpm cache
42+
with:
43+
path: ${{ steps.pnpm-cache.outputs.STORE_PATH }}
44+
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
45+
restore-keys: |
46+
${{ runner.os }}-pnpm-store-
47+
- name: Install dependencies
48+
run: pnpm install
49+
- name: Build documentations
50+
run: pnpm exec concurrently "pnpm:build:docs:site" "pnpm:build:docs:wiki"
51+
- name: Publish GitHub Wiki
52+
uses: Andrew-Chen-Wang/github-wiki-action@v4
53+
with:
54+
commit-message: "chore(publish): GitHub Wiki for ${{ inputs.version || github.ref_name || github.sha }} [skip ci]"
55+
- name: Upload GitHub Pages Artifacts
56+
uses: actions/upload-pages-artifact@v2
57+
with:
58+
path: "site/"
59+
publish_pages:
60+
name: Publish GitHub Pages
61+
needs: build_and_publish_wiki
62+
runs-on: ubuntu-latest
63+
environment:
64+
name: github-pages
65+
url: ${{ steps.deployment.outputs.page_url }}
66+
permissions:
67+
pages: write
68+
id-token: write
69+
steps:
70+
- name: Setup GitHub Pages
71+
uses: actions/configure-pages@v3
72+
- name: Publish GitHub Pages
73+
id: deployment
74+
uses: actions/deploy-pages@v2

.github/workflows/release.yml

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -41,15 +41,3 @@ jobs:
4141
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
4242
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
4343
run: rm -rf dist && pnpm run pre-release && pnpm run semantic-release
44-
- name: Bump package version
45-
uses: peter-evans/create-pull-request@v5
46-
with:
47-
add-paths: |
48-
CHANGELOG.md
49-
package.json
50-
commit-message: "chore(release): bump version and update CHANGELOG.md [skip ci]"
51-
committer: "release-bot <[email protected]>"
52-
branch: release
53-
delete-branch: true
54-
title: "chore(release): bump version and update CHANGELOG.md [skip ci]"
55-
body: "This PR bumps the version in `package.json` and updates `docs/CHANGELOG.md`."

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,3 +102,7 @@ dist
102102

103103
# TernJS port file
104104
.tern-port
105+
106+
# TypeDoc generated documentations
107+
site/
108+
wiki/

.husky/pre-commit

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
#!/usr/bin/env sh
22
. "$(dirname -- "$0")/_/husky.sh"
33

4-
pnpm run lint && pnpm exec lint-staged
4+
pnpm run lint

.prettierignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
node_modules/
33
dist/
44
docs/
5+
site/
6+
wiki/
57
coverage/
68
test/dataset/
79
.editorconfig

.releaserc.json

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,17 +20,25 @@
2020
"noteKeywords": ["BREAKING CHANGE", "BREAKING CHANGES", "BREAKING"]
2121
},
2222
"writerOpts": {
23-
"commitsSort": ["subject", "scope"]
23+
"commitsSort": ["scope", "type", "subject"]
2424
}
2525
}
2626
],
27+
"@semantic-release/changelog",
28+
"@semantic-release/npm",
2729
[
28-
"@semantic-release/changelog",
30+
"@semantic-release/exec",
2931
{
30-
"changelogFile": "CHANGELOG.md"
32+
"prepareCmd": "pnpm run build:docs:md"
33+
}
34+
],
35+
[
36+
"@semantic-release/git",
37+
{
38+
"assets": ["package.json", "CHANGELOG.md", "docs/"],
39+
"message": "chore(release): release v${nextRelease.version} [skip ci]"
3140
}
3241
],
33-
"@semantic-release/npm",
3442
[
3543
"@semantic-release/github",
3644
{

README.md

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,18 @@
11
<h1 align="center">json-kit</h1>
22

33
<div align="center">
4+
<a href="https://www.npmjs.com/package/@kit-p/json-kit">
5+
<img
6+
src="https://img.shields.io/npm/v/%40kit-p/json-kit"
7+
alt="npm: @kit-p/json-kit"
8+
/>
9+
</a>
10+
<a>
11+
<img
12+
src="https://img.shields.io/github/languages/top/Kit-p/json-kit"
13+
alt="languages: github.com/Kit-p/json-kit"
14+
/>
15+
</a>
416
<a href="https://github.com/semantic-release/semantic-release">
517
<img
618
src="https://img.shields.io/badge/semantic--release-conventionalcommits-e10079?logo=semantic-release"
@@ -21,7 +33,7 @@
2133

2234
## Project State
2335

24-
> This project is in **early development** phase. The APIs are subject to change. Please do **NOT** use in production environments.
36+
> This project is in **maintenance** state. The APIs are stable.
2537
2638
## Installation
2739

@@ -73,10 +85,10 @@ import { JsonKit } from "@kit-p/json-kit";
7385
</script>
7486
```
7587

76-
## License
88+
## Usage
7789

78-
MIT
90+
See [the documentation site](https://kit-p.github.io/json-kit/modules.html) or [the repository Wiki page](https://github.com/Kit-p/json-kit/wiki/Exports) or `docs/modules.md`.
7991

80-
```
92+
## License
8193

82-
```
94+
[MIT](https://github.com/Kit-p/json-kit/blob/main/LICENSE)

docs/.gitkeep

Whitespace-only changes.

jest.config.mjs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,14 @@ const config = {
88
transform: {
99
"^.+\\.(c|m)?(t|j)sx?$": ["@swc/jest"],
1010
},
11+
coverageThreshold: {
12+
global: {
13+
branches: 100,
14+
functions: 100,
15+
lines: 100,
16+
statements: 100,
17+
},
18+
},
1119
};
1220

1321
export default config;

0 commit comments

Comments
 (0)