diff --git a/README.md b/README.md index beae77f..b8e99bd 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,11 @@ -# forge-cli-utils [![Build Status](https://travis-ci.org/petrbroz/forge-cli-utils.svg?branch=master)](https://travis-ci.org/petrbroz/forge-cli-utils) [![npm version](https://badge.fury.io/js/forge-cli-utils.svg)](https://badge.fury.io/js/forge-cli-utils) +# forge-cli-utils + +[![build status](https://travis-ci.org/petrbroz/forge-cli-utils.svg?branch=master)](https://travis-ci.org/petrbroz/forge-cli-utils) +[![npm version](https://badge.fury.io/js/forge-cli-utils.svg)](https://badge.fury.io/js/forge-cli-utils) +![node](https://img.shields.io/node/v/forge-cli-utils.svg) +![npm downloads](https://img.shields.io/npm/dw/forge-cli-utils.svg) +![platforms](https://img.shields.io/badge/platform-windows%20%7C%20osx%20%7C%20linux-lightgray.svg) +[![license](https://img.shields.io/badge/license-MIT-blue.svg)](http://opensource.org/licenses/MIT) Command line tools for Autodesk Forge services. @@ -108,6 +115,7 @@ forge-da create-workitem ActivityName ActivityAlias --input PartFile --input-url > `--input InputA --input-local-name house.rvt --input InputB --input InputC --input-url https://foobar.com`. > Such a sequence will define three inputs: _InputA_ with local name _house.rvt_, _InputB_ (with no additional > properties), and _InputC_ with URL _https://foobar.com_. +> For more details, see https://github.com/petrbroz/forge-cli-utils/wiki/Design-Automation-Inputs-and-Outputs #### Model Derivative @@ -120,3 +128,7 @@ forge-md get-viewable-props dXJuOmFkc2sub2JqZWN0czpvcy5vYmplY3Q6cG9jLWJvdXlndWVz ``` > For additional examples, check out the _examples_ subfolder. + +## Additional Resources + +- blog post on auto-deploying Design Automation plugins from Visual Studio: https://forge.autodesk.com/blog/deploying-design-automation-visual-studio \ No newline at end of file diff --git a/package-lock.json b/package-lock.json index 0598bdf..9e5f11f 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "forge-cli-utils", - "version": "0.8.0", + "version": "0.8.1", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index 1263922..6dfcd54 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "forge-cli-utils", - "version": "0.8.0", + "version": "0.8.1", "description": "Command line tools for Autodesk Forge services.", "author": "Petr Broz ", "license": "MIT", diff --git a/src/forge-da.js b/src/forge-da.js index 107fb17..587ff63 100755 --- a/src/forge-da.js +++ b/src/forge-da.js @@ -42,7 +42,7 @@ async function promptAppBundleVersion(appbundle) { async function promptAppBundleAlias(appbundle) { const aliases = await designAutomation.listAppBundleAliases(appbundle); - const answer = await prompt({ type: 'list', name: 'alias', choices: aliases }); + const answer = await prompt({ type: 'list', name: 'alias', choices: aliases.map(item => item.id).filter(id => id !== '$LATEST') }); return answer.alias; } @@ -63,8 +63,8 @@ async function promptActivityVersion(activity) { } async function promptActivityAlias(activity) { - const activities = await designAutomation.listActivityAliases(activity); - const answer = await prompt({ type: 'list', name: 'alias', choices: activities }); + const aliases = await designAutomation.listActivityAliases(activity); + const answer = await prompt({ type: 'list', name: 'alias', choices: aliases.map(item => item.id).filter(id => id !== '$LATEST') }); return answer.alias; } @@ -304,6 +304,9 @@ function _collectActivityInputs(val) { } function _collectActivityInputLocalNames(val) { + if (_activityInputs.length === 0) { + throw new Error('Cannot assign local name property when no --input was provided. See https://github.com/petrbroz/forge-cli-utils/wiki/Design-Automation-Inputs-and-Outputs.'); + } _activityInputs[_activityInputs.length - 1].localName = val; } @@ -312,6 +315,9 @@ function _collectActivityOutputs(val) { } function _collectActivityOutputLocalNames(val) { + if (_activityOutputs.length === 0) { + throw new Error('Cannot assign local name property when no --output was provided. See https://github.com/petrbroz/forge-cli-utils/wiki/Design-Automation-Inputs-and-Outputs.'); + } _activityOutputs[_activityOutputs.length - 1].localName = val; } @@ -495,10 +501,16 @@ function _collectWorkitemInputs(val) { } function _collectWorkitemInputLocalNames(val) { + if (_workitemInputs.length === 0) { + throw new Error('Cannot assign local name property when no --input was provided. See https://github.com/petrbroz/forge-cli-utils/wiki/Design-Automation-Inputs-and-Outputs.'); + } _workitemInputs[_workitemInputs.length - 1].localName = val; } function _collectWorkitemInputURLs(val) { + if (_workitemInputs.length === 0) { + throw new Error('Cannot assign url property when no --input was provided. See https://github.com/petrbroz/forge-cli-utils/wiki/Design-Automation-Inputs-and-Outputs.'); + } _workitemInputs[_workitemInputs.length - 1].url = val; } @@ -507,10 +519,16 @@ function _collectWorkitemOutputs(val) { } function _collectWorkitemOutputLocalNames(val) { + if (_workitemOutputs.length === 0) { + throw new Error('Cannot assign local name property when no --output was provided. See https://github.com/petrbroz/forge-cli-utils/wiki/Design-Automation-Inputs-and-Outputs.'); + } _workitemOutputs[_workitemOutputs.length - 1].localName = val; } function _collectWorkitemOutputURLs(val) { + if (_workitemOutputs.length === 0) { + throw new Error('Cannot assign url property when no --output was provided. See https://github.com/petrbroz/forge-cli-utils/wiki/Design-Automation-Inputs-and-Outputs.'); + } _workitemOutputs[_workitemOutputs.length - 1].url = val; }