
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
command-plugin
Advanced tools
前端工程化脚手架.集成eslint,husky,prettier,eslint,npmrc,CICD,testCase,node_proxy,readme生成 9个主要功能
// 红色
console.log("\x1B[91m --本地ts-build中-- ");
console.log("\x1B[0m")
// 绿色
console.log(\x1B[92m --本地ts-build中-- \x1B[0m);
// 黄色
console.log(\x1B[93m --本地ts-build中-- \x1B[0m);
// 蓝色
console.log(\x1B[94m --本地ts-build中-- \x1B[0m);
npm uninstall -g chalk commander inquirer
begin
npm install command-plugin -g
# 第一种方法,推荐:
npm run engineer
# 第二种方法:不推荐 项目根目录的package.json中输入
command-plugin install prettier husky env eslint npm
# 第三种方法:命令行下面 输入
command-plugin gui
"type": "module",
删掉 "type": "module", 加入 "type": "commonjs"
# 项目根目录的package.json中添加
{
"engineer":"command-plugin gui "
}
# 然后运行 npm run engineer
限制了只能用如下参数进行提交
module.exports = {
printWidth: 80,
// 使用单引号而非双引号;
singleQuote: true,
tabWidth: 2,
proseWrap: 'never',
// 在语句末尾添加分号;
Semicolons: true,
overrides: [{ files: '.prettierrc', options: { parser: 'json' } }],
};
more refer:https://www.prettier.cn/
cross-env ENV=production max dev
var proEnv = require('./config/production.env'); // 生产环境
var testEnv = require('./config/test.env'); // 测试环境
var devEnv = require('./config/development.env'); // 本地环境
const env = process.env.ENV;//当前环境
let URL_COMMON = '';//路径
let URL_RESOURCE = '';//路径
// 默认是本地环境
if (env === 'production') { // 生产环境
console.log("----------生产环境----------");
URL_COMMON = proEnv.URL_COMMON;
URL_RESOURCE = proEnv.URL_RESOURCE
} else if (env === 'test') { // 测试环境
console.log("----------测试环境----------");
URL_COMMON = testEnv.URL_COMMON;
URL_RESOURCE = testEnv.URL_RESOURCE
} else if( env ==='development') { // 开发环境
console.log("----------开发环境----------");
URL_COMMON = devEnv.URL_COMMON;
URL_RESOURCE = devEnv.URL_RESOURCE
}
// npm install babel-eslint --save
module.exports = {
root: true,
env: {
browser: true,
node: true,
},
extends: [
// 额外添加的规则可查看 https://vuejs.github.io/eslint-plugin-vue/rules/
// 'plugin:vue/essential', //加了这个才能当作vue来进行解析,不然只会当成js来进行解析 eslint-plugin-react
],
//不加这个会报错Parsing error: The keyword 'import' is reserved
parserOptions: {
// 指定解析器 parser
ecmaVersion: 8,
sourceType: 'module',
// "parser": 'babel-eslint',
// sourceType: 'module',
// ecmaVersion: 12,
// allowImportExportEverywhere: true, // 不限制eslint对import使用位置
},
settings: {},
// 取消没必要的校验 0 是 不报错 , 1是warn 2 是punishing
// "off"或者0 //关闭规则关闭
// "warn"或者1 //在打开的规则作为警告(不影响退出代码)
// "error"或者2 //把规则作为一个错误(退出代码触发时为1)
rules: {
// "camelcase": ["error", { "allow": ["aa_bb"] }], // 属性名
// "max-lines": ["error", {"max": 20, "skipComments": true}], // 每一个文件最多的行数
// "no-console": 2,//禁止使用console
// "no-mixed-spaces-and-tabs": [2, false],//禁止混用tab和空格
// "no-multiple-empty-lines": [1, {"max": 2}],//空行最多不能超过2行
// "no-multi-spaces": 1,//不能用多余的空格
// "indent": [1, 4],//缩进风格 缩进四个空格
// "max-lines-per-function": [0, { "max": 2 }], // 指定每个function最多多少行
'no-unused-vars': 2, //没被使用
'consistent-return': 0, // 有函数返回值
'no-underscore-dangle': 0, // 不允许有下划线
'no-plusplus': 1, // 不能用++
'no-eval': 0, // 不能用eval
'linebreak-style': [0, 'error', 'window'], // 换行风格
camelcase: 'warn', //像是xx_xx这种会报错
},
// 这里可以配置具体后缀的规则
overrides: [
{
files: ['*.js'],
// extends: ['alloy'],
rules: {
'no-unused-vars': 0, //没被使用
},
},
],
};
more refer:http://eslint.cn/
指定.npmrc
目前这个文件夹是放置一些脚本的。
包括部署和项目结构优化的脚本
里面分成两个文件夹.主要使用jest做的
主要是有工具类js ,ts 的测试。
以及web-component之类的测试
集成了三种方法来做跨域。一般如果你做脚本的话,可以下载下来做插件的端口转发
帮助你生成标准 README.md 的 东西。
注意。提前要填写好你package.json 的name version homepage 三个字段
然后注意 如果项目中有 README.md 需要先删掉
默认会生成 author 和 packageName 的label(就是一开始下面并列的牌子)
如果你想要添加自己的label 可以在package.json中添加 如下格式字段
"label": [
{
"frontName": "Gitee",
"behindName": "Electrolux",
"src": "https://gitee.com/Electrolux",
"color": "red"
},
{
"frontName": "Bili",
"behindName": "Electrolux",
"src": "https://space.bilibili.com/286773126",
"color": "Pink"
}
],
一开始安装的时候会通过package.json的bin字段执行 install.js
如果你想添加你自己工程化的东西
--1.首先将你的文件放进file 文件夹
--2.修改project.js的 guiFn 方法和 增加 util/handleEvent.js导出的方法
--3.接下来的测试阶段请输入npm link
然后 npm run engineer
# first
npm install command-plugin -g
npm run engineer
# THEN
select CICD and husky
# THEN
GO to dir .husky/commit-msg
然后把 os.system("node CICD/CHANGELOG/changeLogAdd.js " + line) 前面的判断符号改成 true
# THEN
GO to dir CICD/CHANGELOG/changeLogAdd
然后 把 isAutoUpDate 改成 true
if you allow my readme.md script ,then you can
# first
npm install command-plugin -g
npm run engineer
# THEN
select CICD
# THEN
GO to dir .husky/commit-msg
然后把 os.system("node CICD/readmeUpdate/readmeUpdate.js") 前面的判断符号改成 true
# THEN
GO to dir CICD/readmeUpdate/readmeUpdate.js
然后 把 line 和 resText 进行 替换
[](https://gitee.com/Electrolux)
command-plugin is developed by me. Please use command-plugin, star it on gitee or even become a sponsor to support us!
FAQs
提交规范和自动化command脚本
The npm package command-plugin receives a total of 14 weekly downloads. As such, command-plugin popularity was classified as not popular.
We found that command-plugin demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.