Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix/vue3/build #1875

Merged
merged 9 commits into from
Feb 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 13 additions & 20 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,40 +6,33 @@ jobs:
build:
runs-on: ${{ matrix.os }}

strategy:
strategy:
matrix:
os: [
macos-latest,
ubuntu-latest,
macos-latest,
ubuntu-latest,
windows-latest
]

steps:
- name: Check out Git repository
uses: actions/checkout@v2
- name: Checkout
uses: actions/checkout@v4

- name: Install Node.js, NPM and Yarn
uses: actions/setup-node@v2
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: 20.11.0

- uses: actions/setup-python@v4
- name: Setup pnpm
uses: pnpm/action-setup@v3
with:
python-version: '2.7'
version: 8

- name: Build Electron app
- name: Build
shell: bash
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SIGN: false
run: |
yarn install --network-timeout 1000000
yarn electron:build --publish="never"

- name: Upload artifact
uses: actions/[email protected]
with:
# Artifact name
name: ${{ matrix.os }}-artifact
# Directory containing files to upload
path: dist_electron
pnpm install
pnpm build --publish="never"
15 changes: 10 additions & 5 deletions .github/workflows/lintAndTest.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,16 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4

- uses: actions/setup-node@v2.1.2
- uses: actions/setup-node@v4
with:
node-version: '20.11.0'
- run: yarn install --network-timeout 1000000
- run: yarn lint:check
- run: yarn test

- uses: pnpm/action-setup@v3
with:
version: 8

- run: pnpm install
- run: pnpm lint:check
- run: pnpm test
16 changes: 10 additions & 6 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,21 @@ jobs:
macos-latest,
ubuntu-latest,
windows-latest
]
]

steps:
- name: Check out Git repository
uses: actions/checkout@v2
uses: actions/checkout@v4

- name: Install Node.js, NPM and Yarn
uses: actions/setup-node@v2
uses: actions/setup-node@v4
with:
node-version: 20.11.0

- uses: pnpm/action-setup@v3
with:
version: 8

- name: Build & release Electron app
shell: bash
env:
Expand All @@ -39,12 +43,12 @@ jobs:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SIGN: true
run: |
yarn install --network-timeout 1000000
yarn electron:build --publish="always"
pnpm install
pnpm build
- name: Upload artifact
uses: actions/[email protected]
with:
# Artifact name
name: ${{ matrix.os }}-artifact
# Directory containing files to upload
path: dist_electron
path: release/**/*
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ witnet
/tests/e2e/screenshots/
sheikah-darwin-x64
/src/components.d.ts
/release

# local env files
.env
Expand Down
4 changes: 3 additions & 1 deletion auto-imports.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,6 @@
// noinspection JSUnusedGlobalSymbols
// Generated by unplugin-auto-import
export {}
declare global {}
declare global {

}
36 changes: 19 additions & 17 deletions electron/main/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,30 +2,28 @@
//
// ├─┬ dist-electron
// │ ├─┬ main
// │ │ └── index.js > Electron-Main
// │ │ └── index.ts > Electron-Main
// │ └─┬ preload
// │ └── index.js > Preload-Scripts
// │ └── index.ts > Preload-Scripts
// ├─┬ dist
// │ └── index.html > Electron-Renderer
//
import { fileURLToPath } from 'node:url'
import { dirname } from 'node:path'
import { join, dirname } from 'node:path'
import { release } from 'os'
import { app, BrowserWindow, shell, ipcMain, Menu } from 'electron'
import kill from 'tree-kill'
import { Status, STATUS_PATH } from '../constants'
import { WalletManager } from '../walletManager'

const __filename = fileURLToPath(import.meta.url)
const __dirname = dirname(__filename)
globalThis.__filename = fileURLToPath(import.meta.url)
globalThis.__dirname = dirname(__filename)
process.env.DIST_ELECTRON = join(__dirname, '..')
process.env.DIST = join(process.env.DIST_ELECTRON, '../dist')
process.env.PUBLIC = app.isPackaged
? process.env.DIST
: join(process.env.DIST_ELECTRON, '../public')

import { app, BrowserWindow, shell, ipcMain, Menu } from 'electron'
import { release } from 'os'
import { join } from 'path'
import { Status, STATUS_PATH } from '../constants'
import { WalletManager } from '../walletManager'
import kill from 'tree-kill'

// Disable GPU Acceleration for Windows 7
if (release().startsWith('6.1')) app.disableHardwareAcceleration()

