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

stack-commander

v0.1.3

Published

Add simple method for running commands on your stack

Downloads

5

Readme

Stack Commander

Although we fell this package to already be very useful it is still in BETA

This is a simple utility you can use to run commands in your dev stack or any stack you'd like.

You simply can define commands then run those commands at a command line starting with they keyword stack

Example

stack start web
stack up
stack down
stack update

or

stack deploy remote web

Install

This is a global package, so you only have to install it on your machine once.

npm install -g stack-commander

Configure

Create a yaml file in the root of you your repo that define your commands

The basic stack.yml file must have this format

stack:
  commands:

All the commands you define will be under the commands: node

A command can be in several forms depending on your needs.

The most basic

stack:
  commands:
    mydir: echo $(pwd)

With multiple commands

This will run the commands as separate commands

stack:
  commands:
    mydir: 
      - echo This is my current directory
      - echo $(pwd)

Or, if you need the commands to run as on single command you can do this:

stack:
  commands:
    mydir: |
      echo This is my current directory
      echo $(pwd)

Or, if you have a command that will need to take in parameters you can do this:

stack:
  commands:
    test:
      filter:
        commands: vendor/bin/phpunit --filter 

Then, when you run this:

stack test filter testSomeMethod testAnotherMethod
# this will produce a filter command
# vendor/bin/phpunit --filter testSomeMethod testAnotherMethod

With a description

stack:
  commands:
    mydir: 
      description: This will print out my current directory
      commands:
        - echo $(pwd)
        - echo There it is

You can make a multi line description simply by doing this:

stack:
  commands:
    mydir: 
      description: |
        This will print out my current directory
        This will print out on the second line of the description
      commands:
        - echo Command 1

With a working directory

You can specify the working directory relative to where the command is being ran

stack:
  commands:
    mydir: 
      description: This will print out my current directory
      path: test/path
      commands:
        - echo 'this is file1' >> file1.txt

If the directory test/path exists the above command will create the file `test/path/file1.txt

With multiple commands with multiple working directories

Not the command keys 0, 1, and 2. These are arbitrary and can be what ever you want them to be as long as they are unique to this list of commands (not unique for the entire stack.yml file)

stack:
  commands:
    mydir: 
      description: This will print out my current directory
      commands:
        0:
          commands: mkdir newdir
        1:
          path: newdir
          commands: 
            - echo 'this is file1' >> file1.txt
            - mkdir anotherdir
        2:
          path: newdir/anotherdir
          commands:
            - echo 'this is file2' >> file2.txt
            - echo 'this is file3' >> file3.txt

Here's what will actually happen with this command.

  1. The directory newdir will be created
  2. A file named file1.txt will be created in newdir (./newdir/file1.txt)
  3. A directory named anotherdir will be created inside the newdir (./newdir/anotherdir)
  4. Files file2.txt and file3.txt will be created in the anotherdir directory (./newdir/anotherdir)

Example

Here is an example of a more complex stack.yml file with examples of different ways you can configure your commands.

stack:
  commands:
    test:
      default: echo This is test default
      zero_a: echo This is zero_a test
    one: echo This is the most basic test
    two:
      - echo Test Two Command One
      - echo Test Two Command Two
    three:
      description: This is test three
      path: test
      commands: echo Test Three Command One
    four:
      description: This is test four
      commands:
        0:
          commands: mkdir newdir
        1:
          path: newdir
          commands: mkdir anotherdir
        2:
          path: newdir/anotherdir
          commands:
            - echo 'this is file1' >> file1.txt
            - echo 'this is file2' >> file2.txt
    five:
      description: This is test five
      path: test
      commands:
        - echo Test Five Command One
        - echo Test Five Command Two
    nested:
      default: echo Level 1
      next:
        default: echo Level 2
        next:
          default: echo Level 3
          next:
            default: echo Level 4
            next:
              default: echo Level 5
              next: echo Level 6

This stack.yml file will produce the following commands

stack test
stack one
stack two
stack three
stack four
stack five
stack nested
stack nested next
stack nested next next
stack nested next next next
stack nested next next next next
stack nested next next next next next

Internal Commands

Get version

stack --version