api updates

This commit is contained in:
Guillermo Rauch 2016-10-06 08:28:43 -07:00
parent 36c55a6580
commit 9f771e839f
8 changed files with 38 additions and 27 deletions

View file

@ -9,7 +9,7 @@ const {version} = require('./package');
const platform = process.platform === 'darwin' ?
'osx' :
process.platform;
const FEED_URL = `https://hyperterm-updates.now.sh/update/${platform}`;
const FEED_URL = `https://hyper-updates.now.sh/update/${platform}`;
let isInit = false;
function init() {

View file

@ -1,5 +1,5 @@
const {homedir} = require('os');
const {readFileSync, writeFileSync} = require('fs');
const {statSync, renameSync, readFileSync, writeFileSync} = require('fs');
const {resolve} = require('path');
const vm = require('vm');
@ -16,7 +16,8 @@ const winCfg = new Config({
}
});
const path = resolve(homedir(), '.hyperterm.js');
const path = resolve(homedir(), '.hyper.js');
const pathLegacy = resolve(homedir(), '.hyperterm.js');
const watchers = [];
let cfg = {};
@ -29,7 +30,7 @@ function watch() {
this.on('changed', () => {
try {
if (exec(readFileSync(path, 'utf8'))) {
notify('HyperTerm configuration reloaded!');
notify('Hyper configuration reloaded!');
watchers.forEach(fn => fn());
}
} catch (err) {
@ -72,6 +73,16 @@ exports.subscribe = function (fn) {
};
exports.init = function () {
// for backwards compatibility with hyperterm
// (prior to the renme), we try to rename
// on behalf of the user
try {
const stat = statSync(pathLegacy);
renameSync(pathLegacy, path);
} catch (err) {
// ignore
}
try {
exec(readFileSync(path, 'utf8'));
} catch (err) {

View file

@ -1,13 +1,13 @@
{
"name": "hyperterm",
"productName": "HyperTerm",
"version": "0.8.0",
"name": "hyper",
"productName": "Hyper",
"version": "0.8.1",
"license": "MIT",
"author": {
"name": "Zeit, Inc.",
"email": "team@zeit.co"
},
"repository": "zeit/hyperterm",
"repository": "zeit/hyper",
"description": "HTML/JS/CSS Terminal",
"dependencies": {
"child_pty": "3.0.1",

View file

@ -16,8 +16,8 @@ const notify = require('./notify');
const cache = new Config();
// modules path
const path = resolve(homedir(), '.hyperterm_plugins');
const localPath = resolve(homedir(), '.hyperterm_plugins', 'local');
const path = resolve(homedir(), '.hyper_plugins');
const localPath = resolve(homedir(), '.hyper_plugins', 'local');
const availableExtensions = new Set([
'onApp', 'onWindow', 'onUnload', 'middleware',
'reduceUI', 'reduceSessions', 'decorateMenu',
@ -78,12 +78,12 @@ function updatePlugins({force = false} = {}) {
} else {
notify(
'Error updating plugins.',
'Check `~/.hyperterm_plugins/npm-debug.log` for more information.'
'Check `~/.hyper_plugins/npm-debug.log` for more information.'
);
}
} else {
// flag successful plugin update
cache.set('hyperterm.plugins', id_);
cache.set('hyper.plugins', id_);
// cache paths
paths = getPaths(plugins);
@ -97,8 +97,8 @@ function updatePlugins({force = false} = {}) {
const loaded = modules.length;
const total = paths.plugins.length + paths.localPlugins.length;
const pluginVersions = JSON.stringify(getPluginVersions());
const changed = cache.get('hyperterm.plugin-versions') !== pluginVersions && loaded === total;
cache.set('hyperterm.plugin-versions', pluginVersions);
const changed = cache.get('hyper.plugin-versions') !== pluginVersions && loaded === total;
cache.set('hyper.plugin-versions', pluginVersions);
// notify watchers
if (force || changed) {
@ -154,7 +154,7 @@ exports.updatePlugins = updatePlugins;
// we schedule the initial plugins update
// a bit after the user launches the terminal
// to prevent slowness
if (cache.get('hyperterm.plugins') !== id || process.env.HYPERTERM_FORCE_UPDATE) {
if (cache.get('hyper.plugins') !== id || process.env.HYPER_FORCE_UPDATE) {
// install immediately if the user changed plugins
console.log('plugins have changed / not init, scheduling plugins installation');
setTimeout(() => {
@ -168,13 +168,13 @@ setInterval(updatePlugins, ms('5h'));
function syncPackageJSON() {
const dependencies = toDependencies(plugins);
const pkg = {
name: 'hyperterm-plugins',
description: 'Auto-generated from `~/.hyperterm.js`!',
name: 'hyper-plugins',
description: 'Auto-generated from `~/.hyper.js`!',
private: true,
version: '0.0.1',
repository: 'zeit/hyperterm',
repository: 'zeit/hyper',
license: 'MIT',
homepage: 'https://hyperterm.org',
homepage: 'https://hyper.is',
dependencies
};
@ -276,7 +276,7 @@ function requirePlugins() {
const exposed = mod && Object.keys(mod).some(key => availableExtensions.has(key));
if (!exposed) {
notify('Plugin error!', `Plugin "${basename(path)}" does not expose any ` +
'HyperTerm extension API methods');
'Hyper extension API methods');
return;
}

View file

@ -17,7 +17,7 @@ try {
'A native module failed to load. Typically this means ' +
'you installed the modules incorrectly.\n Use `scripts/install.sh` ' +
'to trigger the installation.\n ' +
'More information: https://github.com/zeit/hyperterm/issues/72'
'More information: https://github.com/zeit/hyper/issues/72'
);
}

View file

@ -213,9 +213,9 @@ export function showPreferences() {
dispatch(sendSessionData(
uid,
// Leading space prevents command to be store in shell history
[' echo Attempting to open ~/.hyperterm.js with your \$EDITOR', // eslint-disable-line no-useless-escape
[' echo Attempting to open ~/.hyper.js with your \$EDITOR', // eslint-disable-line no-useless-escape
' echo If it fails, open it manually with your favorite editor!',
' bash -c \'exec env ${EDITOR:=' + editorFallback + '} ~/.hyperterm.js\'',
' bash -c \'exec env ${EDITOR:=' + editorFallback + '} ~/.hyper.js\'',
''
].join('\n')
));

View file

@ -82,7 +82,7 @@ export default class Notifications extends Component {
window.require('electron').shell.openExternal(ev.target.href);
ev.preventDefault();
}}
href={`https://github.com/zeit/hyperterm/releases/tag/${this.props.updateVersion}`}
href={`https://github.com/zeit/hyper/releases/tag/${this.props.updateVersion}`}
>notes</a>).
{' '}
<a

View file

@ -1,8 +1,8 @@
{
"name": "hyperterm",
"name": "hyper",
"version": "0.8.0",
"description": "Web app that runs in the renderer process",
"repository": "zeit/hyperterm",
"repository": "zeit/hyper",
"license": "MIT",
"author": {
"name": "Zeit, Inc.",
@ -89,7 +89,7 @@
]
},
"build": {
"appId": "co.zeit.hyperterm",
"appId": "co.zeit.hyper",
"asar": false,
"extend-info": "build/Info.plist",
"linux": {