Skip to content

Commit

Permalink
feat: initial project
Browse files Browse the repository at this point in the history
  • Loading branch information
hckhanh committed Mar 1, 2024
0 parents commit a283319
Show file tree
Hide file tree
Showing 19 changed files with 1,469 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* text=auto eol=lf
51 changes: 51 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
name: Publish

on:
push:
branches:
- main

jobs:
test:
name: Test
uses: ./.github/workflows/tests.yml
secrets: inherit
release:
name: Release
needs: test
runs-on: ubuntu-latest
permissions:
contents: write
issues: write
pull-requests: write
id-token: write
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Install Deno
uses: denoland/setup-deno@v1
- name: Install jq
uses: dcarbone/install-jq-action@v2
- name: Setup pnpm
uses: pnpm/action-setup@v3
with:
version: latest
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 'lts/*'
cache: 'pnpm'
- name: Release on GitHub
run: pnpm --package conventional-changelog-conventionalcommits --package semantic-release dlx semantic-release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Update version in deno.json
run: |
VERSION=$(node -p "require('./package.json').version")
jq --arg version "$VERSION" '.version = $version' deno.json > deno.json.tmp
mv deno.json.tmp deno.json
echo "VERSION=$VERSION" >> $GITHUB_ENV
- name: Publish package to JSR
if: env.VERSION != '0.0.0-development'
run: deno publish
81 changes: 81 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
name: Tests

on:
workflow_call:
pull_request:
branches:
- main

jobs:
lints:
name: Lints
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup pnpm
uses: pnpm/action-setup@v3
with:
version: 8
- uses: actions/setup-node@v4
with:
node-version: 'lts/*'
cache: 'pnpm'
- name: Install dependencies
run: pnpm install
- name: Prettier check
run: pnpm test:prettier
- name: Checks for known security issues with the installed packages
run: pnpm audit
- name: Verify the integrity of provenance attestations and registry signatures for installed dependencies
run: pnpm npm audit signatures
node:
name: Node
needs: lints
runs-on: ubuntu-latest
strategy:
matrix:
node: [18, 20, 21]
steps:
- uses: actions/checkout@v4
- name: Setup pnpm
uses: pnpm/action-setup@v3
with:
version: 8
- name: Set up Node.js ${{matrix.node}}
uses: actions/setup-node@v4
with:
node-version: ${{matrix.node}}
cache: 'pnpm'
- name: Install dependencies
run: pnpm install
- name: Run unit tests
run: pnpm test -- --environment=node
edge:
name: Edge Runtime
needs: lints
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup pnpm
uses: pnpm/action-setup@v3
with:
version: 8
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: 'lts/*'
cache: 'pnpm'
- name: Install dependencies
run: pnpm install
- name: Run unit tests
run: pnpm test -- --environment=edge-runtime
deno:
name: Deno
needs: lints
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install Deno
uses: denoland/setup-deno@v1
- name: Type-check the dependencies
run: deno check src/index.ts
8 changes: 8 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Node
node_modules/

# IDEs
.idea/

# macOS
.DS_Store
1 change: 1 addition & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
pnpm-lock.yaml
6 changes: 6 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"semi": false,
"endOfLine": "lf",
"singleQuote": true,
"jsxSingleQuote": true
}
10 changes: 10 additions & 0 deletions .releaserc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"branches": ["main"],
"tagFormat": "${version}",
"plugins": [
"@semantic-release/commit-analyzer",
"@semantic-release/release-notes-generator",
"@semantic-release/npm",
"@semantic-release/github"
]
}
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 Khánh Hoàng

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.
19 changes: 19 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# google-safe-browsing

A JavaScript client for [Google Safe Browsing](https://safebrowsing.google.com) API (https://developers.google.com/safe-browsing)

## Features

- [Zero dependency](https://jsr.io/@hckhanh/google-safe-browsing/dependencies)
- Edge runtime built-in support
- Typesafe with TypeScript
- Support all Google Safe Browsing API v4 endpoints
- Fully well-documented

## Release Notes

You can go to [Releases](https://github.com/hckhanh/google-safe-browsing/releases) page to see the release notes.

> [!NOTE]
> The Safe Browsing API is for non-commercial use only. If you need to use APIs to detect malicious URLs for commercial
> purposes - meaning 'for sale or revenue-generating purposes' - please refer to the [Web Risk API](https://github.com/hckhanh/web-risk).
18 changes: 18 additions & 0 deletions deno.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"name": "@hckhanh/google-safe-browsing",
"version": "0.0.0-development",
"exports": "./src/index.ts",
"exclude": [
".github/",
"src/**/*.test.ts",
".git*",
".prettier*",
".*ignore",
"*.yml",
"*.yaml",
"*.config.ts",
".*rc.json",
"renovate.json",
"tsconfig.json"
]
}
51 changes: 51 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
{
"name": "@hckhanh/google-safe-browsing",
"version": "0.0.0-development",
"description": "A JavaScript client for Google Safe Browsing API (https://developers.google.com/safe-browsing)",
"type": "module",
"private": true,
"sideEffects": false,
"scripts": {
"test": "vitest related src/**/*.ts",
"test:prettier": "prettier --check ."
},
"author": {
"name": "Khánh Hoàng",
"email": "[email protected]",
"url": "https://khanh.sh"
},
"license": "MIT",
"keywords": [
"reader",
"read",
"number",
"vn",
"vietnam",
"vietnamese",
"vietnamese-language",
"vietnamese-currency",
"currency",
"vnd",
"vn-lang",
"lang",
"language",
"languages",
"language-processing",
"text-generation",
"helper",
"helpers",
"helpers-library",
"helper-tool",
"helper-methods",
"helper-class",
"helper-functions",
"helper-script"
],
"devDependencies": {
"@edge-runtime/vm": "3.2.0",
"@types/node": "20.11.24",
"prettier": "3.2.5",
"typescript": "5.3.3",
"vitest": "1.3.1"
}
}
Loading

0 comments on commit a283319

Please sign in to comment.