Summary: Here I'm changing plugin repository structure to allow re-using of shared packages between both public and fb-internal plugins, and to ensure that public plugins has their own yarn.lock as this will be required to implement reproducible jobs checking plugin compatibility with released flipper versions. Please note that there are a lot of moved files in this diff, make sure to click "Expand all" to see all that actually changed (there are not much of them actually). New proposed structure for plugin packages: ``` - root - node_modules - modules included into Flipper: flipper, flipper-plugin, react, antd, emotion -- plugins --- node_modules - modules used by both public and fb-internal plugins (shared libs will be linked here, see D27034936) --- public ---- node_modules - modules used by public plugins ---- pluginA ----- node_modules - modules used by plugin A exclusively ---- pluginB ----- node_modules - modules used by plugin B exclusively --- fb ---- node_modules - modules used by fb-internal plugins ---- pluginC ----- node_modules - modules used by plugin C exclusively ---- pluginD ----- node_modules - modules used by plugin D exclusively ``` I've moved all public plugins under dir "plugins/public" and excluded them from root yarn workspaces. Instead, they will have their own yarn workspaces config and yarn.lock and they will use flipper modules as peer dependencies. Reviewed By: mweststrate Differential Revision: D27034108 fbshipit-source-id: c2310e3c5bfe7526033f51b46c0ae40199fd7586
109 lines
2.5 KiB
TypeScript
109 lines
2.5 KiB
TypeScript
/**
|
|
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
*
|
|
* This source code is licensed under the MIT license found in the
|
|
* LICENSE file in the root directory of this source tree.
|
|
*
|
|
* @format
|
|
*/
|
|
|
|
import React from 'react';
|
|
import {styled, FlexColumn, FlexRow, Text, Glyph, colors} from 'flipper';
|
|
|
|
const Container = styled(FlexColumn)({
|
|
height: '100%',
|
|
width: '100%',
|
|
justifyContent: 'center',
|
|
alignItems: 'center',
|
|
backgroundColor: colors.light02,
|
|
});
|
|
|
|
const Welcome = styled(FlexColumn)({
|
|
width: 460,
|
|
background: colors.white,
|
|
borderRadius: 10,
|
|
boxShadow: '0 1px 3px rgba(0,0,0,0.25)',
|
|
overflow: 'hidden',
|
|
transition: '0.6s all ease-out',
|
|
});
|
|
|
|
const Title = styled(Text)({
|
|
fontSize: 24,
|
|
fontWeight: 300,
|
|
textAlign: 'center',
|
|
color: colors.light50,
|
|
marginTop: 16,
|
|
marginBottom: 16,
|
|
});
|
|
|
|
const Item = styled(FlexRow)({
|
|
padding: 10,
|
|
alignItems: 'center',
|
|
borderTop: `1px solid ${colors.light10}`,
|
|
});
|
|
|
|
const ItemTitle = styled(Text)({
|
|
color: colors.light50,
|
|
fontSize: 14,
|
|
lineHeight: '20px',
|
|
});
|
|
|
|
const Bold = styled(Text)({
|
|
fontWeight: 600,
|
|
});
|
|
|
|
const Icon = styled(Glyph)({
|
|
marginRight: 11,
|
|
marginLeft: 6,
|
|
});
|
|
|
|
// As more known failures are found, add them to this list with better error information.
|
|
const KNOWN_FAILURE_MESSAGES: Record<
|
|
string,
|
|
Record<'message' | 'hint', string>
|
|
> = {
|
|
'Failed to fetch': {
|
|
// This is the error that is returned specifcally when Metro is turned off.
|
|
message: 'Metro disconnected.',
|
|
hint: 'Please check that metro is running and Flipper can connect to it.',
|
|
},
|
|
default: {
|
|
// All we really know in this case is that we can't connect to metro.
|
|
// Do not try and be more specific here.
|
|
message: 'Cannot connect to Metro.',
|
|
hint: 'Please check that metro is running and Flipper can connect to it.',
|
|
},
|
|
};
|
|
|
|
function getReason(error: Error) {
|
|
let failure_message = KNOWN_FAILURE_MESSAGES.default;
|
|
if (error != null && KNOWN_FAILURE_MESSAGES[error.message]) {
|
|
failure_message = KNOWN_FAILURE_MESSAGES[error.message];
|
|
}
|
|
|
|
return (
|
|
<ItemTitle>
|
|
<Bold>{failure_message.message} </Bold>
|
|
{failure_message.hint}
|
|
</ItemTitle>
|
|
);
|
|
}
|
|
|
|
type Props = Readonly<{
|
|
error: Error;
|
|
}>;
|
|
|
|
export default function ErrorScreen(props: Props) {
|
|
return (
|
|
<Container>
|
|
<Welcome>
|
|
<Title>Hermes Debugger Error</Title>
|
|
<Item>
|
|
<Icon size={20} name="caution-octagon" color={colors.red} />
|
|
<FlexColumn>{getReason(props.error)}</FlexColumn>
|
|
</Item>
|
|
</Welcome>
|
|
</Container>
|
|
);
|
|
}
|