create-yeow 0.2.122 → 0.2.123
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/package.json
CHANGED
|
@@ -148,9 +148,9 @@ function download(url, dest, agent) {
|
|
|
148
148
|
if (res.statusCode !== 200) { f.close(); reject(new Error(`HTTP ${res.statusCode}`)); return; }
|
|
149
149
|
const total = parseInt(res.headers['content-length'], 10);
|
|
150
150
|
let dl = 0;
|
|
151
|
-
res.on('data', chunk => { dl += chunk.length; if (total) process.stdout.write(`\r ${c.B}Downloading...${c.r} ${(dl / 1024 / 1024).toFixed(1)}MB / ${(total / 1024 / 1024).toFixed(1)}MB`); });
|
|
151
|
+
res.on('data', chunk => { dl += chunk.length; if (total && !HEADLESS) process.stdout.write(`\r ${c.B}Downloading...${c.r} ${(dl / 1024 / 1024).toFixed(1)}MB / ${(total / 1024 / 1024).toFixed(1)}MB`); });
|
|
152
152
|
res.pipe(f);
|
|
153
|
-
f.on('finish', () => { f.close(); process.stdout.write('\n'); resolve(); });
|
|
153
|
+
f.on('finish', () => { f.close(); if (!HEADLESS) process.stdout.write('\n'); resolve(); });
|
|
154
154
|
}).on('error', e => { f.close(); reject(e); });
|
|
155
155
|
});
|
|
156
156
|
}
|
|
@@ -159,19 +159,19 @@ async function ensurePaper() {
|
|
|
159
159
|
if (PAPER_URL) {
|
|
160
160
|
// User-specified URL or file path
|
|
161
161
|
if (PAPER_URL.startsWith('http://') || PAPER_URL.startsWith('https://')) {
|
|
162
|
-
if (existsSync(PAPER_PATH) && statSync(PAPER_PATH).size > 1_000_000) { ok('Paper found in cache'); return; }
|
|
162
|
+
if (existsSync(PAPER_PATH) && statSync(PAPER_PATH).size > 1_000_000) { if (!HEADLESS) ok('Paper found in cache'); return; }
|
|
163
163
|
mkdirSync(CACHE, { recursive: true });
|
|
164
164
|
let agent = null;
|
|
165
165
|
if (PROXY) { info(`Proxy: ${PROXY}`); try { const { HttpsProxyAgent } = await import('https-proxy-agent'); agent = new HttpsProxyAgent(PROXY); } catch {} }
|
|
166
|
-
info('Downloading Paper...');
|
|
167
|
-
try { await download(PAPER_URL, PAPER_PATH, agent); ok('Paper downloaded'); }
|
|
166
|
+
if (!HEADLESS) info('Downloading Paper...');
|
|
167
|
+
try { await download(PAPER_URL, PAPER_PATH, agent); if (!HEADLESS) ok('Paper downloaded'); }
|
|
168
168
|
catch (e) { fail('Download failed: ' + e.message); console.log(' Manually: ' + PAPER_PATH); process.exit(1); }
|
|
169
169
|
} else {
|
|
170
170
|
if (!existsSync(PAPER_PATH)) { fail(`Paper JAR not found: ${PAPER_PATH}`); process.exit(1); }
|
|
171
|
-
ok('Paper found at specified path');
|
|
171
|
+
if (!HEADLESS) ok('Paper found at specified path');
|
|
172
172
|
}
|
|
173
173
|
} else {
|
|
174
|
-
if (existsSync(PAPER_PATH) && statSync(PAPER_PATH).size > 1_000_000) { ok('Paper found in cache'); return; }
|
|
174
|
+
if (existsSync(PAPER_PATH) && statSync(PAPER_PATH).size > 1_000_000) { if (!HEADLESS) ok('Paper found in cache'); return; }
|
|
175
175
|
mkdirSync(CACHE, { recursive: true });
|
|
176
176
|
info('Downloading Paper...');
|
|
177
177
|
try {
|
|
@@ -180,7 +180,7 @@ async function ensurePaper() {
|
|
|
180
180
|
const latestBuild = versions.builds[versions.builds.length - 1];
|
|
181
181
|
const dlUrl = `https://api.papermc.io/v2/projects/paper/versions/${PAPER_VERSION}/builds/${latestBuild}/downloads/paper-${PAPER_VERSION}-${latestBuild}.jar`;
|
|
182
182
|
await download(dlUrl, PAPER_PATH, null);
|
|
183
|
-
ok('Paper downloaded');
|
|
183
|
+
if (!HEADLESS) ok('Paper downloaded');
|
|
184
184
|
} catch (e) {
|
|
185
185
|
fail('Download failed: ' + e.message);
|
|
186
186
|
console.log(' Manually download to: ' + PAPER_PATH);
|