Skip to content

Commit

Permalink
chore: Upgrade metro dependencies to 0.76.2
Browse files Browse the repository at this point in the history
  • Loading branch information
huntie committed Apr 14, 2023
1 parent 6d22b62 commit 0e1b813
Show file tree
Hide file tree
Showing 6 changed files with 138 additions and 276 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
"jest-snapshot-serializer-raw": "^1.1.0",
"lerna": "^4.0.0",
"lint-staged": "^13.1.0",
"metro-memory-fs": "0.76.0",
"metro-memory-fs": "0.76.2",
"micromatch": "^4.0.4",
"rimraf": "^3.0.2",
"slash": "^3.0.0",
Expand Down
18 changes: 7 additions & 11 deletions packages/cli-plugin-metro/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,20 +11,16 @@
"@react-native-community/cli-tools": "12.0.0-alpha.2",
"chalk": "^4.1.2",
"execa": "^5.0.0",
"metro": "0.76.0",
"metro-config": "0.76.0",
"metro-core": "0.76.0",
"metro-react-native-babel-transformer": "0.76.0",
"metro-resolver": "0.76.0",
"metro-runtime": "0.76.0",
"metro": "0.76.2",
"metro-config": "0.76.2",
"metro-core": "0.76.2",
"metro-react-native-babel-transformer": "0.76.2",
"metro-resolver": "0.76.2",
"metro-runtime": "0.76.2",
"readline": "^1.3.0"
},
"devDependencies": {
"@react-native-community/cli-types": "12.0.0-alpha.2",
"@types/metro": "^0.76.0",
"@types/metro-config": "^0.76.1",
"@types/metro-core": "^0.76.0",
"@types/metro-resolver": "^0.76.1"
"@react-native-community/cli-types": "12.0.0-alpha.2"
},
"files": [
"build",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import Server from 'metro/src/Server';
// @ts-ignore - no typed definition for the package
const outputBundle = require('metro/src/shared/output/bundle');
import type {BundleOptions} from 'metro/shared/types';
import type {BundleOptions} from 'metro/src/shared/types';
import type {ConfigT} from 'metro-config';
import path from 'path';
import chalk from 'chalk';
Expand Down
3 changes: 1 addition & 2 deletions packages/cli-plugin-metro/src/commands/start/runServer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

// @ts-ignore untyped metro
import Metro from 'metro';
import type {Server} from 'metro';
import type Server from 'metro/src/Server';
import type {Middleware} from 'metro-config';
import {Terminal} from 'metro-core';
import path from 'path';
Expand Down Expand Up @@ -101,7 +101,6 @@ async function runServer(_argv: Array<string>, ctx: Config, args: Args) {
secure: args.https,
secureCert: args.cert,
secureKey: args.key,
hmrEnabled: true,
// @ts-ignore - ws.Server types are incompatible
websocketEndpoints,
});
Expand Down
6 changes: 1 addition & 5 deletions packages/cli-plugin-metro/src/tools/loadMetroConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -89,19 +89,15 @@ export default async function loadMetroConfig(

const projectConfig = await resolveConfig(undefined, ctx.root);

// @ts-ignore resolveConfig return value is mistyped
if (projectConfig.isEmpty) {
throw new CLIError(`No metro config found in ${ctx.root}`);
}

// @ts-ignore resolveConfig return value is mistyped
logger.debug(`Reading Metro config from ${projectConfig.filepath}`);

if (
!/['"']@react-native\/metro-config['"']/.test(
fs
// @ts-ignore resolveConfig return value is mistyped
.readFileSync(projectConfig.filepath, 'utf8'),
fs.readFileSync(projectConfig.filepath, 'utf8'),
)
) {
logger.warn(
Expand Down
Loading

0 comments on commit 0e1b813

Please sign in to comment.