From d7385546c0e91ed6d405a5471d062030ef12702f Mon Sep 17 00:00:00 2001 From: PtiCalin <143633151+PtiCalin@users.noreply.github.com> Date: Tue, 17 Jun 2025 21:35:28 -0400 Subject: [PATCH] =?UTF-8?q?temp:=20restructure=20and=20enhance=20VaultOS?= =?UTF-8?q?=20plugin=20template=20with=20updated=20configurations=20and=20?= =?UTF-8?q?improved=20documentation=20#=20=F0=9F=93=9D=20Pull=20Request=20?= =?UTF-8?q?Summary?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## πŸ“Œ What does this PR do? restructure and enhance VaultOS plugin template with updated configurations and improved documentation ## πŸ” Related Issues None ## βœ… Type of Change - [ ] ✨ New plugin module/content - [x] πŸ›  Refactor - [ ] πŸ› Bug fix - [ ] 🌟 Feature addition - [ ] 🧹 Cleanup - [ ] πŸ§ͺ Experiment / Test - [ ] 🧭 Documentation - [ ] 🎯 Template improvement ## 🧠 Description of Changes ## πŸ”„ How to Test n/a ## πŸ“‹ Checklist - [ ] I have reviewed my changes - [ ] I have tested the changes - [ ] The PR title follows the project's naming conventions - [ ] Related issues are linked --- .editorconfig | 10 ++ .eslintignore | 3 + .eslintrc | 23 ++++ .github/CODE_OF_CONDUCT.md | 9 ++ .github/CONTRIBUTING.md | 87 +++++++++++++ .github/FUNDING.md | 4 + .github/ISSUE_TEMPLATE/bug.yml | 31 +++++ .github/ISSUE_TEMPLATE/bug_report.md | 21 ++++ .github/ISSUE_TEMPLATE/cleanup.yml | 19 +++ .github/ISSUE_TEMPLATE/content.yml | 26 ++++ .github/ISSUE_TEMPLATE/documentation.yml | 19 +++ .github/ISSUE_TEMPLATE/feature-request.yml | 24 ++++ .github/ISSUE_TEMPLATE/feature_request.md | 14 +++ .github/ISSUE_TEMPLATE/general.yml | 19 +++ .github/ISSUE_TEMPLATE/goal-planning.yml | 24 ++++ .github/ISSUE_TEMPLATE/refractor.yml | 26 ++++ .github/ISSUE_TEMPLATE/test.yml | 26 ++++ .github/LICENSE | 21 ++++ .github/SECURITY.md | 7 ++ .github/config.yml | 70 +++++++++++ .github/pull_request_template.md | 33 +++++ .github/workflows/build.yml | 22 ++++ .github/workflows/main.yml | 23 ++++ .gitignore | 22 ++++ .npmrc | 1 + README.md | 129 ++++++++++++++++++++ esbuild.config.mjs | 49 ++++++++ main.ts | 134 +++++++++++++++++++++ manifest.json | 14 +++ package.json | 30 +++++ styles.css | 67 +++++++++++ tsconfig.json | 24 ++++ version-bump.mjs | 14 +++ versions.json | 3 + 34 files changed, 1048 insertions(+) create mode 100644 .editorconfig create mode 100644 .eslintignore create mode 100644 .eslintrc create mode 100644 .github/CODE_OF_CONDUCT.md create mode 100644 .github/CONTRIBUTING.md create mode 100644 .github/FUNDING.md create mode 100644 .github/ISSUE_TEMPLATE/bug.yml create mode 100644 .github/ISSUE_TEMPLATE/bug_report.md create mode 100644 .github/ISSUE_TEMPLATE/cleanup.yml create mode 100644 .github/ISSUE_TEMPLATE/content.yml create mode 100644 .github/ISSUE_TEMPLATE/documentation.yml create mode 100644 .github/ISSUE_TEMPLATE/feature-request.yml create mode 100644 .github/ISSUE_TEMPLATE/feature_request.md create mode 100644 .github/ISSUE_TEMPLATE/general.yml create mode 100644 .github/ISSUE_TEMPLATE/goal-planning.yml create mode 100644 .github/ISSUE_TEMPLATE/refractor.yml create mode 100644 .github/ISSUE_TEMPLATE/test.yml create mode 100644 .github/LICENSE create mode 100644 .github/SECURITY.md create mode 100644 .github/config.yml create mode 100644 .github/pull_request_template.md create mode 100644 .github/workflows/build.yml create mode 100644 .github/workflows/main.yml create mode 100644 .gitignore create mode 100644 .npmrc create mode 100644 README.md create mode 100644 esbuild.config.mjs create mode 100644 main.ts create mode 100644 manifest.json create mode 100644 package.json create mode 100644 styles.css create mode 100644 tsconfig.json create mode 100644 version-bump.mjs create mode 100644 versions.json diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..81f3ec3 --- /dev/null +++ b/.editorconfig @@ -0,0 +1,10 @@ +# top-most EditorConfig file +root = true + +[*] +charset = utf-8 +end_of_line = lf +insert_final_newline = true +indent_style = tab +indent_size = 4 +tab_width = 4 diff --git a/.eslintignore b/.eslintignore new file mode 100644 index 0000000..e019f3c --- /dev/null +++ b/.eslintignore @@ -0,0 +1,3 @@ +node_modules/ + +main.js diff --git a/.eslintrc b/.eslintrc new file mode 100644 index 0000000..0807290 --- /dev/null +++ b/.eslintrc @@ -0,0 +1,23 @@ +{ + "root": true, + "parser": "@typescript-eslint/parser", + "env": { "node": true }, + "plugins": [ + "@typescript-eslint" + ], + "extends": [ + "eslint:recommended", + "plugin:@typescript-eslint/eslint-recommended", + "plugin:@typescript-eslint/recommended" + ], + "parserOptions": { + "sourceType": "module" + }, + "rules": { + "no-unused-vars": "off", + "@typescript-eslint/no-unused-vars": ["error", { "args": "none" }], + "@typescript-eslint/ban-ts-comment": "off", + "no-prototype-builtins": "off", + "@typescript-eslint/no-empty-function": "off" + } + } \ No newline at end of file diff --git a/.github/CODE_OF_CONDUCT.md b/.github/CODE_OF_CONDUCT.md new file mode 100644 index 0000000..cc42a97 --- /dev/null +++ b/.github/CODE_OF_CONDUCT.md @@ -0,0 +1,9 @@ +# 🀝 Code of Conduct + +All contributors are expected to foster a safe, respectful, and inclusive environment. + +## πŸ’« The PtiCalin Pledge + +We commit to kindness, curiosity, and compassion β€” toward ourselves and each other. + +Violations may result in moderation actions. See the full [Contributor Covenant](https://www.contributor-covenant.org/) for details. diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md new file mode 100644 index 0000000..49bed3b --- /dev/null +++ b/.github/CONTRIBUTING.md @@ -0,0 +1,87 @@ +# ✨ Contributing Guide + +Thank you for considering a contribution to this project! +This repo is built on curiosity, creativity, and care β€” and *you* are part of that magic. + +--- + +## 🧩 Ways to Contribute + +πŸͺ„ Whether you're a coder, documenter, designer, or dreamer β€” here are some great ways to help: + +- πŸ“š Improve documentation or fix typos +- πŸ› Report bugs using the [Bug Report Template](https://github.com/your-username/vaultos-plugin-template/issues/new?template=bug.yml) +- 🌟 Suggest new features or enhancements +- πŸ§ͺ Write or improve tests +- πŸ”§ Refactor or optimize code +- πŸ—£οΈ Start a conversation in [GitHub Discussions](https://github.com/PtiCalin/general-template-repo/discussions) + +--- + +## πŸ›  Getting Started + +### 1. Fork + Clone + +```bash +git clone https://github.com/PtiCalin/general-template-repo.git +cd general-template-repo +``` + +### 2. Create a Branch + +```bash +git checkout -b feat/amazing-idea +``` + +### 3. Make Your Changes + +Edit files, add new content, or work your magic β€” then: + +```bash +git add . +git commit -m "Add: your amazing contribution" +git push origin feat/amazing-idea +``` + +--- + +## πŸ“¦ Open a Pull Request + +Once your changes are pushed: + +1. Go to GitHub and open a Pull Request +2. Use the [Pull Request Template](.github/pull_request_template.md) +3. Reference related issues (e.g. `Closes #3`) +4. Write clearly and kindly β€” we want to celebrate your work! + +--- + +## πŸ€– Code Style & Conventions + +- Follow formatting rules (`prettier`, `black`, etc.) +- Stick to existing folder and naming conventions +- Keep code modular, clean, and minimal where possible + +--- + +## πŸ’– What We Value + +We especially appreciate: + +- Kind and constructive communication +- Attention to clarity (docs are love!) +- Inclusivity and accessibility +- Learning in public and sharing growth + +--- + +## 🌿 Final Notes + +Not sure where to start? Open a [Discussion](https://github.com/PtiCalin/general-template-repo/discussions) or draft a PR early to get feedback. + +You're not just contributing to code β€” you're growing a thoughtful and joyful digital garden 🌼 + +--- + +With gratitude, +β€” The PtiCalin Project Team πŸ§ πŸ’« diff --git a/.github/FUNDING.md b/.github/FUNDING.md new file mode 100644 index 0000000..d9194d3 --- /dev/null +++ b/.github/FUNDING.md @@ -0,0 +1,4 @@ +# Funding + +github: ['PtiCalin'] +buy_me_a_coffee: pticalin diff --git a/.github/ISSUE_TEMPLATE/bug.yml b/.github/ISSUE_TEMPLATE/bug.yml new file mode 100644 index 0000000..20b1095 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/bug.yml @@ -0,0 +1,31 @@ +name: πŸͺ² Bug Report +description: Report a bug or glitch with this project. +title: 'Bug: {Issue Summary}' +labels: +- bug +- investigation needed +body: +- type: textarea + id: what-happened + attributes: + label: What happened? + description: Clearly describe the issue. + validations: + required: true +- type: textarea + id: where + attributes: + label: Where? + description: File, module, or workflow where the bug occurred. + validations: + required: true +- type: textarea + id: steps + attributes: + label: Steps to Reproduce + description: Step-by-step instructions to reproduce the issue. +- type: textarea + id: suggestion + attributes: + label: Any thoughts on fixing it? + description: Optional ideas or clues. diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md new file mode 100644 index 0000000..2a7d539 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -0,0 +1,21 @@ +--- +name: Bug report +about: Create a report to help us improve this project +labels: bug +--- + +**Describe the bug** +A clear and concise description of what the bug is. + +**To Reproduce** +Steps to reproduce the behavior: +1. Go to '...' +2. Click on '....' +3. See error + +**Expected behavior** +A clear and concise description of what you expected to happen. + +**Environment** + - OS: [e.g. Windows 11] + - Application version: [e.g. 1.0.0] diff --git a/.github/ISSUE_TEMPLATE/cleanup.yml b/.github/ISSUE_TEMPLATE/cleanup.yml new file mode 100644 index 0000000..1c2443a --- /dev/null +++ b/.github/ISSUE_TEMPLATE/cleanup.yml @@ -0,0 +1,19 @@ +name: 🧹 Repository Cleanup +description: 'Schedule a cleaning session: archiving, deleting, merging.' +title: 'Cleanup: {Scope}' +labels: +- cleanup +- maintenance +body: +- type: textarea + id: scope + attributes: + label: What needs cleaning? + description: Describe the folder, section, or item that needs maintenance. + validations: + required: true +- type: textarea + id: method + attributes: + label: How to proceed? + description: Plan for archiving, deleting, merging, or reorganizing. diff --git a/.github/ISSUE_TEMPLATE/content.yml b/.github/ISSUE_TEMPLATE/content.yml new file mode 100644 index 0000000..b7444c5 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/content.yml @@ -0,0 +1,26 @@ +name: ✍️ New Content Entry +description: Log a new module or snippet added to the project. +title: 'New: {Page or Template Name}' +labels: +- new content +- project growth +body: +- type: textarea + id: description + attributes: + label: What did you create? + description: Describe the new content. + validations: + required: true +- type: input + id: location + attributes: + label: Where is it located? + description: Folder/path inside the project. + validations: + required: true +- type: textarea + id: notes + attributes: + label: Future plans or linking ideas + description: Any notes or next steps? diff --git a/.github/ISSUE_TEMPLATE/documentation.yml b/.github/ISSUE_TEMPLATE/documentation.yml new file mode 100644 index 0000000..9a02d7b --- /dev/null +++ b/.github/ISSUE_TEMPLATE/documentation.yml @@ -0,0 +1,19 @@ +name: 🧭 Documentation Task +description: Improve the README, wiki, or project documentation. +title: 'Docs: {Area}' +labels: +- documentation +- task +body: +- type: textarea + id: what-docs + attributes: + label: What part of the documentation? + description: Specify which file, page, or guide. + validations: + required: true +- type: textarea + id: improvement + attributes: + label: How should it improve? + description: Suggest what to add, fix, or clarify. diff --git a/.github/ISSUE_TEMPLATE/feature-request.yml b/.github/ISSUE_TEMPLATE/feature-request.yml new file mode 100644 index 0000000..daf7bd6 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/feature-request.yml @@ -0,0 +1,24 @@ +name: 🌟 Feature Request +description: Suggest a new feature or improvement for this project. +title: 'Feature: {Idea}' +labels: +- feature request +- enhancement +body: +- type: textarea + id: feature + attributes: + label: What is the feature? + description: Describe the new idea. + validations: + required: true +- type: textarea + id: benefit + attributes: + label: Why would it be useful? + description: Explain why this would improve the project. +- type: textarea + id: notes + attributes: + label: Optional sketches or examples + description: Any mockups, files, or examples. diff --git a/.github/ISSUE_TEMPLATE/feature_request.md b/.github/ISSUE_TEMPLATE/feature_request.md new file mode 100644 index 0000000..d3ae4c9 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/feature_request.md @@ -0,0 +1,14 @@ +--- +name: Feature request +about: Suggest an idea or improvement for this project +labels: enhancement +--- + +**Is your feature request related to a problem? Please describe.** +A clear and concise description of what the problem is. + +**Describe the solution you'd like** +A clear and concise description of what you want to happen. + +**Additional context** +Add any other context or screenshots about the feature request here. diff --git a/.github/ISSUE_TEMPLATE/general.yml b/.github/ISSUE_TEMPLATE/general.yml new file mode 100644 index 0000000..b842fa6 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/general.yml @@ -0,0 +1,19 @@ +name: πŸ’‘ Idea / Brainstorm +description: Capture a new idea. +title: 'Idea: {Short Summary}' +labels: +- idea +- brainstorm +body: +- type: textarea + id: idea + attributes: + label: What's the idea? + description: Let it flow! + validations: + required: true +- type: textarea + id: notes + attributes: + label: Wild thoughts or variations + description: Alternative angles or crazy versions. diff --git a/.github/ISSUE_TEMPLATE/goal-planning.yml b/.github/ISSUE_TEMPLATE/goal-planning.yml new file mode 100644 index 0000000..fc593fe --- /dev/null +++ b/.github/ISSUE_TEMPLATE/goal-planning.yml @@ -0,0 +1,24 @@ +name: 🎯 Goal Planning +description: Plan a focused project goal. +title: 'Goal: {Objective}' +labels: +- goal +- planning +body: +- type: textarea + id: goal + attributes: + label: What's the goal? + description: Describe the objective. + validations: + required: true +- type: textarea + id: steps + attributes: + label: Steps to achieve it + description: List the key steps. +- type: textarea + id: timeline + attributes: + label: Ideal timeline + description: Is there a deadline or priority? diff --git a/.github/ISSUE_TEMPLATE/refractor.yml b/.github/ISSUE_TEMPLATE/refractor.yml new file mode 100644 index 0000000..838bf1e --- /dev/null +++ b/.github/ISSUE_TEMPLATE/refractor.yml @@ -0,0 +1,26 @@ +name: πŸ› οΈ Refactor / Improve Structure +description: Propose a reorganization, renaming, or structural update. +title: 'Refactor: {Area or Item}' +labels: +- refactor +- structure improvement +body: +- type: textarea + id: current-structure + attributes: + label: Current Structure + description: What does the structure look like right now? + validations: + required: true +- type: textarea + id: proposed-change + attributes: + label: Proposed Change + description: Describe the improvements you propose. + validations: + required: true +- type: textarea + id: reasons + attributes: + label: Why change this? + description: Why would this make the project better? diff --git a/.github/ISSUE_TEMPLATE/test.yml b/.github/ISSUE_TEMPLATE/test.yml new file mode 100644 index 0000000..1e1c4bb --- /dev/null +++ b/.github/ISSUE_TEMPLATE/test.yml @@ -0,0 +1,26 @@ +name: πŸ§ͺ Experiment / Test Log +description: Document a trial run of a new workflow or idea. +title: 'Experiment: {Title}' +labels: +- experiment +- test +body: +- type: textarea + id: experiment + attributes: + label: What did you test? + description: Summarize the experiment or new setup. + validations: + required: true +- type: textarea + id: results + attributes: + label: What happened? + description: Describe the results. + validations: + required: true +- type: textarea + id: future + attributes: + label: Future steps? + description: Will you adopt it, improve it, or abandon it? diff --git a/.github/LICENSE b/.github/LICENSE new file mode 100644 index 0000000..4d1cf25 --- /dev/null +++ b/.github/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2025 PtiCalin + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the β€œSoftware”), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED β€œAS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/.github/SECURITY.md b/.github/SECURITY.md new file mode 100644 index 0000000..ec28933 --- /dev/null +++ b/.github/SECURITY.md @@ -0,0 +1,7 @@ +# πŸ” Security Policy + +## Reporting a Vulnerability + +If you discover a security vulnerability, please open a private GitHub security advisory or open up a security issue + +We appreciate responsible disclosure. πŸ™ diff --git a/.github/config.yml b/.github/config.yml new file mode 100644 index 0000000..1e8f6d7 --- /dev/null +++ b/.github/config.yml @@ -0,0 +1,70 @@ +# πŸ“„ Obsidian Plugin Template Configuration + +id: plugin-template-obsidian +title: "Obsidian Plugin Template – PtiCalin Style" +type: template +category: obsidian-plugin +section: templates +role: plugin-template +folder: system/templates +tags: [template, obsidian, plugin, vaultos, pticalin] +version: 1.0 + +# πŸ“Š Status & Lifecycle +status: stable +visibility: public +created: 2025-05-30 +updated: 2025-05-30 + +# πŸ“š Context & Description +summary: > + A preconfigured Obsidian plugin template with TypeScript, Rollup, + plugin manifest, and VaultOS-friendly structure. + +description: | + This template is the foundation for building modular and beautiful Obsidian plugins. + It includes all necessary config and build files to get started with TypeScript, + plus bonus features aligned with VaultOS development, including structured folders for + subplugins, compiled logic, and standardized automation patterns. + + Features include: + - πŸ“¦ Plugin manifest and entry file setup + - βš™οΈ TypeScript + Rollup for builds + - 🧬 src/, dist/, ops/, config/ folder convention (aligned with VaultOS) + - πŸ“œ LICENSE, README, CONTRIBUTING, Code of Conduct, CHANGELOG + - πŸͺ„ GitHub Actions-ready `.github/` folder + +purpose: "Kickstart Obsidian plugin development with structure, style, and extensibility." +scope: "Modular plugins for Obsidian (especially VaultOS-compatible)" +use_cases: ["obsidian development", "plugin scaffolding", "modular vault systems"] +audience: ["plugin developers", "VaultOS contributors", "tinkerers", "builders"] + +# 🧱 Relationships +parent: "plugin-templates" +children: [] +friends: ["repository-template-general"] +related: ["vaultos-subplugin-template", "vaultos-module-manager"] + +# 🌐 Dynamic GitHub URLs +github: + base: "https://github.com/<%= github.user %>/<%= github.repo %>" + manifest: "<%= github.base %>/blob/main/manifest.json" + readme: "<%= github.base %>/blob/main/README.md" + contributing: "<%= github.base %>/blob/main/CONTRIBUTING.md" + license: "<%= github.base %>/blob/main/LICENSE" + changelog: "<%= github.base %>/blob/main/change-log.md" + discussions: "<%= github.base %>/discussions" + sponsor: "https://github.com/sponsors/<%= github.user %>" + +# βš™οΈ Obsidian Plugin Specific +plugin: + manifest_path: "manifest.json" + entry_file: "src/main.ts" + output_dir: "dist/" + build_tool: "rollup" + script_language: "ts" + +# πŸ’Œ Attribution +author: "PtiCalin" +maintainers: ["<%= github.user %>"] +sponsor_link: "<%= github.sponsor %>" diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md new file mode 100644 index 0000000..09c02f9 --- /dev/null +++ b/.github/pull_request_template.md @@ -0,0 +1,33 @@ +# πŸ“ Pull Request Summary + +## πŸ“Œ What does this PR do? + + +## πŸ” Related Issues + + +## βœ… Type of Change + +- [ ] ✨ New plugin module/content +- [ ] πŸ›  Refactor +- [ ] πŸ› Bug fix +- [ ] 🌟 Feature addition +- [ ] 🧹 Cleanup +- [ ] πŸ§ͺ Experiment / Test +- [ ] 🧭 Documentation +- [ ] 🎯 Template improvement + +## 🧠 Description of Changes + + +## πŸ”„ How to Test + + +## πŸ“‹ Checklist + +- [ ] I have reviewed my changes +- [ ] I have tested the changes +- [ ] The PR title follows the project's naming conventions +- [ ] Related issues are linked diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..4bce587 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,22 @@ +name: Build plugin + +on: + push: + branches: [ main ] + pull_request: + branches: [ main ] + +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 + with: + node-version: 18 + - run: npm install + - run: npm run build + - uses: actions/upload-artifact@v3 + with: + name: dist + path: dist diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml new file mode 100644 index 0000000..de5ff7d --- /dev/null +++ b/.github/workflows/main.yml @@ -0,0 +1,23 @@ +# .github/workflows/main.yml + +name: πŸ”„ CI – Vault Template Build Check + +on: + push: + branches: + - main + pull_request: + branches: + - main + +jobs: + build: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 + with: + node-version: 18 + - run: npm run setup + \ No newline at end of file diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..386ac2b --- /dev/null +++ b/.gitignore @@ -0,0 +1,22 @@ +# vscode +.vscode + +# Intellij +*.iml +.idea + +# npm +node_modules + +# Don't include the compiled main.js file in the repo. +# They should be uploaded to GitHub releases instead. +main.js + +# Exclude sourcemaps +*.map + +# obsidian +data.json + +# Exclude macOS Finder (System Explorer) View States +.DS_Store diff --git a/.npmrc b/.npmrc new file mode 100644 index 0000000..b973752 --- /dev/null +++ b/.npmrc @@ -0,0 +1 @@ +tag-version-prefix="" \ No newline at end of file diff --git a/README.md b/README.md new file mode 100644 index 0000000..d66a722 --- /dev/null +++ b/README.md @@ -0,0 +1,129 @@ +# πŸ”Œ VaultOS Plugin Template | Obsidian + +> _A modular beginning to powerful plugin architecture β€” designed the PtiCalin way._ + +Welcome to the VaultOS-style Obsidian Plugin Template β€” structured, scalable, and friendly to creators. +Built to streamline development, boost creativity, and follow best practices recommended by the Obsidian community. + +[![License: MIT](https://img.shields.io/badge/License-MIT-green.svg)](LICENSE) +[![Status: In Progress](https://img.shields.io/badge/status-WIP-yellow.svg)]() +[![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg)](./.github/PULL_REQUEST_TEMPLATE.md) +[![Sponsor PtiCalin](https://img.shields.io/badge/Sponsor-πŸ’–-f06292.svg?logo=githubsponsors)](https://github.com/sponsors/pticalin) + +--- + +## 🧰 Features + +- 🧠 TypeScript-based Obsidian plugin scaffold +- 🎯 100% compatible with [Obsidian sample plugin structure](https://github.com/obsidianmd/obsidian-sample-plugin) +- βš™οΈ Rollup-powered build system +- ✨ Includes GitHub workflows, issue templates, and PR templates +- πŸ“¦ Clean modular layout for faster scaling +- πŸ’¬ Optional Discussions and Sponsor links + +--- + +## πŸš€ Getting Started + +Clone the repo and install dependencies: + +```bash +git clone https://github.com/your-username/temp-repo-obsidian-plugin.git +cd temp-repo-obsidian-plugin +npm install +npm run build +``` + +Then copy the `dist/` folder into `.obsidian/plugins/your-plugin-id/` in your Obsidian vault. + +--- + +## πŸ›  Dev Mode (Live Compile) + +Use live watch mode to iterate quickly: + +```bash +npm run dev +``` + +Make changes to `src/main.ts` (or other `.ts` files), and they'll recompile on save. + +--- + +## 🧱 Folder Structure + +```bash +πŸ“¦ temp-repo-obsidian-plugin/ +β”œβ”€β”€ .github/ β†’ Issues, PR templates, workflows +β”œβ”€β”€ dist/ β†’ Final build (used by Obsidian) +β”œβ”€β”€ src/ β†’ TypeScript source files +β”œβ”€β”€ main.ts β†’ Entry point (if not using src/) +β”œβ”€β”€ styles.css β†’ Optional plugin styles +β”œβ”€β”€ manifest.json β†’ Plugin metadata +β”œβ”€β”€ package.json β†’ Build scripts & dependencies +β”œβ”€β”€ rollup.config.js β†’ Bundler setup +β”œβ”€β”€ tsconfig.json β†’ TypeScript config +└── README.md β†’ You're here! +``` + +--- + +## πŸ”„ Releasing a New Version + +To publish a new release: + +1. Update `manifest.json` and `versions.json` +2. Run: + +```bash +npm version patch | minor | major +``` + +3. Create a new GitHub release: + - Tag must match the version (e.g., `1.0.1`, not `v1.0.1`) + - Attach `main.js`, `manifest.json`, and `styles.css` + +See [sample-plugin releases](https://github.com/obsidianmd/obsidian-sample-plugin/releases) for reference. + +--- + +## 🌐 Adding Your Plugin to Obsidian's Community List + +1. Ensure your repo has: + - `manifest.json` + - `main.js` + - `README.md` +2. Follow the [official plugin submission guide](https://docs.obsidian.md/Plugins/Releasing/Plugin+guidelines) +3. Submit a PR to [`obsidian-releases`](https://github.com/obsidianmd/obsidian-releases) + +--- + +## 🀝 Contributing + +We love PRs, discussions, and feedback! + +- [πŸ› Report a Bug](https://github.com/your-username/temp-repo-obsidian-plugin/issues/new?template=bug.yml) +- [🌟 Request a Feature](https://github.com/your-username/temp-repo-obsidian-plugin/issues/new?template=feature-request.yml) +- [πŸ“¦ Open a PR](./.github/PULL_REQUEST_TEMPLATE.md) + +See [CONTRIBUTING.md](CONTRIBUTING.md) for full guidelines. + +--- + +## πŸ“œ License + +MIT β€” open for remixing, improving, and learning from. +Please credit and consider sharing back improvements. + +--- + +## πŸ’Œ Sponsor + +If this template helped you get started faster or with more clarity, +consider supporting PtiCalin's ongoing plugin ecosystem and modular tooling work: + +➑ [github.com/sponsors/pticalin](https://github.com/sponsors/pticalin) + +--- + +> _Have fun building. Spend less time structuring and more time imagining._ diff --git a/esbuild.config.mjs b/esbuild.config.mjs new file mode 100644 index 0000000..a5de8b8 --- /dev/null +++ b/esbuild.config.mjs @@ -0,0 +1,49 @@ +import esbuild from "esbuild"; +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 +*/ +`; + +const prod = (process.argv[2] === "production"); + +const context = await esbuild.context({ + banner: { + js: banner, + }, + entryPoints: ["main.ts"], + bundle: true, + external: [ + "obsidian", + "electron", + "@codemirror/autocomplete", + "@codemirror/collab", + "@codemirror/commands", + "@codemirror/language", + "@codemirror/lint", + "@codemirror/search", + "@codemirror/state", + "@codemirror/view", + "@lezer/common", + "@lezer/highlight", + "@lezer/lr", + ...builtins], + format: "cjs", + target: "es2018", + logLevel: "info", + sourcemap: prod ? false : "inline", + treeShaking: true, + outfile: "main.js", + minify: prod, +}); + +if (prod) { + await context.rebuild(); + process.exit(0); +} else { + await context.watch(); +} diff --git a/main.ts b/main.ts new file mode 100644 index 0000000..2d07212 --- /dev/null +++ b/main.ts @@ -0,0 +1,134 @@ +import { App, Editor, MarkdownView, Modal, Notice, Plugin, PluginSettingTab, Setting } from 'obsidian'; + +// Remember to rename these classes and interfaces! + +interface MyPluginSettings { + mySetting: string; +} + +const DEFAULT_SETTINGS: MyPluginSettings = { + mySetting: 'default' +} + +export default class MyPlugin extends Plugin { + settings: MyPluginSettings; + + async onload() { + await this.loadSettings(); + + // This creates an icon in the left ribbon. + const ribbonIconEl = this.addRibbonIcon('dice', 'Sample Plugin', (evt: MouseEvent) => { + // Called when the user clicks the icon. + new Notice('This is a notice!'); + }); + // Perform additional things with the ribbon + ribbonIconEl.addClass('my-plugin-ribbon-class'); + + // This adds a status bar item to the bottom of the app. Does not work on mobile apps. + const statusBarItemEl = this.addStatusBarItem(); + statusBarItemEl.setText('Status Bar Text'); + + // This adds a simple command that can be triggered anywhere + this.addCommand({ + id: 'open-sample-modal-simple', + name: 'Open sample modal (simple)', + callback: () => { + new SampleModal(this.app).open(); + } + }); + // This adds an editor command that can perform some operation on the current editor instance + this.addCommand({ + id: 'sample-editor-command', + name: 'Sample editor command', + editorCallback: (editor: Editor, view: MarkdownView) => { + console.log(editor.getSelection()); + editor.replaceSelection('Sample Editor Command'); + } + }); + // This adds a complex command that can check whether the current state of the app allows execution of the command + this.addCommand({ + id: 'open-sample-modal-complex', + name: 'Open sample modal (complex)', + checkCallback: (checking: boolean) => { + // Conditions to check + const markdownView = this.app.workspace.getActiveViewOfType(MarkdownView); + if (markdownView) { + // If checking is true, we're simply "checking" if the command can be run. + // If checking is false, then we want to actually perform the operation. + if (!checking) { + new SampleModal(this.app).open(); + } + + // This command will only show up in Command Palette when the check function returns true + return true; + } + } + }); + + // This adds a settings tab so the user can configure various aspects of the plugin + this.addSettingTab(new SampleSettingTab(this.app, this)); + + // If the plugin hooks up any global DOM events (on parts of the app that doesn't belong to this plugin) + // Using this function will automatically remove the event listener when this plugin is disabled. + this.registerDomEvent(document, 'click', (evt: MouseEvent) => { + console.log('click', evt); + }); + + // When registering intervals, this function will automatically clear the interval when the plugin is disabled. + this.registerInterval(window.setInterval(() => console.log('setInterval'), 5 * 60 * 1000)); + } + + onunload() { + + } + + async loadSettings() { + this.settings = Object.assign({}, DEFAULT_SETTINGS, await this.loadData()); + } + + async saveSettings() { + await this.saveData(this.settings); + } +} + +class SampleModal extends Modal { + constructor(app: App) { + super(app); + } + + onOpen() { + const {contentEl} = this; + contentEl.setText('Woah!'); + } + + onClose() { + const {contentEl} = this; + contentEl.empty(); + } +} + +class SampleSettingTab extends PluginSettingTab { + plugin: MyPlugin; + + constructor(app: App, plugin: MyPlugin) { + super(app, plugin); + this.plugin = plugin; + } + + display(): void { + const {containerEl} = this; + + containerEl.empty(); + + new Setting(containerEl) + .setName('Setting #1') + .setDesc('It\'s a secret') + .addText(text => text + .setPlaceholder('Enter your secret') + .setValue(this.plugin.settings.mySetting) + .onChange(async (value) => { + this.plugin.settings.mySetting = value; + await this.plugin.saveSettings(); + })); + } +} diff --git a/manifest.json b/manifest.json new file mode 100644 index 0000000..7a584d2 --- /dev/null +++ b/manifest.json @@ -0,0 +1,14 @@ +{ + "id": "vaultos-plugin-template", + "name": "VaultOS Plugin Template", + "version": "1.0.0", + "minAppVersion": "0.15.0", + "description": "A modular Obsidian plugin template scaffolded in the VaultOS style. Built for scalable development and joyful contribution.", + "author": "PtiCalin", + "authorUrl": "https://github.com/PtiCalin", + "fundingUrl": { + "GitHub Sponsor": "https://github.com/sponsors/pticalin", + "Buy Me a Coffee": "https://buymeacoffee.com/pticalin" + }, + "isDesktopOnly": false +} diff --git a/package.json b/package.json new file mode 100644 index 0000000..2dd9259 --- /dev/null +++ b/package.json @@ -0,0 +1,30 @@ +{ + "name": "vault-plugin-template", + "version": "1.0.0", + "description": "VaultOS-style Obsidian plugin template. Structured, scalable, and joyful to develop.", + "main": "main.js", + "scripts": { + "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": [ + "obsidian", + "plugin", + "template", + "vaultos", + "pticalin" + ], + "author": "PtiCalin", + "license": "MIT", + "devDependencies": { + "@types/node": "^16.11.6", + "@typescript-eslint/eslint-plugin": "5.29.0", + "@typescript-eslint/parser": "5.29.0", + "builtin-modules": "3.3.0", + "esbuild": "0.17.3", + "obsidian": "latest", + "tslib": "2.4.0", + "typescript": "4.7.4" + } +} diff --git a/styles.css b/styles.css new file mode 100644 index 0000000..c7c8a4d --- /dev/null +++ b/styles.css @@ -0,0 +1,67 @@ +/* + +This CSS file will be included with your plugin, and +available in the app when your plugin is enabled. + +If your plugin does not need CSS, delete this file. + +*/ + +/* πŸ”Œ VaultOS Plugin Base Styles + Style guidelines: Clean, readable, consistent spacing + Theme-compatible, non-intrusive by default +*/ + +:root { + --vaultos-accent: var(--text-accent); + --vaultos-bg: var(--background-secondary); + --vaultos-fg: var(--text-normal); + --vaultos-border: var(--background-modifier-border); +} + +.vaultos-panel { + padding: 1rem; + background-color: var(--vaultos-bg); + color: var(--vaultos-fg); + border: 1px solid var(--vaultos-border); + border-radius: 8px; + box-shadow: var(--shadow-s); + margin-bottom: 1rem; +} + +.vaultos-heading { + font-size: 1.4rem; + font-weight: bold; + color: var(--vaultos-accent); + margin-bottom: 0.5rem; +} + +.vaultos-button { + background-color: var(--vaultos-accent); + color: var(--background-primary); + padding: 0.5rem 1rem; + border: none; + border-radius: 5px; + cursor: pointer; + font-weight: 500; + transition: background-color 0.2s ease; +} + +.vaultos-button:hover { + background-color: var(--text-accent-hover); +} + +.vaultos-input { + width: 100%; + padding: 0.4rem; + border: 1px solid var(--vaultos-border); + border-radius: 4px; + background-color: var(--background-primary); + color: var(--vaultos-fg); +} + +.vaultos-label { + font-weight: 500; + margin-bottom: 0.3rem; + display: block; +} diff --git a/tsconfig.json b/tsconfig.json new file mode 100644 index 0000000..c44b729 --- /dev/null +++ b/tsconfig.json @@ -0,0 +1,24 @@ +{ + "compilerOptions": { + "baseUrl": ".", + "inlineSourceMap": true, + "inlineSources": true, + "module": "ESNext", + "target": "ES6", + "allowJs": true, + "noImplicitAny": true, + "moduleResolution": "node", + "importHelpers": true, + "isolatedModules": true, + "strictNullChecks": true, + "lib": [ + "DOM", + "ES5", + "ES6", + "ES7" + ] + }, + "include": [ + "**/*.ts" + ] +} diff --git a/version-bump.mjs b/version-bump.mjs new file mode 100644 index 0000000..d409fa0 --- /dev/null +++ b/version-bump.mjs @@ -0,0 +1,14 @@ +import { readFileSync, writeFileSync } from "fs"; + +const targetVersion = process.env.npm_package_version; + +// read minAppVersion from manifest.json and bump version to target version +let manifest = JSON.parse(readFileSync("manifest.json", "utf8")); +const { minAppVersion } = manifest; +manifest.version = targetVersion; +writeFileSync("manifest.json", JSON.stringify(manifest, null, "\t")); + +// update versions.json with target version and minAppVersion from manifest.json +let versions = JSON.parse(readFileSync("versions.json", "utf8")); +versions[targetVersion] = minAppVersion; +writeFileSync("versions.json", JSON.stringify(versions, null, "\t")); diff --git a/versions.json b/versions.json new file mode 100644 index 0000000..26382a1 --- /dev/null +++ b/versions.json @@ -0,0 +1,3 @@ +{ + "1.0.0": "0.15.0" +}