-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from httpland/beta
Beta
- Loading branch information
Showing
12 changed files
with
379 additions
and
8 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,40 @@ | ||
name: "CodeQL" | ||
|
||
on: | ||
push: | ||
branches: [ main ] | ||
|
||
pull_request: | ||
branches: [ main ] | ||
|
||
schedule: | ||
- cron: '18 15 * * 2' | ||
|
||
jobs: | ||
analyze: | ||
name: Analyze | ||
runs-on: ubuntu-latest | ||
permissions: | ||
actions: read | ||
contents: read | ||
security-events: write | ||
|
||
strategy: | ||
fail-fast: false | ||
matrix: | ||
language: [ 'typescript' ] | ||
|
||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v3 | ||
|
||
- name: Initialize CodeQL | ||
uses: github/codeql-action/init@v2 | ||
with: | ||
languages: ${{ matrix.language }} | ||
|
||
- name: Autobuild | ||
uses: github/codeql-action/autobuild@v2 | ||
|
||
- name: Perform CodeQL Analysis | ||
uses: github/codeql-action/analyze@v2 |
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,57 @@ | ||
name: release-npm | ||
|
||
on: | ||
release: | ||
types: [published] | ||
|
||
jobs: | ||
release: | ||
runs-on: ${{ matrix.os }} | ||
|
||
strategy: | ||
matrix: | ||
os: [ubuntu-latest] | ||
deno: [v1.x] | ||
node: [16.x] | ||
|
||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
|
||
- uses: denoland/setup-deno@v1 | ||
with: | ||
deno-version: ${{ matrix.deno }} | ||
|
||
- name: Cache node_modules | ||
uses: actions/cache@v2 | ||
with: | ||
path: ~/.pnpm-store | ||
key: ${{ runner.os }}-${{ hashFiles('**/pnpm-lock.yaml') }} | ||
restore-keys: | | ||
${{ runner.os }}- | ||
- uses: pnpm/action-setup@v2.0.1 | ||
with: | ||
version: 7.16.0 | ||
run_install: | | ||
- recursive: true | ||
args: [--frozen-lockfile, --prefer-offline, --ignore-scripts] | ||
- name: Get tag version | ||
if: startsWith(github.ref, 'refs/tags/') | ||
id: get_tag_version | ||
run: echo ::set-output name=TAG_VERSION::${GITHUB_REF/refs\/tags\//} | ||
|
||
- uses: actions/setup-node@v2 | ||
with: | ||
node-version: ${{ matrix.node }} | ||
registry-url: 'https://registry.npmjs.org' | ||
|
||
- name: build | ||
run: deno run -A ./_tools/build_npm.ts ${{steps.get_tag_version.outputs.TAG_VERSION}} | ||
|
||
- name: publish | ||
env: | ||
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | ||
run: deno run -A ./_tools/publish_npm.ts ${{steps.get_tag_version.outputs.TAG_VERSION}} | ||
|
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,79 @@ | ||
name: release | ||
|
||
on: | ||
push: | ||
branches: | ||
- beta | ||
- main | ||
|
||
jobs: | ||
lint: | ||
runs-on: ${{ matrix.os }} | ||
|
||
strategy: | ||
matrix: | ||
os: [ubuntu-latest] | ||
deno: [v1.x] | ||
|
||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
|
||
- uses: denoland/setup-deno@v1 | ||
with: | ||
deno-version: ${{ matrix.deno }} | ||
|
||
- name: Lint | ||
run: | | ||
deno fmt --check | ||
deno lint | ||
test: | ||
runs-on: ${{ matrix.os }} | ||
|
||
strategy: | ||
matrix: | ||
os: [ubuntu-latest] | ||
deno: [v1.x] | ||
|
||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
|
||
- uses: denoland/setup-deno@v1 | ||
with: | ||
deno-version: ${{ matrix.deno }} | ||
|
||
- name: Test | ||
run: deno task test --coverage=coverage | ||
|
||
- name: Generate coverage | ||
if: ${{ matrix.deno == 'v1.x' }} | ||
run: deno task coverage coverage --output=cov_profile.lcov --lcov | ||
|
||
- uses: codecov/codecov-action@v3 | ||
if: ${{ matrix.deno == 'v1.x' }} | ||
with: | ||
files: cov_profile.lcov | ||
|
||
release: | ||
needs: [lint, test] | ||
runs-on: ${{ matrix.os }} | ||
|
||
strategy: | ||
matrix: | ||
os: [ubuntu-latest] | ||
|
||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
with: | ||
token: ${{ secrets.GH_TOKEN }} | ||
|
||
- uses: cycjimmy/semantic-release-action@v3 | ||
with: | ||
extra_plugins: | | ||
@semantic-release/changelog | ||
@semantic-release/git | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }} |
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,43 @@ | ||
name: test | ||
|
||
on: push | ||
jobs: | ||
lint: | ||
runs-on: ${{ matrix.os }} | ||
|
||
strategy: | ||
matrix: | ||
os: [ubuntu-latest, ubuntu-22.04, macos-latest, windows-latest] | ||
deno: [v1.x] | ||
|
||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
|
||
- uses: denoland/setup-deno@v1 | ||
with: | ||
deno-version: ${{ matrix.deno }} | ||
|
||
- name: Lint | ||
run: | | ||
deno fmt --check | ||
deno lint | ||
test: | ||
runs-on: ${{ matrix.os }} | ||
|
||
strategy: | ||
matrix: | ||
os: [ubuntu-latest, ubuntu-22.04, macos-latest, windows-latest] | ||
deno: [v1.x] | ||
|
||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
|
||
- uses: denoland/setup-deno@v1 | ||
with: | ||
deno-version: ${{ matrix.deno }} | ||
|
||
- name: Test | ||
run: deno task test |
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,25 @@ | ||
{ | ||
"branches": [ | ||
"main", | ||
{ | ||
"name": "beta", | ||
"prerelease": true | ||
} | ||
], | ||
"plugins": [ | ||
"@semantic-release/commit-analyzer", | ||
"@semantic-release/release-notes-generator", | ||
"@semantic-release/changelog", | ||
"@semantic-release/github", | ||
[ | ||
"@semantic-release/git", | ||
{ | ||
"assets": [ | ||
"CHANGELOG.md" | ||
], | ||
"message": "chore(release): ${nextRelease.version} [skip ci]\n\n${nextRelease.notes}" | ||
} | ||
] | ||
], | ||
"tagFormat": "${version}" | ||
} |
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 @@ | ||
# 1.0.0-beta.1 (2023-02-13) | ||
|
||
|
||
### Features | ||
|
||
* **types:** add middleware interface ([936af7b](https://github.com/httpland/http-middleware/commit/936af7bdf9229243e3256ac0397f39e1071110c1)) |
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,23 @@ | ||
import { build, emptyDir } from "https://deno.land/x/dnt@0.33.1/mod.ts"; | ||
import { join } from "https://deno.land/std@0.177.0/path/mod.ts"; | ||
import { makeOptions } from "./meta.ts"; | ||
|
||
async function buildPkg(version: string): Promise<void> { | ||
await emptyDir("./npm"); | ||
const pkg = makeOptions(version); | ||
await Deno.copyFile("LICENSE", join(pkg.outDir, "LICENSE")); | ||
Deno.copyFile( | ||
join(".", "README.md"), | ||
join(pkg.outDir, "README.md"), | ||
); | ||
await build(pkg); | ||
} | ||
|
||
if (import.meta.main) { | ||
const version = Deno.args[0]; | ||
if (!version) { | ||
console.error("argument is required"); | ||
Deno.exit(1); | ||
} | ||
await buildPkg(version); | ||
} |
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 { BuildOptions } from "https://deno.land/x/dnt@0.33.1/mod.ts"; | ||
|
||
export const makeOptions = (version: string): BuildOptions => ({ | ||
test: false, | ||
shims: {}, | ||
compilerOptions: { lib: ["esnext", "dom"] }, | ||
typeCheck: true, | ||
entryPoints: ["./mod.ts"], | ||
outDir: "./npm", | ||
package: { | ||
name: "@httpland/http-middleware", | ||
version, | ||
description: "HTTP middleware specification", | ||
keywords: [ | ||
"http", | ||
"middleware", | ||
"http-middleware", | ||
"handler", | ||
"http-handler", | ||
"next", | ||
"request", | ||
"response", | ||
], | ||
license: "MIT", | ||
homepage: "https://github.com/httpland/http-middleware", | ||
repository: { | ||
type: "git", | ||
url: "git+https://github.com/httpland/http-middleware.git", | ||
}, | ||
bugs: { | ||
url: "https://github.com/httpland/http-middleware/issues", | ||
}, | ||
sideEffects: false, | ||
type: "module", | ||
publishConfig: { access: "public" }, | ||
}, | ||
packageManager: "pnpm", | ||
}); |
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,26 @@ | ||
import { prerelease, valid } from "https://deno.land/x/semver@v1.4.1/mod.ts"; | ||
import { makeOptions } from "./meta.ts"; | ||
|
||
if (import.meta.main) { | ||
const version = Deno.args[0]; | ||
if (!version) { | ||
console.error("arg of version is required"); | ||
Deno.exit(1); | ||
} | ||
if (!valid(version)) { | ||
console.error("The argument of version is invalid"); | ||
Deno.exit(1); | ||
} | ||
|
||
const isPrerelease = prerelease(version); | ||
const tag = isPrerelease?.[0] ?? "latest"; | ||
|
||
const pkg = makeOptions(version); | ||
const result = await Deno.run({ | ||
cmd: ["npm", "publish", pkg.outDir, "--tag", String(tag)], | ||
stdout: "piped", | ||
}) | ||
.output(); | ||
|
||
console.log(new TextDecoder().decode(result)); | ||
} |
Oops, something went wrong.