Spaceship-prompt: Ember version takes too long (is unusable)

Created on 27 Jun 2017  路  6Comments  路  Source: denysdovhan/spaceship-prompt

Issue

Using the ember option adds ~4-6 seconds to each command.

Screenshot

ember-version-spaceship

Running ember version on bigger apps can take up to ~4-5 seconds.

Environment

Operating system: macOS
Terminal emulator: iTerm
ZSH version: 5.3.1 (x86_64-apple-darwin16.3.0)

Relevant .zshrc

SPACESHIP_PROMPT_ORDER=(
  time          # Time stampts section
  user          # Username section
  host          # Hostname section
  dir           # Current directory section
  git           # Git section (git_branch + git_status)
  hg            # Mercurial section (hg_branch  + hg_status)
  package       # Package version
  node          # Node.js section
  ruby          # Ruby section
  ember         # Ember.js section
  exec_time     # Execution time
  line_sep      # Line break
  jobs          # Backgound jobs indicator
  exit_code     # Exit code section
  char          # Prompt character
)
bug help-wanted

Most helpful comment

@denysdovhan it might be faster to just do a simple grep on the installed ember-cli package.json. Using npm view ember-cli version is a lot quicker then ember version but still takes ~1-2s.

@thebluejay I'm not sure if this is the direction you may want to go but you can try something like this:

node -p "require('./node_modules/ember-cli/package.json').version"

or

grep '"version":' ./node_modules/ember-cli/package.json | cut -d\" -f4

All 6 comments

@thebluejay has been working on this.

Usefulness of ember section is questionable. If problem won't be fixed, it's gonna be removed out of Spaceship.

@denysdovhan it might be faster to just do a simple grep on the installed ember-cli package.json. Using npm view ember-cli version is a lot quicker then ember version but still takes ~1-2s.

@thebluejay I'm not sure if this is the direction you may want to go but you can try something like this:

node -p "require('./node_modules/ember-cli/package.json').version"

or

grep '"version":' ./node_modules/ember-cli/package.json | cut -d\" -f4

npm view ember-cli version was working fast enough for me, but timing them, your second solution is much faster @offirgolan. I think that will do nicely.

@thebluejay awesome, glad I could help out! Let me know when a new release gets published 馃槃

How to get that via written with node version in the terminal

@Ayanrocks

How to get that via written with node version in the terminal

via is the default prefix and it's used in multiple sections including node. It'll be displayed only when triggered with specific files like package.json or *.js or node_modules directory.

Please open a new issue if your concern is not resolved.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Vvkmnn picture Vvkmnn  路  3Comments

nfischer picture nfischer  路  3Comments

MatthiasJ picture MatthiasJ  路  4Comments

maccius picture maccius  路  3Comments

martincartledge picture martincartledge  路  4Comments