8000 GitHub - crixo/woa-electron-vite-app
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

crixo/woa-electron-vite-app

Repository files navigation

woa-electron-vite-app

An Electron application with React

Recommended IDE Setup

Quick setup

  • Clone master branch

  • npm install

  • When the locator DB screen starts, select an empty sample db loacated at data/woa-emtpy.db

Project Setup

Install

$ npm install

Development

$ npm run dev

Build

# For windows
$ npm run build:win

# For macOS
$ npm run build:mac

# For Linux
$ npm run build:linux

Scaffolding the project

npm create @quick-start/electron@latest
npm install tailwindcss @tailwindcss/vite

add tailwindcss plugin into electron.vite.config.mjs

...
import tailwindcss from '@tailwindcss/vite'
.....
    plugins: [
      react(),
      tailwindcss(),
    ]
...
npm install better-sqlite3
npm install --save-dev electron-rebuild

After the installation is completed, add this to your package.json

{   
    ...
    "scripts": {
        ...             
        "rebuild-sqlite3": "electron-rebuild -f -w better-sqlite3",
    }
}
  • Init Git Repo
git init
  • Add following dependencies
npm install electron-log
npm install --save-dev tailwindcss @tailwindcss/vite
npm install --save-dev react-router-dom
npm install --save-dev react-toastify

Project Run

First initialization from remote repo

git clone https://github.com/crixo/woa-electron-vite-app.git
npm install
npm run rebuild-sqlite3
npm run dev

Rebuild project for apecific arch

  • Dowload repo into a specific folder for the target platform e. mac amd
git clone https://github.com/crixo/woa-electron-vite-app.git woa-electron-vite-app-{platform}

-- Install dependedencies

npm install

-- Rebuild dependencies for the specific paltform (not needed - only for native module as next step)

npm rebuild --arch=x64 --platform=darwin

-- Rebuilds native modules for Electron.

npm run rebuild-sqlite3

-- Build the Electron App for x64 (AMD/Intel)

npm run build:mac-universal
  • Once built, you can check whether the binary arch by running:
file /path/to/app.app/Contents/MacOS/app-binary

or

lipo -info /path/to/app.app/Contents/MacOS/app-binary

Signing

  • find the name of signing certificate and electron-build log for identity value
security find-identity -v -p codesigning
  • Sign app manually after bundle
codesign --deep --force --verbose --sign - ./dist/mac-arm64/woa-electron-vite-app.app 
or a self-signed cert generated via keychain
codesign --deep --force --verbose --sign "CrixoDev" ./dist/mac-arm64/woa-electron-vite-app.app 
  • Verify signing
codesign --verify --verbose /path/to/app.app

Verify who signed

codesign -dv --verbose=4 /path/to/app.app

Fix unsigned app

If Gatekeeper will show warnings like “This app cannot be opened because it is from an unidentified developer.”, Users must manually approve the app

  • Open the app manually via Terminal
open /path/to/YourApp.app

This might still trigger Gatekeeper warnings, but it attempts to launch the app.

  • Try to remove the attribute if present
xattr /path/to/YourApp.app

get more detials about quarantine flag

xattr -p com.apple.quarantine /path/to/YourApp.app

remove the flag

xattr -d com.apple.quarantine /path/to/YourApp.app
    < 77FF li>Add the app to the Gatekeeper exception list
sudo spctl --add /path/to/YourApp.app

Then, check the status with:

spctl --status

If it's enabled, you can disable Gatekeeper temporarily:

sudo spctl --master-disable

(Not recommended for long-term security reasons!)

Create new Release

  • Create a build making sure "prebuild" is enabled to increase automatically the application version in package.json. Make sure your are signing the code with a valid certificate, also a self-signed, to allow auto-update procedure. Verify in the build logs the signing procedure succeded with the following message:
signing         file=dist/mac-arm64/WOA.app platform=darwin type=distribution identity=XXX provisioningProfile=none

For standard/local build for mac arch use

npm run build:mac
  • Create git Tag create an annotated (recommended for releases because it includes metadata). As convention matching the Build just created as per in package.json.version
git tag -a vX.X.X -m "Release version X.X.X"
  • Push the Tag to git
git push origin vX.X.X

AI

Note

Logbook

  • Use BrowserRouter works w/ Electron final package (win, mac, ..) BrowserRouter does not. BrowserRoute works only in dev mode.

  • verify the date format used by local app when a date is selected with html datepicker

  • dates from (old) DB are stored w/ time as 00:00:00. New app will save it w/o time. Time portion is handled in utils.formatDate while loading the date.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Packages

No packages published
0