init: repository initialisation

This commit is contained in:
dragonish 2025-03-08 20:39:07 +08:00
commit 2e864e9bf9
No known key found for this signature in database
GPG key ID: 6F42FA9E807A5177
21 changed files with 3105 additions and 0 deletions

10
.editorconfig Normal file
View file

@ -0,0 +1,10 @@
# top-most EditorConfig file
root = true
[*]
charset = utf-8
end_of_line = lf
insert_final_newline = true
indent_style = space
indent_size = 2
tab_width = 2

1
.gitattributes vendored Normal file
View file

@ -0,0 +1 @@
package.json text eol=lf

View file

@ -0,0 +1,59 @@
module.exports = {
types: [
{
types: ["feat"],
label: "Features",
},
{
types: ["fix"],
label: "Bug Fixes",
},
{
types: ["perf"],
label: "Performance Improvements",
},
{
types: ["enh"],
label: "Enhancements",
},
{
types: ["tweak"],
label: "Refinements",
},
{
types: ["adjust"],
label: "Adjustments",
},
{
types: ["simplify"],
label: "Simplifications",
},
{
types: ["deprecate"],
label: "Deprecations",
},
{
types: ["ui"],
label: "UI Improvements",
},
{
types: ["security"],
label: "Security Fixes",
},
],
excludeTypes: [
"refactor",
"test",
"docs",
"typo",
"style",
"types",
"chore",
"config",
"build",
"ci",
"revert",
"init",
"merge",
],
};

View file

