You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

38 lines
1.2 KiB

"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.writeArtifactSafelyAsync = writeArtifactSafelyAsync;
function _fsExtra() {
const data = _interopRequireDefault(require("fs-extra"));
_fsExtra = function () {
return data;
};
return data;
}
function _path() {
const data = _interopRequireDefault(require("path"));
_path = function () {
return data;
};
return data;
}
function _internal() {
const data = require("../internal");
_internal = function () {
return data;
};
return data;
}
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
async function writeArtifactSafelyAsync(projectRoot, keyName, artifactPath, artifact) {
const pathToWrite = _path().default.resolve(projectRoot, artifactPath);
if (!_fsExtra().default.existsSync(_path().default.dirname(pathToWrite))) {
const errorMsg = keyName ? `app.json specifies: ${pathToWrite}, but that directory does not exist.` : `app.json specifies ${keyName}: ${pathToWrite}, but that directory does not exist.`;
_internal().Logger.global.warn(errorMsg);
} else {
await _fsExtra().default.writeFile(pathToWrite, artifact);
}
}
//# sourceMappingURL=ArtifactUtils.js.map