opendraft 1.6.0 → 1.6.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/bin/opendraft.js +38 -18
- package/package.json +1 -1
package/bin/opendraft.js
CHANGED
|
@@ -48,26 +48,43 @@ ${PURPLE}${BOLD} ╔═══════════════════
|
|
|
48
48
|
}
|
|
49
49
|
|
|
50
50
|
function checkPython() {
|
|
51
|
-
|
|
51
|
+
const home = os.homedir();
|
|
52
|
+
|
|
53
|
+
// Check Python commands - prefer stable versions (3.9-3.13), avoid dev versions (3.14+)
|
|
54
|
+
// Order matters: check specific stable versions first before generic python3
|
|
52
55
|
const pythonCommands = [
|
|
53
|
-
|
|
54
|
-
'python',
|
|
55
|
-
'python3.13',
|
|
56
|
-
'python3.12',
|
|
57
|
-
'python3.11',
|
|
58
|
-
'python3.10',
|
|
59
|
-
'python3.9',
|
|
60
|
-
// Homebrew
|
|
61
|
-
'/opt/homebrew/bin/python3',
|
|
56
|
+
// Homebrew (stable versions first)
|
|
62
57
|
'/opt/homebrew/bin/python3.13',
|
|
63
58
|
'/opt/homebrew/bin/python3.12',
|
|
64
59
|
'/opt/homebrew/bin/python3.11',
|
|
60
|
+
'/opt/homebrew/bin/python3.10',
|
|
61
|
+
'/opt/homebrew/bin/python3',
|
|
65
62
|
'/usr/local/bin/python3',
|
|
66
63
|
// python.org macOS installer
|
|
67
64
|
'/Library/Frameworks/Python.framework/Versions/3.13/bin/python3',
|
|
68
65
|
'/Library/Frameworks/Python.framework/Versions/3.12/bin/python3',
|
|
69
66
|
'/Library/Frameworks/Python.framework/Versions/3.11/bin/python3',
|
|
70
67
|
'/Library/Frameworks/Python.framework/Versions/3.10/bin/python3',
|
|
68
|
+
// Conda (common locations)
|
|
69
|
+
`${home}/anaconda3/bin/python`,
|
|
70
|
+
`${home}/miniconda3/bin/python`,
|
|
71
|
+
`${home}/miniforge3/bin/python`,
|
|
72
|
+
`${home}/mambaforge/bin/python`,
|
|
73
|
+
'/opt/anaconda3/bin/python',
|
|
74
|
+
'/opt/miniconda3/bin/python',
|
|
75
|
+
// pyenv
|
|
76
|
+
`${home}/.pyenv/shims/python3`,
|
|
77
|
+
`${home}/.pyenv/shims/python`,
|
|
78
|
+
// Generic (last resort - may pick dev versions)
|
|
79
|
+
'python3.13',
|
|
80
|
+
'python3.12',
|
|
81
|
+
'python3.11',
|
|
82
|
+
'python3.10',
|
|
83
|
+
'python3.9',
|
|
84
|
+
'python3',
|
|
85
|
+
'python',
|
|
86
|
+
// System Python (macOS)
|
|
87
|
+
'/usr/bin/python3',
|
|
71
88
|
];
|
|
72
89
|
|
|
73
90
|
for (const cmd of pythonCommands) {
|
|
@@ -77,7 +94,8 @@ function checkPython() {
|
|
|
77
94
|
if (match) {
|
|
78
95
|
const major = parseInt(match[1]);
|
|
79
96
|
const minor = parseInt(match[2]);
|
|
80
|
-
|
|
97
|
+
// Require Python 3.9-3.13 (3.14+ is dev/unstable, packages may not work)
|
|
98
|
+
if (major === 3 && minor >= 9 && minor <= 13) {
|
|
81
99
|
return { cmd, version: `${major}.${minor}` };
|
|
82
100
|
}
|
|
83
101
|
}
|
|
@@ -269,19 +287,24 @@ async function main() {
|
|
|
269
287
|
return;
|
|
270
288
|
}
|
|
271
289
|
|
|
290
|
+
// Show logo immediately so user knows something is happening
|
|
291
|
+
printLogo();
|
|
292
|
+
print(`${GRAY}Checking environment...${RESET}`);
|
|
293
|
+
|
|
272
294
|
// Check Python
|
|
273
295
|
const python = checkPython();
|
|
274
296
|
|
|
275
297
|
if (!python) {
|
|
276
|
-
|
|
298
|
+
console.log();
|
|
277
299
|
showInstallInstructions();
|
|
278
300
|
process.exit(1);
|
|
279
301
|
}
|
|
280
302
|
|
|
303
|
+
print(`${GREEN}✓${RESET} Python ${python.version} found`);
|
|
304
|
+
|
|
281
305
|
// Handle --install
|
|
282
306
|
if (args.includes('--install')) {
|
|
283
|
-
|
|
284
|
-
print(`${GREEN}✓${RESET} Python ${python.version} found`);
|
|
307
|
+
print(`${GRAY}Installing OpenDraft...${RESET}`);
|
|
285
308
|
if (installOpendraft(python.cmd)) {
|
|
286
309
|
print(`${GREEN}✓${RESET} OpenDraft installed successfully`);
|
|
287
310
|
console.log();
|
|
@@ -296,15 +319,12 @@ async function main() {
|
|
|
296
319
|
|
|
297
320
|
// Check if opendraft is installed
|
|
298
321
|
if (!checkOpendraftInstalled(python.cmd)) {
|
|
299
|
-
|
|
300
|
-
print(`${YELLOW}First time setup...${RESET}`);
|
|
301
|
-
console.log();
|
|
322
|
+
print(`${YELLOW}First time setup - installing OpenDraft...${RESET}`);
|
|
302
323
|
if (!installOpendraft(python.cmd)) {
|
|
303
324
|
print(`${RED}✗${RESET} Failed to install OpenDraft`);
|
|
304
325
|
process.exit(1);
|
|
305
326
|
}
|
|
306
327
|
print(`${GREEN}✓${RESET} OpenDraft installed`);
|
|
307
|
-
console.log();
|
|
308
328
|
}
|
|
309
329
|
|
|
310
330
|
// Run opendraft
|