npmci/dist/npmci.env.js

49 lines
4.1 KiB
JavaScript
Raw 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");
2017-05-18 20:40:09 +00:00
if (process.env.CI_REPOSITORY_URL) {
2017-05-15 16:27:13 +00:00
exports.repo = new smartstring_1.GitRepo(process.env.CI_REPOSITORY_URL);
2017-05-18 20:40:09 +00:00
}
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-05-18 20:40:09 +00:00
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibnBtY2kuZW52LmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vdHMvbnBtY2kuZW52LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7O0FBQUEsMkNBQTBDO0FBQzFDLHVDQUFzQztBQUN0Qyw2Q0FBcUM7QUFJckMsRUFBRSxDQUFDLENBQUMsT0FBTyxDQUFDLEdBQUcsQ0FBQyxpQkFBaUIsQ0FBQyxDQUFDLENBQUM7SUFDbEMsWUFBSSxHQUFHLElBQUkscUJBQU8sQ0FBQyxPQUFPLENBQUMsR0FBRyxDQUFDLGlCQUFpQixDQUFDLENBQUE7QUFDbkQsQ0FBQztBQUVVLFFBQUEsVUFBVSxHQUFXLE9BQU8sQ0FBQyxHQUFHLENBQUMsY0FBYyxDQUFBO0FBSS9DLFFBQUEsaUJBQWlCLEdBQUcsQ0FBQyxpQkFBeUI7SUFDdkQsc0JBQWMsR0FBRyxpQkFBaUIsQ0FBQTtBQUNwQyxDQUFDLENBQUE7QUFDVSxRQUFBLGdCQUFnQixHQUFpQixFQUFFLENBQUE7QUFDbkMsUUFBQSxXQUFXLEdBQWlCLEVBQUUsQ0FBQTtBQUM5QixRQUFBLE1BQU0sR0FBRztJQUNsQixjQUFjLEVBQUUsU0FBUztJQUN6QixnQkFBZ0IsRUFBRSx3QkFBZ0I7SUFDbEMsV0FBVyxFQUFFLG1CQUFXO0lBQ3hCLE9BQU8sRUFBRSxTQUFTO0NBQ25CLENBQUE7QUFFVSxRQUFBLFdBQVcsR0FBRztJ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