Skip to content

Commit 3a08773

Browse files
Merge pull request #1 from httpland/beta
Beta
2 parents 95f8808 + b238a70 commit 3a08773

26 files changed

+834
-3
lines changed
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
name: "CodeQL"
2+
3+
on:
4+
push:
5+
branches: [ main ]
6+
7+
pull_request:
8+
branches: [ main ]
9+
10+
jobs:
11+
analyze:
12+
name: Analyze
13+
runs-on: ubuntu-latest
14+
permissions:
15+
actions: read
16+
contents: read
17+
security-events: write
18+
19+
strategy:
20+
fail-fast: false
21+
matrix:
22+
language: [ 'typescript' ]
23+
24+
steps:
25+
- name: Checkout repository
26+
uses: actions/checkout@v3
27+
28+
- name: Initialize CodeQL
29+
uses: github/codeql-action/init@v2
30+
with:
31+
languages: ${{ matrix.language }}
32+
33+
- name: Autobuild
34+
uses: github/codeql-action/autobuild@v2
35+
36+
- name: Perform CodeQL Analysis
37+
uses: github/codeql-action/analyze@v2

.github/workflows/release-npm.yaml

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
name: release-npm
2+
3+
on:
4+
release:
5+
types: [published]
6+
7+
jobs:
8+
release:
9+
runs-on: ${{ matrix.os }}
10+
11+
strategy:
12+
matrix:
13+
os: [ubuntu-latest]
14+
deno: [v1.x]
15+
node: [18.x]
16+
17+
steps:
18+
- name: Checkout
19+
uses: actions/checkout@v3
20+
21+
- uses: denoland/setup-deno@v1
22+
with:
23+
deno-version: ${{ matrix.deno }}
24+
25+
- name: Cache node_modules
26+
uses: actions/cache@v2
27+
with:
28+
path: ~/.pnpm-store
29+
key: ${{ runner.os }}-${{ hashFiles('**/pnpm-lock.yaml') }}
30+
restore-keys: |
31+
${{ runner.os }}-
32+
33+
- uses: pnpm/[email protected]
34+
with:
35+
version: 6.23.6
36+
run_install: |
37+
- recursive: true
38+
args: [--frozen-lockfile, --prefer-offline, --ignore-scripts]
39+
40+
- name: Get tag version
41+
if: startsWith(github.ref, 'refs/tags/')
42+
id: get_tag_version
43+
run: echo ::set-output name=TAG_VERSION::${GITHUB_REF/refs\/tags\//}
44+
45+
- uses: actions/setup-node@v2
46+
with:
47+
node-version: ${{ matrix.node }}
48+
registry-url: 'https://registry.npmjs.org'
49+
50+
- name: build
51+
run: deno run -A ./_tools/build_npm.ts ${{steps.get_tag_version.outputs.TAG_VERSION}}
52+
53+
- name: publish
54+
env:
55+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
56+
run: deno run -A ./_tools/publish_npm.ts ${{steps.get_tag_version.outputs.TAG_VERSION}}
57+

.github/workflows/release.yaml

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
name: release
2+
3+
on:
4+
push:
5+
branches:
6+
- beta
7+
- main
8+
9+
jobs:
10+
lint:
11+
runs-on: ${{ matrix.os }}
12+
13+
strategy:
14+
matrix:
15+
os: [ubuntu-latest]
16+
deno: [v1.x]
17+
18+
steps:
19+
- name: Checkout
20+
uses: actions/checkout@v3
21+
22+
- uses: denoland/setup-deno@v1
23+
with:
24+
deno-version: ${{ matrix.deno }}
25+
26+
- name: Lint
27+
run: |
28+
deno fmt --check
29+
deno lint
30+
31+
test:
32+
runs-on: ${{ matrix.os }}
33+
34+
strategy:
35+
matrix:
36+
os: [ubuntu-latest]
37+
deno: [v1.x]
38+
39+
steps:
40+
- name: Checkout
41+
uses: actions/checkout@v3
42+
43+
- uses: denoland/setup-deno@v1
44+
with:
45+
deno-version: ${{ matrix.deno }}
46+
47+
- name: Test
48+
run: deno task test --coverage=coverage
49+
50+
- name: Generate coverage
51+
if: ${{ matrix.deno == 'v1.x' }}
52+
run: deno coverage coverage --output=cov_profile.lcov --lcov
53+
54+
- uses: codecov/codecov-action@v3
55+
if: ${{ matrix.deno == 'v1.x' }}
56+
with:
57+
files: cov_profile.lcov
58+
59+
release:
60+
needs: [lint, test]
61+
runs-on: ${{ matrix.os }}
62+
63+
strategy:
64+
matrix:
65+
os: [ubuntu-latest]
66+
67+
steps:
68+
- name: Checkout
69+
uses: actions/checkout@v3
70+
with:
71+
token: ${{ secrets.GH_TOKEN }}
72+
73+
- uses: cycjimmy/semantic-release-action@v3
74+
with:
75+
extra_plugins: |
76+
@semantic-release/changelog
77+
@semantic-release/git
78+
env:
79+
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}

