xgqfrms™, xgqfrms® : xgqfrms's offical website of cnblogs! xgqfrms™, xgqfrms® : xgqfrms's offical website of GitHub!

Linux Bash & rm -rf & Node.js & rimraf All In One

Linux Bash & rm -rf & Node.js & rimraf All In One

rm -rf / rimraf

Node.js delete dist folder
Node.js delete .map files

cli / build tools

rm -rf

$ rm -rf mydir

https://www.computerhope.com/unix/urm.htm

rimraf

# $ npm i -g rimraf

$ npm i -D rimraf

$ rimraf node_modules

https://www.npmjs.com/package/rimraf

demos

bash cli

# delete node_modules
$ find . -name "node_modules" -exec rm -rf '{}' +

image

npm script

delete node_modules folder
delete dist/build folder
delete all map.js files

// package.json
{
    "scripts": {
        "clean": "rm -rf dist",
        "clear": "rimraf dist"
    },
    "bin": {
        "rmrf": "rm-rf.js",
        "npm_cli_commands": "npm i & npm link"
    },
    "author": "xgqfrms",
    "license": "MIT",
    "devDependencies": {
        "rimraf": "^2.6.2"
    }
}

node.js cli tools

image

https://github.com/xgqfrms-GitHub/Node-CLI-Tools

demos


#! /usr/bin/env node

/**
 * [rmrf : node cli tools]
 * @author: xgqfrms
 * @date: 2017-01-01
 */

const path = require('path');
const rimraf = require('rimraf');

console.log(`hello world!`);
let folder_pathname = path.resolve(__dirname, "dist/js");

// https://github.com/isaacs/rimraf#api
// rimraf(f, [opts], callback);
rimraf.sync(folder_pathname, {}, function(){
    // callback
    console.log("this is a rmrf callback!");
});

// rimraf.sync(__dirname + '/target');

// fs.readFileSync(__dirname + '/src/template.ejs', 'utf-8')

// path: path.resolve(__dirname, "build/public/"),//主目录

// rimraf dist


(🐞 反爬虫测试!打击盗版⚠️)如果你看到这个信息, 说明这是一篇剽窃的文章,请访问 https://www.cnblogs.com/xgqfrms/ 查看原创文章!

refs

Node.js delete directory & file system All In One

https://www.cnblogs.com/xgqfrms/p/13272929.html

bin & cli & rm -rf & npm link

https://github.com/xgqfrms-GitHub/Node-CLI-Tools/issues/19

linux delete all node_modules folder

https://www.nextofwindows.com/three-ways-to-delete-node_modules-directory-or-any-file-name-too-long-folders

https://coderwall.com/p/guqrca/remove-all-node_module-folders-recursively

rm -rf

https://linuxhint.com/delete_file_bash/

https://www.computerhope.com/issues/ch000798.htm

https://stackoverflow.com/questions/41569788/delete-all-node-modules-subfolders

https://www.nextofwindows.com/three-ways-to-delete-node_modules-directory-or-any-file-name-too-long-folders



©xgqfrms 2012-2021

www.cnblogs.com/xgqfrms 发布文章使用:只允许注册用户才可以访问!

原创文章,版权所有©️xgqfrms, 禁止转载 🈲️,侵权必究⚠️!


posted @ 2018-09-20 17:09  xgqfrms  阅读(607)  评论(2编辑  收藏  举报