Skip to content

Commit 07a9761

Browse files
authored
fix: linking assets on Android (#231)
1 parent a79130c commit 07a9761

File tree

3 files changed

+9
-8
lines changed

3 files changed

+9
-8
lines changed

packages/cli/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
"errorhandler": "^1.5.0",
2929
"escape-string-regexp": "^1.0.5",
3030
"execa": "^1.0.0",
31+
"fs-extra": "^7.0.1",
3132
"glob": "^7.1.1",
3233
"graceful-fs": "^4.1.3",
3334
"inquirer": "^3.0.6",

packages/cli/src/commands/link/android/copyAssets.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
* @flow
88
*/
99

10-
import fs from 'fs';
10+
import fs from 'fs-extra';
1111
import path from 'path';
1212
import groupFilesByType from '../groupFilesByType';
1313

@@ -23,10 +23,10 @@ export default function copyAssetsAndroid(
2323
) {
2424
const assets = groupFilesByType(files);
2525

26-
(assets.font || []).forEach(asset =>
27-
fs.copyFileSync(
28-
asset,
29-
path.join(project.assetsPath, 'fonts', path.basename(asset)),
30-
),
31-
);
26+
(assets.font || []).forEach(asset => {
27+
const fontsDir = path.join(project.assetsPath, 'fonts');
28+
// @todo: replace with fs.mkdirSync(path, {recursive}) + fs.copyFileSync
29+
// and get rid of fs-extra once we move to Node 10
30+
fs.copySync(asset, path.join(fontsDir, path.basename(asset)));
31+
});
3232
}

yarn.lock

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3518,7 +3518,7 @@ fs-extra@^1.0.0:
35183518
jsonfile "^2.1.0"
35193519
klaw "^1.0.0"
35203520

3521-
fs-extra@^7.0.0:
3521+
fs-extra@^7.0.0, fs-extra@^7.0.1:
35223522
version "7.0.1"
35233523
resolved "https://registry.yarnpkg.com/fs-extra/-/fs-extra-7.0.1.tgz#4f189c44aa123b895f722804f55ea23eadc348e9"
35243524
integrity sha512-YJDaCJZEnBmcbw13fvdAM9AwNOJwOzrE4pqMqBq5nFiEqXUqHwlK4B+3pUw6JNvfSPtX05xFHtYy/1ni01eGCw==

0 commit comments

Comments
 (0)