Tool
一些适合工程师使用的工具
action-gh-release ---> 自动发布 GitHub Release
用于在 Linux、Windows 和 macOS 虚拟环境上创建 GitHub 版本的 GitHub Action
memlab ---> 检测内存泄露工具
检测浏览器或者 Node.js 的内存泄露。非常详细地追踪某个对象的大小变化,甚至可以用来写内存断言测试
// test-google-maps.js
// initial page load url: Google Maps
function url() {
return 'https://www.google.com/maps/@37.386427,-122.0428214,11z';
}
// action where we want to detect memory leaks: click the Hotels button
async function action(page) {
// puppeteer page API
await page.click('button[aria-label="Hotels"]');
}
// action where we want to go back to the step before: click clear search
async function back(page) {
// puppeteer page API
await page.click('[aria-label="Close"]');
}
module.exports = {action, back, url};$ memlab run --scenario test-google-maps.jsmkcert ---> 生成 HTTPS 证书
可以快速生成本地 localhost 的 HTTPS 证书
$ mkcert -install
Created a new local CA 💥
The local CA is now installed in the system trust store! ⚡️
The local CA is now installed in the Firefox trust store (requires browser restart)! 🦊
$ mkcert example.com "*.example.com" example.test localhost 127.0.0.1 ::1
Created a new certificate valid for the following names 📜
- "example.com"
- "*.example.com"
- "example.test"
- "localhost"
- "127.0.0.1"
- "::1"
The certificate is at "./example.com+5.pem" and the key at "./example.com+5-key.pem" ✅fuite ---> 检测内存泄露工具
原理:通过使用Puppeteer启动Chrome,模拟点击页面上的各个链接,再返回,检测内存大小的变化
$ npm install -g fuite
$ fuite https://www.baidu.comjavy ---> 将 JS 代码编译为 WASM 文件
在 WebAssembly 上运行您的 JavaScript。Javy 可以将您的 JavaScript 代码执行在嵌入的 JavaScript 运行时中
$ javy build index.js -o destination/index.wasmpkg ---> 将js脚本跨平台打包(windows、mac、linux)
打包编写好的log.js只需要执行:
$ npm install -g pkg
$ pkg ./log.js
# => log-win.exe
# => log-macos
# => log-linux初次打包过程会下载对应平台的Node二进制包,会比较慢,所以需要等待一段时间。