
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.
网易教育产品交互式前端脚手架
Edulis致力于提供可扩展的、可配置的、基于NEI工程规范的项目脚手架功能吗,每天为你节省5分钟
在NEI工程规范中我们需要类似于:
nei build -sk 8b99059f8292ebced1335a1285e5d94e -module term -name member-list -author hzxxxxx
这样的命令去生成一个工程的初始结构,which means:
每新建一种类型的工程,需要去NEI上找到对应的工程规范的key
需要记住这个工程规范包含的参数名,例如:module,name,author
一条命令包含了多个参数,难以集成到npm scripts里
在诸如module-term这样的工程里,每新建一个module或component,其命令的module参数其实都是相同的,变化的只有name和author参数。但是由于以上的命令里包含了所有三个参数,所以很难把上面的命令集成到module-term的package.json的scripts里,如果我们添加如下的scripts:
{
"scripts":{
"component": "nei build -sk 8b99059f8292ebced1335a1285e5d94e -module term"
}
}
则需要在npm run component之后手动添加-name member-list -author hzxxxxx,这种体验显然是不自然和不友好的,很容易因为忘记添加后面的参数导致生成了错误的文件
由于Edulis基于NEI工程规范,显然你需要先安装NEI:
npm install -g nei
然后安装Edulis:
npm install -g edulis
因为Edulis的全局配置文件应放置于用户而不是root的home目录下,所以不推荐用sudo进行安装,如果出现非sudo安装权限不够的情况,你可能需要
sudo chown YOUR_USER_NAME /usr/local/lib/node_modules
你可以看到Edulis基本用法如下:
Usage: edulis <command> [--option [value]]
Options:
-V, --version output the version number
-h, --help output usage information
Commands:
* help
component|com [options] Build A New Component
update Update Config
delete Delete All Files and Folders in the Current Dictionary
在你需要新建module和component的目录,例如~/develop/module-term/,运行:
edulis component
你可以看到:
? Choose a Component Template : (Use arrow keys)
❯ 云课堂 - cms组件
教育产品 - 通用组件
教育产品 - 通用模块
教育产品 - 模块组件
教育产品 - 业务组件
教育产品 - 通用缓存
就可以用方向键和Enter选择对于的工程模板了,在选择之后,就可以键入对应的参数值。对于上面提到的例子,我们可以这样使用Edulis实现:
? Choose a Component Template : 教育产品 - 通用模块
? Input the component module: term
? Input the component name: member-list
? Input the component author: hzxxxxx
然后,一个新的“通用模块”就在当前目录诞生啦
NEI上的工程规范那么多,Edulis只会把其中最通用的一部分包含进来。Edulis的全局配置在~/.edulis.json,内容如下:
{
"prefix": "nei build -sk",
"templates": [
//...
{
"des": "教育产品 - 通用组件",
"key": "8b99059f8292ebced1335a1285e5d94e",
"params": [
"module",
"name",
"author"
]
},
//...
]
}
每一项加入Edulis的工程规范,必须在templates数组里有一个对应的配置对象。
其中,
des字段表示在Edulis中显示的该工程规范的名称key字段表示该工程规范的keyparams表示该工程规范需要的参数Notice :
- 要新加入一个工程模板,必须先在NEI上新建对应的工程规范
- 新加入的工程规范如需要配置到Edulis全局配置中,请联系作者
- 全局安装Edulis后,会在home目录自动添加全局配置,如遭遇全局配置错误,可以使用
edulis update初始化全局配置- 受限于NEI,Edulis生成新项目的过程并不原子,无法撤销,只能手动删除
对于上面提到的module-term的例子,我们可以添加这样的npm scripts:
{
"scripts":{
"component": "edulis component -k 8b99059f8292ebced1335a1285e5d94e -m term"
}
}
用-k指定对于工程规范的key,用-m指定对应工程规范的module参数,这样,以后使用npm run component的时候就不需要在选择模板和输入module参数了,只需要输入name和author参数
有一些业务线里专用的工程规范(例如上面出现过的“云课堂 - cms组件”),我们不需要将其加入全局配置中,只要在相应业务工程中可以使用就行了。Edulis支持业务配置,在实际使用中,Edulis实际取到的配置其实是业务配置和全局配置的和。
对于“云课堂 - cms组件”这个工程规范,我们可以在component-cms这个工程的根目录里添加业务配置.edulis.json:
[
{
"des": "云课堂 - cms组件",
"key": "fb85e7dbb675ef5e194b6234cfcc90d9",
"params": [
"name",
"author"
]
}
]
注意,此时可以省略templates字段,内容直接为templates数组
添加了以上的业务配置后,只要Edulis在component-cms目录下运行,就能够找到“云课堂 - cms组件”这个工程规范。
本项目开源在Github,欢迎Star,欢迎Contribute,欢迎各业务线接入
FAQs
Netease EDU Scaffolding
We found that edulis 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.