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

@snailicide/vite-plugin-shopify-theme-schema

v0.2.4

Published

This vite plugin enables Shopify theme developers to better manage the JSON schema files for Shopify Theme Settings

Downloads

78

Readme

@snailicide/vite-plugin-shopify-theme-schema 🐌

This plugin adds features to make it easier to manage the JSON schema files for Shopify Theme Settings. Please see Inspiration section for more info and backstory!

Many thanks to barrel-shopify by Barrel NY for readme inspiration.

Repository

snailicide-monorepo

Author

👤 Gillian Tunney

🐌

Table of contents generated with markdown-toc

Features

Dynamic Shopify Setting Schemas

  • Build Shopify Setting schemas dynamically from Typescript, Javascript, and JSON files
  • Share and reuse schema partials between different files. Promotes efficient code reusability.
  • Benefit from the language support provided by IDEs such as VSCode and WebStorm like autocompletion, formatting, collapsing
  • Use Typescript autocompletion to declare schema structure using my code library. Included types and validators range from generic to highly specific.

Examples

See example_theme_config folder for usage examples of validators and types.

Installation

This library is published in the NPM registry and can be installed using any compatible package manager.

#pnpm
pnpm add @snailicide/vite-plugin-shopify-theme-schema

#yarn
yarn add @snailicide/vite-plugin-shopify-theme-schema

#npm
npm install @snailicide/vite-plugin-shopify-theme-schema

Tests

# build example files
pnpm --filter=@snailicide/vite-plugin-shopify-theme-schema test:example

Usage

Add pluginShopifyThemeSchema plugin to vite.config.js / vite.config.ts:

import pluginShopifyThemeSchema from '@snailicide/vite-plugin-shopify-theme-schema'

/* * Example  * */
export default {
    plugins: [
        pluginShopifyThemeSchema({
            themeRoot: '.',
            sourceCodeDir: './src/global_settings',
            entryPoints: {
                'settings_schema.json': 'settings_schema.js',
            },
        }),
    ],
}
  • Create a sourceCodeDir directory under your theme's folder to hold the source files for your settings_schema.json or custom entrypoint.
  • Create a Javascript,Typescript or JSON file for each 'entrypoint' of your theme settings. You can compose different files to determine the settings sequence.
  • Make sure that your schema source directory is listed in your theme's .shopifyignore file to avoid errors when pushing code to Shopify.

Options

import type { ShopifyLiquidModulesOptions } from './src/options'

/* * Default Options Available * */
const defaultobj: ShopifyLiquidModulesOptions = {
    themeRoot: '.',
    sourceCodeDir: './src',
    entryPoints: {
        'settings_schema.json': 'settings_schema.js',
    },
}

Inspiration

vite-plugin-shopify-theme-settings by Barrel NY

Since i am new to vite plugin, i used this as my starting structure and was heavily inspired by the overall concept of the vite-plugin-shopify-theme-settings. I skipped looping thru the json directory and instead used an 'entryPoint' approach.

Helpful Links

To-Do

  • [ ] Unit Tests

Bugs

Please create an issue if you found any bugs, to help us improve this project!