Skip to content

Commit a8e1c53

Browse files
committed
feat: Initialize Custos application with Wails framework
- Added main application entry point in main.go - Configured Wails options including asset server and application settings - Created frontend structure with React and Vite - Included Nunito font and universal logo assets - Set up TypeScript configuration for frontend development - Implemented event handling and logging functionalities in Wails runtime - Defined application menu and startup behavior - Added necessary Go modules and dependencies for Wails - Created wails.json for project configuration
0 parents  commit a8e1c53

36 files changed

Lines changed: 3037 additions & 0 deletions

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
build/bin
2+
node_modules
3+
frontend/dist

README.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# README
2+
3+
## About
4+
5+
This is the official Wails React-TS template.
6+
7+
You can configure the project by editing `wails.json`. More information about the project settings can be found
8+
here: https://wails.io/docs/reference/project-config
9+
10+
## Live Development
11+
12+
To run in live development mode, run `wails dev` in the project directory. This will run a Vite development
13+
server that will provide very fast hot reload of your frontend changes. If you want to develop in a browser
14+
and have access to your Go methods, there is also a dev server that runs on http://localhost:34115. Connect
15+
to this in your browser, and you can call your Go code from devtools.
16+
17+
## Building
18+
19+
To build a redistributable, production mode package, use `wails build`.

app.go

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
package main
2+
3+
import (
4+
"context"
5+
"fmt"
6+
)
7+
8+
// App struct
9+
type App struct {
10+
ctx context.Context
11+
}
12+
13+
// NewApp creates a new App application struct
14+
func NewApp() *App {
15+
return &App{}
16+
}
17+
18+
// startup is called when the app starts. The context is saved
19+
// so we can call the runtime methods
20+
func (a *App) startup(ctx context.Context) {
21+
a.ctx = ctx
22+
}
23+
24+
// Greet returns a greeting for the given name
25+
func (a *App) Greet(name string) string {
26+
return fmt.Sprintf("Hello %s, It's show time!", name)
27+
}

build/README.md

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
# Build Directory
2+
3+
The build directory is used to house all the build files and assets for your application.
4+
5+
The structure is:
6+
7+
* bin - Output directory
8+
* darwin - macOS specific files
9+
* windows - Windows specific files
10+
11+
## Mac
12+
13+
The `darwin` directory holds files specific to Mac builds.
14+
These may be customised and used as part of the build. To return these files to the default state, simply delete them
15+
and
16+
build with `wails build`.
17+
18+
The directory contains the following files:
19+
20+
- `Info.plist` - the main plist file used for Mac builds. It is used when building using `wails build`.
21+
- `Info.dev.plist` - same as the main plist file but used when building using `wails dev`.
22+
23+
## Windows
24+
25+
The `windows` directory contains the manifest and rc files used when building with `wails build`.
26+
These may be customised for your application. To return these files to the default state, simply delete them and
27+
build with `wails build`.
28+
29+
- `icon.ico` - The icon used for the application. This is used when building using `wails build`. If you wish to
30+
use a different icon, simply replace this file with your own. If it is missing, a new `icon.ico` file
31+
will be created using the `appicon.png` file in the build directory.
32+
- `installer/*` - The files used to create the Windows installer. These are used when building using `wails build`.
33+
- `info.json` - Application details used for Windows builds. The data here will be used by the Windows installer,
34+
as well as the application itself (right click the exe -> properties -> details)
35+
- `wails.exe.manifest` - The main application manifest file.

build/appicon.png

130 KB
Loading

