Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
remarkablemark committed Jun 9, 2024
0 parents commit d79bd77
Show file tree
Hide file tree
Showing 32 changed files with 13,454 additions and 0 deletions.
7 changes: 7 additions & 0 deletions .commitlintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"extends": ["@commitlint/config-conventional"],
"rules": {
"body-max-line-length": [1, "always", 100],
"footer-max-line-length": [1, "always", 100]
}
}
24 changes: 24 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{
"env": {
"es2020": true,
"node": true,
"jest": true
},
"extends": ["eslint:recommended", "plugin:@typescript-eslint/recommended"],
"parser": "@typescript-eslint/parser",
"parserOptions": {
"ecmaVersion": 12,
"sourceType": "module"
},
"plugins": ["@typescript-eslint", "prettier", "simple-import-sort", "tsdoc"],
"rules": {
"@typescript-eslint/no-extra-semi": "off",
"@typescript-eslint/no-unused-vars": "error",
"no-console": "error",
"no-debugger": "error",
"prettier/prettier": "error",
"simple-import-sort/exports": "error",
"simple-import-sort/imports": "error",
"tsdoc/syntax": "error"
}
}
4 changes: 4 additions & 0 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
* @remarkablemark

package.json
package-lock.json
33 changes: 33 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
---
name: Bug Report
about: Report a bug
labels: bug
assignees: remarkablemark
---

## Expected Behavior

<!-- What should happen. -->

## Actual Behavior

<!-- What happens instead. -->

## Steps to Reproduce

<!-- Describe a sequence of steps that anybody can repeat to see the issue. -->

## Reproducible Demo

<!-- Creating a bug demo will help speed up the process of resolving the issue. -->

## Environment

- Version:
- Platform:
- Browser:
- OS:

## Keywords

<!-- Include keywords that might help others with the same problem find this issue. -->
18 changes: 18 additions & 0 deletions .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
---
name: Feature Request
about: Suggest improvements or new features
labels: feature
assignees: remarkablemark
---

## Problem

<!-- What is missing or inconvenient without this improvement or feature? -->

## Suggested Solution

<!-- How do you suggest fixing the problem? Do any other tools already do it? -->

## Keywords

<!-- Include keywords that might help others with the same problem find this issue. -->
14 changes: 14 additions & 0 deletions .github/ISSUE_TEMPLATE/question.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
---
name: Question
about: Ask a question
labels: question
assignees: remarkablemark
---

## Question

<!-- Check the README, issues, and discussions before asking your question. -->

## Keywords

<!-- Include keywords that might help others with the same question find this issue. -->
30 changes: 30 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<!--
Filling out the information below can facilitate the review/merge of the pull request (PR).
-->

## What is the motivation for this pull request?

<!-- Is this a feature, bug fix, documentation, etc.? -->

## What is the current behavior?

<!-- Please link to the issue (if applicable). -->

## What is the new behavior?

<!-- If this is a feature change or bug fix. -->

## Checklist:

<!--
Feel free to remove any item that is irrelevant to your changes.
To check an item, place an "x" in the box like so: `- [x] Tests`
-->

- [ ] [Conventional Commits](https://www.conventionalcommits.org/)
- [ ] Tests
- [ ] Documentation

<!--
Any other comments? Thank you for contributing!
-->
16 changes: 16 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# To get started with Dependabot version updates, you'll need to specify which
# package ecosystems to update and where the package manifests are located.
# Please see the documentation for all configuration options:
# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates

version: 2
updates:
- package-ecosystem: 'npm'
directory: '/'
schedule:
interval: 'daily'

- package-ecosystem: 'github-actions'
directory: '/'
schedule:
interval: 'daily'
8 changes: 8 additions & 0 deletions .github/mergify.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
pull_request_rules:
- name: automatic merge for Dependabot pull requests
conditions:
- author=dependabot[bot]
- check-success=build
actions:
merge:
method: squash
92 changes: 92 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
name: build
on: [push, pull_request]

permissions:
contents: write

jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Use Node.js
uses: actions/setup-node@v4
with:
cache: npm
node-version-file: .nvmrc

- name: Install dependencies
run: npm install

- name: Lint commit message
run: npx commitlint --from=HEAD~1

- name: Lint codebase
run: npm run lint

- name: Check type
run: npm run lint:tsc

- name: Run tests
run: npm run test:ci

- name: Codecov
uses: codecov/codecov-action@v4
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}

