npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@aoout/create-obsidian-plugin

v1.9.11

Published

An unofficial tool for easily creating an obsidian plugin, with i18n support, workflows...

Downloads

488

Readme

create-obsidian-plugin

A tool to easily create plugins for obsidian

Getting started

Run one of the following command, depending of your favorite package manager:

  • npm init @aoout/obsidian-plugin or npx @aoout/create-obsidian-plugin
  • yarn create @aoout/obsidian-plugin
  • pnpm create @aoout/obsidian-plugin

[!WARNING] In yarn V2+, you can't use automatically the post and pre scripts and must be manually used, as npm run bump && npm run postbump. See here for more information. As the package detect your package manager, the package.json will use another scripts for Yarn.

And a plugin will be created in your current directory. It'll prompt you for needed info (like plugin-id, name, etc).

You can optionally pass a plugin-id to the command like

yarn create obsidian-plugin my-plugin

In this case a plugin with the id my-plugin will be created in the current directory. Afterwards, follow the directions from the plugin to get started

Scripts

Prepend the following command with your package manager (npm, yarn, pnpm, etc…).

  1. Build : build
  2. Build and watch : dev
  3. Export to your vault : export - You must set the path to your vault in the .env file. The plugin will be build and exported to your vault.
  4. Bump version with pushing to repository
    • In npm or pnpm : bump
    • In yarn : push
  5. Bump version (w/o push)
    • In npm or pnpm : bump --ignore-scripts
    • In yarn : bump
  6. Upgrade - Update the version number, and export to your main repository : upgrade

Fork difference

The fork separates the settings, interfaces and the main.ts. It also adds :

  • i18next for translation
  • commit-and-tag-version to automatically commit and tag the version based on the commit message (it must respect the conventional commit format)
  • A GitHub workflows to automatically build and publish the plugin when a new tag is added.
  • A JavaScript that allows you to export the built plugin to your obsidian Vault. To do that you must add the path to your Vault (root) in the .env file.
  • A better dev workflow using .env file and dev.js file.

Moreover, the creating adds:

  • Funding information in the manifest (cf funding)
  • Desktop only question
  • Initialize a git repository
  • If you have GitHub CLI installed, you can also choose to create a new repository on GitHub. Obviously, you need to init a git repository before. The created repository will be public by default and use the same name as the plugin id.

i18next : Translation support

This fork adds support for i18next for Obsidian, allowing translation of your plugin in different languages. If you need to add translation, just create a new lang.json in i18n/locales and update i18n/i18nex.ts to add the new language, as follows :

import { moment } from "obsidian";
import * as en from "./locales/en.json";
import * as fr from "./locales/fr.json";
import * as newLang from "./locales/newLang.json";

export const resources = {
	en: { translation: en },
	fr: { translation: fr },
	newLang: { translation: newLang },
} as const;

export const translationLanguage = Object.keys(resources).find(
	i => i == moment.locale()) ? moment.locale() : "en";

Useful environments variables :

If you want to quickly create a plugin without rewrite each time the same information, you can set environment variable with the following name:

  • obsidian_plugin_author_name : Your author name
  • obsidian_plugin_author_url : Your author url (website, social media account, etc…)
  • obsidian_plugin_vault_path : The path to your obsidian vault (root)
  • obsidian_plugin_dev_vault : The path to your obsidian vault (root) for development
  • obsidian_plugin_funding_url : Link to your funding page (Patreon, Paypal, Kofi, etc…)
  • obsidian_plugin_license : Your favorite license by their identifier (MIT, Apache-2.0, etc…). See here for the complete list of identifier.