123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107 |
- "use strict";
- var Cpx = require("./cpx");
- exports.Cpx = Cpx;
- exports.copy = function copy(source, outDir) {
- var options = arguments.length <= 2 || arguments[2] === undefined ? null : arguments[2];
- var cb = arguments.length <= 3 || arguments[3] === undefined ? null : arguments[3];
- if (typeof options === "function") {
-
- cb = options;
- options = null;
-
- }
- var cpx = new Cpx(source, outDir, options);
- if (options && options.clean) {
- cpx.clean(function (err) {
- if (err == null) {
- cpx.copy(cb);
- } else if (cb != null) {
- cb(err);
- }
- });
- } else {
- cpx.copy(cb);
- }
- return cpx;
- };
- exports.copySync = function copySync(source, outDir) {
- var options = arguments.length <= 2 || arguments[2] === undefined ? null : arguments[2];
- var cpx = new Cpx(source, outDir, options);
- if (options && options.clean) {
- cpx.cleanSync();
- }
- cpx.copySync();
- };
- exports.watch = function watch(source, outDir) {
- var options = arguments.length <= 2 || arguments[2] === undefined ? null : arguments[2];
- var cpx = new Cpx(source, outDir, options);
- if (options && options.clean) {
- cpx.clean(function (err) {
- if (err == null) {
- cpx.watch();
- } else {
- cpx.emit("watch-error", err);
- }
- });
- } else {
- cpx.watch();
- }
- return cpx;
- };
|