create-yeow 0.1.2 → 0.1.4

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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-yeow",
3
- "version": "0.1.2",
3
+ "version": "0.1.4",
4
4
  "description": "Scaffold a Yeow plugin project",
5
5
  "type": "module",
6
6
  "bin": {
@@ -18,7 +18,7 @@ async function build() {
18
18
  await esbuild.build({
19
19
  entryPoints: [resolve(root, entry)],
20
20
  outfile: resolve(outDir, 'main.js'),
21
- bundle: true, format: 'iife', target: 'es2023', platform: 'neutral', treeShaking: true, minify: true,
21
+ bundle: true, format: 'iife', target: 'es2023', platform: 'node', treeShaking: true, minify: true,
22
22
  });
23
23
 
24
24
  const size = statSync(resolve(outDir, 'main.js')).size;
@@ -12,17 +12,17 @@ const SERVER = resolve(DEVDIR, 'server');
12
12
  const PAPER = '1.21.4';
13
13
  const BUILD = '232';
14
14
  const JAR = `paper-${PAPER}-${BUILD}.jar`;
15
- const URL = `https://api.papermc.io/v2/projects/paper/versions/${PAPER}/builds/${BUILD}/downloads/${JAR}`;
15
+ const URL = `https://fill-data.papermc.io/v1/objects/5ee4f542f628a14c644410b08c94ea42e772ef4d29fe92973636b6813d4eaffc/paper-1.21.4-232.jar`;
16
16
  const CACHEJAR = resolve(CACHE, JAR);
17
17
 
18
18
  const YES = process.argv.includes('-y') || process.env.CI === 'true';
19
19
  const PROXY = process.argv.find(a => a.startsWith('--proxy='))?.split('=').slice(1).join('=');
20
- const STOP = (() => { const a = process.argv.find(a => a.startsWith('--stop=')); if (!a) return null; const m = a.split('=')[1].match(/^(\d+)(s|m|h)?$/); return m ? parseInt(m[1]) * (m[2]==='m'?60:m[2]==='h'?3600:1) : null; })();
20
+ const STOP = (() => { const a = process.argv.find(a => a.startsWith('--stop=')); if (!a) return null; const m = a.split('=')[1].match(/^(\d+)(s|m|h)?$/); return m ? parseInt(m[1]) * (m[2] === 'm' ? 60 : m[2] === 'h' ? 3600 : 1) : null; })();
21
21
 
22
22
  const cfg = JSON.parse(readFileSync(resolve(ROOT, 'yeow.config.json'), 'utf-8'));
23
23
  const RUNTIME = resolve(ROOT, '.yeow', 'assets', 'yeow-runtime-0.1.0.jar');
24
24
 
25
- const c = { r:'\x1b[0m',b:'\x1b[1m',d:'\x1b[2m',g:'\x1b[32m',y:'\x1b[33m',B:'\x1b[34m',C:'\x1b[36m',R:'\x1b[31m', ok: '\x1b[32m✓\x1b[0m', fail: '\x1b[31m✗\x1b[0m', info: '\x1b[36mⓘ\x1b[0m', warn: '\x1b[33m⚠\x1b[0m' };
25
+ const c = { r: '\x1b[0m', b: '\x1b[1m', d: '\x1b[2m', g: '\x1b[32m', y: '\x1b[33m', B: '\x1b[34m', C: '\x1b[36m', R: '\x1b[31m', ok: '\x1b[32m✓\x1b[0m', fail: '\x1b[31m✗\x1b[0m', info: '\x1b[36mⓘ\x1b[0m', warn: '\x1b[33m⚠\x1b[0m' };
26
26
  const log = (msg, color = '') => console.log(`${c.d}[${new Date().toLocaleTimeString()}]${c.r} ${color}${msg}${c.r}`);
27
27
  const ok = msg => log(`${c.ok} ${msg}`, c.g);
28
28
  const fail = msg => log(`${c.fail} ${msg}`, c.R);
@@ -38,7 +38,7 @@ function download(url, dest, agent) {
38
38
  if (res.statusCode !== 200) { f.close(); reject(new Error(`HTTP ${res.statusCode}`)); return; }
39
39
  const total = parseInt(res.headers['content-length'], 10);
40
40
  let dl = 0;
41
- res.on('data', c => { dl += c.length; if (total) process.stdout.write(`\r ${c.B}Downloading...${c.r} ${(dl/1024/1024).toFixed(1)}MB / ${(total/1024/1024).toFixed(1)}MB`); });
41
+ 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`); });
42
42
  res.pipe(f);
43
43
  f.on('finish', () => { f.close(); process.stdout.write('\n'); resolve(); });
44
44
  }).on('error', e => { f.close(); reject(e); });
@@ -49,7 +49,7 @@ async function ensurePaper() {
49
49
  if (existsSync(CACHEJAR) && statSync(CACHEJAR).size > 1_000_000) { ok('Paper found in cache'); return; }
50
50
  mkdirSync(CACHE, { recursive: true });
51
51
  let agent = null;
52
- if (PROXY) { info(`Proxy: ${PROXY}`); try { const { HttpsProxyAgent } = await import('https-proxy-agent'); agent = new HttpsProxyAgent(PROXY); } catch {} }
52
+ if (PROXY) { info(`Proxy: ${PROXY}`); try { const { HttpsProxyAgent } = await import('https-proxy-agent'); agent = new HttpsProxyAgent(PROXY); } catch { } }
53
53
  info('Downloading Paper...');
54
54
  try { await download(URL, CACHEJAR, agent); ok('Paper downloaded'); }
55
55
  catch (e) { fail('Download failed: ' + e.message); console.log(' Manually: ' + CACHEJAR); process.exit(1); }
@@ -75,7 +75,7 @@ async function initServer() {
75
75
  if (YES) {
76
76
  if (!existsSync(resolve(SERVER, 'server.properties'))) {
77
77
  info('Initializing...');
78
- await new Promise(r => { const p = spawn('java', ['-Xmx4G','-Xms4G','-jar',jar,'--nogui'], { cwd: SERVER, stdio: ['pipe','inherit','inherit'] }); setTimeout(() => { p.kill(); r(); }, 120000); p.on('exit', r); p.on('error', r); });
78
+ await new Promise(r => { const p = spawn('java', ['-Xmx4G', '-Xms4G', '-jar', jar, '--nogui'], { cwd: SERVER, stdio: ['pipe', 'inherit', 'inherit'] }); setTimeout(() => { p.kill(); r(); }, 120000); p.on('exit', r); p.on('error', r); });
79
79
  }
80
80
  writeFileSync(eula, 'eula=true\n'); ok('EULA auto-accepted');
81
81
  } else {
@@ -1,16 +1,17 @@
1
1
  {
2
2
  "name": "my-yeow-plugin",
3
3
  "version": "1.0.0",
4
+ "type": "module",
4
5
  "scripts": {
5
6
  "build": "node .yeow/build.js",
6
7
  "dev": "node .yeow/dev-server.js"
7
8
  },
8
9
  "dependencies": {
9
- "yeow-api": "^0.1.0"
10
+ "yeow-api": "^0.1.1"
10
11
  },
11
12
  "devDependencies": {
12
13
  "esbuild": "^0.25.0",
13
14
  "adm-zip": "^0.5.0",
14
15
  "https-proxy-agent": "^9.0.0"
15
16
  }
16
- }
17
+ }