diff --git a/Taskfile.yml b/Taskfile.yml index 4855ad42..646db22c 100644 --- a/Taskfile.yml +++ b/Taskfile.yml @@ -1,449 +1,34 @@ version: '3' +includes: + common: ./build/Taskfile.yml + windows: ./build/windows/Taskfile.yml + darwin: ./build/darwin/Taskfile.yml + linux: ./build/linux/Taskfile.yml + vars: - APP_NAME: "comet" + APP_NAME: "asdf" BIN_DIR: "bin" VITE_PORT: '{{.WAILS_VITE_PORT | default 9245}}' tasks: - - ## -------------------------- Build -------------------------- ## - build: summary: Builds the application cmds: - # Build for current OS - - task: build:{{OS}} - - # Uncomment to build for specific OSes - # - task: build:linux - # - task: build:windows - # - task: build:darwin - - - ## ------> Windows <------- - - build:windows: - summary: Builds the application for Windows - deps: - - task: go:mod:tidy - - task: build:frontend - vars: - BUILD_FLAGS: '{{.BUILD_FLAGS}}' - - task: generate:icons - - task: generate:syso - vars: - ARCH: '{{.ARCH}}' - cmds: - - go build {{.BUILD_FLAGS}} -o {{.BIN_DIR}}/comet.exe - vars: - BUILD_FLAGS: '{{if eq .PRODUCTION "true"}}-tags production,fts5 -trimpath -ldflags="-w -s -H windowsgui"{{else}}-tags fts5 -gcflags=all="-N -l"{{end}}' - env: - GOOS: windows - CGO_ENABLED: 0 - GOARCH: '{{.ARCH | default ARCH}}' - PRODUCTION: '{{.PRODUCTION | default "false"}}' - - build:windows:prod:arm64: - summary: Creates a production build of the application - cmds: - - task: build:windows - vars: - ARCH: arm64 - PRODUCTION: "true" - - build:windows:prod:amd64: - summary: Creates a production build of the application - cmds: - - task: build:windows - vars: - ARCH: amd64 - PRODUCTION: "true" - - build:windows:debug:arm64: - summary: Creates a debug build of the application - cmds: - - task: build:windows - vars: - ARCH: arm64 - - build:windows:debug:amd64: - summary: Creates a debug build of the application - cmds: - - task: build:windows - vars: - ARCH: amd64 - - ## ------> Darwin <------- - - build:darwin: - summary: Creates a production build of the application - deps: - - task: go:mod:tidy - - task: build:frontend - vars: - BUILD_FLAGS: '{{.BUILD_FLAGS}}' - - task: generate:icons - cmds: - - go build {{.BUILD_FLAGS}} -o {{.BIN_DIR}}/{{.APP_NAME}} - vars: - BUILD_FLAGS: '{{if eq .PRODUCTION "true"}}-tags production,fts5 -trimpath -ldflags="-w -s"{{else}}-tags fts5 -gcflags=all="-N -l"{{end}}' - env: - GOOS: darwin - CGO_ENABLED: 1 - GOARCH: '{{.ARCH | default ARCH}}' - CGO_CFLAGS: "-mmacosx-version-min=10.15" - CGO_LDFLAGS: "-mmacosx-version-min=10.15" - MACOSX_DEPLOYMENT_TARGET: "10.15" - PRODUCTION: '{{.PRODUCTION | default "false"}}' - - build:darwin:prod:arm64: - summary: Creates a production build of the application - cmds: - - task: build:darwin - vars: - ARCH: arm64 - PRODUCTION: "true" - - build:darwin:prod:amd64: - summary: Creates a production build of the application - cmds: - - task: build:darwin - vars: - ARCH: amd64 - PRODUCTION: "true" - - build:darwin:debug:arm64: - summary: Creates a debug build of the application - cmds: - - task: build:darwin - vars: - ARCH: arm64 - - build:darwin:debug:amd64: - summary: Creates a debug build of the application - cmds: - - task: build:darwin - vars: - ARCH: amd64 - - - ## ------> Linux <------- - - build:linux: - summary: Builds the application for Linux - deps: - - task: go:mod:tidy - - task: build:frontend - vars: - BUILD_FLAGS: '{{.BUILD_FLAGS}}' - - task: generate:icons - vars: - ARCH: '{{.ARCH}}' - cmds: - - go build {{.BUILD_FLAGS}} -o {{.BIN_DIR}}/comet - vars: - BUILD_FLAGS: '{{if eq .PRODUCTION "true"}}-tags production,fts5 -trimpath -ldflags="-w -s"{{else}}-tags fts5 -gcflags=all="-N -l"{{end}}' - env: - GOOS: linux - CGO_ENABLED: 1 - GOARCH: '{{.ARCH | default ARCH}}' - PRODUCTION: '{{.PRODUCTION | default "false"}}' - - build:linux:prod:arm64: - summary: Creates a production build of the application - cmds: - - task: build:linux - vars: - ARCH: arm64 - PRODUCTION: "true" - - build:linux:prod:amd64: - summary: Creates a production build of the application - cmds: - - task: build:linux - vars: - ARCH: amd64 - PRODUCTION: "true" - - build:linux:debug:arm64: - summary: Creates a debug build of the application - cmds: - - task: build:linux - vars: - ARCH: arm64 - - build:linux:debug:amd64: - summary: Creates a debug build of the application - cmds: - - task: build:linux - vars: - ARCH: amd64 - - ## -------------------------- Package -------------------------- ## + - task: "{{OS}}:build" package: - summary: Packages a production build of the application into a bundle + summary: Packages a production build of the application cmds: - - # Package for current OS - - task: package:{{OS}} - - # Package for specific os/arch - # - task: package:darwin:arm64 - # - task: package:darwin:amd64 - # - task: package:windows:arm64 - # - task: package:windows:amd64 - - ## ------> Windows <------ - - package:windows: - summary: Packages a production build of the application into a `.exe` bundle - cmds: - - task: create:nsis:installer - vars: - ARCH: '{{.ARCH}}' - vars: - ARCH: '{{.ARCH | default ARCH}}' - - package:windows:arm64: - summary: Packages a production build of the application into a `.exe` bundle - cmds: - - task: package:windows - vars: - ARCH: arm64 - - package:windows:amd64: - summary: Packages a production build of the application into a `.exe` bundle - cmds: - - task: package:windows - vars: - ARCH: amd64 - - generate:syso: - summary: Generates Windows `.syso` file - dir: build - cmds: - - wails3 generate syso -arch {{.ARCH}} -icon icon.ico -manifest wails.exe.manifest -info info.json -out ../wails.syso - vars: - ARCH: '{{.ARCH | default ARCH}}' - - create:nsis:installer: - summary: Creates an NSIS installer - label: "NSIS Installer ({{.ARCH}})" - dir: build/nsis - sources: - - "{{.ROOT_DIR}}\\bin\\{{.APP_NAME}}.exe" - generates: - - "{{.ROOT_DIR}}\\bin\\{{.APP_NAME}}-{{.ARCH}}-installer.exe" - deps: - - task: build:windows - vars: - PRODUCTION: "true" - ARCH: '{{.ARCH}}' - cmds: - - makensis -DARG_WAILS_'{{.ARG_FLAG}}'_BINARY="{{.ROOT_DIR}}\{{.BIN_DIR}}\{{.APP_NAME}}.exe" project.nsi - vars: - ARCH: '{{.ARCH | default ARCH}}' - ARG_FLAG: '{{if eq .ARCH "amd64"}}AMD64{{else}}ARM64{{end}}' - - ## ------> Darwin <------ - - package:darwin: - summary: Packages a production build of the application into a `.app` bundle - platforms: [ darwin ] - deps: - - task: build:darwin - vars: - PRODUCTION: "true" - cmds: - - task: create:app:bundle - - package:darwin:arm64: - summary: Packages a production build of the application into a `.app` bundle - platforms: [ darwin/arm64 ] - deps: - - task: package:darwin - vars: - ARCH: arm64 - - package:darwin:amd64: - summary: Packages a production build of the application into a `.app` bundle - platforms: [ darwin/amd64 ] - deps: - - task: package:darwin - vars: - ARCH: amd64 - - create:app:bundle: - summary: Creates an `.app` bundle - cmds: - - mkdir -p {{.BIN_DIR}}/{{.APP_NAME}}.app/Contents/{MacOS,Resources} - - cp build/icons.icns {{.BIN_DIR}}/{{.APP_NAME}}.app/Contents/Resources - - cp {{.BIN_DIR}}/{{.APP_NAME}} {{.BIN_DIR}}/{{.APP_NAME}}.app/Contents/MacOS - - cp build/Info.plist {{.BIN_DIR}}/{{.APP_NAME}}.app/Contents - - ## ------> Linux <------ - - package:linux: - summary: Packages a production build of the application for Linux - platforms: [ linux ] - deps: - - task: build:linux - vars: - PRODUCTION: "true" - cmds: - - task: create:appimage - - create:appimage: - summary: Creates an AppImage - dir: build/appimage - platforms: [ linux ] - deps: - - task: build:linux - vars: - PRODUCTION: "true" - - task: generate:linux:dotdesktop - cmds: - # Copy binary + icon to appimage dir - - cp {{.APP_BINARY}} {{.APP_NAME}} - - cp ../appicon.png appicon.png - # Generate AppImage - - wails3 generate appimage -binary {{.APP_NAME}} -icon {{.ICON}} -desktopfile {{.DESKTOP_FILE}} -outputdir {{.OUTPUT_DIR}} -builddir {{.ROOT_DIR}}/build/appimage - vars: - APP_NAME: '{{.APP_NAME}}' - APP_BINARY: '../../bin/{{.APP_NAME}}' - ICON: '../appicon.png' - DESKTOP_FILE: '{{.APP_NAME}}.desktop' - OUTPUT_DIR: '../../bin' - - generate:linux:dotdesktop: - summary: Generates a `.desktop` file - dir: build - sources: - - "appicon.png" - generates: - - '{{.ROOT_DIR}}/build/appimage/{{.APP_NAME}}.desktop' - cmds: - - mkdir -p {{.ROOT_DIR}}/build/appimage - # Run `wails3 generate .desktop -help` for all the options - - wails3 generate .desktop -name "{{.APP_NAME}}" -exec "{{.EXEC}}" -icon "{{.ICON}}" -outputfile {{.ROOT_DIR}}/build/appimage/{{.APP_NAME}}.desktop -categories "{{.CATEGORIES}}" - # -comment "A comment" - # -terminal "true" - # -version "1.0" - # -genericname "Generic Name" - # -keywords "keyword1;keyword2;" - # -startupnotify "true" - # -mimetype "application/x-extension1;application/x-extension2;" - - vars: - APP_NAME: '{{.APP_NAME}}' - EXEC: '{{.APP_NAME}}' - ICON: 'appicon' - CATEGORIES: 'Development;' - OUTPUTFILE: '{{.ROOT_DIR}}/build/appimage/{{.APP_NAME}}.desktop' - - ## -------------------------- Misc -------------------------- ## - - - generate:icons: - summary: Generates Windows `.ico` and Mac `.icns` files from an image - dir: build - sources: - - "appicon.png" - generates: - - "icons.icns" - - "icons.ico" - cmds: - # Generates both .ico and .icns files - - wails3 generate icons -input appicon.png - - install:frontend:deps: - summary: Install frontend dependencies - dir: frontend - sources: - - package.json - - package-lock.json - generates: - - node_modules/* - preconditions: - - sh: npm version - msg: "Looks like npm isn't installed. Npm is part of the Node installer: https://nodejs.org/en/download/" - cmds: - # - npm install --silent --no-progress - - npm install - - build:frontend: - summary: Build the frontend project - dir: frontend - sources: - - "**/*" - generates: - - dist/* - deps: - - install:frontend:deps - - task: generate:bindings - vars: - BUILD_FLAGS: '{{.BUILD_FLAGS}}' - cmds: - - npm run build -q - - generate:bindings: - summary: Generates bindings for the frontend - sources: - - "**/*.go" - - go.mod - - go.sum - generates: - - "frontend/bindings/**/*" - cmds: - # For a complete list of options, run `wails3 generate bindings -help` - - wails3 generate bindings -f '{{.BUILD_FLAGS}}' -ts - - go:mod:tidy: - summary: Runs `go mod tidy` - internal: true - generates: - - go.sum - sources: - - go.mod - cmds: - - go mod tidy - -# ----------------------- dev ----------------------- # - + - task: "{{OS}}:package" run: summary: Runs the application cmds: - - task: run:{{OS}} - - run:windows: - cmds: - - '{{.BIN_DIR}}\\{{.APP_NAME}}.exe' - - run:linux: - cmds: - - '{{.BIN_DIR}}/{{.APP_NAME}}' - - run:darwin: - cmds: - - '{{.BIN_DIR}}/{{.APP_NAME}}' - - dev:frontend: - summary: Runs the frontend in development mode - dir: frontend - deps: - - task: install:frontend:deps - cmds: - - npm run dev -- --port {{.VITE_PORT}} --strictPort + - task: "{{OS}}:run" dev: summary: Runs the application in development mode cmds: - - wails3 dev -config ./build/devmode.config.yaml -port {{.VITE_PORT}} + - wails3 dev -config ./build/config.yml -port {{.VITE_PORT}} - dev:reload: - summary: Reloads the application - cmds: - - task: run diff --git a/build/Taskfile.yml b/build/Taskfile.yml new file mode 100644 index 00000000..ee88d272 --- /dev/null +++ b/build/Taskfile.yml @@ -0,0 +1,75 @@ +version: '3' + +tasks: + go:mod:tidy: + summary: Runs `go mod tidy` + internal: true + generates: + - go.sum + sources: + - go.mod + cmds: + - go mod tidy + + install:frontend:deps: + summary: Install frontend dependencies + dir: frontend + sources: + - package.json + - package-lock.json + generates: + - node_modules/* + preconditions: + - sh: npm version + msg: "Looks like npm isn't installed. Npm is part of the Node installer: https://nodejs.org/en/download/" + cmds: + - npm install + + build:frontend: + summary: Build the frontend project + dir: frontend + sources: + - "**/*" + generates: + - dist/* + deps: + - task: install:frontend:deps + - task: generate:bindings + cmds: + - npm run build -q + + generate:bindings: + summary: Generates bindings for the frontend + sources: + - "**/*.go" + - go.mod + - go.sum + generates: + - "frontend/bindings/**/*" + cmds: + - wails3 generate bindings -f '{{.BUILD_FLAGS}}'{{if .UseTypescript}} -ts{{end}} + + generate:icons: + summary: Generates Windows `.ico` and Mac `.icns` files from an image + dir: build + sources: + - "appicon.png" + generates: + - "icons.icns" + - "icons.ico" + cmds: + - wails3 generate icons -input appicon.png -macfilename darwin/icons.icns -windowsfilename windows/icons.ico + + dev:frontend: + summary: Runs the frontend in development mode + dir: frontend + deps: + - task: install:frontend:deps + cmds: + - npm run dev -- --port {{.VITE_PORT}} --strictPort + + update:build-assets: + summary: Updates the build assets + dir: build + cmds: + - wails3 update build-assets -name "{{.APP_NAME}}" -binaryname "{{.APP_NAME}}" -config config.yml -dir . \ No newline at end of file diff --git a/build/config.yml b/build/config.yml new file mode 100644 index 00000000..37da2511 --- /dev/null +++ b/build/config.yml @@ -0,0 +1,62 @@ +# This file contains the configuration for this project. +# When you update `info` or `fileAssociations`, run `wails3 task common:update:build-assets` to update the assets. +# Note that this will overwrite any changes you have made to the assets. +version: '3' + +# This information is used to generate the build assets. +info: + companyName: "My Company" # The name of the company + productName: "My Product" # The name of the application + productIdentifier: "com.mycompany.myproduct" # The unique product identifier + description: "A program that does X" # The application description + copyright: "(c) 2024, My Company" # Copyright text + comments: "Some Product Comments" # Comments + version: "v0.0.1" # The application version + +# Dev mode configuration +dev_mode: + root_path: . + log_level: warn + debounce: 1000 + ignore: + dir: + - .git + - node_modules + - frontend + - bin + file: + - .DS_Store + - .gitignore + - .gitkeep + watched_extension: + - "*.go" + git_ignore: true + executes: + - cmd: wails3 task common:install:frontend:deps + type: once + - cmd: wails3 task common:dev:frontend + type: background + - cmd: go mod tidy + type: blocking + - cmd: wails3 task build + type: blocking + - cmd: wails3 task run + type: primary + +# File Associations +# More information at: https://v3alpha.wails.io/noit/done/yet +fileAssociations: +# - ext: wails +# name: Wails +# description: Wails Application File +# iconName: wailsFileIcon +# role: Editor +# - ext: jpg +# name: JPEG +# description: Image File +# iconName: jpegFileIcon +# role: Editor + +# Other data +other: + - name: My Other Data \ No newline at end of file diff --git a/build/Info.dev.plist b/build/darwin/Info.dev.plist similarity index 92% rename from build/Info.dev.plist rename to build/darwin/Info.dev.plist index de9e36e5..a3ddfdc1 100644 --- a/build/Info.dev.plist +++ b/build/darwin/Info.dev.plist @@ -6,9 +6,9 @@ CFBundleName My Product CFBundleExecutable - comet + asdf CFBundleIdentifier - com.wails.comet + com.wails.asdf CFBundleVersion 0.1.0 CFBundleGetInfoString @@ -29,4 +29,4 @@ - + \ No newline at end of file diff --git a/build/Info.plist b/build/darwin/Info.plist similarity index 91% rename from build/Info.plist rename to build/darwin/Info.plist index af82f72f..ec6553a0 100644 --- a/build/Info.plist +++ b/build/darwin/Info.plist @@ -6,9 +6,9 @@ CFBundleName My Product CFBundleExecutable - comet + asdf CFBundleIdentifier - com.wails.comet + com.wails.asdf CFBundleVersion 0.1.0 CFBundleGetInfoString @@ -24,4 +24,4 @@ NSHumanReadableCopyright © now, My Company - + \ No newline at end of file diff --git a/build/darwin/Taskfile.yml b/build/darwin/Taskfile.yml new file mode 100644 index 00000000..c7d5ce8b --- /dev/null +++ b/build/darwin/Taskfile.yml @@ -0,0 +1,70 @@ +version: '3' + +includes: + common: ../Taskfile.yml + +tasks: + build: + summary: Creates a production build of the application + deps: + - task: common:go:mod:tidy + - task: common:build:frontend + - task: common:generate:icons + cmds: + - go build {{.BUILD_FLAGS}} -o {{.OUTPUT}} + vars: + BUILD_FLAGS: '{{if eq .PRODUCTION "true"}}-tags production,fts5 -trimpath -ldflags="-w -s"{{else}}-tags fts5 -gcflags=all="-N -l"{{end}}' + DEFAULT_OUTPUT: '{{.BIN_DIR}}/{{.APP_NAME}}' + OUTPUT: '{{ .OUTPUT | default .DEFAULT_OUTPUT }}' + env: + GOOS: darwin + CGO_ENABLED: 1 + GOARCH: '{{.ARCH | default ARCH}}' + CGO_CFLAGS: "-mmacosx-version-min=10.15" + CGO_LDFLAGS: "-mmacosx-version-min=10.15" + MACOSX_DEPLOYMENT_TARGET: "10.15" + PRODUCTION: '{{.PRODUCTION | default "false"}}' + + build:universal: + summary: Builds darwin universal binary (arm64 + amd64) + deps: + - task: build + vars: + ARCH: amd64 + OUTPUT: "{{.BIN_DIR}}/{{.APP_NAME}}-amd64" + - task: build + vars: + ARCH: arm64 + OUTPUT: "{{.BIN_DIR}}/{{.APP_NAME}}-arm64" + cmds: + - lipo -create -output "{{.BIN_DIR}}/{{.APP_NAME}}" "{{.BIN_DIR}}/{{.APP_NAME}}-amd64" "{{.BIN_DIR}}/{{.APP_NAME}}-arm64" + - rm "{{.BIN_DIR}}/{{.APP_NAME}}-amd64" "{{.BIN_DIR}}/{{.APP_NAME}}-arm64" + + package: + summary: Packages a production build of the application into a `.app` bundle + deps: + - task: build + vars: + PRODUCTION: "true" + cmds: + - task: create:app:bundle + + package:universal: + summary: Packages darwin universal binary (arm64 + amd64) + deps: + - task: build:universal + cmds: + - task: create:app:bundle + + + create:app:bundle: + summary: Creates an `.app` bundle + cmds: + - mkdir -p {{.BIN_DIR}}/{{.APP_NAME}}.app/Contents/{MacOS,Resources} + - cp build/darwin/icons.icns {{.BIN_DIR}}/{{.APP_NAME}}.app/Contents/Resources + - cp {{.BIN_DIR}}/{{.APP_NAME}} {{.BIN_DIR}}/{{.APP_NAME}}.app/Contents/MacOS + - cp build/darwin/Info.plist {{.BIN_DIR}}/{{.APP_NAME}}.app/Contents + + run: + cmds: + - '{{.BIN_DIR}}/{{.APP_NAME}}' diff --git a/build/icons.icns b/build/darwin/icons.icns similarity index 100% rename from build/icons.icns rename to build/darwin/icons.icns diff --git a/build/devmode.config.yaml b/build/devmode.config.yaml deleted file mode 100644 index 1a441f24..00000000 --- a/build/devmode.config.yaml +++ /dev/null @@ -1,28 +0,0 @@ -config: - root_path: . - log_level: warn - debounce: 1000 - ignore: - dir: - - .git - - node_modules - - frontend - - bin - file: - - .DS_Store - - .gitignore - - .gitkeep - watched_extension: - - "*.go" - git_ignore: true - executes: - - cmd: wails3 task install:frontend:deps - type: once - - cmd: wails3 task dev:frontend - type: background - - cmd: go mod tidy - type: blocking - - cmd: wails3 task build - type: blocking - - cmd: wails3 task run - type: primary diff --git a/build/linux/Taskfile.yml b/build/linux/Taskfile.yml new file mode 100644 index 00000000..971ab5f1 --- /dev/null +++ b/build/linux/Taskfile.yml @@ -0,0 +1,114 @@ +version: '3' + +includes: + common: ../Taskfile.yml + +tasks: + build: + summary: Builds the application for Linux + deps: + - task: common:go:mod:tidy + - task: common:build:frontend + - task: common:generate:icons + cmds: + - go build {{.BUILD_FLAGS}} -o {{.BIN_DIR}}/{{.APP_NAME}} + vars: + BUILD_FLAGS: '{{if eq .PRODUCTION "true"}}-tags production -trimpath -ldflags="-w -s"{{else}}-gcflags=all="-l"{{end}}' + env: + GOOS: linux + CGO_ENABLED: 1 + GOARCH: '{{.ARCH | default ARCH}}' + PRODUCTION: '{{.PRODUCTION | default "false"}}' + + package: + summary: Packages a production build of the application for Linux + deps: + - task: build + vars: + PRODUCTION: "true" + cmds: + - task: create:appimage + - task: create:deb + - task: create:rpm + - task: create:aur + + create:appimage: + summary: Creates an AppImage + dir: build/linux/appimage + deps: + - task: build + vars: + PRODUCTION: "true" + - task: generate:dotdesktop + cmds: + - cp {{.APP_BINARY}} {{.APP_NAME}} + - cp ../../appicon.png appicon.png + - wails3 generate appimage -binary {{.APP_NAME}} -icon {{.ICON}} -desktopfile {{.DESKTOP_FILE}} -outputdir {{.OUTPUT_DIR}} -builddir {{.ROOT_DIR}}/build/linux/appimage/build + vars: + APP_NAME: '{{.APP_NAME}}' + APP_BINARY: '../../../bin/{{.APP_NAME}}' + ICON: '../../appicon.png' + DESKTOP_FILE: '../{{.APP_NAME}}.desktop' + OUTPUT_DIR: '../../../bin' + + create:deb: + summary: Creates a deb package + deps: + - task: build + vars: + PRODUCTION: "true" + cmds: + - task: generate:dotdesktop + - task: generate:deb + + create:rpm: + summary: Creates a rpm package + deps: + - task: build + vars: + PRODUCTION: "true" + cmds: + - task: generate:dotdesktop + - task: generate:rpm + + create:aur: + summary: Creates a arch linux packager package + deps: + - task: build + vars: + PRODUCTION: "true" + cmds: + - task: generate:dotdesktop + - task: generate:aur + + generate:deb: + summary: Creates a deb package + cmds: + - wails3 tool package -name {{.APP_NAME}} -format deb -config ./build/linux/nfpm/nfpm.yaml -out {{.ROOT_DIR}}/bin + + generate:rpm: + summary: Creates a rpm package + cmds: + - wails3 tool package -name {{.APP_NAME}} -format rpm -config ./build/linux/nfpm/nfpm.yaml -out {{.ROOT_DIR}}/bin + + generate:aur: + summary: Creates a arch linux packager package + cmds: + - wails3 tool package -name {{.APP_NAME}} -format archlinux -config ./build/linux/nfpm/nfpm.yaml -out {{.ROOT_DIR}}/bin + + generate:dotdesktop: + summary: Generates a `.desktop` file + dir: build + cmds: + - mkdir -p {{.ROOT_DIR}}/build/linux/appimage + - wails3 generate .desktop -name "{{.APP_NAME}}" -exec "{{.EXEC}}" -icon "{{.ICON}}" -outputfile {{.ROOT_DIR}}/build/linux/{{.APP_NAME}}.desktop -categories "{{.CATEGORIES}}" + vars: + APP_NAME: '{{.APP_NAME}}' + EXEC: '{{.APP_NAME}}' + ICON: 'appicon' + CATEGORIES: 'Development;' + OUTPUTFILE: '{{.ROOT_DIR}}/build/linux/{{.APP_NAME}}.desktop' + + run: + cmds: + - '{{.BIN_DIR}}/{{.APP_NAME}}' diff --git a/build/appimage/build.sh b/build/linux/appimage/build.sh similarity index 100% rename from build/appimage/build.sh rename to build/linux/appimage/build.sh diff --git a/build/linux/nfpm/nfpm.yaml b/build/linux/nfpm/nfpm.yaml new file mode 100644 index 00000000..c40836bf --- /dev/null +++ b/build/linux/nfpm/nfpm.yaml @@ -0,0 +1,50 @@ +# Feel free to remove those if you don't want/need to use them. +# Make sure to check the documentation at https://nfpm.goreleaser.com +# +# The lines below are called `modelines`. See `:help modeline` + +name: "asdf" +arch: ${GOARCH} +platform: "linux" +version: "0.1.0" +section: "default" +priority: "extra" +maintainer: ${GIT_COMMITTER_NAME} <${GIT_COMMITTER_EMAIL}> +description: "My Product Description" +vendor: "My Company" +homepage: "https://wails.io" +license: "MIT" +release: "1" + +contents: + - src: "./bin/asdf" + dst: "/usr/local/bin/asdf" + - src: "./build/appicon.png" + dst: "/usr/share/icons/hicolor/128x128/apps/asdf.png" + - src: "./build/linux/asdf.desktop" + dst: "/usr/share/applications/asdf.desktop" + +depends: + - gtk3 + - libwebkit2gtk + +# replaces: +# - foobar +# provides: +# - bar +# depends: +# - gtk3 +# - libwebkit2gtk +# recommends: +# - whatever +# suggests: +# - something-else +# conflicts: +# - not-foo +# - not-bar +# changelog: "changelog.yaml" +# scripts: +# preinstall: ./build/linux/nfpm/scripts/preinstall.sh +# postinstall: ./build/linux/nfpm/scripts/postinstall.sh +# preremove: ./build/linux/nfpm/scripts/preremove.sh +# postremove: ./build/linux/nfpm/scripts/postremove.sh diff --git a/build/linux/nfpm/scripts/postinstall.sh b/build/linux/nfpm/scripts/postinstall.sh new file mode 100644 index 00000000..a9bf588e --- /dev/null +++ b/build/linux/nfpm/scripts/postinstall.sh @@ -0,0 +1 @@ +#!/bin/bash diff --git a/build/linux/nfpm/scripts/postremove.sh b/build/linux/nfpm/scripts/postremove.sh new file mode 100644 index 00000000..a9bf588e --- /dev/null +++ b/build/linux/nfpm/scripts/postremove.sh @@ -0,0 +1 @@ +#!/bin/bash diff --git a/build/linux/nfpm/scripts/preinstall.sh b/build/linux/nfpm/scripts/preinstall.sh new file mode 100644 index 00000000..a9bf588e --- /dev/null +++ b/build/linux/nfpm/scripts/preinstall.sh @@ -0,0 +1 @@ +#!/bin/bash diff --git a/build/linux/nfpm/scripts/preremove.sh b/build/linux/nfpm/scripts/preremove.sh new file mode 100644 index 00000000..a9bf588e --- /dev/null +++ b/build/linux/nfpm/scripts/preremove.sh @@ -0,0 +1 @@ +#!/bin/bash diff --git a/build/windows/Taskfile.yml b/build/windows/Taskfile.yml new file mode 100644 index 00000000..fd4c6d2f --- /dev/null +++ b/build/windows/Taskfile.yml @@ -0,0 +1,56 @@ +version: '3' + +includes: + common: ../Taskfile.yml + +tasks: + build: + summary: Builds the application for Windows + deps: + - task: common:go:mod:tidy + - task: common:build:frontend + - task: common:generate:icons + cmds: + - task: generate:syso + - go build {{.BUILD_FLAGS}} -o {{.BIN_DIR}}/{{.APP_NAME}}.exe + - cmd: powershell Remove-item *.syso + platforms: [windows] + - cmd: rm -f *.syso + platforms: [linux, darwin] + vars: + BUILD_FLAGS: '{{if eq .PRODUCTION "true"}}-tags production -trimpath -ldflags="-w -s -H windowsgui"{{else}}-gcflags=all="-l"{{end}}' + env: + GOOS: windows + CGO_ENABLED: 0 + GOARCH: '{{.ARCH | default ARCH}}' + PRODUCTION: '{{.PRODUCTION | default "false"}}' + + package: + summary: Packages a production build of the application into a `.exe` bundle + cmds: + - task: create:nsis:installer + + generate:syso: + summary: Generates Windows `.syso` file + dir: build + cmds: + - wails3 generate syso -arch {{.ARCH}} -icon windows/icon.ico -manifest windows/wails.exe.manifest -info windows/info.json -out ../wails_windows_{{.ARCH}}.syso + vars: + ARCH: '{{.ARCH | default ARCH}}' + + create:nsis:installer: + summary: Creates an NSIS installer + dir: build/windows/nsis + deps: + - task: build + vars: + PRODUCTION: "true" + cmds: + - makensis -DARG_WAILS_{{.ARG_FLAG}}_BINARY="{{.ROOT_DIR}}\{{.BIN_DIR}}\{{.APP_NAME}}.exe" project.nsi + vars: + ARCH: '{{.ARCH | default ARCH}}' + ARG_FLAG: '{{if eq .ARCH "amd64"}}AMD64{{else}}ARM64{{end}}' + + run: + cmds: + - '{{.BIN_DIR}}\\{{.APP_NAME}}.exe' \ No newline at end of file diff --git a/build/icon.ico b/build/windows/icon.ico similarity index 100% rename from build/icon.ico rename to build/windows/icon.ico diff --git a/build/windows/icons.ico b/build/windows/icons.ico new file mode 100644 index 00000000..bfa0690b Binary files /dev/null and b/build/windows/icons.ico differ diff --git a/build/info.json b/build/windows/info.json similarity index 100% rename from build/info.json rename to build/windows/info.json diff --git a/build/nsis/project.nsi b/build/windows/nsis/project.nsi similarity index 94% rename from build/nsis/project.nsi rename to build/windows/nsis/project.nsi index caf67069..98b232fa 100644 --- a/build/nsis/project.nsi +++ b/build/windows/nsis/project.nsi @@ -19,7 +19,7 @@ Unicode true #### ## The following information is taken from the wails_tools.nsh file, but they can be overwritten here. #### -## !define INFO_PROJECTNAME "my-project" # Default "comet" +## !define INFO_PROJECTNAME "my-project" # Default "asdf" ## !define INFO_COMPANYNAME "My Company" # Default "My Company" ## !define INFO_PRODUCTNAME "My Product Name" # Default "My Product" ## !define INFO_PRODUCTVERSION "1.0.0" # Default "0.1.0" @@ -71,7 +71,7 @@ ManifestDPIAware true #!finalize 'signtool --file "%1"' Name "${INFO_PRODUCTNAME}" -OutFile "..\..\bin\${INFO_PROJECTNAME}-${ARCH}-installer.exe" # Name of the installer's file. +OutFile "..\..\..\bin\${INFO_PROJECTNAME}-${ARCH}-installer.exe" # Name of the installer's file. InstallDir "$PROGRAMFILES64\${INFO_COMPANYNAME}\${INFO_PRODUCTNAME}" # Default installing folder ($PROGRAMFILES is Program Files folder). ShowInstDetails show # This will always show the installation details. @@ -91,6 +91,8 @@ Section CreateShortcut "$SMPROGRAMS\${INFO_PRODUCTNAME}.lnk" "$INSTDIR\${PRODUCT_EXECUTABLE}" CreateShortCut "$DESKTOP\${INFO_PRODUCTNAME}.lnk" "$INSTDIR\${PRODUCT_EXECUTABLE}" + !insertmacro wails.associateFiles + !insertmacro wails.writeUninstaller SectionEnd @@ -104,5 +106,7 @@ Section "uninstall" Delete "$SMPROGRAMS\${INFO_PRODUCTNAME}.lnk" Delete "$DESKTOP\${INFO_PRODUCTNAME}.lnk" + !insertmacro wails.unassociateFiles + !insertmacro wails.deleteUninstaller SectionEnd diff --git a/build/nsis/wails_tools.nsh b/build/windows/nsis/wails_tools.nsh similarity index 79% rename from build/nsis/wails_tools.nsh rename to build/windows/nsis/wails_tools.nsh index 6de84e9d..39da55ad 100644 --- a/build/nsis/wails_tools.nsh +++ b/build/windows/nsis/wails_tools.nsh @@ -5,7 +5,7 @@ !include "FileFunc.nsh" !ifndef INFO_PROJECTNAME - !define INFO_PROJECTNAME "comet" + !define INFO_PROJECTNAME "asdf" !endif !ifndef INFO_COMPANYNAME !define INFO_COMPANYNAME "My Company" @@ -177,3 +177,36 @@ RequestExecutionLevel "${REQUEST_EXECUTION_LEVEL}" SetDetailsPrint both ok: !macroend + +# Copy of APP_ASSOCIATE and APP_UNASSOCIATE macros from here https://gist.github.com/nikku/281d0ef126dbc215dd58bfd5b3a5cd5b +!macro APP_ASSOCIATE EXT FILECLASS DESCRIPTION ICON COMMANDTEXT COMMAND + ; Backup the previously associated file class + ReadRegStr $R0 SHELL_CONTEXT "Software\Classes\.${EXT}" "" + WriteRegStr SHELL_CONTEXT "Software\Classes\.${EXT}" "${FILECLASS}_backup" "$R0" + + WriteRegStr SHELL_CONTEXT "Software\Classes\.${EXT}" "" "${FILECLASS}" + + WriteRegStr SHELL_CONTEXT "Software\Classes\${FILECLASS}" "" `${DESCRIPTION}` + WriteRegStr SHELL_CONTEXT "Software\Classes\${FILECLASS}\DefaultIcon" "" `${ICON}` + WriteRegStr SHELL_CONTEXT "Software\Classes\${FILECLASS}\shell" "" "open" + WriteRegStr SHELL_CONTEXT "Software\Classes\${FILECLASS}\shell\open" "" `${COMMANDTEXT}` + WriteRegStr SHELL_CONTEXT "Software\Classes\${FILECLASS}\shell\open\command" "" `${COMMAND}` +!macroend + +!macro APP_UNASSOCIATE EXT FILECLASS + ; Backup the previously associated file class + ReadRegStr $R0 SHELL_CONTEXT "Software\Classes\.${EXT}" `${FILECLASS}_backup` + WriteRegStr SHELL_CONTEXT "Software\Classes\.${EXT}" "" "$R0" + + DeleteRegKey SHELL_CONTEXT `Software\Classes\${FILECLASS}` +!macroend + +!macro wails.associateFiles + ; Create file associations + +!macroend + +!macro wails.unassociateFiles + ; Delete app associations + +!macroend \ No newline at end of file diff --git a/build/wails.exe.manifest b/build/windows/wails.exe.manifest similarity index 88% rename from build/wails.exe.manifest rename to build/windows/wails.exe.manifest index 10faed98..c1310aa1 100644 --- a/build/wails.exe.manifest +++ b/build/windows/wails.exe.manifest @@ -1,6 +1,6 @@ - + @@ -12,4 +12,4 @@ permonitorv2,permonitor - + \ No newline at end of file diff --git a/frontend/bindings/database/sql/index.js b/frontend/bindings/database/sql/index.js new file mode 100644 index 00000000..580fb67a --- /dev/null +++ b/frontend/bindings/database/sql/index.js @@ -0,0 +1,5 @@ +// @ts-check +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +export * from "./models.js"; diff --git a/frontend/bindings/database/sql/models.js b/frontend/bindings/database/sql/models.js new file mode 100644 index 00000000..02ff7f8b --- /dev/null +++ b/frontend/bindings/database/sql/models.js @@ -0,0 +1,98 @@ +// @ts-check +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +// eslint-disable-next-line @typescript-eslint/ban-ts-comment +// @ts-ignore: Unused imports +import {Create as $Create} from "@wailsio/runtime"; + +/** + * NullInt64 represents an int64 that may be null. + * NullInt64 implements the [Scanner] interface so + * it can be used as a scan destination, similar to [NullString]. + */ +export class NullInt64 { + /** + * Creates a new NullInt64 instance. + * @param {Partial} [$$source = {}] - The source object to create the NullInt64. + */ + constructor($$source = {}) { + if (!("Int64" in $$source)) { + /** + * @member + * @type {number} + */ + this["Int64"] = 0; + } + if (!("Valid" in $$source)) { + /** + * Valid is true if Int64 is not NULL + * @member + * @type {boolean} + */ + this["Valid"] = false; + } + + Object.assign(this, $$source); + } + + /** + * Creates a new NullInt64 instance from a string or object. + * @param {any} [$$source = {}] + * @returns {NullInt64} + */ + static createFrom($$source = {}) { + let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source; + return new NullInt64(/** @type {Partial} */($$parsedSource)); + } +} + +/** + * NullString represents a string that may be null. + * NullString implements the [Scanner] interface so + * it can be used as a scan destination: + * + * var s NullString + * err := db.QueryRow("SELECT name FROM foo WHERE id=?", id).Scan(&s) + * ... + * if s.Valid { + * // use s.String + * } else { + * // NULL value + * } + */ +export class NullString { + /** + * Creates a new NullString instance. + * @param {Partial} [$$source = {}] - The source object to create the NullString. + */ + constructor($$source = {}) { + if (!("String" in $$source)) { + /** + * @member + * @type {string} + */ + this["String"] = ""; + } + if (!("Valid" in $$source)) { + /** + * Valid is true if String is not NULL + * @member + * @type {boolean} + */ + this["Valid"] = false; + } + + Object.assign(this, $$source); + } + + /** + * Creates a new NullString instance from a string or object. + * @param {any} [$$source = {}] + * @returns {NullString} + */ + static createFrom($$source = {}) { + let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source; + return new NullString(/** @type {Partial} */($$parsedSource)); + } +} diff --git a/frontend/bindings/github.com/nodetec/comet/db/index.js b/frontend/bindings/github.com/nodetec/comet/db/index.js new file mode 100644 index 00000000..580fb67a --- /dev/null +++ b/frontend/bindings/github.com/nodetec/comet/db/index.js @@ -0,0 +1,5 @@ +// @ts-check +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +export * from "./models.js"; diff --git a/frontend/bindings/github.com/nodetec/comet/db/models.js b/frontend/bindings/github.com/nodetec/comet/db/models.js new file mode 100644 index 00000000..14b4f175 --- /dev/null +++ b/frontend/bindings/github.com/nodetec/comet/db/models.js @@ -0,0 +1,596 @@ +// @ts-check +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +// eslint-disable-next-line @typescript-eslint/ban-ts-comment +// @ts-ignore: Unused imports +import {Create as $Create} from "@wailsio/runtime"; + +// eslint-disable-next-line @typescript-eslint/ban-ts-comment +// @ts-ignore: Unused imports +import * as sql$0 from "../../../../database/sql/models.js"; + +export class CreateNoteFromTrashRow { + /** + * Creates a new CreateNoteFromTrashRow instance. + * @param {Partial} [$$source = {}] - The source object to create the CreateNoteFromTrashRow. + */ + constructor($$source = {}) { + if (!("ID" in $$source)) { + /** + * @member + * @type {number} + */ + this["ID"] = 0; + } + if (!("ID_2" in $$source)) { + /** + * @member + * @type {number} + */ + this["ID_2"] = 0; + } + if (!("StatusID" in $$source)) { + /** + * @member + * @type {sql$0.NullInt64} + */ + this["StatusID"] = (new sql$0.NullInt64()); + } + if (!("NotebookID" in $$source)) { + /** + * @member + * @type {number} + */ + this["NotebookID"] = 0; + } + if (!("Content" in $$source)) { + /** + * @member + * @type {string} + */ + this["Content"] = ""; + } + if (!("Title" in $$source)) { + /** + * @member + * @type {string} + */ + this["Title"] = ""; + } + if (!("CreatedAt" in $$source)) { + /** + * @member + * @type {string} + */ + this["CreatedAt"] = ""; + } + if (!("ModifiedAt" in $$source)) { + /** + * @member + * @type {string} + */ + this["ModifiedAt"] = ""; + } + if (!("PublishedAt" in $$source)) { + /** + * @member + * @type {sql$0.NullString} + */ + this["PublishedAt"] = (new sql$0.NullString()); + } + if (!("EventID" in $$source)) { + /** + * @member + * @type {sql$0.NullString} + */ + this["EventID"] = (new sql$0.NullString()); + } + if (!("Pinned" in $$source)) { + /** + * @member + * @type {boolean} + */ + this["Pinned"] = false; + } + if (!("Notetype" in $$source)) { + /** + * @member + * @type {string} + */ + this["Notetype"] = ""; + } + if (!("Filetype" in $$source)) { + /** + * @member + * @type {string} + */ + this["Filetype"] = ""; + } + + Object.assign(this, $$source); + } + + /** + * Creates a new CreateNoteFromTrashRow instance from a string or object. + * @param {any} [$$source = {}] + * @returns {CreateNoteFromTrashRow} + */ + static createFrom($$source = {}) { + const $$createField2_0 = $$createType0; + const $$createField8_0 = $$createType1; + const $$createField9_0 = $$createType1; + let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source; + if ("StatusID" in $$parsedSource) { + $$parsedSource["StatusID"] = $$createField2_0($$parsedSource["StatusID"]); + } + if ("PublishedAt" in $$parsedSource) { + $$parsedSource["PublishedAt"] = $$createField8_0($$parsedSource["PublishedAt"]); + } + if ("EventID" in $$parsedSource) { + $$parsedSource["EventID"] = $$createField9_0($$parsedSource["EventID"]); + } + return new CreateNoteFromTrashRow(/** @type {Partial} */($$parsedSource)); + } +} + +export class GetNoteFromTrashRow { + /** + * Creates a new GetNoteFromTrashRow instance. + * @param {Partial} [$$source = {}] - The source object to create the GetNoteFromTrashRow. + */ + constructor($$source = {}) { + if (!("ID" in $$source)) { + /** + * @member + * @type {number} + */ + this["ID"] = 0; + } + if (!("NoteID" in $$source)) { + /** + * @member + * @type {number} + */ + this["NoteID"] = 0; + } + if (!("Content" in $$source)) { + /** + * @member + * @type {string} + */ + this["Content"] = ""; + } + if (!("Title" in $$source)) { + /** + * @member + * @type {string} + */ + this["Title"] = ""; + } + if (!("CreatedAt" in $$source)) { + /** + * @member + * @type {string} + */ + this["CreatedAt"] = ""; + } + if (!("ModifiedAt" in $$source)) { + /** + * @member + * @type {string} + */ + this["ModifiedAt"] = ""; + } + if (!("Tags" in $$source)) { + /** + * @member + * @type {sql$0.NullString} + */ + this["Tags"] = (new sql$0.NullString()); + } + if (!("NotebookID" in $$source)) { + /** + * @member + * @type {number} + */ + this["NotebookID"] = 0; + } + if (!("PublishedAt" in $$source)) { + /** + * @member + * @type {sql$0.NullString} + */ + this["PublishedAt"] = (new sql$0.NullString()); + } + if (!("EventID" in $$source)) { + /** + * @member + * @type {sql$0.NullString} + */ + this["EventID"] = (new sql$0.NullString()); + } + if (!("Notetype" in $$source)) { + /** + * @member + * @type {string} + */ + this["Notetype"] = ""; + } + if (!("Filetype" in $$source)) { + /** + * @member + * @type {string} + */ + this["Filetype"] = ""; + } + + Object.assign(this, $$source); + } + + /** + * Creates a new GetNoteFromTrashRow instance from a string or object. + * @param {any} [$$source = {}] + * @returns {GetNoteFromTrashRow} + */ + static createFrom($$source = {}) { + const $$createField6_0 = $$createType1; + const $$createField8_0 = $$createType1; + const $$createField9_0 = $$createType1; + let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source; + if ("Tags" in $$parsedSource) { + $$parsedSource["Tags"] = $$createField6_0($$parsedSource["Tags"]); + } + if ("PublishedAt" in $$parsedSource) { + $$parsedSource["PublishedAt"] = $$createField8_0($$parsedSource["PublishedAt"]); + } + if ("EventID" in $$parsedSource) { + $$parsedSource["EventID"] = $$createField9_0($$parsedSource["EventID"]); + } + return new GetNoteFromTrashRow(/** @type {Partial} */($$parsedSource)); + } +} + +export class Note { + /** + * Creates a new Note instance. + * @param {Partial} [$$source = {}] - The source object to create the Note. + */ + constructor($$source = {}) { + if (!("ID" in $$source)) { + /** + * @member + * @type {number} + */ + this["ID"] = 0; + } + if (!("StatusID" in $$source)) { + /** + * @member + * @type {sql$0.NullInt64} + */ + this["StatusID"] = (new sql$0.NullInt64()); + } + if (!("NotebookID" in $$source)) { + /** + * @member + * @type {number} + */ + this["NotebookID"] = 0; + } + if (!("Content" in $$source)) { + /** + * @member + * @type {string} + */ + this["Content"] = ""; + } + if (!("Title" in $$source)) { + /** + * @member + * @type {string} + */ + this["Title"] = ""; + } + if (!("CreatedAt" in $$source)) { + /** + * @member + * @type {string} + */ + this["CreatedAt"] = ""; + } + if (!("ModifiedAt" in $$source)) { + /** + * @member + * @type {string} + */ + this["ModifiedAt"] = ""; + } + if (!("PublishedAt" in $$source)) { + /** + * @member + * @type {sql$0.NullString} + */ + this["PublishedAt"] = (new sql$0.NullString()); + } + if (!("EventID" in $$source)) { + /** + * @member + * @type {sql$0.NullString} + */ + this["EventID"] = (new sql$0.NullString()); + } + if (!("Pinned" in $$source)) { + /** + * @member + * @type {boolean} + */ + this["Pinned"] = false; + } + if (!("Notetype" in $$source)) { + /** + * @member + * @type {string} + */ + this["Notetype"] = ""; + } + if (!("Filetype" in $$source)) { + /** + * @member + * @type {string} + */ + this["Filetype"] = ""; + } + + Object.assign(this, $$source); + } + + /** + * Creates a new Note instance from a string or object. + * @param {any} [$$source = {}] + * @returns {Note} + */ + static createFrom($$source = {}) { + const $$createField1_0 = $$createType0; + const $$createField7_0 = $$createType1; + const $$createField8_0 = $$createType1; + let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source; + if ("StatusID" in $$parsedSource) { + $$parsedSource["StatusID"] = $$createField1_0($$parsedSource["StatusID"]); + } + if ("PublishedAt" in $$parsedSource) { + $$parsedSource["PublishedAt"] = $$createField7_0($$parsedSource["PublishedAt"]); + } + if ("EventID" in $$parsedSource) { + $$parsedSource["EventID"] = $$createField8_0($$parsedSource["EventID"]); + } + return new Note(/** @type {Partial} */($$parsedSource)); + } +} + +export class Notebook { + /** + * Creates a new Notebook instance. + * @param {Partial} [$$source = {}] - The source object to create the Notebook. + */ + constructor($$source = {}) { + if (!("ID" in $$source)) { + /** + * @member + * @type {number} + */ + this["ID"] = 0; + } + if (!("Name" in $$source)) { + /** + * @member + * @type {string} + */ + this["Name"] = ""; + } + if (!("CreatedAt" in $$source)) { + /** + * @member + * @type {string} + */ + this["CreatedAt"] = ""; + } + + Object.assign(this, $$source); + } + + /** + * Creates a new Notebook instance from a string or object. + * @param {any} [$$source = {}] + * @returns {Notebook} + */ + static createFrom($$source = {}) { + let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source; + return new Notebook(/** @type {Partial} */($$parsedSource)); + } +} + +export class Tag { + /** + * Creates a new Tag instance. + * @param {Partial} [$$source = {}] - The source object to create the Tag. + */ + constructor($$source = {}) { + if (!("ID" in $$source)) { + /** + * @member + * @type {number} + */ + this["ID"] = 0; + } + if (!("Name" in $$source)) { + /** + * @member + * @type {string} + */ + this["Name"] = ""; + } + if (!("Color" in $$source)) { + /** + * @member + * @type {sql$0.NullString} + */ + this["Color"] = (new sql$0.NullString()); + } + if (!("Icon" in $$source)) { + /** + * @member + * @type {sql$0.NullString} + */ + this["Icon"] = (new sql$0.NullString()); + } + if (!("CreatedAt" in $$source)) { + /** + * @member + * @type {string} + */ + this["CreatedAt"] = ""; + } + + Object.assign(this, $$source); + } + + /** + * Creates a new Tag instance from a string or object. + * @param {any} [$$source = {}] + * @returns {Tag} + */ + static createFrom($$source = {}) { + const $$createField2_0 = $$createType1; + const $$createField3_0 = $$createType1; + let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source; + if ("Color" in $$parsedSource) { + $$parsedSource["Color"] = $$createField2_0($$parsedSource["Color"]); + } + if ("Icon" in $$parsedSource) { + $$parsedSource["Icon"] = $$createField3_0($$parsedSource["Icon"]); + } + return new Tag(/** @type {Partial} */($$parsedSource)); + } +} + +export class Trash { + /** + * Creates a new Trash instance. + * @param {Partial} [$$source = {}] - The source object to create the Trash. + */ + constructor($$source = {}) { + if (!("ID" in $$source)) { + /** + * @member + * @type {number} + */ + this["ID"] = 0; + } + if (!("NoteID" in $$source)) { + /** + * @member + * @type {number} + */ + this["NoteID"] = 0; + } + if (!("NotebookID" in $$source)) { + /** + * @member + * @type {number} + */ + this["NotebookID"] = 0; + } + if (!("Content" in $$source)) { + /** + * @member + * @type {string} + */ + this["Content"] = ""; + } + if (!("Title" in $$source)) { + /** + * @member + * @type {string} + */ + this["Title"] = ""; + } + if (!("CreatedAt" in $$source)) { + /** + * @member + * @type {string} + */ + this["CreatedAt"] = ""; + } + if (!("ModifiedAt" in $$source)) { + /** + * @member + * @type {string} + */ + this["ModifiedAt"] = ""; + } + if (!("Tags" in $$source)) { + /** + * @member + * @type {sql$0.NullString} + */ + this["Tags"] = (new sql$0.NullString()); + } + if (!("PublishedAt" in $$source)) { + /** + * @member + * @type {sql$0.NullString} + */ + this["PublishedAt"] = (new sql$0.NullString()); + } + if (!("EventID" in $$source)) { + /** + * @member + * @type {sql$0.NullString} + */ + this["EventID"] = (new sql$0.NullString()); + } + if (!("Notetype" in $$source)) { + /** + * @member + * @type {string} + */ + this["Notetype"] = ""; + } + if (!("Filetype" in $$source)) { + /** + * @member + * @type {string} + */ + this["Filetype"] = ""; + } + + Object.assign(this, $$source); + } + + /** + * Creates a new Trash instance from a string or object. + * @param {any} [$$source = {}] + * @returns {Trash} + */ + static createFrom($$source = {}) { + const $$createField7_0 = $$createType1; + const $$createField8_0 = $$createType1; + const $$createField9_0 = $$createType1; + let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source; + if ("Tags" in $$parsedSource) { + $$parsedSource["Tags"] = $$createField7_0($$parsedSource["Tags"]); + } + if ("PublishedAt" in $$parsedSource) { + $$parsedSource["PublishedAt"] = $$createField8_0($$parsedSource["PublishedAt"]); + } + if ("EventID" in $$parsedSource) { + $$parsedSource["EventID"] = $$createField9_0($$parsedSource["EventID"]); + } + return new Trash(/** @type {Partial} */($$parsedSource)); + } +} + +// Private type creation functions +const $$createType0 = sql$0.NullInt64.createFrom; +const $$createType1 = sql$0.NullString.createFrom; diff --git a/frontend/bindings/github.com/nodetec/comet/service/index.js b/frontend/bindings/github.com/nodetec/comet/service/index.js new file mode 100644 index 00000000..a6295320 --- /dev/null +++ b/frontend/bindings/github.com/nodetec/comet/service/index.js @@ -0,0 +1,22 @@ +// @ts-check +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import * as NostrKeyService from "./nostrkeyservice.js"; +import * as NoteService from "./noteservice.js"; +import * as NoteTagService from "./notetagservice.js"; +import * as NotebookService from "./notebookservice.js"; +import * as RelayService from "./relayservice.js"; +import * as SettingService from "./settingservice.js"; +import * as TagService from "./tagservice.js"; +export { + NostrKeyService, + NoteService, + NoteTagService, + NotebookService, + RelayService, + SettingService, + TagService +}; + +export * from "./models.js"; diff --git a/frontend/bindings/github.com/nodetec/comet/service/models.js b/frontend/bindings/github.com/nodetec/comet/service/models.js new file mode 100644 index 00000000..7de58111 --- /dev/null +++ b/frontend/bindings/github.com/nodetec/comet/service/models.js @@ -0,0 +1,292 @@ +// @ts-check +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +// eslint-disable-next-line @typescript-eslint/ban-ts-comment +// @ts-ignore: Unused imports +import {Create as $Create} from "@wailsio/runtime"; + +// eslint-disable-next-line @typescript-eslint/ban-ts-comment +// @ts-ignore: Unused imports +import * as sql$0 from "../../../../database/sql/models.js"; + +export class NostrKey { + /** + * Creates a new NostrKey instance. + * @param {Partial} [$$source = {}] - The source object to create the NostrKey. + */ + constructor($$source = {}) { + if (!("ID" in $$source)) { + /** + * @member + * @type {number} + */ + this["ID"] = 0; + } + if (!("Nsec" in $$source)) { + /** + * @member + * @type {string} + */ + this["Nsec"] = ""; + } + if (!("Npub" in $$source)) { + /** + * @member + * @type {string} + */ + this["Npub"] = ""; + } + if (!("Active" in $$source)) { + /** + * @member + * @type {boolean} + */ + this["Active"] = false; + } + + Object.assign(this, $$source); + } + + /** + * Creates a new NostrKey instance from a string or object. + * @param {any} [$$source = {}] + * @returns {NostrKey} + */ + static createFrom($$source = {}) { + let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source; + return new NostrKey(/** @type {Partial} */($$parsedSource)); + } +} + +export class Relay { + /** + * Creates a new Relay instance. + * @param {Partial} [$$source = {}] - The source object to create the Relay. + */ + constructor($$source = {}) { + if (!("ID" in $$source)) { + /** + * @member + * @type {number} + */ + this["ID"] = 0; + } + if (!("Url" in $$source)) { + /** + * @member + * @type {string} + */ + this["Url"] = ""; + } + if (!("Read" in $$source)) { + /** + * @member + * @type {boolean} + */ + this["Read"] = false; + } + if (!("Write" in $$source)) { + /** + * @member + * @type {boolean} + */ + this["Write"] = false; + } + if (!("Sync" in $$source)) { + /** + * @member + * @type {boolean} + */ + this["Sync"] = false; + } + + Object.assign(this, $$source); + } + + /** + * Creates a new Relay instance from a string or object. + * @param {any} [$$source = {}] + * @returns {Relay} + */ + static createFrom($$source = {}) { + let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source; + return new Relay(/** @type {Partial} */($$parsedSource)); + } +} + +export class Settings { + /** + * Creates a new Settings instance. + * @param {Partial} [$$source = {}] - The source object to create the Settings. + */ + constructor($$source = {}) { + if (!("Theme" in $$source)) { + /** + * theme + * @member + * @type {string} + */ + this["Theme"] = ""; + } + if (!("Vim" in $$source)) { + /** + * editor + * @member + * @type {string} + */ + this["Vim"] = ""; + } + if (!("LineNumbers" in $$source)) { + /** + * @member + * @type {string} + */ + this["LineNumbers"] = ""; + } + if (!("HighlightActiveLine" in $$source)) { + /** + * @member + * @type {string} + */ + this["HighlightActiveLine"] = ""; + } + if (!("LineWrapping" in $$source)) { + /** + * @member + * @type {string} + */ + this["LineWrapping"] = ""; + } + if (!("IndentSpaces" in $$source)) { + /** + * @member + * @type {string} + */ + this["IndentSpaces"] = ""; + } + if (!("FontSize" in $$source)) { + /** + * @member + * @type {string} + */ + this["FontSize"] = ""; + } + if (!("FontFamily" in $$source)) { + /** + * @member + * @type {string} + */ + this["FontFamily"] = ""; + } + if (!("LineHeight" in $$source)) { + /** + * @member + * @type {string} + */ + this["LineHeight"] = ""; + } + if (!("Npub" in $$source)) { + /** + * profile + * @member + * @type {string} + */ + this["Npub"] = ""; + } + if (!("Nsec" in $$source)) { + /** + * @member + * @type {string} + */ + this["Nsec"] = ""; + } + if (!("Relays" in $$source)) { + /** + * relays + * @member + * @type {string} + */ + this["Relays"] = ""; + } + + Object.assign(this, $$source); + } + + /** + * Creates a new Settings instance from a string or object. + * @param {any} [$$source = {}] + * @returns {Settings} + */ + static createFrom($$source = {}) { + let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source; + return new Settings(/** @type {Partial} */($$parsedSource)); + } +} + +export class Tag { + /** + * Creates a new Tag instance. + * @param {Partial} [$$source = {}] - The source object to create the Tag. + */ + constructor($$source = {}) { + if (!("ID" in $$source)) { + /** + * @member + * @type {number} + */ + this["ID"] = 0; + } + if (!("Name" in $$source)) { + /** + * @member + * @type {string} + */ + this["Name"] = ""; + } + if (!("Color" in $$source)) { + /** + * @member + * @type {sql$0.NullString} + */ + this["Color"] = (new sql$0.NullString()); + } + if (!("Icon" in $$source)) { + /** + * @member + * @type {sql$0.NullString} + */ + this["Icon"] = (new sql$0.NullString()); + } + if (!("CreatedAt" in $$source)) { + /** + * @member + * @type {string} + */ + this["CreatedAt"] = ""; + } + + Object.assign(this, $$source); + } + + /** + * Creates a new Tag instance from a string or object. + * @param {any} [$$source = {}] + * @returns {Tag} + */ + static createFrom($$source = {}) { + const $$createField2_0 = $$createType0; + const $$createField3_0 = $$createType0; + let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source; + if ("Color" in $$parsedSource) { + $$parsedSource["Color"] = $$createField2_0($$parsedSource["Color"]); + } + if ("Icon" in $$parsedSource) { + $$parsedSource["Icon"] = $$createField3_0($$parsedSource["Icon"]); + } + return new Tag(/** @type {Partial} */($$parsedSource)); + } +} + +// Private type creation functions +const $$createType0 = sql$0.NullString.createFrom; diff --git a/frontend/bindings/github.com/nodetec/comet/service/nostrkeyservice.js b/frontend/bindings/github.com/nodetec/comet/service/nostrkeyservice.js new file mode 100644 index 00000000..85623c14 --- /dev/null +++ b/frontend/bindings/github.com/nodetec/comet/service/nostrkeyservice.js @@ -0,0 +1,76 @@ +// @ts-check +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +// eslint-disable-next-line @typescript-eslint/ban-ts-comment +// @ts-ignore: Unused imports +import {Call as $Call, Create as $Create} from "@wailsio/runtime"; + +// eslint-disable-next-line @typescript-eslint/ban-ts-comment +// @ts-ignore: Unused imports +import * as $models from "./models.js"; + +/** + * @param {string} nsec + * @param {string} npub + * @param {boolean} active + * @returns {Promise<$models.NostrKey> & { cancel(): void }} + */ +export function CreateNostrKey(nsec, npub, active) { + let $resultPromise = /** @type {any} */($Call.ByID(450605574, nsec, npub, active)); + let $typingPromise = /** @type {any} */($resultPromise.then(($result) => { + return $$createType0($result); + })); + $typingPromise.cancel = $resultPromise.cancel.bind($resultPromise); + return $typingPromise; +} + +/** + * @param {number} id + * @returns {Promise & { cancel(): void }} + */ +export function DeleteNostrKey(id) { + let $resultPromise = /** @type {any} */($Call.ByID(907990853, id)); + return $resultPromise; +} + +/** + * @param {number} id + * @returns {Promise<$models.NostrKey> & { cancel(): void }} + */ +export function GetNostrKey(id) { + let $resultPromise = /** @type {any} */($Call.ByID(3016819188, id)); + let $typingPromise = /** @type {any} */($resultPromise.then(($result) => { + return $$createType0($result); + })); + $typingPromise.cancel = $resultPromise.cancel.bind($resultPromise); + return $typingPromise; +} + +/** + * @returns {Promise<$models.NostrKey[]> & { cancel(): void }} + */ +export function ListNostrKeys() { + let $resultPromise = /** @type {any} */($Call.ByID(2591303287)); + let $typingPromise = /** @type {any} */($resultPromise.then(($result) => { + return $$createType1($result); + })); + $typingPromise.cancel = $resultPromise.cancel.bind($resultPromise); + return $typingPromise; +} + +/** + * @param {number} id + * @param {string} nsec + * @param {string} npub + * @param {boolean} active + * @returns {Promise & { cancel(): void }} + */ +export function UpdateNostrKey(id, nsec, npub, active) { + let $resultPromise = /** @type {any} */($Call.ByID(3751870067, id, nsec, npub, active)); + return $resultPromise; +} + +// Private type creation functions +const $$createType0 = $models.NostrKey.createFrom; +const $$createType1 = $Create.Array($$createType0); diff --git a/frontend/bindings/github.com/nodetec/comet/service/notebookservice.js b/frontend/bindings/github.com/nodetec/comet/service/notebookservice.js new file mode 100644 index 00000000..e7a6bc0f --- /dev/null +++ b/frontend/bindings/github.com/nodetec/comet/service/notebookservice.js @@ -0,0 +1,127 @@ +// @ts-check +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +// eslint-disable-next-line @typescript-eslint/ban-ts-comment +// @ts-ignore: Unused imports +import {Call as $Call, Create as $Create} from "@wailsio/runtime"; + +// eslint-disable-next-line @typescript-eslint/ban-ts-comment +// @ts-ignore: Unused imports +import * as db$0 from "../db/models.js"; + +/** + * @param {number} notebookID + * @param {number} tagID + * @returns {Promise & { cancel(): void }} + */ +export function AddTagToNotebook(notebookID, tagID) { + let $resultPromise = /** @type {any} */($Call.ByID(2083083162, notebookID, tagID)); + return $resultPromise; +} + +/** + * @param {number} notebookID + * @param {number} tagID + * @returns {Promise & { cancel(): void }} + */ +export function CheckTagForNotebook(notebookID, tagID) { + let $resultPromise = /** @type {any} */($Call.ByID(1901298027, notebookID, tagID)); + return $resultPromise; +} + +/** + * @param {string} name + * @returns {Promise & { cancel(): void }} + */ +export function CreateNotebook(name) { + let $resultPromise = /** @type {any} */($Call.ByID(4169347514, name)); + let $typingPromise = /** @type {any} */($resultPromise.then(($result) => { + return $$createType0($result); + })); + $typingPromise.cancel = $resultPromise.cancel.bind($resultPromise); + return $typingPromise; +} + +/** + * @param {number} id + * @returns {Promise & { cancel(): void }} + */ +export function DeleteNotebook(id) { + let $resultPromise = /** @type {any} */($Call.ByID(588830629, id)); + return $resultPromise; +} + +/** + * @param {number} id + * @returns {Promise & { cancel(): void }} + */ +export function GetNotebook(id) { + let $resultPromise = /** @type {any} */($Call.ByID(2651103660, id)); + let $typingPromise = /** @type {any} */($resultPromise.then(($result) => { + return $$createType0($result); + })); + $typingPromise.cancel = $resultPromise.cancel.bind($resultPromise); + return $typingPromise; +} + +/** + * @param {number} notebookID + * @returns {Promise & { cancel(): void }} + */ +export function GetTagsForNotebook(notebookID) { + let $resultPromise = /** @type {any} */($Call.ByID(1666855918, notebookID)); + let $typingPromise = /** @type {any} */($resultPromise.then(($result) => { + return $$createType2($result); + })); + $typingPromise.cancel = $resultPromise.cancel.bind($resultPromise); + return $typingPromise; +} + +/** + * @returns {Promise & { cancel(): void }} + */ +export function ListNotebooks() { + let $resultPromise = /** @type {any} */($Call.ByID(595334731)); + let $typingPromise = /** @type {any} */($resultPromise.then(($result) => { + return $$createType3($result); + })); + $typingPromise.cancel = $resultPromise.cancel.bind($resultPromise); + return $typingPromise; +} + +/** + * @param {number} notebookID + * @returns {Promise & { cancel(): void }} + */ +export function RemoveAllTagsFromNotebook(notebookID) { + let $resultPromise = /** @type {any} */($Call.ByID(2397072902, notebookID)); + return $resultPromise; +} + +/** + * @param {number} notebookID + * @param {number} tagID + * @returns {Promise & { cancel(): void }} + */ +export function RemoveTagFromNotebook(notebookID, tagID) { + let $resultPromise = /** @type {any} */($Call.ByID(2184813900, notebookID, tagID)); + return $resultPromise; +} + +/** + * @param {number} id + * @param {string} name + * @param {string} createdAt + * @returns {Promise & { cancel(): void }} + */ +export function UpdateNotebook(id, name, createdAt) { + let $resultPromise = /** @type {any} */($Call.ByID(1306217847, id, name, createdAt)); + return $resultPromise; +} + +// Private type creation functions +const $$createType0 = db$0.Notebook.createFrom; +const $$createType1 = db$0.Tag.createFrom; +const $$createType2 = $Create.Array($$createType1); +const $$createType3 = $Create.Array($$createType0); diff --git a/frontend/bindings/github.com/nodetec/comet/service/noteservice.js b/frontend/bindings/github.com/nodetec/comet/service/noteservice.js new file mode 100644 index 00000000..13b3496e --- /dev/null +++ b/frontend/bindings/github.com/nodetec/comet/service/noteservice.js @@ -0,0 +1,208 @@ +// @ts-check +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +// eslint-disable-next-line @typescript-eslint/ban-ts-comment +// @ts-ignore: Unused imports +import {Call as $Call, Create as $Create} from "@wailsio/runtime"; + +// eslint-disable-next-line @typescript-eslint/ban-ts-comment +// @ts-ignore: Unused imports +import * as sql$0 from "../../../../database/sql/models.js"; +// eslint-disable-next-line @typescript-eslint/ban-ts-comment +// @ts-ignore: Unused imports +import * as db$0 from "../db/models.js"; + +/** + * @param {db$0.Note} note + * @param {db$0.Tag[]} tags + * @returns {Promise & { cancel(): void }} + */ +export function AddNoteToTrash(note, tags) { + let $resultPromise = /** @type {any} */($Call.ByID(36748134, note, tags)); + return $resultPromise; +} + +/** + * @param {string} title + * @param {string} content + * @param {number} notebookID + * @param {sql$0.NullInt64} statusID + * @param {sql$0.NullString} publishedAt + * @param {sql$0.NullString} eventId + * @param {string} notetype + * @param {string} filetype + * @returns {Promise & { cancel(): void }} + */ +export function CreateNote(title, content, notebookID, statusID, publishedAt, eventId, notetype, filetype) { + let $resultPromise = /** @type {any} */($Call.ByID(3651584158, title, content, notebookID, statusID, publishedAt, eventId, notetype, filetype)); + let $typingPromise = /** @type {any} */($resultPromise.then(($result) => { + return $$createType0($result); + })); + $typingPromise.cancel = $resultPromise.cancel.bind($resultPromise); + return $typingPromise; +} + +/** + * @param {number} id + * @returns {Promise & { cancel(): void }} + */ +export function DeleteNote(id) { + let $resultPromise = /** @type {any} */($Call.ByID(1854972521, id)); + return $resultPromise; +} + +/** + * @param {number} id + * @returns {Promise & { cancel(): void }} + */ +export function DeleteNoteFromTrash(id) { + let $resultPromise = /** @type {any} */($Call.ByID(1832826689, id)); + return $resultPromise; +} + +/** + * @param {number} id + * @returns {Promise & { cancel(): void }} + */ +export function GetNote(id) { + let $resultPromise = /** @type {any} */($Call.ByID(1230348126, id)); + let $typingPromise = /** @type {any} */($resultPromise.then(($result) => { + return $$createType0($result); + })); + $typingPromise.cancel = $resultPromise.cancel.bind($resultPromise); + return $typingPromise; +} + +/** + * @param {number} id + * @returns {Promise & { cancel(): void }} + */ +export function GetNoteFromTrash(id) { + let $resultPromise = /** @type {any} */($Call.ByID(1889602112, id)); + let $typingPromise = /** @type {any} */($resultPromise.then(($result) => { + return $$createType1($result); + })); + $typingPromise.cancel = $resultPromise.cancel.bind($resultPromise); + return $typingPromise; +} + +/** + * @param {number} notebookId + * @param {number} tagId + * @param {number} limit + * @param {number} pageParam + * @param {string} orderBy + * @param {string} sortDirection + * @returns {Promise & { cancel(): void }} + */ +export function ListNotes(notebookId, tagId, limit, pageParam, orderBy, sortDirection) { + let $resultPromise = /** @type {any} */($Call.ByID(1572240871, notebookId, tagId, limit, pageParam, orderBy, sortDirection)); + let $typingPromise = /** @type {any} */($resultPromise.then(($result) => { + return $$createType2($result); + })); + $typingPromise.cancel = $resultPromise.cancel.bind($resultPromise); + return $typingPromise; +} + +/** + * @param {number} limit + * @param {number} pageParam + * @param {string} orderBy + * @param {string} sortDirection + * @returns {Promise & { cancel(): void }} + */ +export function ListNotesFromTrash(limit, pageParam, orderBy, sortDirection) { + let $resultPromise = /** @type {any} */($Call.ByID(3661159223, limit, pageParam, orderBy, sortDirection)); + let $typingPromise = /** @type {any} */($resultPromise.then(($result) => { + return $$createType4($result); + })); + $typingPromise.cancel = $resultPromise.cancel.bind($resultPromise); + return $typingPromise; +} + +/** + * @param {number} noteId + * @param {string} title + * @param {string} content + * @param {number} notebookID + * @param {sql$0.NullInt64} statusID + * @param {string} createdAt + * @param {string} modifiedAt + * @param {sql$0.NullString} publishedAt + * @param {sql$0.NullString} eventId + * @param {string} notetype + * @param {string} filetype + * @param {number[]} tagIds + * @returns {Promise & { cancel(): void }} + */ +export function RestoreNoteFromTrash(noteId, title, content, notebookID, statusID, createdAt, modifiedAt, publishedAt, eventId, notetype, filetype, tagIds) { + let $resultPromise = /** @type {any} */($Call.ByID(3762311242, noteId, title, content, notebookID, statusID, createdAt, modifiedAt, publishedAt, eventId, notetype, filetype, tagIds)); + let $typingPromise = /** @type {any} */($resultPromise.then(($result) => { + return $$createType5($result); + })); + $typingPromise.cancel = $resultPromise.cancel.bind($resultPromise); + return $typingPromise; +} + +/** + * @param {string} searchTerm + * @param {number} notebookID + * @param {number} tagID + * @param {number} limit + * @param {number} pageParam + * @param {string} orderBy + * @param {string} sortDirection + * @returns {Promise & { cancel(): void }} + */ +export function SearchNotes(searchTerm, notebookID, tagID, limit, pageParam, orderBy, sortDirection) { + let $resultPromise = /** @type {any} */($Call.ByID(2746264403, searchTerm, notebookID, tagID, limit, pageParam, orderBy, sortDirection)); + let $typingPromise = /** @type {any} */($resultPromise.then(($result) => { + return $$createType2($result); + })); + $typingPromise.cancel = $resultPromise.cancel.bind($resultPromise); + return $typingPromise; +} + +/** + * @param {string} searchTerm + * @param {number} limit + * @param {number} pageParam + * @param {string} orderBy + * @param {string} sortDirection + * @returns {Promise & { cancel(): void }} + */ +export function SearchTrash(searchTerm, limit, pageParam, orderBy, sortDirection) { + let $resultPromise = /** @type {any} */($Call.ByID(3538009948, searchTerm, limit, pageParam, orderBy, sortDirection)); + let $typingPromise = /** @type {any} */($resultPromise.then(($result) => { + return $$createType4($result); + })); + $typingPromise.cancel = $resultPromise.cancel.bind($resultPromise); + return $typingPromise; +} + +/** + * @param {number} id + * @param {string} title + * @param {string} content + * @param {number} notebookID + * @param {sql$0.NullInt64} statusID + * @param {boolean} published + * @param {sql$0.NullString} eventId + * @param {boolean} pinned + * @param {string} notetype + * @param {string} filetype + * @returns {Promise & { cancel(): void }} + */ +export function UpdateNote(id, title, content, notebookID, statusID, published, eventId, pinned, notetype, filetype) { + let $resultPromise = /** @type {any} */($Call.ByID(518540175, id, title, content, notebookID, statusID, published, eventId, pinned, notetype, filetype)); + return $resultPromise; +} + +// Private type creation functions +const $$createType0 = db$0.Note.createFrom; +const $$createType1 = db$0.GetNoteFromTrashRow.createFrom; +const $$createType2 = $Create.Array($$createType0); +const $$createType3 = db$0.Trash.createFrom; +const $$createType4 = $Create.Array($$createType3); +const $$createType5 = db$0.CreateNoteFromTrashRow.createFrom; diff --git a/frontend/bindings/github.com/nodetec/comet/service/notetagservice.js b/frontend/bindings/github.com/nodetec/comet/service/notetagservice.js new file mode 100644 index 00000000..5acea8ce --- /dev/null +++ b/frontend/bindings/github.com/nodetec/comet/service/notetagservice.js @@ -0,0 +1,58 @@ +// @ts-check +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +// eslint-disable-next-line @typescript-eslint/ban-ts-comment +// @ts-ignore: Unused imports +import {Call as $Call, Create as $Create} from "@wailsio/runtime"; + +// eslint-disable-next-line @typescript-eslint/ban-ts-comment +// @ts-ignore: Unused imports +import * as db$0 from "../db/models.js"; + +/** + * @param {number} noteID + * @param {number} tagID + * @returns {Promise & { cancel(): void }} + */ +export function AddTagToNote(noteID, tagID) { + let $resultPromise = /** @type {any} */($Call.ByID(2643393932, noteID, tagID)); + return $resultPromise; +} + +/** + * @param {number} noteID + * @param {number} tagID + * @returns {Promise & { cancel(): void }} + */ +export function CheckTagForNote(noteID, tagID) { + let $resultPromise = /** @type {any} */($Call.ByID(1794760311, noteID, tagID)); + return $resultPromise; +} + +/** + * @param {number} noteID + * @returns {Promise & { cancel(): void }} + */ +export function GetTagsForNote(noteID) { + let $resultPromise = /** @type {any} */($Call.ByID(2728210140, noteID)); + let $typingPromise = /** @type {any} */($resultPromise.then(($result) => { + return $$createType1($result); + })); + $typingPromise.cancel = $resultPromise.cancel.bind($resultPromise); + return $typingPromise; +} + +/** + * @param {number} noteID + * @param {number} tagID + * @returns {Promise & { cancel(): void }} + */ +export function RemoveTagFromNote(noteID, tagID) { + let $resultPromise = /** @type {any} */($Call.ByID(3246519988, noteID, tagID)); + return $resultPromise; +} + +// Private type creation functions +const $$createType0 = db$0.Tag.createFrom; +const $$createType1 = $Create.Array($$createType0); diff --git a/frontend/bindings/github.com/nodetec/comet/service/relayservice.js b/frontend/bindings/github.com/nodetec/comet/service/relayservice.js new file mode 100644 index 00000000..dcd576fb --- /dev/null +++ b/frontend/bindings/github.com/nodetec/comet/service/relayservice.js @@ -0,0 +1,77 @@ +// @ts-check +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +// eslint-disable-next-line @typescript-eslint/ban-ts-comment +// @ts-ignore: Unused imports +import {Call as $Call, Create as $Create} from "@wailsio/runtime"; + +// eslint-disable-next-line @typescript-eslint/ban-ts-comment +// @ts-ignore: Unused imports +import * as $models from "./models.js"; + +/** + * @param {string} url + * @param {boolean} read + * @param {boolean} write + * @param {boolean} sync + * @returns {Promise<$models.Relay> & { cancel(): void }} + */ +export function CreateRelay(url, read, write, sync) { + let $resultPromise = /** @type {any} */($Call.ByID(2564037930, url, read, write, sync)); + let $typingPromise = /** @type {any} */($resultPromise.then(($result) => { + return $$createType0($result); + })); + $typingPromise.cancel = $resultPromise.cancel.bind($resultPromise); + return $typingPromise; +} + +/** + * @returns {Promise & { cancel(): void }} + */ +export function DeleteRelays() { + let $resultPromise = /** @type {any} */($Call.ByID(4014153816)); + return $resultPromise; +} + +/** + * @param {number} id + * @returns {Promise<$models.Relay> & { cancel(): void }} + */ +export function GetRelay(id) { + let $resultPromise = /** @type {any} */($Call.ByID(2570438932, id)); + let $typingPromise = /** @type {any} */($resultPromise.then(($result) => { + return $$createType0($result); + })); + $typingPromise.cancel = $resultPromise.cancel.bind($resultPromise); + return $typingPromise; +} + +/** + * @returns {Promise<$models.Relay[]> & { cancel(): void }} + */ +export function ListRelays() { + let $resultPromise = /** @type {any} */($Call.ByID(377038031)); + let $typingPromise = /** @type {any} */($resultPromise.then(($result) => { + return $$createType1($result); + })); + $typingPromise.cancel = $resultPromise.cancel.bind($resultPromise); + return $typingPromise; +} + +/** + * @param {number} id + * @param {string} url + * @param {boolean} read + * @param {boolean} write + * @param {boolean} sync + * @returns {Promise & { cancel(): void }} + */ +export function UpdateRelay(id, url, read, write, sync) { + let $resultPromise = /** @type {any} */($Call.ByID(1832504309, id, url, read, write, sync)); + return $resultPromise; +} + +// Private type creation functions +const $$createType0 = $models.Relay.createFrom; +const $$createType1 = $Create.Array($$createType0); diff --git a/frontend/bindings/github.com/nodetec/comet/service/settingservice.js b/frontend/bindings/github.com/nodetec/comet/service/settingservice.js new file mode 100644 index 00000000..1eb447e2 --- /dev/null +++ b/frontend/bindings/github.com/nodetec/comet/service/settingservice.js @@ -0,0 +1,45 @@ +// @ts-check +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +// eslint-disable-next-line @typescript-eslint/ban-ts-comment +// @ts-ignore: Unused imports +import {Call as $Call, Create as $Create} from "@wailsio/runtime"; + +// eslint-disable-next-line @typescript-eslint/ban-ts-comment +// @ts-ignore: Unused imports +import * as $models from "./models.js"; + +/** + * @returns {Promise<$models.Settings> & { cancel(): void }} + */ +export function GetAllSettings() { + let $resultPromise = /** @type {any} */($Call.ByID(1346639610)); + let $typingPromise = /** @type {any} */($resultPromise.then(($result) => { + return $$createType0($result); + })); + $typingPromise.cancel = $resultPromise.cancel.bind($resultPromise); + return $typingPromise; +} + +/** + * @param {string} key + * @returns {Promise & { cancel(): void }} + */ +export function GetSetting(key) { + let $resultPromise = /** @type {any} */($Call.ByID(1317242856, key)); + return $resultPromise; +} + +/** + * @param {string} key + * @param {string} value + * @returns {Promise & { cancel(): void }} + */ +export function UpdateSetting(key, value) { + let $resultPromise = /** @type {any} */($Call.ByID(2612065271, key, value)); + return $resultPromise; +} + +// Private type creation functions +const $$createType0 = $models.Settings.createFrom; diff --git a/frontend/bindings/github.com/nodetec/comet/service/tagservice.js b/frontend/bindings/github.com/nodetec/comet/service/tagservice.js new file mode 100644 index 00000000..56c0a2e6 --- /dev/null +++ b/frontend/bindings/github.com/nodetec/comet/service/tagservice.js @@ -0,0 +1,108 @@ +// @ts-check +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +// eslint-disable-next-line @typescript-eslint/ban-ts-comment +// @ts-ignore: Unused imports +import {Call as $Call, Create as $Create} from "@wailsio/runtime"; + +// eslint-disable-next-line @typescript-eslint/ban-ts-comment +// @ts-ignore: Unused imports +import * as sql$0 from "../../../../database/sql/models.js"; + +// eslint-disable-next-line @typescript-eslint/ban-ts-comment +// @ts-ignore: Unused imports +import * as $models from "./models.js"; + +/** + * @param {string} name + * @param {sql$0.NullString} color + * @param {sql$0.NullString} icon + * @param {string} createdAt + * @returns {Promise<$models.Tag> & { cancel(): void }} + */ +export function CreateTag(name, color, icon, createdAt) { + let $resultPromise = /** @type {any} */($Call.ByID(4191103332, name, color, icon, createdAt)); + let $typingPromise = /** @type {any} */($resultPromise.then(($result) => { + return $$createType0($result); + })); + $typingPromise.cancel = $resultPromise.cancel.bind($resultPromise); + return $typingPromise; +} + +/** + * @param {number} id + * @returns {Promise & { cancel(): void }} + */ +export function DeleteTag(id) { + let $resultPromise = /** @type {any} */($Call.ByID(1411090129, id)); + return $resultPromise; +} + +/** + * @param {number} id + * @returns {Promise<$models.Tag> & { cancel(): void }} + */ +export function GetTag(id) { + let $resultPromise = /** @type {any} */($Call.ByID(2029176156, id)); + let $typingPromise = /** @type {any} */($resultPromise.then(($result) => { + return $$createType0($result); + })); + $typingPromise.cancel = $resultPromise.cancel.bind($resultPromise); + return $typingPromise; +} + +/** + * @param {string} name + * @returns {Promise<$models.Tag> & { cancel(): void }} + */ +export function GetTagByName(name) { + let $resultPromise = /** @type {any} */($Call.ByID(1160743666, name)); + let $typingPromise = /** @type {any} */($resultPromise.then(($result) => { + return $$createType0($result); + })); + $typingPromise.cancel = $resultPromise.cancel.bind($resultPromise); + return $typingPromise; +} + +/** + * @param {string[]} names + * @returns {Promise<$models.Tag[]> & { cancel(): void }} + */ +export function GetTagsByNames(names) { + let $resultPromise = /** @type {any} */($Call.ByID(1226187244, names)); + let $typingPromise = /** @type {any} */($resultPromise.then(($result) => { + return $$createType1($result); + })); + $typingPromise.cancel = $resultPromise.cancel.bind($resultPromise); + return $typingPromise; +} + +/** + * @returns {Promise<$models.Tag[]> & { cancel(): void }} + */ +export function ListTags() { + let $resultPromise = /** @type {any} */($Call.ByID(342385689)); + let $typingPromise = /** @type {any} */($resultPromise.then(($result) => { + return $$createType1($result); + })); + $typingPromise.cancel = $resultPromise.cancel.bind($resultPromise); + return $typingPromise; +} + +/** + * @param {number} id + * @param {string} name + * @param {sql$0.NullString} color + * @param {sql$0.NullString} icon + * @param {string} createdAt + * @returns {Promise & { cancel(): void }} + */ +export function UpdateTag(id, name, color, icon, createdAt) { + let $resultPromise = /** @type {any} */($Call.ByID(3312250639, id, name, color, icon, createdAt)); + return $resultPromise; +} + +// Private type creation functions +const $$createType0 = $models.Tag.createFrom; +const $$createType1 = $Create.Array($$createType0); diff --git a/frontend/tailwind.config.js b/frontend/tailwind.config.ts similarity index 85% rename from frontend/tailwind.config.js rename to frontend/tailwind.config.ts index 0fa16dbf..3ea64aa2 100644 --- a/frontend/tailwind.config.js +++ b/frontend/tailwind.config.ts @@ -1,5 +1,9 @@ -/** @type {import('tailwindcss').Config} */ -module.exports = { +/* eslint-disable @typescript-eslint/no-unsafe-assignment */ +/* eslint-disable @typescript-eslint/no-require-imports */ + +import { Config } from "tailwindcss"; + +const config: Config = { darkMode: ["class"], content: [ "./pages/**/*.{ts,tsx}", @@ -74,11 +78,8 @@ module.exports = { typography: { DEFAULT: { css: { - // Target all images within Prose img: { - // Change the display property to inline display: "inline", - // Optionally adjust vertical alignment "vertical-align": "middle", "margin-top": "0.5em", "margin-bottom": "0.5em", @@ -86,9 +87,9 @@ module.exports = { "margin-right": "0.25em", }, h2: { - "margin-top": "1.5em", // Adjust the top margin - "margin-bottom": "1em", // Adjust the bottom margin - padding: "0", // Remove any padding if necessary + "margin-top": "1.5em", + "margin-bottom": "1em", + padding: "0", }, }, }, @@ -97,3 +98,5 @@ module.exports = { }, plugins: [require("@tailwindcss/typography"), require("tailwindcss-animate")], }; + +export default config; diff --git a/go.mod b/go.mod index db9c1dde..e21acfec 100644 --- a/go.mod +++ b/go.mod @@ -3,25 +3,25 @@ module github.com/nodetec/comet go 1.22.4 require ( - github.com/adrg/xdg v0.4.0 + github.com/adrg/xdg v0.5.0 github.com/mattn/go-sqlite3 v1.14.22 github.com/pressly/goose/v3 v3.21.1 github.com/wailsapp/wails/v3 v3.0.0-alpha.4 ) require ( - dario.cat/mergo v1.0.0 // indirect + dario.cat/mergo v1.0.1 // indirect github.com/Microsoft/go-winio v0.6.1 // indirect - github.com/ProtonMail/go-crypto v0.0.0-20230828082145-3c4c8a2d2371 // indirect + github.com/ProtonMail/go-crypto v1.0.0 // indirect github.com/bep/debounce v1.2.1 // indirect - github.com/cloudflare/circl v1.3.7 // indirect - github.com/cyphar/filepath-securejoin v0.2.4 // indirect + github.com/cloudflare/circl v1.3.8 // indirect + github.com/cyphar/filepath-securejoin v0.2.5 // indirect github.com/ebitengine/purego v0.4.0-alpha.4 // indirect github.com/emirpasic/gods v1.18.1 // indirect github.com/go-git/gcfg v1.5.1-0.20230307220236-3a3c6141e376 // indirect - github.com/go-git/go-billy/v5 v5.5.0 // indirect - github.com/go-git/go-git/v5 v5.11.0 // indirect - github.com/go-ole/go-ole v1.2.6 // indirect + github.com/go-git/go-billy/v5 v5.6.0 // indirect + github.com/go-git/go-git/v5 v5.12.0 // indirect + github.com/go-ole/go-ole v1.3.0 // indirect github.com/godbus/dbus/v5 v5.1.0 // indirect github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect github.com/google/uuid v1.6.0 // indirect @@ -38,20 +38,20 @@ require ( github.com/pkg/browser v0.0.0-20210911075715-681adbf594b8 // indirect github.com/rivo/uniseg v0.4.7 // indirect github.com/samber/lo v1.38.1 // indirect - github.com/sergi/go-diff v1.2.0 // indirect + github.com/sergi/go-diff v1.3.2-0.20230802210424-5b0b94c5c0d3 // indirect github.com/sethvargo/go-retry v0.2.4 // indirect - github.com/skeema/knownhosts v1.2.1 // indirect - github.com/wailsapp/go-webview2 v1.0.16 // indirect + github.com/skeema/knownhosts v1.2.2 // indirect + github.com/wailsapp/go-webview2 v1.0.18 // indirect github.com/wailsapp/mimetype v1.4.1 // indirect github.com/xanzy/ssh-agent v0.3.3 // indirect go.uber.org/multierr v1.11.0 // indirect - golang.org/x/crypto v0.23.0 // indirect - golang.org/x/exp v0.0.0-20240325151524-a685a6edb6d8 // indirect - golang.org/x/mod v0.17.0 // indirect - golang.org/x/net v0.25.0 // indirect - golang.org/x/sync v0.8.0 // indirect - golang.org/x/sys v0.20.0 // indirect - golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d // indirect + golang.org/x/crypto v0.25.0 // indirect + golang.org/x/exp v0.0.0-20240719175910-8a7402abbf56 // indirect + golang.org/x/mod v0.19.0 // indirect + golang.org/x/net v0.27.0 // indirect + golang.org/x/sync v0.9.0 // indirect + golang.org/x/sys v0.28.0 // indirect + golang.org/x/tools v0.23.0 // indirect gopkg.in/warnings.v0 v0.1.2 // indirect ) diff --git a/main.go b/main.go index 31c48311..ee025e81 100644 --- a/main.go +++ b/main.go @@ -104,7 +104,7 @@ func main() { URL: "/", MinWidth: 500, MinHeight: 250, - Centered: true, + // Centered: true, BackgroundColour: application.NewRGB(27, 38, 54), Mac: application.MacWindow{ InvisibleTitleBarHeight: 50,