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

@devpodio/task

v0.6.3

Published

Theia - Task extension. This extension adds support for executing raw or terminal processes in the backend.

Downloads

3

Readme

Theia - Task Extension

This extension permits executing scripts or binaries in Theia's backend.

Tasks launch configurations can be defined independently for each workspace, under .theia/tasks.json. When present, they are automatically picked-up when a client opens a workspace, and watches for changes. A task can be executed by triggering the "Run Task" command (shortcut F1). A list of known tasks will then be available, one of which can be selected to trigger execution.

Each task configuration looks like this:

{
    "label": "Test task - list workspace files recursively",
    "type": "shell",
    "cwd": "${workspaceFolder}",
    "command": "ls",
    "args": [
        "-alR"
    ],
    "windows": {
        "command": "cmd.exe",
        "args": [
            "/c",
            "dir",
            "/s"
        ]
    }
}

label: a unique string that identifies the task. That's what's shown to the user, when it's time to chose one task configuration to run.

type: determines what type of process will be used to execute the task. Can be "process" or "shell". "Shell" processes' output can be shown in Theia's frontend, in a terminal widget. If type set as "process" then task will be run without their output being shown.

cwd: the current working directory, in which the task's command will execute. This is the equivalent of doing a "cd" to that directory, on the command-line, before running the command. This can contain the variable ${workspaceFolder}, which will be replaced at execution time by the path of the current workspace. If left undefined, will by default be set to workspace root.

command: the actual command or script to execute. The command can have no path (e.g. "ls") if it can be found in the system path. Else it can have an absolute path, in which case there is no confusion. Or it can have a relative path, in which case it will be interpreted to be relative to cwd. e.g. "./task" would be interpreted to mean a script or binary called "task", right under the workspace root directory.

args: a list of strings, each one being one argument to pass to the command.

windows: by default, command and args above are used on all platforms. However it's not always possible to express a task in the same way, both on Unix and Windows. The command and/or arguments may be different, for example. If a task needs to work on both Linux/MacOS and Windows, it can be better to have two separate process options. If windows is defined, it will be used instead of command and args, when a task is executed on a Windows backend.

Here is a sample tasks.json that can be used to test tasks. Just add this content under the theia source directory, in directory .theia:

{
    // Some sample Theia tasks
    "tasks": [
        {
            "label": "[Task] short running test task (~3s)",
            "type": "shell",
            "cwd": "${workspaceFolder}/packages/task/src/node/test-resources/",
            "command": "./task",
            "args": [
                "1",
                "2",
                "3"
            ],
            "windows": {
                "command": "cmd.exe",
                "args": [
                    "/c",
                    "task.bat",
                    "abc"
                ]
            }
        },
        {
            "label": "[Task] long running test task (~300s)",
            "type": "shell",
            "cwd": "${workspaceFolder}/packages/task/src/node/test-resources/",
            "command": "./task-long-running",
            "args": [],
            "windows": {
                "command": "cmd.exe",
                "args": [
                    "/c",
                    "task-long-running.bat"
                ]
            }
        },
        {
            "label": "[Task] recursively list files from workspace root",
            "type": "shell",
            "cwd": "${workspaceFolder}",
            "command": "ls",
            "args": [
                "-alR"
            ],
            "windows": {
                "command": "cmd.exe",
                "args": [
                    "/c",
                    "dir",
                    "/s"
                ]
            }
        },
        {
            "label": "[Task] Echo a string",
            "type": "shell",
            "cwd": "${workspaceFolder}",
            "command": "bash",
            "args": [
                "-c",
                "echo 1 2 3"
            ]
        }
    ]
}

Variables substitution

The variables are supported in the following properties, using ${variableName} syntax:

  • cwd
  • command
  • args
  • windows.command
  • windows.args

See here for a detailed documentation.

Contribution points

The extension provides contribution points:

  • browser/TaskContribution - allows an extension to provide its own Task format and/or to provide the Tasks programmatically to the system
export interface TaskContribution {
    registerResolvers?(resolvers: TaskResolverRegistry): void;
    registerProviders?(providers: TaskProviderRegistry): void;
}
  • node/TaskRunnerContribution - allows an extension to provide its own way of running/killing a Task
export interface TaskRunnerContribution {
    registerRunner(runners: TaskRunnerRegistry): void;
}

License