build/darwin/Info.dev.plist

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
2+
<plist version="1.0">
3+
<dict>
4+
<key>CFBundlePackageType</key>
5+
<string>APPL</string>
6+
<key>CFBundleName</key>
7+
<string>{{.Info.ProductName}}</string>
8+
<key>CFBundleExecutable</key>
9+
<string>{{.OutputFilename}}</string>
10+
<key>CFBundleIdentifier</key>
11+
<string>com.wails.{{.Name}}</string>
12+
<key>CFBundleVersion</key>
13+
<string>{{.Info.ProductVersion}}</string>
14+
<key>CFBundleGetInfoString</key>
15+
<string>{{.Info.Comments}}</string>
16+
<key>CFBundleShortVersionString</key>
17+
<string>{{.Info.ProductVersion}}</string>
18+
<key>CFBundleIconFile</key>
19+
<string>iconfile</string>
20+
<key>LSMinimumSystemVersion</key>
21+
<string>10.13.0</string>
22+
<key>NSHighResolutionCapable</key>
23+
<string>true</string>
24+
<key>NSHumanReadableCopyright</key>
25+
<string>{{.Info.Copyright}}</string>
26+
{{if .Info.FileAssociations}}
27+
<key>CFBundleDocumentTypes</key>
28+
<array>
29+
{{range .Info.FileAssociations}}
30+
<dict>
31+
<key>CFBundleTypeExtensions</key>
32+
<array>
33+
<string>{{.Ext}}</string>
34+
</array>
35+
<key>CFBundleTypeName</key>
36+
<string>{{.Name}}</string>
37+
<key>CFBundleTypeRole</key>
38+
<string>{{.Role}}</string>
39+
<key>CFBundleTypeIconFile</key>
40+
<string>{{.IconName}}</string>
41+
</dict>
42+
{{end}}
43+
</array>
44+
{{end}}
45+
{{if .Info.Protocols}}
46+
<key>CFBundleURLTypes</key>
47+
<array>
48+
{{range .Info.Protocols}}
49+
<dict>
50+
<key>CFBundleURLName</key>
51+
<string>com.wails.{{.Scheme}}</string>
52+
<key>CFBundleURLSchemes</key>
53+
<array>
54+
<string>{{.Scheme}}</string>
55+
</array>
56+
<key>CFBundleTypeRole</key>
57+
<string>{{.Role}}</string>
58+
</dict>
59+
{{end}}
60+
</array>
61+
{{end}}
62+
<key>NSAppTransportSecurity</key>
63+
<dict>
64+
<key>NSAllowsLocalNetworking</key>
65+
<true/>
66+
</dict>
67+
</dict>
68+
</plist>

build/darwin/Info.plist

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
2+
<plist version="1.0">
3+
<dict>
4+
<key>CFBundlePackageType</key>
5+
<string>APPL</string>
6+
<key>CFBundleName</key>
7+
<string>{{.Info.ProductName}}</string>
8+
<key>CFBundleExecutable</key>
9+
<string>{{.OutputFilename}}</string>
10+
<key>CFBundleIdentifier</key>
11+
<string>com.wails.{{.Name}}</string>
12+
<key>CFBundleVersion</key>
13+
<string>{{.Info.ProductVersion}}</string>
14+
<key>CFBundleGetInfoString</key>
15+
<string>{{.Info.Comments}}</string>
16+
<key>CFBundleShortVersionString</key>
17+
<string>{{.Info.ProductVersion}}</string>
18+
<key>CFBundleIconFile</key>
19+
<string>iconfile</string>
20+
<key>LSMinimumSystemVersion</key>
21+
<string>10.13.0</string>
22+
<key>NSHighResolutionCapable</key>
23+
<string>true</string>
24+
<key>NSHumanReadableCopyright</key>
25+
<string>{{.Info.Copyright}}</string>
26+
{{if .Info.FileAssociations}}
27+
<key>CFBundleDocumentTypes</key>
28+
<array>
29+
{{range .Info.FileAssociations}}
30+
<dict>
31+
<key>CFBundleTypeExtensions</key>
32+
<array>
33+
<string>{{.Ext}}</string>
34+
</array>
35+
<key>CFBundleTypeName</key>
36+
<string>{{.Name}}</string>
37+
<key>CFBundleTypeRole</key>
38+
<string>{{.Role}}</string>
39+
<key>CFBundleTypeIconFile</key>
40+
<string>{{.IconName}}</string>
41+
</dict>
42+
{{end}}
43+
</array>
44+
{{end}}
45+
{{if .Info.Protocols}}
46+
<key>CFBundleURLTypes</key>
47+
<array>
48+
{{range .Info.Protocols}}
49+
<dict>
50+
<key>CFBundleURLName</key>
51+
<string>com.wails.{{.Scheme}}</string>
52+
<key>CFBundleURLSchemes</key>
53+
<array>
54+
<string>{{.Scheme}}</string>
55+
</array>
56+
<key>CFBundleTypeRole</key>
57+
<string>{{.Role}}</string>
58+
</dict>
59+
{{end}}
60+
</array>
61+
{{end}}
62+
</dict>
63+
</plist>

