mirror of
https://github.com/quine-global/hyper.git
synced 2026-01-12 20:18:41 -09:00
fix prettier errors
This commit is contained in:
parent
d2d31e346a
commit
41b1ac1852
39 changed files with 150 additions and 153 deletions
|
|
@ -8,41 +8,41 @@ const commands: Record<string, (focusedWindow?: BrowserWindow) => void> = {
|
||||||
// If window is created on the same tick, it will consume event too
|
// If window is created on the same tick, it will consume event too
|
||||||
setTimeout(app.createWindow, 0);
|
setTimeout(app.createWindow, 0);
|
||||||
},
|
},
|
||||||
'tab:new': focusedWindow => {
|
'tab:new': (focusedWindow) => {
|
||||||
if (focusedWindow) {
|
if (focusedWindow) {
|
||||||
focusedWindow.rpc.emit('termgroup add req', {});
|
focusedWindow.rpc.emit('termgroup add req', {});
|
||||||
} else {
|
} else {
|
||||||
setTimeout(app.createWindow, 0);
|
setTimeout(app.createWindow, 0);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
'pane:splitRight': focusedWindow => {
|
'pane:splitRight': (focusedWindow) => {
|
||||||
focusedWindow && focusedWindow.rpc.emit('split request vertical', {});
|
focusedWindow && focusedWindow.rpc.emit('split request vertical', {});
|
||||||
},
|
},
|
||||||
'pane:splitDown': focusedWindow => {
|
'pane:splitDown': (focusedWindow) => {
|
||||||
focusedWindow && focusedWindow.rpc.emit('split request horizontal', {});
|
focusedWindow && focusedWindow.rpc.emit('split request horizontal', {});
|
||||||
},
|
},
|
||||||
'pane:close': focusedWindow => {
|
'pane:close': (focusedWindow) => {
|
||||||
focusedWindow && focusedWindow.rpc.emit('termgroup close req');
|
focusedWindow && focusedWindow.rpc.emit('termgroup close req');
|
||||||
},
|
},
|
||||||
'window:preferences': () => {
|
'window:preferences': () => {
|
||||||
openConfig();
|
openConfig();
|
||||||
},
|
},
|
||||||
'editor:clearBuffer': focusedWindow => {
|
'editor:clearBuffer': (focusedWindow) => {
|
||||||
focusedWindow && focusedWindow.rpc.emit('session clear req');
|
focusedWindow && focusedWindow.rpc.emit('session clear req');
|
||||||
},
|
},
|
||||||
'editor:selectAll': focusedWindow => {
|
'editor:selectAll': (focusedWindow) => {
|
||||||
focusedWindow && focusedWindow.rpc.emit('term selectAll');
|
focusedWindow && focusedWindow.rpc.emit('term selectAll');
|
||||||
},
|
},
|
||||||
'plugins:update': () => {
|
'plugins:update': () => {
|
||||||
updatePlugins();
|
updatePlugins();
|
||||||
},
|
},
|
||||||
'window:reload': focusedWindow => {
|
'window:reload': (focusedWindow) => {
|
||||||
focusedWindow && focusedWindow.rpc.emit('reload');
|
focusedWindow && focusedWindow.rpc.emit('reload');
|
||||||
},
|
},
|
||||||
'window:reloadFull': focusedWindow => {
|
'window:reloadFull': (focusedWindow) => {
|
||||||
focusedWindow && focusedWindow.reload();
|
focusedWindow && focusedWindow.reload();
|
||||||
},
|
},
|
||||||
'window:devtools': focusedWindow => {
|
'window:devtools': (focusedWindow) => {
|
||||||
if (!focusedWindow) {
|
if (!focusedWindow) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
@ -53,58 +53,58 @@ const commands: Record<string, (focusedWindow?: BrowserWindow) => void> = {
|
||||||
webContents.openDevTools({mode: 'detach'});
|
webContents.openDevTools({mode: 'detach'});
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
'zoom:reset': focusedWindow => {
|
'zoom:reset': (focusedWindow) => {
|
||||||
focusedWindow && focusedWindow.rpc.emit('reset fontSize req');
|
focusedWindow && focusedWindow.rpc.emit('reset fontSize req');
|
||||||
},
|
},
|
||||||
'zoom:in': focusedWindow => {
|
'zoom:in': (focusedWindow) => {
|
||||||
focusedWindow && focusedWindow.rpc.emit('increase fontSize req');
|
focusedWindow && focusedWindow.rpc.emit('increase fontSize req');
|
||||||
},
|
},
|
||||||
'zoom:out': focusedWindow => {
|
'zoom:out': (focusedWindow) => {
|
||||||
focusedWindow && focusedWindow.rpc.emit('decrease fontSize req');
|
focusedWindow && focusedWindow.rpc.emit('decrease fontSize req');
|
||||||
},
|
},
|
||||||
'tab:prev': focusedWindow => {
|
'tab:prev': (focusedWindow) => {
|
||||||
focusedWindow && focusedWindow.rpc.emit('move left req');
|
focusedWindow && focusedWindow.rpc.emit('move left req');
|
||||||
},
|
},
|
||||||
'tab:next': focusedWindow => {
|
'tab:next': (focusedWindow) => {
|
||||||
focusedWindow && focusedWindow.rpc.emit('move right req');
|
focusedWindow && focusedWindow.rpc.emit('move right req');
|
||||||
},
|
},
|
||||||
'pane:prev': focusedWindow => {
|
'pane:prev': (focusedWindow) => {
|
||||||
focusedWindow && focusedWindow.rpc.emit('prev pane req');
|
focusedWindow && focusedWindow.rpc.emit('prev pane req');
|
||||||
},
|
},
|
||||||
'pane:next': focusedWindow => {
|
'pane:next': (focusedWindow) => {
|
||||||
focusedWindow && focusedWindow.rpc.emit('next pane req');
|
focusedWindow && focusedWindow.rpc.emit('next pane req');
|
||||||
},
|
},
|
||||||
'editor:movePreviousWord': focusedWindow => {
|
'editor:movePreviousWord': (focusedWindow) => {
|
||||||
focusedWindow && focusedWindow.rpc.emit('session move word left req');
|
focusedWindow && focusedWindow.rpc.emit('session move word left req');
|
||||||
},
|
},
|
||||||
'editor:moveNextWord': focusedWindow => {
|
'editor:moveNextWord': (focusedWindow) => {
|
||||||
focusedWindow && focusedWindow.rpc.emit('session move word right req');
|
focusedWindow && focusedWindow.rpc.emit('session move word right req');
|
||||||
},
|
},
|
||||||
'editor:moveBeginningLine': focusedWindow => {
|
'editor:moveBeginningLine': (focusedWindow) => {
|
||||||
focusedWindow && focusedWindow.rpc.emit('session move line beginning req');
|
focusedWindow && focusedWindow.rpc.emit('session move line beginning req');
|
||||||
},
|
},
|
||||||
'editor:moveEndLine': focusedWindow => {
|
'editor:moveEndLine': (focusedWindow) => {
|
||||||
focusedWindow && focusedWindow.rpc.emit('session move line end req');
|
focusedWindow && focusedWindow.rpc.emit('session move line end req');
|
||||||
},
|
},
|
||||||
'editor:deletePreviousWord': focusedWindow => {
|
'editor:deletePreviousWord': (focusedWindow) => {
|
||||||
focusedWindow && focusedWindow.rpc.emit('session del word left req');
|
focusedWindow && focusedWindow.rpc.emit('session del word left req');
|
||||||
},
|
},
|
||||||
'editor:deleteNextWord': focusedWindow => {
|
'editor:deleteNextWord': (focusedWindow) => {
|
||||||
focusedWindow && focusedWindow.rpc.emit('session del word right req');
|
focusedWindow && focusedWindow.rpc.emit('session del word right req');
|
||||||
},
|
},
|
||||||
'editor:deleteBeginningLine': focusedWindow => {
|
'editor:deleteBeginningLine': (focusedWindow) => {
|
||||||
focusedWindow && focusedWindow.rpc.emit('session del line beginning req');
|
focusedWindow && focusedWindow.rpc.emit('session del line beginning req');
|
||||||
},
|
},
|
||||||
'editor:deleteEndLine': focusedWindow => {
|
'editor:deleteEndLine': (focusedWindow) => {
|
||||||
focusedWindow && focusedWindow.rpc.emit('session del line end req');
|
focusedWindow && focusedWindow.rpc.emit('session del line end req');
|
||||||
},
|
},
|
||||||
'editor:break': focusedWindow => {
|
'editor:break': (focusedWindow) => {
|
||||||
focusedWindow && focusedWindow.rpc.emit('session break req');
|
focusedWindow && focusedWindow.rpc.emit('session break req');
|
||||||
},
|
},
|
||||||
'editor:search': focusedWindow => {
|
'editor:search': (focusedWindow) => {
|
||||||
focusedWindow && focusedWindow.rpc.emit('session search');
|
focusedWindow && focusedWindow.rpc.emit('session search');
|
||||||
},
|
},
|
||||||
'editor:search-close': focusedWindow => {
|
'editor:search-close': (focusedWindow) => {
|
||||||
focusedWindow && focusedWindow.rpc.emit('session search close');
|
focusedWindow && focusedWindow.rpc.emit('session search close');
|
||||||
},
|
},
|
||||||
'cli:install': () => {
|
'cli:install': () => {
|
||||||
|
|
@ -118,9 +118,9 @@ const commands: Record<string, (focusedWindow?: BrowserWindow) => void> = {
|
||||||
};
|
};
|
||||||
|
|
||||||
//Special numeric command
|
//Special numeric command
|
||||||
([1, 2, 3, 4, 5, 6, 7, 8, 'last'] as const).forEach(cmdIndex => {
|
([1, 2, 3, 4, 5, 6, 7, 8, 'last'] as const).forEach((cmdIndex) => {
|
||||||
const index = cmdIndex === 'last' ? cmdIndex : cmdIndex - 1;
|
const index = cmdIndex === 'last' ? cmdIndex : cmdIndex - 1;
|
||||||
commands[`tab:jump:${cmdIndex}`] = focusedWindow => {
|
commands[`tab:jump:${cmdIndex}`] = (focusedWindow) => {
|
||||||
focusedWindow && focusedWindow.rpc.emit('move jump req', index);
|
focusedWindow && focusedWindow.rpc.emit('move jump req', index);
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -13,7 +13,7 @@ let _watcher: fs.FSWatcher;
|
||||||
export const getDeprecatedCSS = (config: Record<string, any>) => {
|
export const getDeprecatedCSS = (config: Record<string, any>) => {
|
||||||
const deprecated: string[] = [];
|
const deprecated: string[] = [];
|
||||||
const deprecatedCSS = ['x-screen', 'x-row', 'cursor-node', '::selection'];
|
const deprecatedCSS = ['x-screen', 'x-row', 'cursor-node', '::selection'];
|
||||||
deprecatedCSS.forEach(css => {
|
deprecatedCSS.forEach((css) => {
|
||||||
if ((config.css && config.css.includes(css)) || (config.termCSS && config.termCSS.includes(css))) {
|
if ((config.css && config.css.includes(css)) || (config.termCSS && config.termCSS.includes(css))) {
|
||||||
deprecated.push(css);
|
deprecated.push(css);
|
||||||
}
|
}
|
||||||
|
|
@ -43,7 +43,7 @@ const _watch = () => {
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
cfg = _import();
|
cfg = _import();
|
||||||
notify('Configuration updated', 'Hyper configuration reloaded!');
|
notify('Configuration updated', 'Hyper configuration reloaded!');
|
||||||
watchers.forEach(fn => fn());
|
watchers.forEach((fn) => fn());
|
||||||
checkDeprecatedConfig();
|
checkDeprecatedConfig();
|
||||||
}, 100);
|
}, 100);
|
||||||
};
|
};
|
||||||
|
|
@ -64,7 +64,7 @@ const _watch = () => {
|
||||||
// macOS/Linux
|
// macOS/Linux
|
||||||
function setWatcher() {
|
function setWatcher() {
|
||||||
try {
|
try {
|
||||||
_watcher = fs.watch(cfgPath, eventType => {
|
_watcher = fs.watch(cfgPath, (eventType) => {
|
||||||
if (eventType === 'rename') {
|
if (eventType === 'rename') {
|
||||||
_watcher.close();
|
_watcher.close();
|
||||||
// Ensure that new file has been written
|
// Ensure that new file has been written
|
||||||
|
|
@ -76,7 +76,7 @@ const _watch = () => {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
_watcher.on('change', onChange);
|
_watcher.on('change', onChange);
|
||||||
_watcher.on('error', error => {
|
_watcher.on('error', (error) => {
|
||||||
console.error('error watching config', error);
|
console.error('error watching config', error);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
@ -140,7 +140,7 @@ export const htermConfigTranslate = (config: Record<string, any>) => {
|
||||||
'x-screen a([ {.[])': '.terminal a$1',
|
'x-screen a([ {.[])': '.terminal a$1',
|
||||||
'x-row a([ {.[])': '.terminal a$1'
|
'x-row a([ {.[])': '.terminal a$1'
|
||||||
};
|
};
|
||||||
Object.keys(cssReplacements).forEach(pattern => {
|
Object.keys(cssReplacements).forEach((pattern) => {
|
||||||
const searchvalue = new RegExp(pattern, 'g');
|
const searchvalue = new RegExp(pattern, 'g');
|
||||||
const newvalue = cssReplacements[pattern];
|
const newvalue = cssReplacements[pattern];
|
||||||
config.css = config.css && config.css.replace(searchvalue, newvalue);
|
config.css = config.css && config.css.replace(searchvalue, newvalue);
|
||||||
|
|
|
||||||
|
|
@ -26,7 +26,7 @@ export default () => {
|
||||||
Registry.closeKey(fileExtsKeys);
|
Registry.closeKey(fileExtsKeys);
|
||||||
|
|
||||||
// Find UserChoice key
|
// Find UserChoice key
|
||||||
const userChoice = keys.find(k => k.endsWith('UserChoice'));
|
const userChoice = keys.find((k) => k.endsWith('UserChoice'));
|
||||||
return userChoice
|
return userChoice
|
||||||
? `Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\FileExts\\.js\\${userChoice}`
|
? `Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\FileExts\\.js\\${userChoice}`
|
||||||
: userChoice;
|
: userChoice;
|
||||||
|
|
@ -44,13 +44,13 @@ export default () => {
|
||||||
// Load key values
|
// Load key values
|
||||||
const userChoiceKey = Registry.openKey(Registry.HKCU, userChoice, Registry.Access.READ)!;
|
const userChoiceKey = Registry.openKey(Registry.HKCU, userChoice, Registry.Access.READ)!;
|
||||||
const values: string[] = Registry.enumValueNames(userChoiceKey).map(
|
const values: string[] = Registry.enumValueNames(userChoiceKey).map(
|
||||||
x => (Registry.queryValue(userChoiceKey, x) as string) || ''
|
(x) => (Registry.queryValue(userChoiceKey, x) as string) || ''
|
||||||
);
|
);
|
||||||
Registry.closeKey(userChoiceKey);
|
Registry.closeKey(userChoiceKey);
|
||||||
|
|
||||||
// Look for default program
|
// Look for default program
|
||||||
const hasDefaultProgramConfigured = values.every(
|
const hasDefaultProgramConfigured = values.every(
|
||||||
value => value && typeof value === 'string' && !value.includes('WScript.exe') && !value.includes('JSFile')
|
(value) => value && typeof value === 'string' && !value.includes('WScript.exe') && !value.includes('JSFile')
|
||||||
);
|
);
|
||||||
|
|
||||||
return hasDefaultProgramConfigured;
|
return hasDefaultProgramConfigured;
|
||||||
|
|
@ -62,21 +62,21 @@ export default () => {
|
||||||
|
|
||||||
// This mimics shell.openItem, true if it worked, false if not.
|
// This mimics shell.openItem, true if it worked, false if not.
|
||||||
const openNotepad = (file: string) =>
|
const openNotepad = (file: string) =>
|
||||||
new Promise<boolean>(resolve => {
|
new Promise<boolean>((resolve) => {
|
||||||
exec(`start notepad.exe ${file}`, error => {
|
exec(`start notepad.exe ${file}`, (error) => {
|
||||||
resolve(!error);
|
resolve(!error);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
return hasDefaultSet()
|
return hasDefaultSet()
|
||||||
.then(yes => {
|
.then((yes) => {
|
||||||
if (yes) {
|
if (yes) {
|
||||||
return shell.openItem(cfgPath);
|
return shell.openItem(cfgPath);
|
||||||
}
|
}
|
||||||
console.warn('No default app set for .js files, using notepad.exe fallback');
|
console.warn('No default app set for .js files, using notepad.exe fallback');
|
||||||
return openNotepad(cfgPath);
|
return openNotepad(cfgPath);
|
||||||
})
|
})
|
||||||
.catch(err => {
|
.catch((err) => {
|
||||||
console.error('Open config with default app error:', err);
|
console.error('Open config with default app error:', err);
|
||||||
return openNotepad(cfgPath);
|
return openNotepad(cfgPath);
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -129,7 +129,7 @@ function installDevExtensions(isDev_: boolean) {
|
||||||
const extensions = ['REACT_DEVELOPER_TOOLS', 'REDUX_DEVTOOLS'] as const;
|
const extensions = ['REACT_DEVELOPER_TOOLS', 'REDUX_DEVTOOLS'] as const;
|
||||||
const forceDownload = Boolean(process.env.UPGRADE_EXTENSIONS);
|
const forceDownload = Boolean(process.env.UPGRADE_EXTENSIONS);
|
||||||
|
|
||||||
return Promise.all(extensions.map(name => installer.default(installer[name], forceDownload)));
|
return Promise.all(extensions.map((name) => installer.default(installer[name], forceDownload)));
|
||||||
}
|
}
|
||||||
|
|
||||||
app.on('ready', () =>
|
app.on('ready', () =>
|
||||||
|
|
@ -249,7 +249,7 @@ app.on('ready', () =>
|
||||||
installCLI(false);
|
installCLI(false);
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.catch(err => {
|
.catch((err) => {
|
||||||
console.error('Error while loading devtools extensions', err);
|
console.error('Error while loading devtools extensions', err);
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -41,7 +41,7 @@ export const createMenu = (
|
||||||
const showAbout = () => {
|
const showAbout = () => {
|
||||||
const loadedPlugins = getLoadedPluginVersions();
|
const loadedPlugins = getLoadedPluginVersions();
|
||||||
const pluginList =
|
const pluginList =
|
||||||
loadedPlugins.length === 0 ? 'none' : loadedPlugins.map(plugin => `\n ${plugin.name} (${plugin.version})`);
|
loadedPlugins.length === 0 ? 'none' : loadedPlugins.map((plugin) => `\n ${plugin.name} (${plugin.version})`);
|
||||||
|
|
||||||
const rendererCounts = Object.values(getRendererTypes()).reduce((acc: Record<string, number>, type) => {
|
const rendererCounts = Object.values(getRendererTypes()).reduce((acc: Record<string, number>, type) => {
|
||||||
acc[type] = acc[type] ? acc[type] + 1 : 1;
|
acc[type] = acc[type] ? acc[type] + 1 : 1;
|
||||||
|
|
|
||||||
|
|
@ -20,8 +20,8 @@ export default function fetchNotifications(win: BrowserWindow) {
|
||||||
'X-Hyper-Platform': process.platform
|
'X-Hyper-Platform': process.platform
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.then(res => res.json())
|
.then((res) => res.json())
|
||||||
.then(data => {
|
.then((data) => {
|
||||||
const {message} = data || {};
|
const {message} = data || {};
|
||||||
if (typeof message !== 'object' && message !== '') {
|
if (typeof message !== 'object' && message !== '') {
|
||||||
throw new Error('Bad response');
|
throw new Error('Bad response');
|
||||||
|
|
|
||||||
|
|
@ -82,7 +82,7 @@ function patchModuleLoad() {
|
||||||
}
|
}
|
||||||
|
|
||||||
function checkDeprecatedExtendKeymaps() {
|
function checkDeprecatedExtendKeymaps() {
|
||||||
modules.forEach(plugin => {
|
modules.forEach((plugin) => {
|
||||||
if (plugin.extendKeymaps) {
|
if (plugin.extendKeymaps) {
|
||||||
notify('Plugin warning!', `"${plugin._name}" use deprecated "extendKeymaps" handler`);
|
notify('Plugin warning!', `"${plugin._name}" use deprecated "extendKeymaps" handler`);
|
||||||
return;
|
return;
|
||||||
|
|
@ -124,7 +124,7 @@ function updatePlugins({force = false} = {}) {
|
||||||
cache.set('hyper.plugin-versions', pluginVersions);
|
cache.set('hyper.plugin-versions', pluginVersions);
|
||||||
|
|
||||||
// notify watchers
|
// notify watchers
|
||||||
watchers.forEach(fn => fn(err, {force}));
|
watchers.forEach((fn) => fn(err, {force}));
|
||||||
|
|
||||||
if (force || changed) {
|
if (force || changed) {
|
||||||
if (changed) {
|
if (changed) {
|
||||||
|
|
@ -140,7 +140,7 @@ function updatePlugins({force = false} = {}) {
|
||||||
|
|
||||||
function getPluginVersions() {
|
function getPluginVersions() {
|
||||||
const paths_ = paths.plugins.concat(paths.localPlugins);
|
const paths_ = paths.plugins.concat(paths.localPlugins);
|
||||||
return paths_.map(path_ => {
|
return paths_.map((path_) => {
|
||||||
let version = null;
|
let version = null;
|
||||||
try {
|
try {
|
||||||
version = require(resolve(path_, 'package.json')).version;
|
version = require(resolve(path_, 'package.json')).version;
|
||||||
|
|
@ -152,7 +152,7 @@ function getPluginVersions() {
|
||||||
|
|
||||||
function clearCache() {
|
function clearCache() {
|
||||||
// trigger unload hooks
|
// trigger unload hooks
|
||||||
modules.forEach(mod => {
|
modules.forEach((mod) => {
|
||||||
if (mod.onUnload) {
|
if (mod.onUnload) {
|
||||||
mod.onUnload(app);
|
mod.onUnload(app);
|
||||||
}
|
}
|
||||||
|
|
@ -169,7 +169,7 @@ function clearCache() {
|
||||||
export {updatePlugins};
|
export {updatePlugins};
|
||||||
|
|
||||||
export const getLoadedPluginVersions = () => {
|
export const getLoadedPluginVersions = () => {
|
||||||
return modules.map(mod => ({name: mod._name, version: mod._version}));
|
return modules.map((mod) => ({name: mod._name, version: mod._version}));
|
||||||
};
|
};
|
||||||
|
|
||||||
// we schedule the initial plugins update
|
// we schedule the initial plugins update
|
||||||
|
|
@ -224,7 +224,7 @@ function alert(message: string) {
|
||||||
|
|
||||||
function toDependencies(plugins_: {plugins: string[]}) {
|
function toDependencies(plugins_: {plugins: string[]}) {
|
||||||
const obj: Record<string, string> = {};
|
const obj: Record<string, string> = {};
|
||||||
plugins_.plugins.forEach(plugin => {
|
plugins_.plugins.forEach((plugin) => {
|
||||||
const regex = /.(@|#)/;
|
const regex = /.(@|#)/;
|
||||||
const match = regex.exec(plugin);
|
const match = regex.exec(plugin);
|
||||||
|
|
||||||
|
|
@ -251,10 +251,10 @@ export const subscribe = (fn: Function) => {
|
||||||
|
|
||||||
function getPaths() {
|
function getPaths() {
|
||||||
return {
|
return {
|
||||||
plugins: plugins.plugins.map(name => {
|
plugins: plugins.plugins.map((name) => {
|
||||||
return resolve(path, 'node_modules', name.split('#')[0]);
|
return resolve(path, 'node_modules', name.split('#')[0]);
|
||||||
}),
|
}),
|
||||||
localPlugins: plugins.localPlugins.map(name => {
|
localPlugins: plugins.localPlugins.map((name) => {
|
||||||
return resolve(localPath, name);
|
return resolve(localPath, name);
|
||||||
})
|
})
|
||||||
};
|
};
|
||||||
|
|
@ -275,7 +275,7 @@ function requirePlugins(): any[] {
|
||||||
let mod: any;
|
let mod: any;
|
||||||
try {
|
try {
|
||||||
mod = require(path_);
|
mod = require(path_);
|
||||||
const exposed = mod && Object.keys(mod).some(key => availableExtensions.has(key));
|
const exposed = mod && Object.keys(mod).some((key) => availableExtensions.has(key));
|
||||||
if (!exposed) {
|
if (!exposed) {
|
||||||
notify('Plugin error!', `${`Plugin "${basename(path_)}" does not expose any `}Hyper extension API methods`);
|
notify('Plugin error!', `${`Plugin "${basename(path_)}" does not expose any `}Hyper extension API methods`);
|
||||||
return;
|
return;
|
||||||
|
|
@ -303,11 +303,11 @@ function requirePlugins(): any[] {
|
||||||
return plugins_
|
return plugins_
|
||||||
.map(load)
|
.map(load)
|
||||||
.concat(localPlugins.map(load))
|
.concat(localPlugins.map(load))
|
||||||
.filter(v => Boolean(v));
|
.filter((v) => Boolean(v));
|
||||||
}
|
}
|
||||||
|
|
||||||
export const onApp = (app_: App) => {
|
export const onApp = (app_: App) => {
|
||||||
modules.forEach(plugin => {
|
modules.forEach((plugin) => {
|
||||||
if (plugin.onApp) {
|
if (plugin.onApp) {
|
||||||
try {
|
try {
|
||||||
plugin.onApp(app_);
|
plugin.onApp(app_);
|
||||||
|
|
@ -321,7 +321,7 @@ export const onApp = (app_: App) => {
|
||||||
};
|
};
|
||||||
|
|
||||||
export const onWindowClass = (win: BrowserWindow) => {
|
export const onWindowClass = (win: BrowserWindow) => {
|
||||||
modules.forEach(plugin => {
|
modules.forEach((plugin) => {
|
||||||
if (plugin.onWindowClass) {
|
if (plugin.onWindowClass) {
|
||||||
try {
|
try {
|
||||||
plugin.onWindowClass(win);
|
plugin.onWindowClass(win);
|
||||||
|
|
@ -335,7 +335,7 @@ export const onWindowClass = (win: BrowserWindow) => {
|
||||||
};
|
};
|
||||||
|
|
||||||
export const onWindow = (win: BrowserWindow) => {
|
export const onWindow = (win: BrowserWindow) => {
|
||||||
modules.forEach(plugin => {
|
modules.forEach((plugin) => {
|
||||||
if (plugin.onWindow) {
|
if (plugin.onWindow) {
|
||||||
try {
|
try {
|
||||||
plugin.onWindow(win);
|
plugin.onWindow(win);
|
||||||
|
|
@ -352,7 +352,7 @@ export const onWindow = (win: BrowserWindow) => {
|
||||||
// for all the available plugins
|
// for all the available plugins
|
||||||
function decorateEntity(base: any, key: string, type: 'object' | 'function') {
|
function decorateEntity(base: any, key: string, type: 'object' | 'function') {
|
||||||
let decorated = base;
|
let decorated = base;
|
||||||
modules.forEach(plugin => {
|
modules.forEach((plugin) => {
|
||||||
if (plugin[key]) {
|
if (plugin[key]) {
|
||||||
let res;
|
let res;
|
||||||
try {
|
try {
|
||||||
|
|
@ -383,7 +383,7 @@ function decorateClass(base: any, key: string) {
|
||||||
export const getDeprecatedConfig = () => {
|
export const getDeprecatedConfig = () => {
|
||||||
const deprecated: Record<string, any> = {};
|
const deprecated: Record<string, any> = {};
|
||||||
const baseConfig = config.getConfig();
|
const baseConfig = config.getConfig();
|
||||||
modules.forEach(plugin => {
|
modules.forEach((plugin) => {
|
||||||
if (!plugin.decorateConfig) {
|
if (!plugin.decorateConfig) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,7 @@ export const install = (fn: Function) => {
|
||||||
NODE_ENV: 'production',
|
NODE_ENV: 'production',
|
||||||
ELECTRON_RUN_AS_NODE: 'true'
|
ELECTRON_RUN_AS_NODE: 'true'
|
||||||
};
|
};
|
||||||
spawnQueue.push(end => {
|
spawnQueue.push((end) => {
|
||||||
const cmd = [process.execPath, yarn].concat(args).join(' ');
|
const cmd = [process.execPath, yarn].concat(args).join(' ');
|
||||||
console.log('Launching yarn:', cmd);
|
console.log('Launching yarn:', cmd);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -146,14 +146,14 @@ export default class Session extends EventEmitter {
|
||||||
}
|
}
|
||||||
|
|
||||||
this.batcher = new DataBatcher(uid);
|
this.batcher = new DataBatcher(uid);
|
||||||
this.pty.onData(chunk => {
|
this.pty.onData((chunk) => {
|
||||||
if (this.ended) {
|
if (this.ended) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
this.batcher?.write(chunk as any);
|
this.batcher?.write(chunk as any);
|
||||||
});
|
});
|
||||||
|
|
||||||
this.batcher.on('flush', data => {
|
this.batcher.on('flush', (data) => {
|
||||||
this.emit('data', data);
|
this.emit('data', data);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -29,5 +29,5 @@ export default (
|
||||||
const _edit = editMenu(commandKeys, execCommand).submenu.filter(filterCutCopy.bind(null, selection));
|
const _edit = editMenu(commandKeys, execCommand).submenu.filter(filterCutCopy.bind(null, selection));
|
||||||
return _edit
|
return _edit
|
||||||
.concat(separator, _shell)
|
.concat(separator, _shell)
|
||||||
.filter(menuItem => !Object.prototype.hasOwnProperty.call(menuItem, 'enabled') || menuItem.enabled);
|
.filter((menuItem) => !Object.prototype.hasOwnProperty.call(menuItem, 'enabled') || menuItem.enabled);
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -113,7 +113,7 @@ export function newWindow(
|
||||||
function createSession(extraOptions: any = {}) {
|
function createSession(extraOptions: any = {}) {
|
||||||
const uid = uuidv4();
|
const uid = uuidv4();
|
||||||
const extraOptionsFiltered: any = {};
|
const extraOptionsFiltered: any = {};
|
||||||
Object.keys(extraOptions).forEach(key => {
|
Object.keys(extraOptions).forEach((key) => {
|
||||||
if (extraOptions[key] !== undefined) extraOptionsFiltered[key] = extraOptions[key];
|
if (extraOptions[key] !== undefined) extraOptionsFiltered[key] = extraOptions[key];
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
@ -135,7 +135,7 @@ export function newWindow(
|
||||||
return {session, options};
|
return {session, options};
|
||||||
}
|
}
|
||||||
|
|
||||||
rpc.on('new', extraOptions => {
|
rpc.on('new', (extraOptions) => {
|
||||||
const {session, options} = createSession(extraOptions);
|
const {session, options} = createSession(extraOptions);
|
||||||
|
|
||||||
sessions.set(options.uid, session);
|
sessions.set(options.uid, session);
|
||||||
|
|
@ -202,7 +202,7 @@ export function newWindow(
|
||||||
rpc.on('open external', ({url}) => {
|
rpc.on('open external', ({url}) => {
|
||||||
shell.openExternal(url);
|
shell.openExternal(url);
|
||||||
});
|
});
|
||||||
rpc.on('open context menu', selection => {
|
rpc.on('open context menu', (selection) => {
|
||||||
const {createWindow} = app;
|
const {createWindow} = app;
|
||||||
const {buildFromTemplate} = Menu;
|
const {buildFromTemplate} = Menu;
|
||||||
buildFromTemplate(contextMenuTemplate(createWindow, selection)).popup({window});
|
buildFromTemplate(contextMenuTemplate(createWindow, selection)).popup({window});
|
||||||
|
|
@ -223,7 +223,7 @@ export function newWindow(
|
||||||
rpc.on('close', () => {
|
rpc.on('close', () => {
|
||||||
window.close();
|
window.close();
|
||||||
});
|
});
|
||||||
rpc.on('command', command => {
|
rpc.on('command', (command) => {
|
||||||
const focusedWindow = BrowserWindow.getFocusedWindow();
|
const focusedWindow = BrowserWindow.getFocusedWindow();
|
||||||
execCommand(command, focusedWindow!);
|
execCommand(command, focusedWindow!);
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -25,7 +25,7 @@ const buildFeedUrl = (canary: boolean, currentVersion: string) => {
|
||||||
const isCanary = (updateChannel: string) => updateChannel === 'canary';
|
const isCanary = (updateChannel: string) => updateChannel === 'canary';
|
||||||
|
|
||||||
async function init() {
|
async function init() {
|
||||||
autoUpdater.on('error', err => {
|
autoUpdater.on('error', (err) => {
|
||||||
console.error('Error fetching updates', `${err.message} (${err.stack})`);
|
console.error('Error fetching updates', `${err.message} (${err.stack})`);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -19,8 +19,8 @@ const symlink = pify(fs.symlink);
|
||||||
|
|
||||||
const checkInstall = () => {
|
const checkInstall = () => {
|
||||||
return readlink(cliLinkPath)
|
return readlink(cliLinkPath)
|
||||||
.then(link => link === cliScriptPath)
|
.then((link) => link === cliScriptPath)
|
||||||
.catch(err => {
|
.catch((err) => {
|
||||||
if (err.code === 'ENOENT') {
|
if (err.code === 'ENOENT') {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
@ -29,7 +29,7 @@ const checkInstall = () => {
|
||||||
};
|
};
|
||||||
|
|
||||||
const addSymlink = () => {
|
const addSymlink = () => {
|
||||||
return checkInstall().then(isInstalled => {
|
return checkInstall().then((isInstalled) => {
|
||||||
if (isInstalled) {
|
if (isInstalled) {
|
||||||
console.log('Hyper CLI already in PATH');
|
console.log('Hyper CLI already in PATH');
|
||||||
return Promise.resolve();
|
return Promise.resolve();
|
||||||
|
|
@ -50,7 +50,7 @@ const addBinToUserPath = () => {
|
||||||
const basePath = path.resolve(binPath, '../../..');
|
const basePath = path.resolve(binPath, '../../..');
|
||||||
|
|
||||||
const items = Registry.enumValueNames(envKey);
|
const items = Registry.enumValueNames(envKey);
|
||||||
const pathItem = items.find(item => item.toUpperCase() === 'PATH');
|
const pathItem = items.find((item) => item.toUpperCase() === 'PATH');
|
||||||
const pathItemName = pathItem || 'PATH';
|
const pathItemName = pathItem || 'PATH';
|
||||||
|
|
||||||
let newPathValue = binPath;
|
let newPathValue = binPath;
|
||||||
|
|
@ -72,7 +72,7 @@ const addBinToUserPath = () => {
|
||||||
|
|
||||||
// Because version is in path we need to remove old path if present and add current path
|
// Because version is in path we need to remove old path if present and add current path
|
||||||
newPathValue = pathParts
|
newPathValue = pathParts
|
||||||
.filter(pathPart => !pathPart.startsWith(basePath))
|
.filter((pathPart) => !pathPart.startsWith(basePath))
|
||||||
.concat([binPath])
|
.concat([binPath])
|
||||||
.join(';');
|
.join(';');
|
||||||
}
|
}
|
||||||
|
|
@ -101,13 +101,13 @@ export const installCLI = (withNotification: boolean) => {
|
||||||
'You may need to restart your computer to complete this installation process.'
|
'You may need to restart your computer to complete this installation process.'
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
.catch(err =>
|
.catch((err) =>
|
||||||
logNotify(withNotification, 'Hyper CLI installation failed', `Failed to add Hyper CLI path to user PATH ${err}`)
|
logNotify(withNotification, 'Hyper CLI installation failed', `Failed to add Hyper CLI path to user PATH ${err}`)
|
||||||
);
|
);
|
||||||
} else if (process.platform === 'darwin') {
|
} else if (process.platform === 'darwin') {
|
||||||
addSymlink()
|
addSymlink()
|
||||||
.then(() => logNotify(withNotification, 'Hyper CLI installed', `Symlink created at ${cliLinkPath}`))
|
.then(() => logNotify(withNotification, 'Hyper CLI installed', `Symlink created at ${cliLinkPath}`))
|
||||||
.catch(err => {
|
.catch((err) => {
|
||||||
// 'EINVAL' is returned by readlink,
|
// 'EINVAL' is returned by readlink,
|
||||||
// 'EEXIST' is returned by symlink
|
// 'EEXIST' is returned by symlink
|
||||||
const error =
|
const error =
|
||||||
|
|
|
||||||
|
|
@ -21,7 +21,7 @@ const colorList = [
|
||||||
|
|
||||||
export const getColorMap: {
|
export const getColorMap: {
|
||||||
<T>(colors: T): T extends (infer U)[] ? {[k: string]: U} : T;
|
<T>(colors: T): T extends (infer U)[] ? {[k: string]: U} : T;
|
||||||
} = colors => {
|
} = (colors) => {
|
||||||
if (!Array.isArray(colors)) {
|
if (!Array.isArray(colors)) {
|
||||||
return colors;
|
return colors;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@ const generatePrefixedCommand = (command: string, shortcuts: string[]) => {
|
||||||
for (let i = 1; i <= 9; i++) {
|
for (let i = 1; i <= 9; i++) {
|
||||||
// 9 is a special number because it means 'last'
|
// 9 is a special number because it means 'last'
|
||||||
const index = i === 9 ? 'last' : i;
|
const index = i === 9 ? 'last' : i;
|
||||||
const prefixedShortcuts = shortcuts.map(shortcut => `${shortcut}+${i}`);
|
const prefixedShortcuts = shortcuts.map((shortcut) => `${shortcut}+${i}`);
|
||||||
result[`${baseCmd}:${index}`] = prefixedShortcuts;
|
result[`${baseCmd}:${index}`] = prefixedShortcuts;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -20,7 +20,7 @@ export default (config: Record<string, string[] | string>) => {
|
||||||
const _shortcuts = config[command];
|
const _shortcuts = config[command];
|
||||||
const shortcuts = Array.isArray(_shortcuts) ? _shortcuts : [_shortcuts];
|
const shortcuts = Array.isArray(_shortcuts) ? _shortcuts : [_shortcuts];
|
||||||
const fixedShortcuts: string[] = [];
|
const fixedShortcuts: string[] = [];
|
||||||
shortcuts.forEach(shortcut => {
|
shortcuts.forEach((shortcut) => {
|
||||||
let newShortcut = shortcut;
|
let newShortcut = shortcut;
|
||||||
if (newShortcut.indexOf('cmd') !== -1) {
|
if (newShortcut.indexOf('cmd') !== -1) {
|
||||||
// Mousetrap use `command` and not `cmd`
|
// Mousetrap use `command` and not `cmd`
|
||||||
|
|
|
||||||
|
|
@ -13,8 +13,5 @@ export default (bgColor: string) => {
|
||||||
|
|
||||||
// http://stackoverflow.com/a/11019879/1202488
|
// http://stackoverflow.com/a/11019879/1202488
|
||||||
const alphaHex = Math.round(color.alpha() * 255).toString(16);
|
const alphaHex = Math.round(color.alpha() * 255).toString(16);
|
||||||
return `#${alphaHex}${color
|
return `#${alphaHex}${color.hex().toString().substr(1)}`;
|
||||||
.hex()
|
|
||||||
.toString()
|
|
||||||
.substr(1)}`;
|
|
||||||
};
|
};
|
||||||
|
|
|
||||||
10
cli/api.ts
10
cli/api.ts
|
|
@ -54,7 +54,7 @@ const getFileContents = memoize(() => {
|
||||||
|
|
||||||
const getParsedFile = memoize(() => recast.parse(getFileContents()!));
|
const getParsedFile = memoize(() => recast.parse(getFileContents()!));
|
||||||
|
|
||||||
const getProperties = memoize(() => ((getParsedFile()?.program?.body as any[]) || []).map(obj => obj));
|
const getProperties = memoize(() => ((getParsedFile()?.program?.body as any[]) || []).map((obj) => obj));
|
||||||
|
|
||||||
const getPluginsByKey = (key: string) => {
|
const getPluginsByKey = (key: string) => {
|
||||||
const properties = getProperties();
|
const properties = getProperties();
|
||||||
|
|
@ -84,7 +84,7 @@ function exists() {
|
||||||
function isInstalled(plugin: string, locally?: boolean) {
|
function isInstalled(plugin: string, locally?: boolean) {
|
||||||
const array = (locally ? getLocalPlugins() : getPlugins()) || [];
|
const array = (locally ? getLocalPlugins() : getPlugins()) || [];
|
||||||
if (array && Array.isArray(array)) {
|
if (array && Array.isArray(array)) {
|
||||||
return array.some(entry => entry.value === plugin);
|
return array.some((entry) => entry.value === plugin);
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
@ -108,7 +108,7 @@ function existsOnNpm(plugin: string) {
|
||||||
const name = getPackageName(plugin);
|
const name = getPackageName(plugin);
|
||||||
return got
|
return got
|
||||||
.get<any>(registryUrl + name.toLowerCase(), {timeout: 10000, responseType: 'json'})
|
.get<any>(registryUrl + name.toLowerCase(), {timeout: 10000, responseType: 'json'})
|
||||||
.then(res => {
|
.then((res) => {
|
||||||
if (!res.body.versions) {
|
if (!res.body.versions) {
|
||||||
return Promise.reject(res);
|
return Promise.reject(res);
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -142,7 +142,7 @@ function uninstall(plugin: string) {
|
||||||
return Promise.reject(`${plugin} is not installed`);
|
return Promise.reject(`${plugin} is not installed`);
|
||||||
}
|
}
|
||||||
|
|
||||||
const index = getPlugins()!.findIndex(entry => entry.value === plugin);
|
const index = getPlugins()!.findIndex((entry) => entry.value === plugin);
|
||||||
getPlugins()!.splice(index, 1);
|
getPlugins()!.splice(index, 1);
|
||||||
return save();
|
return save();
|
||||||
}
|
}
|
||||||
|
|
@ -150,7 +150,7 @@ function uninstall(plugin: string) {
|
||||||
function list() {
|
function list() {
|
||||||
if (Array.isArray(getPlugins())) {
|
if (Array.isArray(getPlugins())) {
|
||||||
return getPlugins()!
|
return getPlugins()!
|
||||||
.map(plugin => plugin.value)
|
.map((plugin) => plugin.value)
|
||||||
.join('\n');
|
.join('\n');
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
|
|
||||||
30
cli/index.ts
30
cli/index.ts
|
|
@ -59,7 +59,7 @@ args.command(
|
||||||
commandPromise = api
|
commandPromise = api
|
||||||
.uninstall(pluginName)
|
.uninstall(pluginName)
|
||||||
.then(() => console.log(chalk.green(`${pluginName} uninstalled successfully!`)))
|
.then(() => console.log(chalk.green(`${pluginName} uninstalled successfully!`)))
|
||||||
.catch(err => console.log(chalk.red(err)));
|
.catch((err) => console.log(chalk.red(err)));
|
||||||
},
|
},
|
||||||
['u', 'rm', 'remove']
|
['u', 'rm', 'remove']
|
||||||
);
|
);
|
||||||
|
|
@ -85,16 +85,16 @@ const lsRemote = (pattern?: string) => {
|
||||||
// note that no errors are catched by this function
|
// note that no errors are catched by this function
|
||||||
const URL = `https://api.npms.io/v2/search?q=${(pattern && `${pattern}+`) || ''}keywords:hyper-plugin,hyper-theme`;
|
const URL = `https://api.npms.io/v2/search?q=${(pattern && `${pattern}+`) || ''}keywords:hyper-plugin,hyper-theme`;
|
||||||
return got(URL)
|
return got(URL)
|
||||||
.then(response => JSON.parse(response.body).results as any[])
|
.then((response) => JSON.parse(response.body).results as any[])
|
||||||
.then(entries => entries.map(entry => entry.package))
|
.then((entries) => entries.map((entry) => entry.package))
|
||||||
.then(entries => entries.filter(entry => entry.name.indexOf(PLUGIN_PREFIX) === 0))
|
.then((entries) => entries.filter((entry) => entry.name.indexOf(PLUGIN_PREFIX) === 0))
|
||||||
.then(entries =>
|
.then((entries) =>
|
||||||
entries.map(({name, description}) => {
|
entries.map(({name, description}) => {
|
||||||
return {name, description};
|
return {name, description};
|
||||||
})
|
})
|
||||||
)
|
)
|
||||||
.then(entries =>
|
.then((entries) =>
|
||||||
entries.map(entry => {
|
entries.map((entry) => {
|
||||||
entry.name = chalk.green(entry.name);
|
entry.name = chalk.green(entry.name);
|
||||||
return entry;
|
return entry;
|
||||||
})
|
})
|
||||||
|
|
@ -109,7 +109,7 @@ args.command(
|
||||||
const query = args_[0] ? args_[0].toLowerCase() : '';
|
const query = args_[0] ? args_[0].toLowerCase() : '';
|
||||||
|
|
||||||
commandPromise = lsRemote(query)
|
commandPromise = lsRemote(query)
|
||||||
.then(entries => {
|
.then((entries) => {
|
||||||
if (entries.length === 0) {
|
if (entries.length === 0) {
|
||||||
spinner.fail();
|
spinner.fail();
|
||||||
console.error(chalk.red(`Your search '${query}' did not match any plugins`));
|
console.error(chalk.red(`Your search '${query}' did not match any plugins`));
|
||||||
|
|
@ -122,7 +122,7 @@ args.command(
|
||||||
console.log(msg);
|
console.log(msg);
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.catch(err => {
|
.catch((err) => {
|
||||||
spinner.fail();
|
spinner.fail();
|
||||||
console.error(chalk.red(err)); // TODO
|
console.error(chalk.red(err)); // TODO
|
||||||
});
|
});
|
||||||
|
|
@ -137,14 +137,14 @@ args.command(
|
||||||
const spinner = ora('Searching').start();
|
const spinner = ora('Searching').start();
|
||||||
|
|
||||||
commandPromise = lsRemote()
|
commandPromise = lsRemote()
|
||||||
.then(entries => {
|
.then((entries) => {
|
||||||
let msg = columnify(entries);
|
let msg = columnify(entries);
|
||||||
|
|
||||||
spinner.succeed();
|
spinner.succeed();
|
||||||
msg = msg.substring(msg.indexOf('\n') + 1); // remove header
|
msg = msg.substring(msg.indexOf('\n') + 1); // remove header
|
||||||
console.log(msg);
|
console.log(msg);
|
||||||
})
|
})
|
||||||
.catch(err => {
|
.catch((err) => {
|
||||||
spinner.fail();
|
spinner.fail();
|
||||||
console.error(chalk.red(err)); // TODO
|
console.error(chalk.red(err)); // TODO
|
||||||
});
|
});
|
||||||
|
|
@ -208,7 +208,7 @@ const main = (argv: string[]) => {
|
||||||
env
|
env
|
||||||
};
|
};
|
||||||
|
|
||||||
const args_ = args.sub.map(arg => {
|
const args_ = args.sub.map((arg) => {
|
||||||
const cwd = isAbsolute(arg) ? arg : resolve(process.cwd(), arg);
|
const cwd = isAbsolute(arg) ? arg : resolve(process.cwd(), arg);
|
||||||
if (!existsSync(cwd)) {
|
if (!existsSync(cwd)) {
|
||||||
console.error(chalk.red(`Error! Directory or file does not exist: ${cwd}`));
|
console.error(chalk.red(`Error! Directory or file does not exist: ${cwd}`));
|
||||||
|
|
@ -232,11 +232,11 @@ const main = (argv: string[]) => {
|
||||||
const child = spawn(process.execPath, args_, options);
|
const child = spawn(process.execPath, args_, options);
|
||||||
|
|
||||||
if (flags.verbose) {
|
if (flags.verbose) {
|
||||||
child.stdout.on('data', data => console.log(data.toString('utf8')));
|
child.stdout.on('data', (data) => console.log(data.toString('utf8')));
|
||||||
child.stderr.on('data', data => console.error(data.toString('utf8')));
|
child.stderr.on('data', (data) => console.error(data.toString('utf8')));
|
||||||
}
|
}
|
||||||
if (flags.verbose) {
|
if (flags.verbose) {
|
||||||
return new Promise(c => child.once('exit', () => c(null)));
|
return new Promise((c) => child.once('exit', () => c(null)));
|
||||||
}
|
}
|
||||||
child.unref();
|
child.unref();
|
||||||
return Promise.resolve();
|
return Promise.resolve();
|
||||||
|
|
|
||||||
|
|
@ -152,7 +152,7 @@ export function userExitTermGroup(uid: string) {
|
||||||
if (group.sessionUid) {
|
if (group.sessionUid) {
|
||||||
dispatch(userExitSession(group.sessionUid));
|
dispatch(userExitSession(group.sessionUid));
|
||||||
} else {
|
} else {
|
||||||
group.children.forEach(childUid => {
|
group.children.forEach((childUid) => {
|
||||||
dispatch(userExitTermGroup(childUid));
|
dispatch(userExitTermGroup(childUid));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -209,7 +209,7 @@ export function moveTo(i: number | 'last') {
|
||||||
const {termGroups} = getState().termGroups;
|
const {termGroups} = getState().termGroups;
|
||||||
i =
|
i =
|
||||||
Object.keys(termGroups)
|
Object.keys(termGroups)
|
||||||
.map(uid => termGroups[uid])
|
.map((uid) => termGroups[uid])
|
||||||
.filter(({parentUid}) => !parentUid).length - 1;
|
.filter(({parentUid}) => !parentUid).length - 1;
|
||||||
}
|
}
|
||||||
dispatch({
|
dispatch({
|
||||||
|
|
|
||||||
|
|
@ -50,7 +50,7 @@ export default class Notifications extends React.PureComponent<NotificationsProp
|
||||||
<a
|
<a
|
||||||
key="link"
|
key="link"
|
||||||
style={{color: '#fff'}}
|
style={{color: '#fff'}}
|
||||||
onClick={ev => {
|
onClick={(ev) => {
|
||||||
window.require('electron').shell.openExternal(ev.currentTarget.href);
|
window.require('electron').shell.openExternal(ev.currentTarget.href);
|
||||||
ev.preventDefault();
|
ev.preventDefault();
|
||||||
}}
|
}}
|
||||||
|
|
@ -77,7 +77,7 @@ export default class Notifications extends React.PureComponent<NotificationsProp
|
||||||
{this.props.updateNote && ` ${this.props.updateNote.trim().replace(/\.$/, '')}`} (
|
{this.props.updateNote && ` ${this.props.updateNote.trim().replace(/\.$/, '')}`} (
|
||||||
<a
|
<a
|
||||||
style={{color: '#000'}}
|
style={{color: '#000'}}
|
||||||
onClick={ev => {
|
onClick={(ev) => {
|
||||||
window.require('electron').shell.openExternal(ev.currentTarget.href);
|
window.require('electron').shell.openExternal(ev.currentTarget.href);
|
||||||
ev.preventDefault();
|
ev.preventDefault();
|
||||||
}}
|
}}
|
||||||
|
|
@ -105,7 +105,7 @@ export default class Notifications extends React.PureComponent<NotificationsProp
|
||||||
textDecoration: 'underline',
|
textDecoration: 'underline',
|
||||||
fontWeight: 'bold'
|
fontWeight: 'bold'
|
||||||
}}
|
}}
|
||||||
onClick={ev => {
|
onClick={(ev) => {
|
||||||
window.require('electron').shell.openExternal(ev.currentTarget.href);
|
window.require('electron').shell.openExternal(ev.currentTarget.href);
|
||||||
ev.preventDefault();
|
ev.preventDefault();
|
||||||
}}
|
}}
|
||||||
|
|
|
||||||
|
|
@ -31,7 +31,7 @@ export default class SearchBox extends React.PureComponent<SearchBoxProps> {
|
||||||
render() {
|
render() {
|
||||||
return (
|
return (
|
||||||
<div style={searchBoxStyling}>
|
<div style={searchBoxStyling}>
|
||||||
<input type="text" className="search-box" onKeyUp={this.handleChange} ref={input => input && input.focus()} />
|
<input type="text" className="search-box" onKeyUp={this.handleChange} ref={(input) => input && input.focus()} />
|
||||||
<span className="search-button" onClick={() => this.props.prev(this.searchTerm)}>
|
<span className="search-button" onClick={() => this.props.prev(this.searchTerm)}>
|
||||||
{' '}
|
{' '}
|
||||||
←{' '}
|
←{' '}
|
||||||
|
|
|
||||||
|
|
@ -119,7 +119,7 @@ class TermGroup_ extends React.PureComponent<TermGroupProps> {
|
||||||
return this.renderTerm(termGroup.sessionUid);
|
return this.renderTerm(termGroup.sessionUid);
|
||||||
}
|
}
|
||||||
|
|
||||||
const groups = childGroups.asMutable().map(child => {
|
const groups = childGroups.asMutable().map((child) => {
|
||||||
const props = getTermGroupProps(
|
const props = getTermGroupProps(
|
||||||
child.uid,
|
child.uid,
|
||||||
this.props.parentProps,
|
this.props.parentProps,
|
||||||
|
|
@ -134,7 +134,7 @@ class TermGroup_ extends React.PureComponent<TermGroupProps> {
|
||||||
}
|
}
|
||||||
|
|
||||||
const mapStateToProps = (state: HyperState, ownProps: TermGroupOwnProps) => ({
|
const mapStateToProps = (state: HyperState, ownProps: TermGroupOwnProps) => ({
|
||||||
childGroups: ownProps.termGroup.children.map(uid => state.termGroups.termGroups[uid])
|
childGroups: ownProps.termGroup.children.map((uid) => state.termGroups.termGroups[uid])
|
||||||
});
|
});
|
||||||
|
|
||||||
const mapDispatchToProps = (dispatch: HyperDispatch, ownProps: TermGroupOwnProps) => ({
|
const mapDispatchToProps = (dispatch: HyperDispatch, ownProps: TermGroupOwnProps) => ({
|
||||||
|
|
|
||||||
|
|
@ -326,8 +326,8 @@ export default class Term extends React.PureComponent<TermProps> {
|
||||||
|
|
||||||
// Update only options that have changed.
|
// Update only options that have changed.
|
||||||
ObjectTypedKeys(nextTermOptions)
|
ObjectTypedKeys(nextTermOptions)
|
||||||
.filter(option => option !== 'theme' && nextTermOptions[option] !== this.termOptions[option])
|
.filter((option) => option !== 'theme' && nextTermOptions[option] !== this.termOptions[option])
|
||||||
.forEach(option => {
|
.forEach((option) => {
|
||||||
try {
|
try {
|
||||||
this.term.setOption(option, nextTermOptions[option]);
|
this.term.setOption(option, nextTermOptions[option]);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
|
@ -344,7 +344,7 @@ export default class Term extends React.PureComponent<TermProps> {
|
||||||
!this.termOptions.theme ||
|
!this.termOptions.theme ||
|
||||||
nextTermOptions.rendererType !== this.termOptions.rendererType ||
|
nextTermOptions.rendererType !== this.termOptions.rendererType ||
|
||||||
ObjectTypedKeys(nextTermOptions.theme!).some(
|
ObjectTypedKeys(nextTermOptions.theme!).some(
|
||||||
option => nextTermOptions.theme![option] !== this.termOptions.theme![option]
|
(option) => nextTermOptions.theme![option] !== this.termOptions.theme![option]
|
||||||
);
|
);
|
||||||
if (shouldUpdateTheme) {
|
if (shouldUpdateTheme) {
|
||||||
this.term.setOption('theme', nextTermOptions.theme);
|
this.term.setOption('theme', nextTermOptions.theme);
|
||||||
|
|
@ -392,7 +392,7 @@ export default class Term extends React.PureComponent<TermProps> {
|
||||||
// instead of invoking `destroy`, since it will make the
|
// instead of invoking `destroy`, since it will make the
|
||||||
// term insta un-attachable in the future (which we need
|
// term insta un-attachable in the future (which we need
|
||||||
// to do in case of splitting, see `componentDidMount`
|
// to do in case of splitting, see `componentDidMount`
|
||||||
this.disposableListeners.forEach(handler => handler.dispose());
|
this.disposableListeners.forEach((handler) => handler.dispose());
|
||||||
this.disposableListeners = [];
|
this.disposableListeners = [];
|
||||||
|
|
||||||
window.removeEventListener('paste', this.onWindowPaste, {
|
window.removeEventListener('paste', this.onWindowPaste, {
|
||||||
|
|
|
||||||
|
|
@ -24,8 +24,8 @@ export default class Terms extends React.Component<TermsProps> {
|
||||||
|
|
||||||
shouldComponentUpdate(nextProps: TermsProps & {children: any}) {
|
shouldComponentUpdate(nextProps: TermsProps & {children: any}) {
|
||||||
return (
|
return (
|
||||||
ObjectTypedKeys(nextProps).some(i => i !== 'write' && this.props[i] !== nextProps[i]) ||
|
ObjectTypedKeys(nextProps).some((i) => i !== 'write' && this.props[i] !== nextProps[i]) ||
|
||||||
ObjectTypedKeys(this.props).some(i => i !== 'write' && this.props[i] !== nextProps[i])
|
ObjectTypedKeys(this.props).some((i) => i !== 'write' && this.props[i] !== nextProps[i])
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -75,7 +75,7 @@ export default class Terms extends React.Component<TermsProps> {
|
||||||
return (
|
return (
|
||||||
<div className={`terms_terms ${shift ? 'terms_termsShifted' : 'terms_termsNotShifted'}`}>
|
<div className={`terms_terms ${shift ? 'terms_termsShifted' : 'terms_termsNotShifted'}`}>
|
||||||
{this.props.customChildrenBefore}
|
{this.props.customChildrenBefore}
|
||||||
{this.props.termGroups.map(termGroup => {
|
{this.props.termGroups.map((termGroup) => {
|
||||||
const {uid} = termGroup;
|
const {uid} = termGroup;
|
||||||
const isActive = uid === this.props.activeRootGroup;
|
const isActive = uid === this.props.activeRootGroup;
|
||||||
const props = getTermGroupProps(uid, this.props, {
|
const props = getTermGroupProps(uid, this.props, {
|
||||||
|
|
|
||||||
|
|
@ -61,7 +61,7 @@ class Hyper extends React.PureComponent<HyperProps> {
|
||||||
}
|
}
|
||||||
|
|
||||||
const keys = getRegisteredKeys();
|
const keys = getRegisteredKeys();
|
||||||
Object.keys(keys).forEach(commandKeys => {
|
Object.keys(keys).forEach((commandKeys) => {
|
||||||
this.mousetrap.bind(
|
this.mousetrap.bind(
|
||||||
commandKeys,
|
commandKeys,
|
||||||
(e: any) => {
|
(e: any) => {
|
||||||
|
|
|
||||||
|
|
@ -38,7 +38,7 @@ const fetchFileData = (configData: any) => {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
getBase64FileData(configInfo.bellSoundURL).then(base64FileData => {
|
getBase64FileData(configInfo.bellSoundURL).then((base64FileData) => {
|
||||||
// prepend "base64," to the result of this method in order for this to work properly within xterm.js
|
// prepend "base64," to the result of this method in order for this to work properly within xterm.js
|
||||||
const bellSound = !base64FileData ? null : 'base64,' + base64FileData;
|
const bellSound = !base64FileData ? null : 'base64,' + base64FileData;
|
||||||
configInfo.bellSound = bellSound;
|
configInfo.bellSound = bellSound;
|
||||||
|
|
@ -71,11 +71,11 @@ rpc.on('ready', () => {
|
||||||
store_.dispatch(uiActions.setFontSmoothing());
|
store_.dispatch(uiActions.setFontSmoothing());
|
||||||
});
|
});
|
||||||
|
|
||||||
rpc.on('session add', data => {
|
rpc.on('session add', (data) => {
|
||||||
store_.dispatch(sessionActions.addSession(data));
|
store_.dispatch(sessionActions.addSession(data));
|
||||||
});
|
});
|
||||||
|
|
||||||
rpc.on('session data', d => {
|
rpc.on('session data', (d) => {
|
||||||
// the uid is a uuid v4 so it's 36 chars long
|
// the uid is a uuid v4 so it's 36 chars long
|
||||||
const uid = d.slice(0, 36);
|
const uid = d.slice(0, 36);
|
||||||
const data = d.slice(36);
|
const data = d.slice(36);
|
||||||
|
|
@ -174,7 +174,7 @@ rpc.on('move right req', () => {
|
||||||
store_.dispatch(uiActions.moveRight());
|
store_.dispatch(uiActions.moveRight());
|
||||||
});
|
});
|
||||||
|
|
||||||
rpc.on('move jump req', index => {
|
rpc.on('move jump req', (index) => {
|
||||||
store_.dispatch(uiActions.moveTo(index));
|
store_.dispatch(uiActions.moveTo(index));
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
@ -190,7 +190,7 @@ rpc.on('open file', ({path}) => {
|
||||||
store_.dispatch(uiActions.openFile(path));
|
store_.dispatch(uiActions.openFile(path));
|
||||||
});
|
});
|
||||||
|
|
||||||
rpc.on('open ssh', url => {
|
rpc.on('open ssh', (url) => {
|
||||||
store_.dispatch(uiActions.openSSH(url));
|
store_.dispatch(uiActions.openSSH(url));
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
@ -198,7 +198,7 @@ rpc.on('update available', ({releaseName, releaseNotes, releaseUrl, canInstall})
|
||||||
store_.dispatch(updaterActions.updateAvailable(releaseName, releaseNotes, releaseUrl, canInstall));
|
store_.dispatch(updaterActions.updateAvailable(releaseName, releaseNotes, releaseUrl, canInstall));
|
||||||
});
|
});
|
||||||
|
|
||||||
rpc.on('move', window => {
|
rpc.on('move', (window) => {
|
||||||
store_.dispatch(uiActions.windowMove(window));
|
store_.dispatch(uiActions.windowMove(window));
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -50,7 +50,7 @@ const insertRebalance = (oldSizes: ImmutableType<number[]>, index: any) => {
|
||||||
const newSize = 1 / (oldSizes.length + 1);
|
const newSize = 1 / (oldSizes.length + 1);
|
||||||
// We spread out how much each pane should be reduced
|
// We spread out how much each pane should be reduced
|
||||||
// with based on their existing size:
|
// with based on their existing size:
|
||||||
const balanced = oldSizes.map(size => size - newSize * size);
|
const balanced = oldSizes.map((size) => size - newSize * size);
|
||||||
return [...balanced.slice(0, index).asMutable(), newSize, ...balanced.slice(index).asMutable()];
|
return [...balanced.slice(0, index).asMutable(), newSize, ...balanced.slice(index).asMutable()];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -190,7 +190,7 @@ const removeGroup = (state: ImmutableType<ITermState>, uid: string) => {
|
||||||
|
|
||||||
const resizeGroup = (state: ImmutableType<ITermState>, uid: any, sizes: number[]) => {
|
const resizeGroup = (state: ImmutableType<ITermState>, uid: any, sizes: number[]) => {
|
||||||
// Make sure none of the sizes fall below MIN_SIZE:
|
// Make sure none of the sizes fall below MIN_SIZE:
|
||||||
if (sizes.find(size => size < MIN_SIZE)) {
|
if (sizes.find((size) => size < MIN_SIZE)) {
|
||||||
return state;
|
return state;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2,8 +2,8 @@ import {createSelector} from 'reselect';
|
||||||
import {HyperState} from './hyper';
|
import {HyperState} from './hyper';
|
||||||
|
|
||||||
const getTermGroups = ({termGroups}: Pick<HyperState, 'termGroups'>) => termGroups.termGroups;
|
const getTermGroups = ({termGroups}: Pick<HyperState, 'termGroups'>) => termGroups.termGroups;
|
||||||
export const getRootGroups = createSelector(getTermGroups, termGroups =>
|
export const getRootGroups = createSelector(getTermGroups, (termGroups) =>
|
||||||
Object.keys(termGroups)
|
Object.keys(termGroups)
|
||||||
.map(uid => termGroups[uid])
|
.map((uid) => termGroups[uid])
|
||||||
.filter(({parentUid}) => !parentUid)
|
.filter(({parentUid}) => !parentUid)
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@ import {Middleware} from 'redux';
|
||||||
// the only side effect we perform from middleware
|
// the only side effect we perform from middleware
|
||||||
// is to write to the react term instance directly
|
// is to write to the react term instance directly
|
||||||
// to avoid a performance hit
|
// to avoid a performance hit
|
||||||
const writeMiddleware: Middleware = () => next => action => {
|
const writeMiddleware: Middleware = () => (next) => (action) => {
|
||||||
if (action.type === 'SESSION_PTY_DATA') {
|
if (action.type === 'SESSION_PTY_DATA') {
|
||||||
const term = terms[action.uid];
|
const term = terms[action.uid];
|
||||||
if (term) {
|
if (term) {
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,7 @@
|
||||||
* as the result of an action being triggered.
|
* as the result of an action being triggered.
|
||||||
*/
|
*/
|
||||||
import {Middleware} from 'redux';
|
import {Middleware} from 'redux';
|
||||||
const effectsMiddleware: Middleware = () => next => action => {
|
const effectsMiddleware: Middleware = () => (next) => (action) => {
|
||||||
const ret = next(action);
|
const ret = next(action);
|
||||||
if (action.effect) {
|
if (action.effect) {
|
||||||
action.effect();
|
action.effect();
|
||||||
|
|
|
||||||
|
|
@ -271,7 +271,7 @@ const loadModules = () => {
|
||||||
return undefined;
|
return undefined;
|
||||||
}
|
}
|
||||||
|
|
||||||
ObjectTypedKeys(mod).forEach(i => {
|
ObjectTypedKeys(mod).forEach((i) => {
|
||||||
if (Object.hasOwnProperty.call(mod, i)) {
|
if (Object.hasOwnProperty.call(mod, i)) {
|
||||||
mod[i]._pluginName = pluginName;
|
mod[i]._pluginName = pluginName;
|
||||||
mod[i]._pluginVersion = pluginVersion;
|
mod[i]._pluginVersion = pluginVersion;
|
||||||
|
|
@ -364,7 +364,7 @@ const loadModules = () => {
|
||||||
.filter((mod: any) => Boolean(mod));
|
.filter((mod: any) => Boolean(mod));
|
||||||
|
|
||||||
const deprecatedPlugins: Record<string, any> = plugins.getDeprecatedConfig();
|
const deprecatedPlugins: Record<string, any> = plugins.getDeprecatedConfig();
|
||||||
Object.keys(deprecatedPlugins).forEach(name => {
|
Object.keys(deprecatedPlugins).forEach((name) => {
|
||||||
const {css} = deprecatedPlugins[name];
|
const {css} = deprecatedPlugins[name];
|
||||||
if (css) {
|
if (css) {
|
||||||
console.warn(`Warning: "${name}" plugin uses some deprecated CSS classes (${css.join(', ')}).`);
|
console.warn(`Warning: "${name}" plugin uses some deprecated CSS classes (${css.join(', ')}).`);
|
||||||
|
|
@ -387,7 +387,7 @@ function getProps(name: keyof typeof propsDecorators, props: any, ...fnArgs: any
|
||||||
const decorators = propsDecorators[name];
|
const decorators = propsDecorators[name];
|
||||||
let props_: typeof props;
|
let props_: typeof props;
|
||||||
|
|
||||||
decorators.forEach(fn => {
|
decorators.forEach((fn) => {
|
||||||
let ret_;
|
let ret_;
|
||||||
|
|
||||||
if (!props_) {
|
if (!props_) {
|
||||||
|
|
@ -445,9 +445,9 @@ export function connect<stateProps, dispatchProps>(
|
||||||
) {
|
) {
|
||||||
return (Class: any, name: keyof typeof connectors) => {
|
return (Class: any, name: keyof typeof connectors) => {
|
||||||
return reduxConnect<stateProps, dispatchProps, any, HyperState>(
|
return reduxConnect<stateProps, dispatchProps, any, HyperState>(
|
||||||
state => {
|
(state) => {
|
||||||
let ret = stateFn(state);
|
let ret = stateFn(state);
|
||||||
connectors[name].state.forEach(fn => {
|
connectors[name].state.forEach((fn) => {
|
||||||
let ret_;
|
let ret_;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|
@ -470,9 +470,9 @@ export function connect<stateProps, dispatchProps>(
|
||||||
});
|
});
|
||||||
return ret;
|
return ret;
|
||||||
},
|
},
|
||||||
dispatch => {
|
(dispatch) => {
|
||||||
let ret = dispatchFn(dispatch);
|
let ret = dispatchFn(dispatch);
|
||||||
connectors[name].dispatch.forEach(fn => {
|
connectors[name].dispatch.forEach((fn) => {
|
||||||
let ret_;
|
let ret_;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|
@ -550,7 +550,7 @@ export function decorateSessionsReducer(fn: ISessionReducer) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// redux middleware generator
|
// redux middleware generator
|
||||||
export const middleware: Middleware = store => next => action => {
|
export const middleware: Middleware = (store) => (next) => (action) => {
|
||||||
const nextMiddleware = (remaining: Middleware[]) => (action_: any) =>
|
const nextMiddleware = (remaining: Middleware[]) => (action_: any) =>
|
||||||
remaining.length ? remaining[0](store)(nextMiddleware(remaining.slice(1)))(action_) : next(action_);
|
remaining.length ? remaining[0](store)(nextMiddleware(remaining.slice(1)))(action_) : next(action_);
|
||||||
nextMiddleware(middlewares)(action);
|
nextMiddleware(middlewares)(action);
|
||||||
|
|
|
||||||
|
|
@ -4,6 +4,6 @@ import {Immutable} from 'seamless-immutable';
|
||||||
export default function findBySession(termGroupState: Immutable<ITermState>, sessionUid: string) {
|
export default function findBySession(termGroupState: Immutable<ITermState>, sessionUid: string) {
|
||||||
const {termGroups} = termGroupState;
|
const {termGroups} = termGroupState;
|
||||||
return Object.keys(termGroups)
|
return Object.keys(termGroups)
|
||||||
.map(uid => termGroups[uid])
|
.map((uid) => termGroups[uid])
|
||||||
.find(group => group.sessionUid === sessionUid);
|
.find((group) => group.sessionUid === sessionUid);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
// Packages
|
// Packages
|
||||||
const {prompt} = require('inquirer');
|
const {prompt} = require('inquirer');
|
||||||
|
|
||||||
module.exports = async markdown => {
|
module.exports = async (markdown) => {
|
||||||
const answers = await prompt([
|
const answers = await prompt([
|
||||||
{
|
{
|
||||||
name: 'intro',
|
name: 'intro',
|
||||||
|
|
|
||||||
|
|
@ -38,7 +38,7 @@ test.after(async () => {
|
||||||
await app.stop();
|
await app.stop();
|
||||||
});
|
});
|
||||||
|
|
||||||
test('see if dev tools are open', async t => {
|
test('see if dev tools are open', async (t) => {
|
||||||
await app.client.waitUntilWindowLoaded();
|
await app.client.waitUntilWindowLoaded();
|
||||||
t.false(await app.webContents.isDevToolsOpened());
|
t.false(await app.webContents.isDevToolsOpened());
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
import test from 'ava';
|
import test from 'ava';
|
||||||
const proxyquire = require('proxyquire').noCallThru();
|
const proxyquire = require('proxyquire').noCallThru();
|
||||||
|
|
||||||
test('existsOnNpm() builds the url for non-scoped packages', t => {
|
test('existsOnNpm() builds the url for non-scoped packages', (t) => {
|
||||||
let getUrl: string;
|
let getUrl: string;
|
||||||
const {existsOnNpm} = proxyquire('../../cli/api', {
|
const {existsOnNpm} = proxyquire('../../cli/api', {
|
||||||
got: {
|
got: {
|
||||||
|
|
@ -22,7 +22,7 @@ test('existsOnNpm() builds the url for non-scoped packages', t => {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
test('existsOnNpm() builds the url for scoped packages', t => {
|
test('existsOnNpm() builds the url for scoped packages', (t) => {
|
||||||
let getUrl: string;
|
let getUrl: string;
|
||||||
const {existsOnNpm} = proxyquire('../../cli/api', {
|
const {existsOnNpm} = proxyquire('../../cli/api', {
|
||||||
got: {
|
got: {
|
||||||
|
|
|
||||||
|
|
@ -2,11 +2,11 @@ import test from 'ava';
|
||||||
import toElectronBackgroundColor from '../../app/utils/to-electron-background-color';
|
import toElectronBackgroundColor from '../../app/utils/to-electron-background-color';
|
||||||
import {isHexColor} from '../testUtils/is-hex-color';
|
import {isHexColor} from '../testUtils/is-hex-color';
|
||||||
|
|
||||||
test('toElectronBackgroundColor', t => {
|
test('toElectronBackgroundColor', (t) => {
|
||||||
t.false(false);
|
t.false(false);
|
||||||
});
|
});
|
||||||
|
|
||||||
test(`returns a color that's in hex`, t => {
|
test(`returns a color that's in hex`, (t) => {
|
||||||
const hexColor = '#BADA55';
|
const hexColor = '#BADA55';
|
||||||
const rgbColor = 'rgb(0,0,0)';
|
const rgbColor = 'rgb(0,0,0)';
|
||||||
const rgbaColor = 'rgb(0,0,0, 55)';
|
const rgbaColor = 'rgb(0,0,0, 55)';
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
import test from 'ava';
|
import test from 'ava';
|
||||||
const proxyquire = require('proxyquire').noCallThru();
|
const proxyquire = require('proxyquire').noCallThru();
|
||||||
|
|
||||||
test('positionIsValid() returns true when window is on only screen', t => {
|
test('positionIsValid() returns true when window is on only screen', (t) => {
|
||||||
const position = [50, 50];
|
const position = [50, 50];
|
||||||
const windowUtils = proxyquire('../../app/utils/window-utils', {
|
const windowUtils = proxyquire('../../app/utils/window-utils', {
|
||||||
electron: {
|
electron: {
|
||||||
|
|
@ -27,7 +27,7 @@ test('positionIsValid() returns true when window is on only screen', t => {
|
||||||
t.true(result);
|
t.true(result);
|
||||||
});
|
});
|
||||||
|
|
||||||
test('positionIsValid() returns true when window is on second screen', t => {
|
test('positionIsValid() returns true when window is on second screen', (t) => {
|
||||||
const position = [750, 50];
|
const position = [750, 50];
|
||||||
const windowUtils = proxyquire('../../app/utils/window-utils', {
|
const windowUtils = proxyquire('../../app/utils/window-utils', {
|
||||||
electron: {
|
electron: {
|
||||||
|
|
@ -61,7 +61,7 @@ test('positionIsValid() returns true when window is on second screen', t => {
|
||||||
t.true(result);
|
t.true(result);
|
||||||
});
|
});
|
||||||
|
|
||||||
test('positionIsValid() returns false when position isnt valid', t => {
|
test('positionIsValid() returns false when position isnt valid', (t) => {
|
||||||
const primaryDisplay = {
|
const primaryDisplay = {
|
||||||
workArea: {
|
workArea: {
|
||||||
x: 0,
|
x: 0,
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue