mirror of
https://github.com/hananoshikayomaru/Obsidian-Frontmatter-Generator.git
synced 2026-07-22 08:40:34 +00:00
release: 1.0.6
This commit is contained in:
parent
640f4f2d8b
commit
28df9ee28f
7 changed files with 145 additions and 77 deletions
2
.github/FUNDING.yml
vendored
Normal file
2
.github/FUNDING.yml
vendored
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
github: [hananoshikayomaru]
|
||||
custom: https://www.buymeacoffee.com/yomaru
|
||||
38
README.md
38
README.md
|
|
@ -13,9 +13,9 @@ for example, the following frontmatter template
|
|||
|
||||
```ts
|
||||
{
|
||||
folder: file.parent.path;
|
||||
title: file.basename;
|
||||
test: ["1", "2"];
|
||||
folder: file.parent.path;
|
||||
title: file.basename;
|
||||
test: ["1", "2"];
|
||||
}
|
||||
```
|
||||
|
||||
|
|
@ -29,7 +29,7 @@ test:
|
|||
- "2"
|
||||
```
|
||||
|
||||
Demo: https://youtu.be/Cz9d5e1WQVM
|
||||
Demo: <https://youtu.be/Cz9d5e1WQVM>
|
||||
|
||||
## Advanced usage
|
||||
|
||||
|
|
@ -37,20 +37,20 @@ Demo: https://youtu.be/Cz9d5e1WQVM
|
|||
|
||||
```ts
|
||||
file.properties?.type === "kanban"
|
||||
? {
|
||||
folder: file.parent.path,
|
||||
title: file.basename,
|
||||
}
|
||||
: {};
|
||||
? {
|
||||
folder: file.parent.path,
|
||||
title: file.basename,
|
||||
}
|
||||
: {};
|
||||
```
|
||||
|
||||
### function
|
||||
|
||||
```ts
|
||||
{
|
||||
test: (() => {
|
||||
return { test: "test" };
|
||||
})();
|
||||
test: (() => {
|
||||
return { test: "test" };
|
||||
})();
|
||||
}
|
||||
```
|
||||
|
||||
|
|
@ -58,7 +58,7 @@ file.properties?.type === "kanban"
|
|||
|
||||
```ts
|
||||
{
|
||||
numberOfPages: dv.pages("#ai").length;
|
||||
numberOfPages: dv.pages("#ai").length;
|
||||
}
|
||||
```
|
||||
|
||||
|
|
@ -70,21 +70,17 @@ It could be a json or a javascript expression that return an object.
|
|||
|
||||
<small>^ even functions work</small>
|
||||
|
||||

|
||||
|
||||
<small>^ async function doesn't work</small>
|
||||
|
||||
## Variable that it can access
|
||||
|
||||
- `file`, the [`TFile`](https://docs.obsidian.md/Reference/TypeScript+API/TFile/TFile) object
|
||||
- `file.properties` will access the yaml object of the current file
|
||||
- `dv`, the [dataview](https://blacksmithgu.github.io/obsidian-dataview/) object (you can only access this if you install and enable the dataview plugin)
|
||||
- `file`, the [`TFile`](https://docs.obsidian.md/Reference/TypeScript+API/TFile/TFile) object
|
||||
- `file.properties` will access the yaml object of the current file
|
||||
- `dv`, the [dataview](https://blacksmithgu.github.io/obsidian-dataview/) object (you can only access this if you install and enable the dataview plugin)
|
||||
|
||||
## Installation
|
||||
|
||||
### Install on obsidian plugin marketplace
|
||||
|
||||
⏳ Still waiting for review and approval: https://github.com/obsidianmd/obsidian-releases/pull/2502
|
||||
⏳ Still waiting for review and approval: <https://github.com/obsidianmd/obsidian-releases/pull/2502>
|
||||
|
||||
### Manual Install
|
||||
|
||||
|
|
|
|||
BIN
bun.lockb
BIN
bun.lockb
Binary file not shown.
|
|
@ -1,11 +1,11 @@
|
|||
{
|
||||
"id": "frontmatter-generator",
|
||||
"name": "Frontmatter generator",
|
||||
"version": "1.0.4",
|
||||
"version": "1.0.5",
|
||||
"minAppVersion": "0.15.0",
|
||||
"description": "Generate frontmatter for your notes from json and javascript",
|
||||
"author": "Hananoshika Yomaru",
|
||||
"authorUrl": "https://yomaru.dev",
|
||||
"fundingUrl": "https://www.buymeacoffee.com/yomaru",
|
||||
"isDesktopOnly": false
|
||||
}
|
||||
}
|
||||
109
package.json
109
package.json
|
|
@ -1,55 +1,58 @@
|
|||
{
|
||||
"name": "obsidian-frontmatter-generator",
|
||||
"version": "1.0.5",
|
||||
"description": "A plugin for Obsidian that generates frontmatter for notes.",
|
||||
"main": "main.js",
|
||||
"scripts": {
|
||||
"dev": "bun esbuild.config.mjs",
|
||||
"build": "bun esbuild.config.mjs production",
|
||||
"version": "bun version-bump.mjs && git add manifest.json versions.json",
|
||||
"prepare": "husky install"
|
||||
},
|
||||
"keywords": [
|
||||
"obsidian",
|
||||
"plugin",
|
||||
"frontmatter",
|
||||
"generator",
|
||||
"yaml",
|
||||
"dataview"
|
||||
],
|
||||
"author": "Hananoshika Yomaru",
|
||||
"license": "MIT",
|
||||
"devDependencies": {
|
||||
"@types/diff-match-patch": "^1.0.34",
|
||||
"@types/js-yaml": "^4.0.6",
|
||||
"@types/node": "^16.11.6",
|
||||
"@typescript-eslint/eslint-plugin": "5.29.0",
|
||||
"@typescript-eslint/parser": "5.29.0",
|
||||
"builtin-modules": "3.3.0",
|
||||
"bun-types": "^1.0.3",
|
||||
"esbuild": "0.17.3",
|
||||
"husky": "^8.0.3",
|
||||
"obsidian": "latest",
|
||||
"tslib": "2.4.0",
|
||||
"typescript": "^5.0.5"
|
||||
},
|
||||
"dependencies": {
|
||||
"@total-typescript/ts-reset": "^0.5.1",
|
||||
"diff-match-patch": "^1.0.5",
|
||||
"js-yaml": "^4.1.0",
|
||||
"mdast-util-from-markdown": "^1.2.0",
|
||||
"mdast-util-gfm-footnote": "^1.0.1",
|
||||
"mdast-util-gfm-task-list-item": "^1.0.1",
|
||||
"mdast-util-math": "^2.0.1",
|
||||
"micromark-extension-gfm-footnote": "^1.0.4",
|
||||
"micromark-extension-gfm-task-list-item": "^1.0.3",
|
||||
"micromark-extension-math": "^2.0.2",
|
||||
"micromark-util-combine-extensions": "^1.0.0",
|
||||
"obsidian-dataview": "^0.5.59",
|
||||
"quick-lru": "^6.1.1",
|
||||
"ts-dedent": "^2.2.0",
|
||||
"ts-pattern": "^5.0.5",
|
||||
"unist-util-visit": "^4.1.2",
|
||||
"zod": "^3.22.2"
|
||||
}
|
||||
"name": "obsidian-frontmatter-generator",
|
||||
"version": "1.0.6",
|
||||
"description": "A plugin for Obsidian that generates frontmatter for notes.",
|
||||
"main": "main.js",
|
||||
"scripts": {
|
||||
"dev": "bun esbuild.config.mjs",
|
||||
"build": "bun esbuild.config.mjs production",
|
||||
"version": "bun version-bump.mjs && git add manifest.json versions.json",
|
||||
"prepare": "husky install",
|
||||
"release": "bash release.sh",
|
||||
"typecheck": "tsc -noEmit -skipLibCheck",
|
||||
"lint": "eslint . --ext .ts --fix"
|
||||
},
|
||||
"keywords": [
|
||||
"obsidian",
|
||||
"plugin",
|
||||
"frontmatter",
|
||||
"generator",
|
||||
"yaml",
|
||||
"dataview"
|
||||
],
|
||||
"author": "Hananoshika Yomaru",
|
||||
"license": "MIT",
|
||||
"devDependencies": {
|
||||
"@types/diff-match-patch": "^1.0.34",
|
||||
"@types/js-yaml": "^4.0.6",
|
||||
"@types/node": "^16.11.6",
|
||||
"@typescript-eslint/eslint-plugin": "5.29.0",
|
||||
"@typescript-eslint/parser": "5.29.0",
|
||||
"builtin-modules": "3.3.0",
|
||||
"bun-types": "^1.0.3",
|
||||
"esbuild": "0.17.3",
|
||||
"husky": "^8.0.3",
|
||||
"obsidian": "latest",
|
||||
"tslib": "2.4.0",
|
||||
"typescript": "^5.0.5"
|
||||
},
|
||||
"dependencies": {
|
||||
"@total-typescript/ts-reset": "^0.5.1",
|
||||
"diff-match-patch": "^1.0.5",
|
||||
"js-yaml": "^4.1.0",
|
||||
"mdast-util-from-markdown": "^1.2.0",
|
||||
"mdast-util-gfm-footnote": "^1.0.1",
|
||||
"mdast-util-gfm-task-list-item": "^1.0.1",
|
||||
"mdast-util-math": "^2.0.1",
|
||||
"micromark-extension-gfm-footnote": "^1.0.4",
|
||||
"micromark-extension-gfm-task-list-item": "^1.0.3",
|
||||
"micromark-extension-math": "^2.0.2",
|
||||
"micromark-util-combine-extensions": "^1.0.0",
|
||||
"obsidian-dataview": "^0.5.61",
|
||||
"quick-lru": "^6.1.1",
|
||||
"ts-dedent": "^2.2.0",
|
||||
"ts-pattern": "^5.0.5",
|
||||
"unist-util-visit": "^4.1.2",
|
||||
"zod": "^3.22.2"
|
||||
}
|
||||
}
|
||||
|
|
|
|||
66
release.sh
Normal file
66
release.sh
Normal file
|
|
@ -0,0 +1,66 @@
|
|||
#!/bin/bash
|
||||
|
||||
# Set the default update type
|
||||
UPDATE_TYPE="patch"
|
||||
|
||||
# Parse command-line arguments
|
||||
while [[ $# -gt 0 ]]; do
|
||||
key="$1"
|
||||
case $key in
|
||||
-m | --minor)
|
||||
UPDATE_TYPE="minor"
|
||||
shift
|
||||
;;
|
||||
-M | --major)
|
||||
UPDATE_TYPE="major"
|
||||
shift
|
||||
;;
|
||||
*)
|
||||
echo "Unknown option: $key"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
# Get the version number from manifest.json
|
||||
MANIFEST_VERSION=$(jq -r '.version' manifest.json)
|
||||
|
||||
# Get the version number from package.json
|
||||
PACKAGE_VERSION=$(node -p -e "require('./package.json').version")
|
||||
|
||||
# Ensure the version from package.json matches the version in manifest.json
|
||||
if [ "$PACKAGE_VERSION" != "$MANIFEST_VERSION" ]; then
|
||||
echo "Version mismatch between package.json and manifest.json"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Increment the version based on the specified update type
|
||||
if [ "$UPDATE_TYPE" = "minor" ]; then
|
||||
NEW_VERSION=$(semver $PACKAGE_VERSION -i minor)
|
||||
elif [ "$UPDATE_TYPE" = "major" ]; then
|
||||
NEW_VERSION=$(semver $PACKAGE_VERSION -i major)
|
||||
else
|
||||
NEW_VERSION=$(semver $PACKAGE_VERSION -i patch)
|
||||
fi
|
||||
|
||||
echo "Current version: $PACKAGE_VERSION"
|
||||
echo "New version: $NEW_VERSION"
|
||||
|
||||
# Update the version in package.json
|
||||
jq --arg version "$NEW_VERSION" '.version = $version' package.json >tmp.json && mv tmp.json package.json
|
||||
echo "Changed package.json version to $NEW_VERSION"
|
||||
|
||||
# Print the updated version of manifest.json using 'bun'
|
||||
bun run version
|
||||
echo "Updated version of manifest using bun. The current version of manifest.json is $(jq -r '.version' manifest.json)"
|
||||
|
||||
# Create a git commit and tag
|
||||
git add . && git commit -m "release: $NEW_VERSION"
|
||||
git tag -a "$NEW_VERSION" -m "release: $NEW_VERSION"
|
||||
echo "Created tag $NEW_VERSION"
|
||||
|
||||
# Push the commit and tag to the remote repository
|
||||
git push origin "$NEW_VERSION"
|
||||
echo "Pushed tag $NEW_VERSION to the origin branch $NEW_VERSION"
|
||||
git push
|
||||
echo "Pushed to the origin master branch"
|
||||
|
|
@ -3,5 +3,6 @@
|
|||
"1.0.1": "0.15.0",
|
||||
"1.0.2": "0.15.0",
|
||||
"1.0.3": "0.15.0",
|
||||
"1.0.4": "0.15.0"
|
||||
"1.0.4": "0.15.0",
|
||||
"1.0.5": "0.15.0"
|
||||
}
|
||||
Loading…
Reference in a new issue