Merge remote changes

This commit is contained in:
Kossi D. T. Saka 2023-01-26 07:37:18 +01:00
commit 639cef9c7d
2 changed files with 23 additions and 21 deletions

View File

@ -37,29 +37,31 @@ const buildOptions = {
...builtins,
],
format: "cjs",
watch: !prod,
target: "es2018",
logLevel: "info",
sourcemap: prod ? false : "inline",
treeShaking: true,
};
esbuild
.build(buildOptions)
.catch(() => process.exit(1))
.then(() => {
/**
* If there is a new version number, copy it to the dist folder
*/
if (process.env.npm_new_version) {
const manifestJsonSrc = path.join(process.cwd(), "manifest.json");
const manifestJsonDist = path.join(
process.cwd(),
buildOptions.outdir,
"manifest.json"
);
const context = await esbuild.context(buildOptions);
// Copy the manifest.json file over to the dist folder
copyFileSync(manifestJsonSrc, manifestJsonDist);
}
});
if (prod) {
await context.rebuild();
/**
* If there is a new version number, copy it to the dist folder
*/
if (process.env.npm_new_version) {
const manifestJsonSrc = path.join(process.cwd(), "manifest.json");
const manifestJsonDist = path.join(
process.cwd(),
buildOptions.outdir,
"manifest.json"
);
// Copy the manifest.json file over to the dist folder
copyFileSync(manifestJsonSrc, manifestJsonDist);
}
process.exit(0);
} else {
await context.watch();
}

View File

@ -1,6 +1,6 @@
{
"name": "obsidian-sample-plugin",
"version": "1.0.1",
"version": "1.0.0",
"description": "This is a sample plugin for Obsidian (https://obsidian.md)",
"main": "main.js",
"scripts": {
@ -16,7 +16,7 @@
"@typescript-eslint/eslint-plugin": "5.29.0",
"@typescript-eslint/parser": "5.29.0",
"builtin-modules": "3.3.0",
"esbuild": "0.14.47",
"esbuild": "0.17.3",
"obsidian": "latest",
"tslib": "2.4.0",
"typescript": "4.7.4"