Skip to content

Commit 24ec9dc

Browse files
committed
Use DeviceOS versions endpoint
1 parent 42b719d commit 24ec9dc

File tree

4 files changed

+21
-11
lines changed

4 files changed

+21
-11
lines changed

npm-shrinkwrap.json

Lines changed: 7 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@
6767
"lodash": "^4.17.15",
6868
"moment": "^2.24.0",
6969
"node-wifiscanner2": "^1.2.1",
70-
"particle-api-js": "^10.5.1",
70+
"particle-api-js": "^10.6.0",
7171
"particle-commands": "^1.0.1",
7272
"particle-library-manager": "^0.1.15",
7373
"particle-usb": "^3.6.0",

src/cmd/api.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,16 @@ module.exports = class ParticleApi {
154154
);
155155
}
156156

157+
listDeviceOsVersions(platformId, internalVersion){
158+
return this._wrap(
159+
this.api.listDeviceOsVersions({
160+
platformId,
161+
internalVersion,
162+
auth: this.accessToken
163+
})
164+
);
165+
}
166+
157167
compileCode(files, platformId, targetVersion){
158168
return this._wrap(
159169
this.api.compileCode({

src/cmd/cloud.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -300,15 +300,15 @@ module.exports = class CloudCommand extends CLICommandBase {
300300

301301
let data;
302302
try {
303-
data = await createAPI().listBuildTargets(true /* onlyFeatured */);
303+
data = await createAPI().listDeviceOsVersions(platformId);
304304
} catch (error) {
305305
throw normalizedApiError(error);
306306
}
307307

308-
const validTargets = data.targets.filter((t) => t.platforms.includes(platformId));
308+
const validTargets = data.versions.filter((t) => t.release_state !== 'archived');
309309
const validTarget = validTargets.filter((t) => t.version === target);
310310
if (!validTarget.length) {
311-
throw new VError(['Invalid build target version.', 'Valid targets:'].concat(_.map(validTargets, 'version')).join('\n'));
311+
throw new VError(['Invalid build target version.', 'Valid targets:'].concat(validTargets.map((v) => `${v.version} ${v.release_state === 'preview' ? '(preview)' : ''}`)).join('\n'));
312312
}
313313
targetVersion = validTarget[0].version;
314314
this.ui.stdout.write(`Targeting version: ${targetVersion}${os.EOL}`);

0 commit comments

Comments
 (0)