PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Friday, October 21, 2022

[FIXED] How to clean (delete contents) folder with npm

 October 21, 2022     deployment, npm     No comments   

Issue

I am trying to deploy a web project but before build it, I need to clear/delete the dist folder.

I could add a script that would run rm -rf dist/* but that would not work on Windows system.

Is there some npm package u other solution that allows deleting a folder with a command that works in every OS?


Solution

You can use rimraf: https://github.com/isaacs/rimraf.

Note that if you are using globs containing the globstar (**), you must double-quote them. Unix systems don't all support the globstar by default, but rimraf will expand them for you. Windows doesn't support single-quotes, so those can't be used. Remember that double-quotes must be escaped in JSON with a \.



Answered By - RyanZim
Answer Checked By - Gilberto Lyons (PHPFixing Admin)
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing