Skip to content

Commit 2684d46

Browse files
committed
🎉 Initial commit
0 parents  commit 2684d46

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+11122
-0
lines changed

.editorconfig

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
root = true
2+
3+
[*]
4+
charset = utf-8
5+
indent_style = space
6+
indent_size = 2
7+
end_of_line = lf
8+
insert_final_newline = true
9+
trim_trailing_whitespace = true

.eslint-doc-generatorrc.js

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
// @ts-check
2+
3+
import { getDocsUrl } from './src/utils/get-docs-url.js';
4+
5+
const START_OPTIONS_LIST = '<!-- begin auto-generated rule options list -->';
6+
const END_OPTIONS_LIST = '<!-- end auto-generated rule options list -->';
7+
8+
/** @type {import('eslint-doc-generator').GenerateOptions} */
9+
export default {
10+
pathRuleDoc: './docs/{name}.md',
11+
ignoreConfig: ['flat/all', 'flat/recommended'],
12+
ruleDocSectionInclude: [
13+
'Rule Details',
14+
'Examples',
15+
'❌ Incorrect',
16+
'✅ Correct',
17+
'When Not To Use',
18+
'Options',
19+
'Version',
20+
'Implementation',
21+
],
22+
ruleDocSectionOptions: true,
23+
ruleDocTitleFormat: 'prefix-name',
24+
ruleDocNotices: [
25+
'deprecated',
26+
'requiresTypeChecking',
27+
28+
'description',
29+
30+
'fixableAndHasSuggestions',
31+
32+
'configs',
33+
'options',
34+
],
35+
urlRuleDoc(ruleName, _pathOfFileBeingEdited) {
36+
return getDocsUrl(ruleName)
37+
},
38+
postprocess(content, _pathOfFileBeingEdited) {
39+
const optionsListBeginIndex = content.indexOf(START_OPTIONS_LIST) + START_OPTIONS_LIST.length;
40+
const optionsListEndIndex = content.indexOf(END_OPTIONS_LIST);
41+
42+
const optionsList = content.slice(optionsListBeginIndex, optionsListEndIndex).trim();
43+
44+
if (optionsList.length !== 0) return content;
45+
46+
return content.slice(0, optionsListBeginIndex) + '\n\n_None_\n\n' + content.slice(optionsListEndIndex);
47+
}
48+
};

.gitattributes

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# Auto detect text files and perform LF normalization
2+
* text=auto eol=lf

.github/workflows/release.yml