Expand Down Expand Up @@ -72,7 +70,7 @@ async function createWindow() {

if (!process.env.VITE_DEV_SERVER_URL) {
// Hide electron toolbar in production environment
this.win.setMenuBarVisibility(false)
win.setMenuBarVisibility(false)
const menu = Menu.buildFromTemplate([
{
label: 'Menu',
Expand All @@ -81,7 +79,7 @@ async function createWindow() {
label: 'Quit',
accelerator: 'CmdOrCtrl+Q',
click: () => {
this.sendShutdownMessage()
sendShutdownMessage()
},
},
{ label: 'Reload', accelerator: 'CmdOrCtrl+R', click: () => {} },
Expand Down Expand Up @@ -246,10 +244,14 @@ function closeWindow() {
win.close()
}

win?.on('close', closeApp.bind(this))
win?.on('close', closeApp)

function closeApp(event: Event) {
event.preventDefault()
this.sendShutdownMessage()
// FIXME: no event is received
if (event) {
event.preventDefault()
}
sendShutdownMessage()
}

function setStatus(s: Status) {
Expand Down
82 changes: 41 additions & 41 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,73 +37,73 @@
"test:unit": "vitest"
},
"main": "dist-electron/main/index.js",
"dependencies": {
"bugs": {
"url": "https://github.com/witnet/sheikah/issues"
},
"license": "GPL-3.0",
"productName": "Sheikah-Witnet-wallet",
"repository": {
"type": "git",
"url": "git+https://github.com/witnet/sheikah.git"
},
"volta": {
"node": "20.9.0"
},
"devDependencies": {
"@fortawesome/fontawesome-svg-core": "^6.5.1",
"@fortawesome/free-solid-svg-icons": "^6.5.1",
"@fortawesome/vue-fontawesome": "^3.0.5",
"@fortawesome/vue-fontawesome": "^3.0.6",
"@intlify/unplugin-vue-i18n": "^2.0.0",
"@rushstack/eslint-patch": "^1.6.1",
"@typescript-eslint/parser": "^6.18.1",
"@vitejs/plugin-vue": "^5.0.3",
"@vueuse/core": "^10.7.2",
"@rushstack/eslint-patch": "^1.7.2",
"@types/node": "^20.11.17",
"@typescript-eslint/parser": "^7.0.1",
"@vitejs/plugin-vue": "^5.0.4",
"@vue/eslint-config-prettier": "^9.0.0",
"@vue/eslint-config-typescript": "^12.0.0",
"@vueuse/core": "^10.7.2",
"autoprefixer": "^10.4.16",
"axios": "^1.6.5",
"@vue/test-utils": "^2.4.4",
"autoprefixer": "^10.4.17",
"axios": "^1.6.7",
"big.js": "^6.2.1",
"cbor2": "^1.1.0",
"date-fns": "^3.2.0",
"electron": "^28.1.3",
"cbor2": "^1.2.2",
"date-fns": "^3.3.1",
"electron-builder": "^24.9.1",
"electron-devtools-installer": "^3.2.0",
"element-plus": "^2.5.1",
"eslint": "^8.56.0",
"electron": "^28.2.2",
"element-plus": "^2.5.5",
"eslint-import-resolver-alias": "1.1.2",
"eslint-plugin-import": "2.29.1",
"eslint-plugin-node": "11.1.0",
"eslint-plugin-vue": "9.20.0",
"eslint-plugin-vue": "9.21.1",
"eslint": "^8.56.0",
"fs-extra": "^11.2.0",
"lint-staged": "^15.2.0",
"postcss": "^8.4.33",
"prettier": "3.1.1",
"jsdom": "^24.0.0",
"lint-staged": "^15.2.2",
"postcss": "^8.4.35",
"prettier": "3.2.5",
"progress-stream": "^2.0.0",
"rpc-websockets": "^7.9.0",
"sass": "^1.69.7",
"semver": "^7.5.4",
"sass": "^1.70.0",
"semver": "^7.6.0",
"tar": "^6.2.0",
"tree-kill": "^1.2.2",
"typescript": "^5.3.3",
"unocss": "^0.58.3",
"unplugin-auto-import": "^0.17.3",
"unplugin-auto-import": "^0.17.5",
"unplugin-vue-components": "^0.26.0",
"uuid": "^9.0.1",
"vite": "^5.0.11",
"vite-plugin-electron": "^0.28.0-beta.2",
"vite-plugin-electron-renderer": "^0.14.5",
"vite-plugin-electron": "^0.28.2",
"vite-svg-loader": "^5.1.0",
"vue": "^3.4.10",
"vue-i18n": "^9.9.0",
"vite": "^5.1.1",
"vitest": "^1.2.2",
"vue-i18n": "^9.9.1",
"vue-json-tree": "^0.4.3",
"vue-observe-visibility": "^1.0.0",
"vue-router": "^4.2.5",
"vue-tsc": "^1.8.27",
"vue": "3.4.19",
"vuex": "^4.1.0",
"witnet-radon-js": "^0.11.0",
"witnet-requests": "^0.9.12",
"@vue/test-utils": "^2.4.3",
"jsdom": "^24.0.0",
"vitest": "^1.1.3"
},
"bugs": {
"url": "https://github.com/witnet/sheikah/issues"
},
"license": "GPL-3.0",
"productName": "Sheikah Witnet wallet",
"repository": {
"type": "git",
"url": "git+https://github.com/witnet/sheikah.git"
},
"volta": {
"node": "20.9.0"
"witnet-requests": "^0.9.12"
}
}
Loading