|
|
8 years ago | |
|---|---|---|
| app | 8 years ago | |
| assets | 8 years ago | |
| scripts | 8 years ago | |
| test | 8 years ago | |
| ui | 8 years ago | |
| .babelrc | 8 years ago | |
| .gitattributes | 8 years ago | |
| .gitignore | 8 years ago | |
| License.md | 8 years ago | |
| README.md | 8 years ago | |
| gulpfile.js | 8 years ago | |
| package.json | 8 years ago | |
| webpack.config.js | 8 years ago |
Homepage: https://oldj.github.io/SwitchHosts/
这是一个用于快速切换 hosts 文件的小程序,基于 Electron 开发,同时使用了 React 以及 CodeMirror 等框架/库。
你可以直接下载源码到本地运行或编辑,或者在下面下载可执行版本:
在 macOS 上,也可以使用 brew cast 安装,命令如下:
brew cask install switchhosts
感谢 @gobinathm、@iamybj 更新 brew cask 版本。
SwitchHosts! 的数据文件在 ~/.SwitchHosts 目录下(Windows 用户为个人主目录下的 .SwitchHosts 目录下),其中 ~/.SwitchHosts/data.json 是 hosts 数据文件,~/.SwitchHosts/prefereces.json 是配置信息。
./ 下,运行 npm install 命令,安装开发依赖库;在 ./app 目录下,运行 npm install 命令,安装 App 运行依赖库;
npm install
cd app && npm install && cd ..
./ 目录下,运行 npm run dll 命令,构建公共文件(仅在第一次构建或公共库发生改变时执行);./ 目录下,运行 npm run build 命令,构建所需文件;在 ./ 目录下,运行 npm start 命令,即可运行程序。
# create dll file
npm run dll
# build
npm run build
# start
npm start
# or start in developer mode
npm run dev
建议使用 electron-packager 进行打包
# install electron-packager for use from cli
npm install electron-packager -g
在 ./ 目录下,运行 npm run pack 命令,打包后的文件位于 ./dist 目录;
首次执行此命令可能需要花费较多时间(需要下载对应的构建文件),也可先手动下载对应的发布版本(淘宝镜像),手动保存到 ~/.electron 目录下。更多信息请参考 Electron 文档。
# pack
npm run pack # the packed files will be in ./dist
# 也可以只打包特定平台的版本,如
npm run pack-mac # pack for macOS, the packed files will be in ./dist
npm run pack-win # pack for Windows, the packed files will be in ./dist
打包完成后,可运行以下命令将生成的程序压缩为 zip 文件。
# zip
npm run zip # the zipped files will be in ./dist
go*le matches google)及正则支持(eg. /go.*le matches google)。本程序完全免费,并基于 MIT 协议开源。