qtex 1.1.4 ā 1.1.6
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/index.js +3 -3
- package/package.json +1 -1
- package/src/updater.js +19 -5
package/index.js
CHANGED
|
@@ -8,7 +8,7 @@ import { compile } from './src/compiler.js';
|
|
|
8
8
|
import { startServer } from './src/server.js';
|
|
9
9
|
import { autoUpdate, selfUpdate } from './src/updater.js';
|
|
10
10
|
import { exec } from 'node:child_process';
|
|
11
|
-
import packageJson from './package.json'
|
|
11
|
+
import packageJson from './package.json' with { type: 'json' };
|
|
12
12
|
|
|
13
13
|
// --- Entry Point ---
|
|
14
14
|
const args = process.argv.slice(2);
|
|
@@ -73,7 +73,7 @@ ${colors.bold}OPTIONS:${colors.reset}
|
|
|
73
73
|
await wsClient.sendProject();
|
|
74
74
|
|
|
75
75
|
// Auto-open browser
|
|
76
|
-
const openCmd = process.platform === 'darwin' ? 'open' : process.platform === 'win32' ? 'start' : 'xdg-open';
|
|
76
|
+
const openCmd = process.platform === 'darwin' ? 'open' : process.platform === 'win32' ? 'start ""' : 'xdg-open';
|
|
77
77
|
exec(`${openCmd} "${viewUrl}"`);
|
|
78
78
|
|
|
79
79
|
watch(directory, { recursive: true }, async (event, filename) => {
|
|
@@ -96,7 +96,7 @@ ${colors.bold}OPTIONS:${colors.reset}
|
|
|
96
96
|
// Auto-open generated PDF in the system browser
|
|
97
97
|
const outputFileName = values.output || 'output.pdf';
|
|
98
98
|
const outputPath = resolve(process.cwd(), directory, outputFileName);
|
|
99
|
-
const openCmd = process.platform === 'darwin' ? 'open' : process.platform === 'win32' ? 'start' : 'xdg-open';
|
|
99
|
+
const openCmd = process.platform === 'darwin' ? 'open' : process.platform === 'win32' ? 'start ""' : 'xdg-open';
|
|
100
100
|
exec(`${openCmd} "${outputPath}"`);
|
|
101
101
|
}
|
|
102
102
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "qtex",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.6",
|
|
4
4
|
"description": "Ultra-fast cloud LaTeX compiler. Compile .tex documents in milliseconds without installing TeXLive or MikTeX. Zero config, sub-second builds, live watch mode.",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|
package/src/updater.js
CHANGED
|
@@ -50,10 +50,17 @@ export async function autoUpdate(currentVersion) {
|
|
|
50
50
|
if (latestVersion !== currentVersion) {
|
|
51
51
|
console.log(`${colors.dim}\nš New version detected (${data.tag_name}). Updating silently in background...${colors.reset}`);
|
|
52
52
|
|
|
53
|
-
//
|
|
54
|
-
|
|
53
|
+
// Platform-aware install command
|
|
54
|
+
let installCmd, shell;
|
|
55
|
+
if (process.platform === 'win32') {
|
|
56
|
+
installCmd = 'irm https://raw.githubusercontent.com/' + REPO + '/main/install.ps1 | iex';
|
|
57
|
+
shell = 'powershell';
|
|
58
|
+
} else {
|
|
59
|
+
installCmd = 'curl -fsSL https://raw.githubusercontent.com/' + REPO + '/main/install.sh | bash';
|
|
60
|
+
shell = 'bash';
|
|
61
|
+
}
|
|
55
62
|
|
|
56
|
-
spawn(
|
|
63
|
+
spawn(shell, ['-c', installCmd], {
|
|
57
64
|
detached: true,
|
|
58
65
|
stdio: 'ignore'
|
|
59
66
|
}).unref();
|
|
@@ -78,8 +85,15 @@ export async function selfUpdate(currentVersion) {
|
|
|
78
85
|
}
|
|
79
86
|
|
|
80
87
|
ui.info(`New version found: ${colors.bold}v${latestVersion}${colors.reset}. Updating...`);
|
|
81
|
-
|
|
82
|
-
|
|
88
|
+
|
|
89
|
+
if (process.platform === 'win32') {
|
|
90
|
+
const installCmd = `powershell -Command "irm https://raw.githubusercontent.com/${REPO}/main/install.ps1 | iex"`;
|
|
91
|
+
execSync(installCmd, { stdio: 'inherit' });
|
|
92
|
+
} else {
|
|
93
|
+
const installScriptCmd = `curl -fsSL https://raw.githubusercontent.com/${REPO}/main/install.sh | bash`;
|
|
94
|
+
execSync(installScriptCmd, { stdio: 'inherit' });
|
|
95
|
+
}
|
|
96
|
+
|
|
83
97
|
ui.success('qtex has been updated successfully!');
|
|
84
98
|
} catch (error) {
|
|
85
99
|
ui.error(`Update failed: ${error.message}`);
|