Skip to content

Commit 5a7e184

Browse files
authored
Merge pull request #777 from particle-iot/bug/sc-132028/compiles-for-archived-version-is-not-working
bug/sc-132028/compiles-for-archived-version-is-not-working
2 parents ec1bb51 + 677dcb0 commit 5a7e184

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

src/cmd/cloud.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -305,10 +305,9 @@ module.exports = class CloudCommand extends CLICommandBase {
305305
throw normalizedApiError(error);
306306
}
307307

308-
const validTargets = data.versions.filter((t) => t.release_state !== 'archived');
309-
const validTarget = validTargets.filter((t) => t.version === target);
308+
const validTarget = data?.versions?.filter((t) => t.version === target);
310309
if (!validTarget.length) {
311-
throw new VError(['Invalid build target version.', 'Valid targets:'].concat(validTargets.map((v) => `${v.version} ${v.release_state === 'preview' ? '(preview)' : ''}`)).join('\n'));
310+
throw new VError(['Invalid build target version.', 'Valid targets:'].concat(data.versions.map((v) => `${v.version} ${v.release_state === 'preview' ? '(preview)' : ''}`)).join('\n'));
312311
}
313312
targetVersion = validTarget[0].version;
314313
this.ui.stdout.write(`Targeting version: ${targetVersion}${os.EOL}`);

0 commit comments

Comments
 (0)