chore: Add Obsidian plugin manifest.

This commit is contained in:
Stephen Granade 2025-09-01 11:05:32 -05:00
parent 0656add3ed
commit aed556586c
3 changed files with 35 additions and 2 deletions

1
.gitignore vendored
View file

@ -8,4 +8,5 @@ node_modules
# VSCode
.vscode
# Other
TODO.md

View file

@ -1,9 +1,10 @@
import esbuild from "esbuild";
import process from "process";
import { readFileSync } from "fs";
import { readFileSync, writeFileSync } from "fs";
const pkg = JSON.parse(readFileSync("./package.json", "utf8"));
const banner = `/*! ${pkg.name} v${pkg.version} | (c) ${pkg.author.name} | ${pkg.author.url} */`;
const outdir = "dist";
/**
* @type {import('esbuild').Plugin}
@ -27,6 +28,26 @@ const esbuildProblemMatcherPlugin = {
},
};
/**
* Copy `manifest.json` to outdir, updating its version to match what's in `package.json`.
* @type {import('esbuild').Plugin}
*/
const updateManifestPlugin = {
name: "update-manifest",
setup(build) {
build.onEnd(() => {
const manifest = JSON.parse(readFileSync("manifest.json", "utf8"));
manifest.version = pkg.version;
writeFileSync(
outdir + "/manifest.json",
JSON.stringify(manifest, null, 2)
);
console.log("✅ manifest.json updated");
});
},
};
const production = process.argv.includes("--production");
const watch = process.argv.includes("--watch");
@ -43,9 +64,10 @@ const ctx = await esbuild.context({
bundle: true,
sourcemap: production ? false : "inline",
treeShaking: true,
outdir: "dist",
outdir: outdir,
minify: production,
plugins: [
updateManifestPlugin,
/* add to the end of plugins array */
esbuildProblemMatcherPlugin,
],

10
manifest.json Normal file
View file

@ -0,0 +1,10 @@
{
"id": "manuscripten",
"name": "Manuscripten",
"version": "x.x.x",
"minAppVersion": "1.5.7",
"description": "Obsidian plugin to create .docx files that contain story and novel manuscripts for submission to magazines or agents.",
"author": "Stephen Granade",
"authorUrl": "https://github.com/sgranade",
"isDesktopOnly": true
}