Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@react-native-windows/cli

Package Overview
Dependencies
Maintainers
2
Versions
417
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@react-native-windows/cli - npm Package Compare versions

Comparing version 0.0.0-canary.44 to 0.0.0-canary.45

28

CHANGELOG.json

@@ -5,2 +5,30 @@ {

{
"date": "Tue, 08 Dec 2020 01:58:13 GMT",
"tag": "@react-native-windows/cli_v0.0.0-canary.45",
"version": "0.0.0-canary.45",
"comments": {
"prerelease": [
{
"comment": "Ensure windows script added on init",
"author": "ngerlem@microsoft.com",
"commit": "92ed26927664ee91fb7447b0b3ba67fab410ed74",
"package": "@react-native-windows/cli"
},
{
"comment": "Change from Manually Entered Version to Reference to WinUI.props",
"author": "34109996+chiaramooney@users.noreply.github.com",
"commit": "4dcb62a74ed1536b38d2b348506cb9a55ea87a55",
"package": "@react-native-windows/cli"
}
],
"none": [
{
"author": "ngerlem@microsoft.com",
"commit": "56d2170d526548052de30c3648d40cc47e683a6e",
"package": "@react-native-windows/cli"
}
]
}
},
{
"date": "Thu, 03 Dec 2020 21:43:48 GMT",

@@ -7,0 +35,0 @@ "tag": "@react-native-windows/cli_v0.0.0-canary.43",

11

CHANGELOG.md
# Change Log - @react-native-windows/cli
This log was last generated on Thu, 03 Dec 2020 21:43:48 GMT and should not be manually modified.
This log was last generated on Tue, 08 Dec 2020 01:58:13 GMT and should not be manually modified.
<!-- Start content -->
## 0.0.0-canary.45
Tue, 08 Dec 2020 01:58:13 GMT
### Changes
- Ensure windows script added on init (ngerlem@microsoft.com)
- Change from Manually Entered Version to Reference to WinUI.props (34109996+chiaramooney@users.noreply.github.com)
## 0.0.0-canary.43

@@ -8,0 +17,0 @@

4

lib-commonjs/generator-windows/index.d.ts

@@ -8,4 +8,4 @@ /**

export declare function copyProjectTemplateAndReplace(srcRootPath: string, destPath: string, newProjectName: string, namespace: string, options: GenerateOptions): Promise<void>;
export declare function installDependencies(options: {
export declare function installScriptsAndDependencies(options: {
verbose: boolean;
}): void;
}): Promise<void>;

@@ -8,3 +8,3 @@ "use strict";

Object.defineProperty(exports, "__esModule", { value: true });
exports.installDependencies = exports.copyProjectTemplateAndReplace = void 0;
exports.installScriptsAndDependencies = exports.copyProjectTemplateAndReplace = void 0;
const chalk = require("chalk");

@@ -21,2 +21,3 @@ const path = require("path");

const generator_common_1 = require("../generator-common");
const package_utils_1 = require("@rnw-scripts/package-utils");
const windowsDir = 'windows';

@@ -106,5 +107,6 @@ const bundleDir = 'Bundle';

const xamlNamespaceCpp = toCppNamespace(xamlNamespace);
const winui3PropsPath = require.resolve('react-native-windows/PropertySheets/WinUI.props', { paths: [process.cwd()] });
const winui3Props = configUtils_1.readProjectFile(winui3PropsPath);
const winui3Version = configUtils_1.findPropertyValue(winui3Props, 'WinUI3Version', winui3PropsPath);
const winuiPropsPath = require.resolve('react-native-windows/PropertySheets/WinUI.props', { paths: [process.cwd()] });
const winuiProps = configUtils_1.readProjectFile(winuiPropsPath);
const winui3Version = configUtils_1.findPropertyValue(winuiProps, 'WinUI3Version', winuiPropsPath);
const winui2xVersion = configUtils_1.findPropertyValue(winuiProps, 'WinUI2xVersion', winuiPropsPath);
const csNugetPackages = [

@@ -126,3 +128,3 @@ {

id: options.useWinUI3 ? 'Microsoft.WinUI' : 'Microsoft.UI.Xaml',
version: options.useWinUI3 ? winui3Version : '2.3.191129002',
version: options.useWinUI3 ? winui3Version : winui2xVersion,
hasProps: false,

@@ -333,34 +335,33 @@ hasTargets: false,

}
function installDependencies(options) {
const cwd = process.cwd();
// Extract react-native peer dependency version
const rnwPackageJsonPath = require.resolve('react-native-windows/package.json', { paths: [process.cwd()] });
const rnwPackageJson = JSON.parse(fs.readFileSync(rnwPackageJsonPath, { encoding: 'UTF8' }));
let rnPeerDependency = rnwPackageJson.peerDependencies['react-native'];
const depDelim = ' || ';
const delimIndex = rnPeerDependency.indexOf(depDelim);
if (delimIndex !== -1) {
rnPeerDependency = rnPeerDependency.slice(0, delimIndex);
async function installScriptsAndDependencies(options) {
var _a;
const projectPackage = await package_utils_1.WritableNpmPackage.fromPath(process.cwd());
if (!projectPackage) {
throw new Error('The current directory is not the root of an npm package');
}
const rnPackageJsonPath = require.resolve('react-native/package.json', {
paths: [process.cwd()],
await projectPackage.mergeProps({
scripts: { windows: 'react-native run-windows' },
});
const rnPackageJson = JSON.parse(fs.readFileSync(rnPackageJsonPath, { encoding: 'UTF8' }));
if (!semver.satisfies(rnPackageJson.version, rnPeerDependency)) {
const rnwPackage = await package_utils_1.findPackage('react-native-windows');
if (!rnwPackage) {
throw new Error('Could not locate the package for react-native-windows');
}
const rnPackage = await package_utils_1.findPackage('react-native');
if (!rnPackage) {
throw new Error('Could not locate the package for react-native');
}
const rnPeerDependency = rnwPackage.json.peerDependencies['react-native'];
if (!semver.satisfies(rnPackage.json.version, rnPeerDependency) && ((_a = projectPackage.json.dependencies) === null || _a === void 0 ? void 0 : _a['react-native'])) {
console.log(chalk.green('Installing a compatible version of react-native:'));
console.log(chalk.white(` ${rnPeerDependency}`));
// Patch package.json to have proper react-native version and install
const projectPackageJsonPath = path.join(cwd, 'package.json');
const projectPackageJson = JSON.parse(fs.readFileSync(projectPackageJsonPath, { encoding: 'UTF8' }));
projectPackageJson.scripts.windows = 'react-native run-windows';
if (projectPackageJson.hasOwnProperty('dependencies')) {
projectPackageJson.dependencies['react-native'] = rnPeerDependency;
}
fs.writeFileSync(projectPackageJsonPath, JSON.stringify(projectPackageJson, null, 2));
await projectPackage.mergeProps({
dependencies: { 'react-native': rnPeerDependency },
});
// Install dependencies using correct package manager
const isYarn = fs.existsSync(path.join(cwd, 'yarn.lock'));
const isYarn = fs.existsSync(path.join(process.cwd(), 'yarn.lock'));
childProcess.execSync(isYarn ? 'yarn' : 'npm i', options.verbose ? { stdio: 'inherit' } : {});
}
}
exports.installDependencies = installDependencies;
exports.installScriptsAndDependencies = installScriptsAndDependencies;
//# sourceMappingURL=index.js.map

@@ -45,3 +45,3 @@ "use strict";

}
generator_windows_1.installDependencies(options);
await generator_windows_1.installScriptsAndDependencies(options);
const rnwPackage = path.dirname(require.resolve('react-native-windows/package.json', {

@@ -48,0 +48,0 @@ paths: [projectDir],

{
"name": "@react-native-windows/cli",
"version": "0.0.0-canary.44",
"version": "0.0.0-canary.45",
"license": "MIT",

@@ -21,2 +21,3 @@ "main": "lib-commonjs/index.js",

"@react-native-windows/telemetry": "^0.0.0-canary.11",
"@rnw-scripts/package-utils": "^0.0.11",
"chalk": "^4.1.0",

@@ -38,3 +39,3 @@ "cli-spinners": "^2.2.0",

"devDependencies": {
"@react-native-community/cli-types": "^4.10.1",
"@react-native-community/cli-types": "^5.0.1-alpha.0",
"@rnw-scripts/eslint-config": "0.1.6",

@@ -41,0 +42,0 @@ "@rnw-scripts/jest-unittest-config": "0.1.1",

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc