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

open-terminal-programmatically

v1.0.0

Published

A support package for the vscode extension `Open Terminal Programmatically`

Downloads

136

Readme

Open Terminal Programmatically

Open VsCode terminal programmatically in the simplest way possible.
Launch VsCode's debugger programmatically, passing in your launch configuration.

Introduction

If you're using VSCode, and you constantly find yourself in a situation where you need to open multiple vscode terminals, where each one runs a different server (or a script), then this is the package for you.

Prerequisites:

  • VSCode as your IDE
  • Open Terminal Programmatically extension installed

Most of the work would be done by the extension. This package just acts as its wrapper, providing you with 2 easy-to-use functions, with hints, autocomplete, and correct typings.


Getting Started

- Step 1: install Open Terminal Programmatically extension

Go over to the extension market on VSCode, search & download Open Terminal Programmatically.

- Step 2: install the open-terminal-programmatically npm package

Run one of these:
(depending on your package manager)

npm install -g open-terminal-programmatically
pnpm add -g open-terminal-programmatically
yarn add -g open-terminal-programmatically

- Step 3: import the openTerminal function

import { openTerminal } from 'open-terminal-programmatically';

How to use

The openTerminal is a function you can use to open new terminals in VSCode, or launch/attach a new debug process.

It accept these following options:

- isDebugMode

type: boolean (Optional) default: false

If set to true, command will open up VSCode's debug terminal, which would appear under the TERMINAL tab.
If set toe true, the config prop should then be of type DebugConfig, else, it should be of type TerminalConfig. (more on those 2 types is down below).

- delayNextFor

type: number (Optional)

Puts a delay of X milliseconds after the execution.
Sometimes you're running 2 servers, where one is dependant on the other being ready. You can put some delay between them by using the delayNextFor property.

- config

type: TerminalConfig | DebugConfig (Required)

Depending on whether you want a debugger terminal, or a regular terminal, you should pass the proper form of corresponding config.

- config of type TerminalConfig

- config.command

type: string (Required)

The command to execute in that new terminal to be opened.
This is the only required field on config.

- config.name

type: string (Optional)

The name of the new terminal to be opened.
Will appear in your IDE.

- config.color

type: 'red' | 'green' | 'blue' | 'yellow' | 'magenta' | 'cyan' | 'black' | 'white'; (Optional) default: 'white'

The name of the terminal will be colored in that color.

- config.autoFocus

type: boolean (Optional) default: false

Should the terminal gain focus once it's open or not.

- config.runtimeArgs

type: Array (Optional)

You can add additional run time args to the command to execute.

- config of type DebugConfig

These props are all the props you usually put under your launch config, under your ".vscode/launch.json" file. Read more about those in the official VSCode documentation.


License

MIT