1 Star 0 Fork 0

animalcoder/Vue

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
build.js 1.11 KB
一键复制 编辑 原始数据 按行查看 历史
animalcoder 提交于 2020-03-17 14:52 +08:00 . Vueinit
#!/usr/bin/env node
var request = require('request')
, fs = require('fs')
, uvheadloc = 'https://raw.github.com/joyent/libuv/master/include/uv.h'
, defreg = /^\s*XX\(\s*([\-\d]+),\s*([A-Z]+),\s*"([^"]*)"\s*\)\s*\\?$/
request(uvheadloc, function (err, response) {
if (err)
throw err
var data, out
data = response.body
.split('\n')
.map(function (line) { return line.match(defreg) })
.filter(function (match) { return match })
.map(function (match) { return {
errno: parseInt(match[1], 10)
, code: match[2]
, description: match[3]
}})
out = 'var all = module.exports.all = ' + JSON.stringify(data, 0, 1) + '\n\n'
out += '\nmodule.exports.errno = {\n '
+ data.map(function (e, i) {
return '\'' + e.errno + '\': all[' + i + ']'
}).join('\n , ')
+ '\n}\n\n'
out += '\nmodule.exports.code = {\n '
+ data.map(function (e, i) {
return '\'' + e.code + '\': all[' + i + ']'
}).join('\n , ')
+ '\n}\n\n'
out += '\nmodule.exports.custom = require("./custom")(module.exports)\n'
fs.writeFile('errno.js', out)
})
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/animalcoder/Vue.git
git@gitee.com:animalcoder/Vue.git
animalcoder
Vue
Vue
master

搜索帮助