1
Fork 0

Change directory structure and merge all configurations

This commit is contained in:
Korbs 2023-08-30 03:11:27 -04:00
parent 983e317358
commit 0c89b22e92
No known key found for this signature in database
23 changed files with 195 additions and 156 deletions

View file

@ -1,12 +1,10 @@
{
"extends": "./tsconfig.json",
"include": [
"../../electron/main/index.ts",
"../../electron/windows/primary.ts"
"../../app/electron/main/index.ts",
"../../app/electron/main/window.ts"
],
"exclude": [
"../../.build",
"../../astro",
"../../configuration",
"../../app/astro",
]
}

View file

@ -1,7 +1,5 @@
import { Configuration } from 'electron-builder'
import {meta} from '../configuration/app'
import {splash} from '../configuration/theme'
import {update, macos, linux, windows} from '../configuration/electron-builder'
import {info, splash, update, macos, linux, windows} from '../configuration'
///////////////////////////////////////////////////////////////
// Please configure the "configuration/app.ts" file instead. //
@ -9,8 +7,8 @@ import {update, macos, linux, windows} from '../configuration/electron-builder'
const config: Configuration = {
directories: {output: ".build/output/distribution/${platform}/${arch}"},
productName: meta.name,
appId: meta.id,
productName: info.name,
appId: info.id,
// Auto Update
publish: {
@ -43,16 +41,16 @@ const config: Configuration = {
},
appx: {
backgroundColor: splash.backgroundColor,
applicationId: meta.id,
applicationId: info.id,
identityName: windows.identityName,
publisher: windows.publisher,
publisherDisplayName: meta.company
publisherDisplayName: info.company
},
nsis: {
installerSidebar: ".build/assets/backgrounds/NSIS-Sidebar.bmp",
uninstallDisplayName: meta.name + ' - Uninstall.exe',
artifactName: meta.name + ' - Install.exe',
shortcutName: meta.name,
uninstallDisplayName: info.name + ' - Uninstall.exe',
artifactName: info.name + ' - Install.exe',
shortcutName: info.name,
allowElevation: windows.requireAdmin,
oneClick: windows.silent,
allowToChangeInstallationDirectory: windows.allowToChangeInstallationDirectory,
@ -65,9 +63,9 @@ const config: Configuration = {
linux: {
icon: ".build/assets/icons/linux/icon.png",
category: linux.category,
maintainer: meta.id,
vendor: meta.company,
description: meta.description,
maintainer: info.id,
vendor: info.company,
description: info.description,
target: [
{ target: 'AppImage', arch: 'x64' }, // Universal - x86_64
{ target: 'AppImage', arch: 'arm64' }, // Universal - arm64
@ -83,7 +81,7 @@ const config: Configuration = {
]
},
snap: {
title: meta.name,
title: info.name,
allowNativeWayland: true,
confinement: "strict"
}

View file

@ -3,8 +3,8 @@ import { defineConfig } from 'astro/config'
export default defineConfig({
compressHTML: true,
publicDir: "./src/public",
outDir: "../.build/output/astro",
cacheDir: "../build/output/astro-cache/",
outDir: "../../.build/output/astro",
cacheDir: "../../build/output/astro-cache/",
server: {
host: false,
port: 2023

View file

Before

Width:  |  Height:  |  Size: 749 B

After

Width:  |  Height:  |  Size: 749 B

View file

@ -3,4 +3,5 @@ import App from '../structure/app.astro'
---
<App>
<p>Hello</p>
</App>

View file

@ -0,0 +1,13 @@
---
import {info} from '../../../../configuration'
---
<html>
<head>
<meta charset="utf-8" />
<title>{info.name}</title>
</head>
<body>
<slot />
</body>
</html>

View file

@ -1,3 +1,3 @@
import {app, BrowserWindow} from "electron"
let mainWindow = require('../windows/primary')
let mainWindow = require('./window')
app.whenReady().then(() => {mainWindow.launch()})

View file

@ -0,0 +1,43 @@
import {BrowserWindow} from 'electron'
import {info, window, splash} from '../../../configuration'
if (process.env.NODE_ENV === "development") {var devTools = true}
else if (process.env.NODE_ENV === 'production') {var devTools =false}
let mainWindow : BrowserWindow
module.exports = {
launch: function() {
mainWindow = new BrowserWindow({
title: info.name,
width: window.width,
height: window.height,
minWidth: window.minWidth,
minHeight: window.minHeight,
show: false,
autoHideMenuBar: true,
transparent: true,
// frame: false,
// titleBarStyle: 'hiddenInset',
vibrancy: 'sidebar', // Window blur effect on macOS
backgroundMaterial: 'auto', // Window blur effect on Windows. Note: This method is only supported on Windows 11 22H2 and up.
trafficLightPosition: { x: 25, y: 28 }, // Position of Traffic Light buttons on macOS
titleBarOverlay: { // Background and Height of Windows titlebar buttons
color: splash.backgroundColor, // Background
symbolColor: 'white', // Icon
height: 44,
},
webPreferences: {
webviewTag: true,
nodeIntegration: false,
contextIsolation: true,
devTools: devTools
}
})
// Load Content
if (process.env.NODE_ENV === "development") {mainWindow.loadURL('http://localhost:2023')}
else if (process.env.NODE_ENV === 'production') {mainWindow.loadFile('.build/output/astro/index.html')}
// Showing the window gracefuly
// Doc: https://www.electronjs.org/docs/latest/api/browser-window#showing-the-window-gracefully
mainWindow.once('ready-to-show', () => {mainWindow.show()})
}
}

View file

@ -1,9 +0,0 @@
<html>
<head>
<meta charset="utf-8" />
<title>DESKTOP_APP_NAME</title>
</head>
<body>
<slot />
</body>
</html>

117
configuration.ts Normal file
View file

@ -0,0 +1,117 @@
///////////////////////
// Metadata //
///////////////////////
export const info = {
name: 'App ',
company: 'Company Name',
description: '',
id: 'org.company-name.app-name-here', // extension.domain.appname
// Sources
website: "https://mywebsite.net/",
support: "https://mywebsite.net/help/",
source_code: "https://github.com/user/repo"
}
////////////////////////////////
// App Configuration //
////////////////////////////////
export const config = {
// Notifications
notificationType: "Native", // "Custom" "Native"
// Pushy Notifications
pushyAppId: "63e9212d7446e48a2a0e8ec0",
// Crash Reporter
crashReportServer: "https://nexuspolestar.bugsplat.com/post/electron/crash.php"
}
export const window = {
width: 1200,
height: 800,
minWidth: 400,
minHeight: 400,
}
////////////////////
// Theme //
////////////////////
export const sidebar = {
headerFontSize: "14px",
tabFontSize: "16px",
tabHeight: "24px",
tabPositions: "Normal", // "Normal" "Centered"
size: "Normal", // "Normal" "Compact"
enableToggle: false,
enableSearch: false,
}
export const splash = {
loadingIndicator: "Spinner", // "Spinner" "ProgressBar" "JumpingBalls" "GlowingBars"
backgroundColor: "#232323",
}
//////////////////////
// Sidebar //
//////////////////////
export const SIDEBARTOP = [
{
text: "Dashboard",
icon: "wand-magic-sparkles",
default: true
},
{
text: "Files",
icon: "folder-tree"
},
{
text: "Webview Demo",
icon: "globe"
},
{
text: "Webview Demo 2",
icon: "globe"
},
{
text: "iFrame Demo",
icon: "eye"
},
]
export const SIDEBARBOTTOM = [
{
text: "Settings",
icon: "sliders"
}
]
///////////////////////////////
// Electron Builder //
///////////////////////////////
export const update = {
channel: "latest", // Branch: "latest" "beta" "alpha"
url: '' // Point to url where build files will be stored on your server.
}
export const macos = {
category: 'public.app-category.utilities' // https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/LaunchServicesKeys.html#//apple_ref/doc/uid/TP40009250-SW8
}
export const linux = {
category: 'Utilities', // https://specifications.freedesktop.org/menu-spec/menu-spec-1.0.html/category-registry
}
export const windows = {
// NSIS (.exe setup)
requireAdmin: false, // If you app needs to run admin tasks, which is shouldn't need to, set this to "true"
silent: false, // Ignore NSIS options below if "true"
allowToChangeInstallationDirectory: true, // Allow users to install your app anywhere
displayLanguageSelector: true,
createDesktopShortcut: false,
deleteAppDataOnUninstall: true,
// Microsoft Store
identityName: '00000Company.AppName',
publisher: 'CN=000A00A0-A00A-0A00-AAA0-0AAA00A000AA'
}

View file

@ -1,28 +0,0 @@
///////////////////////
// Metadata //
///////////////////////
export const meta = {
name: 'App Name Here',
company: 'Company Name',
description: '',
id: 'org.company-name.app-name-here', // extension.domain.appname
// Sources
website: "https://mywebsite.net/",
support: "https://mywebsite.net/help/",
source_code: "https://github.com/user/repo"
}
////////////////////////////////
// App Configuration //
////////////////////////////////
export const config = {
// Notifications
notificationType: "Native", // "Custom" "Native"
// Pushy Notifications
pushyAppId: "63e9212d7446e48a2a0e8ec0",
// Crash Reporter
crashReportServer: "https://nexuspolestar.bugsplat.com/post/electron/crash.php"
}

View file

@ -1,26 +0,0 @@
export const update = {
channel: "latest", // Branch: "latest" "beta" "alpha"
url: '' // Point to url where build files will be stored on your server.
}
export const macos = {
category: 'public.app-category.utilities' // https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/LaunchServicesKeys.html#//apple_ref/doc/uid/TP40009250-SW8
}
export const linux = {
category: 'Utilities', // https://specifications.freedesktop.org/menu-spec/menu-spec-1.0.html/category-registry
}
export const windows = {
// NSIS (.exe setup)
requireAdmin: false, // If you app needs to run admin tasks, which is shouldn't need to, set this to "true"
silent: false, // Ignore NSIS options below if "true"
allowToChangeInstallationDirectory: true, // Allow users to install your app anywhere
displayLanguageSelector: true,
createDesktopShortcut: false,
deleteAppDataOnUninstall: true,
// Microsoft Store
identityName: '00000Company.AppName',
publisher: 'CN=000A00A0-A00A-0A00-AAA0-0AAA00A000AA'
}

View file

@ -1,30 +0,0 @@
export const SIDEBARTOP = [
{
text: "Dashboard",
icon: "wand-magic-sparkles",
default: true
},
{
text: "Files",
icon: "folder-tree"
},
{
text: "Webview Demo",
icon: "globe"
},
{
text: "Webview Demo 2",
icon: "globe"
},
{
text: "iFrame Demo",
icon: "eye"
},
]
export const SIDEBARBOTTOM = [
{
text: "Settings",
icon: "sliders"
}
]

View file

@ -1,14 +0,0 @@
export const sidebar = {
headerFontSize: "14px",
tabFontSize: "16px",
tabHeight: "24px",
tabPositions: "normal", // "normal" "centered"
size: "normal", // "normal" "compact"
enableToggle: false,
enableSearch: false,
}
export const splash = {
loadingIndicator: "Spinner", // "Spinner" "ProgressBar" "JumpingBalls" "GlowingBars"
backgroundColor: "#232323",
}

View file

@ -1,24 +0,0 @@
import {BrowserWindow} from "electron"
import {meta} from '../../configuration/app'
let mainWindow : BrowserWindow
module.exports = {
launch: function() {
mainWindow = new BrowserWindow({
title: meta.name,
width: 500,
height: 500,
webPreferences: {
webviewTag: true,
nodeIntegration: false,
contextIsolation: true
}
})
// Load Content
if (process.env.NODE_ENV === "development") {
mainWindow.loadURL('http://localhost:2023')
} else if (process.env.NODE_ENV === 'production') {
mainWindow.loadFile('.build/output/astro/index.html')
}
}
}

View file

@ -2,13 +2,13 @@
"name": "nexus-polestar",
"version": "0.0.1",
"license": "AGPL-3.0-or-later",
"main": ".build/output/electron/electron/main/index.js",
"main": ".build/output/electron/app/electron/main/index.js",
"scripts": {
"start": "concurrently \"npm run tsc\" \"npm run astro:start\" \"wait-on http://localhost:2023 && npm run electron:start\"",
"build": "npm run tsc && npm run astro:build && npm run electron:build",
"tsc": "tsc -p .build/devlopment/tsconfig-build.json",
"astro:start": "astro dev --silent --root ./astro/",
"astro:build": "astro build --silent --root ./astro/",
"astro:start": "astro dev --silent --root ./app/astro/",
"astro:build": "astro build --silent --root ./app/astro/",
"electron:start": "NODE_ENV=development electron .",
"electron:build": "electron-builder --config ./.build/electron-builder.ts"
},