reset-framework-cli 1.2.0 → 1.2.2
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 +20 -20
- package/README.md +19 -19
- package/package.json +8 -6
- package/src/commands/build.js +91 -73
- package/src/commands/dev.js +143 -122
- package/src/commands/doctor.js +61 -54
- package/src/commands/init.js +946 -866
- package/src/commands/package.js +68 -68
- package/src/index.js +195 -195
- package/src/lib/backend.js +123 -0
- package/src/lib/context.js +66 -66
- package/src/lib/framework.js +57 -57
- package/src/lib/logger.js +11 -11
- package/src/lib/output.js +251 -236
- package/src/lib/process.js +303 -303
- package/src/lib/project.js +531 -494
- package/src/lib/toolchain.js +62 -62
- package/src/lib/ui.js +244 -244
- package/templates/basic/README.md +15 -15
- package/templates/basic/frontend/README.md +73 -73
- package/templates/basic/frontend/eslint.config.js +23 -23
- package/templates/basic/frontend/index.html +13 -13
- package/templates/basic/frontend/package.json +31 -31
- package/templates/basic/frontend/public/icons.svg +24 -24
- package/templates/basic/frontend/src/App.css +216 -216
- package/templates/basic/frontend/src/App.tsx +77 -77
- package/templates/basic/frontend/src/assets/vite.svg +1 -1
- package/templates/basic/frontend/src/index.css +111 -111
- package/templates/basic/frontend/src/lib/reset.ts +1 -1
- package/templates/basic/frontend/src/main.tsx +10 -10
- package/templates/basic/frontend/tsconfig.app.json +28 -28
- package/templates/basic/frontend/tsconfig.json +7 -7
- package/templates/basic/frontend/tsconfig.node.json +26 -26
- package/templates/basic/frontend/vite.config.ts +16 -16
- package/templates/basic/reset.config.json +58 -58
package/LICENSE
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2026 Jan Kordoš
|
|
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 do so, subject to the
|
|
10
|
-
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
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Jan Kordoš
|
|
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 do so, subject to the
|
|
10
|
+
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
21
|
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
# reset-framework-cli
|
|
2
|
-
|
|
3
|
-
`reset-framework-cli` is the developer-facing command-line interface for Reset Framework.
|
|
4
|
-
|
|
5
|
-
## Install
|
|
6
|
-
|
|
7
|
-
```bash
|
|
8
|
-
npm install -g reset-framework-cli
|
|
9
|
-
```
|
|
10
|
-
|
|
11
|
-
## Commands
|
|
12
|
-
|
|
13
|
-
- `reset-framework-cli create-app my-app`
|
|
14
|
-
- `reset-framework-cli dev`
|
|
15
|
-
- `reset-framework-cli build`
|
|
16
|
-
- `reset-framework-cli package`
|
|
17
|
-
- `reset-framework-cli doctor`
|
|
18
|
-
|
|
1
|
+
# reset-framework-cli
|
|
2
|
+
|
|
3
|
+
`reset-framework-cli` is the developer-facing command-line interface for Reset Framework.
|
|
4
|
+
|
|
5
|
+
## Install
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install -g reset-framework-cli
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Commands
|
|
12
|
+
|
|
13
|
+
- `reset-framework-cli create-app my-app`
|
|
14
|
+
- `reset-framework-cli dev`
|
|
15
|
+
- `reset-framework-cli build`
|
|
16
|
+
- `reset-framework-cli package`
|
|
17
|
+
- `reset-framework-cli doctor`
|
|
18
|
+
|
|
19
19
|
## Package boundary
|
|
20
20
|
|
|
21
21
|
- `reset-framework-cli` orchestrates the framework.
|
|
@@ -23,7 +23,7 @@ npm install -g reset-framework-cli
|
|
|
23
23
|
- `@reset-framework/native` provides the CMake-based runtime source package.
|
|
24
24
|
- `@reset-framework/sdk` provides the frontend bridge package.
|
|
25
25
|
- `@reset-framework/schema` provides the config schema package.
|
|
26
|
-
|
|
26
|
+
|
|
27
27
|
## How it works
|
|
28
28
|
|
|
29
29
|
- `reset-framework-cli dev` and `reset-framework-cli build` use the bundled runtime package for the current platform by default.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "reset-framework-cli",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.2",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Command-line tooling for Reset Framework.",
|
|
6
6
|
"license": "MIT",
|
|
@@ -11,13 +11,15 @@
|
|
|
11
11
|
"node": ">=20.19.0"
|
|
12
12
|
},
|
|
13
13
|
"dependencies": {
|
|
14
|
-
"@reset-framework/
|
|
15
|
-
"@reset-framework/
|
|
14
|
+
"@reset-framework/backend": "1.2.2",
|
|
15
|
+
"@reset-framework/schema": "1.2.2",
|
|
16
|
+
"@reset-framework/sdk": "1.2.2",
|
|
17
|
+
"esbuild": "^0.25.10"
|
|
16
18
|
},
|
|
17
19
|
"optionalDependencies": {
|
|
18
|
-
"@reset-framework/runtime-darwin-arm64": "1.2.
|
|
19
|
-
"@reset-framework/runtime-darwin-x64": "1.2.
|
|
20
|
-
"@reset-framework/runtime-win32-x64": "1.2.
|
|
20
|
+
"@reset-framework/runtime-darwin-arm64": "1.2.2",
|
|
21
|
+
"@reset-framework/runtime-darwin-x64": "1.2.2",
|
|
22
|
+
"@reset-framework/runtime-win32-x64": "1.2.2"
|
|
21
23
|
},
|
|
22
24
|
"bin": {
|
|
23
25
|
"reset-framework-cli": "src/index.js"
|
package/src/commands/build.js
CHANGED
|
@@ -1,65 +1,70 @@
|
|
|
1
1
|
import { prepareFrameworkRuntime } from "../lib/framework.js"
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
2
|
+
import { prepareAppBackend } from "../lib/backend.js"
|
|
3
|
+
import { stageMacOSAppBundle, stageWindowsAppBundle } from "../lib/output.js"
|
|
4
|
+
import { resolvePackageManagerCommand, runCommand } from "../lib/process.js"
|
|
5
|
+
import {
|
|
6
|
+
assertAppProject,
|
|
7
|
+
assertFrameworkInstall,
|
|
8
|
+
loadResetConfig,
|
|
9
|
+
resolveAppOutputPaths,
|
|
10
|
+
resolveAppPaths,
|
|
11
|
+
resolveAppPackageManager,
|
|
11
12
|
resolveConfigPath,
|
|
12
13
|
resolveFrontendDir,
|
|
13
14
|
resolveFrameworkBuildPaths,
|
|
14
15
|
resolveFrameworkRuntimeStrategy,
|
|
15
|
-
resolveFrameworkPaths
|
|
16
|
+
resolveFrameworkPaths,
|
|
17
|
+
resolveOptionalBackendEntry
|
|
16
18
|
} from "../lib/project.js"
|
|
17
|
-
import {
|
|
18
|
-
createProgress,
|
|
19
|
-
printBanner,
|
|
20
|
-
printKeyValueTable,
|
|
21
|
-
printSection,
|
|
22
|
-
printStatusTable
|
|
23
|
-
} from "../lib/ui.js"
|
|
24
|
-
|
|
25
|
-
export const description = "Build the frontend, runtime, and final desktop app bundle"
|
|
26
|
-
|
|
27
|
-
export async function run(context) {
|
|
19
|
+
import {
|
|
20
|
+
createProgress,
|
|
21
|
+
printBanner,
|
|
22
|
+
printKeyValueTable,
|
|
23
|
+
printSection,
|
|
24
|
+
printStatusTable
|
|
25
|
+
} from "../lib/ui.js"
|
|
26
|
+
|
|
27
|
+
export const description = "Build the frontend, runtime, and final desktop app bundle"
|
|
28
|
+
|
|
29
|
+
export async function run(context) {
|
|
28
30
|
const dryRun = Boolean(context.flags["dry-run"])
|
|
29
31
|
const skipFrontend = Boolean(context.flags["skip-frontend"])
|
|
30
32
|
const skipRuntime = Boolean(context.flags["skip-runtime"])
|
|
31
33
|
const skipStage = Boolean(context.flags["skip-stage"])
|
|
32
34
|
const preferSource = Boolean(context.flags["runtime-source"])
|
|
33
|
-
|
|
34
|
-
const appPaths = resolveAppPaths(context.projectRoot)
|
|
35
|
-
const frameworkPaths = resolveFrameworkPaths()
|
|
36
|
-
assertAppProject(appPaths)
|
|
37
|
-
assertFrameworkInstall(frameworkPaths)
|
|
38
|
-
const config = loadResetConfig(appPaths)
|
|
39
|
-
assertAppProject(appPaths, config)
|
|
40
|
-
const packageManager = resolveAppPackageManager(appPaths, config)
|
|
35
|
+
|
|
36
|
+
const appPaths = resolveAppPaths(context.projectRoot)
|
|
37
|
+
const frameworkPaths = resolveFrameworkPaths()
|
|
38
|
+
assertAppProject(appPaths)
|
|
39
|
+
assertFrameworkInstall(frameworkPaths)
|
|
40
|
+
const config = loadResetConfig(appPaths)
|
|
41
|
+
assertAppProject(appPaths, config)
|
|
42
|
+
const packageManager = resolveAppPackageManager(appPaths, config)
|
|
41
43
|
const outputPaths = resolveAppOutputPaths(appPaths, config)
|
|
42
44
|
const configPath = resolveConfigPath(appPaths)
|
|
43
45
|
const frontendDir = resolveFrontendDir(appPaths, config)
|
|
46
|
+
const backendEntry = resolveOptionalBackendEntry(appPaths)
|
|
44
47
|
const frameworkBuildPaths = resolveFrameworkBuildPaths(appPaths)
|
|
45
48
|
const runtimeStrategy = resolveFrameworkRuntimeStrategy(frameworkPaths, { preferSource })
|
|
46
49
|
const steps = [
|
|
47
50
|
!skipFrontend ? "Build frontend" : null,
|
|
48
51
|
!skipRuntime ? "Prepare runtime" : null,
|
|
52
|
+
!skipStage && backendEntry ? "Bundle backend sidecar" : null,
|
|
49
53
|
!skipStage ? "Stage desktop bundle" : null
|
|
50
54
|
].filter(Boolean)
|
|
51
|
-
|
|
52
|
-
printBanner("reset-framework-cli build", description)
|
|
53
|
-
printSection("Project")
|
|
55
|
+
|
|
56
|
+
printBanner("reset-framework-cli build", description)
|
|
57
|
+
printSection("Project")
|
|
54
58
|
printKeyValueTable([
|
|
55
59
|
["Config", configPath],
|
|
56
60
|
["Frontend", frontendDir],
|
|
61
|
+
["Backend", backendEntry ?? "not configured"],
|
|
57
62
|
["Package manager", packageManager],
|
|
58
63
|
["Output", outputPaths.appBundlePath],
|
|
59
64
|
["Runtime", `${runtimeStrategy.kind === "prebuilt" ? "bundled" : "source"} (${runtimeStrategy.label})`]
|
|
60
65
|
])
|
|
61
|
-
console.log("")
|
|
62
|
-
|
|
66
|
+
console.log("")
|
|
67
|
+
|
|
63
68
|
printSection("Plan")
|
|
64
69
|
printStatusTable([
|
|
65
70
|
[skipFrontend ? "skip" : "ready", "Frontend", skipFrontend ? "Skipping frontend build" : "Build static frontend assets"],
|
|
@@ -70,38 +75,45 @@ export async function run(context) {
|
|
|
70
75
|
? (runtimeStrategy.kind === "prebuilt" ? "Reuse the bundled runtime package" : "Skip the source runtime build")
|
|
71
76
|
: (runtimeStrategy.kind === "prebuilt" ? "Use the bundled runtime package" : "Configure and build the runtime from source")
|
|
72
77
|
],
|
|
78
|
+
[
|
|
79
|
+
backendEntry && !skipStage ? "ready" : "skip",
|
|
80
|
+
"Backend",
|
|
81
|
+
backendEntry && !skipStage ? "Bundle the optional TypeScript sidecar backend" : "No backend staging is required"
|
|
82
|
+
],
|
|
73
83
|
[skipStage ? "skip" : "ready", "Bundle", skipStage ? "Skipping app bundle staging" : "Assemble the final desktop app bundle"]
|
|
74
84
|
])
|
|
75
|
-
|
|
76
|
-
if (dryRun) {
|
|
77
|
-
console.log("")
|
|
78
|
-
printSection("Dry run")
|
|
79
|
-
printStatusTable(
|
|
80
|
-
steps.length > 0
|
|
81
|
-
? steps.map((step) => ["plan", step, "No changes will be written"])
|
|
82
|
-
: [["warn", "Nothing to do", "All build phases were skipped"]]
|
|
83
|
-
)
|
|
84
|
-
return
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
if (steps.length === 0) {
|
|
88
|
-
console.log("")
|
|
89
|
-
printSection("Result")
|
|
90
|
-
printStatusTable([["warn", "Nothing to do", "All build phases were skipped"]])
|
|
91
|
-
return
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
console.log("")
|
|
95
|
-
const progress = createProgress(steps.length, "Build")
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
85
|
+
|
|
86
|
+
if (dryRun) {
|
|
87
|
+
console.log("")
|
|
88
|
+
printSection("Dry run")
|
|
89
|
+
printStatusTable(
|
|
90
|
+
steps.length > 0
|
|
91
|
+
? steps.map((step) => ["plan", step, "No changes will be written"])
|
|
92
|
+
: [["warn", "Nothing to do", "All build phases were skipped"]]
|
|
93
|
+
)
|
|
94
|
+
return
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
if (steps.length === 0) {
|
|
98
|
+
console.log("")
|
|
99
|
+
printSection("Result")
|
|
100
|
+
printStatusTable([["warn", "Nothing to do", "All build phases were skipped"]])
|
|
101
|
+
return
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
console.log("")
|
|
105
|
+
const progress = createProgress(steps.length, "Build")
|
|
106
|
+
|
|
107
|
+
let backendArtifact = null
|
|
108
|
+
|
|
109
|
+
if (!skipFrontend) {
|
|
110
|
+
await runCommand(resolvePackageManagerCommand(packageManager), ["run", "build"], {
|
|
111
|
+
cwd: frontendDir,
|
|
112
|
+
dryRun
|
|
113
|
+
})
|
|
114
|
+
progress.tick("Frontend assets built")
|
|
115
|
+
}
|
|
116
|
+
|
|
105
117
|
if (!skipRuntime) {
|
|
106
118
|
const preparedRuntime = await prepareFrameworkRuntime(frameworkPaths, frameworkBuildPaths, "release", {
|
|
107
119
|
cwd: appPaths.appRoot,
|
|
@@ -111,21 +123,27 @@ export async function run(context) {
|
|
|
111
123
|
progress.tick(preparedRuntime.kind === "prebuilt" ? "Bundled runtime ready" : "Native runtime built")
|
|
112
124
|
}
|
|
113
125
|
|
|
126
|
+
if (!skipStage && backendEntry) {
|
|
127
|
+
backendArtifact = await prepareAppBackend(frameworkPaths, appPaths, "release")
|
|
128
|
+
progress.tick("Backend sidecar bundled")
|
|
129
|
+
}
|
|
130
|
+
|
|
114
131
|
if (!skipStage) {
|
|
115
132
|
const stageBundle = process.platform === "win32" ? stageWindowsAppBundle : stageMacOSAppBundle
|
|
116
133
|
await stageBundle(frameworkPaths, frameworkBuildPaths, config, {
|
|
117
134
|
dryRun,
|
|
118
135
|
outputPaths,
|
|
119
136
|
configPath,
|
|
120
|
-
preferSource
|
|
137
|
+
preferSource,
|
|
138
|
+
backendArtifact
|
|
121
139
|
})
|
|
122
140
|
progress.tick("Desktop app bundle staged")
|
|
123
141
|
}
|
|
124
|
-
|
|
125
|
-
console.log("")
|
|
126
|
-
printSection("Result")
|
|
127
|
-
printStatusTable([
|
|
128
|
-
["done", "Build output", outputPaths.outputRoot],
|
|
129
|
-
["done", "Desktop app", outputPaths.appBundlePath]
|
|
130
|
-
])
|
|
131
|
-
}
|
|
142
|
+
|
|
143
|
+
console.log("")
|
|
144
|
+
printSection("Result")
|
|
145
|
+
printStatusTable([
|
|
146
|
+
["done", "Build output", outputPaths.outputRoot],
|
|
147
|
+
["done", "Desktop app", outputPaths.appBundlePath]
|
|
148
|
+
])
|
|
149
|
+
}
|
package/src/commands/dev.js
CHANGED
|
@@ -1,71 +1,76 @@
|
|
|
1
1
|
import { prepareFrameworkRuntime } from "../lib/framework.js"
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
2
|
+
import { prepareAppBackend } from "../lib/backend.js"
|
|
3
|
+
import {
|
|
4
|
+
registerChildCleanup,
|
|
5
|
+
resolvePackageManagerCommand,
|
|
6
|
+
spawnCommand,
|
|
7
|
+
waitForProcessExit,
|
|
8
|
+
waitForUrl
|
|
9
|
+
} from "../lib/process.js"
|
|
10
|
+
import {
|
|
11
|
+
assertAppProject,
|
|
12
|
+
assertFrameworkInstall,
|
|
13
|
+
loadResetConfig,
|
|
14
|
+
resolveAppPaths,
|
|
15
|
+
resolveAppPackageManager,
|
|
15
16
|
resolveConfigPath,
|
|
16
17
|
resolveDevServerOptions,
|
|
17
18
|
resolveFrontendDir,
|
|
18
19
|
resolveFrameworkBuildPaths,
|
|
19
20
|
resolveFrameworkRuntimeBinary,
|
|
20
21
|
resolveFrameworkRuntimeStrategy,
|
|
21
|
-
resolveFrameworkPaths
|
|
22
|
+
resolveFrameworkPaths,
|
|
23
|
+
resolveOptionalBackendEntry
|
|
22
24
|
} from "../lib/project.js"
|
|
23
|
-
import {
|
|
24
|
-
createProgress,
|
|
25
|
-
printBanner,
|
|
26
|
-
printKeyValueTable,
|
|
27
|
-
printSection,
|
|
28
|
-
printStatusTable
|
|
29
|
-
} from "../lib/ui.js"
|
|
30
|
-
|
|
31
|
-
export const description = "Run the frontend dev server and native host"
|
|
32
|
-
|
|
33
|
-
export async function run(context) {
|
|
25
|
+
import {
|
|
26
|
+
createProgress,
|
|
27
|
+
printBanner,
|
|
28
|
+
printKeyValueTable,
|
|
29
|
+
printSection,
|
|
30
|
+
printStatusTable
|
|
31
|
+
} from "../lib/ui.js"
|
|
32
|
+
|
|
33
|
+
export const description = "Run the frontend dev server and native host"
|
|
34
|
+
|
|
35
|
+
export async function run(context) {
|
|
34
36
|
const dryRun = Boolean(context.flags["dry-run"])
|
|
35
37
|
const skipFrontend = Boolean(context.flags["skip-frontend"])
|
|
36
38
|
const skipRuntime = Boolean(context.flags["skip-runtime"])
|
|
37
39
|
const noOpen = Boolean(context.flags["no-open"])
|
|
38
40
|
const preferSource = Boolean(context.flags["runtime-source"])
|
|
39
|
-
|
|
40
|
-
const appPaths = resolveAppPaths(context.projectRoot)
|
|
41
|
-
const frameworkPaths = resolveFrameworkPaths()
|
|
42
|
-
assertAppProject(appPaths)
|
|
43
|
-
assertFrameworkInstall(frameworkPaths)
|
|
44
|
-
const config = loadResetConfig(appPaths)
|
|
45
|
-
assertAppProject(appPaths, config)
|
|
46
|
-
const packageManager = resolveAppPackageManager(appPaths, config)
|
|
47
|
-
const devServer = resolveDevServerOptions(config)
|
|
41
|
+
|
|
42
|
+
const appPaths = resolveAppPaths(context.projectRoot)
|
|
43
|
+
const frameworkPaths = resolveFrameworkPaths()
|
|
44
|
+
assertAppProject(appPaths)
|
|
45
|
+
assertFrameworkInstall(frameworkPaths)
|
|
46
|
+
const config = loadResetConfig(appPaths)
|
|
47
|
+
assertAppProject(appPaths, config)
|
|
48
|
+
const packageManager = resolveAppPackageManager(appPaths, config)
|
|
49
|
+
const devServer = resolveDevServerOptions(config)
|
|
48
50
|
const configPath = resolveConfigPath(appPaths)
|
|
49
51
|
const frontendDir = resolveFrontendDir(appPaths, config)
|
|
52
|
+
const backendEntry = resolveOptionalBackendEntry(appPaths)
|
|
50
53
|
const frameworkBuildPaths = resolveFrameworkBuildPaths(appPaths)
|
|
51
54
|
const runtimeStrategy = resolveFrameworkRuntimeStrategy(frameworkPaths, { preferSource })
|
|
52
55
|
const steps = [
|
|
53
56
|
!skipRuntime ? "Prepare runtime" : null,
|
|
57
|
+
backendEntry ? "Bundle backend sidecar" : null,
|
|
54
58
|
!skipFrontend ? "Start frontend dev server" : null,
|
|
55
59
|
!noOpen ? "Launch desktop window" : null
|
|
56
60
|
].filter(Boolean)
|
|
57
|
-
|
|
58
|
-
printBanner("reset-framework-cli dev", description)
|
|
59
|
-
printSection("Project")
|
|
61
|
+
|
|
62
|
+
printBanner("reset-framework-cli dev", description)
|
|
63
|
+
printSection("Project")
|
|
60
64
|
printKeyValueTable([
|
|
61
65
|
["Config", configPath],
|
|
62
66
|
["Frontend", frontendDir],
|
|
67
|
+
["Backend", backendEntry ?? "not configured"],
|
|
63
68
|
["Package manager", packageManager],
|
|
64
69
|
["Dev URL", config.frontend.devUrl],
|
|
65
70
|
["Runtime", `${runtimeStrategy.kind === "prebuilt" ? "bundled" : "source"} (${runtimeStrategy.label})`]
|
|
66
71
|
])
|
|
67
|
-
console.log("")
|
|
68
|
-
|
|
72
|
+
console.log("")
|
|
73
|
+
|
|
69
74
|
printSection("Plan")
|
|
70
75
|
printStatusTable([
|
|
71
76
|
[
|
|
@@ -75,29 +80,30 @@ export async function run(context) {
|
|
|
75
80
|
? (runtimeStrategy.kind === "prebuilt" ? "Reuse the bundled runtime package" : "Reuse the existing source runtime build")
|
|
76
81
|
: (runtimeStrategy.kind === "prebuilt" ? "Use the bundled runtime package" : "Configure and build the runtime from source")
|
|
77
82
|
],
|
|
83
|
+
[backendEntry ? "ready" : "skip", "Backend", backendEntry ? "Bundle the optional TypeScript sidecar backend" : "No backend entry was found under backend/"],
|
|
78
84
|
[skipFrontend ? "skip" : "ready", "Frontend", skipFrontend ? "Expecting an already running dev server" : "Start the frontend dev server and wait for readiness"],
|
|
79
85
|
[noOpen ? "skip" : "ready", "Window", noOpen ? "Do not launch the desktop window" : "Start the native host with the active project config"]
|
|
80
86
|
])
|
|
81
|
-
|
|
82
|
-
if (dryRun) {
|
|
83
|
-
console.log("")
|
|
84
|
-
printSection("Dry run")
|
|
85
|
-
printStatusTable(
|
|
86
|
-
steps.length > 0
|
|
87
|
-
? steps.map((step) => ["plan", step, "No processes will be started"])
|
|
88
|
-
: [["warn", "Nothing to do", "All dev phases were skipped"]]
|
|
89
|
-
)
|
|
90
|
-
return
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
if (steps.length === 0) {
|
|
94
|
-
console.log("")
|
|
95
|
-
printSection("Result")
|
|
96
|
-
printStatusTable([["warn", "Nothing to do", "All dev phases were skipped"]])
|
|
97
|
-
return
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
console.log("")
|
|
87
|
+
|
|
88
|
+
if (dryRun) {
|
|
89
|
+
console.log("")
|
|
90
|
+
printSection("Dry run")
|
|
91
|
+
printStatusTable(
|
|
92
|
+
steps.length > 0
|
|
93
|
+
? steps.map((step) => ["plan", step, "No processes will be started"])
|
|
94
|
+
: [["warn", "Nothing to do", "All dev phases were skipped"]]
|
|
95
|
+
)
|
|
96
|
+
return
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
if (steps.length === 0) {
|
|
100
|
+
console.log("")
|
|
101
|
+
printSection("Result")
|
|
102
|
+
printStatusTable([["warn", "Nothing to do", "All dev phases were skipped"]])
|
|
103
|
+
return
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
console.log("")
|
|
101
107
|
const progress = createProgress(steps.length, "Dev")
|
|
102
108
|
|
|
103
109
|
if (!skipRuntime) {
|
|
@@ -108,72 +114,87 @@ export async function run(context) {
|
|
|
108
114
|
})
|
|
109
115
|
progress.tick(preparedRuntime.kind === "prebuilt" ? "Bundled runtime ready" : "Native runtime built")
|
|
110
116
|
}
|
|
111
|
-
|
|
112
|
-
const children = []
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
"
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
|
|
117
|
+
|
|
118
|
+
const children = []
|
|
119
|
+
let backendArtifact = null
|
|
120
|
+
|
|
121
|
+
if (backendEntry) {
|
|
122
|
+
backendArtifact = await prepareAppBackend(frameworkPaths, appPaths, "dev")
|
|
123
|
+
progress.tick("Backend sidecar bundled")
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
if (!skipFrontend) {
|
|
127
|
+
const frontendProcess = spawnCommand(resolvePackageManagerCommand(packageManager), [
|
|
128
|
+
"run",
|
|
129
|
+
"dev",
|
|
130
|
+
"--",
|
|
131
|
+
"--host",
|
|
132
|
+
devServer.host,
|
|
133
|
+
"--port",
|
|
134
|
+
devServer.port,
|
|
135
|
+
"--strictPort"
|
|
136
|
+
], {
|
|
137
|
+
cwd: frontendDir,
|
|
138
|
+
dryRun
|
|
139
|
+
})
|
|
140
|
+
|
|
141
|
+
if (frontendProcess) {
|
|
142
|
+
children.push(frontendProcess)
|
|
143
|
+
await waitForUrl(config.frontend.devUrl)
|
|
144
|
+
progress.tick("Frontend dev server is reachable")
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
|
|
136
148
|
if (!noOpen) {
|
|
137
149
|
const appBinary = resolveFrameworkRuntimeBinary(frameworkPaths, frameworkBuildPaths, "dev", {
|
|
138
150
|
mustExist: !dryRun,
|
|
139
151
|
strategy: runtimeStrategy
|
|
140
152
|
})
|
|
141
153
|
const appProcess = spawnCommand(appBinary, [], {
|
|
142
|
-
cwd: appPaths.appRoot,
|
|
143
|
-
env: {
|
|
144
|
-
RESET_CONFIG_PATH: configPath,
|
|
145
|
-
RESET_FRONTEND_DEV_URL: config.frontend.devUrl
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
154
|
+
cwd: appPaths.appRoot,
|
|
155
|
+
env: {
|
|
156
|
+
RESET_CONFIG_PATH: configPath,
|
|
157
|
+
RESET_FRONTEND_DEV_URL: config.frontend.devUrl,
|
|
158
|
+
...(backendArtifact
|
|
159
|
+
? {
|
|
160
|
+
RESET_BACKEND_EXECUTABLE: backendArtifact.runtimeExecutablePath,
|
|
161
|
+
RESET_BACKEND_RUNNER: backendArtifact.runnerPath,
|
|
162
|
+
RESET_BACKEND_ENTRY: backendArtifact.bundleEntryPath,
|
|
163
|
+
RESET_BACKEND_WORKING_DIRECTORY: backendArtifact.workingDirectory
|
|
164
|
+
}
|
|
165
|
+
: {})
|
|
166
|
+
},
|
|
167
|
+
dryRun
|
|
168
|
+
})
|
|
169
|
+
|
|
170
|
+
if (appProcess) {
|
|
171
|
+
children.push(appProcess)
|
|
172
|
+
progress.tick("Desktop window launched")
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
if (children.length === 0) {
|
|
177
|
+
return
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
console.log("")
|
|
181
|
+
printSection("Runtime")
|
|
182
|
+
printStatusTable([
|
|
183
|
+
["done", "Frontend", config.frontend.devUrl],
|
|
184
|
+
["done", "Config", configPath],
|
|
185
|
+
["done", "Backend", backendArtifact ? backendArtifact.bundleEntryPath : "disabled"]
|
|
186
|
+
])
|
|
187
|
+
console.log(" Press Ctrl+C to stop")
|
|
188
|
+
|
|
189
|
+
const cleanup = registerChildCleanup(children)
|
|
190
|
+
|
|
191
|
+
try {
|
|
192
|
+
await Promise.race([
|
|
193
|
+
...children.map((child, index) =>
|
|
194
|
+
waitForProcessExit(child, index === 0 ? "dev process" : "native host")
|
|
195
|
+
)
|
|
196
|
+
])
|
|
197
|
+
} finally {
|
|
198
|
+
await cleanup()
|
|
199
|
+
}
|
|
200
|
+
}
|