Skip to content

Commit 9616f57

Browse files
committed
More fixes for Ceramic v2.0+
1 parent b47f35b commit 9616f57

File tree

2 files changed

+25
-6
lines changed

2 files changed

+25
-6
lines changed

download-ceramic.js

Lines changed: 24 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,26 @@ const axios = require('axios');
77

88
process.chdir(__dirname);
99

10+
// Determine platform and architecture
1011
const platform = process.platform == 'darwin' ? 'mac' : 'linux';
12+
const arch = process.arch;
13+
14+
// Construct the asset name based on platform and architecture
15+
function getAssetName() {
16+
if (platform === 'mac') {
17+
return 'ceramic-mac.zip';
18+
} else if (platform === 'linux') {
19+
// Map Node.js arch values to the expected file naming
20+
const archMap = {
21+
'x64': 'x86_64',
22+
'arm64': 'arm64'
23+
};
24+
const mappedArch = archMap[arch] || arch;
25+
return `ceramic-linux-${mappedArch}.zip`;
26+
}
27+
}
28+
29+
const assetName = getAssetName();
1130

1231
function fail(message) {
1332
console.error(message);
@@ -24,14 +43,14 @@ async function resolveLatestRelease() {
2443
if (release.assets != null) {
2544
var assets = release.assets;
2645
for (var asset of assets) {
27-
if (asset.name == 'ceramic-'+platform+'.zip') {
46+
if (asset.name == assetName) {
2847
return release;
2948
}
3049
}
3150
}
3251
}
3352

34-
fail('Failed to resolve latest ceramic version! Try again later?');
53+
fail(`Failed to resolve latest ceramic version! Looking for ${assetName}. Try again later?`);
3554
return null;
3655

3756
}
@@ -51,16 +70,16 @@ cleanup();
5170

5271
(async () => {
5372

54-
console.log('Resolve latest Ceramic release');
73+
console.log(`Resolve latest Ceramic release for ${platform} (${arch})`);
5574
var releaseInfo = await resolveLatestRelease();
5675
var targetTag = releaseInfo.tag_name;
5776
var ceramicZipPath = 'ceramic.zip';
58-
var ceramicArchiveUrl = 'https://github.com/ceramic-engine/ceramic/releases/download/'+targetTag+'/ceramic-'+platform+'.zip';
77+
var ceramicArchiveUrl = `https://github.com/ceramic-engine/ceramic/releases/download/${targetTag}/${assetName}`;
5978

6079
console.log('Download ceramic archive: ' + ceramicArchiveUrl);
6180
fs.writeFileSync(ceramicZipPath, await download(ceramicArchiveUrl));
6281

6382
console.log('Unzip...');
6483
unzipFile(ceramicZipPath, 'ceramic');
6584

66-
})();
85+
})();

gen-docs.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,4 +81,4 @@ $(ceramic haxe) docs.hxml --xml ../../../docs/unity.xml -D doc-gen -D documentat
8181

8282
$(ceramic haxelib) run dox -i ./docs --output-path docs --keep-field-order --exclude 'zpp_nape|microsoft|unityengine|fuzzaldrin|gif|timestamp|stb|sys|spec|sdl|polyline|poly2tri|opengl|openal|ogg|js|hsluv|hscript|glew|format|earcut|cs|cpp|com|assets|ceramic.scriptable|ceramic.macros' --title 'Ceramic API'
8383

84-
$(ceramic node) transform-docs.js
84+
node transform-docs.js

0 commit comments

Comments
 (0)