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

BREAKING: Move to JSR #48

Merged
merged 6 commits into from
Mar 9, 2024
Merged
Show file tree
Hide file tree
Changes from all 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
56 changes: 28 additions & 28 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,46 +1,26 @@
name: Release

on:
release:
types:
- released
push:
tags:
- 'v*.*.*'
- "v*.*.*"

permissions:
contents: read

jobs:
publish:
draft:
name: Create draft release
if: github.event_name == 'push'
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Use Node.js v18
uses: actions/setup-node@v3
with:
node-version: 18
registry-url: 'https://registry.npmjs.org'

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

- name: Testing
run: deno test

- name: Build
run: deno task build:node ${{ github.ref }}

- name: Publish to registry.npmjs.com
run: |
cd ./npm
npm publish
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

- name: Setup git-cliff
uses: kenji-miyake/setup-git-cliff@v1

Expand All @@ -57,3 +37,23 @@ jobs:
with:
draft: true
body: ${{ steps.changelog.outputs.result }}

publish:
name: Publish to JSR
if: github.event_name == 'release'
runs-on: ubuntu-latest
permissions:
contents: read
id-token: write
steps:
- uses: actions/checkout@v4

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

- name: Publish (dry-run)
run: deno publish --dry-run

- name: Publish
run: deno publish
3 changes: 3 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,3 +34,6 @@ jobs:
- uses: codecov/codecov-action@v3
with:
file: ./coverage.lcov

- name: Publish (dry run)
run: deno publish --dry-run
3 changes: 2 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{
"deno.enable": true
"deno.enable": true,
"deno.unstable": true
}
8 changes: 2 additions & 6 deletions basic-auth/fetcher.test.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
import {
assertInstanceOf,
assertSpyCalls,
assertStrictEquals,
stub,
} from "../deps_test.ts";
import { assertInstanceOf, assertStrictEquals } from "@std/assert";
import { assertSpyCalls, stub } from "@std/testing/mock";
import { fetcher as basicAuth } from "./fetcher.ts";

Deno.test('When calling fetch, the "Authorization" header must be set to the correct value.', async () => {
Expand Down
9 changes: 6 additions & 3 deletions basic-auth/fetcher.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { base64encode } from "../deps.ts";
import { encodeBase64 } from "@std/encoding/base64";
import { resolveURL } from "../utils/url.ts";

/**
Expand All @@ -20,8 +20,11 @@ import { resolveURL } from "../utils/url.ts";
* @param username your email address
* @param password your password
*/
export const fetcher = (username: string, password: string) => {
const token = base64encode(`${username}:${password}`);
export const fetcher = (
username: string,
password: string,
): (input: string | Request, init?: RequestInit) => Promise<Response> => {
const token = encodeBase64(`${username}:${password}`);

return (input: string | Request, init?: RequestInit) => {
const url = resolveURL(input);
Expand Down
113 changes: 0 additions & 113 deletions build.ts

This file was deleted.

25 changes: 14 additions & 11 deletions deno.json
Original file line number Diff line number Diff line change
@@ -1,20 +1,23 @@
{
"tasks": {
"build:node": "deno run -A ./build.ts"
"name": "@nexterias/twitter-api-fetch",
"version": "3.0.0",
"exports": "./mod.ts",
"lock": false,
"publish": {
"exclude": ["./.github/**/*", "./cliff.toml", "./vscode/**/*"]
},
"lint": {
"files": {
"exclude": ["./npm", "./coverage"]
}
"exclude": ["./coverage"]
},
"fmt": {
"files": {
"exclude": ["./npm", "./coverage"]
}
"exclude": ["./coverage"]
},
"test": {
"files": {
"exclude": ["./npm", "./coverage"]
}
"exclude": ["./coverage"]
},
"imports": {
"@std/assert": "jsr:@std/assert@^0.219.1",
"@std/encoding": "jsr:@std/encoding@^0.219.1",
"@std/testing": "jsr:@std/testing@^0.219.1"
}
}
Loading
Loading