Tag: install

Using Shell Commands in JS-Projects or in Scripts in package.json

1. ShellJS

ShellJS is a portable (Windows/Linux/OS X) implementation of Unix shell commands on top of the Node.js API. You can use it to eliminate your shell script’s dependency on Unix while still keeping its familiar and powerful commands. You can also install it globally so you can run it from outside Node projects – say goodbye to those gnarly Bash scripts!

$ npm install [-g] shelljs

2. Shx

shx is a wrapper around ShellJS Unix commands, providing an easy solution for simple Unix-like, cross-platform commands in npm package scripts.

$ npm install shx --save-dev

Difference Between ShellJS and shx

  • ShellJS: Good for writing long scripts, all in JS, running via NodeJS (e.g. node myScript.js).
  • shx: Good for writing one-off commands in npm package scripts (e.g. "clean": "shx rm -rf out/").


Adding SASS Support in Angular Projects

Once the project is generated with Angular/CLI, set default style extension:

ng set defaults.styleExt scss

After you have generated a new component:

ng g c MyComponent

you will see MyComponent.scss in your MyComponent folder.

If you open the scss-file, WebStorm will ask you, if you want to add file-watchers for this type of extension. This procedure is normally not necessary, because angular/cliwill generate and update your project automatically.

Anyway, If you want to add file-watcher for SCSS (on McOS):

  1.  brew install ruby
  2. gem install sass

WebStorm will automatically recognize the installation path (on McOS /usr/local/bin/scss).

Brew node / npm Problem: Error: Cannot find module ‘semver’

  • sudo rm -rf /usr/local/lib/node_modules
  • sudo rm -rf ~/.npm
  • brew uninstall –force node
  • brew install node

Yarn vs NPM

Commons: init, link, outdated, publish, run, cache clean, login, logout, test
npm install
npm install foo --save
yarn add foo
npm uninstall foo --save
yarn remove foo
npm install foo --save-dev
yarn add foo --dev
npm update --save
yarn upgrade
npm install foo@latest --save
yarn add foo
npm install foo --global
yarn add foo global
npm install npm@latest
yarn self-update
npm install --production
yarn --production
Only Yarn
yarn licenses ls
yarn licenses generate-disclaimer
yarn why foo
yarn upgrade-interactive
Only NPM
npm xmas
npm visnup

Copyright © 2020 EBIA

Theme by Anders NorenUp ↑