Hyper: Extensions API

Created on 2 Jul 2016  路  3Comments  路  Source: vercel/hyper

Continuing from the "Allow custom stylesheet" thread (#10).

The way I want to do this is directly with the JS extensions API. You would basically register a plugin that registers CSS.

The sample extension we'll have is one that makes the theme light during the day and dark at night. This will show off adding CSS and also adding a bit of JS logic, so it's a good all-around example.

I'll probably use webpack in the example build step so that you can require('./something.css'). People that want to use sass can simply use a sass loader or add another step to get the .css from the .sass.

馃挰 Feedback Wanted

Most helpful comment

As far as how someone register their extensions, I was thinking about having $HOME/hyperterm.json.
It would look as follows:

[
  "@hyperterm/preserve-pwd",
  "hypersolar"
]

This has a few purposes:

  • Sharability. "馃懆: Why does your hyperterm look so cool!? "馃懇: Here, have my hyperterm.json".
  • Configurability and extensibility in one. If you want to remove functionality, simply remove a core plugin. Plugins admit optional parameters:

json ["hypersolar", { "useWeatherAPI": true, "zipCode": 94123 }]

  • Declarative installation. Kind of like the amazing .vimrc based extensions solutions (I use NeoBundle). When you make changes to the file, that triggers the installation or removal of the NPM modules.

The NPM modules will be installed inside ~/.hyperterm-modules

All 3 comments

As far as how someone register their extensions, I was thinking about having $HOME/hyperterm.json.
It would look as follows:

[
  "@hyperterm/preserve-pwd",
  "hypersolar"
]

This has a few purposes:

  • Sharability. "馃懆: Why does your hyperterm look so cool!? "馃懇: Here, have my hyperterm.json".
  • Configurability and extensibility in one. If you want to remove functionality, simply remove a core plugin. Plugins admit optional parameters:

json ["hypersolar", { "useWeatherAPI": true, "zipCode": 94123 }]

  • Declarative installation. Kind of like the amazing .vimrc based extensions solutions (I use NeoBundle). When you make changes to the file, that triggers the installation or removal of the NPM modules.

The NPM modules will be installed inside ~/.hyperterm-modules

As far as the API, I'm going to experiment with the following: plugins simply expose a function that is invoked with the main <HyperTerm> component to decorate.

This would give plugins complete control over the customizability of the terminal. They could register componentDidMount, add stuff to render, etc.

Outdated

Was this page helpful?
0 / 5 - 0 ratings

Related issues

ConstantinChirila picture ConstantinChirila  路  3Comments

weabot picture weabot  路  3Comments

yvan-sraka picture yvan-sraka  路  3Comments

hxnt picture hxnt  路  3Comments

legomushroom picture legomushroom  路  3Comments