mirror of
https://github.com/sgranade/manuscriptum.git
synced 2026-07-22 06:43:11 +00:00
chore: Add Obsidian plugin manifest.
This commit is contained in:
parent
0656add3ed
commit
aed556586c
3 changed files with 35 additions and 2 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
|
@ -8,4 +8,5 @@ node_modules
|
|||
# VSCode
|
||||
.vscode
|
||||
|
||||
# Other
|
||||
TODO.md
|
||||
|
|
@ -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
10
manifest.json
Normal 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
|
||||
}
|
||||
Loading…
Reference in a new issue