vydanne 0.4.0 → 0.4.1

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": "vydanne",
3
- "version": "0.4.0",
3
+ "version": "0.4.1",
4
4
  "description": "App Store Connect + Google Play submission prep — the companion to zdymak (media). Native Node (no fastlane/Ruby/Python): localized listings, screenshot/preview/icon upload, ratings, review contact, accessibility & privacy labels, IAP, export docs, a diff of local-vs-store, and a preflight verifier that encodes the store gotchas. iOS/macOS via the ASC REST API; Android via the Play Developer Edits API (--store google).",
5
5
  "keywords": [
6
6
  "app-store-connect",
@@ -46,10 +46,22 @@ export async function run(config, client) {
46
46
 
47
47
  const editId = await client.newEdit();
48
48
  try {
49
- const bundle = await client.uploadBundle(editId, aab);
50
- const versionCode = bundle.versionCode;
51
- if (!versionCode) throw new Error(`upload returned no versionCode: ${JSON.stringify(bundle).slice(0, 200)}`);
52
- console.log(green(` uploaded versionCode ${versionCode}`));
49
+ // Upload, or REUSE. Play rejects a versionCode it already holds, which is the right answer for an
50
+ // accidental re-upload but wrong for the common case of promoting a build you already pushed to one
51
+ // testing track onto another. The API names the code in its refusal, so take it and carry on — the
52
+ // bytes are already up there, and a bundle is immutable, so reusing it can't diverge from the file.
53
+ let versionCode;
54
+ try {
55
+ const bundle = await client.uploadBundle(editId, aab);
56
+ versionCode = bundle.versionCode;
57
+ if (!versionCode) throw new Error(`upload returned no versionCode: ${JSON.stringify(bundle).slice(0, 200)}`);
58
+ console.log(green(` uploaded versionCode ${versionCode}`));
59
+ } catch (e) {
60
+ const used = /Version code (\d+) has already been used/.exec(e.message);
61
+ if (!used) throw e;
62
+ versionCode = Number(used[1]);
63
+ console.log(yellow(` versionCode ${versionCode} already uploaded — reusing that bundle`));
64
+ }
53
65
 
54
66
  const releaseNotes = readNotes(g.metadataDir, versionCode, g.defaultLocale);
55
67
  if (releaseNotes.length) {