Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: fix link all #188

Merged
merged 2 commits into from
Feb 22, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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