欢迎使用 Ghost Writer !
Ghost Writer 是一款参照 觅道(MrDoc) 开发的个人笔记、文档离线管理应用。
是一个纯前端项目,使用了sqlite本地数据库,除自行编辑使用到的外部图片、外部视频、外部链接等资源、以及OCR识别接口外,注册、登录、编辑等功能均不使用网络,数据存储在该应用本地的资源夹内,完全的保证了数据的隐私、私有。默认管理员账号 admin
密码 admin123..
在 node.js 中使用sql.js 已经托管在 npm ,你只需运行 npm install sql.js
就能安装。另外,你也可以选择下载 sql-wasm.js
和 sql-wasm.wasm
来实现功能
var fs = require('fs');
var initSqlJs = require('sql-wasm.js');
var filebuffer = fs.readFileSync('test.sqlite');
initSqlJs().then(function(SQL){
// Load the db
var db = new SQL.Database(filebuffer);
});
你需要将 db.export 的结果转换为 buffer
var fs = require("fs");
// [...] (create the database)
var data = db.export();
var buffer = new Buffer(data);
fs.writeFileSync("filename.sqlite", buffer);
npm install
cnpm install
electron-builder
进行打包的时候,会建议你在此之前使用electron-builder install-app-deps
的命令。该命令的作用就是针对即将打包的electron
程序对应的node版本进行原生模块的编译工作,以达到模块运行时匹配。实际上,install-app-deps内部依然使用了node-gyp
相关知识。
如果install环节出现报错,可以先把"postinstall": "electron-builder install-app-deps",
和"postuninstall": "electron-builder install-app-deps"
删除再执行。
cnpm install
/npm install
时,报错:RunScriptError: Run "C:\Windows\system32\cmd.exe /d /s /c node-gyp rebuild"
管理员权限运行powershell,安装cnpm install --global --production windows-build-tools
,配置环境变量path增加C:\Users\username\.windows-build-tools\python27
npm run dev
npm run electron:build
提示cannot find module fs/promises
时,按报错位置找到依赖文件,把require("fs/promises")
全部替换为require("fs").promises
再打包
# 第一步清理npm缓存:
npm cache clean -f
# 第二步运行npm安装工具
npm -g install n
# 第三步运行n stable(安装最新稳定版本)
n stable
# 第一步删除已安装的cnpm版本
npm uninstall -g cnpm
# 第二步安装低版本cnpm
npm install cnpm@7.1.0 -g --registry=https://registry.npm.taobao.org
Ctrl + F12
打开控制台