...
|
...
|
@@ -52,6 +52,8 @@ class Build { |
|
|
self.version = pkg.version;
|
|
|
self.pkgName = pkg.name;
|
|
|
|
|
|
sh.rm('-rf', path.join(self.codePath, 'public/dist/'));
|
|
|
|
|
|
return self._installdep();
|
|
|
}).then(() => {
|
|
|
return self._buildScript();
|
...
|
...
|
@@ -75,6 +77,10 @@ class Build { |
|
|
get buildPath() {
|
|
|
return path.join(config.buildDir, this.project.name, this.buildTime, this.pkgName);
|
|
|
}
|
|
|
|
|
|
get sourceMapPath() {
|
|
|
return path.join(config.sourceMapDir, this.project.name);
|
|
|
}
|
|
|
|
|
|
get rootPath() {
|
|
|
return path.join(config.buildDir, this.project.name, this.buildTime);
|
...
|
...
|
@@ -91,6 +97,10 @@ class Build { |
|
|
if (!sh.test('-e', config.codeDir)) {
|
|
|
sh.mkdir('-p', config.codeDir);
|
|
|
}
|
|
|
|
|
|
if (!sh.test('-e', config.sourceMapDir)) {
|
|
|
sh.mkdir('-p', config.sourceMapDir);
|
|
|
}
|
|
|
|
|
|
if (!sh.test('-e', this.rootPath)) {
|
|
|
sh.mkdir('-p', this.rootPath);
|
...
|
...
|
@@ -216,11 +226,23 @@ class Build { |
|
|
this._log('>>>>>>>>> clone to deploy folder >>>>>>>>>>');
|
|
|
return new Promise((resolve, reject) => {
|
|
|
let projectRoot = `public/dist/${self.pkgName}/`;
|
|
|
let copyPath = path.join(self.codePath, projectRoot);
|
|
|
|
|
|
self._state('clone to deploy');
|
|
|
|
|
|
sh.cd(copyPath);
|
|
|
|
|
|
sh.find('.').filter(file => file.match(/\.map$/)).forEach(file => {
|
|
|
const destFile = path.join(this.sourceMapPath, file);
|
|
|
const firdir = path.dirname(destFile);
|
|
|
if (!sh.test('-e', firdir)) {
|
|
|
sh.mkdir('-p', firdir);
|
|
|
}
|
|
|
sh.mv(path.join(copyPath, file), destFile)
|
|
|
});
|
|
|
|
|
|
// assets folder & version folder
|
|
|
var child = sh.cp('-r', path.join(self.codePath, projectRoot), self.buildPath);
|
|
|
var child = sh.cp('-r', copyPath, self.buildPath);
|
|
|
|
|
|
if (child.code === 0) {
|
|
|
console.log('cope to deploy success');
|
...
|
...
|
|