mirror of
https://gitee.com/openharmony/developtools_ace_js2bundle
synced 2024-11-23 07:20:22 +00:00
!628 Differences in synchronization codes between blue and yellow areas
Merge pull request !628 from 李欣楠/master
This commit is contained in:
commit
f7070250b4
@ -12,6 +12,7 @@
|
|||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
const fs = require('fs');
|
const fs = require('fs');
|
||||||
const path = require('path');
|
const path = require('path');
|
||||||
const moduleSource = require('./module-source');
|
const moduleSource = require('./module-source');
|
||||||
@ -21,46 +22,51 @@ const exists = function(src, dst, callback) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
fs.exists(dst, function(exists) {
|
fs.exists(dst, function(exists) {
|
||||||
if(exists){
|
if (exists) {
|
||||||
callback(src, dst);
|
callback(src, dst);
|
||||||
} else{
|
} else {
|
||||||
fs.mkdir(dst, function() {
|
fs.mkdir(dst, function() {
|
||||||
callback(src, dst);
|
callback(src, dst);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
};
|
||||||
|
|
||||||
stat = fs.stat;
|
stat = fs.stat;
|
||||||
const copy = function(src, dst){
|
const copy = function(src, dst) {
|
||||||
fs.readdir(src, function(err, paths){
|
fs.readdir(src, function(err, paths) {
|
||||||
if(err){
|
if (err) {
|
||||||
throw err;
|
throw err;
|
||||||
}
|
}
|
||||||
paths.forEach(function(_path){
|
paths.forEach(function(_path) {
|
||||||
var _src = src + '/' + _path,
|
copyForEach(src, dst, _path);
|
||||||
_dst = dst + '/' + _path,
|
|
||||||
readable, writable;
|
|
||||||
stat(_src, function(err, st){
|
|
||||||
if(err){
|
|
||||||
throw err;
|
|
||||||
}
|
|
||||||
if(st.isFile()){
|
|
||||||
const pathInfo = path.parse(_src);
|
|
||||||
if (pathInfo.name === 'gulpfile' || pathInfo.ext !== '.js') {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
readable = fs.createReadStream(_src);
|
|
||||||
writable = fs.createWriteStream(_dst);
|
|
||||||
readable.pipe(writable);
|
|
||||||
} else if(st.isDirectory()){
|
|
||||||
exists(_src, _dst, copy);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
function copyForEach(src, dst, _path) {
|
||||||
|
let _src = src + '/' + _path;
|
||||||
|
let _dst = dst + '/' + _path;
|
||||||
|
let readable = null;
|
||||||
|
let writable = null;
|
||||||
|
stat(_src, function(err, st) {
|
||||||
|
if (err) {
|
||||||
|
throw err;
|
||||||
|
}
|
||||||
|
if (st.isFile()) {
|
||||||
|
const pathInfo = path.parse(_src);
|
||||||
|
if (pathInfo.name === 'gulpfile' || pathInfo.ext !== '.js') {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
readable = fs.createReadStream(_src);
|
||||||
|
writable = fs.createWriteStream(_dst);
|
||||||
|
readable.pipe(writable);
|
||||||
|
} else if (st.isDirectory()) {
|
||||||
|
exists(_src, _dst, copy);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
moduleSource.copyResource(path.resolve(__dirname, './third_party/weex-loader/deps/weex-scripter'), process.argv[2] + '/scripter');
|
moduleSource.copyResource(path.resolve(__dirname, './third_party/weex-loader/deps/weex-scripter'), process.argv[2] + '/scripter');
|
||||||
moduleSource.copyResource(path.resolve(__dirname, './third_party/weex-loader/deps/weex-styler'), process.argv[2] + '/styler');
|
moduleSource.copyResource(path.resolve(__dirname, './third_party/weex-loader/deps/weex-styler'), process.argv[2] + '/styler');
|
||||||
moduleSource.copyResource(path.resolve(__dirname, './third_party/parse5/packages/parse5/dist/cjs'), process.argv[2] + '/parse');
|
moduleSource.copyResource(path.resolve(__dirname, './third_party/parse5/packages/parse5/dist/cjs'), process.argv[2] + '/parse');
|
||||||
|
@ -71,4 +71,4 @@ copyResource(path.resolve(__dirname, './plugin/codegen'), process.argv[2] + '/co
|
|||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
copyResource
|
copyResource
|
||||||
}
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user