Skip to content

Commit

Permalink
move typings into a separate directory
Browse files Browse the repository at this point in the history
  • Loading branch information
LabhanshAgrawal committed Jul 25, 2023
1 parent 33f7d2b commit c62ed62
Show file tree
Hide file tree
Showing 56 changed files with 87 additions and 78 deletions.
2 changes: 1 addition & 1 deletion app/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import {_import, getDefaultConfig} from './config/import';
import _openConfig from './config/open';
import {cfgPath, cfgDir} from './config/paths';
import {getColorMap} from './utils/colors';
import type {parsedConfig, configOptions} from '../lib/config';
import type {parsedConfig, configOptions} from '../typings/config';
import {app} from 'electron';

const watchers: Function[] = [];
Expand Down
2 changes: 1 addition & 1 deletion app/config/import.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import {readFileSync, mkdirpSync} from 'fs-extra';
import {defaultCfg, cfgPath, plugs, defaultPlatformKeyPath} from './paths';
import {_init} from './init';
import notify from '../notify';
import type {rawConfig} from '../../lib/config';
import type {rawConfig} from '../../typings/config';
import {migrateHyper3Config} from './migrate';

let defaultConfig: rawConfig;
Expand Down
2 changes: 1 addition & 1 deletion app/config/init.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import vm from 'vm';
import notify from '../notify';
import mapKeys from '../utils/map-keys';
import type {parsedConfig, rawConfig, configOptions} from '../../lib/config';
import type {parsedConfig, rawConfig, configOptions} from '../../typings/config';
import merge from 'lodash/merge';

const _extract = (script?: vm.Script): Record<string, any> => {
Expand Down
1 change: 0 additions & 1 deletion app/index.d.ts

This file was deleted.

4 changes: 2 additions & 2 deletions app/plugins.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@ import {availableExtensions} from './plugins/extensions';
import {install} from './plugins/install';
import {plugs} from './config/paths';
import mapKeys from './utils/map-keys';
import type {configOptions} from '../lib/config';
import type {configOptions} from '../typings/config';
import {promisify} from 'util';
import {exec, execFile} from 'child_process';
import type {IpcMainWithCommands} from '../common';
import type {IpcMainWithCommands} from '../typings/common';

// local storage
const cache = new Config();
Expand Down
2 changes: 1 addition & 1 deletion app/rpc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import {EventEmitter} from 'events';
import type {BrowserWindow, IpcMainEvent} from 'electron';
import {ipcMain} from 'electron';
import {v4 as uuidv4} from 'uuid';
import type {TypedEmitter, MainEvents, RendererEvents, FilterNever} from '../common';
import type {TypedEmitter, MainEvents, RendererEvents, FilterNever} from '../typings/common';

export class Server {
emitter: TypedEmitter<MainEvents>;
Expand Down
4 changes: 3 additions & 1 deletion app/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
},
"include": [
"./**/*",
"./package.json"
"./package.json",
"../typings/extend-electron.d.ts",
"../typings/ext-modules.d.ts"
]
}
4 changes: 2 additions & 2 deletions app/ui/window.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@ import {execCommand} from '../commands';
import {setRendererType, unsetRendererType} from '../utils/renderer-utils';
import {decorateSessionOptions, decorateSessionClass} from '../plugins';
import {enable as remoteEnable} from '@electron/remote/main';
import type {configOptions} from '../../lib/config';
import type {configOptions} from '../../typings/config';
import {getWorkingDirectoryFromPID} from 'native-process-working-directory';
import {existsSync} from 'fs';
import type {sessionExtraOptions} from '../../common';
import type {sessionExtraOptions} from '../../typings/common';
import {getDefaultProfile} from '../config';

