Skip to content

Commit

Permalink
init
Browse files Browse the repository at this point in the history
  • Loading branch information
ryoppippi committed Jun 4, 2024
0 parents commit eddc367
Show file tree
Hide file tree
Showing 12 changed files with 351 additions and 0 deletions.
11 changes: 11 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
## Describe your changes

## Issue ticket number and link

## Checklist before requesting a review

- [ ] Did you implement the changes in the correct branch?
- [ ] Is JSDocs for your new implementation up to date?
- [ ] Did you add tests for your changes?
- [ ] Did you update the documentation?
- [ ] Did all CI checks pass?
30 changes: 30 additions & 0 deletions .github/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
changelog:
exclude:
labels:
- 'Type: Meta'
- 'Type: Question'
- 'Type: Release'

categories:
- title: Security Fixes
labels: ['Type: Security']
- title: Breaking Changes
labels: ['Type: Breaking Change']
- title: Features
labels: ['Type: Feature']
- title: Bug Fixes
labels: ['Type: Bug']
- title: Documentation
labels: ['Type: Documentation']
- title: Refactoring
labels: ['Type: Refactoring']
- title: Testing
labels: ['Type: Testing']
- title: Maintenance
labels: ['Type: Maintenance']
- title: CI
labels: ['Type: CI']
- title: Dependency Updates
labels: ['Type: Dependencies', "dependencies"]
- title: Other Changes
labels: ['*']
27 changes: 27 additions & 0 deletions .github/workflows/jsr.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: jsr

env:
DENO_VERSION: 1.x

on:
push:
tags:
- "*"

permissions:
contents: read
id-token: write

jobs:
publish:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: denoland/setup-deno@v1
with:
deno-version: ${{ env.DENO_VERSION }}
- name: Publish
run: |
deno run -A jsr:@david/publish-on-tag@0.1.3
104 changes: 104 additions & 0 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
# yaml-language-server: $schema=https://json.schemastore.org/github-workflow.json

name: Deno Test

on:
push:
branches:
- main
paths:
- '**.ts'
- '.github/workflows/test.yml'
- 'deno.jsonc'
pull_request:
branches:
- main
paths:
- '**.ts'

permissions:
contents: read

jobs:
test:
runs-on: ubuntu-latest
steps:
- name: Setup repo
uses: actions/checkout@v4

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

- name: Check
run: deno task check

- name: Run linter
run: deno task lint

- name: Run test with coverage report
shell: bash
run: |
deno task test:coverage
deno task coverage:lco
deno task coverage:show >> .coverage/result.txt
- name: Upload coverage report to Artifact
uses: actions/upload-artifact@v4
with:
name: my-artifact
path: ./.coverage

- name: Create commit comment
uses: peter-evans/commit-comment@v3
with:
body: |
Deno test coverage report
$(cat .coverage/result.txt)
coverage:
needs: test
runs-on: ubuntu-latest
permissions:
write-all
steps:
- name: Download coverage report from Artifact
uses: actions/download-artifact@v4
with:
name: my-artifact
path: ./.coverage

- name: Upload coverage report to Codecov
uses: codecov/codecov-action@v4.3.0
with:
file: ./.coverage/lcov.info
fail_ci_if_error: true
token: ${{ secrets.CODECOV_TOKEN }}
slug: ${{ github.repository }}

- name: Create commit comment
uses: peter-evans/commit-comment@v3
with:
body: |
Deno test coverage report
$(cat .coverage/result.txt)
jsr-publish-dry-run:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: denoland/setup-deno@v1
with:
deno-version: ${{ env.DENO_VERSION }}
- run: deno publish --dry-run

action-timeline:
needs:
- test
- coverage
- jsr-publish-dry-run
if: ${{ always() }}
runs-on: ubuntu-latest
steps:
- uses: Kesin11/actions-timeline@v2
60 changes: 60 additions & 0 deletions .github/workflows/update.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
# yaml-language-server: $schema=https://json.schemastore.org/github-workflow.json

name: Deno Update

on:
schedule:
- cron: "0 9 * * *"
workflow_dispatch: {}

jobs:
update:
permissions: write-all
runs-on: ubuntu-latest

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

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

- name: Update dependencies with molt
id: run-deno-molt
env:
NO_COLOR: true
run: |
{
echo 'MOLT_RESULT<<EOF'
deno run --allow-all jsr:@molt/cli --write $(find . -type f -name '*.mts' -o -name '*.cts' -o -name '*.mjs' -o -name '*.cjs' -o -name '*.ts' -o -name '*.js' -o -name '*.tsx' -o -name '*.jsx')
echo EOF
} >> $GITHUB_OUTPUT
- name: Check
run: deno task check

- name: Run linter
run: deno task lint

- name: Run tests
run: deno task test

- name: Create pull request
uses: peter-evans/create-pull-request@v6
with:
commit-message: "chore(deps): Update deno dependencies"
title: Update Deno dependencies
body: |-
Some external modules are stale.
<details><summary>Details</summary><div>
```
${{ steps.run-deno-molt.outputs.MOLT_RESULT }}
```
</div></details>
branch: molt-update
author: GitHub <noreply@github.com>
delete-branch: true
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
.DS_Store
/node_modules
/types
/.coverage
/npm
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2024 ryoppippi

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Deno jsr library template


29 changes: 29 additions & 0 deletions deno.jsonc
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
{
"name": "@ryoppippi/",
"version": "0.0.0",
"tasks": {
"dev": "deno run --watch main.ts",
"check": "deno check ./**/*.ts && deno fmt --check",
"lint": "deno lint ./**/*.ts",
"test": "deno test -A --parallel --doc",
"test:coverage": "deno task test --coverage=.coverage",
"coverage:show": "deno coverage .coverage",
"coverage:lco": "deno coverage --lcov .coverage > .coverage/lcov.info"
},
"fmt": {
"exclude": [
"*.md"
]
},
"imports": {
"@cross/test": "jsr:@cross/test@^0.0.9",
"@std/assert": "jsr:@std/assert@^0.226.0"
},
"exports": "./main.ts",
"keywords": [
"random",
"regex",
"typescript",
"typesafe"
]
}
50 changes: 50 additions & 0 deletions deno.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions main.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export function add(a: number, b: number): number {
return a + b;
}
8 changes: 8 additions & 0 deletions main_test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import { test } from "@cross/test";
import { assertEquals } from "@std/assert";

import { add } from "./main.ts";

test("dummy", () => {
assertEquals(add(1, 2), 3);
});

0 comments on commit eddc367

Please sign in to comment.