Skip to content

Commit 38da730

Browse files
committed
prettier
1 parent e21539e commit 38da730

19 files changed

+579
-431
lines changed

.github/workflows/test.yml

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@ name: Tests
22

33
on:
44
push:
5-
branches: ["**"]
5+
branches: ['**']
66
pull_request:
7-
branches: ["**"]
7+
branches: ['**']
88

99
jobs:
1010
test:
@@ -22,11 +22,14 @@ jobs:
2222
uses: actions/setup-node@v4
2323
with:
2424
node-version: ${{ matrix.node-version }}
25-
cache: "npm"
25+
cache: 'npm'
2626

2727
- name: Install dependencies
2828
run: npm ci
2929

30+
- name: Check formatting
31+
run: npm run format:check
32+
3033
- name: Run tests
3134
run: npm test
3235

@@ -42,4 +45,3 @@ jobs:
4245
name: codecov-umbrella
4346
fail_ci_if_error: true
4447
verbose: true
45-

.husky/_/pre-push

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
#!/bin/sh
2+
# Generated via simple-git-hooks (run `npm install` or `npx simple-git-hooks` to enable locally)
3+
4+
if [ "$SKIP_SIMPLE_GIT_HOOKS" = "1" ]; then
5+
echo "[INFO] SKIP_SIMPLE_GIT_HOOKS is set to 1, skipping hook."
6+
exit 0
7+
fi
8+
9+
if [ -f "$SIMPLE_GIT_HOOKS_RC" ]; then
10+
. "$SIMPLE_GIT_HOOKS_RC"
11+
fi
12+
13+
npm run format:check

.husky/pre-push

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
#!/usr/bin/env sh
2+
3+
echo "Checking code format with Prettier..."
4+
npm run format:check
5+

.prettierignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
dist
2+
coverage
3+
node_modules
4+

.prettierrc.json

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"$schema": "https://json.schemastore.org/prettierrc.json",
3+
"singleQuote": true,
4+
"semi": true,
5+
"trailingComma": "all",
6+
"printWidth": 100
7+
}

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,7 @@ See [tests/README.md](./tests/README.md) for detailed test documentation.
155155
### OP_RETURN Format
156156

157157
Counterparty OP_RETURN messages are:
158+
158159
1. Encrypted with RC4 using the first input's transaction ID as the key
159160
2. Prefixed with "CNTRPRTY" (8 bytes)
160161
3. Followed by message type ID (1 or 4 bytes)
@@ -163,6 +164,7 @@ Counterparty OP_RETURN messages are:
163164
### Taproot Format
164165

165166
Taproot reveal transactions use witness scripts with envelope patterns:
167+
166168
- Generic envelope: `OP_FALSE OP_IF <data chunks> OP_ENDIF`
167169
- Ord/XCP envelope: `OP_FALSE OP_IF "ord" "xcp" <metadata> <content> OP_ENDIF`
168170

@@ -180,4 +182,3 @@ MIT
180182
- [Counterparty Protocol](https://counterparty.io/)
181183
- [GitHub Repository](https://github.com/CounterpartyXCP/TxParser)
182184
- [Issue Tracker](https://github.com/CounterpartyXCP/TxParser/issues)
183-

package-lock.json

Lines changed: 29 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: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,9 @@
1010
"test": "vitest run",
1111
"test:watch": "vitest",
1212
"test:coverage": "vitest run --coverage",
13-
"prepare": "npm run build",
13+
"format": "prettier --write .",
14+
"format:check": "prettier --check .",
15+
"prepare": "npm run build && npx simple-git-hooks",
1416
"prepublishOnly": "npm run build"
1517
},
1618
"keywords": [
@@ -42,12 +44,17 @@
4244
"@types/node": "^20",
4345
"@vitest/coverage-v8": "^4.0.5",
4446
"bitcoinjs-lib": "^7.0.0-rc.0",
47+
"simple-git-hooks": "^2.10.0",
48+
"prettier": "^3.3.3",
4549
"typescript": "^5",
4650
"vitest": "^4.0.5"
4751
},
4852
"files": [
4953
"dist",
5054
"README.md",
5155
"LICENSE"
52-
]
56+
],
57+
"simple-git-hooks": {
58+
"pre-push": "npm run format:check"
59+
}
5360
}

src/constants.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,4 +32,3 @@ export const MESSAGE_TYPES: Record<number, string> = {
3232
102: 'detach',
3333
110: 'destroy',
3434
};
35-

src/index.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/**
22
* Counterparty Transaction Parser
3-
*
3+
*
44
* This module provides utilities for parsing Counterparty protocol transactions
55
* from both OP_RETURN and Taproot reveal formats.
66
*/
@@ -32,4 +32,3 @@ export type {
3232
TaprootCommitPayload,
3333
UnknownPayload,
3434
} from './types';
35-

0 commit comments

Comments
 (0)