Skip to content

Commit

Permalink
update ci
Browse files Browse the repository at this point in the history
  • Loading branch information
huozhi committed Jan 18, 2025
1 parent a23fd3b commit 14b46f1
Show file tree
Hide file tree
Showing 2 changed files with 58 additions and 11 deletions.
18 changes: 7 additions & 11 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,18 +14,16 @@ jobs:
timeout-minutes: 5
strategy:
matrix:
node-version: [16]
node-version: [22]

name: Node ${{ matrix.node-version }}
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4.2.2

- uses: pnpm/action-setup@v2
with:
version: 7.24.3
- uses: pnpm/action-setup@v4

- name: Use Node ${{ matrix.node-version }}
uses: actions/setup-node@v3
uses: actions/setup-node@v4.1.0
with:
node-version: ${{ matrix.node-version }}
cache: 'pnpm'
Expand All @@ -48,14 +46,12 @@ jobs:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4.2.2

- uses: pnpm/action-setup@v2
with:
version: 7.24.3
- uses: pnpm/action-setup@v4

- name: Use Node ${{ matrix.node-version }}
uses: actions/setup-node@v3
uses: actions/setup-node@v4.1.0
with:
node-version: ${{ matrix.node-version }}
cache: 'pnpm'
Expand Down
51 changes: 51 additions & 0 deletions site/app/page.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
'use client'

import { Editor } from 'codice'
import { useState } from 'react'
import { highlight } from 'sugar-high'
import { useSearchParams } from 'next/navigation'

const CODE_QUERY_KEY = 'c'

const defaultCode = `\
import { useState } from 'react'
import { highlight } from 'sugar-high'
import { Editor } from 'codice'
const defaultText = 'console.log("hello world")'
export default function Page() {
const [code, setCode] = useState(defaultText)
return (
<div>
<Editor
value={code}
className='editor'
title='index.js'
highlight={text => highlight(text)}
onChange={(text) => setCode(text)}
/>
</div>
)
}
`

export default function Page() {
const searchParams = useSearchParams()
const codeQuery = searchParams.get(CODE_QUERY_KEY)
const initialCode = codeQuery ? atob(codeQuery) : defaultCode
const [code, setCode] = useState(initialCode)

return (
<div>
<Editor
value={code}
className='editor'
title='index.js'
highlight={text => highlight(text)}
onChange={(text) => setCode(text)}
/>
</div>
)
}

0 comments on commit 14b46f1

Please sign in to comment.