Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Publish to JSR #939

Merged
merged 11 commits into from
Dec 20, 2024
Merged
Show file tree
Hide file tree
Changes from 9 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 0 additions & 46 deletions .github/workflows/npm-release.yml

This file was deleted.

64 changes: 64 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
name: Publish

on:
push:
tags:
- "effection-v*"

permissions:
contents: read
id-token: write

jobs:
publish-npm:
runs-on: ubuntu-latest

steps:
- name: checkout
uses: actions/checkout@v4

- name: setup deno
uses: denoland/setup-deno@v2
with:
deno-version: v2.x

- name: Get Version
id: vars
run: echo ::set-output name=version::$(echo ${{github.ref_name}} | sed 's/^effection-v//')

- name: Setup Node
uses: actions/[email protected]
with:
node-version: 18.x
registry-url: https://registry.npmjs.com

- name: Build NPM
run: deno task build:npm ${{steps.vars.outputs.version}}

- name: Publish NPM
run: npm publish --access=public
working-directory: ./build/npm
env:
NODE_AUTH_TOKEN: ${{secrets.NPM_AUTH_TOKEN}}

publish-jsr:
runs-on: ubuntu-latest

steps:
- name: checkout
uses: actions/checkout@v4

- name: setup deno
uses: denoland/setup-deno@v2
with:
deno-version: v2.x

- name: Get Version
id: vars
run: echo ::set-output name=version::$(echo ${{github.ref_name}} | sed 's/^effection-v//')

- name: Build JSR
run: deno task build:jsr ${{steps.vars.outputs.version}}

- name: Publish JSR
run: npx jsr publish --allow-dirty
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@

# Local Netlify folder
.netlify
/build/
/build/
7 changes: 7 additions & 0 deletions deno.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,15 @@
{
"name": "@effection/effection",
"exports": "./mod.ts",
"license": "ISC",
"publish": {
"include": ["lib", "mod.ts", "README.md"]
},
"lock": false,
"tasks": {
"test": "deno test --allow-run=deno",
"test:node": "deno task build:npm 0.0.0 && node test/main/node.mjs hello world",
"build:jsr": "deno run -A tasks/build-jsr.ts",
"build:npm": "deno run -A tasks/build-npm.ts"
},
"lint": {
Expand Down
4 changes: 2 additions & 2 deletions lib/deps.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
export { assert } from "https://deno.land/std@0.158.0/testing/asserts.ts";
export * from "https://deno.land/x/[email protected].5/mod.ts";
export { assert } from "jsr:@std/[email protected]";
export * from "jsr:@frontside/[email protected].6";
2 changes: 1 addition & 1 deletion lib/each.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ export function each<T>(stream: Stream<T, unknown>): Operation<Iterable<T>> {
};
}

each.next = function next() {
each.next = function next(): Operation<void> {
return {
name: "each.next()",
*[Symbol.iterator]() {
Expand Down
3 changes: 2 additions & 1 deletion lib/signal.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import type { Stream, Subscription } from "./types.ts";
import { createQueue, type Queue } from "./queue.ts";
import { resource } from "./instructions.ts";
import { createContext } from "./context.ts";
import { type Context } from "./types.ts";

/**
* Convert plain JavaScript function calls into a {@link Stream} that can
Expand Down Expand Up @@ -81,7 +82,7 @@ export interface Signal<T, TClose> extends Stream<T, TClose> {
* }
* ```
*/
export const SignalQueueFactory = createContext(
export const SignalQueueFactory: Context<typeof createQueue> = createContext(
"Signal.createQueue",
createQueue,
);
Expand Down
9 changes: 9 additions & 0 deletions tasks/build-jsr.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import jsonDeno from "../deno.json" with { type: "json" };

await Deno.writeTextFile(
new URL("../deno.json", import.meta.url),
JSON.stringify({
...jsonDeno,
version: Deno.env.get("VERSION"),
taras marked this conversation as resolved.
Show resolved Hide resolved
}),
);
9 changes: 3 additions & 6 deletions tasks/build-npm.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
import {
build,
emptyDir,
} from "https://deno.land/x/[email protected]/mod.ts?pin=v123";
import { build, emptyDir } from "jsr:@deno/[email protected]";

const outDir = "./build/npm";

Expand All @@ -21,7 +18,7 @@ await build({
test: false,
typeCheck: false,
compilerOptions: {
lib: ["esnext", "dom"],
lib: ["ESNext", "DOM"],
target: "ES2020",
sourceMap: true,
},
Expand All @@ -31,8 +28,8 @@ await build({
version,
description: "Structured concurrency and effects for JavaScript",
license: "ISC",
author: "[email protected]",
repository: {
author: "[email protected]",
type: "git",
url: "git+https://github.com/thefrontside/effection.git",
},
Expand Down
Loading