npmci/dist/npmci.env.js

49 lines
4.1 KiB
JavaScript
Raw Permalink Normal View History

2016-06-02 15:57:01 +00:00
"use strict";
2017-03-11 00:10:37 +00:00
Object.defineProperty(exports, "__esModule", { value: true });
2016-07-18 14:56:53 +00:00
const plugins = require("./npmci.plugins");
const paths = require("./npmci.paths");
const 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.setDockerRegistry = (dockerRegistryArg) => {
exports.dockerRegistry = dockerRegistryArg;
};
exports.dockerFilesBuilt = [];
exports.dockerFiles = [];
exports.config = {
dockerRegistry: undefined,
dockerFilesBuilt: exports.dockerFilesBuilt,
dockerFiles: exports.dockerFiles,
project: undefined
};
2016-07-18 14:56:53 +00:00
exports.configStore = () => {
exports.config.dockerRegistry = exports.dockerRegistry;
plugins.smartfile.memory.toFsSync(JSON.stringify(exports.config), paths.NpmciPackageConfig);
2016-06-05 21:53:01 +00:00
};
2016-07-18 14:56:53 +00:00
let configLoad = () => {
2016-06-19 00:30:50 +00:00
// internal config to transfer information in between npmci shell calls
2016-06-05 21:53:01 +00:00
try {
2016-11-24 23:07:20 +00:00
plugins.lodash.assign(exports.config, plugins.smartfile.fs.toObjectSync(paths.NpmciPackageConfig, 'json'));
2016-06-05 21:53:01 +00:00
}
catch (err) {
exports.configStore();
2016-11-24 23:07:20 +00:00
plugins.beautylog.log('config initialized!');
2016-06-05 21:53:01 +00:00
}
2016-06-19 00:30:50 +00:00
// project config
try {
if (!exports.config.project) {
2016-11-24 23:07:20 +00:00
exports.config.project = plugins.smartfile.fs.toObjectSync(paths.NpmciProjectDir, 'npmci.json');
plugins.beautylog.ok('project config found!');
2016-06-19 00:30:50 +00:00
}
;
}
catch (err) {
exports.config.project = {};
2016-11-24 23:07:20 +00:00
plugins.beautylog.log('no project config found, so proceeding with default behaviour!');
2016-06-19 00:30:50 +00:00
}
exports.config.dockerRegistry ? exports.dockerRegistry = exports.config.dockerRegistry : void (0);
exports.config.dockerFilesBuilt ? exports.dockerFilesBuilt = exports.config.dockerFilesBuilt : void (0);
};
2016-06-19 00:30:50 +00:00
configLoad();
2017-03-11 00:10:37 +00:00
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibnBtY2kuZW52LmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vdHMvbnBtY2kuZW52LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7O0FBQUEsMkNBQTBDO0FBQzFDLHVDQUFzQztBQUN0Qyw2Q0FBcUM7QUFJckMsRUFBRSxDQUFDLENBQUMsT0FBTyxDQUFDLEdBQUcsQ0FBQyxhQUFhLENBQUM7SUFBQyxZQUFJLEdBQUcsSUFBSSxxQkFBTyxDQUFDLE9BQU8sQ0FBQyxHQUFHLENBQUMsYUFBYSxDQUFDLENBQUE7QUFFakUsUUFBQSxVQUFVLEdBQVcsT0FBTyxDQUFDLEdBQUcsQ0FBQyxjQUFjLENBQUE7QUFJL0MsUUFBQSxpQkFBaUIsR0FBRyxDQUFDLGlCQUF5QjtJQUN2RCxzQkFBYyxHQUFHLGlCQUFpQixDQUFBO0FBQ3BDLENBQUMsQ0FBQTtBQUNVLFFBQUEsZ0JBQWdCLEdBQWlCLEVBQUUsQ0FBQTtBQUNuQyxRQUFBLFdBQVcsR0FBaUIsRUFBRSxDQUFBO0FBQzlCLFFBQUEsTUFBTSxHQUFHO0lBQ2xCLGNBQWMsRUFBRSxTQUFTO0lBQ3pCLGdCQUFnQixFQUFFLHdCQUFnQjtJQUNsQyxXQUFXLEVBQUUsbUJBQVc7SUFDeEIsT0FBTyxFQUFFLFNBQVM7Q0FDbkIsQ0FBQTtBQUVVLFFBQUEsV0FBVyxHQUFHO0lBQ3ZCLGNBQU0sQ0FBQyxjQUFjLEdBQUcsc0JBQWMsQ0FBQTtJQUN0QyxPQUFPLENBQUMsU0FBU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