Lines changed: 177 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,177 @@
1+
name: Build & Publish Release
2+
3+
on:
4+
release:
5+
types:
6+
- released
7+
- prereleased
8+
9+
concurrency:
10+
group: "release-${{ github.event.release.id }}"
11+
cancel-in-progress: true
12+
13+
permissions:
14+
id-token: write
15+
16+
jobs:
17+
sanity-checks:
18+
name: Sanity Checks
19+
permissions:
20+
id-token: none
21+
uses: ./.github/workflows/sanity-checks.yml
22+
23+
add-publishing-note:
24+
name: Add Publishing Note
25+
if: github.event.release != null
26+
runs-on: ubuntu-latest
27+
permissions:
28+
contents: write
29+
id-token: none
30+
concurrency:
31+
group: "release-editing-${{ github.event.release.id }}"
32+
steps:
33+
- name: "Update Release Title & Description"
34+
uses: actions/github-script@v8
35+
with:
36+
github-token: ${{ secrets.GITHUB_TOKEN }}
37+
script: |
38+
github.rest.repos.updateRelease({
39+
owner: context.repo.owner,
40+
repo: context.repo.repo,
41+
release_id: context.payload.release.id,
42+
name: context.payload.release.name + " (Building)",
43+
body: context.payload.release.body + "\n\n<!-- ACTIONS_REMOVE_AFTER_BUILD -->\n\n---\n\n> [!NOTE]\n> ### This release is currently being built.\n> Build artifacts will be added to this release once the build is complete. For now, you can watch the build progress from [its GitHub Actions page](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}).",
44+
})
45+
46+
build-and-publish:
47+
name: Build & Publish
48+
needs: [sanity-checks, add-publishing-note]
49+
runs-on: ubuntu-latest
50+
permissions:
51+
id-token: write
52+
packages: write
53+
contents: write
54+
steps:
55+
- name: Checkout
56+
uses: actions/checkout@v5.0.0
57+
with:
58+
fetch-depth: 0
59+
60+
- name: Setup Tools
61+
uses: tanstack/config/.github/setup@9286c261b7c25a2c0342e2a06510f9cd9e4512f6
62+
63+
- name: Set package.json Version Field to the Release's Tag
64+
uses: BellCubeDev/update-package-version-by-release-tag@v2
65+
with:
66+
ignore-semver-check: "true"
67+
68+
- name: Run Build
69+
run: pnpm run build
70+
71+
- name: PNPM Pack
72+
run: |
73+
pnpm pack
74+
75+
######################
76+
## ##
77+
## NPM Registry ##
78+
## ##
79+
######################
80+
81+
- id: publish-npm
82+
name: Publish to NPM Registry
83+
# Uses OIDC token to authenticate, so no need to set up a secret for this
84+
# This does restrict us to only using base `npm`, though 🙁
85+
run: |
86+
pnpm dlx npm publish --access public --registry https://registry.npmjs.org/ --tag ${{ github.event.release.prerelease && 'next' || 'latest' }} --provenance
87+
88+
- name: ON FAILURE - cat NPM debug log for "Publish to NPM Registry"
89+
if: always() && steps.publish-npm.outcome == 'failure'
90+
run: |
91+
echo "ACTIONS_ID_TOKEN_REQUEST_URL: $ACTIONS_ID_TOKEN_REQUEST_URL"
92+
echo "ACTIONS_ID_TOKEN_REQUEST_TOKEN is set: ${{ env.ACTIONS_ID_TOKEN_REQUEST_TOKEN != '' }}"
93+
echo ""
94+
echo ""
95+
cat ~/.npm/_logs/*.log || echo "No NPM log file found"
96+
97+
#################################
98+
## ##
99+
## GitHub Package Registry ##
100+
## ##
101+
#################################
102+
103+
- uses: jossef/action-set-json-field@v2.1
104+
name: "Change Package Name for GitHub Package Registry"
105+
with:
106+
file: package.json
107+
field: name
108+
value: "@${{ github.repository_owner }}/${{ github.event.repository.name }}"
109+
110+
- id: publish-gpr
111+
name: Publish to GitHub Package Registry
112+
env:
113+
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
114+
run: |
115+
pnpm dlx npm publish --access public --registry https://npm.pkg.github.com --tag ${{ github.event.release.prerelease && 'next' || 'latest' }} --provenance
116+
117+
- name: ON FAILURE - cat NPM debug log for "Publish to GitHub Package Registry"
118+
if: always() && steps.publish-gpr.outcome == 'failure'
119+
run: |
120+
echo "ACTIONS_ID_TOKEN_REQUEST_URL: $ACTIONS_ID_TOKEN_REQUEST_URL"
121+
echo "ACTIONS_ID_TOKEN_REQUEST_TOKEN is set: ${{ env.ACTIONS_ID_TOKEN_REQUEST_TOKEN != '' }}"
122+
echo ""
123+
echo ""
124+
cat ~/.npm/_logs/*.log || echo "No NPM log file found"
125+
126+
###########################
127+
## ##
128+
## Release Artifacts ##
129+
## ##
130+
###########################
131+
132+
- name: "Upload Files to Release"
133+
if: github.event.release != null
134+
uses: AButler/upload-release-assets@v3.0
135+
with:
136+
files: "*.tgz"
137+
repo-token: ${{ secrets.GITHUB_TOKEN }}
138+
release-id: ${{ github.event.release.id }}
139+
140+
- name: "Update Release Title & Description"
141+
if: github.event.release != null
142+
uses: actions/github-script@v8
143+
with:
144+
github-token: ${{ secrets.GITHUB_TOKEN }}
145+
script: |
146+
github.rest.repos.updateRelease({
147+
owner: context.repo.owner,
148+
repo: context.repo.repo,
149+
release_id: context.payload.release.id,
150+
name: context.payload.release.name.replace(/\s+\(Building\)$/, ''),
151+
body: context.payload.release.body.replace(/<!-- ACTIONS_REMOVE_AFTER_BUILD -->[\s\S]*$/, '') + "\n\n---\n\n##### Built successfully by [GitHub Actions run #${{ github.run_number }}](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}).",
152+
})
153+
154+
155+
note-release-build-failed:
156+
permissions:
157+
contents: write
158+
id-token: none
159+
name: "Note Release Build Failed"
160+
needs: [build-and-publish]
161+
if: failure() && github.event.release != null
162+
runs-on: ubuntu-latest
163+
concurrency:
164+
group: "release-editing-${{ github.event.release.id }}"
165+
steps:
166+
- name: "Update Release Title & Description"
167+
uses: actions/github-script@v7
168+
with:
169+
github-token: ${{ secrets.GITHUB_TOKEN }}
170+
script: |
171+
github.rest.repos.updateRelease({
172+
owner: context.repo.owner,
173+
repo: context.repo.repo,
174+
release_id: context.payload.release.id,
175+
name: context.payload.release.name.replace(/\s+\(Building\)$/, '') + " (Failed)",
176+
body: "> [!CAUTION]\n> ### This Release's Build Failed\n> The build for this release failed. You can see where and why the build failed in [its GitHub Action page](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}).\n\n---\n\n" + context.payload.release.body.replace(/<!-- ACTIONS_REMOVE_AFTER_BUILD -->[\s\S]*$/, ''),
177+
})
Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
name: Sanity Checks
2+
3+
on:
4+
workflow_call:
5+
workflow_dispatch:
6+
push:
7+
pull_request:
8+
9+
10+
jobs:
11+
tests:
12+
name: Tests
13+
runs-on: ubuntu-latest
14+
steps:
15+
- name: Checkout
16+
uses: actions/checkout@v5.0.0
17+
with:
18+
fetch-depth: 0
19+
20+
- name: Setup Tools
21+
uses: tanstack/config/.github/setup@9286c261b7c25a2c0342e2a06510f9cd9e4512f6
22+
23+
- name: Run Tests
24+
run: pnpm run test:lib
25+
26+
27+
28+
lint:
29+
name: Lint
30+
runs-on: ubuntu-latest
31+
steps:
32+
- name: Checkout
33+
uses: actions/checkout@v5.0.0
34+
with:
35+
fetch-depth: 0
36+
37+
- name: Setup Tools
38+
uses: tanstack/config/.github/setup@9286c261b7c25a2c0342e2a06510f9cd9e4512f6
39+
40+
- name: Run Lint
41+
run: pnpm run test:eslint
42+
43+
44+
45+
typecheck:
46+
name: Typecheck
47+
runs-on: ubuntu-latest
48+
steps:
49+
- name: Checkout
50+
uses: actions/checkout@v5.0.0
51+
with:
52+
fetch-depth: 0
53+
54+
- name: Setup Tools
55+
uses: tanstack/config/.github/setup@9286c261b7c25a2c0342e2a06510f9cd9e4512f6
56+
57+
- name: Run Typecheck
58+
run: pnpm run test:types
59+
60+
61+
62+
documentation:
63+
name: Check Auto-Generated Documentation
64+
runs-on: ubuntu-latest
65+
steps:
66+
- name: Checkout
67+
uses: actions/checkout@v5.0.0
68+
with:
69+
fetch-depth: 0
70+
71+
- name: Setup Tools
72+
uses: tanstack/config/.github/setup@9286c261b7c25a2c0342e2a06510f9cd9e4512f6
73+
74+
- name: Run Documentation Check
75+
run: pnpm run docgen:check
76+
77+
78+
79+
can-build:
80+
name: Ensure Project Can Build
81+
runs-on: ubuntu-latest
82+
steps:
83+
- name: Checkout
84+
uses: actions/checkout@v5.0.0
85+
with:
86+
fetch-depth: 0
87+
88+
- name: Setup Tools
89+
uses: tanstack/config/.github/setup@9286c261b7c25a2c0342e2a06510f9cd9e4512f6
90+
91+
- name: Run Build
92+
run: pnpm run build
93+
94+
- name: PNPM Pack
95+
run: |
96+
pnpm pack

.gitignore

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
2+
# See https://help.github.com/ignore-files/ for more about ignoring files.
3+
4+
# dependencies
5+
node_modules
6+
package-lock.json
7+
yarn.lock
8+
9+
# builds
10+
build
11+
coverage
12+
dist
13+
dist-ts
14+
*.tgz
15+
16+
# misc
17+
.DS_Store
18+
.env
19+
.env.local
20+
.env.development.local
21+
.env.test.local
22+
.env.production.local
23+
.next
24+
25+
npm-debug.log*
26+
yarn-debug.log*
27+
yarn-error.log*
28+
.history
29+
size-plugin.json
30+
stats-hydration.json
31+
stats.json
32+
stats.html
33+
.vscode/mcp.json
34+
.cursor/rules
35+
36+
*.log
37+
*.tsbuildinfo
38+
.angular
39+
.cache
40+
.idea
41+
.pnpm-store
42+
.svelte-kit
43+
.tsup
44+
.vinxi
45+
temp
46+
47+
vite.config.js.timestamp-*
48+
vite.config.ts.timestamp-*

.husky/pre-commit

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
#!/usr/bin/env pwsh
2+
3+
pnpm run docgen:check

.npmrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
provenance=true

.nvmrc

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

.vscode/settings.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"editor.detectIndentation": false,
3+
"editor.insertSpaces": false,
4+
"files.trimTrailingWhitespace": true,
5+
}

0 commit comments

Comments
 (0)