fix(scripts): fetch-assets ESM + native Windows tar
This commit is contained in:
parent
cc3eb8d0be
commit
7709bd9f74
@ -4,11 +4,16 @@
|
||||
//
|
||||
// Архив весит ~43МБ, содержит модели (.glb), текстуры (.png) и скины.
|
||||
// В Git они НЕ лежат — занимают много места и редко меняются.
|
||||
//
|
||||
// ES-модуль (в package.json "type": "module").
|
||||
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
const https = require('https');
|
||||
const { execSync } = require('child_process');
|
||||
import fs from 'node:fs';
|
||||
import path from 'node:path';
|
||||
import https from 'node:https';
|
||||
import { execSync } from 'node:child_process';
|
||||
import { fileURLToPath } from 'node:url';
|
||||
|
||||
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
||||
|
||||
const RELEASE_URL =
|
||||
'https://git.rublox.pro/rublox/player/releases/download/assets-v1/kubikon-assets.tar.gz';
|
||||
@ -68,7 +73,14 @@ async function main() {
|
||||
await download(RELEASE_URL, TMP_TAR);
|
||||
|
||||
console.log('Распаковка...');
|
||||
execSync(`tar -xzf "${TMP_TAR}" -C "${PUBLIC_DIR}"`, { stdio: 'inherit' });
|
||||
// На Windows используем native tar.exe из System32 — Git Bash-овский
|
||||
// BSD-tar ломается на путях с двоеточием (`C:` интерпретируется как
|
||||
// ssh-хост). На *nix просто `tar` в $PATH.
|
||||
const tarBin =
|
||||
process.platform === 'win32' && fs.existsSync('C:\\Windows\\System32\\tar.exe')
|
||||
? 'C:\\Windows\\System32\\tar.exe'
|
||||
: 'tar';
|
||||
execSync(`"${tarBin}" -xzf "${TMP_TAR}" -C "${PUBLIC_DIR}"`, { stdio: 'inherit' });
|
||||
fs.unlinkSync(TMP_TAR);
|
||||
|
||||
console.log('Готово! Ассеты в public/kubikon-assets/');
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user