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

stash-plugin-builder

v1.0.3

Published

Build stash plugins with React, SCSS and other libraries with TS support

Downloads

17

Readme

stash-plugin-builder

Build Stash plugins using React, SCSS, and other libraries with TypeScript support.

stash-plugin-builder

Benefits of using stash-plugin-builder:

  1. Supports React JSX, TypeScript, Scss, Sass, Less, Css modules and Stylus out of the box
  2. Live reloading
  3. Install npm packages and ship it with your plugins
  4. Cross-source dependency installer
  5. Cross browser theme support with Autoprefixer
  6. Built-in gh workflow to automatically build and publish your plugins for every commit push

Usage

1. Generate boilerplate using create-stash-plugin

npm

npx create-stash-plugin

yarn

yarn create stash-plugin

2. Build plugin

cd to the generated plugin folder and run

npm run build

The plugin will be built in your stash plugins folder. Reload stash, and the plugin should be listed in the Plugins tab. If not, try clicking Reload plugins button and reload again.

3. Watch plugin

Run this npm command and reload stash just once to connect stash-plugin-builder and stash

npm run watch

Just saving the source code file will auto build and reload stash.

4. Build plugin for distribution

npm run build-dist

This will build the plugin and output the distributable plugin to the dist folder. You can change this folder in package.json.

Note: You don't need this if you have generated the boilerplate with npx create-stash-plugin as it comes with gh workflow that automatically builds and publishes your plugins on every commit push.

build-config.json

build.js builds your plugins for deployment based on the configuration specified in build-config.json.

{
    "plugins": ["plugins/*", "themes/MyTheme"], // use this only if you have monorepo
    "outDir": "dist", // if you edit this, update the workflow file too
    "excludePluginFolders": "MyTestPlugin", // plugin's folder name not id
    "stashPluginSubDir": "my-plugins-dev", // optional sub-dir inside your stash plugins folder
    "include": ["README.md", "LICENSE", "foler-one", "foler-two/*"] // these files will be copied to dist branch
}

settings.yml structure

The npx create-stash-plugin command should generate a basic settings.yml. However, if you wish to configure advanced settings, please adhere to this structure. The settings.yml follows the same structure as the stash plugin.yml but with extra configuration. See the example below:

id: MyPlugin # should be upper camel case
name: My Plugin
description: My plugin does awesome things
url: https://github.com/Tetrax-10/stash-stuffs
version: 1.0
stashPluginSubDir: my-plugins-dev # optional sub-dir inside your stash plugins folder
ui:
    javascript: ./src/index.js # main js file
    css: ./styles/main.css # main css file
    include: # external js and css files that aren't part of main ui files
        - ./lib/colors.js
        - ./scripts/injectRemoteCode.js
    requires:
        - MyUtilsLibrary # local plugin id
        - MyReactComponentsLibrary # local plugin id
        - id: StashUserscriptLibrary # cross-source plugin id
          source: https://stashapp.github.io/CommunityScripts/stable/index.yml # cross-source plugin source url
    # the following assets and csp structure are just default plugin.yml structure
    assets: # optional list of assets
        urlPrefix: fsLocation
    csp: # content-security policy overrides
        script-src:
            - http://alloweddomain.com
        style-src:
            - http://alloweddomain.com
        connect-src:
            - http://alloweddomain.com
include: # include external files
    - ./assets # assets folder will be copied to the output folder
    - ./python/foo.py # foo.py will be copi...
    - ./configs/* # all contents inside the configs folder will be copi...
# the following are just default plugin.yml structure and they are used for plugin tasks only
exec:
    - python
    - "{pluginDir}/foo.py" # values with variable should be wrapped with double quotes
interface: raw
errLog: error
tasks:
    - name: <operation name>
      description: <optional description>
      execArgs:
          - <arg to add to the exec line>

Cross-source dependency installer

You can simply specify the dependency plugin's id and source, the stash-plugin-builder will automatically bundle a cross-source dependency installer script with your plugin. Therefore, when users install your plugin, the cross-source dependencies will be installed automatically.

ui:
    requires:
        - MyUtilsLibrary # local plugin id
        - MyReactComponentsLibrary # local plugin id
        - id: StashUserscriptLibrary # cross-source plugin id
          source: https://stashapp.github.io/CommunityScripts/stable/index.yml # cross-source plugin source url
        - id: TetraxUserscriptLibrary # cross-source plugin id
          source: https://tetrax-10.github.io/stash-stuffs/index.yml # cross-source plugin source url

Cli Docs

Credits

Inspired from spicetify-creator by @FlafyDev

Made with Love💕 by Tetrax-10