export function newWindow(
Expand Down
4 changes: 2 additions & 2 deletions lib/actions/config.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import {CONFIG_LOAD, CONFIG_RELOAD} from '../constants/config';
import type {HyperActions} from '../hyper';
import type {configOptions} from '../config';
import type {HyperActions} from '../../typings/hyper';
import type {configOptions} from '../../typings/config';

export function loadConfig(config: configOptions): HyperActions {
return {
Expand Down
2 changes: 1 addition & 1 deletion lib/actions/header.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import {
} from '../constants/ui';
import rpc from '../rpc';
import {userExitTermGroup, setActiveGroup} from './term-groups';
import type {HyperDispatch} from '../hyper';
import type {HyperDispatch} from '../../typings/hyper';

export function closeTab(uid: string) {
return (dispatch: HyperDispatch) => {
Expand Down
2 changes: 1 addition & 1 deletion lib/actions/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import rpc from '../rpc';
import {INIT} from '../constants';
import type {HyperDispatch} from '../hyper';
import type {HyperDispatch} from '../../typings/hyper';

export default function init() {
return (dispatch: HyperDispatch) => {
Expand Down
2 changes: 1 addition & 1 deletion lib/actions/notifications.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import {NOTIFICATION_MESSAGE, NOTIFICATION_DISMISS} from '../constants/notifications';
import type {HyperActions} from '../hyper';
import type {HyperActions} from '../../typings/hyper';

export function dismissNotification(id: string): HyperActions {
return {
Expand Down
4 changes: 2 additions & 2 deletions lib/actions/sessions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ import {
SESSION_SET_XTERM_TITLE,
SESSION_SEARCH
} from '../constants/sessions';
import type {HyperState, HyperDispatch, HyperActions} from '../hyper';
import type {Session} from '../../common';
import type {HyperState, HyperDispatch, HyperActions} from '../../typings/hyper';
import type {Session} from '../../typings/common';

export function addSession({uid, shell, pid, cols = null, rows = null, splitDirection, activeUid, profile}: Session) {
return (dispatch: HyperDispatch, getState: () => HyperState) => {
Expand Down
2 changes: 1 addition & 1 deletion lib/actions/term-groups.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import {SESSION_REQUEST} from '../constants/sessions';
import findBySession from '../utils/term-groups';
import {getRootGroups} from '../selectors';
import {setActiveSession, ptyExitSession, userExitSession} from './sessions';
import type {ITermState, ITermGroup, HyperState, HyperDispatch, HyperActions} from '../hyper';
import type {ITermState, ITermGroup, HyperState, HyperDispatch, HyperActions} from '../../typings/hyper';

function requestSplit(direction: 'VERTICAL' | 'HORIZONTAL') {
return (_activeUid: string | undefined, _profile: string | undefined) =>
Expand Down
2 changes: 1 addition & 1 deletion lib/actions/ui.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ import {

import {setActiveGroup} from './term-groups';
import type parseUrl from 'parse-url';
import type {HyperState, HyperDispatch, HyperActions, ITermGroups} from '../hyper';
import type {HyperState, HyperDispatch, HyperActions, ITermGroups} from '../../typings/hyper';
import type {Stats} from 'fs';
import {stat} from 'fs';

Expand Down
2 changes: 1 addition & 1 deletion lib/actions/updater.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import {UPDATE_INSTALL, UPDATE_AVAILABLE} from '../constants/updater';
import rpc from '../rpc';
import type {HyperActions} from '../hyper';
import type {HyperActions} from '../../typings/hyper';

export function installUpdate(): HyperActions {
return {
Expand Down
2 changes: 1 addition & 1 deletion lib/command-registry.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import {ipcRenderer} from './utils/ipc';
import type {HyperDispatch} from './hyper';
import type {HyperDispatch} from '../typings/hyper';
import {closeSearch} from './actions/sessions';

let commands: Record<string, (event: any, dispatch: HyperDispatch) => void> = {
Expand Down
2 changes: 1 addition & 1 deletion lib/components/header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import React from 'react';
import {decorate, getTabsProps} from '../utils/plugins';

import Tabs_ from './tabs';
import type {HeaderProps} from '../hyper';
import type {HeaderProps} from '../../typings/hyper';

const Tabs = decorate(Tabs_, 'Tabs');

Expand Down
2 changes: 1 addition & 1 deletion lib/components/new-tab.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React, {useRef, useState} from 'react';
import {VscChevronDown} from '@react-icons/all-files/vsc/VscChevronDown';
import type {configOptions} from '../config';
import type {configOptions} from '../../typings/config';
import useClickAway from 'react-use/lib/useClickAway';

interface Props {
Expand Down
2 changes: 1 addition & 1 deletion lib/components/notification.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React, {forwardRef, useEffect, useRef, useState} from 'react';
import type {NotificationProps} from '../hyper';
import type {NotificationProps} from '../../typings/hyper';

const Notification = forwardRef<HTMLDivElement, React.PropsWithChildren<NotificationProps>>((props, ref) => {
const dismissTimer = useRef<NodeJS.Timeout | undefined>(undefined);
Expand Down
2 changes: 1 addition & 1 deletion lib/components/notifications.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import React, {forwardRef} from 'react';
import {decorate} from '../utils/plugins';

import Notification_ from './notification';
import type {NotificationsProps} from '../hyper';
import type {NotificationsProps} from '../../typings/hyper';

const Notification = decorate(Notification_, 'Notification');

Expand Down
2 changes: 1 addition & 1 deletion lib/components/searchBox.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React, {useCallback, useRef, useEffect, forwardRef} from 'react';
import type {SearchBoxProps} from '../hyper';
import type {SearchBoxProps} from '../../typings/hyper';
import {VscArrowUp} from '@react-icons/all-files/vsc/VscArrowUp';
import {VscArrowDown} from '@react-icons/all-files/vsc/VscArrowDown';
import {VscClose} from '@react-icons/all-files/vsc/VscClose';
Expand Down
2 changes: 1 addition & 1 deletion lib/components/split-pane.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from 'react';
import sum from 'lodash/sum';
import type {SplitPaneProps} from '../hyper';
import type {SplitPaneProps} from '../../typings/hyper';

export default class SplitPane extends React.PureComponent<
React.PropsWithChildren<SplitPaneProps>,
Expand Down
2 changes: 1 addition & 1 deletion lib/components/style-sheet.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React, {forwardRef} from 'react';
import type {StyleSheetProps} from '../hyper';
import type {StyleSheetProps} from '../../typings/hyper';

const StyleSheet = forwardRef<HTMLStyleElement, StyleSheetProps>((props, ref) => {
const {borderColor} = props;
Expand Down
2 changes: 1 addition & 1 deletion lib/components/tab.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React, {forwardRef} from 'react';
import type {TabProps} from '../hyper';
import type {TabProps} from '../../typings/hyper';

const Tab = forwardRef<HTMLLIElement, TabProps>((props, ref) => {
const handleClick = (event: React.MouseEvent) => {
Expand Down
2 changes: 1 addition & 1 deletion lib/components/tabs.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import React, {forwardRef} from 'react';
import {decorate, getTabProps} from '../utils/plugins';

import Tab_ from './tab';
import type {TabsProps} from '../hyper';
import type {TabsProps} from '../../typings/hyper';
import DropdownButton from './new-tab';

const Tab = decorate(Tab_, 'Tab');
Expand Down
2 changes: 1 addition & 1 deletion lib/components/term-group.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import {decorate, getTermProps, getTermGroupProps} from '../utils/plugins';
import {resizeTermGroup} from '../actions/term-groups';
import Term_ from './term';
import SplitPane_ from './split-pane';
import type {HyperState, HyperDispatch, TermGroupProps, TermGroupOwnProps} from '../hyper';
import type {HyperState, HyperDispatch, TermGroupProps, TermGroupOwnProps} from '../../typings/hyper';

const Term = decorate(Term_, 'Term');
const SplitPane = decorate(SplitPane_, 'SplitPane');
Expand Down
2 changes: 1 addition & 1 deletion lib/components/term.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import Color from 'color';
import terms from '../terms';
import processClipboard from '../utils/paste';
import _SearchBox from './searchBox';
import type {TermProps} from '../hyper';
import type {TermProps} from '../../typings/hyper';
import pickBy from 'lodash/pickBy';
import isEqual from 'lodash/isEqual';
import {decorate} from '../utils/plugins';
Expand Down
2 changes: 1 addition & 1 deletion lib/components/terms.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import {decorate, getTermGroupProps} from '../utils/plugins';
import {registerCommandHandlers} from '../command-registry';
import TermGroup_ from './term-group';
import StyleSheet_ from './style-sheet';
import type {TermsProps, HyperDispatch} from '../hyper';
import type {TermsProps, HyperDispatch} from '../../typings/hyper';
import type Term from './term';
import {ObjectTypedKeys} from '../utils/object';

Expand Down
2 changes: 1 addition & 1 deletion lib/constants/config.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type {configOptions} from '../config';
import type {configOptions} from '../../typings/config';

export const CONFIG_LOAD = 'CONFIG_LOAD';
export const CONFIG_RELOAD = 'CONFIG_RELOAD';
Expand Down
2 changes: 1 addition & 1 deletion lib/containers/header.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import Header from '../components/header';
import {closeTab, changeTab, maximize, openHamburgerMenu, unmaximize, minimize, close} from '../actions/header';
import {connect} from '../utils/plugins';
import {getRootGroups} from '../selectors';
import type {HyperState, HyperDispatch, ITab} from '../hyper';
import type {HyperState, HyperDispatch, ITab} from '../../typings/hyper';
import {requestTermGroup} from '../actions/term-groups';

const isMac = /Mac/.test(navigator.userAgent);
Expand Down
2 changes: 1 addition & 1 deletion lib/containers/hyper.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import stylis from 'stylis';
import {HeaderContainer} from './header';
import TermsContainer from './terms';
import NotificationsContainer from './notifications';
import type {HyperState, HyperProps, HyperDispatch} from '../hyper';
import type {HyperState, HyperProps, HyperDispatch} from '../../typings/hyper';
import type Terms from '../components/terms';

const isMac = /Mac/.test(navigator.userAgent);
Expand Down
2 changes: 1 addition & 1 deletion lib/containers/notifications.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import Notifications from '../components/notifications';
import {installUpdate} from '../actions/updater';
import {connect} from '../utils/plugins';
import {dismissNotification} from '../actions/notifications';
import type {HyperState, HyperDispatch} from '../hyper';
import type {HyperState, HyperDispatch} from '../../typings/hyper';

const mapStateToProps = (state: HyperState) => {
const {ui} = state;
Expand Down
2 changes: 1 addition & 1 deletion lib/containers/terms.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import {

import {openContextMenu} from '../actions/ui';
import {getRootGroups} from '../selectors';
import type {HyperState, HyperDispatch} from '../hyper';
import type {HyperState, HyperDispatch} from '../../typings/hyper';

const mapStateToProps = (state: HyperState) => {
const {sessions} = state.sessions;
Expand Down
3 changes: 0 additions & 3 deletions lib/ext-modules.d.ts

This file was deleted.

2 changes: 1 addition & 1 deletion lib/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import {addNotificationMessage} from './actions/notifications';
import {loadConfig, reloadConfig} from './actions/config';
import HyperContainer from './containers/hyper';
import configureStore from './store/configure-store';
import type {configOptions} from './config';
import type {configOptions} from '../typings/config';

// On Linux, the default zoom was somehow changed with Electron 3 (or maybe 2).
// Setting zoom factor to 1.2 brings back the normal default size
Expand Down
2 changes: 1 addition & 1 deletion lib/reducers/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import {combineReducers} from 'redux';
import ui from './ui';
import sessions from './sessions';
import termGroups from './term-groups';
import type {HyperActions, HyperState} from '../hyper';
import type {HyperActions, HyperState} from '../../typings/hyper';

export default combineReducers({
ui,
Expand Down
2 changes: 1 addition & 1 deletion lib/reducers/sessions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import {
SESSION_SET_CWD,
SESSION_SEARCH
} from '../constants/sessions';
import type {sessionState, session, Mutable, ISessionReducer} from '../hyper';
import type {sessionState, session, Mutable, ISessionReducer} from '../../typings/hyper';

const initialState: sessionState = Immutable<Mutable<sessionState>>({
sessions: {},
Expand Down
2 changes: 1 addition & 1 deletion lib/reducers/term-groups.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import type {SessionAddAction} from '../constants/sessions';
import {SESSION_ADD, SESSION_SET_ACTIVE} from '../constants/sessions';
import findBySession from '../utils/term-groups';
import {decorateTermGroupsReducer} from '../utils/plugins';
import type {ITermGroup, ITermState, ITermGroups, ITermGroupReducer, Mutable} from '../hyper';
import type {ITermGroup, ITermState, ITermGroups, ITermGroupReducer, Mutable} from '../../typings/hyper';

const MIN_SIZE = 0.05;
const initialState: ITermState = Immutable<Mutable<ITermState>>({
Expand Down
2 changes: 1 addition & 1 deletion lib/reducers/ui.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import {
SESSION_SET_CWD
} from '../constants/sessions';
import {UPDATE_AVAILABLE} from '../constants/updater';
import type {uiState, Mutable, IUiReducer} from '../hyper';
import type {uiState, Mutable, IUiReducer} from '../../typings/hyper';
import {release} from 'os';

const isWindows = ['Windows', 'Win16', 'Win32', 'WinCE'].includes(navigator.platform) || process.platform === 'win32';
Expand Down
2 changes: 1 addition & 1 deletion lib/selectors.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import {createSelector} from 'reselect';
import type {HyperState} from './hyper';
import type {HyperState} from '../typings/hyper';

const getTermGroups = ({termGroups}: Pick<HyperState, 'termGroups'>) => termGroups.termGroups;
export const getRootGroups = createSelector(getTermGroups, (termGroups) =>
Expand Down
2 changes: 1 addition & 1 deletion lib/store/configure-store.dev.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import effects from '../utils/effects';
import * as plugins from '../utils/plugins';
import writeMiddleware from './write-middleware';
import {composeWithDevTools} from '@redux-devtools/extension';
import type {HyperState, HyperActions} from '../hyper';
import type {HyperState, HyperActions} from '../../typings/hyper';
const thunk: ThunkMiddleware<HyperState, HyperActions> = _thunk;

export default () => {
Expand Down
2 changes: 1 addition & 1 deletion lib/store/configure-store.prod.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import rootReducer from '../reducers/index';
import effects from '../utils/effects';
import * as plugins from '../utils/plugins';
import writeMiddleware from './write-middleware';
import type {HyperState, HyperActions} from '../hyper';
import type {HyperState, HyperActions} from '../../typings/hyper';
const thunk: ThunkMiddleware<HyperState, HyperActions> = _thunk;

export default () =>
Expand Down
2 changes: 1 addition & 1 deletion lib/store/write-middleware.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type {HyperActions, HyperState} from '../hyper';
import type {HyperActions, HyperState} from '../../typings/hyper';
import terms from '../terms';
import type {Dispatch, Middleware} from 'redux';

Expand Down
2 changes: 1 addition & 1 deletion lib/utils/effects.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type {Dispatch, Middleware} from 'redux';
import type {HyperActions, HyperState} from '../hyper';
import type {HyperActions, HyperState} from '../../typings/hyper';
/**
* Simple redux middleware that executes
* the `effect` field if provided in an action
Expand Down
2 changes: 1 addition & 1 deletion lib/utils/ipc.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {ipcRenderer as _ipc} from 'electron';
import type {IpcRendererWithCommands} from '../../common';
import type {IpcRendererWithCommands} from '../../typings/common';

export const ipcRenderer = _ipc as IpcRendererWithCommands;
2 changes: 1 addition & 1 deletion lib/utils/plugins.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ import type {
TermProps,
Assignable,
HyperActions
} from '../hyper';
} from '../../typings/hyper';
import type {Dispatch, Middleware} from 'redux';
import {ObjectTypedKeys} from './object';
import IPCChildProcess from './ipc-child-process';
Expand Down
Loading

0 comments on commit c62ed62

Please sign in to comment.