@niyamulahsan/create-deskapp 0.0.0-stage → 1.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (132) hide show
  1. package/README.md +33 -2
  2. package/bin/create.js +136 -0
  3. package/package.json +14 -4
  4. package/template/.env +13 -0
  5. package/template/.env.example +13 -0
  6. package/template/.vscode/extensions.json +6 -0
  7. package/template/.vscode/settings.json +37 -0
  8. package/template/LICENSE +21 -0
  9. package/template/README.md +29 -0
  10. package/template/biome.json +99 -0
  11. package/template/drizzle.config.ts +32 -0
  12. package/template/gitignore-stub +19 -0
  13. package/template/package.json +111 -0
  14. package/template/scripts/build-electron.mjs +55 -0
  15. package/template/scripts/dev-electron.mjs +53 -0
  16. package/template/scripts/installer.nsh +14 -0
  17. package/template/src/config/app.ts +24 -0
  18. package/template/src/core/api/bindings.generated.ts +23 -0
  19. package/template/src/core/api/generate.manifest.ts +86 -0
  20. package/template/src/core/api/registry.ts +48 -0
  21. package/template/src/core/config.ts +99 -0
  22. package/template/src/core/database/aggregate.ts +85 -0
  23. package/template/src/core/database/config.ts +48 -0
  24. package/template/src/core/database/connection.ts +114 -0
  25. package/template/src/core/database/migrate-hooks.ts +84 -0
  26. package/template/src/core/database/paginate.ts +224 -0
  27. package/template/src/core/database/reset.ts +19 -0
  28. package/template/src/core/database/seed.ts +169 -0
  29. package/template/src/core/database/status.ts +32 -0
  30. package/template/src/core/env.ts +106 -0
  31. package/template/src/core/facade.ts +59 -0
  32. package/template/src/core/maker/db/fresh.ts +8 -0
  33. package/template/src/core/maker/db/generate.ts +11 -0
  34. package/template/src/core/maker/db/helpers.ts +96 -0
  35. package/template/src/core/maker/db/migrate.ts +36 -0
  36. package/template/src/core/maker/db/mod.ts +63 -0
  37. package/template/src/core/maker/db/module-migrate.ts +53 -0
  38. package/template/src/core/maker/db/push.ts +21 -0
  39. package/template/src/core/maker/db/reset.ts +6 -0
  40. package/template/src/core/maker/db/seed.ts +7 -0
  41. package/template/src/core/maker/db/status.ts +6 -0
  42. package/template/src/core/maker/help.ts +66 -0
  43. package/template/src/core/maker/make/controller.ts +27 -0
  44. package/template/src/core/maker/make/helpers.ts +93 -0
  45. package/template/src/core/maker/make/mod.ts +68 -0
  46. package/template/src/core/maker/make/model.ts +14 -0
  47. package/template/src/core/maker/make/module.ts +62 -0
  48. package/template/src/core/maker/make/seeder.ts +21 -0
  49. package/template/src/core/maker/make/test.ts +30 -0
  50. package/template/src/core/maker/mod.ts +83 -0
  51. package/template/src/core/maker/run/mod.ts +112 -0
  52. package/template/src/core/maker/stub.ts +24 -0
  53. package/template/src/core/maker/stubs/controller/controller.controller.stub +55 -0
  54. package/template/src/core/maker/stubs/controller/controller.schema.stub +13 -0
  55. package/template/src/core/maker/stubs/model/model.stub +8 -0
  56. package/template/src/core/maker/stubs/seeder/seeder.stub +16 -0
  57. package/template/src/core/maker/stubs/test/test.stub +7 -0
  58. package/template/src/core/maker/sync-config.ts +94 -0
  59. package/template/src/core/utils/password.ts +27 -0
  60. package/template/src/core/utils/playwright.ts +121 -0
  61. package/template/src/core/utils/queue.ts +59 -0
  62. package/template/src/core/utils/scheduler.ts +70 -0
  63. package/template/src/core/utils/storage.ts +599 -0
  64. package/template/src/core/utils/validation.ts +35 -0
  65. package/template/src/database/migrations/sqlite/meta/_journal.json +1 -0
  66. package/template/src/database/schema.ts +6 -0
  67. package/template/src/icons/apple-touch-icon.png +0 -0
  68. package/template/src/icons/deskapp.png +0 -0
  69. package/template/src/icons/favicon-96x96.png +0 -0
  70. package/template/src/icons/favicon.ico +0 -0
  71. package/template/src/icons/favicon.svg +1 -0
  72. package/template/src/icons/site.webmanifest +21 -0
  73. package/template/src/icons/tray.png +0 -0
  74. package/template/src/icons/web-app-manifest-192x192.png +0 -0
  75. package/template/src/icons/web-app-manifest-512x512.png +0 -0
  76. package/template/src/main.ts +116 -0
  77. package/template/src/modules/app/controllers/demo.controller.ts +118 -0
  78. package/template/src/modules/app/controllers/net.controller.ts +48 -0
  79. package/template/src/modules/app/controllers/playwright.controller.ts +140 -0
  80. package/template/src/modules/app/controllers/storage.controller.ts +229 -0
  81. package/template/src/modules/app/controllers/window.controller.ts +107 -0
  82. package/template/src/preload.ts +35 -0
  83. package/template/src/storage/.gitkeep +1 -0
  84. package/template/src/storage/app/private/.gitkeep +1 -0
  85. package/template/src/storage/app/private/samples/.gitkeep +1 -0
  86. package/template/src/storage/app/private/samples/state.json +5 -0
  87. package/template/src/storage/app/private/uploads/.gitkeep +1 -0
  88. package/template/src/storage/app/public/.gitkeep +1 -0
  89. package/template/src/storage/app/tmp/generated/.gitkeep +1 -0
  90. package/template/src/storage/logs/.gitkeep +0 -0
  91. package/template/src/storage/logs/app.log +0 -0
  92. package/template/src/storage/logs/fatal.log +0 -0
  93. package/template/src/ui/.vscode/extensions.json +3 -0
  94. package/template/src/ui/index.html +14 -0
  95. package/template/src/ui/public/icons.svg +24 -0
  96. package/template/src/ui/src/App.vue +3 -0
  97. package/template/src/ui/src/app.ts +23 -0
  98. package/template/src/ui/src/assets/fonts/public-sans/public-sans-latin-ext.woff2 +0 -0
  99. package/template/src/ui/src/assets/fonts/public-sans/public-sans-latin.woff2 +0 -0
  100. package/template/src/ui/src/assets/images/deskapp.png +0 -0
  101. package/template/src/ui/src/assets/images/favicon/favicon.ico +0 -0
  102. package/template/src/ui/src/assets/scss/custom.scss +186 -0
  103. package/template/src/ui/src/bindings.d.ts +16 -0
  104. package/template/src/ui/src/components/Button.vue +32 -0
  105. package/template/src/ui/src/components/Checkbox.vue +29 -0
  106. package/template/src/ui/src/components/Input.vue +227 -0
  107. package/template/src/ui/src/components/Modal.vue +55 -0
  108. package/template/src/ui/src/components/Spinner.vue +42 -0
  109. package/template/src/ui/src/components/Switch.vue +65 -0
  110. package/template/src/ui/src/components/TextArea.vue +121 -0
  111. package/template/src/ui/src/components/Toast.vue +56 -0
  112. package/template/src/ui/src/components/datatable/DataTableSkeleton.vue +98 -0
  113. package/template/src/ui/src/components/datatable/Pagination.vue +125 -0
  114. package/template/src/ui/src/components/datatable/SelectOpption.vue +35 -0
  115. package/template/src/ui/src/components/datatable/index.vue +258 -0
  116. package/template/src/ui/src/env.d.ts +13 -0
  117. package/template/src/ui/src/global.d.ts +35 -0
  118. package/template/src/ui/src/helpers/nformatter.ts +10 -0
  119. package/template/src/ui/src/pages/dashboard/index.vue +687 -0
  120. package/template/src/ui/src/plugins/gum.ts +549 -0
  121. package/template/src/ui/src/plugins/gum.ts.bak +683 -0
  122. package/template/src/ui/src/plugins/pulse.ts +148 -0
  123. package/template/src/ui/src/router/index.ts +25 -0
  124. package/template/src/ui/src/stores/example.ts +27 -0
  125. package/template/src/ui/tsconfig.json +15 -0
  126. package/template/src/ui/vite.config.ts +38 -0
  127. package/template/src/window/config.ts +71 -0
  128. package/template/src/window/dialogs.ts +67 -0
  129. package/template/src/window/manager.ts +139 -0
  130. package/template/src/window/native.ts +215 -0
  131. package/template/tsconfig.json +22 -0
  132. package/template/vitest.config.ts +34 -0
package/README.md CHANGED
@@ -1,3 +1,34 @@
1
- # Temporary Holding Version
1
+ # create-deskapp
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ Scaffold a new Deskapp project with Electron + Vue 3 + npm.
4
+
5
+ ## Usage
6
+
7
+ ```bash
8
+ npm create deskapp@latest my-app
9
+ # or
10
+ npx create-deskapp my-app
11
+ ```
12
+
13
+ Then:
14
+
15
+ ```bash
16
+ cd my-app
17
+ npm install
18
+ npm run dev
19
+ ```
20
+
21
+ ## Features
22
+
23
+ - Electron main process + Vue 3 renderer
24
+ - IPC bindings for in-process backend/frontend communication
25
+ - SQLite + Drizzle ORM
26
+ - Queue, scheduler, storage utilities
27
+ - Native windows, menus, dialogs, file pickers
28
+ - Playwright support for automation
29
+ - Hot reload in development
30
+ - Package with electron-builder
31
+
32
+ ## Documentation
33
+
34
+ See the [main repository](https://github.com/niyamulahsan/deskapp) for full documentation.
package/bin/create.js ADDED
@@ -0,0 +1,136 @@
1
+ #!/usr/bin/env node
2
+
3
+ import { readFileSync, existsSync, cpSync, mkdirSync, writeFileSync, renameSync, readdirSync } from "node:fs";
4
+ import { join, dirname, basename } from "node:path";
5
+ import { fileURLToPath } from "node:url";
6
+
7
+ const __dirname = dirname(fileURLToPath(import.meta.url));
8
+ const PKG_PATH = join(__dirname, "..", "package.json");
9
+ const TEMPLATE_DIR = join(__dirname, "..", "template");
10
+
11
+ const pkg = JSON.parse(readFileSync(PKG_PATH, "utf-8"));
12
+
13
+ async function ask(query) {
14
+ const rl = (await import("node:readline")).createInterface({ input: process.stdin, output: process.stdout });
15
+ return new Promise((resolve) => rl.question(query, (a) => { rl.close(); resolve(a.trim()); }));
16
+ }
17
+
18
+ function isValidProjectName(name) {
19
+ return /^[a-z0-9@][a-z0-9._-]*$/i.test(name);
20
+ }
21
+
22
+ function resolveTargetDir(name) {
23
+ const cwd = process.cwd();
24
+ if (name === ".") {
25
+ const entries = readdirSync(cwd);
26
+ if (entries.length > 0) {
27
+ console.error(`Error: Current directory "${basename(cwd)}" is not empty.`);
28
+ console.error(" Scaffolding into '.' requires an empty directory so existing files are not overwritten.");
29
+ process.exit(1);
30
+ }
31
+ return cwd;
32
+ }
33
+ const dir = join(cwd, name);
34
+ if (existsSync(dir)) {
35
+ console.error(`Error: Directory "${name}" already exists.`);
36
+ process.exit(1);
37
+ }
38
+ return dir;
39
+ }
40
+
41
+ function parseArgs(argv) {
42
+ const args = { force: false };
43
+ for (const a of argv) {
44
+ if (a === "--force" || a === "-f") args.force = true;
45
+ else if (!a.startsWith("--")) args.name = a;
46
+ }
47
+ return args;
48
+ }
49
+
50
+ async function main() {
51
+ const { name, force } = parseArgs(process.argv.slice(2));
52
+
53
+ if (process.argv.includes("--help") || process.argv.includes("-h")) {
54
+ console.log(`create-deskapp v${pkg.version}`);
55
+ console.log();
56
+ console.log("Usage:");
57
+ console.log(" npm create deskapp@latest <project-name|.> [--force]");
58
+ console.log(" npx create-deskapp <project-name|.> [--force]");
59
+ console.log();
60
+ console.log("Options:");
61
+ console.log(" -f, --force Overwrite existing directory");
62
+ console.log(" -h, --help Show this help");
63
+ process.exit(0);
64
+ }
65
+
66
+ let projectName = name;
67
+ if (!projectName) {
68
+ if (!process.stdin.isTTY) {
69
+ console.error("Error: Please provide a project name or '.' to scaffold into the current directory.");
70
+ process.exit(1);
71
+ }
72
+ projectName = await ask("Project name or '.' for the current directory: ");
73
+ }
74
+
75
+ if (!projectName) {
76
+ console.error("Error: Please provide a project name or '.' to scaffold into the current directory.");
77
+ process.exit(1);
78
+ }
79
+
80
+ if (projectName !== "." && !isValidProjectName(projectName)) {
81
+ console.error("Error: Invalid project name.");
82
+ process.exit(1);
83
+ }
84
+
85
+ const targetDir = resolveTargetDir(projectName);
86
+ const isCurrentDir = targetDir === process.cwd();
87
+
88
+ console.log(`\nCreating project "${projectName}"...\n`);
89
+ mkdirSync(targetDir, { recursive: true });
90
+
91
+ try {
92
+ console.log(" Copying template files...");
93
+ cpSync(TEMPLATE_DIR, targetDir, { recursive: true });
94
+ } catch (err) {
95
+ console.error("Error: Failed to copy template.");
96
+ console.error(" " + err.message);
97
+ if (!isCurrentDir) {
98
+ // best effort cleanup
99
+ }
100
+ process.exit(1);
101
+ }
102
+
103
+ const gitignoreStub = join(targetDir, "gitignore-stub");
104
+ if (existsSync(gitignoreStub)) {
105
+ renameSync(gitignoreStub, join(targetDir, ".gitignore"));
106
+ }
107
+
108
+ const targetPkgPath = join(targetDir, "package.json");
109
+ if (existsSync(targetPkgPath)) {
110
+ try {
111
+ const targetPkg = JSON.parse(readFileSync(targetPkgPath, "utf-8"));
112
+ targetPkg.name = projectName === "." ? basename(targetDir) : projectName;
113
+ writeFileSync(targetPkgPath, JSON.stringify(targetPkg, null, 2) + "\n");
114
+ } catch {}
115
+ }
116
+
117
+ const pm = process.env.npm_config_user_agent?.includes('pnpm') ? 'pnpm' :
118
+ process.env.npm_config_user_agent?.includes('yarn') ? 'yarn' :
119
+ process.env.npm_config_user_agent?.includes('bun') ? 'bun' : 'npm';
120
+
121
+ const cdName = projectName === "." ? basename(targetDir) : projectName;
122
+ console.log(`Done! Created "${cdName}" at ${targetDir}`);
123
+ console.log();
124
+ if (projectName !== ".") {
125
+ console.log(" cd " + cdName);
126
+ }
127
+ console.log(" " + pm + " install");
128
+ console.log(" " + pm + " run dev");
129
+ console.log();
130
+ console.log("Enjoy building with Deskapp!");
131
+ }
132
+
133
+ main().catch((err) => {
134
+ console.error(err);
135
+ process.exit(1);
136
+ });
package/package.json CHANGED
@@ -1,6 +1,16 @@
1
1
  {
2
2
  "name": "@niyamulahsan/create-deskapp",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
3
+ "version": "1.2.0",
4
+ "description": "Scaffold a new Deskapp (Electron + Vue + npm) project",
5
+ "type": "module",
6
+ "bin": {
7
+ "create-deskapp": "./bin/create.js"
8
+ },
9
+ "files": [
10
+ "bin",
11
+ "template",
12
+ "template.manifest.json",
13
+ "src"
14
+ ],
15
+ "license": "MIT"
16
+ }
package/template/.env ADDED
@@ -0,0 +1,13 @@
1
+ # The app always runs its local stack (SQLite, local queue, local cron,
2
+ # local realtime) - fully self-contained, no remote server required.
3
+
4
+ # Frontend: true = serve the UI + open windows (default);
5
+ # false = headless at runtime (tray only, no window).
6
+ DESKAPP_UI=true
7
+
8
+ # Database: defaults to the Electron userData folder.
9
+ # Override only if you want a custom file/path.
10
+ DATABASE_URL=sqlite:./src/storage/something-else.sqlite
11
+
12
+ # Runtime base dir for relative DATABASE_URL / storage paths.
13
+ # APP_BASE_DIR=
@@ -0,0 +1,13 @@
1
+ # The app always runs its local stack (SQLite, local queue, local cron,
2
+ # local realtime) - fully self-contained, no remote server required.
3
+
4
+ # Frontend: true = serve the UI + open windows (default);
5
+ # false = headless at runtime (tray only, no window).
6
+ DESKAPP_UI=true
7
+
8
+ # Database: defaults to the Electron userData folder.
9
+ # Override only if you want a custom file/path.
10
+ DATABASE_URL=sqlite:./src/storage/something-else.sqlite
11
+
12
+ # Runtime base dir for relative DATABASE_URL / storage paths.
13
+ # APP_BASE_DIR=
@@ -0,0 +1,6 @@
1
+ {
2
+ "recommendations": [
3
+ "biomejs.biome",
4
+ "editorconfig.editorconfig"
5
+ ]
6
+ }
@@ -0,0 +1,37 @@
1
+ {
2
+ "editor.defaultFormatter": "biomejs.biome",
3
+ "[typescript]": {
4
+ "editor.defaultFormatter": "biomejs.biome"
5
+ },
6
+ "[typescriptreact]": {
7
+ "editor.defaultFormatter": "biomejs.biome"
8
+ },
9
+ "[javascript]": {
10
+ "editor.defaultFormatter": "biomejs.biome"
11
+ },
12
+ "[javascriptreact]": {
13
+ "editor.defaultFormatter": "biomejs.biome"
14
+ },
15
+ "[json]": {
16
+ "editor.defaultFormatter": "biomejs.biome"
17
+ },
18
+ "[jsonc]": {
19
+ "editor.defaultFormatter": "biomejs.biome"
20
+ },
21
+ "[vue]": {
22
+ "editor.defaultFormatter": "biomejs.biome"
23
+ },
24
+ "[css]": {
25
+ "editor.defaultFormatter": "biomejs.biome"
26
+ },
27
+ "[scss]": {
28
+ "editor.defaultFormatter": "biomejs.biome"
29
+ },
30
+ "editor.codeActionsOnSave": {
31
+ "source.organizeImports.biome": "explicit",
32
+ "source.fixAll.biome": "explicit"
33
+ },
34
+ "files.eol": "\n",
35
+ "files.trimTrailingWhitespace": true,
36
+ "files.insertFinalNewline": true
37
+ }
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 - present, niYam
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,29 @@
1
+ # Deskapp
2
+
3
+ Electron + Vue 3 desktop app built with the Deskapp framework.
4
+
5
+ ## Quick Start
6
+
7
+ ```bash
8
+ npm install
9
+ npm run dev
10
+ ```
11
+
12
+ ## Scripts
13
+
14
+ - `npm run dev` - Run in development mode
15
+ - `npm run build` - Build the app
16
+ - `npm run package` - Package the app with electron-builder
17
+ - `npm run maker` - Run the maker CLI
18
+
19
+ ## Structure
20
+
21
+ - `src/main.ts` - Electron main process
22
+ - `src/preload.ts` - Preload script
23
+ - `src/ui/` - Vue 3 frontend
24
+ - `src/modules/` - Your application modules
25
+ - `src/core/` - Framework core
26
+
27
+ ## Documentation
28
+
29
+ See the framework documentation for more details.
@@ -0,0 +1,99 @@
1
+ {
2
+ "$schema": "./node_modules/@biomejs/biome/configuration_schema.json",
3
+ "vcs": {
4
+ "enabled": true,
5
+ "clientKind": "git",
6
+ "useIgnoreFile": true
7
+ },
8
+ "html": {
9
+ "experimentalFullSupportEnabled": true,
10
+ "formatter": {
11
+ "enabled": true
12
+ }
13
+ },
14
+ "formatter": {
15
+ "indentStyle": "space",
16
+ "indentWidth": 2,
17
+ "lineWidth": 140,
18
+ "bracketSameLine": false
19
+ },
20
+ "files": {
21
+ "includes": [
22
+ "**",
23
+ "!**/node_modules"
24
+ ]
25
+ },
26
+ "linter": {
27
+ "rules": {
28
+ "preset": "recommended",
29
+ "a11y": {
30
+ "noLabelWithoutControl": "off",
31
+ "useButtonType": "off",
32
+ "useSemanticElements": "off",
33
+ "noStaticElementInteractions": "off",
34
+ "useKeyWithClickEvents": "off",
35
+ "useValidAnchor": "off",
36
+ "useAnchorContent": "off",
37
+ "noDistractingElements": "off"
38
+ },
39
+ "correctness": {
40
+ "noUnusedVariables": "off",
41
+ "useVueValidTemplateRoot": "off",
42
+ "noUnusedImports": "off"
43
+ },
44
+ "complexity": {
45
+ "noUselessEscapeInRegex": "off",
46
+ "noImportantStyles": "off"
47
+ },
48
+ "style": {
49
+ "noNonNullAssertion": "off",
50
+ "useVueMultiWordComponentNames": "off",
51
+ "useImportType": "off"
52
+ },
53
+ "suspicious": {
54
+ "noEmptyBlockStatements": "off",
55
+ "noExplicitAny": "off",
56
+ "noRedeclare": "off",
57
+ "noAssignInExpressions": "off",
58
+ "useIterableCallbackReturn": "off"
59
+ }
60
+ }
61
+ },
62
+ "javascript": {
63
+ "formatter": {
64
+ "quoteStyle": "double",
65
+ "semicolons": "always",
66
+ "trailingCommas": "none"
67
+ }
68
+ },
69
+ "overrides": [
70
+ {
71
+ "includes": [
72
+ "**/*.{js,mjs,cjs,ts,tsx,vue}"
73
+ ],
74
+ "javascript": {
75
+ "globals": [
76
+ "exports",
77
+ "location"
78
+ ]
79
+ }
80
+ }
81
+ ],
82
+ "assist": {
83
+ "actions": {
84
+ "source": {
85
+ "organizeImports": {
86
+ "level": "on",
87
+ "options": {
88
+ "groups": [
89
+ ":NODE:",
90
+ ":PACKAGE:",
91
+ ":ALIAS:",
92
+ ":PATH:"
93
+ ]
94
+ }
95
+ }
96
+ }
97
+ }
98
+ }
99
+ }
@@ -0,0 +1,32 @@
1
+ import fs from "node:fs";
2
+ import { defineConfig } from "drizzle-kit";
3
+
4
+ // Mirror the runtime default (src/core/database/config.ts) so drizzle-kit and
5
+ // the app agree on the sqlite file, including the create-time project name.
6
+ function appKebab(): string {
7
+ try {
8
+ const pkg: { name?: string; build?: { productName?: string } } = JSON.parse(fs.readFileSync("./package.json", "utf-8"));
9
+ const name = pkg?.build?.productName?.trim() || pkg?.name?.trim() || "Deskapp";
10
+ return name
11
+ .toLowerCase()
12
+ .replace(/[^a-z0-9]+/g, "-")
13
+ .replace(/^-+|-+$/g, "");
14
+ } catch {
15
+ return "deskapp";
16
+ }
17
+ }
18
+
19
+ const databaseUrl = process.env.DATABASE_URL || `sqlite:./src/storage/${appKebab()}.sqlite`;
20
+
21
+ function sqlitePathFromUrl(url: string) {
22
+ if (url.startsWith("sqlite:///")) return url.replace("sqlite:///", "");
23
+ if (url.startsWith("sqlite://")) return url.replace("sqlite://", "");
24
+ return url.replace("sqlite:", "");
25
+ }
26
+
27
+ export default defineConfig({
28
+ schema: process.env.DRIZZLE_SCHEMA || "./src/database/schema.ts",
29
+ out: "./src/database/migrations/sqlite",
30
+ dialect: "sqlite",
31
+ dbCredentials: { url: `file:${sqlitePathFromUrl(databaseUrl)}` }
32
+ });
@@ -0,0 +1,19 @@
1
+ # Local environment (never commit secrets)
2
+ .env
3
+
4
+ # Node.js
5
+ node_modules/
6
+
7
+ # Build output (generated)
8
+ dist/
9
+ out/
10
+ release/
11
+ coverage/
12
+
13
+ # App-managed runtime data (dev databases, state)
14
+ src/storage/
15
+
16
+ # Editor / OS
17
+ .DS_Store
18
+ Thumbs.db
19
+ *.log
@@ -0,0 +1,111 @@
1
+ {
2
+ "name": "deskapp",
3
+ "version": "0.1.0",
4
+ "description": "Deskapp - Electron desktop app framework",
5
+ "main": "out/main/index.cjs",
6
+ "type": "module",
7
+ "scripts": {
8
+ "prepare": "npm run config:sync && npm run db:schema && npm run bindings:gen",
9
+ "config:sync": "tsx --tsconfig tsconfig.json src/core/maker/sync-config.ts",
10
+ "dev": "npm run config:sync && npm run db:schema && npm run bindings:gen && concurrently -k -n ui,main,electron \"npm run dev:ui\" \"npm run dev:main\" \"npm run dev:electron\"",
11
+ "dev:ui": "vite --config src/ui/vite.config.ts",
12
+ "dev:main": "node scripts/build-electron.mjs --watch",
13
+ "dev:electron": "wait-on tcp:5173 out/main/index.cjs && cross-env NODE_ENV=development electron out/main/index.cjs",
14
+ "build": "npm run config:sync && npm run db:schema && npm run bindings:gen && npm run build:ui && npm run build:electron",
15
+ "build:ui": "vite build --config src/ui/vite.config.ts",
16
+ "build:electron": "node scripts/build-electron.mjs",
17
+ "start": "electron out/main/index.cjs",
18
+ "package": "npm run build && electron-builder",
19
+ "maker": "tsx --tsconfig tsconfig.json src/core/maker/mod.ts",
20
+ "db:schema": "tsx --tsconfig tsconfig.json src/core/database/aggregate.ts",
21
+ "bindings:gen": "tsx --tsconfig tsconfig.json src/core/api/generate.manifest.ts",
22
+ "lint": "biome check .",
23
+ "lint:fix": "biome check --write .",
24
+ "format": "biome format --write .",
25
+ "format:check": "biome format .",
26
+ "test": "vitest run",
27
+ "test:watch": "vitest",
28
+ "test:coverage": "vitest run --coverage"
29
+ },
30
+ "dependencies": {
31
+ "@libsql/client": "^0.18.0",
32
+ "axios": "^1.20.0",
33
+ "bcryptjs": "^3.0.3",
34
+ "croner": "^10.0.1",
35
+ "dotenv": "^16.4.5",
36
+ "drizzle-orm": "^0.45.2",
37
+ "lodash-es": "^4.17.21",
38
+ "socket.io-client": "^4.8.4",
39
+ "zod": "^4.5.4"
40
+ },
41
+ "devDependencies": {
42
+ "@biomejs/biome": "^2.5.7",
43
+ "@types/node": "^22.20.5",
44
+ "@vitejs/plugin-vue": "^6.0.8",
45
+ "@vitest/coverage-v8": "^5.1.0",
46
+ "bootstrap": "^5.3.8",
47
+ "bootstrap-icons": "^1.13.1",
48
+ "concurrently": "^9.1.0",
49
+ "cross-env": "^10.1.0",
50
+ "drizzle-kit": "^0.31.10",
51
+ "electron": "^45.2.3",
52
+ "electron-builder": "^25.1.8",
53
+ "esbuild": "^0.28.2",
54
+ "pinia": "^4.0.3",
55
+ "sass": "^1.103.1",
56
+ "tsx": "^4.23.15",
57
+ "typescript": "^6.0.3",
58
+ "vite": "^8.2.2",
59
+ "vitest": "^5.1.0",
60
+ "vue": "^3.5.42",
61
+ "vue-router": "^5.3.1",
62
+ "wait-on": "^9.5.1"
63
+ },
64
+ "build": {
65
+ "appId": "com.deskapp.app",
66
+ "productName": "Deskapp",
67
+ "directories": {
68
+ "output": "release"
69
+ },
70
+ "files": [
71
+ "out/**/*",
72
+ "src/ui/dist/**/*",
73
+ "src/icons/**/*",
74
+ "src/database/migrations/**/*",
75
+ "package.json"
76
+ ],
77
+ "mac": {
78
+ "icon": "src/icons/web-app-manifest-512x512.png",
79
+ "target": "dmg"
80
+ },
81
+ "win": {
82
+ "icon": "src/icons/web-app-manifest-512x512.png",
83
+ "target": "nsis",
84
+ "signAndEditExecutable": false
85
+ },
86
+ "nsis": {
87
+ "oneClick": false,
88
+ "allowToChangeInstallationDirectory": true,
89
+ "allowElevation": true,
90
+ "perMachine": false,
91
+ "createDesktopShortcut": true,
92
+ "createStartMenuShortcut": true,
93
+ "shortcutName": "Deskapp",
94
+ "uninstallDisplayName": "Deskapp",
95
+ "include": "scripts/installer.nsh",
96
+ "deleteAppDataOnUninstall": false
97
+ },
98
+ "linux": {
99
+ "icon": "src/icons/web-app-manifest-512x512.png",
100
+ "target": "AppImage"
101
+ },
102
+ "protocols": [
103
+ {
104
+ "name": "Deskapp",
105
+ "schemes": [
106
+ "deskapp"
107
+ ]
108
+ }
109
+ ]
110
+ }
111
+ }
@@ -0,0 +1,55 @@
1
+ import path from "node:path";
2
+ import { fileURLToPath } from "node:url";
3
+ import * as esbuild from "esbuild";
4
+
5
+ const __dirname = path.dirname(fileURLToPath(import.meta.url));
6
+ const root = path.resolve(__dirname, "..");
7
+ const watch = process.argv.includes("--watch");
8
+
9
+ /** @type {import('esbuild').BuildOptions} */
10
+ const shared = {
11
+ bundle: true,
12
+ platform: "node",
13
+ format: "cjs",
14
+ sourcemap: true,
15
+ target: "node20",
16
+ alias: {
17
+ "@/ui": path.resolve(root, "src/ui/src"),
18
+ "@config": path.resolve(root, "src/config"),
19
+ "@": path.resolve(root, "src")
20
+ },
21
+ // Keep Electron and native/runtime-loaded deps external.
22
+ external: ["electron", "@libsql/client", "drizzle-orm", "playwright", "playwright-core", "chromium-bidi"],
23
+ logLevel: "info"
24
+ };
25
+
26
+ async function run() {
27
+ const mainOpts = {
28
+ ...shared,
29
+ entryPoints: [path.resolve(root, "src/main.ts")],
30
+ outfile: path.resolve(root, "out/main/index.cjs")
31
+ };
32
+ const preloadOpts = {
33
+ ...shared,
34
+ entryPoints: [path.resolve(root, "src/preload.ts")],
35
+ outfile: path.resolve(root, "out/preload/index.cjs")
36
+ };
37
+
38
+ if (watch) {
39
+ const [mainCtx, preloadCtx] = await Promise.all([esbuild.context(mainOpts), esbuild.context(preloadOpts)]);
40
+ await Promise.all([mainCtx.watch(), preloadCtx.watch()]);
41
+ console.log("[electron] watching main & preload...");
42
+ // Keep process alive
43
+ process.on("SIGINT", async () => {
44
+ await Promise.all([mainCtx.dispose(), preloadCtx.dispose()]);
45
+ process.exit(0);
46
+ });
47
+ } else {
48
+ await Promise.all([esbuild.build(mainOpts), esbuild.build(preloadOpts)]);
49
+ }
50
+ }
51
+
52
+ run().catch((err) => {
53
+ console.error(err);
54
+ process.exit(1);
55
+ });