Skip to content

Commit 9bdf61e

Browse files
committed
chore: add explicit formatting scripts
1 parent 99271a4 commit 9bdf61e

6 files changed

Lines changed: 109 additions & 92 deletions

File tree

.github/workflows/lint.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,9 @@ jobs:
3333
run: npm ci
3434

3535
- name: Run Format Check
36-
run: npm run format:ci
36+
run: |
37+
npm run format:ts:ci
38+
npm run format:src:ci
3739
3840
- name: Run Lint
3941
run: npm run lint:all

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
.vscode
77
node_modules/
88
.rslib/
9+
.clang-format
910
dist/
1011
src/build/
1112
src/node_modules/

package-lock.json

Lines changed: 20 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,10 @@
3636
"build:watch": "rslib build --watch",
3737
"lint:ts": "tsgo -p tsconfig.json --noEmit",
3838
"prepare": "npm run build:ci",
39+
"format:src": "node -e \"import('@node-3d/addon-tools').then((m) => m.cpclangformat())\" && clang-format -i \"src/cpp/*.cpp\" \"src/cpp/*.hpp\"",
40+
"format:src:ci": "node -e \"import('@node-3d/addon-tools').then((m) => m.cpclangformat())\" && clang-format --dry-run --Werror \"src/cpp/*.cpp\" \"src/cpp/*.hpp\"",
3941
"format:ts": "oxfmt -c ./oxfmt.config.ts --no-error-on-unmatched-pattern \"**/*.{js,jsx,ts,tsx}\"",
40-
"format:ci": "oxfmt -c ./oxfmt.config.ts --check --no-error-on-unmatched-pattern \"**/*.{js,jsx,ts,tsx}\""
42+
"format:ts:ci": "oxfmt -c ./oxfmt.config.ts --check --no-error-on-unmatched-pattern \"**/*.{js,jsx,ts,tsx}\""
4143
},
4244
"repository": {
4345
"type": "git",
@@ -56,7 +58,8 @@
5658
"oxlint": "1.72.0",
5759
"tslib": "2.8.1",
5860
"oxfmt": "0.57.0",
59-
"typescript": "6.0.3"
61+
"typescript": "6.0.3",
62+
"clang-format-node": "3.0.7"
6063
},
6164
"type": "module",
6265
"types": "dist/index.d.ts",

0 commit comments

Comments
 (0)