get-codex-lost-world 1.0.5 → 1.0.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.
|
@@ -9,11 +9,9 @@ function printTargetShortcuts() {
|
|
|
9
9
|
'Target shortcuts:',
|
|
10
10
|
' --mac-silicon Build/download for Apple Silicon Mac (default source: original Codex.dmg on macOS arm64 host)',
|
|
11
11
|
' --mac-intel Build/download for Intel Mac (.dmg)',
|
|
12
|
-
' --windows-x64 Build/download for Windows x64 (.zip)',
|
|
13
|
-
' --windows-arm64 Build/download for Windows arm64 (.zip)',
|
|
14
12
|
'',
|
|
15
13
|
'Example:',
|
|
16
|
-
' npx get-codex-lost-world
|
|
14
|
+
' npx get-codex-lost-world -w ~/Downloads',
|
|
17
15
|
].join('\n');
|
|
18
16
|
|
|
19
17
|
process.stdout.write(`${message}\n`);
|
|
@@ -23,8 +21,6 @@ function remapShortcutArgs(argv = []) {
|
|
|
23
21
|
const targetShortcuts = {
|
|
24
22
|
'--mac-silicon': ['--platform', 'mac', '--format', 'dmg'],
|
|
25
23
|
'--mac-intel': ['--platform', 'mac', '--arch', 'x64', '--format', 'dmg'],
|
|
26
|
-
'--windows-x64': ['--platform', 'windows', '--arch', 'x64', '--format', 'zip'],
|
|
27
|
-
'--windows-arm64': ['--platform', 'windows', '--arch', 'arm64', '--format', 'zip'],
|
|
28
24
|
};
|
|
29
25
|
|
|
30
26
|
const selectedShortcuts = argv.filter((arg) => Object.prototype.hasOwnProperty.call(targetShortcuts, arg));
|
|
@@ -59,4 +55,4 @@ main().catch((error) => {
|
|
|
59
55
|
process.stderr.write(`${message}\n\n${usage()}\n`);
|
|
60
56
|
process.stderr.write('Use --target-help to see target shortcuts.\n');
|
|
61
57
|
process.exit(1);
|
|
62
|
-
});
|
|
58
|
+
});
|
|
@@ -11,16 +11,10 @@ function makeOutputName(version) {
|
|
|
11
11
|
return `CodexIntelMac_${sanitizeVersion(version)}.dmg`;
|
|
12
12
|
}
|
|
13
13
|
|
|
14
|
-
function makeOutputNameForTarget({ version,
|
|
14
|
+
function makeOutputNameForTarget({ version, format }) {
|
|
15
15
|
const safeVersion = sanitizeVersion(version);
|
|
16
|
-
const normalizedPlatform = String(platform || '').trim().toLowerCase();
|
|
17
|
-
const normalizedArch = String(arch || '').trim().toLowerCase();
|
|
18
16
|
const normalizedFormat = String(format || '').trim().toLowerCase();
|
|
19
17
|
|
|
20
|
-
if (normalizedPlatform === 'windows') {
|
|
21
|
-
return `CodexWindows_${normalizedArch || 'x64'}_${safeVersion}.${normalizedFormat || 'zip'}`;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
18
|
return `CodexIntelMac_${safeVersion}.${normalizedFormat || 'dmg'}`;
|
|
25
19
|
}
|
|
26
20
|
|
|
@@ -300,9 +300,9 @@ function usage() {
|
|
|
300
300
|
' -c, --cache Show latest release info and optionally download/sign it',
|
|
301
301
|
' -s, --sign <path> Ad-hoc sign a local app/dmg path',
|
|
302
302
|
' -w, --workdir <path> Build working directory (download source + write Intel DMG)',
|
|
303
|
-
' --platform <p> Target platform: mac
|
|
304
|
-
' --arch <a> Target arch: x64
|
|
305
|
-
' --format <f> Target format: dmg
|
|
303
|
+
' --platform <p> Target platform: mac',
|
|
304
|
+
' --arch <a> Target arch: x64',
|
|
305
|
+
' --format <f> Target format: dmg',
|
|
306
306
|
'',
|
|
307
307
|
'Other options:',
|
|
308
308
|
' -h, --help Show this help message',
|
|
@@ -315,32 +315,16 @@ function usage() {
|
|
|
315
315
|
].join('\n');
|
|
316
316
|
}
|
|
317
317
|
|
|
318
|
-
function
|
|
319
|
-
const normalized = String(hostArch || '').trim().toLowerCase();
|
|
320
|
-
if (normalized === 'arm64') {
|
|
321
|
-
return 'arm64';
|
|
322
|
-
}
|
|
323
|
-
|
|
324
|
-
return 'x64';
|
|
325
|
-
}
|
|
326
|
-
|
|
327
|
-
function resolveDefaultTargetInput(parsed, env) {
|
|
328
|
-
const runtimePlatform = String((env && env.RUNTIME_PLATFORM) || process.platform || '').trim().toLowerCase();
|
|
329
|
-
const runtimeArch = String((env && env.RUNTIME_ARCH) || process.arch || '').trim().toLowerCase();
|
|
330
|
-
|
|
331
|
-
const inferredPlatform = runtimePlatform === 'win32' ? 'windows' : 'mac';
|
|
318
|
+
function resolveDefaultTargetInput(parsed, _env) {
|
|
332
319
|
const selectedPlatform = typeof parsed.platform === 'string' && parsed.platform.trim() !== ''
|
|
333
320
|
? parsed.platform
|
|
334
|
-
:
|
|
335
|
-
|
|
336
|
-
const normalizedPlatform = String(selectedPlatform).trim().toLowerCase();
|
|
337
|
-
const inferredArch = normalizedPlatform === 'windows' ? mapHostArchToTargetArch(runtimeArch) : 'x64';
|
|
321
|
+
: 'mac';
|
|
338
322
|
const selectedArch = typeof parsed.arch === 'string' && parsed.arch.trim() !== ''
|
|
339
323
|
? parsed.arch
|
|
340
|
-
:
|
|
324
|
+
: 'x64';
|
|
341
325
|
const selectedFormat = typeof parsed.format === 'string' && parsed.format.trim() !== ''
|
|
342
326
|
? parsed.format
|
|
343
|
-
:
|
|
327
|
+
: 'dmg';
|
|
344
328
|
|
|
345
329
|
return {
|
|
346
330
|
platform: selectedPlatform,
|
|
@@ -389,15 +373,6 @@ async function runCacheMode(parsed, deps) {
|
|
|
389
373
|
: (downloadResult && downloadResult.path) || fallbackPath;
|
|
390
374
|
deps.io.log(`Download done: ${downloadedPath}`);
|
|
391
375
|
|
|
392
|
-
if (target.platform === 'windows') {
|
|
393
|
-
return {
|
|
394
|
-
mode: 'cache',
|
|
395
|
-
downloaded: true,
|
|
396
|
-
signed: false,
|
|
397
|
-
path: downloadedPath,
|
|
398
|
-
target,
|
|
399
|
-
};
|
|
400
|
-
}
|
|
401
376
|
|
|
402
377
|
const signAnswer = await deps.io.prompt('Sign downloaded file? (Y/n)', 'Y');
|
|
403
378
|
let signed = false;
|
|
@@ -18,33 +18,15 @@ function pickLatestAssetForTarget(release, target = {}) {
|
|
|
18
18
|
const assets = Array.isArray(release?.assets) ? release.assets : [];
|
|
19
19
|
const platform = String(target.platform || 'mac').trim().toLowerCase();
|
|
20
20
|
const arch = String(target.arch || 'x64').trim().toLowerCase();
|
|
21
|
-
const format = String(target.format ||
|
|
21
|
+
const format = String(target.format || 'dmg').trim().toLowerCase();
|
|
22
22
|
|
|
23
|
-
const candidates = assets
|
|
23
|
+
const candidates = assets
|
|
24
|
+
.filter((asset) => typeof asset?.name === 'string' && asset.name.toLowerCase().endsWith(`.${format}`))
|
|
25
|
+
.sort((a, b) => new Date(b.updated_at) - new Date(a.updated_at));
|
|
24
26
|
if (candidates.length === 0) {
|
|
25
27
|
throw new Error(`No .${format} asset found in release assets`);
|
|
26
28
|
}
|
|
27
29
|
|
|
28
|
-
if (platform === 'windows') {
|
|
29
|
-
const strictMatch = candidates.find((asset) => {
|
|
30
|
-
const name = asset.name.toLowerCase();
|
|
31
|
-
return name.includes('windows') && name.includes(arch);
|
|
32
|
-
});
|
|
33
|
-
|
|
34
|
-
if (strictMatch) {
|
|
35
|
-
ensureAssetUrl(strictMatch, `.${format}`);
|
|
36
|
-
return strictMatch;
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
const archMatch = candidates.find((asset) => asset.name.toLowerCase().includes(arch));
|
|
40
|
-
if (archMatch) {
|
|
41
|
-
ensureAssetUrl(archMatch, `.${format}`);
|
|
42
|
-
return archMatch;
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
throw new Error(`No .${format} asset found for windows/${arch}`);
|
|
46
|
-
}
|
|
47
|
-
|
|
48
30
|
const preferred = candidates.find((asset) => /^CodexIntelMac_.*\.dmg$/i.test(asset.name));
|
|
49
31
|
const selected = preferred || candidates[0];
|
|
50
32
|
ensureAssetUrl(selected, `.${format}`);
|
|
@@ -1,15 +1,13 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
const SUPPORTED_PLATFORMS = ['mac'
|
|
3
|
+
const SUPPORTED_PLATFORMS = ['mac'];
|
|
4
4
|
|
|
5
5
|
const SUPPORTED_ARCHES_BY_PLATFORM = {
|
|
6
6
|
mac: ['x64'],
|
|
7
|
-
windows: ['x64', 'arm64'],
|
|
8
7
|
};
|
|
9
8
|
|
|
10
9
|
const SUPPORTED_FORMATS_BY_PLATFORM = {
|
|
11
10
|
mac: ['dmg'],
|
|
12
|
-
windows: ['zip'],
|
|
13
11
|
};
|
|
14
12
|
|
|
15
13
|
function normalizeValue(value) {
|
|
@@ -19,7 +17,7 @@ function normalizeValue(value) {
|
|
|
19
17
|
function normalizeTarget(input = {}) {
|
|
20
18
|
const platform = normalizeValue(input.platform) || 'mac';
|
|
21
19
|
const arch = normalizeValue(input.arch) || 'x64';
|
|
22
|
-
const format = normalizeValue(input.format) ||
|
|
20
|
+
const format = normalizeValue(input.format) || 'dmg';
|
|
23
21
|
const target = { platform, arch, format };
|
|
24
22
|
validateTarget(target);
|
|
25
23
|
return target;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "get-codex-lost-world",
|
|
3
|
-
"version": "1.0.
|
|
4
|
-
"description": "CLI to download/build Codex Mac Intel DMG
|
|
3
|
+
"version": "1.0.6",
|
|
4
|
+
"description": "CLI to download/build Codex Mac Intel DMG artifacts from upstream Codex.dmg.",
|
|
5
5
|
"main": "lib/get-codex-lost-world/main.js",
|
|
6
6
|
"bin": {
|
|
7
7
|
"get-codex-lost-world": "bin/get-codex-lost-world.js"
|
|
@@ -17,9 +17,7 @@
|
|
|
17
17
|
"codex",
|
|
18
18
|
"intel",
|
|
19
19
|
"build",
|
|
20
|
-
"mac"
|
|
21
|
-
"windows",
|
|
22
|
-
"zip"
|
|
20
|
+
"mac"
|
|
23
21
|
],
|
|
24
22
|
"author": "0x0a0d",
|
|
25
23
|
"license": "ISC",
|