mirror of
https://github.com/sern-handler/gui
synced 2026-06-06 01:16:54 +00:00
feat: change to swc to compile electron app
This commit is contained in:
@@ -6,7 +6,6 @@ jobs:
|
||||
steps:
|
||||
- checkout
|
||||
- run: yarn
|
||||
- run: yarn electron-ci
|
||||
- run: yarn build-electron-win
|
||||
build_linux:
|
||||
docker:
|
||||
@@ -14,7 +13,6 @@ jobs:
|
||||
steps:
|
||||
- checkout
|
||||
- run: yarn
|
||||
- run: yarn electron-ci
|
||||
- run: yarn build-electron-linux
|
||||
|
||||
workflows:
|
||||
|
||||
19
.swcrc
Normal file
19
.swcrc
Normal file
@@ -0,0 +1,19 @@
|
||||
{
|
||||
"$schema": "https://json.schemastore.org/swcrc",
|
||||
"jsc": {
|
||||
"parser": {
|
||||
"syntax": "typescript",
|
||||
"dynamicImport": false,
|
||||
"decorators": false,
|
||||
"importAssertions": true
|
||||
},
|
||||
"target": "esnext",
|
||||
"loose": false,
|
||||
"externalHelpers": false,
|
||||
// Requires v1.2.50 or upper and requires target to be es2016 or upper.
|
||||
"keepClassNames": false
|
||||
},
|
||||
"module": {
|
||||
"type": "commonjs"
|
||||
}
|
||||
}
|
||||
13
README.md
13
README.md
@@ -1,22 +1,21 @@
|
||||
# init-gui
|
||||
sern init but gui
|
||||
# gui
|
||||
yet another way to manage your sern projects!
|
||||
|
||||
[](https://gitpod.io/#https://github.com/sern-handler/gui)
|
||||
|
||||
|
||||
|
||||
# why do u use electron!?!?! switch to tauri!! im mad uwu (;⌣̀_⌣́)
|
||||
|
||||
[answer](https://memz.willysuna.dev/stfu.mp4)
|
||||
|
||||
# where's the electron code?
|
||||
|
||||
public/electron.js
|
||||
electron/index.ts
|
||||
|
||||
# how do I build the app?
|
||||
|
||||
`yarn build-electron` ([tested on linux](https://gist.github.com/SrIzan10/50bc2ba689a4cc43bcbac2799cc733c9). `wine` must be installed to build windows packages)
|
||||
`yarn build-electron-windows` (not tested but should work. use this if on windows. only builds windows packages)
|
||||
`yarn build-electron` ([tested on linux](https://gist.github.com/SrIzan10/50bc2ba689a4cc43bcbac2799cc733c9). `wine` must be installed to build windows packages)
|
||||
`yarn build-electron-windows` (not tested but should work. use this if on windows. only builds windows packages)
|
||||
`yarn build-electron-mac`
|
||||
|
||||
# CI builds?
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import * as path from 'node:path'
|
||||
import path from 'node:path'
|
||||
import { app, BrowserWindow, dialog, ipcMain } from 'electron';
|
||||
import * as isDev from 'electron-is-dev';
|
||||
import * as colorette from 'colorette';
|
||||
import isDev from 'electron-is-dev';
|
||||
import colorette from 'colorette';
|
||||
import { exec } from 'node:child_process';
|
||||
|
||||
function createWindow() {
|
||||
@@ -47,9 +47,9 @@ function createWindow() {
|
||||
|
||||
ipcMain.on('submitForm', async (event, data) => {
|
||||
// Process the submitted data here
|
||||
console.log(`${colorette.green('✓')} Received sern init submit form data:`)
|
||||
console.log(data);
|
||||
console.log(`${colorette.cyan('🛈')} Current OS: ${currentOS}`)
|
||||
console.log(`${colorette.green('✓')} Received sern init submit form data:`);
|
||||
console.log(data)
|
||||
console.log(`${colorette.cyan('🛈')} Current OS: ${currentOS}`);
|
||||
|
||||
let packageManagerCommand: string
|
||||
switch (data.chosenPackageManager) {
|
||||
@@ -66,7 +66,7 @@ function createWindow() {
|
||||
packageManagerCommand = `npm create @sern/bot@latest -- --template=${data.chosenTemplate} --name="${data.projectName}"`
|
||||
break;
|
||||
}
|
||||
let commandToRun: string
|
||||
let commandToRun: string;
|
||||
switch (currentOS) {
|
||||
case 'linux':
|
||||
commandToRun = `cd ${data.selectedPath};${packageManagerCommand}`
|
||||
@@ -83,15 +83,15 @@ function createWindow() {
|
||||
break;
|
||||
}
|
||||
|
||||
console.log(`${colorette.cyan('🛈')} About to execute command: ${commandToRun}`)
|
||||
console.log(`${colorette.cyan('🛈')} About to execute command: ${commandToRun}`);
|
||||
const cmd = exec(commandToRun)
|
||||
|
||||
cmd.stdout!.on('data', (data) => {
|
||||
console.log(`${colorette.cyan('🛈')} Command stdout: ${data}`);
|
||||
console.log(`${colorette.cyan('🛈')} ${data}`);
|
||||
});
|
||||
|
||||
cmd.stderr!.on('data', (data) => {
|
||||
console.error(`${colorette.red('×')} Command stderr: ${data}`);
|
||||
console.error(`${colorette.red('×')} stderr: ${data}`);
|
||||
});
|
||||
|
||||
cmd.on('close', (code) => {
|
||||
|
||||
@@ -1,26 +0,0 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"target": "ES2020",
|
||||
"useDefineForClassFields": true,
|
||||
"lib": ["ES2020", "DOM", "DOM.Iterable"],
|
||||
"module": "ESNext",
|
||||
"skipLibCheck": true,
|
||||
"outDir": "./dist",
|
||||
|
||||
/* Bundler mode */
|
||||
"moduleResolution": "node",
|
||||
"allowImportingTsExtensions": true,
|
||||
"resolveJsonModule": true,
|
||||
"isolatedModules": true,
|
||||
"noEmit": true,
|
||||
"allowSyntheticDefaultImports": true,
|
||||
"esModuleInterop": true,
|
||||
|
||||
/* Linting */
|
||||
"strict": true,
|
||||
"noUnusedLocals": true,
|
||||
"noUnusedParameters": true,
|
||||
"noFallthroughCasesInSwitch": true
|
||||
},
|
||||
}
|
||||
|
||||
21
package.json
21
package.json
@@ -6,16 +6,15 @@
|
||||
"homepage": "./",
|
||||
"scripts": {
|
||||
"start": "vite",
|
||||
"dev": "concurrently -k \"yarn:start\" \"yarn:electron\"",
|
||||
"build": "tsc && vite build",
|
||||
"lint": "eslint src --ext ts,tsx --report-unused-disable-directives --max-warnings 0",
|
||||
"preview": "vite preview",
|
||||
"electron": "tsc-watch ./electron/index.ts --outDir \"./dist\" --onSuccess \"electron .\"",
|
||||
"electron-ci": "tsc --outDir \"./dist\" ./electron/index.ts",
|
||||
"build-electron": "yarn build && electron-builder --linux --windows",
|
||||
"build-electron-linux": "yarn build && electron-builder --linux",
|
||||
"build-electron-win": "yarn build && electron-builder --windows",
|
||||
"build-electron-mac": "yarn build && electron-builder --mac"
|
||||
"electron": "nodemon --watch electron/ --exec \"swc ./electron/index.ts -d ./dist && npx electron .\" electron/index.ts",
|
||||
"electron-build": "swc ./electron/index.ts -d ./dist",
|
||||
"build-electron": "yarn build && yarn electron-build && electron-builder --linux --windows",
|
||||
"build-electron-linux": "yarn build && yarn electron-build && electron-builder --linux",
|
||||
"build-electron-win": "yarn build && yarn electron-build && electron-builder --windows",
|
||||
"build-electron-mac": "yarn build && yarn electron-build && electron-builder --mac"
|
||||
},
|
||||
"dependencies": {
|
||||
"@emotion/react": "^11.11.1",
|
||||
@@ -32,21 +31,21 @@
|
||||
"react-dom": "^18.2.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@swc/cli": "^0.1.62",
|
||||
"@swc/core": "^1.3.70",
|
||||
"@types/react": "^18.2.14",
|
||||
"@types/react-dom": "^18.2.6",
|
||||
"@typescript-eslint/eslint-plugin": "^5.61.0",
|
||||
"@typescript-eslint/parser": "^5.61.0",
|
||||
"@vitejs/plugin-react-swc": "^3.3.2",
|
||||
"concurrently": "^8.2.0",
|
||||
"electron": "^25.2.0",
|
||||
"electron-builder": "^24.4.0",
|
||||
"eslint": "^8.44.0",
|
||||
"eslint-plugin-react-hooks": "^4.6.0",
|
||||
"eslint-plugin-react-refresh": "^0.4.1",
|
||||
"tsc-watch": "^6.0.4",
|
||||
"nodemon": "^3.0.1",
|
||||
"typescript": "^5.0.2",
|
||||
"vite": "^4.4.0",
|
||||
"wait-on": "^7.0.1"
|
||||
"vite": "^4.4.0"
|
||||
},
|
||||
"build": {
|
||||
"extends": null,
|
||||
|
||||
Reference in New Issue
Block a user