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

steamer-plugin-task

v1.0.5

Published

run tasks parallelly or serially

Downloads

15

Readme

steamer-plugin-task

并行或串行执行自定义任务

NPM Version Travis Deps Coverage

添加任务

steamer task --add [task name]

// 如:
steamer task --add alloyteam
// 1. 全局安装 steamer-task-alloyteam
// 2. 将 steamer-task-alloyteam 里的 .steamer 内容全数拷贝到项目的 .steamer内
// 3. 安装 steamer-task-alloyteam 任务所需依赖到项目中

任务配置

// 自动生成配置
steamer task

// .steamer/steamer-plugin-task.js
/**
 * 如果 task 是一个文件路径字符串,并且存在,文件会被 require 之后,执行
 * 如果 task 是字符串且中间有空格分割,task 会被解析成命令行,直接用 spawn 执行
 */
module.exports = {
    "plugin": "steamer-plugin-task",
    "config": {
        // 用对象写法是并行运行命令
        "dev": {
            0: "steamer list",
            1: "cde.js",
        },
        // 用数组写法是串行运行命令
        "dist": [
            "steamer kit -l",
            "bcd.js",
            "abc.js"
        ]
    }
};

// .steamer/task
task
 |-- abc.js
 |-- bcd.js
 |-- cde.js
 |-- def.js

// 并行任务
// cde.js
module.exports = function (ctx) {
    console.log('cde');
};

// def.js
module.exports = function (ctx) {
    console.log('def');
};

// 串行任务
// bcd.js
module.exports = function(ctx, next) {
    console.log('bcd');
    next();
};

// abc.js, 最后一个任务无须执行next
module.exports = function(ctx) {
    console.log('abc');
};

并行或串行运行任务

// 并行运行 dev 的命令
steamer task dev
start running task: steamer list
start running task: cde.js
// output from node cde.js
finishing task: cde.js
// output from steamer list
finishing task: steamer list

// 串行运行 dist 的命令
start running task: steamer kit -l
// output from steamer list
steamer task dist
start running task: bcd.js
// 1 second later
// output from node bcd.js
start running task: abc.js
// out from node abc.js