From 07a976127d8c758775b16daeacc9fd5f6f3a55ad Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Pierzcha=C5=82a?= Date: Thu, 14 Mar 2019 10:32:34 +0100 Subject: [PATCH] fix: linking assets on Android (#231) --- packages/cli/package.json | 1 + .../cli/src/commands/link/android/copyAssets.js | 14 +++++++------- yarn.lock | 2 +- 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/packages/cli/package.json b/packages/cli/package.json index 55b061976..24a01e2b4 100644 --- a/packages/cli/package.json +++ b/packages/cli/package.json @@ -28,6 +28,7 @@ "errorhandler": "^1.5.0", "escape-string-regexp": "^1.0.5", "execa": "^1.0.0", + "fs-extra": "^7.0.1", "glob": "^7.1.1", "graceful-fs": "^4.1.3", "inquirer": "^3.0.6", diff --git a/packages/cli/src/commands/link/android/copyAssets.js b/packages/cli/src/commands/link/android/copyAssets.js index 81f4ad58a..fb8f124db 100644 --- a/packages/cli/src/commands/link/android/copyAssets.js +++ b/packages/cli/src/commands/link/android/copyAssets.js @@ -7,7 +7,7 @@ * @flow */ -import fs from 'fs'; +import fs from 'fs-extra'; import path from 'path'; import groupFilesByType from '../groupFilesByType'; @@ -23,10 +23,10 @@ export default function copyAssetsAndroid( ) { const assets = groupFilesByType(files); - (assets.font || []).forEach(asset => - fs.copyFileSync( - asset, - path.join(project.assetsPath, 'fonts', path.basename(asset)), - ), - ); + (assets.font || []).forEach(asset => { + const fontsDir = path.join(project.assetsPath, 'fonts'); + // @todo: replace with fs.mkdirSync(path, {recursive}) + fs.copyFileSync + // and get rid of fs-extra once we move to Node 10 + fs.copySync(asset, path.join(fontsDir, path.basename(asset))); + }); } diff --git a/yarn.lock b/yarn.lock index 77823481f..7e951d145 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3518,7 +3518,7 @@ fs-extra@^1.0.0: jsonfile "^2.1.0" klaw "^1.0.0" -fs-extra@^7.0.0: +fs-extra@^7.0.0, fs-extra@^7.0.1: version "7.0.1" resolved "https://registry.yarnpkg.com/fs-extra/-/fs-extra-7.0.1.tgz#4f189c44aa123b895f722804f55ea23eadc348e9" integrity sha512-YJDaCJZEnBmcbw13fvdAM9AwNOJwOzrE4pqMqBq5nFiEqXUqHwlK4B+3pUw6JNvfSPtX05xFHtYy/1ni01eGCw==