diff --git a/packages/@expo/cli/src/start/project/__tests__/devices-test.ts b/packages/@expo/cli/src/start/project/__tests__/devices-test.ts
index 47cca6966ff94d..3eb4feb23905b1 100644
--- a/packages/@expo/cli/src/start/project/__tests__/devices-test.ts
+++ b/packages/@expo/cli/src/start/project/__tests__/devices-test.ts
@@ -26,7 +26,7 @@ describe('devices info', () => {
const file = path.join(projectRoot, '.expo', 'devices.json');
expect(fs.existsSync(file)).toBe(true);
- const { devices } = JSON.parse(fs.readFileSync(file, 'utf8').toString());
+ const { devices } = JSON.parse(fs.readFileSync(file, 'utf8'));
expect(devices.length).toBe(1);
expect(devices[0].installationId).toBe('test-device-id');
});
diff --git a/packages/@expo/cli/src/utils/mergeGitIgnorePaths.ts b/packages/@expo/cli/src/utils/mergeGitIgnorePaths.ts
index dab487df678413..8fe635d49973c9 100644
--- a/packages/@expo/cli/src/utils/mergeGitIgnorePaths.ts
+++ b/packages/@expo/cli/src/utils/mergeGitIgnorePaths.ts
@@ -35,8 +35,8 @@ export function mergeGitIgnorePaths(
return null;
}
- const targetGitIgnore = fs.readFileSync(targetGitIgnorePath).toString();
- const sourceGitIgnore = fs.readFileSync(sourceGitIgnorePath).toString();
+ const targetGitIgnore = fs.readFileSync(targetGitIgnorePath, 'utf8');
+ const sourceGitIgnore = fs.readFileSync(sourceGitIgnorePath, 'utf8');
const merged = mergeGitIgnoreContents(targetGitIgnore, sourceGitIgnore);
// Only rewrite the file if it was modified.
if (merged.contents) {
diff --git a/packages/@expo/config-plugins/src/android/Package.ts b/packages/@expo/config-plugins/src/android/Package.ts
index 96222ebf4ba553..052004d5ed719e 100644
--- a/packages/@expo/config-plugins/src/android/Package.ts
+++ b/packages/@expo/config-plugins/src/android/Package.ts
@@ -125,7 +125,7 @@ export async function renameJniOnDiskForType({
filesToUpdate.forEach((filepath: string) => {
try {
if (fs.lstatSync(filepath).isFile() && ['.h', '.cpp'].includes(path.extname(filepath))) {
- let contents = fs.readFileSync(filepath).toString();
+ let contents = fs.readFileSync(filepath, 'utf8');
contents = contents.replace(
new RegExp(transformJavaClassDescriptor(currentPackageName).replace(/\//g, '\\/'), 'g'),
transformJavaClassDescriptor(packageName)
@@ -207,7 +207,7 @@ export async function renamePackageOnDiskForType({
filesToUpdate.forEach((filepath: string) => {
try {
if (fs.lstatSync(filepath).isFile()) {
- let contents = fs.readFileSync(filepath).toString();
+ let contents = fs.readFileSync(filepath, 'utf8');
if (path.extname(filepath) === '.kt') {
contents = replacePackageName(contents, currentPackageName, kotlinSanitizedPackageName);
} else {
diff --git a/packages/@expo/config-plugins/src/android/__tests__/Locales-test.ts b/packages/@expo/config-plugins/src/android/__tests__/Locales-test.ts
index 9f31ef8fc18685..7609a8705633c2 100644
--- a/packages/@expo/config-plugins/src/android/__tests__/Locales-test.ts
+++ b/packages/@expo/config-plugins/src/android/__tests__/Locales-test.ts
@@ -58,7 +58,7 @@ describe('e2e: Android locales', () => {
},
};
const mockJSONFile = {
- readAsync: (path) => JSON.parse(vol.readFileSync(path).toString()),
+ readAsync: (path) => JSON.parse(vol.readFileSync(path, 'utf8') as string),
};
jest.mock('../../utils/XML', () => mockXML);
jest.mock('@expo/json-file', () => mockJSONFile);
@@ -84,21 +84,21 @@ describe('e2e: Android locales', () => {
{ projectRoot }
);
- expect(vol.readFileSync('/app/android/app/src/main/res/values-b+es/strings.xml').toString())
+ expect(vol.readFileSync('/app/android/app/src/main/res/values-b+es/strings.xml', 'utf8'))
.toMatchInlineSnapshot(`
"
"spanish-name"
"
`);
// backwards compatibility
- expect(vol.readFileSync('/app/android/app/src/main/res/values-b+en/strings.xml').toString())
+ expect(vol.readFileSync('/app/android/app/src/main/res/values-b+en/strings.xml', 'utf8'))
.toMatchInlineSnapshot(`
"
"us-name"
"us-name"
"
`);
- expect(vol.readFileSync('/app/android/app/src/main/res/values-b+en+US/strings.xml').toString())
+ expect(vol.readFileSync('/app/android/app/src/main/res/values-b+en+US/strings.xml', 'utf8'))
.toMatchInlineSnapshot(`
"
"us-name"
diff --git a/packages/@expo/config-plugins/src/android/__tests__/renamePackageOnDisk-test.ts b/packages/@expo/config-plugins/src/android/__tests__/renamePackageOnDisk-test.ts
index af4d7c87c84aa5..6aa1e4762456fb 100644
--- a/packages/@expo/config-plugins/src/android/__tests__/renamePackageOnDisk-test.ts
+++ b/packages/@expo/config-plugins/src/android/__tests__/renamePackageOnDisk-test.ts
@@ -44,24 +44,24 @@ public class SomeClass {
await renamePackageOnDisk({ android: { package: 'xyz.bront.app' } }, '/myapp');
const mainActivityPath = '/myapp/android/app/src/main/java/xyz/bront/app/MainActivity.java';
expect(fs.existsSync(mainActivityPath)).toBeTruthy();
- expect(fs.readFileSync(mainActivityPath).toString()).toMatch('package xyz.bront.app');
+ expect(fs.readFileSync(mainActivityPath, 'utf8')).toMatch('package xyz.bront.app');
const nestedClassPath =
'/myapp/android/app/src/main/java/xyz/bront/app/example/SomeClass.java';
expect(fs.existsSync(nestedClassPath)).toBeTruthy();
- expect(fs.readFileSync(nestedClassPath).toString()).toMatch('package xyz.bront.app');
- expect(fs.readFileSync(nestedClassPath).toString()).not.toMatch('com.lololol');
+ expect(fs.readFileSync(nestedClassPath, 'utf8')).toMatch('package xyz.bront.app');
+ expect(fs.readFileSync(nestedClassPath, 'utf8')).not.toMatch('com.lololol');
const buckPath = '/myapp/android/app/BUCK';
- expect(fs.readFileSync(buckPath).toString()).toMatch('package = "xyz.bront.app"');
- expect(fs.readFileSync(buckPath).toString()).not.toMatch('com.lololol');
+ expect(fs.readFileSync(buckPath, 'utf8')).toMatch('package = "xyz.bront.app"');
+ expect(fs.readFileSync(buckPath, 'utf8')).not.toMatch('com.lololol');
});
it('does not clobber itself if package has similar parts', async () => {
await renamePackageOnDisk({ android: { package: 'com.bront' } }, '/myapp');
const mainActivityPath = '/myapp/android/app/src/main/java/com/bront/MainActivity.java';
expect(fs.existsSync(mainActivityPath)).toBeTruthy();
- expect(fs.readFileSync(mainActivityPath).toString()).toMatch('package com.bront');
+ expect(fs.readFileSync(mainActivityPath, 'utf8')).toMatch('package com.bront');
});
});
});
diff --git a/packages/@expo/fingerprint/src/__tests__/Fingerprint-filehook-test.ts b/packages/@expo/fingerprint/src/__tests__/Fingerprint-filehook-test.ts
index 3f8599da338258..49d135a45197fc 100644
--- a/packages/@expo/fingerprint/src/__tests__/Fingerprint-filehook-test.ts
+++ b/packages/@expo/fingerprint/src/__tests__/Fingerprint-filehook-test.ts
@@ -96,7 +96,7 @@ describe('FileHookTransform', () => {
it('should call hook function from createFingerprintAsync', async () => {
vol.fromJSON(require('../sourcer/__tests__/fixtures/ExpoManaged47Project.json'));
- const packageJson = JSON.parse(vol.readFileSync('/app/package.json', 'utf8').toString());
+ const packageJson = JSON.parse(vol.readFileSync('/app/package.json', 'utf8') as string);
jest.doMock('/app/package.json', () => packageJson, { virtual: true });
const options = await normalizeOptionsAsync('/app', { fileHookTransform: mockHook });
await createFingerprintAsync('/app', options);
@@ -121,7 +121,7 @@ describe('FileHookTransform', () => {
}
) as jest.MockedFunction;
vol.fromJSON(require('../sourcer/__tests__/fixtures/ExpoManaged47Project.json'));
- const packageJson = JSON.parse(vol.readFileSync('/app/package.json', 'utf8').toString());
+ const packageJson = JSON.parse(vol.readFileSync('/app/package.json', 'utf8') as string);
jest.doMock('/app/package.json', () => packageJson, { virtual: true });
const options = await normalizeOptionsAsync('/app', { fileHookTransform: mockExpoConfigHook });
const result = await createFingerprintAsync('/app', options);
diff --git a/packages/@expo/fingerprint/src/__tests__/Fingerprint-test.ts b/packages/@expo/fingerprint/src/__tests__/Fingerprint-test.ts
index f8368243c4ae28..f57b5a85a7cdfc 100644
--- a/packages/@expo/fingerprint/src/__tests__/Fingerprint-test.ts
+++ b/packages/@expo/fingerprint/src/__tests__/Fingerprint-test.ts
@@ -71,6 +71,36 @@ describe(diffFingerprintChangesAsync, () => {
expect(normalizedDiff).toMatchInlineSnapshot(`
[
+ {
+ "addedSource": {
+ "contents": "{"extraDependencies":[],"coreFeatures":[],"modules":[]}",
+ "debugInfo": {
+ "hash": "10c4144650e3af1f596683ac4ae7a6fd971f7447",
+ },
+ "hash": "10c4144650e3af1f596683ac4ae7a6fd971f7447",
+ "id": "expoAutolinkingConfig:android",
+ "reasons": [
+ "expoAutolinkingAndroid",
+ ],
+ "type": "contents",
+ },
+ "op": "added",
+ },
+ {
+ "addedSource": {
+ "contents": "{"extraDependencies":[],"coreFeatures":[],"modules":[]}",
+ "debugInfo": {
+ "hash": "10c4144650e3af1f596683ac4ae7a6fd971f7447",
+ },
+ "hash": "10c4144650e3af1f596683ac4ae7a6fd971f7447",
+ "id": "expoAutolinkingConfig:ios",
+ "reasons": [
+ "expoAutolinkingIos",
+ ],
+ "type": "contents",
+ },
+ "op": "added",
+ },
{
"addedSource": {
"contents": "{"android":{"adaptiveIcon":{"backgroundColor":"#FFFFFF","foregroundImage":"./assets/adaptive-icon.png"}},"assetBundlePatterns":["**/*"],"icon":"./assets/icon.png","ios":{"supportsTablet":true},"name":"sdk47","orientation":"portrait","platforms":["android","ios","web"],"slug":"sdk47","splash":{"backgroundColor":"#ffffff","image":"./assets/splash.png","resizeMode":"contain"},"updates":{"fallbackToCacheTimeout":0},"userInterfaceStyle":"light","version":"1.0.0","web":{"favicon":"./assets/favicon.png"}}",
@@ -86,13 +116,58 @@ describe(diffFingerprintChangesAsync, () => {
},
"op": "added",
},
+ {
+ "addedSource": {
+ "contents": "{"setup:docs":"./scripts/download-dependencies.sh","setup:native":"./scripts/download-dependencies.sh && ./scripts/setup-react-android.sh","postinstall":"yarn-deduplicate && yarn workspace @expo/cli prepare && patch-package && node ./tools/bin/expotools.js validate-workspace-dependencies","install:react-native-lab":"(([ \\"$(ls -A react-native-lab/react-native)\\" ] && (yarn --cwd react-native-lab/react-native install --frozen-lockfile || true)) || echo \\"Skipping installing Node modules in react-native-lab/react-native (directory empty)\\")","lint":"eslint .","tsc":"echo 'You are trying to run \\"tsc\\" in the workspace root. Run it from an individual package instead.' && exit 1"}",
+ "debugInfo": {
+ "hash": "c4f835988805180a373d4ff37cef6ce53cb14995",
+ },
+ "hash": "c4f835988805180a373d4ff37cef6ce53cb14995",
+ "id": "packageJson:scripts",
+ "reasons": [
+ "packageJson:scripts",
+ ],
+ "type": "contents",
+ },
+ "op": "added",
+ },
+ {
+ "addedSource": {
+ "contents": "{}",
+ "debugInfo": {
+ "hash": "bf21a9e8fbc5a3846fb05b4fa0859e0917b2202f",
+ },
+ "hash": "bf21a9e8fbc5a3846fb05b4fa0859e0917b2202f",
+ "id": "rncoreAutolinkingConfig:android",
+ "reasons": [
+ "rncoreAutolinkingAndroid",
+ ],
+ "type": "contents",
+ },
+ "op": "added",
+ },
+ {
+ "addedSource": {
+ "contents": "{}",
+ "debugInfo": {
+ "hash": "bf21a9e8fbc5a3846fb05b4fa0859e0917b2202f",
+ },
+ "hash": "bf21a9e8fbc5a3846fb05b4fa0859e0917b2202f",
+ "id": "rncoreAutolinkingConfig:ios",
+ "reasons": [
+ "rncoreAutolinkingIos",
+ ],
+ "type": "contents",
+ },
+ "op": "added",
+ },
]
`);
});
it('should return diff from contents changes', async () => {
vol.fromJSON(require('../sourcer/__tests__/fixtures/ExpoManaged47Project.json'));
- const packageJson = JSON.parse(vol.readFileSync('/app/package.json', 'utf8').toString());
+ const packageJson = JSON.parse(vol.readFileSync('/app/package.json', 'utf8') as string);
jest.doMock('/app/package.json', () => packageJson, { virtual: true });
const fingerprint = await createFingerprintAsync(
'/app',
@@ -158,7 +233,7 @@ describe(diffFingerprintChangesAsync, () => {
'/app',
await normalizeOptionsAsync('/app', { debug: true })
);
- const config = JSON.parse(vol.readFileSync('/app/app.json', 'utf8').toString());
+ const config = JSON.parse(vol.readFileSync('/app/app.json', 'utf8') as string);
config.expo.jsEngine = 'jsc';
vol.writeFileSync('/app/app.json', JSON.stringify(config, null, 2));
const diff = await diffFingerprintChangesAsync(
diff --git a/packages/@expo/fingerprint/src/sourcer/__tests__/Expo-test.ts b/packages/@expo/fingerprint/src/sourcer/__tests__/Expo-test.ts
index af1da632552c14..ebfa8db4b1048e 100644
--- a/packages/@expo/fingerprint/src/sourcer/__tests__/Expo-test.ts
+++ b/packages/@expo/fingerprint/src/sourcer/__tests__/Expo-test.ts
@@ -184,7 +184,7 @@ describe(getExpoConfigSourcesAsync, () => {
it('should contain expo config', async () => {
vol.fromJSON(require('./fixtures/ExpoManaged47Project.json'));
- const appJson = JSON.parse(vol.readFileSync('/app/app.json', 'utf8').toString());
+ const appJson = JSON.parse(vol.readFileSync('/app/app.json', 'utf8') as string);
const options = await normalizeOptionsAsync('/app');
const { config, loadedModules } = await getExpoConfigAsync('/app', options);
const sources = await getExpoConfigSourcesAsync('/app', config, loadedModules, options);
@@ -192,7 +192,7 @@ describe(getExpoConfigSourcesAsync, () => {
(source): source is HashSourceContents =>
source.type === 'contents' && source.id === 'expoConfig'
);
- const expoConfig = JSON.parse(expoConfigSource?.contents?.toString() ?? 'null');
+ const expoConfig = JSON.parse((expoConfigSource?.contents as string) ?? 'null');
expect(expoConfig).not.toBeNull();
expect(expoConfig.name).toEqual(appJson.expo.name);
});
@@ -203,7 +203,7 @@ describe(getExpoConfigSourcesAsync, () => {
const { config, loadedModules } = await getExpoConfigAsync('/app', options);
const sources = await getExpoConfigSourcesAsync('/app', config, loadedModules, options);
- const appJsonContents = vol.readFileSync('/app/app.json', 'utf8').toString();
+ const appJsonContents = vol.readFileSync('/app/app.json', 'utf8') as string;
const appJson = JSON.parse(appJsonContents);
const { name } = appJson.expo;
// Re-insert name to change the object order
@@ -225,7 +225,7 @@ describe(getExpoConfigSourcesAsync, () => {
it('should transform expo config paths as relative paths', async () => {
vol.fromJSON(require('./fixtures/ExpoManaged47Project.json'));
- const appJson = JSON.parse(vol.readFileSync('/app/app.json', 'utf8').toString());
+ const appJson = JSON.parse(vol.readFileSync('/app/app.json', 'utf8') as string);
appJson.expo.extra ||= {};
appJson.expo.extra.testFile = '/app/test-file.txt';
appJson.expo.extra.testNestedFile = '/app/nested/test-file.txt';
@@ -237,7 +237,7 @@ describe(getExpoConfigSourcesAsync, () => {
(source): source is HashSourceContents =>
source.type === 'contents' && source.id === 'expoConfig'
);
- const expoConfig = JSON.parse(expoConfigSource?.contents?.toString() ?? 'null');
+ const expoConfig = JSON.parse((expoConfigSource?.contents as string) ?? 'null');
expect(expoConfig.extra.testFile).toBe('test-file.txt');
expect(expoConfig.extra.testNestedFile).toBe('nested/test-file.txt');
});
@@ -263,7 +263,7 @@ describe(getExpoConfigSourcesAsync, () => {
vol.writeFileSync('/app/assets/icon-light.png', 'PNG data');
vol.writeFileSync('/app/assets/icon-dark.png', 'PNG data');
vol.writeFileSync('/app/assets/icon-tinted.png', 'PNG data');
- const appJson = JSON.parse(vol.readFileSync('/app/app.json', 'utf8').toString());
+ const appJson = JSON.parse(vol.readFileSync('/app/app.json', 'utf8') as string);
appJson.expo.ios ||= {};
appJson.expo.ios.icon = {
light: '/app/assets/icon-light.png',
@@ -299,7 +299,7 @@ describe(getExpoConfigSourcesAsync, () => {
vol.fromJSON(require('./fixtures/ExpoManaged47Project.json'));
vol.mkdirSync('/app/assets');
copyDirSync(path.join(__dirname, 'fixtures', 'ExpoGo.icon'), '/app/assets/ExpoGo.icon');
- const appJson = JSON.parse(vol.readFileSync('/app/app.json', 'utf8').toString());
+ const appJson = JSON.parse(vol.readFileSync('/app/app.json', 'utf8') as string);
appJson.expo.ios ||= {};
appJson.expo.ios.icon = '/app/assets/ExpoGo.icon';
vol.writeFileSync('/app/app.json', JSON.stringify(appJson, null, 2));
@@ -319,7 +319,7 @@ describe(getExpoConfigSourcesAsync, () => {
it('should contain external google service files with override hash key', async () => {
vol.fromJSON(require('./fixtures/ExpoManaged47Project.json'));
vol.writeFileSync('/app/google-services.json', 'JSON data');
- const appJson = JSON.parse(vol.readFileSync('/app/app.json', 'utf8').toString());
+ const appJson = JSON.parse(vol.readFileSync('/app/app.json', 'utf8') as string);
appJson.expo.android ||= {};
appJson.expo.android.googleServicesFile = '/app/google-services.json';
vol.writeFileSync('/app/app.json', JSON.stringify(appJson, null, 2));
@@ -342,7 +342,7 @@ describe(getExpoConfigSourcesAsync, () => {
vol.writeFileSync('/app/assets/images/splash-icon.png', 'PNG data');
const config = {
- exp: JSON.parse(vol.readFileSync('/app/app.json', 'utf8').toString()).expo,
+ exp: JSON.parse(vol.readFileSync('/app/app.json', 'utf8') as string).expo,
};
const configResult = JSON.stringify({ config, loadedModules: [] });
const mockSpawnWithIpcAsync = spawnWithIpcAsync as jest.MockedFunction<
@@ -435,7 +435,7 @@ describe(`getExpoConfigSourcesAsync - sourceSkips`, () => {
(source): source is HashSourceContents =>
source.type === 'contents' && source.id === 'expoConfig'
);
- const expoConfig = JSON.parse(expoConfigSource?.contents?.toString() ?? 'null');
+ const expoConfig = JSON.parse((expoConfigSource?.contents as string) ?? 'null');
expect(expoConfig).not.toBeNull();
expect(expoConfig.version).toBeUndefined();
expect(expoConfig.android.versionCode).toBeUndefined();
@@ -471,7 +471,7 @@ module.exports = config;
(source): source is HashSourceContents =>
source.type === 'contents' && source.id === 'expoConfig'
);
- const expoConfig = JSON.parse(expoConfigSource?.contents?.toString() ?? 'null');
+ const expoConfig = JSON.parse((expoConfigSource?.contents as string) ?? 'null');
expect(expoConfig).not.toBeNull();
expect(expoConfig.version).toBeUndefined();
expect(expoConfig.android.versionCode).toBeUndefined();
@@ -509,7 +509,7 @@ module.exports = config;
(source): source is HashSourceContents =>
source.type === 'contents' && source.id === 'expoConfig'
);
- const expoConfig = JSON.parse(expoConfigSource?.contents?.toString() ?? 'null');
+ const expoConfig = JSON.parse((expoConfigSource?.contents as string) ?? 'null');
expect(expoConfig).not.toBeNull();
expect(expoConfig.version).toBeUndefined();
expect(expoConfig.android.versionCode).toBeUndefined();
@@ -540,7 +540,7 @@ module.exports = config;
(source): source is HashSourceContents =>
source.type === 'contents' && source.id === 'expoConfig'
);
- const expoConfig = JSON.parse(expoConfigSource?.contents?.toString() ?? 'null');
+ const expoConfig = JSON.parse((expoConfigSource?.contents as string) ?? 'null');
expect(expoConfig).not.toBeNull();
expect(expoConfig.runtimeVersion).toBeUndefined();
expect(expoConfig.android.runtimeVersion).toBeUndefined();
@@ -570,7 +570,7 @@ module.exports = config;
(source): source is HashSourceContents =>
source.type === 'contents' && source.id === 'expoConfig'
);
- const expoConfig = JSON.parse(expoConfigSource?.contents?.toString() ?? 'null');
+ const expoConfig = JSON.parse((expoConfigSource?.contents as string) ?? 'null');
expect(expoConfig).not.toBeNull();
expect(expoConfig.runtimeVersion).toMatchObject({ policy: 'test' });
expect(expoConfig.android.runtimeVersion).toMatchObject({ policy: 'test' });
diff --git a/packages/@expo/package-manager/src/node/__tests__/NpmPackageManager-test.ts b/packages/@expo/package-manager/src/node/__tests__/NpmPackageManager-test.ts
index e6a2ceb6fea0f6..ee0be18cbd6deb 100644
--- a/packages/@expo/package-manager/src/node/__tests__/NpmPackageManager-test.ts
+++ b/packages/@expo/package-manager/src/node/__tests__/NpmPackageManager-test.ts
@@ -263,7 +263,7 @@ describe('NpmPackageManager', () => {
await npm.addAsync(['expo@^46', 'react-native@0.69.3']);
const packageFile = JSON.parse(
- vol.readFileSync(path.join(projectRoot, 'package.json')).toString()
+ vol.readFileSync(path.join(projectRoot, 'package.json'), 'utf8') as string
);
expect(packageFile).toHaveProperty(
@@ -284,7 +284,7 @@ describe('NpmPackageManager', () => {
await npm.addAsync(['expo@^46', 'react-native@0.69.3', 'jest', '--ignore-scripts']);
const packageFile = JSON.parse(
- vol.readFileSync(path.join(projectRoot, 'package.json')).toString()
+ vol.readFileSync(path.join(projectRoot, 'package.json'), 'utf8') as string
);
expect(packageFile).toHaveProperty(
@@ -305,7 +305,7 @@ describe('NpmPackageManager', () => {
await npm.addAsync(['react-native@0.69.3', 'expo@next']);
const packageFile = JSON.parse(
- vol.readFileSync(path.join(projectRoot, 'package.json')).toString()
+ vol.readFileSync(path.join(projectRoot, 'package.json'), 'utf8') as string
);
expect(packageFile).toHaveProperty(
@@ -327,7 +327,7 @@ describe('NpmPackageManager', () => {
await npm.addAsync(['zebra@^1.0.0', 'Alpha@^2.0.0', 'beta@^3.0.0', 'Gamma@^4.0.0']);
const packageFile = JSON.parse(
- vol.readFileSync(path.join(projectRoot, 'package.json')).toString()
+ vol.readFileSync(path.join(projectRoot, 'package.json'), 'utf8') as string
);
const dependencyKeys = Object.keys(packageFile.dependencies);
@@ -384,7 +384,7 @@ describe('NpmPackageManager', () => {
await npm.addDevAsync(['expo@^46', 'react-native@0.69.3']);
const packageFile = JSON.parse(
- vol.readFileSync(path.join(projectRoot, 'package.json')).toString()
+ vol.readFileSync(path.join(projectRoot, 'package.json'), 'utf8') as string
);
expect(packageFile).toHaveProperty(
@@ -405,7 +405,7 @@ describe('NpmPackageManager', () => {
await npm.addDevAsync(['expo@^46', 'react-native@0.69.3', 'jest', '--ignore-scripts']);
const packageFile = JSON.parse(
- vol.readFileSync(path.join(projectRoot, 'package.json')).toString()
+ vol.readFileSync(path.join(projectRoot, 'package.json'), 'utf8') as string
);
expect(packageFile).toHaveProperty(
@@ -426,7 +426,7 @@ describe('NpmPackageManager', () => {
await npm.addDevAsync(['react-native@0.69.3', 'expo@next']);
const packageFile = JSON.parse(
- vol.readFileSync(path.join(projectRoot, 'package.json')).toString()
+ vol.readFileSync(path.join(projectRoot, 'package.json'), 'utf8') as string
);
expect(packageFile).toHaveProperty(
diff --git a/packages/@expo/prebuild-config/src/plugins/unversioned/expo-splash-screen/__tests__/withAndroidSplashLegacyMainActivity-test.ts b/packages/@expo/prebuild-config/src/plugins/unversioned/expo-splash-screen/__tests__/withAndroidSplashLegacyMainActivity-test.ts
index edbcea2fa9eb34..9eaaa5e6efcfff 100644
--- a/packages/@expo/prebuild-config/src/plugins/unversioned/expo-splash-screen/__tests__/withAndroidSplashLegacyMainActivity-test.ts
+++ b/packages/@expo/prebuild-config/src/plugins/unversioned/expo-splash-screen/__tests__/withAndroidSplashLegacyMainActivity-test.ts
@@ -28,7 +28,7 @@ describe(setSplashScreenLegacyMainActivity, () => {
},
};
const mainActivity = await AndroidConfig.Paths.getMainActivityAsync('/app');
- let contents = fs.readFileSync(mainActivity.path).toString();
+ let contents = fs.readFileSync(mainActivity.path, 'utf8');
contents = await setSplashScreenLegacyMainActivity(
exp,
{ backgroundColor: '#000020', resizeMode: 'native' },
diff --git a/packages/expo-brownfield/plugin/src/common/filesystem.ts b/packages/expo-brownfield/plugin/src/common/filesystem.ts
index dfbcceaeb05b2d..a1f9762a7c0c0c 100644
--- a/packages/expo-brownfield/plugin/src/common/filesystem.ts
+++ b/packages/expo-brownfield/plugin/src/common/filesystem.ts
@@ -26,13 +26,14 @@ const maybeReadOverwrittenTemplate = (template: string, platform?: PlatformStrin
try {
accessSync(path.join(process.cwd(), '.brownfield-templates'));
if (existsSync(path.join(process.cwd(), '.brownfield-templates', template))) {
- return readFileSync(path.join(process.cwd(), '.brownfield-templates', template)).toString();
+ return readFileSync(path.join(process.cwd(), '.brownfield-templates', template), 'utf8');
}
if (existsSync(path.join(process.cwd(), '.brownfield-templates', platform ?? '.', template))) {
return readFileSync(
- path.join(process.cwd(), '.brownfield-templates', platform ?? '.', template)
- ).toString();
+ path.join(process.cwd(), '.brownfield-templates', platform ?? '.', template),
+ 'utf8'
+ );
}
// eslint-disable-next-line no-empty
} catch {}
@@ -55,7 +56,7 @@ const readTemplate = (template: string, platform?: PlatformString): string => {
throw new Error(`Template ${template} doesn't exist at ${templatePath}`);
}
- return readFileSync(templatePath).toString();
+ return readFileSync(templatePath, 'utf8');
};
const createFileFromTemplateInternal = (
diff --git a/packages/pod-install/src/index.ts b/packages/pod-install/src/index.ts
index 15184c3f113372..56650359e3df6b 100644
--- a/packages/pod-install/src/index.ts
+++ b/packages/pod-install/src/index.ts
@@ -41,7 +41,7 @@ async function runAsync(maybeProjectDirectory?: string): Promise {
process.exit(1);
}
- const jsonData = JSON.parse(readFileSync(packageJsonPath).toString());
+ const jsonData = JSON.parse(readFileSync(packageJsonPath, 'utf8'));
const hasExpoPackage = jsonData.dependencies?.hasOwnProperty('expo');
if (hasExpoPackage) {