@empire-builder-kit/desktop 0.0.1-alpha.10
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.
- package/LICENSE +21 -0
- package/README.md +11 -0
- package/dist/executors.json +3 -0
- package/dist/generators/app/app.d.ts +5 -0
- package/dist/generators/app/app.d.ts.map +1 -0
- package/dist/generators/app/app.js +207 -0
- package/dist/generators/app/files-go/README.md.template +11 -0
- package/dist/generators/app/files-go/frontend/index.html.template +11 -0
- package/dist/generators/app/files-go/go.mod.template +5 -0
- package/dist/generators/app/files-go/main.go.template +43 -0
- package/dist/generators/app/files-go/wails.json.template +12 -0
- package/dist/generators/app/files-python/README.md.template +11 -0
- package/dist/generators/app/files-python/pyproject.toml.template +15 -0
- package/dist/generators/app/files-python/src/main.py.template +28 -0
- package/dist/generators/app/files-rust/README.md.template +11 -0
- package/dist/generators/app/files-rust/src/index.html.template +11 -0
- package/dist/generators/app/files-rust/src-tauri/Cargo.toml.template +9 -0
- package/dist/generators/app/files-rust/src-tauri/src/main.rs.template +11 -0
- package/dist/generators/app/files-rust/src-tauri/tauri.conf.json.template +23 -0
- package/dist/generators/app/files-typescript/README.md.template +11 -0
- package/dist/generators/app/files-typescript/package.json.template +18 -0
- package/dist/generators/app/files-typescript/scripts/copy-static.mjs.template +13 -0
- package/dist/generators/app/files-typescript/src/app.spec.ts.template +7 -0
- package/dist/generators/app/files-typescript/src/index.html.template +12 -0
- package/dist/generators/app/files-typescript/src/main.ts.template +22 -0
- package/dist/generators/app/files-typescript/src/preload.ts.template +5 -0
- package/dist/generators/app/files-typescript/tsconfig.json.template +16 -0
- package/dist/generators/app/files-typescript/vitest.config.mts.template +8 -0
- package/dist/generators/app/schema.d.ts +8 -0
- package/dist/generators/app/schema.json +39 -0
- package/dist/generators.json +9 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +5 -0
- package/executors.json +3 -0
- package/generators.json +9 -0
- package/package.json +85 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Empire Builder Kit Contributors
|
|
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.
|
package/README.md
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
# @empire-builder-kit/desktop
|
|
2
|
+
|
|
3
|
+
Standardized Nx plugin for Empire Builder Kit workspace tooling.
|
|
4
|
+
|
|
5
|
+
## Building
|
|
6
|
+
|
|
7
|
+
Run `pnpm nx build @empire-builder-kit/desktop` to build the library.
|
|
8
|
+
|
|
9
|
+
## Running unit tests
|
|
10
|
+
|
|
11
|
+
Run `pnpm nx test @empire-builder-kit/desktop` to execute the unit tests via [Vitest](https://vitest.dev/).
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"app.d.ts","sourceRoot":"","sources":["../../../src/generators/app/app.ts"],"names":[],"mappings":"AAAA,OAAO,EAQL,IAAI,EACL,MAAM,YAAY,CAAC;AAEpB,OAAO,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAC;AA0N9C,wBAAsB,mBAAmB,CACvC,IAAI,EAAE,IAAI,EACV,OAAO,EAAE,kBAAkB,iBAyC5B;AAED,eAAe,mBAAmB,CAAC"}
|
|
@@ -0,0 +1,207 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.desktopAppGenerator = desktopAppGenerator;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const devkit_1 = require("@nx/devkit");
|
|
6
|
+
const path = tslib_1.__importStar(require("node:path"));
|
|
7
|
+
function runtimeForLanguage(language) {
|
|
8
|
+
switch (language) {
|
|
9
|
+
case 'typescript':
|
|
10
|
+
return 'node';
|
|
11
|
+
case 'rust':
|
|
12
|
+
return 'native';
|
|
13
|
+
case 'go':
|
|
14
|
+
return 'native';
|
|
15
|
+
case 'python':
|
|
16
|
+
return 'python';
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
function frameworkForLanguage(language) {
|
|
20
|
+
switch (language) {
|
|
21
|
+
case 'typescript':
|
|
22
|
+
return 'electron';
|
|
23
|
+
case 'rust':
|
|
24
|
+
return 'tauri';
|
|
25
|
+
case 'go':
|
|
26
|
+
return 'wails';
|
|
27
|
+
case 'python':
|
|
28
|
+
return 'pyqt';
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
function targetsForLanguage(language, projectRoot) {
|
|
32
|
+
const cwd = projectRoot;
|
|
33
|
+
switch (language) {
|
|
34
|
+
case 'typescript':
|
|
35
|
+
return {
|
|
36
|
+
build: {
|
|
37
|
+
executor: 'nx:run-commands',
|
|
38
|
+
options: {
|
|
39
|
+
cwd,
|
|
40
|
+
command: 'tsc -p tsconfig.json && node scripts/copy-static.mjs',
|
|
41
|
+
},
|
|
42
|
+
},
|
|
43
|
+
serve: {
|
|
44
|
+
executor: 'nx:run-commands',
|
|
45
|
+
options: {
|
|
46
|
+
cwd,
|
|
47
|
+
command: 'tsc -p tsconfig.json && node scripts/copy-static.mjs && electron .',
|
|
48
|
+
},
|
|
49
|
+
},
|
|
50
|
+
lint: {
|
|
51
|
+
executor: 'nx:run-commands',
|
|
52
|
+
options: { cwd, command: 'eslint .' },
|
|
53
|
+
},
|
|
54
|
+
typecheck: {
|
|
55
|
+
executor: 'nx:run-commands',
|
|
56
|
+
options: { cwd, command: 'tsc --noEmit -p tsconfig.json' },
|
|
57
|
+
},
|
|
58
|
+
test: {
|
|
59
|
+
executor: 'nx:run-commands',
|
|
60
|
+
options: { cwd, command: 'vitest run --config vitest.config.mts' },
|
|
61
|
+
},
|
|
62
|
+
package: {
|
|
63
|
+
executor: 'nx:run-commands',
|
|
64
|
+
options: {
|
|
65
|
+
cwd,
|
|
66
|
+
command: 'tsc -p tsconfig.json && node scripts/copy-static.mjs && electron-builder build --publish never',
|
|
67
|
+
},
|
|
68
|
+
},
|
|
69
|
+
};
|
|
70
|
+
case 'rust':
|
|
71
|
+
return {
|
|
72
|
+
build: {
|
|
73
|
+
executor: 'nx:run-commands',
|
|
74
|
+
options: { cwd: `${cwd}/src-tauri`, command: 'cargo build' },
|
|
75
|
+
},
|
|
76
|
+
serve: {
|
|
77
|
+
executor: 'nx:run-commands',
|
|
78
|
+
options: { cwd, command: 'cargo tauri dev' },
|
|
79
|
+
},
|
|
80
|
+
lint: {
|
|
81
|
+
executor: 'nx:run-commands',
|
|
82
|
+
options: {
|
|
83
|
+
cwd: `${cwd}/src-tauri`,
|
|
84
|
+
command: 'cargo clippy -- -D warnings',
|
|
85
|
+
},
|
|
86
|
+
},
|
|
87
|
+
test: {
|
|
88
|
+
executor: 'nx:run-commands',
|
|
89
|
+
options: { cwd: `${cwd}/src-tauri`, command: 'cargo test' },
|
|
90
|
+
},
|
|
91
|
+
package: {
|
|
92
|
+
executor: 'nx:run-commands',
|
|
93
|
+
options: { cwd, command: 'cargo tauri build' },
|
|
94
|
+
},
|
|
95
|
+
};
|
|
96
|
+
case 'go':
|
|
97
|
+
return {
|
|
98
|
+
build: {
|
|
99
|
+
executor: 'nx:run-commands',
|
|
100
|
+
options: { cwd, command: 'wails build' },
|
|
101
|
+
},
|
|
102
|
+
serve: {
|
|
103
|
+
executor: 'nx:run-commands',
|
|
104
|
+
options: { cwd, command: 'wails dev' },
|
|
105
|
+
},
|
|
106
|
+
lint: {
|
|
107
|
+
executor: 'nx:run-commands',
|
|
108
|
+
options: { cwd, command: 'golangci-lint run' },
|
|
109
|
+
},
|
|
110
|
+
typecheck: {
|
|
111
|
+
executor: 'nx:run-commands',
|
|
112
|
+
options: { cwd, command: 'go vet ./...' },
|
|
113
|
+
},
|
|
114
|
+
test: {
|
|
115
|
+
executor: 'nx:run-commands',
|
|
116
|
+
options: { cwd, command: 'go test ./...' },
|
|
117
|
+
},
|
|
118
|
+
package: {
|
|
119
|
+
executor: 'nx:run-commands',
|
|
120
|
+
options: { cwd, command: 'wails build' },
|
|
121
|
+
},
|
|
122
|
+
};
|
|
123
|
+
case 'python':
|
|
124
|
+
return {
|
|
125
|
+
serve: {
|
|
126
|
+
executor: 'nx:run-commands',
|
|
127
|
+
options: { cwd, command: 'python src/main.py' },
|
|
128
|
+
},
|
|
129
|
+
lint: {
|
|
130
|
+
executor: 'nx:run-commands',
|
|
131
|
+
options: { cwd, command: 'ruff check .' },
|
|
132
|
+
},
|
|
133
|
+
typecheck: {
|
|
134
|
+
executor: 'nx:run-commands',
|
|
135
|
+
options: { cwd, command: 'mypy src/' },
|
|
136
|
+
},
|
|
137
|
+
test: {
|
|
138
|
+
executor: 'nx:run-commands',
|
|
139
|
+
options: { cwd, command: 'pytest' },
|
|
140
|
+
},
|
|
141
|
+
package: {
|
|
142
|
+
executor: 'nx:run-commands',
|
|
143
|
+
options: { cwd, command: 'pyinstaller --onefile src/main.py' },
|
|
144
|
+
},
|
|
145
|
+
};
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
function normalizeOptions(tree, options) {
|
|
149
|
+
const appNames = (0, devkit_1.names)(options.app);
|
|
150
|
+
const desktopNames = (0, devkit_1.names)(options.name);
|
|
151
|
+
const language = options.language ?? 'typescript';
|
|
152
|
+
const directory = (options.directory ?? 'packages').replace(/\\/g, '/');
|
|
153
|
+
const appRoot = (0, devkit_1.joinPathFragments)(directory, appNames.fileName);
|
|
154
|
+
const projectRoot = (0, devkit_1.joinPathFragments)(directory, appNames.fileName, 'apps', 'desktop', desktopNames.fileName);
|
|
155
|
+
const userTags = options.tags
|
|
156
|
+
?.split(',')
|
|
157
|
+
.map((tag) => tag.trim())
|
|
158
|
+
.filter(Boolean) ?? [];
|
|
159
|
+
return {
|
|
160
|
+
app: appNames.fileName,
|
|
161
|
+
appRoot,
|
|
162
|
+
className: appNames.className,
|
|
163
|
+
directory,
|
|
164
|
+
language,
|
|
165
|
+
name: desktopNames.fileName,
|
|
166
|
+
offsetFromRoot: (0, devkit_1.offsetFromRoot)(projectRoot),
|
|
167
|
+
projectName: `${appNames.fileName}-desktop-${desktopNames.fileName}`,
|
|
168
|
+
projectRoot,
|
|
169
|
+
projectTitle: `${appNames.className} Desktop ${desktopNames.className}`,
|
|
170
|
+
skipFormat: options.skipFormat,
|
|
171
|
+
tags: [
|
|
172
|
+
`scope:${appNames.fileName}`,
|
|
173
|
+
'layer:app',
|
|
174
|
+
'type:desktop',
|
|
175
|
+
`runtime:${runtimeForLanguage(language)}`,
|
|
176
|
+
'deploy:native',
|
|
177
|
+
'visibility:internal',
|
|
178
|
+
...userTags,
|
|
179
|
+
],
|
|
180
|
+
};
|
|
181
|
+
}
|
|
182
|
+
async function desktopAppGenerator(tree, options) {
|
|
183
|
+
const normalized = normalizeOptions(tree, options);
|
|
184
|
+
if (!tree.exists(normalized.appRoot)) {
|
|
185
|
+
throw new Error(`App group "${normalized.app}" does not exist at "${normalized.appRoot}". Generate the app group first.`);
|
|
186
|
+
}
|
|
187
|
+
if (tree.exists((0, devkit_1.joinPathFragments)(normalized.projectRoot, 'project.json')) ||
|
|
188
|
+
tree.exists((0, devkit_1.joinPathFragments)(normalized.projectRoot, 'package.json'))) {
|
|
189
|
+
throw new Error(`Desktop app "${normalized.name}" already exists at "${normalized.projectRoot}".`);
|
|
190
|
+
}
|
|
191
|
+
(0, devkit_1.addProjectConfiguration)(tree, normalized.projectName, {
|
|
192
|
+
root: normalized.projectRoot,
|
|
193
|
+
projectType: 'application',
|
|
194
|
+
sourceRoot: `${normalized.projectRoot}/src`,
|
|
195
|
+
tags: normalized.tags,
|
|
196
|
+
targets: targetsForLanguage(normalized.language, normalized.projectRoot),
|
|
197
|
+
});
|
|
198
|
+
(0, devkit_1.generateFiles)(tree, path.join(__dirname, `files-${normalized.language}`), normalized.projectRoot, {
|
|
199
|
+
...normalized,
|
|
200
|
+
framework: frameworkForLanguage(normalized.language),
|
|
201
|
+
tmpl: '',
|
|
202
|
+
});
|
|
203
|
+
if (!normalized.skipFormat) {
|
|
204
|
+
await (0, devkit_1.formatFiles)(tree);
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
exports.default = desktopAppGenerator;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
# <%= projectTitle %>
|
|
2
|
+
|
|
3
|
+
Wails desktop app for the `<%= app %>` app group.
|
|
4
|
+
|
|
5
|
+
## Commands
|
|
6
|
+
|
|
7
|
+
- `pnpm nx run <%= projectName %>:serve` — start Wails dev mode
|
|
8
|
+
- `pnpm nx run <%= projectName %>:build` — build for current platform
|
|
9
|
+
- `pnpm nx run <%= projectName %>:test` — run tests
|
|
10
|
+
- `pnpm nx run <%= projectName %>:lint` — run golangci-lint
|
|
11
|
+
- `pnpm nx run <%= projectName %>:package` — build for all platforms
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
package main
|
|
2
|
+
|
|
3
|
+
import (
|
|
4
|
+
"embed"
|
|
5
|
+
"fmt"
|
|
6
|
+
|
|
7
|
+
"github.com/wailsapp/wails/v2"
|
|
8
|
+
"github.com/wailsapp/wails/v2/pkg/options"
|
|
9
|
+
"github.com/wailsapp/wails/v2/pkg/options/assetserver"
|
|
10
|
+
)
|
|
11
|
+
|
|
12
|
+
//go:embed frontend
|
|
13
|
+
var assets embed.FS
|
|
14
|
+
|
|
15
|
+
type App struct{}
|
|
16
|
+
|
|
17
|
+
func NewApp() *App {
|
|
18
|
+
return &App{}
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
func (a *App) Greet(name string) string {
|
|
22
|
+
return fmt.Sprintf("Hello, %s! From <%= projectTitle %>.", name)
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
func main() {
|
|
26
|
+
app := NewApp()
|
|
27
|
+
|
|
28
|
+
err := wails.Run(&options.App{
|
|
29
|
+
Title: "<%= projectTitle %>",
|
|
30
|
+
Width: 1200,
|
|
31
|
+
Height: 800,
|
|
32
|
+
AssetServer: &assetserver.Options{
|
|
33
|
+
Assets: assets,
|
|
34
|
+
},
|
|
35
|
+
Bind: []interface{}{
|
|
36
|
+
app,
|
|
37
|
+
},
|
|
38
|
+
})
|
|
39
|
+
|
|
40
|
+
if err != nil {
|
|
41
|
+
println("Error:", err.Error())
|
|
42
|
+
}
|
|
43
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://wails.io/schemas/config.v2.json",
|
|
3
|
+
"name": "<%= projectName %>",
|
|
4
|
+
"outputfilename": "<%= name %>",
|
|
5
|
+
"frontend:install": "",
|
|
6
|
+
"frontend:build": "",
|
|
7
|
+
"frontend:dev:watcher": "",
|
|
8
|
+
"frontend:dev:serverUrl": "",
|
|
9
|
+
"author": {
|
|
10
|
+
"name": "<%= app %>"
|
|
11
|
+
}
|
|
12
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
# <%= projectTitle %>
|
|
2
|
+
|
|
3
|
+
PyQt6 desktop app for the `<%= app %>` app group.
|
|
4
|
+
|
|
5
|
+
## Commands
|
|
6
|
+
|
|
7
|
+
- `pnpm nx run <%= projectName %>:serve` — run the app
|
|
8
|
+
- `pnpm nx run <%= projectName %>:test` — run pytest
|
|
9
|
+
- `pnpm nx run <%= projectName %>:lint` — run ruff
|
|
10
|
+
- `pnpm nx run <%= projectName %>:typecheck` — run mypy
|
|
11
|
+
- `pnpm nx run <%= projectName %>:package` — build distributable with pyinstaller
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"""<%= projectTitle %> — PyQt6 desktop app for the <%= app %> app group."""
|
|
2
|
+
|
|
3
|
+
import sys
|
|
4
|
+
from PyQt6.QtWidgets import QApplication, QMainWindow, QLabel, QVBoxLayout, QWidget
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
class MainWindow(QMainWindow):
|
|
8
|
+
def __init__(self):
|
|
9
|
+
super().__init__()
|
|
10
|
+
self.setWindowTitle("<%= projectTitle %>")
|
|
11
|
+
self.setMinimumSize(800, 600)
|
|
12
|
+
|
|
13
|
+
central = QWidget()
|
|
14
|
+
layout = QVBoxLayout(central)
|
|
15
|
+
layout.addWidget(QLabel("<%= projectTitle %>"))
|
|
16
|
+
layout.addWidget(QLabel("PyQt6 desktop app for the <%= app %> app group."))
|
|
17
|
+
self.setCentralWidget(central)
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
def main():
|
|
21
|
+
app = QApplication(sys.argv)
|
|
22
|
+
window = MainWindow()
|
|
23
|
+
window.show()
|
|
24
|
+
sys.exit(app.exec())
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
if __name__ == "__main__":
|
|
28
|
+
main()
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
# <%= projectTitle %>
|
|
2
|
+
|
|
3
|
+
Tauri desktop app for the `<%= app %>` app group.
|
|
4
|
+
|
|
5
|
+
## Commands
|
|
6
|
+
|
|
7
|
+
- `pnpm nx run <%= projectName %>:serve` — start Tauri dev mode
|
|
8
|
+
- `pnpm nx run <%= projectName %>:build` — build for distribution
|
|
9
|
+
- `pnpm nx run <%= projectName %>:test` — run tests
|
|
10
|
+
- `pnpm nx run <%= projectName %>:lint` — run clippy
|
|
11
|
+
- `pnpm nx run <%= projectName %>:package` — package for distribution
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
fn main() {
|
|
2
|
+
tauri::Builder::default()
|
|
3
|
+
.invoke_handler(tauri::generate_handler![greet])
|
|
4
|
+
.run(tauri::generate_context!())
|
|
5
|
+
.expect("error while running tauri application");
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
#[tauri::command]
|
|
9
|
+
fn greet(name: &str) -> String {
|
|
10
|
+
format!("Hello, {}! From <%= projectTitle %>.", name)
|
|
11
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://raw.githubusercontent.com/nicholasgasior/tauri-docs/master/schemas/config.schema.json",
|
|
3
|
+
"productName": "<%= projectTitle %>",
|
|
4
|
+
"version": "0.1.0",
|
|
5
|
+
"identifier": "com.<%= app %>.<%= name %>",
|
|
6
|
+
"build": {
|
|
7
|
+
"frontendDist": "../src"
|
|
8
|
+
},
|
|
9
|
+
"app": {
|
|
10
|
+
"title": "<%= projectTitle %>",
|
|
11
|
+
"windows": [
|
|
12
|
+
{
|
|
13
|
+
"title": "<%= projectTitle %>",
|
|
14
|
+
"width": 1200,
|
|
15
|
+
"height": 800
|
|
16
|
+
}
|
|
17
|
+
]
|
|
18
|
+
},
|
|
19
|
+
"bundle": {
|
|
20
|
+
"active": true,
|
|
21
|
+
"targets": "all"
|
|
22
|
+
}
|
|
23
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
# <%= projectTitle %>
|
|
2
|
+
|
|
3
|
+
Electron desktop app for the `<%= app %>` app group.
|
|
4
|
+
|
|
5
|
+
## Commands
|
|
6
|
+
|
|
7
|
+
- `pnpm nx run <%= projectName %>:serve` — launch Electron
|
|
8
|
+
- `pnpm nx run <%= projectName %>:build` — build distributable
|
|
9
|
+
- `pnpm nx run <%= projectName %>:test` — run tests
|
|
10
|
+
- `pnpm nx run <%= projectName %>:lint` — lint
|
|
11
|
+
- `pnpm nx run <%= projectName %>:package` — package for distribution
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@org/<%= projectName %>",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"private": true,
|
|
5
|
+
"main": "dist/main.js",
|
|
6
|
+
"scripts": {
|
|
7
|
+
"compile": "tsc -p tsconfig.json",
|
|
8
|
+
"start": "tsc -p tsconfig.json && node scripts/copy-static.mjs && electron .",
|
|
9
|
+
"build": "tsc -p tsconfig.json && node scripts/copy-static.mjs && electron-builder build --publish never"
|
|
10
|
+
},
|
|
11
|
+
"dependencies": {
|
|
12
|
+
"electron": "^33.0.0"
|
|
13
|
+
},
|
|
14
|
+
"devDependencies": {
|
|
15
|
+
"electron-builder": "^25.0.0",
|
|
16
|
+
"typescript": "~5.8.0"
|
|
17
|
+
}
|
|
18
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { copyFileSync, mkdirSync, readdirSync } from 'node:fs';
|
|
2
|
+
import { join } from 'node:path';
|
|
3
|
+
|
|
4
|
+
const sourceDir = 'src';
|
|
5
|
+
const outputDir = 'dist';
|
|
6
|
+
|
|
7
|
+
mkdirSync(outputDir, { recursive: true });
|
|
8
|
+
|
|
9
|
+
for (const fileName of readdirSync(sourceDir)) {
|
|
10
|
+
if (fileName.endsWith('.html')) {
|
|
11
|
+
copyFileSync(join(sourceDir, fileName), join(outputDir, fileName));
|
|
12
|
+
}
|
|
13
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="UTF-8" />
|
|
5
|
+
<meta http-equiv="Content-Security-Policy" content="default-src 'self'; script-src 'self'" />
|
|
6
|
+
<title><%= projectTitle %></title>
|
|
7
|
+
</head>
|
|
8
|
+
<body>
|
|
9
|
+
<h1><%= projectTitle %></h1>
|
|
10
|
+
<p>Electron desktop app for the <%= app %> app group.</p>
|
|
11
|
+
</body>
|
|
12
|
+
</html>
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { app, BrowserWindow } from 'electron';
|
|
2
|
+
import * as path from 'path';
|
|
3
|
+
|
|
4
|
+
function createWindow() {
|
|
5
|
+
const win = new BrowserWindow({
|
|
6
|
+
width: 1200,
|
|
7
|
+
height: 800,
|
|
8
|
+
webPreferences: {
|
|
9
|
+
preload: path.join(__dirname, 'preload.js'),
|
|
10
|
+
},
|
|
11
|
+
});
|
|
12
|
+
|
|
13
|
+
win.loadFile(path.join(__dirname, 'index.html'));
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
app.whenReady().then(createWindow);
|
|
17
|
+
|
|
18
|
+
app.on('window-all-closed', () => {
|
|
19
|
+
if (process.platform !== 'darwin') {
|
|
20
|
+
app.quit();
|
|
21
|
+
}
|
|
22
|
+
});
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"target": "ES2022",
|
|
4
|
+
"module": "commonjs",
|
|
5
|
+
"lib": ["ES2022"],
|
|
6
|
+
"outDir": "dist",
|
|
7
|
+
"rootDir": "src",
|
|
8
|
+
"strict": true,
|
|
9
|
+
"esModuleInterop": true,
|
|
10
|
+
"skipLibCheck": true,
|
|
11
|
+
"forceConsistentCasingInFileNames": true,
|
|
12
|
+
"resolveJsonModule": true
|
|
13
|
+
},
|
|
14
|
+
"include": ["src/**/*.ts"],
|
|
15
|
+
"exclude": ["node_modules", "dist", "src/**/*.spec.ts"]
|
|
16
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/schema",
|
|
3
|
+
"$id": "DesktopAppGenerator",
|
|
4
|
+
"title": "Generate an EBK desktop app",
|
|
5
|
+
"type": "object",
|
|
6
|
+
"properties": {
|
|
7
|
+
"name": {
|
|
8
|
+
"type": "string",
|
|
9
|
+
"description": "Name for the desktop app within the app group.",
|
|
10
|
+
"$default": { "$source": "argv", "index": 0 },
|
|
11
|
+
"x-prompt": "What name should the desktop app have?"
|
|
12
|
+
},
|
|
13
|
+
"app": {
|
|
14
|
+
"type": "string",
|
|
15
|
+
"description": "Owning Empire Builder Kit app-group name.",
|
|
16
|
+
"x-prompt": "Which app group should receive the desktop app?"
|
|
17
|
+
},
|
|
18
|
+
"language": {
|
|
19
|
+
"type": "string",
|
|
20
|
+
"description": "Programming language and framework for the desktop app.",
|
|
21
|
+
"enum": ["typescript", "rust", "go", "python"],
|
|
22
|
+
"default": "typescript"
|
|
23
|
+
},
|
|
24
|
+
"directory": {
|
|
25
|
+
"type": "string",
|
|
26
|
+
"description": "Base directory for app groups.",
|
|
27
|
+
"default": "packages"
|
|
28
|
+
},
|
|
29
|
+
"tags": {
|
|
30
|
+
"type": "string",
|
|
31
|
+
"description": "Comma-separated additional tags."
|
|
32
|
+
},
|
|
33
|
+
"skipFormat": {
|
|
34
|
+
"type": "boolean",
|
|
35
|
+
"default": false
|
|
36
|
+
}
|
|
37
|
+
},
|
|
38
|
+
"required": ["name", "app"]
|
|
39
|
+
}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.desktopAppGenerator = void 0;
|
|
4
|
+
var app_1 = require("./generators/app/app");
|
|
5
|
+
Object.defineProperty(exports, "desktopAppGenerator", { enumerable: true, get: function () { return app_1.desktopAppGenerator; } });
|
package/executors.json
ADDED
package/generators.json
ADDED
package/package.json
ADDED
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@empire-builder-kit/desktop",
|
|
3
|
+
"version": "0.0.1-alpha.10",
|
|
4
|
+
"license": "MIT",
|
|
5
|
+
"publishConfig": {
|
|
6
|
+
"access": "public",
|
|
7
|
+
"provenance": false
|
|
8
|
+
},
|
|
9
|
+
"main": "./dist/index.js",
|
|
10
|
+
"module": "./dist/index.js",
|
|
11
|
+
"types": "./dist/index.d.ts",
|
|
12
|
+
"exports": {
|
|
13
|
+
"./package.json": "./package.json",
|
|
14
|
+
".": {
|
|
15
|
+
"@org/source": "./src/index.ts",
|
|
16
|
+
"types": "./dist/index.d.ts",
|
|
17
|
+
"import": "./dist/index.js",
|
|
18
|
+
"default": "./dist/index.js"
|
|
19
|
+
}
|
|
20
|
+
},
|
|
21
|
+
"nx": {
|
|
22
|
+
"name": "@empire-builder-kit/desktop",
|
|
23
|
+
"targets": {
|
|
24
|
+
"build": {
|
|
25
|
+
"executor": "@nx/js:tsc",
|
|
26
|
+
"outputs": [
|
|
27
|
+
"{options.outputPath}"
|
|
28
|
+
],
|
|
29
|
+
"options": {
|
|
30
|
+
"outputPath": "packages/desktop/dist",
|
|
31
|
+
"main": "packages/desktop/src/index.ts",
|
|
32
|
+
"tsConfig": "packages/desktop/tsconfig.lib.json",
|
|
33
|
+
"rootDir": "packages/desktop/src",
|
|
34
|
+
"generatePackageJson": false,
|
|
35
|
+
"assets": [
|
|
36
|
+
{
|
|
37
|
+
"input": "./packages/desktop/src",
|
|
38
|
+
"glob": "**/!(*.ts)",
|
|
39
|
+
"output": "."
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
"input": "./packages/desktop/src",
|
|
43
|
+
"glob": "**/.*",
|
|
44
|
+
"output": "."
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
"input": "./packages/desktop/src",
|
|
48
|
+
"glob": "**/*.d.ts",
|
|
49
|
+
"output": "."
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
"input": "./packages/desktop",
|
|
53
|
+
"glob": "generators.json",
|
|
54
|
+
"output": "."
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
"input": "./packages/desktop",
|
|
58
|
+
"glob": "executors.json",
|
|
59
|
+
"output": "."
|
|
60
|
+
}
|
|
61
|
+
]
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
},
|
|
65
|
+
"tags": [
|
|
66
|
+
"scope:workspace",
|
|
67
|
+
"layer:tooling",
|
|
68
|
+
"visibility:public",
|
|
69
|
+
"npm:public"
|
|
70
|
+
]
|
|
71
|
+
},
|
|
72
|
+
"dependencies": {
|
|
73
|
+
"@nx/devkit": "22.6.5",
|
|
74
|
+
"tslib": "^2.3.0",
|
|
75
|
+
"vitest": "4.1.4"
|
|
76
|
+
},
|
|
77
|
+
"generators": "./generators.json",
|
|
78
|
+
"executors": "./executors.json",
|
|
79
|
+
"files": [
|
|
80
|
+
"dist",
|
|
81
|
+
"!**/*.tsbuildinfo",
|
|
82
|
+
"generators.json",
|
|
83
|
+
"executors.json"
|
|
84
|
+
]
|
|
85
|
+
}
|