3 Star 4 Fork 0

sitdown.liu / nest-electron-dev

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
贡献代码
同步代码
取消
提示: 由于 Git 不支持空文件夾,创建文件夹后会生成空的 .keep 文件
Loading...
README
MIT

NE框架: NestJS + Electron & Esbuild

基于NestJS+Electron实现的桌面软件开发框架,让开发者能快速搭建一个使用Web技术开发桌面端应用软件的基础环境。

主进程是用esbuild构建的,主程序中集成了NestJS,并且基于NestJS集成了SQLite、LowDB等常用类库,让开发者可以像写NestJS后端一样编写自己的代码。

UI界面使用的Angular并集成了DevUI库,让开发者在编写UI界面时能使用与NestJS相同的语法,感觉这样的编码模式很酷。考虑到开发者的使用习惯,我也会延迟发布For Vue分支,同样集成DevUI库。

编译工具使用了更快速更轻量级的Vite,开发者可以使用“vite build”快速打包发布自己的应用程序。但遗憾的是目前@angular/cli还未支持Vite,使用For Angular分支需要先"ng"再"vite"。但你不用担心,只要ngc一旦支持vite,本框架也会第一时间同步更新。For Vue不会受到上述影响。

仓库地址

GitHub:https://github.com/SitdownLiu/nest-electron-dev

码云:https://gitee.com/sitdown-liu/nest-electron-dev

环境要求

nodejs v16.x
npm v8.x
node-gyp v9.x
typescript >= v4.5.x <= v4.8.x

快速开始

  • 直接克隆此仓库

    git clone https://gitee.com/sitdown-liu/nest-electron-dev.git
  • For Angular:

    # 安装依赖包
    yarn # npm install
    
    # 运行开发模式
    yarn dev:ng # npm run dev:ng
    yarn dev:ne # npm run dev:ne
    
    # 发布
    yarn build:ng # npm run build:ng
    yarn build:ne # npm run build:ne
  • For Vue

    # 安装依赖包
    yarn # npm install
    
    # 运行开发模式
    yarn dev # npm run dev
    
    # 发布
    yarn build # npm run build

使用PNPM请注意

pnpm一起使用,你需要调整你的.npmrc

node-linker=hoisted
public-hoist-pattern=*
shamefully-hoist=true

常见问题

  • SQLite3安装/编译失败

    使用electron开发桌面程序,sqlite编译最容易出错,你需要提前安装好Python2.7(下载地址)和vs2015(下载地址),然后执行以下操作:

    #安装Windows的相关环境
    npm install --global --production windows-build-tools
    
    #安装node-gyp
    npm install -g node-gyp
    
    #安装并构建兼容electron的sqlite
    npm install sqlite3 --build-from-source --runtime=electron --target=21.1.0 --dist-url=https://electronjs.org/headers

    如果安装失败也许是你所在的网段被墙了,你可以使用网络代理、国内镜像或cnpm。

    如果在.\node_moudles\sqlite3\lib\binding\下多了一个electron-v3.1-win32-x64文件夹,其下名为‘node_sqlite3.node’的文件就是electron所需要的sqlite文件,到这里就已经安装完成了。

    你也可以尝试手动构建支持electron的sqlite文件

    #在package.json中添加脚本
    "scripts": {
        "postinstall": "electron-builder install-app-deps",
        "rebuild": "electron-rebuild -f -w sqlite3"
     },
     
     #执行脚本
     npm run postinstall
     npm run rebuild

    在Windows平台上安装和编译SQLite3会碰到一些奇怪的程序异常,以上纯粹个人经验,你还可以在SQLite3 bindings for NodeJS寻找其他解决方案。

MIT License Copyright (c) 2020-2021 ArcherGu Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

简介

基于NestJS+Electron实现的桌面软件开发框架。UI界面使用Angular14/Vue3实现 展开 收起
TypeScript 等 4 种语言
MIT
取消

发行版

暂无发行版

贡献者

全部

近期动态

加载更多
不能加载更多了
TypeScript
1
https://gitee.com/sitdown-liu/nest-electron-dev.git
git@gitee.com:sitdown-liu/nest-electron-dev.git
sitdown-liu
nest-electron-dev
nest-electron-dev
For-Angular

搜索帮助