Skip to content

Commit

Permalink
chore: remove ui terminal node-pty (#5522)
Browse files Browse the repository at this point in the history
  • Loading branch information
ycjcl868 authored Oct 10, 2020
1 parent f37bbac commit 4d0d5d0
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 79 deletions.
58 changes: 0 additions & 58 deletions packages/umi-ui/client/src/layouts/Footer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import {
QuestionCircleOutlined,
CheckOutlined,
MessageOutlined,
CodeOutlined,
} from '@ant-design/icons';
import { formatMessage } from 'umi-plugin-react/locale';
import cls from 'classnames';
Expand All @@ -19,7 +18,6 @@ import Context from '@/layouts/Context';
import Logs from '@/components/Logs';
import FooterToolbar from './FooterToolbar';
import EditorIcon from '@/components/icons/Editor';
import Shell from '@/components/Shell';
import { states, reducers } from '@/customModels/footer';
import { handleBack } from '@/utils';
import event, { MESSAGES } from '@/message';
Expand Down Expand Up @@ -127,7 +125,6 @@ const Footer: React.SFC<IFooterProps> = props => {

const actionCls = cls(styles.section, styles.action);
const logCls = cls(actionCls, styles.log);
const shellCls = cls(actionCls, styles.shell);

const LocaleText = ({ locale: textLocale, checked, style }) => (
<span style={style}>
Expand Down Expand Up @@ -214,55 +211,6 @@ const Footer: React.SFC<IFooterProps> = props => {
>
<Logs logs={logs} type={type} className={styles['section-drawer-logs']} />
</Drawer>
<Drawer
title={
<FooterToolbar
title={formatMessage({ id: 'org.umi.ui.global.terminal.upperCase' })}
resizeAxis="y"
onResize={size => {
const newHeight = terminalHeight + size.deltaY;
dispatch({
type: 'changeSize',
payload: {
terminalHeight: newHeight,
},
});
if (fitAddon) {
fitAddon.fit();
}
}}
onClose={() => togglePanel('terminal')}
onClear={() => terminal.clear()}
onScrollBottom={() => terminal.scrollToBottom()}
/>
}
getContainer={drawerContainerRef.current}
destroyOnClose={false}
closable={false}
visible={visible.terminal}
placement="bottom"
mask={false}
className={styles['section-drawer']}
height={terminalHeight}
>
{typeof visible.terminal === 'boolean' && (
// init shell socket when open Drawer
<Shell
// style hide / show, not dom
visible={!!visible.terminal}
ref={(ref, fitAddon) =>
dispatch({
type: 'initTerminal',
payload: {
terminal: ref,
fitAddon,
},
})
}
className={styles['section-drawer-shell']}
/>
)}
</Drawer>
</div>
<div className={styles.statusBar}>
<div className={styles['statusBar-left']}>
Expand All @@ -289,12 +237,6 @@ const Footer: React.SFC<IFooterProps> = props => {
<ProfileFilled style={{ marginRight: 4 }} />{' '}
{formatMessage({ id: 'org.umi.ui.global.log' })}
</div>
{projectDashboard && (
<div className={shellCls} onClick={() => togglePanel('terminal')}>
<CodeOutlined style={{ marginRight: 4 }} />{' '}
{formatMessage({ id: 'org.umi.ui.global.terminal' })}
</div>
)}
</div>

{!!key && (
Expand Down
3 changes: 0 additions & 3 deletions packages/umi-ui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,6 @@
"chencheng <sorrycc@gmail.com> (https://github.com/sorrycc)"
],
"license": "MIT",
"optionalDependencies": {
"node-pty": "^0.10.0-beta3"
},
"dependencies": {
"@umijs/launch-editor": "^1.0.0",
"binary-mirror-config": "1.20.3",
Expand Down
18 changes: 0 additions & 18 deletions packages/umi-ui/src/UmiUI.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ import { BackToHomeAction, OpenProjectAction, ReInstallDependencyAction } from '
import { isDepLost, isPluginLost, isUmiProject, isUsingBigfish, isUsingUmi } from './checkProject';
import getScripts from './scripts';
import isDepFileExists from './utils/isDepFileExists';
import initTerminal, { resizeTerminal } from './terminal';
import detectLanguage from './detectLanguage';
import detectNpmClients from './detectNpmClients';
import debug, { debugSocket } from './debug';
Expand Down Expand Up @@ -849,22 +848,6 @@ export default class UmiUI {
);
}

/**
* Terminal shell resize server
*/
app.get('/terminal/resize', async (req, res) => {
const rows = parseInt(req.query.rows || 30);
const cols = parseInt(req.query.cols || 180);
try {
resizeTerminal({ rows, cols });
res.send({
success: true,
rows,
cols,
});
} catch (_) {}
});

app.get('/', async (req, res) => {
const isMini = 'mini' in req.query;
debug('isMini', isMini);
Expand Down Expand Up @@ -1080,7 +1063,6 @@ export default class UmiUI {
prefix: '/umiui',
log: () => {},
});
initTerminal.call(this, server);
this.socketServer = ss;
this.server = server;
});
Expand Down

0 comments on commit 4d0d5d0

Please sign in to comment.