Skip to content

Commit

Permalink
first commit
Browse files Browse the repository at this point in the history
  • Loading branch information
Lruihao committed Sep 6, 2024
0 parents commit 6ec6b2d
Show file tree
Hide file tree
Showing 14 changed files with 564 additions and 0 deletions.
25 changes: 25 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# 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" # See documentation for possible values
directory: "/" # Location of package manifests
schedule:
interval: "monthly"
open-pull-requests-limit: 1000
assignees:
- "Lruihao"
labels:
- "dependencies"
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "monthly"
open-pull-requests-limit: 1000
assignees:
- "Lruihao"
labels:
- "dependencies"
19 changes: 19 additions & 0 deletions .github/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
changelog:
exclude:
labels:
- ignore-for-release
authors:
- dependabot
categories:
- title: New features
labels:
- new feature
- title: Enhancement
labels:
- enhancement
- title: Fixes
labels:
- bug
- title: Other Changes
labels:
- "*"
30 changes: 30 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: Publish Package to npmjs

on:
release:
types: [published]

jobs:
publish-npm:
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v4

# Setup .npmrc file to publish to npm
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: 18
registry-url: 'https://registry.npmjs.org'
# Defaults to the user or organization that owns the workflow file
# scope: '@cell-x'

- name: Install dependencies
run: npm ci

- name: Publish Package to npmjs
run: npm publish
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
47 changes: 47 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# This is a basic workflow to help you get started with Actions

name: Release for new tag

# Controls when the action will run.
on:
# Triggers the workflow on push or pull request events but only for the master branch
push:
tags:
- 'v*.*.*'

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# This workflow contains a single job called "build"
build:
# The type of runner that the job will run on
runs-on: ubuntu-latest

# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- name: Checkout repository
uses: actions/checkout@v4

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 16

- name: Install dependencies
run: npm ci

- name: GitHub Release
uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/')
with:
# Creates a draft release. Defaults to false
draft: true
# Newline-delimited list of path globs for asset files to upload
# files: |
# dist/*.js
# dist/*.js.map
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
node_modules/
1 change: 1 addition & 0 deletions .nvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
v18
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 Lruihao (https://lruihao.cn)

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.
17 changes: 17 additions & 0 deletions changelog/config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"output": "CHANGELOG.md",
"sortCommits": "relevance",
"commitLimit": false,
"ignoreCommitPattern": "(Chore|chore):|\\(ignore\\)",
"replaceText": {
"^(Feat|feat):": ":sparkles: Feat:",
"^(Fix|fix):": ":bug: Fix:",
"^(Build|build):": ":hammer: Build:",
"^(Refactor|refactor):": ":recycle: Refactor:",
"^(Style|style):": ":lipstick: Style:",
"^(Perf|perf):": ":zap: Perf:",
"^(Test|test):": ":white_check_mark: Test:",
"^(Docs|docs):": ":memo: Docs:",
"^(Chore|chore):": ":wrench: Chore:"
}
}
31 changes: 31 additions & 0 deletions changelog/setup.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
// Custom Handlebars helpers
module.exports = function (Handlebars) {
/**
* Handlebars helper to replace a string with another string
* @param {String} context the string to replace
* @param {Object} options
* @param {String} options.hash.from the string to replace
* @param {String} options.hash.to the string to replace with
* @example {{replace "foo bar" from="foo" to="baz"}} => "baz bar"
*/
Handlebars.registerHelper('replace', function (context, options) {
return context.replace(options.hash.from, options.hash.to)
})
/**
* Handlebars helper to convert a name to a GitHub username
* @param {String} context name to convert
* @param {Object} options
* @param {Boolean} [options.hash.linked=true] whether to return a linked username
* @example {{githubUser "Cell"}} => "Lruihao"
*/
Handlebars.registerHelper('githubUser', function (context, { hash: { linked = false }}) {
const map = {
'Cell': "Lruihao",
}
const username = map[context] || context
if (linked) {
return `[@${username}](https://github.com/${username})`
}
return `@${username}`
})
}
70 changes: 70 additions & 0 deletions changelog/template.hbs
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
# Changelog

All notable changes to this project will be documented in this file.
{{!-- if need, set replaceText in config.json "#(\\d+)": "[#$1](https://github.com/hugo-fixit/FixIt/issues/$1)" --}}

{{#each releases}}
{{#if href}}
## [{{title}}]({{href}}){{#if tag}} - {{isoDate}}{{/if}}
{{else}}
## {{title}}{{#if tag}} - {{isoDate}}{{/if}}
{{/if}}

{{#if summary}}
{{summary}}
{{/if}}

{{!-- List commits with `Breaking change: ` somewhere in the message --}}
{{#commit-list commits heading='### :boom: Breaking Changes' message='(:boom:|Breaking change:|BREAKING CHANGE:)'}}
- {{subject}} [`{{shorthash}}`]({{href}}) by {{githubUser author}}
{{/commit-list}}

{{!-- List commits that add new features, but exclude those that have `:sparkles:` in the message --}}
{{#commit-list commits heading='### :tada: New Features' message='(:tada:|Feat:|feat:)' exclude='^:sparkles:'}}
- {{subject}} [`{{shorthash}}`]({{href}}) by {{githubUser author}}
{{/commit-list}}

{{!-- List commits that enhance existing features, but exclude those that have `:tada:` in the message --}}
{{#commit-list commits heading='### :sparkles: Enhancements' message='(:sparkles:|Feat:|feat:|Perf:|perf:)' exclude='^:tada:'}}
- {{subject}} [`{{shorthash}}`]({{href}}) by {{githubUser author}}
{{/commit-list}}

{{!-- List commits that bug fixes --}}
{{#commit-list commits heading='### :bug: Bug Fixes' message='(:bug:|Fix:|fix:)'}}
- {{subject}} [`{{shorthash}}`]({{href}}) by {{githubUser author}}
{{/commit-list}}

{{!-- List commits that improve the documentation --}}
{{#commit-list commits heading='### :memo: Documentation' message='(:memo:|Docs:|docs:)'}}
- {{subject}} [`{{shorthash}}`]({{href}}) by {{githubUser author}}
{{/commit-list}}

{{!-- List other changes commits --}}
{{#commit-list commits heading='### :wrench: Other Changes' message='(Refactor:|refactor:|Style:|style:|Test:|test:|Chore:|chore:|Build:|build:)'}}
- {{subject}} [`{{shorthash}}`]({{href}}) by {{githubUser author}}
{{/commit-list}}

**Full Changelog**: {{href}}

---

### Uncategorized

{{#if merges}}
#### Merged pull requests

{{#each merges}}
{{!-- {{#if href}}[`#{{id}}`]({{href}}){{/if}} --}}
- {{#if commit.breaking}}**Breaking change:** {{/if}}{{message}} by {{githubUser author}} in {{#if id}}#{{id}}{{/if}}
{{/each}}
{{/if}}

{{#if fixes}}
#### Closed issues

{{#each fixes}}
- {{#if commit.breaking}}**Breaking change:** {{/if}}{{commit.subject}}{{#each fixes}} {{#if id}}#{{id}}{{/if}}{{/each}} by {{githubUser commit.author}}
{{/each}}
{{/if}}

{{/each}}
Loading

0 comments on commit 6ec6b2d

Please sign in to comment.