@pshaw/gulp-writeme
Version: 
A gulp wrapper for writeme
217 lines (203 loc) • 4.29 kB
JavaScript
"use strict";
var cov_2b7bvuj1pr = function () {
  var path = "/Users/pshaw/code/monorepo/packages/gulp-writeme/src/index.ts",
      hash = "c98026b86e5a04f260d9ee05daccd334764c6682",
      Function = function () {}.constructor,
      global = new Function('return this')(),
      gcv = "__coverage__",
      coverageData = {
    path: "/Users/pshaw/code/monorepo/packages/gulp-writeme/src/index.ts",
    statementMap: {
      "0": {
        start: {
          line: 6,
          column: 2
        },
        end: {
          line: 16,
          column: 5
        }
      },
      "1": {
        start: {
          line: 7,
          column: 4
        },
        end: {
          line: 14,
          column: 5
        }
      },
      "2": {
        start: {
          line: 8,
          column: 25
        },
        end: {
          line: 8,
          column: 72
        }
      },
      "3": {
        start: {
          line: 9,
          column: 6
        },
        end: {
          line: 9,
          column: 50
        }
      },
      "4": {
        start: {
          line: 10,
          column: 6
        },
        end: {
          line: 10,
          column: 47
        }
      },
      "5": {
        start: {
          line: 12,
          column: 6
        },
        end: {
          line: 12,
          column: 69
        }
      },
      "6": {
        start: {
          line: 13,
          column: 6
        },
        end: {
          line: 13,
          column: 13
        }
      },
      "7": {
        start: {
          line: 15,
          column: 4
        },
        end: {
          line: 15,
          column: 25
        }
      }
    },
    fnMap: {
      "0": {
        name: "writeme",
        decl: {
          start: {
            line: 5,
            column: 16
          },
          end: {
            line: 5,
            column: 23
          }
        },
        loc: {
          start: {
            line: 5,
            column: 45
          },
          end: {
            line: 17,
            column: 1
          }
        },
        line: 5
      },
      "1": {
        name: "(anonymous_1)",
        decl: {
          start: {
            line: 6,
            column: 21
          },
          end: {
            line: 6,
            column: 22
          }
        },
        loc: {
          start: {
            line: 6,
            column: 52
          },
          end: {
            line: 16,
            column: 3
          }
        },
        line: 6
      }
    },
    branchMap: {},
    s: {
      "0": 0,
      "1": 0,
      "2": 0,
      "3": 0,
      "4": 0,
      "5": 0,
      "6": 0,
      "7": 0
    },
    f: {
      "0": 0,
      "1": 0
    },
    b: {},
    _coverageSchema: "43e27e138ebf9cfc5966b082cf9a028302ed4184"
  },
      coverage = global[gcv] || (global[gcv] = {});
  if (coverage[path] && coverage[path].hash === hash) {
    return coverage[path];
  }
  coverageData.hash = hash;
  return coverage[path] = coverageData;
}();
Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.writeme = writeme;
exports.default = void 0;
var _writeme = _interopRequireDefault(require("@pshaw/writeme"));
var _path = require("path");
var _through = _interopRequireDefault(require("through2"));
var _pluginError = _interopRequireDefault(require("plugin-error"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function writeme(missingFileCallback) {
  cov_2b7bvuj1pr.f[0]++;
  cov_2b7bvuj1pr.s[0]++;
  return _through.default.obj(async (file, enc, callback) => {
    cov_2b7bvuj1pr.f[1]++;
    cov_2b7bvuj1pr.s[1]++;
    try {
      const readmeText = (cov_2b7bvuj1pr.s[2]++, await (0, _writeme.default)(file.path, missingFileCallback));
      cov_2b7bvuj1pr.s[3]++;
      file.contents = new Buffer(readmeText, enc);
      cov_2b7bvuj1pr.s[4]++;
      file.path = (0, _path.join)(file.path, 'README.md');
    } catch (err) {
      cov_2b7bvuj1pr.s[5]++;
      callback(new _pluginError.default('writeme', err, {
        showStack: true
      }));
      cov_2b7bvuj1pr.s[6]++;
      return;
    }
    cov_2b7bvuj1pr.s[7]++;
    callback(null, file);
  });
}
var _default = writeme;
exports.default = _default;
//# sourceMappingURL=index.js.map