build cleanup (#17)

* style: cleanup file formatting

* chore: simplify build

* chore: cleanup package.json
This commit is contained in:
Keath Milligan 2026-02-10 18:31:53 -06:00 committed by GitHub
parent 7435a160b7
commit 62a1893a97
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 740 additions and 774 deletions

View file

@ -1,34 +0,0 @@
// copy-styles.mjs
import { promises as fs } from 'fs';
import path from 'path';
// Ensure the dist directory exists
async function ensureDir(dir) {
try {
await fs.mkdir(dir, { recursive: true });
} catch (error) {
if (error.code !== 'EEXIST') {
throw error;
}
}
}
async function copyFiles() {
const distDir = path.resolve('./dist');
await ensureDir(distDir);
try {
// Copy styles.css to dist directory
await fs.copyFile('./styles.css', path.join(distDir, 'styles.css'));
console.log('Successfully copied styles.css to dist directory');
// Copy manifest.json to dist directory
await fs.copyFile('./manifest.json', path.join(distDir, 'manifest.json'));
console.log('Successfully copied manifest.json to dist directory');
} catch (error) {
console.error('Error copying files:', error);
process.exit(1);
}
}
copyFiles();

View file

@ -3,7 +3,7 @@ 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
*/
@ -37,7 +37,7 @@ const context = await esbuild.context({
logLevel: "info",
sourcemap: prod ? false : "inline",
treeShaking: true,
outfile: "dist/main.js",
outfile: "main.js",
minify: prod,
});

View file

@ -1,11 +1,11 @@
{
"name": "obsidian-sample-plugin",
"name": "obsidian-paste-reformatter",
"version": "1.4.0",
"description": "This is a sample plugin for Obsidian (https://obsidian.md)",
"main": "dist/main.js",
"description": "Reformat pasted text for precise control.",
"main": "main.js",
"scripts": {
"dev": "node esbuild.config.mjs && node copy-styles.mjs",
"build": "tsc -noEmit -skipLibCheck && node esbuild.config.mjs production && node copy-styles.mjs",
"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"
},
"keywords": [],