diff --git a/change/rnpm-plugin-windows-2019-12-16-15-28-08-cli_chooser.json b/change/rnpm-plugin-windows-2019-12-16-15-28-08-cli_chooser.json new file mode 100644 index 00000000000..f8fbd80079f --- /dev/null +++ b/change/rnpm-plugin-windows-2019-12-16-15-28-08-cli_chooser.json @@ -0,0 +1,8 @@ +{ + "type": "minor", + "comment": "add prompt to CLI", + "packageName": "rnpm-plugin-windows", + "email": "kmelmon@microsoft.com", + "commit": "364e3cd867a026a9f57f0cb526be03bd5300a39d", + "date": "2019-12-16T23:28:08.121Z" +} \ No newline at end of file diff --git a/current/local-cli/rnpm/windows/src/windows.js b/current/local-cli/rnpm/windows/src/windows.js index 7172b1319c0..05d828819c1 100644 --- a/current/local-cli/rnpm/windows/src/windows.js +++ b/current/local-cli/rnpm/windows/src/windows.js @@ -8,6 +8,7 @@ const Common = require('./common'); const chalk = require('chalk'); const execSync = require('child_process').execSync; const path = require('path'); +const prompt = require('@react-native-community/cli/build/tools/generator/promptSync').default(); const REACT_NATIVE_WINDOWS_GENERATE_PATH = function() { return path.resolve( @@ -24,11 +25,16 @@ module.exports = function (config, args, options) { const ns = options.namespace ? options.namespace : name; const version = options.windowsVersion ? options.windowsVersion : Common.getReactNativeVersion(); - // If the template is not set, look for a stable or 'rc' version - const template = options.template ? options.template : 'rc'; - const ignoreStable = !!options.template; + let template = options.template; + if (!template) { + console.log("What version of react-native-windows would you like to install? Choose one of: legacy, latest [default]:"); + template = prompt(); + if (template === '') { + template = 'vnext' + } + } - return Common.getInstallPackage(version, template, ignoreStable) + return Common.getInstallPackage(version, template, true) .then(rnwPackage => { console.log(`Installing ${rnwPackage}...`); const pkgmgr = Common.isGlobalCliUsingYarn(process.cwd()) ? 'yarn add' : 'npm install --save';