npm init uses npx under the hood (#tilPost)

Today I read Tierney Cyren’s article 11 Simple npm Tricks That Will Knock Your Wombat Socks Off. The article includes a bunch of npm magic, but one included idea made me stop. Tierney creates GitHub repositories while calling npm in…


This content originally appeared on Stefan Judis Web Development and was authored by Stefan Judis

Today I read Tierney Cyren's article 11 Simple npm Tricks That Will Knock Your Wombat Socks Off. The article includes a bunch of npm magic, but one included idea made me stop. Tierney creates GitHub repositories while calling npm init using an npm init script. Avoiding the step to go to GitHub and create a new repository manually is a fabulous idea. I started reading the npm docs on how to do that.

While reading, I learned that npm init translates to npx when you define an initializer (npm init [initializer]). ?

npm init foo -> npx create-foo
npm init @usr/foo -> npx @usr/create-foo
npm init @usr -> npx @usr/create

This behavior is quite handy, and it led me in a different direction. I couldn't hold it and had to publish a quick module to scaffold my future Node.js projects.

npm init @stfnjds

# or

npx @stfnjds

You can use it as a GitHub template if you need a quick way to start projects. ?


Reply to Stefan


This content originally appeared on Stefan Judis Web Development and was authored by Stefan Judis


Print Share Comment Cite Upload Translate
APA
Stefan Judis | Sciencx (2023-02-04T22:33:30+00:00) » npm init uses npx under the hood (#tilPost). Retrieved from https://www.scien.cx/2020/07/12/npm-init-uses-npx-under-the-hood-tilpost/.
MLA
" » npm init uses npx under the hood (#tilPost)." Stefan Judis | Sciencx - Sunday July 12, 2020, https://www.scien.cx/2020/07/12/npm-init-uses-npx-under-the-hood-tilpost/
HARVARD
Stefan Judis | Sciencx Sunday July 12, 2020 » npm init uses npx under the hood (#tilPost)., viewed 2023-02-04T22:33:30+00:00,<https://www.scien.cx/2020/07/12/npm-init-uses-npx-under-the-hood-tilpost/>
VANCOUVER
Stefan Judis | Sciencx - » npm init uses npx under the hood (#tilPost). [Internet]. [Accessed 2023-02-04T22:33:30+00:00]. Available from: https://www.scien.cx/2020/07/12/npm-init-uses-npx-under-the-hood-tilpost/
CHICAGO
" » npm init uses npx under the hood (#tilPost)." Stefan Judis | Sciencx - Accessed 2023-02-04T22:33:30+00:00. https://www.scien.cx/2020/07/12/npm-init-uses-npx-under-the-hood-tilpost/
IEEE
" » npm init uses npx under the hood (#tilPost)." Stefan Judis | Sciencx [Online]. Available: https://www.scien.cx/2020/07/12/npm-init-uses-npx-under-the-hood-tilpost/. [Accessed: 2023-02-04T22:33:30+00:00]
rf:citation
» npm init uses npx under the hood (#tilPost) | Stefan Judis | Sciencx | https://www.scien.cx/2020/07/12/npm-init-uses-npx-under-the-hood-tilpost/ | 2023-02-04T22:33:30+00:00
https://github.com/addpipe/simple-recorderjs-demo