Skip to content

Commit

Permalink
fix(app, expo): Use fs/promises in Node 12 compatible way (#5585)
Browse files Browse the repository at this point in the history
Looks like `fs.promises` was introduced even in Node 10: https://nodejs.org/dist/latest-v12.x/docs/api/fs.html#fs_fspromises_copyfile_src_dest_flags

But the import doesn't exist, you have to access the API in a different way
  • Loading branch information
barthap authored Aug 11, 2021
1 parent d4b2015 commit 64f569a
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions packages/app/plugin/src/android/copyGoogleServices.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { ConfigPlugin, withDangerousMod } from '@expo/config-plugins';

import { DEFAULT_TARGET_PATH } from './constants';
import path from 'path';
import fs from 'fs/promises';
import fs from 'fs';

/**
* Copy `google-services.json`
Expand All @@ -24,7 +24,7 @@ export const withCopyAndroidGoogleServices: ConfigPlugin = config => {
const destPath = path.resolve(config.modRequest.platformProjectRoot, DEFAULT_TARGET_PATH);

try {
await fs.copyFile(srcPath, destPath);
await fs.promises.copyFile(srcPath, destPath);
} catch (e) {
throw new Error(
`Cannot copy google-services.json, because the file ${srcPath} doesn't exist. Please provide a valid path in \`app.json\`.`,
Expand Down

1 comment on commit 64f569a

@vercel
Copy link

@vercel vercel bot commented on 64f569a Aug 11, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.