-
Notifications
You must be signed in to change notification settings - Fork 665
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
e2ecb46
commit 819d5bc
Showing
3 changed files
with
53 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
name: Publish JSR | ||
|
||
on: | ||
push: | ||
branches: | ||
- fresh-2.0 | ||
|
||
jobs: | ||
publish: | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: read | ||
id-token: write | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Install Deno | ||
uses: denoland/setup-deno@v1 | ||
with: | ||
deno-version: v1.x | ||
- run: deno run --allow-write --allow-read tools/pre_publish.ts | ||
- run: npx jsr publish |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import * as path from "@std/path"; | ||
import { DenoConfig } from "../src/dev/dev_app.ts"; | ||
|
||
const denoJsonPath = path.join(import.meta.dirname!, "..", "deno.json"); | ||
const denoJson = JSON.parse( | ||
await Deno.readTextFile(denoJsonPath), | ||
) as DenoConfig; | ||
|
||
const replaceLibs = ["preact", "preact-render-to-string", "@preact/signals"]; | ||
|
||
if (denoJson.imports) { | ||
for (const replace of replaceLibs) { | ||
const value = denoJson.imports[replace]; | ||
if (value === undefined) continue; | ||
|
||
// Remove url expansion imports. They are not neede with | ||
// `npm:` or `jsr:` prefixes. | ||
delete denoJson.imports[replace + "/"]; | ||
|
||
const match = value.match( | ||
/^https:\/\/esm\.sh\/((@\w+\/)?[^@\?]+)(@[^\?]+)?.*$/, | ||
); | ||
if (match !== null) { | ||
denoJson.imports[replace] = `npm:${match[1]}${match[3]}`; | ||
} | ||
} | ||
} | ||
|
||
await Deno.writeTextFile(denoJsonPath, JSON.stringify(denoJson, null, 2)); |