NPM - pre & post scripts

  Рет қаралды 15,054

Steve Griffith - Prof3ssorSt3v3

Steve Griffith - Prof3ssorSt3v3

Күн бұрын

Пікірлер: 33
@Colstonewall
@Colstonewall 5 жыл бұрын
This type of tutorial (NPM Scripts) is far underutilized. It's something that needs to be taught, and I don't think I've seen anyone else do a vid on it. Thanks Steve.
@SteveGriffith-Prof3ssorSt3v3
@SteveGriffith-Prof3ssorSt3v3 5 жыл бұрын
I've got a bunch more NodeJS and NPM videos coming in the near future.
@rotrose7531
@rotrose7531 4 жыл бұрын
Thank you for explaining these wonderful and useful details. You are the best teacher because you know what a student does not know.
@mmesba
@mmesba 3 жыл бұрын
Your contents are always valuable
@tengun
@tengun 5 жыл бұрын
Great video as always. Thank you!
@fibrecompany5093
@fibrecompany5093 4 жыл бұрын
love your work man
@yairvolloch1556
@yairvolloch1556 2 жыл бұрын
Is there a way to define a pre script for several scripts? Meaning it'll run before scripts A, B, C...
@SteveGriffith-Prof3ssorSt3v3
@SteveGriffith-Prof3ssorSt3v3 2 жыл бұрын
Any script can have a pre and a post script. Each script can have any number of commands, including calling other scripts.
@questreal5812
@questreal5812 4 жыл бұрын
what would be the difference between doing it this way and using "&&" instead? For example, wouldn't "touch .gitignore && echo \"\" > .gitignore && echo \".gitignore .vscode/ node_modules/\" >> .gitignore" achieve the same thing?
@SteveGriffith-Prof3ssorSt3v3
@SteveGriffith-Prof3ssorSt3v3 4 жыл бұрын
yes. But the point is that you can have automated tasks that run before and after any script without always having to explicitly writing them out with the &&. Those scripts could call other scripts or run shell scripts that do lots of things.
@5ystemNoveary
@5ystemNoveary 5 жыл бұрын
Great video, thanks sir. But i got an error: 'touch' is not recognized as an internal or external command, operable program or batch file.
@SteveGriffith-Prof3ssorSt3v3
@SteveGriffith-Prof3ssorSt3v3 5 жыл бұрын
touch is a Mac or Linux command. If you are using Windows then you have to create the file another way. blog.jongallant.com/2016/11/windows-touch-equivalent/
@kensyjolicoeur
@kensyjolicoeur 5 жыл бұрын
i'm using windows : echo filecontent > filename.fileextension
@nikolasashorov9851
@nikolasashorov9851 4 жыл бұрын
you can use git bash terminal
@radoslavtsanev6822
@radoslavtsanev6822 4 жыл бұрын
windows command - type nul > .gitignore
@mrray3695
@mrray3695 2 жыл бұрын
check your file directory if you are specifying the correct path
@MohammedAhmed-zm7qw
@MohammedAhmed-zm7qw 3 жыл бұрын
Thank Y❤U
@kensyjolicoeur
@kensyjolicoeur 5 жыл бұрын
thank you 1000 times
@alvinacosta2312
@alvinacosta2312 4 жыл бұрын
thanks for this but a ran into a problem. "ignore": "echo \"\" > .gitignore", "preignore": "type nul > .gitignore", "postignore": "echo \"node_modules/ .gitignore .vscode/\" > .gitignore" I am running these scripts but I get an empty string in my gitignore file. Any help is appreciated!
@stanleychukwu7424
@stanleychukwu7424 3 жыл бұрын
trying using the >> in the postignore file, then what is the type nul for? maybe you don't need the pre script at all.. or have you fixed it?
@someoneelse4123
@someoneelse4123 3 жыл бұрын
On windows I get an empty string and it tries to output to console, I have used many different search terms and haven't figured it out.
@SteveGriffith-Prof3ssorSt3v3
@SteveGriffith-Prof3ssorSt3v3 3 жыл бұрын
The problem is likely connected to the touch command, which works on MacOS and Linux but not the Windows command line. This stackoverflow post does a good job talking about how to achieve the same things on windows. stackoverflow.com/questions/30011267/create-an-empty-file-on-the-commandline-in-windows-like-the-linux-touch-command
@ningzhou8397
@ningzhou8397 4 жыл бұрын
how to fix the following error? npm ERR! Line breaks can't be quoted on Windows
@SteveGriffith-Prof3ssorSt3v3
@SteveGriffith-Prof3ssorSt3v3 4 жыл бұрын
The error message is saying that you can't use line breaks in the quoted commands.
@ningzhou8397
@ningzhou8397 4 жыл бұрын
@@SteveGriffith-Prof3ssorSt3v3 thanks Steve for your comment, I searched the solution but cannot find any yet, by the way, great videos!
@juhandvan
@juhandvan 5 жыл бұрын
thank you so much
@coffeymay6775
@coffeymay6775 4 жыл бұрын
What is the benefit of creating files this way?
@SteveGriffith-Prof3ssorSt3v3
@SteveGriffith-Prof3ssorSt3v3 4 жыл бұрын
Creating files was just a placeholder activity. You can do whatever you want in the pre and post scripts.
@heitormr2509
@heitormr2509 4 жыл бұрын
Cara,isso não funcionou'-'
@TechWithAchiever
@TechWithAchiever 4 жыл бұрын
Thank you so much, Steve, I am learning a ton on these series. Btwn, I run "npm run ignore" it just adds quotes in the file, and not the expected, would you mind helping? see pastebin.com/FB2WMF4v
@SteveGriffith-Prof3ssorSt3v3
@SteveGriffith-Prof3ssorSt3v3 4 жыл бұрын
It is the backslashes that you are adding before the quotes. "echo \"\" >> .gitignore", You are telling it to write "" in the file.
@TechWithAchiever
@TechWithAchiever 4 жыл бұрын
@@SteveGriffith-Prof3ssorSt3v3 Thank you for replying, please see attached its exactly how you did it in the video and it worked for you, i truly hope it will work for me too. ibb.co/PGbRQR6
Things Every Developer Should Know About package.json
15:41
Steve Griffith - Prof3ssorSt3v3
Рет қаралды 49 М.
NodeJS Web Server - Handling HTTP Requests
26:27
Steve Griffith - Prof3ssorSt3v3
Рет қаралды 38 М.
npm for absolute beginners
15:32
Kevin Powell
Рет қаралды 23 М.
Was NPM hacked for 2 hours?
7:15
Mehul - Codedamn
Рет қаралды 13 М.
How the Heck Do API Keys Work?
39:43
Steve Griffith - Prof3ssorSt3v3
Рет қаралды 45 М.
Making HTTP Requests from NodeJS
10:39
Steve Griffith - Prof3ssorSt3v3
Рет қаралды 54 М.
Package JSON Demystified - Dependencies and DevDependencies
11:30
A shot of code
Рет қаралды 3,3 М.
NPM Crash Course
42:03
Traversy Media
Рет қаралды 331 М.
ЧТО ТАКОЕ Node Package Manager(NPM) за 12 минут??? (2020)
11:56
NPM пакет от А до Я. Для нубов
22:15
WebDev с нуля. Канал Алекса Лущенко
Рет қаралды 24 М.