- name: Run action
uses: ./

- name: Build artifact
run: npm run build

- name: Git commit and push
if: github.actor == 'dependabot[bot]'
uses: stefanzweifel/git-auto-commit-action@v5
with:
commit_message: 'feat: update build artifacts'

- name: Check Git working tree
run: |
if [[ $(git diff --stat) != '' ]]; then
echo 'Detected uncommitted changes. See status below:'
git diff
exit 1
fi
# action should work on a clean machine without building
test:
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
version: [2.27.0]
runs-on: ${{ matrix.os }}
steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Run action
uses: ./
with:
cli-version: ${{ matrix.version }}
cli-name: gh

- name: Locate binary
run: command -v gh

- name: Check version
if: matrix.os != 'windows-latest'
run: |
if [[ $(gh --version) != *'${{ matrix.version }}'* ]]; then
echo 'Version does not match. See version below:'
gh --version
exit 1
fi
- name: Show help
run: gh --help
38 changes: 38 additions & 0 deletions .github/workflows/release-please.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: release-please
on:
push:
branches:
- master

permissions:
contents: write
pull-requests: write

jobs:
release-please:
runs-on: ubuntu-latest
outputs:
release_created: ${{ steps.release.outputs.release_created }}

steps:
- name: Release Please
uses: google-github-actions/release-please-action@v4
with:
release-type: node
id: release

- name: Checkout repository
if: ${{ steps.release.outputs.release_created }}
uses: actions/checkout@v4

- name: Tag major and minor versions
if: ${{ steps.release.outputs.release_created }}
run: |
git config user.name 'github-actions[bot]'
git config user.email 'github-actions[bot]@users.noreply.github.com'
git tag -d v${{ steps.release.outputs.major }} || true
git tag -d v${{ steps.release.outputs.major }}.${{ steps.release.outputs.minor }} || true
git tag -a v${{ steps.release.outputs.major }} -m 'Release v${{ steps.release.outputs.major }}'
git tag -a v${{ steps.release.outputs.major }}.${{ steps.release.outputs.minor }} -m 'Release v${{ steps.release.outputs.major }}.${{ steps.release.outputs.minor }}'
git push -f origin v${{ steps.release.outputs.major }}
git push -f origin v${{ steps.release.outputs.major }}.${{ steps.release.outputs.minor }}
47 changes: 47 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# Logs
logs
*.log
npm-debug.log*

# Runtime data
pids
*.pid
*.seed
*.pid.lock

# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov

# Coverage directory used by tools like istanbul
coverage

# nyc test coverage
.nyc_output

# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
.grunt

# node-waf configuration
.lock-wscript

# Compiled binary addons (http://nodejs.org/api/addons.html)
build/Release

# Dependency directories
node_modules
jspm_packages

# Optional npm cache directory
.npm

# Optional eslint cache
.eslintcache

# Optional REPL history
.node_repl_history

# Vim swap files
*.swp

# Mac OS
.DS_Store
1 change: 1 addition & 0 deletions .husky/commit-msg
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
npx commitlint --edit $1
5 changes: 5 additions & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
npm run lint:tsc
npm run build
npm run test:ci
npx lint-staged
git add dist
4 changes: 4 additions & 0 deletions .lintstagedrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"*.ts": "eslint --fix",
"*.{css,js,json,md,yml}": "prettier --write"
}
1 change: 1 addition & 0 deletions .nvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
20
1 change: 1 addition & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
dist
3 changes: 3 additions & 0 deletions .prettierrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"singleQuote": true
}
22 changes: 22 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
The MIT License (MIT)

Copyright (c) 2024 Menglin "Mark" Xu <mark@remarkablemark.org>

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.
Loading

0 comments on commit d79bd77

Please sign in to comment.