metabinaries 1.0.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/LICENSE +21 -0
- package/README.md +43 -0
- package/index.js +164 -0
- package/package.json +32 -0
- package/src/constants.js +62 -0
- package/src/templates/app.js +527 -0
- package/src/templates/configs.js +303 -0
- package/src/templates/core.js +328 -0
- package/src/templates/folder-structure.js +21 -0
- package/src/templates/layout.js +279 -0
- package/src/templates/misc.js +277 -0
- package/src/templates/packages.js +42 -0
- package/src/templates/ui-2.js +585 -0
- package/src/templates/ui-3.js +606 -0
- package/src/templates/ui-4.js +615 -0
- package/src/templates/ui.js +777 -0
- package/src/utils.js +38 -0
package/src/utils.js
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { spawn } from 'child_process';
|
|
2
|
+
|
|
3
|
+
export function runCommand(command, args = []) {
|
|
4
|
+
return new Promise((resolve, reject) => {
|
|
5
|
+
// On Windows, we need shell for npm/npx commands
|
|
6
|
+
const isWindows = process.platform === 'win32';
|
|
7
|
+
const needsShell = isWindows && (command === 'npm' || command === 'npx' || command === 'git');
|
|
8
|
+
|
|
9
|
+
// Quote args if they contain spaces and we're using shell
|
|
10
|
+
const processedArgs = args.map(arg => {
|
|
11
|
+
if (needsShell && (arg.includes(' ') || arg.includes('&') || arg.includes('|'))) {
|
|
12
|
+
return `"${arg}"`;
|
|
13
|
+
}
|
|
14
|
+
return arg;
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
const fullCommand = needsShell ? `${command} ${processedArgs.join(' ')}` : command;
|
|
18
|
+
const spawnArgs = needsShell ? [] : processedArgs;
|
|
19
|
+
|
|
20
|
+
const child = spawn(fullCommand, spawnArgs, {
|
|
21
|
+
stdio: 'inherit',
|
|
22
|
+
shell: needsShell,
|
|
23
|
+
windowsHide: false
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
child.on('close', (code) => {
|
|
27
|
+
if (code !== 0) {
|
|
28
|
+
reject(new Error(`Command failed: ${command} ${args.join(' ')}`));
|
|
29
|
+
} else {
|
|
30
|
+
resolve();
|
|
31
|
+
}
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
child.on('error', (err) => {
|
|
35
|
+
reject(err);
|
|
36
|
+
});
|
|
37
|
+
});
|
|
38
|
+
}
|