git clone git@github.com:FrontDream/cloud-doc.git

cd cloud-doc

npm install (切記在可以科學(xué)上網(wǎng)的" />

国产成人精品无码青草_亚洲国产美女精品久久久久∴_欧美人与鲁交大毛片免费_国产果冻豆传媒麻婆精东

15158846557 在線咨詢 在線咨詢
15158846557 在線咨詢
所在位置: 首頁(yè) > 營(yíng)銷資訊 > 網(wǎng)站運(yùn)營(yíng) > Electron+React+七牛云開發(fā)跨平臺(tái)云文檔

Electron+React+七牛云開發(fā)跨平臺(tái)云文檔

時(shí)間:2023-05-31 19:18:02 | 來(lái)源:網(wǎng)站運(yùn)營(yíng)

時(shí)間:2023-05-31 19:18:02 來(lái)源:網(wǎng)站運(yùn)營(yíng)

Electron+React+七牛云開發(fā)跨平臺(tái)云文檔:

前言

采用了Electron+React+七牛云搭建的在線Markdown云文檔。

git clone git@github.com:FrontDream/cloud-doc.git

cd cloud-doc

npm install (切記在可以科學(xué)上網(wǎng)的情況下安裝,國(guó)內(nèi)即使用淘寶鏡像,雖然能運(yùn)行起來(lái),打包也會(huì)失敗)

npm run dev (運(yùn)行)

npm run dist (打包)

npm run release (發(fā)布)
注意

以下是從0到1的搭建過(guò)程,當(dāng)然,其中省略了中間的業(yè)務(wù)

搭建electron+React開發(fā)環(huán)境

"main": "main.js",const { app ,BrowserWindow } = require('electron')const isDev = require('electron-is-dev')let mainWindow;app.on('ready',()=>{ mainWindow = new BrowserWindow({ width: 1024, height: 680, webPreferences: { nodeIntegration: true } }) const urlLocation = isDev?'http://localhost:3000': 'ddd' mainWindow.loadURL(urlLocation)})"scripts": { "start": "react-scripts start", "build": "react-scripts build", "test": "react-scripts test", "eject": "react-scripts eject", "ele": "electron .", "dev": "concurrently /"npm start/" /"npm run ele/"" }"scripts": { "start": "react-scripts start", "build": "react-scripts build", "test": "react-scripts test", "eject": "react-scripts eject", "ele": "electron .", "dev": "concurrently /"npm start/" /"wait-on http://localhost:3000 && electron ./"" }, "scripts": { "start": "react-scripts start", "build": "react-scripts build", "test": "react-scripts test", "eject": "react-scripts eject", "ele": "electron .", "dev": "concurrently /"cross-env BROWSER=none npm start/" /"wait-on http://localhost:3000 && electron ./"" },

打包過(guò)程

"author": { "name": "qiandingwei", "email": "1370336125@qq.com"},"build": { "appId": "cloudDoc", "productName": "七牛云文檔", "copyright": "Copyright ? 2020 ${author}" },"pack": "electron-builder --dir","prepack": "npm run build","dist": "electron-builder"

配置安裝包

"directories": { "buildResources": "assets" },"mac": { "category": "public.app-category.productivity", "artifactName": "${productName}-${version}-${arch}.${ext}" }, "dmg": { "background": "assets/appdmg.png", "icon": "assets/icon.icns", "iconSize": 100, "contents": [ { "x": 380, "y": 280, "type": "link", "path": "/Applications" }, { "x": 110, "y": 280, "type": "file" } ], "window": { "width": 500, "height": 500 } }, "win": { "target": [ "msi", "nsis" ], "icon": "assets/icon.ico", "artifactName": "${productName}-Web-Setup-${version}.${ext}", "publisherName": "Viking Zhang" }, "nsis": { "allowToChangeInstallationDirectory": true, "oneClick": false, "perMachine": false }

壓縮優(yōu)化體積

如何release

"publish": ["github"]"release": "cross-env GH_TOKEN=you_access_key electron-builder", "prerelease": "npm run build && npm run buildMain"

版本自動(dòng)更新

const { autoUpdater} = require('electron-updater')autoUpdater.autoDownload = false autoUpdater.checkForUpdatesAndNotify() autoUpdater.on('error',(error)=>{ dialog.showErrorBox('Error',error===null?"un-known":error) }) autoUpdater.on('update-available',()=>{ dialog.showMessageBox({ type: 'info', title: '應(yīng)用有新的版本', message: '發(fā)現(xiàn)新應(yīng)用,是否現(xiàn)在更新?', buttons: ['是','否'], },(buttonIndex)=>{ if(buttonIndex===0){ autoUpdater.downloadUpdate() } }) }) autoUpdater.on('update-not-available',()=>{ dialog.showMessageBox({ type: 'info', title: '沒(méi)有新的版本', message: '當(dāng)前已經(jīng)是最新版本', }) })?? 愛(ài)心三連擊
1.看到這里了就點(diǎn)個(gè)在看支持下吧,你的「在看」是我創(chuàng)作的動(dòng)力。
2.關(guān)注公眾號(hào)前端夢(mèng)想家,「一起學(xué)前端」!
3.添加微信【qdw1370336125】,拉你進(jìn)技術(shù)交流群一起學(xué)習(xí)。

關(guān)鍵詞:平臺(tái)

74
73
25
news

版權(quán)所有? 億企邦 1997-2025 保留一切法律許可權(quán)利。

為了最佳展示效果,本站不支持IE9及以下版本的瀏覽器,建議您使用谷歌Chrome瀏覽器。 點(diǎn)擊下載Chrome瀏覽器
關(guān)閉