Skip to content

Commit 2479795

Browse files
feat: CI, format, and fix tests
1 parent 17ec885 commit 2479795

7 files changed

Lines changed: 55 additions & 7 deletions

File tree

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
name: Prettier Plugin PyWire
2+
3+
on:
4+
push:
5+
branches: ['main']
6+
pull_request:
7+
branches: ['main']
8+
9+
jobs:
10+
prettier-plugin-pywire:
11+
name: 'Prettier Plugin PyWire'
12+
runs-on: ubuntu-latest
13+
defaults:
14+
run:
15+
working-directory: .
16+
steps:
17+
- uses: actions/checkout@v4
18+
19+
- name: Install pnpm
20+
uses: pnpm/action-setup@v2
21+
with:
22+
version: 9
23+
24+
- name: Setup Node.js
25+
uses: actions/setup-node@v4
26+
with:
27+
node-version: '20'
28+
29+
- name: Install dependencies
30+
run: pnpm install --frozen-lockfile
31+
32+
- name: Run checks
33+
run: ./scripts/check
34+
35+
- name: Run coverage
36+
run: ./scripts/coverage

.prettierignore

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
README.md
2+
.github/
3+
*.lock
4+
pnpm-lock.yaml
5+
node_modules/
6+
dist/
7+
*.json

build.mjs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,12 @@
11
import { build } from 'esbuild'
22
import { existsSync, mkdirSync } from 'node:fs'
3-
import { dirname } from 'node:path'
43
import { fileURLToPath } from 'node:url'
54

65
const distDir = fileURLToPath(new URL('./dist', import.meta.url))
76
if (!existsSync(distDir)) {
87
mkdirSync(distDir, { recursive: true })
98
}
109

11-
const isWatch = process.argv.includes('--watch')
12-
1310
const commonOptions = {
1411
entryPoints: ['src/index.ts'],
1512
bundle: true,

src/utils/html-format.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,10 @@ type Placeholder = {
1414
original: string
1515
}
1616

17-
function protectPywireExpressions(html: string): { protected: string; placeholders: Placeholder[] } {
17+
function protectPywireExpressions(html: string): {
18+
protected: string
19+
placeholders: Placeholder[]
20+
} {
1821
const placeholders: Placeholder[] = []
1922
let counter = 0
2023

tests/fixtures/expected-basic.wire

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,7 @@ name = "World"
55

66
def greet():
77
return f"Hi {name}"
8-
---html---
8+
9+
--- html ---
10+
911
<div><p>{name}</p></div>

tests/fixtures/expected-directives.wire

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,7 @@
33
}
44

55
count = 1
6-
---html---
6+
7+
--- html ---
8+
79
<section><h1>{count}</h1></section>

tests/fixtures/expected-style.wire

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
---html---
1+
--- html ---
2+
23
<div class="box">
34
<style>
45
.box {

0 commit comments

Comments
 (0)