Skip to content

Commit 62ae623

Browse files
committed
feat: add attributions generation with pre-commit hook
1 parent dad41f1 commit 62ae623

7 files changed

Lines changed: 38040 additions & 1 deletion

File tree

.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 sh
2+
3+
node scripts/pre-commit-attributions.js

ATTRIBUTIONS.md

Lines changed: 37457 additions & 0 deletions
Large diffs are not rendered by default.

docs/ATTRIBUTIONS_GENERATION.md

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# Attributions Generation
2+
3+
This document explains how the automatic attributions generation works in this project.
4+
5+
## Overview
6+
7+
The project automatically generates an `ATTRIBUTIONS.md` file that contains:
8+
9+
- A thank you message to the open-source community
10+
- A list of all third-party dependencies from `package-lock.json`
11+
- Full license texts for each dependency
12+
13+
## Scripts
14+
15+
- `npm run generate-attributions`: Manually generate the attributions file
16+
- Pre-commit hook automatically runs when `package-lock.json` has changed
17+
18+
## Files
19+
20+
- `scripts/generate-attributions.js`: Main script that generates the attributions
21+
- `scripts/pre-commit-attributions.js`: Pre-commit hook logic
22+
- `.husky/pre-commit`: Husky pre-commit hook configuration
23+
- `ATTRIBUTIONS.md`: Generated attributions file (tracked in git)
24+
25+
## How it works
26+
27+
1. When you commit changes, the pre-commit hook checks if `package-lock.json` is in the staged files
28+
2. If it is (or if `ATTRIBUTIONS.md` is missing/outdated), it regenerates the attributions file
29+
3. The updated `ATTRIBUTIONS.md` is automatically staged and included in the commit
30+
4. This ensures the attributions file is always up-to-date with the current dependencies

package-lock.json

Lines changed: 17 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,9 @@
2929
"docs": "typedoc packages/sdk/src/index.ts --out docs --exclude '**/*.test.ts' --exclude 'packages/sdk/src/generated/**'",
3030
"docs:serve": "npx http-server docs -p 8080",
3131
"format": "prettier --write packages/*/src/**/*.ts",
32-
"format:check": "prettier --check packages/*/src/**/*.ts"
32+
"format:check": "prettier --check packages/*/src/**/*.ts",
33+
"generate-attributions": "node scripts/generate-attributions.js",
34+
"prepare": "husky"
3335
},
3436
"repository": {
3537
"type": "git",
@@ -68,6 +70,7 @@
6870
"eslint": "^9.31.0",
6971
"eslint-config-prettier": "^10.1.8",
7072
"eslint-plugin-prettier": "^5.5.3",
73+
"husky": "^9.1.7",
7174
"msw": "^2.10.4",
7275
"nx": "^21.3.5",
7376
"prettier": "^3.4.2",

0 commit comments

Comments
 (0)