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

hyper-init

v1.5.3

Published

The ultimate and most complete extension to initialize commands before and after Hyper terminal starts

Downloads

524

Readme

With hyper-init you can perform as many commands as you want, before and after Hyper terminal starts, using rules that define when your commands should run.

Table of Contents

Installation

If you don't have Hyper, install it from here.

So, type the following on Hyper:

hyper i hyper-init

Configuration

init

hyper-init can be configured within the config object in the ~/.hyper.js configuration file.

All you have to do to get started is to create an array of objects called init, like this:

init: [
  {
    rule: 'once',
    commands: ['cd ~/Desktop', 'ls'],
    allowedShells: ['zsh', 'bash']
  }
]

Your ~/.hyper.js configuration file should look like this:

module.exports = {
  config: {

    // add hyper-init configuration like this:
    init: [
      {
        rule: 'once',
        commands: ['cd ~/Desktop', 'ls'],
        allowedShells: ['zsh', 'bash']
      },
      {
        rule: 'windows',
        commands: ['echo This is only executed on New Windows!']
      },
      {
        rule: ['splitted', 'tabs', 'windows'],
        commands: ['echo Hey, I can set an array of rules!']
      }
    ]
  },

  plugins: ['hyper-init']

}

Rules

A string or array that defines when you want your commands to run.

Rule | Description --- | --- once | executes your commands only at Hyper starts windows | executes your commands only when a new Hyper window opens tabs | executes your commands only when a new tab is opened splitted | executes your commands only when a new pane is opened all | executes your commands every time a terminal opens

Commands

An array with your shell commands to run. You can perform as many commands as you would like.

Example:

commands: ['cd ~/Desktop', 'ls']

Allowed Shells

An array of allowed shells to restrict the commands to be executed.

Example:

allowedShells: ['zsh', 'bash']

You can omit this property or let the array empty if you would like to allow the commands run for all shells.

clearCommand

hyper-init can infer the command to clear the screen for a small number of terminals. If it can't infer the command, hyper-init clears the terminal buffer using printf "\\033[H". You can set it manually adding the clearCommand: '' property within the config object. For example:

module.exports = {
  config: {
    clearCommand: 'reset'
  }
}

commandSeparator

hyper-init uses && as the default separator for commands. For known terminals, hyper-init can infer the separator. You can also set it manually by adding the commandSeparator: '' property within the config object, but this overrides for all terminals, even ones that don't support that delimiter. For example:

module.exports = {
  config: {
    commandSeparator: ' ++ ' // For an arbitrary terminal that uses `++`
  }
}

Contributing

Contributions are always welcome.

There's a bunch of ways you can contribute to this project, like by:

  • :electric_plug: Creating new features
  • :wave: Requesting a feature
  • :beetle: Reporting a bug
  • :page_facing_up: Improving this documentation
  • :rotating_light: Sharing this project and recommending it to your friends
  • :dollar: Supporting this project on Patreon
  • :bug: Funding an issue on IssueHunt
  • :star2: Dropping a star on this repository

And hyper-init's ability to infer the clearCommand and commandSeparator is based on its relatively small dictionary. Feel free to add more definitions for terminals not listed in shells.js.

KNOWN_SHELLS = {
  [...]
  shellName: {
    separator: '',
    clearCommand: ''
  }
  [...]
}
  • shellName should be replaced with the name of the shell you want to target (lowercase)
  • The value of separator should be the separator for multiple statements on one line (e.g. ' && ') as a string
  • The value of clearCommand should be the command to clear the target shell (e.g. 'cls') as a string
KNOWN_SHELLS = {
  [...]
  powershell: {
    separator: '; ',
    clearCommand: 'Clear-Host'
  }
  [...]
}

License

MIT © Dalton Menezes