{"id":20226234,"url":"https://github.com/steamerjs/steamer-plugin-task","last_synced_at":"2026-06-06T04:31:11.911Z","repository":{"id":57370579,"uuid":"113207661","full_name":"steamerjs/steamer-plugin-task","owner":"steamerjs","description":"steamerjs任务管理命令","archived":false,"fork":false,"pushed_at":"2018-05-07T15:01:58.000Z","size":73,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":11,"default_branch":"master","last_synced_at":"2024-04-25T16:45:01.982Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/steamerjs.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-12-05T16:40:59.000Z","updated_at":"2018-05-07T15:01:59.000Z","dependencies_parsed_at":"2022-08-29T19:00:24.954Z","dependency_job_id":null,"html_url":"https://github.com/steamerjs/steamer-plugin-task","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/steamerjs%2Fsteamer-plugin-task","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/steamerjs%2Fsteamer-plugin-task/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/steamerjs%2Fsteamer-plugin-task/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/steamerjs%2Fsteamer-plugin-task/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/steamerjs","download_url":"https://codeload.github.com/steamerjs/steamer-plugin-task/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241670132,"owners_count":20000326,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-14T07:16:52.387Z","updated_at":"2026-06-06T04:31:11.463Z","avatar_url":"https://github.com/steamerjs.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# steamer-plugin-task\n\n并行或串行执行自定义任务\n\n[![NPM Version](https://img.shields.io/npm/v/steamer-plugin-task.svg?style=flat)](https://www.npmjs.com/package/steamer-plugin-task)\n[![Travis](https://img.shields.io/travis/steamerjs/steamer-plugin-task.svg)](https://travis-ci.org/steamerjs/steamer-plugin-task)\n[![Deps](https://david-dm.org/steamerjs/steamer-plugin-task.svg)](https://img.shields.io/steamerjs/steamer-plugin-task)\n[![Coverage](https://img.shields.io/coveralls/steamerjs/steamer-plugin-task.svg)](https://coveralls.io/github/steamerjs/steamer-plugin-task)\n\n## 添加任务\n```javascript\nsteamer task --add [task name]\n\n// 如：\nsteamer task --add alloyteam\n// 1. 全局安装 steamer-task-alloyteam\n// 2. 将 steamer-task-alloyteam 里的 .steamer 内容全数拷贝到项目的 .steamer内\n// 3. 安装 steamer-task-alloyteam 任务所需依赖到项目中\n```\n\n## 任务配置\n```javascript\n// 自动生成配置\nsteamer task\n\n// .steamer/steamer-plugin-task.js\n/**\n * 如果 task 是一个文件路径字符串，并且存在，文件会被 require 之后，执行\n * 如果 task 是字符串且中间有空格分割，task 会被解析成命令行，直接用 spawn 执行\n */\nmodule.exports = {\n    \"plugin\": \"steamer-plugin-task\",\n    \"config\": {\n        // 用对象写法是并行运行命令\n        \"dev\": {\n            0: \"steamer list\",\n            1: \"cde.js\",\n        },\n        // 用数组写法是串行运行命令\n        \"dist\": [\n            \"steamer kit -l\",\n            \"bcd.js\",\n            \"abc.js\"\n        ]\n    }\n};\n\n// .steamer/task\ntask\n |-- abc.js\n |-- bcd.js\n |-- cde.js\n |-- def.js\n\n// 并行任务\n// cde.js\nmodule.exports = function (ctx) {\n    console.log('cde');\n};\n\n// def.js\nmodule.exports = function (ctx) {\n    console.log('def');\n};\n\n// 串行任务\n// bcd.js\nmodule.exports = function(ctx, next) {\n    console.log('bcd');\n    next();\n};\n\n// abc.js, 最后一个任务无须执行next\nmodule.exports = function(ctx) {\n    console.log('abc');\n};\n\n```\n\n## 并行或串行运行任务\n```javascript\n// 并行运行 dev 的命令\nsteamer task dev\nstart running task: steamer list\nstart running task: cde.js\n// output from node cde.js\nfinishing task: cde.js\n// output from steamer list\nfinishing task: steamer list\n\n// 串行运行 dist 的命令\nstart running task: steamer kit -l\n// output from steamer list\nsteamer task dist\nstart running task: bcd.js\n// 1 second later\n// output from node bcd.js\nstart running task: abc.js\n// out from node abc.js\n```\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsteamerjs%2Fsteamer-plugin-task","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsteamerjs%2Fsteamer-plugin-task","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsteamerjs%2Fsteamer-plugin-task/lists"}