expo-dev-launcher
Advanced tools
Comparing version 0.4.0 to 0.5.0
@@ -13,2 +13,8 @@ # Changelog | ||
## 0.5.0 — 2021-06-10 | ||
### 🛠 Breaking changes | ||
- Renamed the iOS protocol in expo-updates-interface to EXUpdatesExternalInterface. ([#13214](https://github.com/expo/expo/pull/13214) by [@esamelson](https://github.com/esamelson)) | ||
## 0.4.0 — 2021-06-08 | ||
@@ -15,0 +21,0 @@ |
{ | ||
"name": "expo-dev-launcher", | ||
"title": "Expo Development Launcher", | ||
"version": "0.4.0", | ||
"version": "0.5.0", | ||
"description": "Pre-release version of the Expo development launcher package for testing.", | ||
"main": "build/DevelopementClient.js", | ||
"types": "build/DevelopementClient.d.ts", | ||
"main": "build/DevLauncher.js", | ||
"types": "build/DevLauncher.d.ts", | ||
"scripts": { | ||
@@ -39,3 +39,3 @@ "build": "expo-module build", | ||
}, | ||
"gitHead": "e99c20461cf39ee129889526ddbed76afa3c8926" | ||
"gitHead": "77159576bce2adddd45ca2d00c088cf8e3cebc2f" | ||
} |
@@ -24,2 +24,4 @@ "use strict"; | ||
const DEV_LAUNCHER_POD_IMPORT = "pod 'expo-dev-launcher', path: '../node_modules/expo-dev-launcher', :configurations => :debug"; | ||
const DEV_LAUNCHER_JS_REGISTER_ERROR_HANDLERS = `import { registerErrorHandlers } from 'expo-dev-launcher'; | ||
registerErrorHandlers();`; | ||
async function readFileAsync(path) { | ||
@@ -60,3 +62,3 @@ return fs_1.default.promises.readFile(path, 'utf8'); | ||
catch (e) { | ||
config_plugins_1.WarningAggregator.addWarningIOS('expo-dev-launcher', `Couldn't modified MainApplication.java - ${e}.`); | ||
config_plugins_1.WarningAggregator.addWarningIOS('expo-dev-launcher', `Couldn't modify MainApplication.java - ${e}.`); | ||
} | ||
@@ -71,5 +73,15 @@ } | ||
catch (e) { | ||
config_plugins_1.WarningAggregator.addWarningIOS('expo-dev-launcher', `Couldn't modified AppDelegate.m - ${e}.`); | ||
config_plugins_1.WarningAggregator.addWarningIOS('expo-dev-launcher', `Couldn't modify AppDelegate.m - ${e}.`); | ||
} | ||
} | ||
async function editIndex(config, action) { | ||
const indexPath = path_1.default.join(config.modRequest.projectRoot, 'index.js'); | ||
try { | ||
const index = action(await readFileAsync(indexPath)); | ||
return await saveFileAsync(indexPath, index); | ||
} | ||
catch (e) { | ||
config_plugins_1.WarningAggregator.addWarningIOS('expo-dev-launcher', `Couldn't modify index.js - ${e}.`); | ||
} | ||
} | ||
const withDevLauncherApplication = config => { | ||
@@ -132,2 +144,17 @@ return config_plugins_1.withDangerousMod(config, [ | ||
}; | ||
const withErrorHandling = config => { | ||
return config_plugins_1.withDangerousMod(config, [ | ||
// We want to edit js file, but for the `DangerousMod` we need to select a platform. | ||
'android', | ||
async (config) => { | ||
await editIndex(config, index => { | ||
if (!index.includes(DEV_LAUNCHER_JS_REGISTER_ERROR_HANDLERS)) { | ||
index = DEV_LAUNCHER_JS_REGISTER_ERROR_HANDLERS + '\n\n' + index; | ||
} | ||
return index; | ||
}); | ||
return config; | ||
}, | ||
]); | ||
}; | ||
const withDevLauncher = (config) => { | ||
@@ -138,4 +165,5 @@ config = withDevLauncherActivity(config); | ||
config = withDevLauncherAppDelegate_1.withDevLauncherAppDelegate(config); | ||
config = withErrorHandling(config); | ||
return config; | ||
}; | ||
exports.default = config_plugins_1.createRunOncePlugin(withDevLauncher, pkg.name, pkg.version); |
@@ -33,2 +33,5 @@ import { | ||
const DEV_LAUNCHER_JS_REGISTER_ERROR_HANDLERS = `import { registerErrorHandlers } from 'expo-dev-launcher'; | ||
registerErrorHandlers();`; | ||
async function readFileAsync(path: string): Promise<string> { | ||
@@ -89,3 +92,3 @@ return fs.promises.readFile(path, 'utf8'); | ||
'expo-dev-launcher', | ||
`Couldn't modified MainApplication.java - ${e}.` | ||
`Couldn't modify MainApplication.java - ${e}.` | ||
); | ||
@@ -99,9 +102,18 @@ } | ||
const podfile = action(await readFileAsync(podfilePath)); | ||
return await saveFileAsync(podfilePath, podfile); | ||
} catch (e) { | ||
WarningAggregator.addWarningIOS('expo-dev-launcher', `Couldn't modified AppDelegate.m - ${e}.`); | ||
WarningAggregator.addWarningIOS('expo-dev-launcher', `Couldn't modify AppDelegate.m - ${e}.`); | ||
} | ||
} | ||
async function editIndex(config: ExportedConfigWithProps, action: (index: string) => string) { | ||
const indexPath = path.join(config.modRequest.projectRoot, 'index.js'); | ||
try { | ||
const index = action(await readFileAsync(indexPath)); | ||
return await saveFileAsync(indexPath, index); | ||
} catch (e) { | ||
WarningAggregator.addWarningIOS('expo-dev-launcher', `Couldn't modify index.js - ${e}.`); | ||
} | ||
} | ||
const withDevLauncherApplication: ConfigPlugin = config => { | ||
@@ -184,2 +196,18 @@ return withDangerousMod(config, [ | ||
const withErrorHandling: ConfigPlugin = config => { | ||
return withDangerousMod(config, [ | ||
// We want to edit js file, but for the `DangerousMod` we need to select a platform. | ||
'android', | ||
async config => { | ||
await editIndex(config, index => { | ||
if (!index.includes(DEV_LAUNCHER_JS_REGISTER_ERROR_HANDLERS)) { | ||
index = DEV_LAUNCHER_JS_REGISTER_ERROR_HANDLERS + '\n\n' + index; | ||
} | ||
return index; | ||
}); | ||
return config; | ||
}, | ||
]); | ||
}; | ||
const withDevLauncher = (config: ExpoConfig) => { | ||
@@ -190,2 +218,3 @@ config = withDevLauncherActivity(config); | ||
config = withDevLauncherAppDelegate(config); | ||
config = withErrorHandling(config); | ||
return config; | ||
@@ -192,0 +221,0 @@ }; |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
1764822
153
1658
1