Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

产出到目标目录之前,清空目录 #3

Open
haledeng opened this issue Oct 29, 2015 · 6 comments
Open

产出到目标目录之前,清空目录 #3

haledeng opened this issue Oct 29, 2015 · 6 comments

Comments

@haledeng
Copy link

目前的问题: 加md5产出后,之前版本的文件还存在产出目录中。

@2betop
Copy link
Contributor

2betop commented Oct 29, 2015

嗯,一直都是这样的,原来的文件手动删吧。采用非覆盖式部署方式,老文件是不会删的。

@haledeng
Copy link
Author

能否提供一个配置项,是否清空原来的文件目录?
这样每次release之前,还需要手工删,太不智能了。

@haledeng
Copy link
Author

那发布到线上的dist,不是有很多历史版本的js、css等文件,这里最好提供一个删除功能,没有只保留当前构建的文件吧

@joviqiao
Copy link

joviqiao commented Dec 5, 2016

我也遇到这个问题,如果我已经部署过多,肯定已经到线上服务器或者cdn了
希望可以有 清空目的文件夹 的选项啊,当前烦死了,每次都要记得手动先清理一次

@joviqiao
Copy link

joviqiao commented Dec 5, 2016

我在conf.js 里面自己处理

var fs = require("fs");

var toPath = '../src/main/webapp/asset';

deleteFolderRecursive = function(path) {
    var files = [];
    if( fs.existsSync(path) ) {
        files = fs.readdirSync(path);
        files.forEach(function(file,index){
            var curPath = path + "/" + file;
            if(fs.statSync(curPath).isDirectory()) {
                deleteFolderRecursive(curPath);
            } else {
                fs.unlinkSync(curPath);
            }
        });
        fs.rmdirSync(path);
    }
};

if( fs.existsSync(toPath) ) {
    deleteFolderRecursive(toPath);
}

奇慢无比...

@qishenliang
Copy link

"scripts": {
"build": "rm -rf ../public && rm -rf ../app/views && fis3 release -d",
"watch": "fis3 release -w"
},

在目录的package配置,npm run build就可以了

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants