Skip to content

Commit

Permalink
fix: fix link all (#188)
Browse files Browse the repository at this point in the history
Summary:
---------

Fix `linkAll` to link root assets.

@sijad can you test link with those changes?
  • Loading branch information
Esemesek authored and thymikee committed Feb 22, 2019
1 parent 762c1fd commit ec87ccb
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 10 deletions.
2 changes: 1 addition & 1 deletion packages/cli/src/link/link.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ function link([rawPackageName]: Array<string>, ctx: ContextT, opts: FlagsType) {
() => promisify(dependencyConfig.commands.prelink || commandStub),
() => linkDependency(platforms, project, dependencyConfig),
() => promisify(dependencyConfig.commands.postlink || commandStub),
() => linkAssets(platforms, project, dependencyConfig),
() => linkAssets(platforms, project, dependencyConfig.assets),
];

return promiseWaterfall(tasks).catch(err => {
Expand Down
3 changes: 2 additions & 1 deletion packages/cli/src/link/linkAll.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ import promisify from './promisify';
import linkAssets from './linkAssets';
import linkDependency from './linkDependency';

const dedupeAssets = assets => uniqBy(assets, asset => path.basename(asset));
const dedupeAssets = (assets: Array<string>): Array<string> =>
uniqBy(assets, asset => path.basename(asset));

function linkAll(
context: ContextT,
Expand Down
12 changes: 4 additions & 8 deletions packages/cli/src/link/linkAssets.js
Original file line number Diff line number Diff line change
@@ -1,20 +1,16 @@
// @flow

import { isEmpty } from 'lodash';
import type {
PlatformsT,
ProjectConfigT,
DependenciesConfig,
} from '../core/types.flow';
import type { PlatformsT, ProjectConfigT } from '../core/types.flow';

import logger from '../util/logger';

const linkAssets = (
platforms: PlatformsT,
project: ProjectConfigT,
dependency: DependenciesConfig
assets: Array<string>
) => {
if (isEmpty(dependency.assets)) {
if (isEmpty(assets)) {
return;
}

Expand All @@ -30,7 +26,7 @@ const linkAssets = (

logger.info(`Linking assets to ${platform} project`);
// $FlowFixMe: We check for existence of project[platform]
linkConfig.copyAssets(dependency.assets, project[platform]);
linkConfig.copyAssets(assets, project[platform]);
});

logger.info('Assets have been successfully linked to your project');
Expand Down

0 comments on commit ec87ccb

Please sign in to comment.