pulltool / pulltool-chrome-app

Source for the Pull Tool Chrome App
MIT License
2 stars 1 forks source link

JSON Schema #1

Open stuartpb opened 8 years ago

stuartpb commented 8 years ago

Here's what I'm thinking (using YAML syntax and Tabalanche as an example):

source:
  zip: https://github.com/tabalanche/tabalanche-extension/archive/unstable.zip
extension:
  shim:
    manifest:
      name: Unstable Tabalanche
      icons:
        "16": images/tabalanche-unstable-16px.png
        "48": images/tabalanche-unstable-48px.png
        "128": images/tabalanche-unstable-128px-20pxborder.png
      browser_action:
        default_icon:
          "19": images/tabalanche-unstable-19px.png
          "38": images/tabalanche-unstable-38px.png
        default_title: Unstable Tabalanche
stuartpb commented 8 years ago

Actually, since extension management isn't allowed for Chrome apps (ugh), I'm probably going to do something more like this (which can be generalized):

patch:
  json:
    manifest.json:
      name: Unstable Tabalanche
      icons:
        "16": images/tabalanche-unstable-16px.png
        "48": images/tabalanche-unstable-48px.png
        "128": images/tabalanche-unstable-128px-20pxborder.png
      browser_action:
        default_icon:
          "19": images/tabalanche-unstable-19px.png
          "38": images/tabalanche-unstable-38px.png
        default_title: Unstable Tabalanche
stuartpb commented 8 years ago

Actually, to keep the JSON patching flexible, there should probably be a layer like "set" that sets keys to values (with room for future extensions like "append" and "merge"). Maybe call it "values" or "properties".

stuartpb commented 8 years ago

Okay, so here's the new sample schema:

sources:
- url: https://path/to/whatever.zip
  slice:
  - from: subfolder-in-zip/deeper-subfolder #defaults to root
    to: different-sublocation #defaults to root
tags: [extension]
patch:
  files:
    manifest.json:
      set: {name: "Example (Development)"}
    icon.png:
      color: [invert]
stuartpb commented 8 years ago

Patch items might have a "don't patch in repack" option. Also, repack is somewhere in the future-planned-features list.

stuartpb commented 8 years ago

I'm going to have a layer for the kind of patching, like "json" or "png", and they're going to be items in an array for enforcing order (ie. if you want to do a fulltext patch, and then a JSON patch, and then maybe another fulltext patch). Having each step be an object allows for each step to have patch-operation options placed on it (like "include in repack").