
Security News
Axios Supply Chain Attack Reaches OpenAI macOS Signing Pipeline, Forces Certificate Rotation
OpenAI rotated macOS signing certificates after a malicious Axios package reached its CI pipeline in a broader software supply chain attack.
基于gulp任务流的模板和静态资源版本化、combo工具
安装npm install -g Yworkcli del-cli@3.0.1
采用的是全局安装,命令行调用。
在项目中新建ywork.config.json配置文件
{
"static":{
"path":"build/activity", //生成的项目资源路径
"gtimgName":"activity", //对应的gtimg地址资源路径
"output":"_prelease" //本地输出的编译后路径
},
"views":{
"path":"src/views", //匹配的模板文件路径
"output":"_previews"//最终生成的目录文件路劲
},
"configs":{
"path":"src/node--config",//框架机config路径
"output":"_prelease"//框架集config发布路径
},
"combo": {
"force": true,//是否开启combo
"gtimgTag":"<%= staticConf.domains.static %>",// 静态资源环境配置
"gtimgNamePrepend":"readnovel", // combo串单独资源路由前置路径
"uri":"<%= staticConf.domains.static %>/c/=",//combo的线上URL接口
"logicCondition": "envType == \"pro\" || envType == \"oa\"" //开启combo的条件,注意需要转义双引号
},
}
由于yworkcli将核心构建任务完全配置化。可以理解成,通过上面的ywork.config.json配置静态资源和views的入口和出口。
项目路径执行yworkcli --init会初始化一个配置文件,大家务必按照自己的项目需求来配置。
不再强制约束文件夹格式,适用性更广。只需要保证保证框架机核心config配置,静态资源和模板自由度路径自由度更高。
在项目目录下(有ywork.config.json),执行yworkcli --publish --log './ywork.log'
--log {日志相对路径}可以自定义日志,方便调试。
执行yworkcli --publish --skip,即可强制不生版本发布。
执行yworkcli --publish --hash,即可生成hash版本,默认hash长度为5位。
执行yworkcli --publish --yconfig ${proj.yconfig}
带deps的参数, 会在hash-tag-map生成一个deps.json和alias.json 同时views里面需要新增如下配置
LBF.config({
deps: <%= lbf.deps %>
});
LBF.config({
alias: <%= lbf.alias %>
});
在完成之后<%= lbf.deps %>和<%= lbf.alias %>会被替换成对应的json
执行yworkcli --publish --yconfig ${proj.yconfig} --hash --deps
因为--deps方式,将页面的js都不使用带版本的js替换了,但是部分js还是需要替换,所以在ywork.config.json新增了一个deps:replaceMD5的配置, 使用的是glob格式语法.
{
"static":{
"path":"build/activity", //生成的项目资源路径
"gtimgName":"activity", //对应的gtimg地址资源路径
"output":"_prelease" //本地输出的编译后路径
},
"views":{
"path":"src/views", //匹配的模板文件路径
"output":"_previews"//最终生成的目录文件路劲
},
"configs":{
"path":"src/node--config",//框架机config路径
"output":"_prelease"//框架集config发布路径
},
"combo": {
"force": true,//是否开启combo
"gtimgTag":"<%= staticConf.domains.static %>",// 静态资源环境配置
"gtimgNamePrepend":"readnovel", // combo串单独资源路由前置路径
"uri":"<%= staticConf.domains.static %>/c/=",//combo的线上URL接口
"logicCondition": "envType == \"pro\" || envType == \"oa\"" //开启combo的条件,注意需要转义双引号
},
"deps": {
"replaceMD5": ["!**/*.js", "**/sprite.js", "**/sprite.*.js"] // 除了sprite.js和sprite.*.js以外,所有的js都不参与MD5的替换
}
}
"sw": [ { "globDirectory": "./dist/static/", "globPattern": ["/*.{js,css}"], "swDest": "./dist/views/m.webnovel.com/sw-dev.js", "modifyUrlPrefix": { "overseam": "https://devwww.yueimg.com/overseam" }, "clientsClaim": true, "skipWaiting": true }, { "globDirectory": "./dist/static/", "globPattern": ["/.{js,css}"], "swDest": "./dist/views/m.webnovel.com/sw-oa.js", "modifyUrlPrefix": { "overseam": "https://oawww.yueimg.com/overseam" }, "clientsClaim": true, "skipWaiting": true }, { "globDirectory": "./dist/static/", "globPattern": ["**/.{js,css}"], "swDest": "./dist/views/m.webnovel.com/sw-pre.js", "modifyUrlPrefix": { "overseam": "https://prewww.yueimg.com/overseam" }, "clientsClaim": true, "skipWaiting": true }, { "globDirectory": "./dist/static/", "globPattern": ["**/*.{js,css}"], "swDest": "./dist/views/m.webnovel.com/sw.js", "modifyUrlPrefix": { "overseam": "https://www.yueimg.com/overseam" }, "clientsClaim": true, "skipWaiting": true } ]
FAQs
A smart front end workflow cli tool.
The npm package Yworkcli receives a total of 1 weekly downloads. As such, Yworkcli popularity was classified as not popular.
We found that Yworkcli demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 4 open source maintainers 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
OpenAI rotated macOS signing certificates after a malicious Axios package reached its CI pipeline in a broader software supply chain attack.

Security News
Open source is under attack because of how much value it creates. It has been the foundation of every major software innovation for the last three decades. This is not the time to walk away from it.

Security News
Socket CEO Feross Aboukhadijeh breaks down how North Korea hijacked Axios and what it means for the future of software supply chain security.