@ -0,0 +1,70 @@
name: Release
on:
push:
tags:
- '*'
jobs:
build:
runs-on: ubuntu-latest
container: catthehacker/ubuntu:act-latest
env:
HTTP_PROXY: ${{ vars.PROXY }}
HTTPS_PROXY: ${{ vars.PROXY }}
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
fetch-tags: true
- name: Setup pnpm
uses: pnpm/action-setup@v4
with:
version: 10
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: 20
cache: 'pnpm'
- name: Build package
run: |
pnpm install
pnpm run build
- name: Get git tags
id: git_tags
run: |
current=$(git describe --abbrev=0 --tags)
echo "current=${current}" >> $GITHUB_OUTPUT
prev=$(git describe --abbrev=0 --tags `git rev-list --tags --skip=1 --max-count=1`)
echo "prev=${prev}" >> $GITHUB_OUTPUT
- name: Create zip file
run: |
package_file=./package.json
plugin_name=$(cat $package_file | jq -r '.name')
mkdir -p release
zip "./release/${plugin_name}_v${{ steps.git_tags.outputs.current }}.zip" "main.js" "styles.css" "manifest.json"
- name: Create changelog text
id: changelog_text
uses: dragonish/tag-changelog@7ec9e81e765a457f012bf0747f7a5a60831899e2
with:
token: ${{ secrets.ACCESS_TOKEN }}
config_file: ../.gitea/scripts/tag-changelog-config.cjs
- name: Create release
uses: akkuman/gitea-release-action@v1
env:
NODE_OPTIONS: '--experimental-fetch' # if nodejs < 18
with:
server_url: ${{ vars.SERVER }}
files: |-
release/**
token: ${{ secrets.GITHUB_TOKEN }}
name: Release ${{ steps.git_tags.outputs.current }}
body: |
${{ steps.changelog_text.outputs.changes }}
---
## Details
See: [${{ steps.git_tags.outputs.prev }}...${{ steps.git_tags.outputs.current }}](/compare/${{ steps.git_tags.outputs.prev }}...${{ steps.git_tags.outputs.current }})

1
.github/FUNDING.yml vendored Normal file
View file

@ -0,0 +1 @@
ko_fi: monogamy

View file

@ -0,0 +1,59 @@
module.exports = {
types: [
{
types: ["feat"],
label: "Features",
},
{
types: ["fix"],
label: "Bug Fixes",
},
{
types: ["perf"],
label: "Performance Improvements",
},
{
types: ["enh"],
label: "Enhancements",
},
{
types: ["tweak"],
label: "Refinements",
},
{
types: ["adjust"],
label: "Adjustments",
},
{
types: ["simplify"],
label: "Simplifications",
},
{
types: ["deprecate"],
label: "Deprecations",
},
{
types: ["ui"],
label: "UI Improvements",
},
{
types: ["security"],
label: "Security Fixes",
},
],
excludeTypes: [
"refactor",
"test",
"docs",
"typo",
"style",
"types",
"chore",
"config",
"build",
"ci",
"revert",
"init",
"merge",
],
};

49
.github/workflows/release.yaml vendored Normal file
View file

@ -0,0 +1,49 @@
name: Release
on:
push:
tags:
- '*'
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
fetch-tags: true
- name: Setup pnpm
uses: pnpm/action-setup@v4
with:
version: 10
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: 20
cache: 'pnpm'
- name: Build package
run: |
pnpm install
pnpm run build
- name: Create changelog text
id: changelog_text
uses: loopwerk/tag-changelog@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
config_file: .github/scripts/tag-changelog-config.cjs
- name: Get git tags
id: git_tags
run: |
current=$(git describe --abbrev=0 --tags)
echo "current=${current}" >> $GITHUB_OUTPUT
- name: Create release
uses: ncipollo/release-action@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
name: Release ${{ steps.git_tags.outputs.current }}
prerelease: false
draft: false
artifacts: "main.js,styles.css,manifest.json"
body: ${{ steps.changelog_text.outputs.changes }}

22
.gitignore vendored Normal file
View file

@ -0,0 +1,22 @@
# vscode
.vscode
# Intellij
*.iml
.idea
# npm
node_modules
# Don't include the compiled main.js file in the repo.
# They should be uploaded to GitHub releases instead.
main.js
# Exclude sourcemaps
*.map
# obsidian
data.json
# Exclude macOS Finder (System Explorer) View States
.DS_Store

1
.npmrc Normal file
View file

@ -0,0 +1 @@
tag-version-prefix=""

12
.versionrc.json Normal file
View file

@ -0,0 +1,12 @@
{
"bumpFiles": [
{
"filename": "./package.json",
"type": "json"
},
{
"filename": "./manifest.json",
"type": "json"
}
]
}

21
LICENSE Normal file
View file

@ -0,0 +1,21 @@
MIT License
Copyright (c) 2025 dragonish
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.

9
README.md Normal file
View file

@ -0,0 +1,9 @@
# Heading Decorator
> Obsidian Plugin
## Introduction
This is a plugin for [Obsidian](https://obsidian.md).
Implements the decoration of the heading.

49
esbuild.config.mjs Normal file
View file

@ -0,0 +1,49 @@
import esbuild from "esbuild";
import process from "process";
import builtins from "builtin-modules";
const banner = `/*
THIS IS A GENERATED/BUNDLED FILE BY ESBUILD
if you want to view the source, please visit the github repository of this plugin
*/
`;
const prod = process.argv[2] === "production";
const context = await esbuild.context({
banner: {
js: banner,
},
entryPoints: ["main.ts"],
bundle: true,
external: [
"obsidian",
"electron",
"@codemirror/autocomplete",
"@codemirror/collab",
"@codemirror/commands",
"@codemirror/language",
"@codemirror/lint",
"@codemirror/search",
"@codemirror/state",
"@codemirror/view",
"@lezer/common",
"@lezer/highlight",
"@lezer/lr",
...builtins,
],
format: "cjs",
target: "es2018",
logLevel: "info",
sourcemap: prod ? false : "inline",
treeShaking: true,
outfile: "main.js",
minify: prod,
});
if (prod) {
await context.rebuild();
process.exit(0);
} else {
await context.watch();
}

0
main.ts Normal file
View file

11
manifest.json Normal file
View file

@ -0,0 +1,11 @@
{
"id": "heading-decorator",
"name": "Heading Decorator",
"version": "1.0.0",
"minAppVersion": "0.15.0",
"description": "Implements the decoration of the heading.",
"author": "dragonish",
"authorUrl": "https://github.com/dragonish",
"fundingUrl": "https://ko-fi.com/monogamy",
"isDesktopOnly": false
}

41
package.json Normal file
View file

@ -0,0 +1,41 @@
{
"name": "obsidian-heading-decorator",
"version": "1.0.0",
"description": "Heading Decorator",
"main": "main.js",
"scripts": {
"dev": "node esbuild.config.mjs",
"build": "tsc -noEmit -skipLibCheck && node esbuild.config.mjs production",
"version": "node version-bump.mjs && git add manifest.json versions.json",
"release": "standard-version -t ''"
},
"keywords": [],
"author": "dragonish",
"license": "MIT",
"devDependencies": {
"@codemirror/state": "^6.5.2",
"@codemirror/view": "^6.36.4",
"@eslint/js": "^9.22.0",
"@types/node": "^20.17.24",
"@typescript-eslint/eslint-plugin": "^8.26.0",
"@typescript-eslint/parser": "^8.26.0",
"builtin-modules": "5.0.0",
"esbuild": "^0.25.0",
"eslint": "^9.22.0",
"obsidian": "^1.8.7",
"standard-version": "^9.5.0",
"tslib": "^2.8.1",
"typescript": "^5.8.2",
"typescript-eslint": "^8.26.0"
},
"pnpm": {
"onlyBuiltDependencies": [
"esbuild"
]
},
"standard-version": {
"skip": {
"changelog": true
}
}
}

2656
pnpm-lock.yaml Normal file

File diff suppressed because it is too large Load diff

0
styles.css Normal file
View file

17
tsconfig.json Normal file
View file

@ -0,0 +1,17 @@
{
"compilerOptions": {
"baseUrl": ".",
"inlineSourceMap": true,
"inlineSources": true,
"module": "ESNext",
"target": "ES6",
"allowJs": true,
"noImplicitAny": true,
"moduleResolution": "node",
"importHelpers": true,
"isolatedModules": true,
"strictNullChecks": true,
"lib": ["DOM", "ES5", "ES6", "ES7"]
},
"include": ["**/*.ts"]
}

14
version-bump.mjs Normal file
View file

@ -0,0 +1,14 @@
import { readFileSync, writeFileSync } from "fs";
const targetVersion = process.env.npm_package_version;
// read minAppVersion from manifest.json and bump version to target version
let manifest = JSON.parse(readFileSync("manifest.json", "utf8"));
const { minAppVersion } = manifest;
manifest.version = targetVersion;
writeFileSync("manifest.json", JSON.stringify(manifest, null, "\t"));
// update versions.json with target version and minAppVersion from manifest.json
let versions = JSON.parse(readFileSync("versions.json", "utf8"));
versions[targetVersion] = minAppVersion;
writeFileSync("versions.json", JSON.stringify(versions, null, "\t"));

3
versions.json Normal file
View file

@ -0,0 +1,3 @@
{
"1.0.0": "0.15.0"
}