diff --git a/.github/ISSUE_TEMPLATE/react-native-windows--vnext--bug-report.md b/.github/ISSUE_TEMPLATE/react-native-windows--vnext--bug-report.md index e04f2dbda25..6549797d05f 100644 --- a/.github/ISSUE_TEMPLATE/react-native-windows--vnext--bug-report.md +++ b/.github/ISSUE_TEMPLATE/react-native-windows--vnext--bug-report.md @@ -19,7 +19,6 @@ If you are using latest version: Otherwise if `--info` doesn't exist: 1. `react-native -v`: -2. `npm ls rnpm-plugin-windows`: 3. `npm ls react-native-windows`: 4. `node -v`: 5. `npm -v`: diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index e5a532a2b3e..6788ff5d38b 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -163,9 +163,6 @@ jobs: - name: Init new project run: cd ${{ runner.temp }} && react-native init testcli --version 0.60.6 - - name: Install rnpm-plugin-windows - run: cd ${{ runner.temp }}\testcli && yarn add rnpm-plugin-windows@file:${{ runner.workspace }}\react-native-windows\current\local-cli\rnpm\windows - - name: Apply windows template run: cd ${{ runner.temp }}\testcli && react-native windows --template vnext --windowsVersion file:${{ runner.workspace }}\react-native-windows\vnext diff --git a/change/react-native-windows-2020-04-27-09-14-14-delrnpm.json b/change/react-native-windows-2020-04-27-09-14-14-delrnpm.json new file mode 100644 index 00000000000..4b5933ed081 --- /dev/null +++ b/change/react-native-windows-2020-04-27-09-14-14-delrnpm.json @@ -0,0 +1,8 @@ +{ + "type": "none", + "comment": "Remove rnpm-plugin-windows", + "packageName": "react-native-windows", + "email": "acoates@microsoft.com", + "dependentChangeType": "none", + "date": "2020-04-27T16:14:12.892Z" +} diff --git a/packages/E2ETest/package.json b/packages/E2ETest/package.json index 46abc09dd84..4f080c7ea22 100644 --- a/packages/E2ETest/package.json +++ b/packages/E2ETest/package.json @@ -25,8 +25,7 @@ "prompt-sync": "^4.2.0", "react": "16.9.0", "react-native": "0.62.2", - "react-native-windows": "0.0.0-master.50", - "rnpm-plugin-windows": "^0.6.1" + "react-native-windows": "0.0.0-master.50" }, "devDependencies": { "@babel/core": "^7.8.4", diff --git a/packages/microsoft-reactnative-sampleapps/package.json b/packages/microsoft-reactnative-sampleapps/package.json index 85f228c1c27..7889e67990c 100644 --- a/packages/microsoft-reactnative-sampleapps/package.json +++ b/packages/microsoft-reactnative-sampleapps/package.json @@ -16,8 +16,7 @@ "dependencies": { "react": "16.9.0", "react-native": "0.62.2", - "react-native-windows": "0.0.0-master.50", - "rnpm-plugin-windows": "^0.6.1" + "react-native-windows": "0.0.0-master.50" }, "devDependencies": { "@babel/core": "^7.8.4", diff --git a/packages/rnpm-plugin-windows/CHANGELOG.json b/packages/rnpm-plugin-windows/CHANGELOG.json deleted file mode 100644 index 54132a5ce53..00000000000 --- a/packages/rnpm-plugin-windows/CHANGELOG.json +++ /dev/null @@ -1,187 +0,0 @@ -{ - "name": "rnpm-plugin-windows", - "entries": [ - { - "date": "Wed, 25 Mar 2020 20:04:59 GMT", - "tag": "rnpm-plugin-windows_v0.6.1", - "version": "0.6.1", - "comments": { - "patch": [ - { - "comment": "allow CLI to install from file:", - "author": "kmelmon@microsoft.com", - "commit": "407c0834ada43cd9d42c24cb6ddfe7c91ddf960a" - } - ] - } - }, - { - "date": "Tue, 24 Mar 2020 22:51:22 GMT", - "tag": "rnpm-plugin-windows_v0.6.0", - "version": "0.6.0", - "comments": { - "minor": [ - { - "comment": "Teach React Native CLI about master and 0.61 versions", - "author": "ngerlem@microsoft.com", - "commit": "407c0834ada43cd9d42c24cb6ddfe7c91ddf960a" - } - ] - } - }, - { - "date": "Thu, 27 Feb 2020 18:38:20 GMT", - "tag": "rnpm-plugin-windows_v0.5.1-0", - "version": "0.5.1-0", - "comments": { - "none": [ - { - "comment": "Move rnpm-plugin-windows package out of current", - "author": "acoates@microsoft.com", - "commit": "2a2bf8556317d97b52c8339b038943b484864f77" - } - ] - } - }, - { - "date": "Tue, 11 Feb 2020 01:21:44 GMT", - "tag": "rnpm-plugin-windows_v0.5.1-0", - "version": "0.5.1-0", - "comments": { - "prerelease": [ - { - "comment": "Fix CLI dependency", - "author": "acoates@microsoft.com", - "commit": "33f9509e627c111fa5582e11c78d0b00a3b6ce05" - } - ] - } - }, - { - "date": "Tue, 17 Dec 2019 23:33:28 GMT", - "tag": "rnpm-plugin-windows_v0.4.0", - "version": "0.4.0", - "comments": { - "minor": [ - { - "comment": "add prompt to CLI", - "author": "kmelmon@microsoft.com", - "commit": "364e3cd867a026a9f57f0cb526be03bd5300a39d" - } - ] - } - }, - { - "date": "Tue, 17 Dec 2019 21:45:01 GMT", - "tag": "rnpm-plugin-windows_v0.3.9", - "version": "0.3.9", - "comments": { - "patch": [ - { - "comment": "CLI detect project name from app.json", - "author": "licanhua@live.com", - "commit": "ed24ef5033bac55fb8f0db6ee727051521e4682c" - } - ] - } - }, - { - "date": "Wed, 06 Nov 2019 13:58:14 GMT", - "tag": "rnpm-plugin-windows_v0.3.8", - "version": "0.3.8", - "comments": { - "patch": [ - { - "comment": "This change enables consuming JSI implementations where the referenced JSI headers differs from the JSI headers in react-native.", - "author": "anandrag@microsoft.com", - "commit": "04b58d679ba04baca23348928fad5250a34d31b9" - } - ] - } - }, - { - "date": "Thu, 17 Oct 2019 20:58:22 GMT", - "tag": "rnpm-plugin-windows_v0.3.7", - "version": "0.3.7", - "comments": { - "patch": [ - { - "comment": "Fix two issues: 1) you cannot animated 2 subchannels of the same property with different animations. to fix this we animated yet another property set for translation and scale owned by the props nodes and use one animation to animate all of the subchannels for the uiElement. 2) Reference parameter names which started with a multi digit number are unsupported so i added an n to the start of each name, which was previously just the node's tag.", - "author": "stpete@microsoft.com", - "commit": "62049fdbd667fc71ae09b09f074446d8593d826d" - } - ] - } - }, - { - "date": "Tue, 15 Oct 2019 13:59:27 GMT", - "tag": "rnpm-plugin-windows_v0.3.6", - "version": "0.3.6", - "comments": { - "patch": [ - { - "comment": "Updates logic for `wpf` command to install correct dependency", - "author": "erozell@outlook.com", - "commit": "2325263a2cd4bd66ae7f78f2fa01650aee280345" - } - ] - } - }, - { - "date": "Thu, 03 Oct 2019 22:17:13 GMT", - "tag": "rnpm-plugin-windows_v0.3.5", - "version": "0.3.5", - "comments": { - "none": [ - { - "comment": "Support contextMenuHidden", - "author": "dida@ntdev.microsoft.com", - "commit": "18b68810d1f1687889909782e47750afe6f06b24" - } - ] - } - }, - { - "date": "Tue, 01 Oct 2019 18:17:42 GMT", - "tag": "rnpm-plugin-windows_v0.3.5", - "version": "0.3.5", - "comments": { - "patch": [ - { - "comment": "The customer provided examples revealed a few of issues. One, we were dubble counding the starting value of animatiosn in some cases. Two we were incorrectly relying on JS to tell us to flatten our animated values. Three we were detaching the expression animations that tied the property to the UIElement and in certain cases the JS thread does not inform us that we need to rebuild this cuppling. There is an open issue with this final part #3280", - "author": "stpete@microsoft.com", - "commit": "87e54197b92a06e15acc0d3da7c4016eb3c95448" - } - ] - } - }, - { - "date": "Sat, 28 Sep 2019 01:21:33 GMT", - "tag": "rnpm-plugin-windows_v0.3.0", - "version": "0.3.0", - "comments": { - "minor": [ - { - "comment": "add support for cpp", - "author": "email not defined", - "commit": "10233b95839d33eb57d32eaa6b67462f643884c4" - } - ] - } - }, - { - "date": "Tue, 24 Sep 2019 19:11:20 GMT", - "tag": "rnpm-plugin-windows_v0.2.13", - "version": "0.2.13", - "comments": { - "patch": [ - { - "comment": "Support latest react-native-cli", - "author": "acoates@microsoft.com", - "commit": "704b5b46704d5638293c3f6ff0f3bd09e6bfa809" - } - ] - } - } - ] -} \ No newline at end of file diff --git a/packages/rnpm-plugin-windows/CHANGELOG.md b/packages/rnpm-plugin-windows/CHANGELOG.md deleted file mode 100644 index 3e9ac981f07..00000000000 --- a/packages/rnpm-plugin-windows/CHANGELOG.md +++ /dev/null @@ -1,70 +0,0 @@ -# Change Log - rnpm-plugin-windows - -This log was last generated on Wed, 25 Mar 2020 20:04:59 GMT and should not be manually modified. - -## 0.6.1 -Wed, 25 Mar 2020 20:04:59 GMT - -### Patches - -- allow CLI to install from file: (kmelmon@microsoft.com) -## 0.6.0 -Tue, 24 Mar 2020 22:51:22 GMT - -### Minor changes - -- Teach React Native CLI about master and 0.61 versions (ngerlem@microsoft.com) -## 0.5.1-0 -Tue, 11 Feb 2020 01:21:44 GMT - -### Changes - -- Fix CLI dependency (acoates@microsoft.com) -## 0.4.0 -Tue, 17 Dec 2019 23:33:28 GMT - -### Minor changes - -- add prompt to CLI (kmelmon@microsoft.com) -## 0.3.9 -Tue, 17 Dec 2019 21:45:01 GMT - -### Patches - -- CLI detect project name from app.json (licanhua@live.com) -## 0.3.8 -Wed, 06 Nov 2019 13:58:14 GMT - -### Patches - -- This change enables consuming JSI implementations where the referenced JSI headers differs from the JSI headers in react-native. (anandrag@microsoft.com) -## 0.3.7 -Thu, 17 Oct 2019 20:58:22 GMT - -### Patches - -- Fix two issues: 1) you cannot animated 2 subchannels of the same property with different animations. to fix this we animated yet another property set for translation and scale owned by the props nodes and use one animation to animate all of the subchannels for the uiElement. 2) Reference parameter names which started with a multi digit number are unsupported so i added an n to the start of each name, which was previously just the node's tag. (stpete@microsoft.com) -## 0.3.6 -Tue, 15 Oct 2019 13:59:27 GMT - -### Patches - -- Updates logic for `wpf` command to install correct dependency (erozell@outlook.com) -## 0.3.5 -Tue, 01 Oct 2019 18:17:42 GMT - -### Patches - -- The customer provided examples revealed a few of issues. One, we were dubble counding the starting value of animatiosn in some cases. Two we were incorrectly relying on JS to tell us to flatten our animated values. Three we were detaching the expression animations that tied the property to the UIElement and in certain cases the JS thread does not inform us that we need to rebuild this cuppling. There is an open issue with this final part #3280 (stpete@microsoft.com) -## 0.3.0 -Sat, 28 Sep 2019 01:21:33 GMT - -### Minor changes - -- add support for cpp (email not defined) -## 0.2.13 -Tue, 24 Sep 2019 19:11:20 GMT - -### Patches - -- Support latest react-native-cli (acoates@microsoft.com) \ No newline at end of file diff --git a/packages/rnpm-plugin-windows/README.md b/packages/rnpm-plugin-windows/README.md deleted file mode 100644 index e55920a0a16..00000000000 --- a/packages/rnpm-plugin-windows/README.md +++ /dev/null @@ -1,52 +0,0 @@ -# RNPM Plugin for Universal Windows - -To bootstrap the creation of Windows projects for React Native, we've published `rnpm-plugin-windows`. The purpose of this plugin is to provide project init functionality comparable to `react-native init` and `react-native android`, and to allow users to build and run React Windows applications from the command line. - -## Project Initialization - -To start, make sure you have the react-native CLI installed globally. - -``` -npm install -g react-native-cli -``` - -Once the CLI is installed, install rnpm-plugin-windows and initialize your project. Note: if you have Yarn installed, the react-native-cli will prefer to use that instead of npm, so use yarn to install `rnpm-plugin-windows`. - -``` -npm install --save-dev rnpm-plugin-windows -react-native windows -``` - -The `windows` command will do the following: -- Install `react-native-windows` from [NPM](https://www.npmjs.com/package/react-native-windows) -- Read the name of your project from `package.json` -- Use [Yeoman](http://yeoman.io/) to generate the Windows project files. - -### Usage - -``` -react-native windows [name] [--namespace ] [--windowsVersion ] -``` - -The `windows` command takes an optional command line argument. -- `name` - The name of the project, which will be used for both file names and the name of the component that is registered in the React Native [AppRegistry](https://facebook.github.io/react-native/docs/appregistry.html). Default value is the name given in the root-level `package.json`. - -The `windows` command accepts two optional flags. -- `--namepace` - The namespace that will be used in the generated native C# code. Default value is `name`. -- `--windowsVersion` - The version of `react-native-windows` that will be used. Default value is matches the major and minor version of `react-native` if installed, otherwise the latest version. - -### React Native 0.27.* -> 0.30.* - -For versions of react-native prior to 0.31.0, you'll need to use the [rnpm](http://github.com/rnpm/rnpm) global CLI to run the `windows` command. Since the RNPM plugin syntax for the react-native CLI is not backward compatibile with rnpm, you'll need to use an older version of `rnpm-plugin-windows`: - -``` -npm install --save-dev rnpm-plugin-windows@0.1.* -``` - -## Running React Windows Applications - -Once `react-native-windows` is installed in your project, an additional RNPM plugin for running Windows apps is exposed to the `react-native-cli`. To deploy your app to Desktop, execute: -``` -react-native run-windows -``` -For more information on the kinds of options and flags available for deploying to devices and emulators, use the `--help` flag to get the command usage information. diff --git a/packages/rnpm-plugin-windows/index.js b/packages/rnpm-plugin-windows/index.js deleted file mode 100644 index bdd2e8b364c..00000000000 --- a/packages/rnpm-plugin-windows/index.js +++ /dev/null @@ -1,43 +0,0 @@ -module.exports = [{ - func: require('./src/windows'), - description: 'Generate React Native Windows template project', - name: 'windows [name]', - options: [{ - command: '--windowsVersion [version]', - description: 'The version of react-native-windows to use.', - }, { - command: '--namespace [namespace]', - description: 'The native project namespace.', - }, { - command: '--verbose', - description: 'Enables logging.', - default: false, - }, { - command: '--template [template]', - description: 'Template to install. E.g., `vnext`.', - }, { - command: '--language [language]', - description: 'Which language the template app is written in. Possible values are cs and cpp', - default: 'cpp', - }, { - command: '--overwrite', - description: 'Overwrite any existing files without prompting', - default: false, - }], -},{ - func: require('./src/wpf'), - description: 'Generate React Native Windows template project on WPF', - name: 'wpf [name]', - options: [{ - command: '--windowsVersion [version]', - description: 'The version of react-native-wpf to use.', - }, { - command: '--namespace [namespace]', - description: 'The native project namespace.', - }, { - command: '--verbose', - description: 'Enables logging', - default: false, - }], -}, -]; diff --git a/packages/rnpm-plugin-windows/package.json b/packages/rnpm-plugin-windows/package.json deleted file mode 100644 index e1a1366e3c9..00000000000 --- a/packages/rnpm-plugin-windows/package.json +++ /dev/null @@ -1,33 +0,0 @@ -{ - "name": "rnpm-plugin-windows", - "version": "0.6.1", - "description": "rnpm plugin that generates a Windows template project", - "main": "index.js", - "keywords": [ - "rnpm", - "react-native", - "react-native-windows", - "rnpm windows" - ], - "repository": { - "type": "git", - "url": "https://github.com/Microsoft/react-native-windows.git" - }, - "engines": { - "node": ">= 4.0.0" - }, - "license": "MIT", - "peerDependencies": { - "react-native": ">=0.31.0" - }, - "dependencies": { - "chalk": "^1.1.3", - "extract-zip": "^1.6.7", - "fs-extra": "^7.0.1", - "npm-registry": "^0.1.13", - "prompts": "^2.3.0", - "request": "^2.88.0", - "semver": "^6.1.1", - "valid-url": "^1.0.9" - } -} diff --git a/packages/rnpm-plugin-windows/react-native.config.js b/packages/rnpm-plugin-windows/react-native.config.js deleted file mode 100644 index 0ab8a95efe9..00000000000 --- a/packages/rnpm-plugin-windows/react-native.config.js +++ /dev/null @@ -1,5 +0,0 @@ -// @ts-check - -module.exports = { - commands: require('./index'), -}; diff --git a/packages/rnpm-plugin-windows/src/common.js b/packages/rnpm-plugin-windows/src/common.js deleted file mode 100644 index 653f6a25762..00000000000 --- a/packages/rnpm-plugin-windows/src/common.js +++ /dev/null @@ -1,196 +0,0 @@ -/** - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. - */ -'use strict'; - -const fs = require('fs'); -const path = require('path'); -const semver = require('semver'); -const Registry = require('npm-registry'); -const child_process = require('child_process'); -const validUrl = require('valid-url'); - -let npmConfReg = child_process.execSync('npm config get registry').toString().trim(); -let NPM_REGISTRY_URL = validUrl.is_uri(npmConfReg) ? npmConfReg : 'http://registry.npmjs.org'; - -const REACT_NATIVE_PACKAGE_JSON_PATH = function() { - return path.resolve( - process.cwd(), - 'node_modules', - 'react-native', - 'package.json' - ); -}; - -const npm = new Registry({registry: NPM_REGISTRY_URL}); - -function getLatestVersion() { - return new Promise(function (resolve, reject) { - npm.packages.release('react-native-windows', 'latest', (err, releases) => { - if (err) { - reject(err); - } else if (!releases || releases.length === 0) { - reject(new Error('Could not find react-native-windows@latest.')); - } else { - resolve(releases[0].version); - } - }); - }); -} - -function isTagMatch(packageVersion, requestTag) { - const prerelease = semver.prerelease(packageVersion); - if (prerelease === null && !requestTag) { - return true; - } else { - return prerelease && prerelease[0] === requestTag; - } -} - -function isVersionMatch(packageVersion, requestVersion, requestTag) { - if (semver.parse(packageVersion) === null) { - return false; - } - - const { major, minor } = semver.parse(packageVersion); - const minVersion = semver.minVersion(requestVersion); - return major === minVersion.major && - minor === minVersion.minor && - isTagMatch(packageVersion, requestTag); -} - -function getLatestMatchingVersion(versionRange, tag) { - return new Promise((resolve, reject) => { - // Ignore the version range of React Native if asking for master, since our - // RNW version may not align. - if (tag === 'master') { - npm.packages.release('react-native-windows', 'master', (err, rel) => { - if (err) { - reject(err); - } else { - resolve(rel[0].version); - } - }); - } else { - npm.packages.releases('react-native-windows', (err, rels) => { - if (err) { - reject(err); - } else { - const matchingVersions = Object.keys(rels) - .filter(v => isVersionMatch(v, versionRange, tag)) - .sort(semver.rcompare); - - if (matchingVersions.length > 0) { - resolve(matchingVersions[0]); - } else { - reject(); - } - } - }); - } - }); -} - -/** - * Matches a version range to a version of react-native-windows to install. This is a hairy process - * with a few different cases. Note that we will not run this at all if an exact version was given - * for --windowsVersion. - * - * - If no version was specified we are passed a range based on React Native version. E.g. "0.61.*". - * We will try to match this against available packages, but need special rules for prerelease - * tags since we use them for even stable releases for several versions. Because of that we cannot - * use the semver range directly. - * - * - If our tag is "master", we grab the latest master label builds, since our RN version may not - * correspond to our RNW version. This will change once we're aligned to Facebook's master builds. - * - * - Users can pass in a range to --windowsVersion and we will try to respect it according to above - * matching logic. We likely do not do the right thing here in many cases sine we do not query the - * registry for the range directly, instead using custom logic to also ensure tag matches. - */ -async function getMatchingVersion(versionRange, tag) { - const versionStr = tag === 'master' ? 'master' : versionRange; - console.log(`Checking for react-native-windows version matching ${versionStr}...`); - - try { - return await getLatestMatchingVersion(versionRange, tag); - } catch (ex) { - const latestVersion = await getLatestVersion(); - throw new Error(`Could not find react-native-windows@${versionStr}. ` + - `Latest version of react-native-windows is ${latestVersion}, try switching to ` + - `react-native@${semver.major(latestVersion)}.${semver.minor(latestVersion)}.*.`); - } -} - -const isSupportedVersion = function(validVersion, validRange) { - // Allow 0.0.0-x master builds - if (validVersion) { - return semver.lt(validVersion, '0.0.0') || semver.gte(validVersion, '0.27.0'); - } else if (validRange) { - return semver.gtr('0.0.0', validRange) || semver.ltr('0.27.0', validRange); - } else { - return false; - } -}; - -const getInstallPackage = function (version, tag) { - const packageToInstall = 'react-native-windows'; - const validVersion = semver.valid(version); - const validRange = semver.validRange(version); - - if (!isSupportedVersion(validVersion, validRange)) { - console.error( - 'Please upgrade react-native to ^0.27 or specify a --windowsVersion that is >=0.27.0' - ); - process.exit(1); - } - - if (validVersion) { - return Promise.resolve(`${packageToInstall}@${version}`); - } else { - return getMatchingVersion(version, tag) - .then(resultVersion => `${packageToInstall}@${resultVersion}`); - } -}; - -const getReactNativeVersion = function () { - console.log('Reading react-native version from node_modules...'); - if (fs.existsSync(REACT_NATIVE_PACKAGE_JSON_PATH())) { - const version = JSON.parse(fs.readFileSync(REACT_NATIVE_PACKAGE_JSON_PATH(), 'utf-8')).version; - return `${semver.major(version)}.${semver.minor(version)}.*`; - } -}; - -const getReactNativeAppName = function () { - console.log('Reading application name from package.json...'); - let name = JSON.parse(fs.readFileSync('package.json', 'utf8')).name; - if (!name) { - if (fs.existsSync('app.json')) { - console.log('Reading application name from app.json...'); - name = JSON.parse(fs.readFileSync('app.json', 'utf8')).name; - } - } - if (!name) { - console.error('Please specify name in package.json or app.json'); - } - return name; -}; - -/** - * Check that 'react-native init' itself used yarn to install React Native. - * When using an old global react-native-cli@1.0.0 (or older), we don't want - * to install React Native with npm, and React + Jest with yarn. - * Let's be safe and not mix yarn and npm in a single project. - * @param projectDir e.g. /Users/martin/AwesomeApp - */ -const isGlobalCliUsingYarn = function(projectDir) { - return fs.existsSync(path.join(projectDir, 'yarn.lock')); -}; - -module.exports = { - getInstallPackage, - getReactNativeVersion, - getReactNativeAppName, - isGlobalCliUsingYarn, -}; diff --git a/packages/rnpm-plugin-windows/src/windows.js b/packages/rnpm-plugin-windows/src/windows.js deleted file mode 100644 index 502ce3640de..00000000000 --- a/packages/rnpm-plugin-windows/src/windows.js +++ /dev/null @@ -1,96 +0,0 @@ -/** - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. - */ -'use strict'; - -const Common = require('./common'); -const chalk = require('chalk'); -const execSync = require('child_process').execSync; -const path = require('path'); -const prompts = require('prompts'); -const semver = require('semver'); - -const REACT_NATIVE_WINDOWS_GENERATE_PATH = function() { - return path.resolve( - process.cwd(), - 'node_modules', - 'react-native-windows', - 'local-cli', - 'generate-windows.js' - ); -}; - -async function getDefaultVersionTag(version) { - const validVersion = semver.valid(version); - const validRange = semver.validRange(version); - if (!validVersion && !validRange) { - console.error(chalk.red(`'${version}' is not a valid version`)); - process.exit(1); - } - - // 0.57 and below had stable untagged releases - if ((validVersion && semver.lt(validVersion, '0.58.0')) - || (validRange && semver.gtr('0.58.0', validRange))) { - return null; - } - - // 0.58 went to RC (See #2559) - if ((validVersion && semver.lt(validVersion, '0.59.0')) - || (validRange && semver.gtr('0.59.0', validRange))) { - return 'rc'; - } - - // 0.59 tags releases as "legacy" or "vnext" - if ((validVersion && semver.lt(validVersion, '0.60.0')) - || (validRange && semver.gtr('0.60.0', validRange))) { - return (await prompts({ - type: 'select', - name: 'template', - message: 'What version of react-native-windows would you like to install?', - choices: [ - { value: 'vnext', title: ' Latest - High performance react-native-windows built on a shared C++ core from facebook (supports C++ or C#).' }, - { value: 'legacy', title: ' Legacy - Older react-native-windows implementation - (C# only, react-native <= 0.59 only)' }, - ], - })).template; - } - - // 0.60 releases all use the vnext tag - if ((validVersion && semver.lt(validVersion, '0.61.0')) - || (validRange && semver.gtr('0.61.0', validRange))) { - return 'vnext'; - } - - // 0.61 and after don't tag stable releases - return null; -} - -module.exports = async function (config, args, options) { - try { - const name = args[0] || Common.getReactNativeAppName(); - const ns = options.namespace || name; - const version = options.windowsVersion || Common.getReactNativeVersion(); - let rnwPackage = version; - // If the version is a file: link, there's no need to compute what package to install. - // This is useful when testing local changes to the repo that haven't been published yet. - if (!version.startsWith("file:")) { - const versionTag = options.template || await getDefaultVersionTag(version); - - rnwPackage = await Common.getInstallPackage(version, versionTag); - } - - console.log(`Installing ${rnwPackage}...`); - const pkgmgr = Common.isGlobalCliUsingYarn(process.cwd()) ? 'yarn add' : 'npm install --save'; - - const execOptions = options.verbose ? { stdio: 'inherit' } : {}; - execSync(`${pkgmgr} ${rnwPackage}`, execOptions); - console.log(chalk.green(`${rnwPackage} successfully installed.`)); - - const generateWindows = require(REACT_NATIVE_WINDOWS_GENERATE_PATH()); - generateWindows(process.cwd(), name, ns, options); - } catch (error) { - console.error(chalk.red(error.message)); - console.error(error); - process.exit(1); - } -}; diff --git a/packages/rnpm-plugin-windows/src/wpf.js b/packages/rnpm-plugin-windows/src/wpf.js deleted file mode 100644 index 3a6821c2e30..00000000000 --- a/packages/rnpm-plugin-windows/src/wpf.js +++ /dev/null @@ -1,42 +0,0 @@ -/** - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. - */ -'use strict'; - -const Common = require('./common'); -const chalk = require('chalk'); -const execSync = require('child_process').execSync; -const path = require('path'); - -const REACT_NATIVE_WPF_GENERATE_PATH = function() { - return path.resolve( - process.cwd(), - 'node_modules', - 'react-native-windows', - 'local-cli', - 'generate-wpf.js' - ); -}; - -module.exports = function (config, args, options) { - const name = args[0] ? args[0] : Common.getReactNativeAppName(); - 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'; - - return Common.getInstallPackage(version, template) - .then(rnwPackage => { - console.log(`Installing ${rnwPackage}...`); - const pkgmgr = Common.isGlobalCliUsingYarn(process.cwd()) ? 'yarn add' : 'npm install --save'; - - const execOptions = options.verbose ? { stdio: 'inherit' } : {}; - execSync(`${pkgmgr} ${rnwPackage}`, execOptions); - console.log(chalk.green(`${rnwPackage} successfully installed.`)); - - const generateWPF = require(REACT_NATIVE_WPF_GENERATE_PATH()); - generateWPF(process.cwd(), name, ns, options); - }).catch(error => console.error(chalk.red(error.message))); -}; diff --git a/vnext/local-cli/runWindows/utils/info.js b/vnext/local-cli/runWindows/utils/info.js index cf87af941c0..dd13c6d2e2a 100644 --- a/vnext/local-cli/runWindows/utils/info.js +++ b/vnext/local-cli/runWindows/utils/info.js @@ -16,7 +16,6 @@ async function getEnvironmentInfo() { 'react-native', 'react-native-windows', '@react-native-community/cli', - 'rnpm-plugin-windows', 'react-native-cli', ], npmGlobalPackages: ['*react-native*'],