47 lines
6.2 KiB
JavaScript
47 lines
6.2 KiB
JavaScript
"use strict";
|
|
require("typings-global");
|
|
var plugins = require("./npmci.plugins");
|
|
var paths = require("./npmci.paths");
|
|
var smartstring_1 = require("smartstring");
|
|
if (process.env.CI_BUILD_REPO)
|
|
exports.repo = new smartstring_1.GitRepo(process.env.CI_BUILD_REPO);
|
|
exports.buildStage = process.env.CI_BUILD_STAGE;
|
|
exports.dockerFilesBuilt = [];
|
|
exports.dockerFiles = [];
|
|
exports.configStore = function () {
|
|
var config = {
|
|
dockerRegistry: exports.dockerRegistry,
|
|
dockerFilesBuilt: exports.dockerFilesBuilt,
|
|
dockerFiles: exports.dockerFiles
|
|
};
|
|
plugins.smartfile.memory.toFsSync(JSON.stringify(config), paths.NpmciPackageConfig);
|
|
};
|
|
var configLoad = function () {
|
|
// internal config to transfer information in between npmci shell calls
|
|
try {
|
|
exports.config = plugins.smartfile.fs.toObjectSync(paths.NpmciPackageConfig, "json");
|
|
}
|
|
catch (err) {
|
|
exports.config = {};
|
|
exports.configStore();
|
|
plugins.beautylog.log("config initialized!");
|
|
}
|
|
// project config
|
|
try {
|
|
if (!exports.config.project) {
|
|
exports.config.project = plugins.smartfile.fs.toObjectSync(paths.NpmciProjectDir, "npmci.json");
|
|
plugins.beautylog.ok("project config found!");
|
|
}
|
|
;
|
|
}
|
|
catch (err) {
|
|
exports.config.project = {};
|
|
plugins.beautylog.log("no project config found, so proceeding with default behaviour!");
|
|
}
|
|
exports.config.dockerRegistry ? exports.dockerRegistry = exports.config.dockerRegistry : void (0);
|
|
exports.config.dockerFilesBuilt ? exports.dockerFilesBuilt = exports.config.dockerFilesBuilt : void (0);
|
|
};
|
|
configLoad();
|
|
|
|
//# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIm5wbWNpLmVudi50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiO0FBQUEsUUFBTyxnQkFBZ0IsQ0FBQyxDQ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