.github/workflows/test.yaml

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
name: test
2+
3+
on: push
4+
jobs:
5+
lint:
6+
runs-on: ${{ matrix.os }}
7+
8+
strategy:
9+
matrix:
10+
os: [ubuntu-latest]
11+
deno: [v1.x]
12+
13+
steps:
14+
- name: Checkout
15+
uses: actions/checkout@v3
16+
17+
- uses: denoland/setup-deno@v1
18+
with:
19+
deno-version: ${{ matrix.deno }}
20+
21+
- name: Lint
22+
run: |
23+
deno fmt --check
24+
deno lint
25+
26+
test:
27+
runs-on: ${{ matrix.os }}
28+
29+
strategy:
30+
matrix:
31+
os: [ubuntu-latest]
32+
deno: [v1.x]
33+
34+
steps:
35+
- name: Checkout
36+
uses: actions/checkout@v3
37+
38+
- uses: denoland/setup-deno@v1
39+
with:
40+
deno-version: ${{ matrix.deno }}
41+
42+
- name: Test
43+
run: deno task test

.releaserc

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
{
2+
"branches": [
3+
"main",
4+
{
5+
"name": "beta",
6+
"prerelease": true
7+
}
8+
],
9+
"plugins": [
10+
"@semantic-release/commit-analyzer",
11+
"@semantic-release/release-notes-generator",
12+
"@semantic-release/changelog",
13+
"@semantic-release/github",
14+
[
15+
"@semantic-release/git",
16+
{
17+
"assets": [
18+
"CHANGELOG.md"
19+
],
20+
"message": "chore(release): ${nextRelease.version} [skip ci]\n\n${nextRelease.notes}"
21+
}
22+
]
23+
],
24+
"tagFormat": "${version}"
25+
}

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# 1.0.0-beta.1 (2023-05-04)
2+
3+
4+
### Features
5+
6+
* add headers utility functions ([7cfad8d](https://github.com/httpland/headers-utils/commit/7cfad8de91b6f1a2ba7c5d34eb77c7dfc5218ffc))

README.md

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
Headers utility collection.
1212

13-
## equalHeaders
13+
## equalsHeaders
1414

1515
Check two `Headers` field name and field value equality.
1616

@@ -48,8 +48,7 @@ assert(headers.has("content-type"));
4848
## filterHeadersKeys
4949

5050
Returns a new `Headers` with all entries of the given headers except the ones
51-
that have a key(header name or field name) that does not match the given
52-
predicate.
51+
that have a key(field name) that does not match the given predicate.
5352

5453
```ts
5554
import { filterHeadersKeys } from "https://deno.land/x/headers_utils@$VERSION/filter_keys.ts";
@@ -123,6 +122,10 @@ date: Wed, 21 Oct 2015 07:28:00 GMT`,
123122
);
124123
```
125124

125+
## API
126+
127+
All APIs can be found in the [deno doc](https://deno.land/x/headers_utils?doc).
128+
126129
## License
127130

128131
Copyright © 2023-present [httpland](https://github.com/httpland).

_dev_deps.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
// Copyright 2023-latest the httpland authors. All rights reserved. MIT license.
2+
3+
export { describe, it } from "https://deno.land/[email protected]/testing/bdd.ts";
4+
export {
5+
assert,
6+
assertEquals,
7+
assertFalse,
8+
assertRejects,
9+
assertThrows,
10+
} from "https://deno.land/[email protected]/testing/asserts.ts";

_test_import_map.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"imports": {
3+
"https://deno.land/x/headers_utils@$VERSION/": "./",
4+
"https://deno.land/std/": "https://deno.land/[email protected]/"
5+
}
6+
}

_tools/build_npm.ts

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
import { build, emptyDir } from "https://deno.land/x/[email protected]/mod.ts";
2+
import { join } from "https://deno.land/[email protected]/path/mod.ts";
3+
import { makeOptions } from "./meta.ts";
4+
5+
async function buildPkg(version: string): Promise<void> {
6+
await emptyDir("./npm");
7+
const pkg = makeOptions(version);
8+
await Deno.copyFile("LICENSE", join(pkg.outDir, "LICENSE"));
9+
Deno.copyFile(
10+
join(".", "README.md"),
11+
join(pkg.outDir, "README.md"),
12+
);
13+
await build(pkg);
14+
}
15+
16+
if (import.meta.main) {
17+
const version = Deno.args[0];
18+
if (!version) {
19+
console.error("argument is required");
20+
Deno.exit(1);
21+
}
22+
await buildPkg(version);
23+
}

0 commit comments

Comments
 (0)