-
Notifications
You must be signed in to change notification settings - Fork 98
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat: JSR support * work * work * work * tweak * fmt * tweak * tweak * tweak * tweak * workaround
- Loading branch information
Showing
3 changed files
with
97 additions
and
0 deletions.
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,53 @@ | ||
name: Publish to JSR | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
|
||
env: | ||
DENO_UNSTABLE_WORKSPACES: true | ||
|
||
jobs: | ||
publish: | ||
runs-on: ubuntu-latest | ||
timeout-minutes: 30 | ||
|
||
permissions: | ||
contents: read | ||
id-token: write | ||
|
||
steps: | ||
- name: Clone repository | ||
uses: actions/checkout@v4 | ||
with: | ||
submodules: true | ||
|
||
- name: Set up Deno | ||
uses: denoland/setup-deno@v1 | ||
|
||
- name: Convert to JSR package | ||
run: deno run -A tools/convert_to_jsr.ts | ||
|
||
- name: Format | ||
run: deno fmt --check | ||
|
||
- name: Lint | ||
run: deno lint | ||
|
||
- name: Documentation tests | ||
run: deno test --doc client.ts mod.ts pool.ts client/ connection/ query/ utils/ | ||
|
||
- name: Build tests container | ||
run: docker-compose build tests | ||
|
||
- name: Run tests | ||
run: docker-compose run tests | ||
|
||
- name: Publish (dry run) | ||
if: startsWith(github.ref, 'refs/tags/') == false | ||
run: deno publish --dry-run | ||
|
||
- name: Publish (real) | ||
if: startsWith(github.ref, 'refs/tags/') | ||
run: deno 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{ | ||
"lock": false, | ||
"name": "@bartlomieju/postgres", | ||
"version": "0.17.2", | ||
"exports": "./mod.ts" | ||
} |
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,38 @@ | ||
import { walk } from "https://deno.land/[email protected]/fs/walk.ts"; | ||
import denoConfig from "../deno.json" with { type: "json" }; | ||
|
||
const STD_SPECIFIER_REGEX = | ||
/https:\/\/deno\.land\/std@(\d+\.\d+\.\d+)\/(\w+)\/(.+)\.ts/g; | ||
const POSTGRES_X_SPECIFIER = "https://deno.land/x/postgres/mod.ts"; | ||
const POSTGRES_JSR_SPECIFIER = `jsr:${denoConfig.name}`; | ||
|
||
function toStdJsrSpecifier( | ||
_full: string, | ||
_version: string, | ||
module: string, | ||
path: string, | ||
): string { | ||
/** | ||
* @todo(iuioiua) Restore the dynamic use of the `version` argument | ||
* once 0.214.0 is released. | ||
*/ | ||
const version = "0.213.1"; | ||
return path === "mod" | ||
? `jsr:@std/${module}@${version}` | ||
: `jsr:@std/${module}@${version}/${path}`; | ||
} | ||
|
||
for await ( | ||
const entry of walk(".", { | ||
includeDirs: false, | ||
exts: [".ts", ".md"], | ||
skip: [/docker/, /.github/, /tools/], | ||
followSymlinks: false, | ||
}) | ||
) { | ||
const text = await Deno.readTextFile(entry.path); | ||
const newText = text | ||
.replaceAll(STD_SPECIFIER_REGEX, toStdJsrSpecifier) | ||
.replaceAll(POSTGRES_X_SPECIFIER, POSTGRES_JSR_SPECIFIER); | ||
await Deno.writeTextFile(entry.path, newText); | ||
} |
b78c2a6
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No typecheck tests failure
This error was most likely caused by incorrect type stripping from the SWC crate
Please report the following failure to https://github.com/denoland/deno with a reproduction of the current commit
Failure log