-
-
Notifications
You must be signed in to change notification settings - Fork 5
Open
Labels
enhancementNew feature or requestNew feature or requestquestionFurther information is requestedFurther information is requested
Description
Description
Add support for:
- Global constants that can be stored in the repository alongside .env variables
- Multiple output paths by building once and copying to multiple destinations
Reference implementation: https://github.com/mnaoumov/obsidian-dev-utils/blob/main/docs/cli-commands.md#build-development-version
Details
Currently, the build process requires custom scripting to copy built files to multiple locations. This feature would streamline the development workflow by:
- Allowing constants to be defined in a configuration file that's committed to the repository
- Supporting multiple output paths natively, eliminating the need for manual copy operations
- Support generating an obsidian vault folder using the https://github.com/mnaoumov/generator-obsidian-plugin
Desired Behavior
- Accept global constants in addition to .env variables that can be version-controlled with the repository
- Support configuring multiple output paths in the build configuration
- Build the plugin once and automatically copy to all specified destinations
Current Behavior
Currently using a custom hook to achieve this functionality:
scripts\dev.ts
import {
BuildMode,
buildObsidianPlugin,
} from "obsidian-dev-utils/ScriptUtils/esbuild/ObsidianPluginBuilder";
import fs from "fs/promises";
import path from "path";
export async function invoke(): Promise<CliTaskResult> {
try {
console.log("Building plugin in development mode...");
const result = await buildObsidianPlugin({ mode: BuildMode.Development });
// Verify build output exists
const distDir = path.join(process.cwd(), "dist/dev");
try {
await fs.access(distDir);
} catch {
throw new Error(`Build output not found at ${distDir}`);
}
// Copy to test vault
const testVaultPluginDir = path.join(
process.cwd(),
"test-vault/.obsidian/plugins/my-plugin"
);
await fs.mkdir(testVaultPluginDir, { recursive: true });
await fs.cp(distDir, testVaultPluginDir, { recursive: true, force: true });
console.log("Copied to test vault:", testVaultPluginDir);
return result;
} catch (error) {
console.error("Build failed:", error);
throw error;
}
}
Attachments
Not applicable for this feature request.
Confirmations
- I attached a video showing the current behavior, or it is not necessary
- I have tested the absence of the requested feature with the latest version of the utils
- I have checked GitHub for existing Feature Requests
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or requestquestionFurther information is requestedFurther information is requested