create nodejs cli select/options menu - node.js

How do you create an arrow-key menu list?
I'm looking for something like after entering in eslint init or create-react-app <project>? (see images below)
ESlint
yeoman
Searching around to find ways to create a CLI, I found NodeJS to be an option followed by a few tools: Commander.js, Vorpal, and/or create-new-cli.
If I am on the right track, how can I create a CLI arrow-key select menu?

I believe yeoman is using inquirer. Source: yo's dependencies.
I've also seen prompts which has a similar arrow selection feature and other cli ui/ux features. See the demos about halfway down the page.
Note: I've never actually used either, I'm just in the same research phase.

looks like 'inquirer' (npm i inquirer)
also for progress bars and such you should look at clui (npm i clui)
for parsing commands most use commander (npm commander) or the open cli framework (npm i oclif) - you can also look at yargs (very similar to commander, npm i yargs)
inquirer and clui work very well with both command parsers.
Have fun.

Related

CodeMix/Eclipse cannot find 'react/jsx-dev-runtime'

I'm completely new to React, Node, NPM, and CodeMix in Eclipse. I'm a veteran java developer and so want to use eclipse over VSCode for familiarity. I'm following this tutorial:
https://www.genuitec.com/react-tutorial-getting-started/
I get to step 5 and run
react-scripts start
The result:
./src/index.js
Module not found: Can't resolve 'react/jsx-dev-runtime' in 'C:\temp\workspace\CCFPortal\src'
I created my project via the new project to create a React project. The wizard added all the standard code. Bringing up the terminal gave me some issues because the terminal doesn't seem to set the path to bring nodejs.exe into scope, so I did it manually in the terminal window. Adjusting the properties in window->preferences terminal+ doesn't seem to ever take effect.
I did the following in npm (in addition to the steps in the tutorial) because there were two 'warnings' in the markers view that suggested it. As near as I can tell, all commands were successful whether from the tutorial or these two (though it does flag some 'vulnerabilities' in npm that I force fixed).
npm install #types/react
npm install #types/react-dom
It is indeed true that there is no react/jsx-dev-runtime under that src folder. There's NOTHING there but the src. But I'm unclear why it wasn't there given that I ran npm install and the other things suggested in the tutorial.
Can someone help explain my pathing issue in the terminal and especially why npm is doing this when I run react-scripts start?

Node.js - displaying ESLint errors in terminal like create-react-app

I'm working on a Node.js app using Express, and I want ESLint to display errors/warnings in the terminal with colors like the way "create-react-app" does.
There is a way to achieve that ?
Thanks.
Use the eslint npm package: https://www.npmjs.com/package/eslint
Follow the instructions to create a .eslintrc file. You're IDE should automatically read this and show the errors/warnings

Adding supertest to Aurelia causes error when building vendor bundle

I have a current project using aurelia.
I add the supertest library using npm.
npm install supertest --save-dev
Now add package to aurelia.json file
{
"name": "supertest",
"path": "../node_modules/supertest"
}
Now run aurelia build
au run
produces following error:
Tracing supertest...
error /Users/xxxxxxx/node_modules/supertest.js
Writing app-bundle.js...
I have tried everything I can think of to fix this. Any help would be appreciated.
I recommend you to use the aurelia-skeleton-navigation setup instead which uses Gulp and JSPM -> https://github.com/aurelia/skeleton-navigation. This will provide you more on control on your project.
Aurelia CLI is still on alpha, quoting from https://github.com/aurelia/cli:
Note: The CLI is currently in Alpha and as such may not be suitable for use on all projects yet. In particular, projects that need to make use of extensive 3rd party libraries or Aurelia plugins may not yet work or may require extensive custom configuration or workarounds. We are in the process of addressing these issues.
Emphasis on extensive custom configuration or workarounds lol. I myself tried the CLI initially but ended up switching to Gulp and JSPM setup instead because of the tedious importing of external libraries.

Yeoman hangs on line 72 of events.js, won't let me do anything

First of all, I'm running this on Windows 8.
So When I install yeoman with npm install -g yo, it seems to work fine.
Then, when I type in the command yo, I get the usual response of:
[?] What would you like to do? (Use arrow keys)
Run the Famous generator (0.2.10)
Update your generators
Install a generator
Find some help
Get me out of here!
But then when I click on, for example,
Update your Generators
I get the following:
Its the exact same error every time, and it's preventing me from using any yeoman generators, which is making it impossible then to use the new Famo.us engine.
So far, I've tried uninstalling and reinstalling Node, Yeoman, and everything in between. I've also tried it in various command prompts, including the standard Windows Command Prompt, Git Bash, NodeJS commandPrompt, and cygwin.
Does anyone know how I can fix this?
One avenue of action I've been thinking about is trying to find this events.js (or whatever other file this error is originating from) and trying to build from there.
Also, this person # Yeoman gifsicle error (and others) seems to be having similar issues, but the fixes mentioned in that question don't seem to be working for me.
Thanks!

What does npm mean for socket.io/installing stuff?

I'm a real noob at this. I've just began scratching the surface on node.js/socket.io/html5 and stuff. I finally figured out how to use my command prompt (using windows) to launch a "hello world" application with the command "node example.js." But what does npm mean? When I'm looking at socket.io it says to install, npm install socket.io Does that mean I need to extract all the files into my nodejs folder?
I'm confused.
npm is a generally awesome program for managing packages and dependencies (especially while you have a network connection). It does lots of fancy things and is most commonly used with node.js projects. That said, it's an unfortunately common misconception that the acronym stands for "node package manager".
In reality, npm doesn't actually stand for anything as it's not an acronym. With taglines like "no problem, meatbag" the npm organization playfully resists the trend of acronymization. It should always be referenced in lowercase to avoid confusion with the National Association of Pastoral Musicians.
npm is a command line interface program to manage node.js libraries (it stands for node package manager - at least it did initially, they since turned this into a bit of a running gag - thanks to #spex in the comments for that link). Check out the docs, it is awesome and amazing. As you mentioned, just type npm install in a command prompt, and voilĂ , you have the library in your local node modules.
npm is stands for Non-Parametric Mapping utility written by Chris Rorden...
But we can keep it as Node Package Manager and it is very helpful for Module Loader which uses CommmonJS module pattern, and I am not sure will Node will support the ES2015 Module Loading Syntax (Built in module Loading Syntax)?
for those who are wondering the same thing, you just type npm install socket.io in the command prompt where nodejs file is.
C:/Program Files/nodejs
That should be what your command prompt should say and then just type that in.

Resources