VS Code Life Hack for Redwood

I use VS Code as an IDE, and its Terminal feature for running dev servers as well as having a console for work like so:

It’s inconvenient to add new shell sessions, rename them, and remember the correct command to launch services every time I reboot.

There’s a VS Code extension that lets you add a terminals.json file to your .vscode directory and launch the terminals automatically. Here’s the script I’m using for Redwood. You’ll end up with the default console (named Bash) that VS code sets up. There’s no way I found to delete or rename an existing console (like you can with Yakuake).

{
  "autorun": true,
  "env": { "NODE_ENV": "development" },
  "terminals": [
    {
      "name": "server",
      "description": "Start the dev server",
      "command": "yarn rw dev"
    },
    {
      "name": "graphiql",
      "description": "Start Prisma server",
      "command": "yarn rw prisma studio"
    },
    {
      "name": "storybook",
      "description": "Start Storybook server",
      "command": "yarn rw storybook"
    },
    {
      "name": "docs",
      "description": "Start Docusaurus server",
      "commands": ["cd docs", "yarn start --port 3267"]
    },
    {
      "name": "test",
      "description": "Start unit test watcher",
      "command": "yarn rw test"
    },
    {
      "name": "console",
      "description": "Open console",
      "focus": true
    }
  ]
}

Thought someone else might find it handy.

8 Likes

Love this - great share :raised_hands:

1 Like

Love it! typo in studio (commands should be singular)

1 Like

Thanks for catching that, I updated the post

1 Like