build/windows/icon.ico

20.5 KB
Binary file not shown.

build/windows/info.json

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{
2+
"fixed": {
3+
"file_version": "{{.Info.ProductVersion}}"
4+
},
5+
"info": {
6+
"0000": {
7+
"ProductVersion": "{{.Info.ProductVersion}}",
8+
"CompanyName": "{{.Info.CompanyName}}",
9+
"FileDescription": "{{.Info.ProductName}}",
10+
"LegalCopyright": "{{.Info.Copyright}}",
11+
"ProductName": "{{.Info.ProductName}}",
12+
"Comments": "{{.Info.Comments}}"
13+
}
14+
}
15+
}
Lines changed: 114 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,114 @@
1+
Unicode true
2+
3+
####
4+
## Please note: Template replacements don't work in this file. They are provided with default defines like
5+
## mentioned underneath.
6+
## If the keyword is not defined, "wails_tools.nsh" will populate them with the values from ProjectInfo.
7+
## If they are defined here, "wails_tools.nsh" will not touch them. This allows to use this project.nsi manually
8+
## from outside of Wails for debugging and development of the installer.
9+
##
10+
## For development first make a wails nsis build to populate the "wails_tools.nsh":
11+
## > wails build --target windows/amd64 --nsis
12+
## Then you can call makensis on this file with specifying the path to your binary:
13+
## For a AMD64 only installer:
14+
## > makensis -DARG_WAILS_AMD64_BINARY=..\..\bin\app.exe
15+
## For a ARM64 only installer:
16+
## > makensis -DARG_WAILS_ARM64_BINARY=..\..\bin\app.exe
17+
## For a installer with both architectures:
18+
## > makensis -DARG_WAILS_AMD64_BINARY=..\..\bin\app-amd64.exe -DARG_WAILS_ARM64_BINARY=..\..\bin\app-arm64.exe
19+
####
20+
## The following information is taken from the ProjectInfo file, but they can be overwritten here.
21+
####
22+
## !define INFO_PROJECTNAME "MyProject" # Default "{{.Name}}"
23+
## !define INFO_COMPANYNAME "MyCompany" # Default "{{.Info.CompanyName}}"
24+
## !define INFO_PRODUCTNAME "MyProduct" # Default "{{.Info.ProductName}}"
25+
## !define INFO_PRODUCTVERSION "1.0.0" # Default "{{.Info.ProductVersion}}"
26+
## !define INFO_COPYRIGHT "Copyright" # Default "{{.Info.Copyright}}"
27+
###
28+
## !define PRODUCT_EXECUTABLE "Application.exe" # Default "${INFO_PROJECTNAME}.exe"
29+
## !define UNINST_KEY_NAME "UninstKeyInRegistry" # Default "${INFO_COMPANYNAME}${INFO_PRODUCTNAME}"
30+
####
31+
## !define REQUEST_EXECUTION_LEVEL "admin" # Default "admin" see also https://nsis.sourceforge.io/Docs/Chapter4.html
32+
####
33+
## Include the wails tools
34+
####
35+
!include "wails_tools.nsh"
36+
37+
# The version information for this two must consist of 4 parts
38+
VIProductVersion "${INFO_PRODUCTVERSION}.0"
39+
VIFileVersion "${INFO_PRODUCTVERSION}.0"
40+
41+
VIAddVersionKey "CompanyName" "${INFO_COMPANYNAME}"
42+
VIAddVersionKey "FileDescription" "${INFO_PRODUCTNAME} Installer"
43+
VIAddVersionKey "ProductVersion" "${INFO_PRODUCTVERSION}"
44+
VIAddVersionKey "FileVersion" "${INFO_PRODUCTVERSION}"
45+
VIAddVersionKey "LegalCopyright" "${INFO_COPYRIGHT}"
46+
VIAddVersionKey "ProductName" "${INFO_PRODUCTNAME}"
47+
48+
# Enable HiDPI support. https://nsis.sourceforge.io/Reference/ManifestDPIAware
49+
ManifestDPIAware true
50+
51+
!include "MUI.nsh"
52+
53+
!define MUI_ICON "..\icon.ico"
54+
!define MUI_UNICON "..\icon.ico"
55+
# !define MUI_WELCOMEFINISHPAGE_BITMAP "resources\leftimage.bmp" #Include this to add a bitmap on the left side of the Welcome Page. Must be a size of 164x314
56+
!define MUI_FINISHPAGE_NOAUTOCLOSE # Wait on the INSTFILES page so the user can take a look into the details of the installation steps
57+
!define MUI_ABORTWARNING # This will warn the user if they exit from the installer.
58+
59+
!insertmacro MUI_PAGE_WELCOME # Welcome to the installer page.
60+
# !insertmacro MUI_PAGE_LICENSE "resources\eula.txt" # Adds a EULA page to the installer
61+
!insertmacro MUI_PAGE_DIRECTORY # In which folder install page.
62+
!insertmacro MUI_PAGE_INSTFILES # Installing page.
63+
!insertmacro MUI_PAGE_FINISH # Finished installation page.
64+
65+
!insertmacro MUI_UNPAGE_INSTFILES # Uinstalling page
66+
67+
!insertmacro MUI_LANGUAGE "English" # Set the Language of the installer
68+
69+
## The following two statements can be used to sign the installer and the uninstaller. The path to the binaries are provided in %1
70+
#!uninstfinalize 'signtool --file "%1"'
71+
#!finalize 'signtool --file "%1"'
72+
73+
Name "${INFO_PRODUCTNAME}"
74+
OutFile "..\..\bin\${INFO_PROJECTNAME}-${ARCH}-installer.exe" # Name of the installer's file.
75+
InstallDir "$PROGRAMFILES64\${INFO_COMPANYNAME}\${INFO_PRODUCTNAME}" # Default installing folder ($PROGRAMFILES is Program Files folder).
76+
ShowInstDetails show # This will always show the installation details.
77+
78+
Function .onInit
79+
!insertmacro wails.checkArchitecture
80+
FunctionEnd
81+
82+
Section
83+
!insertmacro wails.setShellContext
84+
85+
!insertmacro wails.webview2runtime
86+
87+
SetOutPath $INSTDIR
88+
89+
!insertmacro wails.files
90+
91+
CreateShortcut "$SMPROGRAMS\${INFO_PRODUCTNAME}.lnk" "$INSTDIR\${PRODUCT_EXECUTABLE}"
92+
CreateShortCut "$DESKTOP\${INFO_PRODUCTNAME}.lnk" "$INSTDIR\${PRODUCT_EXECUTABLE}"
93+
94+
!insertmacro wails.associateFiles
95+
!insertmacro wails.associateCustomProtocols
96+
97+
!insertmacro wails.writeUninstaller
98+
SectionEnd
99+
100+
Section "uninstall"
101+
!insertmacro wails.setShellContext
102+
103+
RMDir /r "$AppData\${PRODUCT_EXECUTABLE}" # Remove the WebView2 DataPath
104+
105+
RMDir /r $INSTDIR
106+
107+
Delete "$SMPROGRAMS\${INFO_PRODUCTNAME}.lnk"
108+
Delete "$DESKTOP\${INFO_PRODUCTNAME}.lnk"
109+
110+
!insertmacro wails.unassociateFiles
111+
!insertmacro wails.unassociateCustomProtocols
112+
113+
!insertmacro wails.deleteUninstaller
114+
SectionEnd

0 commit comments

Comments
 (0)