{"id":20226229,"url":"https://github.com/steamerjs/steamer-pluginutils","last_synced_at":"2026-05-30T21:31:59.399Z","repository":{"id":57370618,"uuid":"76120876","full_name":"steamerjs/steamer-pluginutils","owner":"steamerjs","description":"utils for steamer plugin","archived":false,"fork":false,"pushed_at":"2018-05-02T17:17:24.000Z","size":59,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-01-13T23:32:53.261Z","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":"2016-12-10T15:29:16.000Z","updated_at":"2018-05-02T17:17:25.000Z","dependencies_parsed_at":"2022-08-29T18:30:35.306Z","dependency_job_id":null,"html_url":"https://github.com/steamerjs/steamer-pluginutils","commit_stats":null,"previous_names":["steamerteam/steamer-pluginutils"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/steamerjs%2Fsteamer-pluginutils","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/steamerjs%2Fsteamer-pluginutils/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/steamerjs%2Fsteamer-pluginutils/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/steamerjs%2Fsteamer-pluginutils/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/steamerjs","download_url":"https://codeload.github.com/steamerjs/steamer-pluginutils/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.316Z","updated_at":"2026-05-30T21:31:59.393Z","avatar_url":"https://github.com/steamerjs.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"## steamer-pluginutils\n\n### 即将过时\n本项目即将过时，插件开发后续主要使用 [steamer-plugin](https://github.com/steamerjs/steamer-plugin) 作为基类开发。\n\n[![NPM Version](https://img.shields.io/npm/v/steamer-pluginutils.svg?style=flat)](https://www.npmjs.com/package/steamer-pluginutils)\n[![Travis](https://img.shields.io/travis/steamerjs/steamer-pluginutils.svg)](https://travis-ci.org/steamerjs/steamer-pluginutils)\n[![Deps](https://david-dm.org/steamerjs/steamer-pluginutils.svg)](https://david-dm.org/steamerjs/steamer-pluginutils)\n[![Coverage](https://img.shields.io/coveralls/steamerjs/steamer-pluginutils.svg)](https://coveralls.io/github/steamerjs/steamer-pluginutils)\n\n[steamerjs](https://github.com/steamerjs/steamer-pluginutils) 便于开发 `plugin` 的 `util` 函数\n\n### 接口\n\n#### 属性\n- `pluginName`\n\t- `String`\n\t- 默认值: \"\"\n\t- 注册 `plugin` 名\n\n- `config`\n\t- `Object`\n\t- 默认值: null,\n\t- 配置值\n\n- `isWindows`\n\t- `Boolean`\n\t- 是否window系统\n- `globalHome`\n\t- `String`\n\t- 通常用作全局配置存放的位置，是 `os.homedir()` 的一层包装\n\n- `globalNodeModules`\n\t- `String`\n\t- 全局 `npm` 模块包位置， 是 `process.env.NODE_PATH` 的一层包装\n\n#### 配置函数\n\n- `addRequirePath`\n\t- `Function`\n\t- 添加模块搜索路径\n\t- 参数\n\t- `requirePath`, `String`, 新的模块搜索路径\n\t- `targetPath`, `String`, 添加新模块搜索路径的目标, 默认值: `require.main.paths`\n\n- `createConfig`\n\t- Function\n\t- 创建配置\n\t- 参数\n\t\t- `config`, config object, 默认值为: `{}`\n\t\t- `option`, 其它配置项目\n\t\t\t- `isGlobal`,`Boolean`， 是否放于全局\n\t\t\t- `folder`, `String`, `.steamer` 的父目录，\n\t\t\t- `filename`, `String`, 具体的文件名\n\t\t\t- `extension`, `String`, 文件名后缀，默认值：`js`\n\t\t\t- `overwrite`, `Boolean`, 是否覆盖已经存在的配置文件\n\n\n- `readConfig`\n\t- Function\n\t- 读取配置, 采用配置继承的方式，本地配置继承全局配置\n\t- 参数\n\t\t- `option`, 其它配置项目\n\t\t\t- `folder`, `String`, `.steamer` 的父目录，\n\t\t\t- `filename`, `String`, 具体的文件名\n\t\t\t- `extension`, `String`, 文件名后缀，默认值：`js`\n\n- readSteamerConfig\n\t- Function\n\t- read steamerjs global or local config\n\t- Parameters\n\t\t- `isGlobal`, is the config global or local, default: `false`\n\t- Return \n\t\t- `config`, config object\n\n- readSteamerLocalConfig\n\t- Function\n\t- read steamerjs local config\n\t- Return\n\t\t- `config`, local config object\n\n- readSteamerGlobalConfig\n\t- Function\n\t- read steamerjs global config\n\t- Return\n\t\t- `config`, global config object\n\n- createSteamerConfig\n\t- Function\n\t- read steamerjs global or local config\n\t- Parameters\n\t\t- `isGlobal`, is the config global or local, default: `false`\n\t\t- `overwrite`, `Boolean`, 是否覆盖已经存在的配置文件\n\t- Return \n\t\t- `config`, config object\n\n#### 命令输出\n\n- error\n\t- Function\n\t- 将文本以红色输出\n\n- info\n\t- Function\n\t- 将文本以蓝色输出\n\n- warn\n\t- Function\n\t- 将文本以黄色输出\n\n- success\n\t- Function\n\t- 将文本以绿色输出\n\n- printTitle\n \t- Function\n \t- 输出命令标题\n \t- Parameters\n \t\t- `str`, 标题\n \t\t- `color`, 颜色\n```javascript\n// 例子\n================================ Command Usage ================================\n```\n\n- printEnd\n \t- Function\n \t- 输出命令结尾\n \t- Parameters\n \t\t- `color`, 颜色\n```javascript\n// 例子\n================================================================================\n```\n\n- printUsage\n \t- Function\n \t- 输出命令使用\n \t- Parameters\n \t\t- `description`, 命令描述\n \t\t- `cmd`, 命令名称\n ```javascript\n // 例子\nusage:\nsteamer doctor    help you check steamer running environment!!!\n ```\n\n- printOption\n - Function\n \t- 输出命令参数\n \t- Parameters\n \t\t- `options`, 参数数组\n \t\t\t- `option.option`, 参数名\n \t\t\t- `option.alias`, 参数别名\n \t\t\t- `option.value`, 参数值\n```javascript\n// 例子\noptions:\n    --help, -h                    123\n    --ak, -a                      456\n    --plugin, -p \u003cplugin name\u003e    789\n    --help                        123\n```\n\n#### 外部库\n\t- fs ([fs-extra](https://github.com/jprichardson/node-fs-extra))\n\t- chalk ([chalk](https://github.com/chalk/chalk))\n\n\n### 开发及测试\n```javascript\n// 用于全局进行代码清理\nnpm i -g eslint\nnpm run lint\n\n// 用于测试\nnpm test\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsteamerjs%2Fsteamer-pluginutils","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsteamerjs%2Fsteamer-pluginutils","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsteamerjs%2Fsteamer-pluginutils/lists"}