Skip to content

[WIP] Hyper CLI#2337

Closed
chabou wants to merge 6 commits into
vercel:canaryfrom
chabou:embed_hpm
Closed

[WIP] Hyper CLI#2337
chabou wants to merge 6 commits into
vercel:canaryfrom
chabou:embed_hpm

Conversation

@chabou
Copy link
Copy Markdown
Contributor

@chabou chabou commented Oct 9, 2017

Will fix #2288

@chabou
Copy link
Copy Markdown
Contributor Author

chabou commented Oct 9, 2017

  • Hyper CLI javascript file is bootstrapped by scripts (located in build/(mac|win|linux)/)
  • Right platform script(s) are copied at build time to bin/
  • At Hyper startup time (only in production mode), platform script is symlinked to /usr/local/bin (or /usr/bin/ on Linux)

For now, only macOS has been tested and it works great:

  • Build Hyper yarn dist -- -m
  • Launch ./dist/mac/Hyper.app
  • Type hyper <args>
  • are printed

Copy link
Copy Markdown
Contributor

@albinekb albinekb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks 👍 to me, just a few comments. Awesome job, and nice that we're looking at what VS Code does as their setup seems to work great.

Comment thread app/utils/cli-install.js
const target = process.platform === 'darwin' ? '/usr/local/bin/hyper' : '/usr/bin/hyper';
const source = cliScriptPath;

const checkInstall = () => {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would write all these promise-chain-functions without the return statement (implicit return) saves a few lines and also makes the code more readable, but if it's like this in the readme, keep it. 👍 (very very minor thing 😂 )

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll change that

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I really prefer a first explicit return in these functions

Comment thread app/index.js
console.log('running in prod mode');
if (process.platform === 'win32') {
//eslint-disable-next-line no-console
addBinToUserPath().catch(err => console.error('Failed to add Hyper CLI path to user PATH', err));
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this be shown to the user (notification) or not?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not enough place to print error in notification.
On macOS, error could be read in Console.app. But I don't know for other platform

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's keep it as it is and see if it's needed later on 👍 Let's not over engineer it

Comment thread app/index.js
addBinToUserPath().catch(err => console.error('Failed to add Hyper CLI path to user PATH', err));
} else {
//eslint-disable-next-line no-console
addSymlink().catch(err => console.error('Failed to symlink Hyper CLI', err));
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same with this one, shown to the user or just a log?

Comment thread app/package.json Outdated
"queue": "4.4.0",
"semver": "5.4.1",
"shell-env": "0.3.0",
"util.promisify": "false1.0.0",
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I forgot to remove it from this file.
I replaced util.promisify by pify.
Promisify built-in is only available from node v8.x and we are using v7.9.0 (with Electron v1.7.8).

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 No probs

Copy link
Copy Markdown
Contributor

@albinekb albinekb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove line 30 of package.json
"util.promisify": "false1.0.0",

Copy link
Copy Markdown
Contributor

@albinekb albinekb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A W E S O M E 💯 I like this PR, it's not too huge and does only one thing, very :nice:

@chabou chabou closed this Oct 10, 2017
@chabou chabou deleted the embed_hpm branch October 10, 2017 22:32
@chabou
Copy link
Copy Markdown
Contributor Author

chabou commented Oct 10, 2017

I'm closing this PR.
As @albinekb asked, I'm creating a feature branch with multiple PR to make review easier.

@chabou chabou mentioned this pull request Oct 10, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Hyper CLI

2 participants