plusui-native 0.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.
- package/README.md +162 -0
- package/package.json +36 -0
- package/src/assets/icon-generator.js +251 -0
- package/src/assets/resource-embedder.js +351 -0
- package/src/doctor/detectors/cmake.js +84 -0
- package/src/doctor/detectors/compiler.js +145 -0
- package/src/doctor/detectors/just.js +45 -0
- package/src/doctor/detectors/nodejs.js +57 -0
- package/src/doctor/detectors/webview2.js +66 -0
- package/src/doctor/index.js +184 -0
- package/src/doctor/installers/linux.js +121 -0
- package/src/doctor/installers/macos.js +123 -0
- package/src/doctor/installers/windows.js +117 -0
- package/src/doctor/reporter.js +219 -0
- package/src/index.js +904 -0
- package/templates/base/Justfile +115 -0
- package/templates/base/README.md.template +168 -0
- package/templates/base/assets/README.md +88 -0
- package/templates/base/assets/icon.png +0 -0
- package/templates/manager.js +217 -0
- package/templates/react/.vscode/c_cpp_properties.json +24 -0
- package/templates/react/CMakeLists.txt.template +151 -0
- package/templates/react/frontend/index.html +12 -0
- package/templates/react/frontend/package.json.template +24 -0
- package/templates/react/frontend/src/App.tsx +134 -0
- package/templates/react/frontend/src/main.tsx +10 -0
- package/templates/react/frontend/src/styles/app.css +140 -0
- package/templates/react/frontend/tsconfig.json +21 -0
- package/templates/react/frontend/tsconfig.node.json +11 -0
- package/templates/react/frontend/vite.config.ts +14 -0
- package/templates/react/main.cpp.template +201 -0
- package/templates/react/package.json.template +23 -0
- package/templates/solid/.vscode/c_cpp_properties.json +24 -0
- package/templates/solid/CMakeLists.txt.template +151 -0
- package/templates/solid/frontend/index.html +12 -0
- package/templates/solid/frontend/package.json.template +21 -0
- package/templates/solid/frontend/src/App.tsx +133 -0
- package/templates/solid/frontend/src/main.tsx +5 -0
- package/templates/solid/frontend/src/styles/app.css +140 -0
- package/templates/solid/frontend/tsconfig.json +22 -0
- package/templates/solid/frontend/tsconfig.node.json +11 -0
- package/templates/solid/frontend/vite.config.ts +14 -0
- package/templates/solid/main.cpp.template +192 -0
- package/templates/solid/package.json.template +23 -0
|
@@ -0,0 +1,219 @@
|
|
|
1
|
+
import chalk from 'chalk';
|
|
2
|
+
import os from 'os';
|
|
3
|
+
|
|
4
|
+
export class DoctorReporter {
|
|
5
|
+
formatResults(results) {
|
|
6
|
+
let output = '';
|
|
7
|
+
|
|
8
|
+
// System Information
|
|
9
|
+
output += chalk.bold('\nSystem Information\n');
|
|
10
|
+
output += '==================\n';
|
|
11
|
+
output += `OS: ${os.type()} ${os.release()}\n`;
|
|
12
|
+
output += `Platform: ${results.platform} ${os.arch()}\n`;
|
|
13
|
+
output += `CPUs: ${os.cpus()[0].model} (${os.cpus().length} cores)\n`;
|
|
14
|
+
output += `Memory: ${Math.round(os.totalmem() / (1024 ** 3))} GB\n`;
|
|
15
|
+
|
|
16
|
+
// Required Tools
|
|
17
|
+
output += chalk.bold('\n\nRequired Tools\n');
|
|
18
|
+
output += '==============\n';
|
|
19
|
+
|
|
20
|
+
// Node.js
|
|
21
|
+
if (results.nodejs.found) {
|
|
22
|
+
if (results.nodejs.valid) {
|
|
23
|
+
output += chalk.green(`✓ Node.js v${results.nodejs.version}\n`);
|
|
24
|
+
} else {
|
|
25
|
+
output += chalk.yellow(`⚠ Node.js v${results.nodejs.version} (requires >= ${results.nodejs.requiredVersion})\n`);
|
|
26
|
+
}
|
|
27
|
+
} else {
|
|
28
|
+
output += chalk.red(`✗ Node.js Not found (requires >= ${results.nodejs.requiredVersion})\n`);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
// npm
|
|
32
|
+
if (results.nodejs.npm.found) {
|
|
33
|
+
if (results.nodejs.npm.valid) {
|
|
34
|
+
output += chalk.green(`✓ npm v${results.nodejs.npm.version}\n`);
|
|
35
|
+
} else {
|
|
36
|
+
output += chalk.yellow(`⚠ npm v${results.nodejs.npm.version} (requires >= ${results.nodejs.npm.requiredVersion})\n`);
|
|
37
|
+
}
|
|
38
|
+
} else {
|
|
39
|
+
output += chalk.red(`✗ npm Not found\n`);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
// CMake
|
|
43
|
+
if (results.cmake.found) {
|
|
44
|
+
if (results.cmake.valid) {
|
|
45
|
+
output += chalk.green(`✓ CMake ${results.cmake.version}`);
|
|
46
|
+
if (results.cmake.path !== 'cmake') {
|
|
47
|
+
output += chalk.gray(` (${results.cmake.path})`);
|
|
48
|
+
}
|
|
49
|
+
output += '\n';
|
|
50
|
+
} else {
|
|
51
|
+
output += chalk.yellow(`⚠ CMake ${results.cmake.version} (requires >= ${results.cmake.requiredVersion})\n`);
|
|
52
|
+
}
|
|
53
|
+
} else {
|
|
54
|
+
output += chalk.red(`✗ CMake Not found (requires >= ${results.cmake.requiredVersion})\n`);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
// Compiler
|
|
58
|
+
if (results.compiler.found) {
|
|
59
|
+
if (results.compiler.valid) {
|
|
60
|
+
output += chalk.green(`✓ ${results.compiler.name}`);
|
|
61
|
+
if (results.compiler.version) {
|
|
62
|
+
output += ` ${results.compiler.version}`;
|
|
63
|
+
}
|
|
64
|
+
output += '\n';
|
|
65
|
+
} else {
|
|
66
|
+
output += chalk.yellow(`⚠ ${results.compiler.name} (incomplete installation)\n`);
|
|
67
|
+
}
|
|
68
|
+
} else {
|
|
69
|
+
output += chalk.red(`✗ ${results.compiler.name}\n`);
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
// Just
|
|
73
|
+
if (results.just.found) {
|
|
74
|
+
if (results.just.valid) {
|
|
75
|
+
output += chalk.green(`✓ Just v${results.just.version}\n`);
|
|
76
|
+
} else {
|
|
77
|
+
output += chalk.yellow(`⚠ Just v${results.just.version} (requires >= ${results.just.requiredVersion})\n`);
|
|
78
|
+
}
|
|
79
|
+
} else {
|
|
80
|
+
output += chalk.red(`✗ Just Not found\n`);
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
// WebView2
|
|
84
|
+
if (results.webview2.platform === 'win32') {
|
|
85
|
+
if (results.webview2.found) {
|
|
86
|
+
output += chalk.green(`✓ WebView2 v${results.webview2.version}\n`);
|
|
87
|
+
} else {
|
|
88
|
+
output += chalk.red(`✗ WebView2 Runtime Not Found (Required for Windows)\n`);
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
// Installation instructions for missing tools
|
|
93
|
+
const missingTools = [];
|
|
94
|
+
|
|
95
|
+
if (!results.nodejs.found || !results.nodejs.valid) {
|
|
96
|
+
missingTools.push({ name: 'nodejs', info: results.nodejs });
|
|
97
|
+
}
|
|
98
|
+
if (!results.cmake.found || !results.cmake.valid) {
|
|
99
|
+
missingTools.push({ name: 'cmake', info: results.cmake });
|
|
100
|
+
}
|
|
101
|
+
if (!results.compiler.found || !results.compiler.valid) {
|
|
102
|
+
missingTools.push({ name: 'compiler', info: results.compiler });
|
|
103
|
+
}
|
|
104
|
+
if (!results.just.found || !results.just.valid) {
|
|
105
|
+
missingTools.push({ name: 'just', info: results.just });
|
|
106
|
+
}
|
|
107
|
+
if (results.webview2.platform === 'win32' && !results.webview2.found) {
|
|
108
|
+
missingTools.push({ name: 'webview2', info: results.webview2 });
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
if (missingTools.length > 0) {
|
|
112
|
+
output += chalk.bold('\n\nInstallation Instructions\n');
|
|
113
|
+
output += '=========================\n';
|
|
114
|
+
|
|
115
|
+
for (const tool of missingTools) {
|
|
116
|
+
output += this.formatInstallInstructions(tool.name, results.platform);
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
output += '\n' + chalk.yellow('Or run: plusui doctor --fix (to attempt automatic installation)\n');
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
// Summary
|
|
123
|
+
output += chalk.bold('\n\nSummary\n');
|
|
124
|
+
output += '=======\n';
|
|
125
|
+
|
|
126
|
+
if (missingTools.length === 0) {
|
|
127
|
+
output += chalk.green('Status: ✓ Ready to build PlusUI apps!\n');
|
|
128
|
+
} else {
|
|
129
|
+
output += chalk.red(`Status: ✗ Needs Setup\n`);
|
|
130
|
+
output += `Missing: ${missingTools.length} required tool(s)\n`;
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
console.log(output);
|
|
134
|
+
|
|
135
|
+
return missingTools.length === 0;
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
formatInstallInstructions(toolName, platform) {
|
|
139
|
+
let output = '\n';
|
|
140
|
+
|
|
141
|
+
switch (toolName) {
|
|
142
|
+
case 'nodejs':
|
|
143
|
+
output += chalk.bold('Node.js\n');
|
|
144
|
+
if (platform === 'win32') {
|
|
145
|
+
output += ' Install: winget install -e --id OpenJS.NodeJS\n';
|
|
146
|
+
output += ' Or download from: https://nodejs.org/\n';
|
|
147
|
+
} else if (platform === 'darwin') {
|
|
148
|
+
output += ' Install: brew install node\n';
|
|
149
|
+
output += ' Or download from: https://nodejs.org/\n';
|
|
150
|
+
} else {
|
|
151
|
+
output += ' Ubuntu/Debian: sudo apt install -y nodejs npm\n';
|
|
152
|
+
output += ' Fedora: sudo dnf install -y nodejs\n';
|
|
153
|
+
output += ' Or download from: https://nodejs.org/\n';
|
|
154
|
+
}
|
|
155
|
+
break;
|
|
156
|
+
|
|
157
|
+
case 'cmake':
|
|
158
|
+
output += chalk.bold('CMake\n');
|
|
159
|
+
if (platform === 'win32') {
|
|
160
|
+
output += ' Install: winget install -e --id Kitware.CMake\n';
|
|
161
|
+
output += ' Or download from: https://cmake.org/download/\n';
|
|
162
|
+
} else if (platform === 'darwin') {
|
|
163
|
+
output += ' Install: brew install cmake\n';
|
|
164
|
+
output += ' Or download from: https://cmake.org/download/\n';
|
|
165
|
+
} else {
|
|
166
|
+
output += ' Ubuntu/Debian: sudo apt install -y cmake\n';
|
|
167
|
+
output += ' Fedora: sudo dnf install -y cmake\n';
|
|
168
|
+
output += ' Or download from: https://cmake.org/download/\n';
|
|
169
|
+
}
|
|
170
|
+
break;
|
|
171
|
+
|
|
172
|
+
case 'compiler':
|
|
173
|
+
output += chalk.bold('C++ Compiler\n');
|
|
174
|
+
if (platform === 'win32') {
|
|
175
|
+
output += ' Visual Studio 2022 with C++ workload is required.\n\n';
|
|
176
|
+
output += ' Installation:\n';
|
|
177
|
+
output += ' 1. Download from: https://visualstudio.microsoft.com/downloads/\n';
|
|
178
|
+
output += ' 2. Run the installer\n';
|
|
179
|
+
output += ' 3. Select "Desktop development with C++" workload\n';
|
|
180
|
+
output += ' 4. Include these components:\n';
|
|
181
|
+
output += ' - MSVC v143 - VS 2022 C++ x64/x86 build tools\n';
|
|
182
|
+
output += ' - Windows 11 SDK (10.0.22621.0 or later)\n';
|
|
183
|
+
output += ' - CMake tools for Windows\n';
|
|
184
|
+
} else if (platform === 'darwin') {
|
|
185
|
+
output += ' Install: xcode-select --install\n';
|
|
186
|
+
output += ' This will install Xcode Command Line Tools with clang++\n';
|
|
187
|
+
} else {
|
|
188
|
+
output += ' Ubuntu/Debian: sudo apt install -y build-essential\n';
|
|
189
|
+
output += ' Fedora: sudo dnf groupinstall -y "Development Tools"\n';
|
|
190
|
+
output += ' Arch: sudo pacman -S --noconfirm base-devel\n';
|
|
191
|
+
}
|
|
192
|
+
break;
|
|
193
|
+
|
|
194
|
+
case 'just':
|
|
195
|
+
output += chalk.bold('Just Command Runner\n');
|
|
196
|
+
if (platform === 'win32') {
|
|
197
|
+
output += ' Install: winget install -e --id casey.just\n';
|
|
198
|
+
output += ' Or download from: https://github.com/casey/just/releases\n';
|
|
199
|
+
} else if (platform === 'darwin') {
|
|
200
|
+
output += ' Install: brew install just\n';
|
|
201
|
+
output += ' Or download from: https://github.com/casey/just/releases\n';
|
|
202
|
+
} else {
|
|
203
|
+
output += ' Ubuntu/Debian: sudo apt install -y just\n';
|
|
204
|
+
output += ' Fedora: sudo dnf install -y just\n';
|
|
205
|
+
output += ' Or download from: https://github.com/casey/just/releases\n';
|
|
206
|
+
}
|
|
207
|
+
break;
|
|
208
|
+
|
|
209
|
+
case 'webview2':
|
|
210
|
+
output += chalk.bold('WebView2 Runtime\n');
|
|
211
|
+
output += ' Install: Download and run the Evergreen Bootstrapper:\n';
|
|
212
|
+
output += ' https://developer.microsoft.com/en-us/microsoft-edge/webview2/#download-section\n';
|
|
213
|
+
output += ' (Or run `plusui doctor --fix`)\n';
|
|
214
|
+
break;
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
return output;
|
|
218
|
+
}
|
|
219
|
+
}
|