npmci/dist/npmci.env.js

48 lines
4.0 KiB
JavaScript
Raw Permalink Normal View History

2016-06-02 15:57:01 +00:00
"use strict";
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-02-19 13:46:05 +00:00
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibnBtY2kuZW52LmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vdHMvbnBtY2kuZW52LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7QUFBQSwyQ0FBMEM7QUFDMUMsdUNBQXNDO0FBQ3RDLDZDQUFtQztBQUluQyxFQUFFLENBQUMsQ0FBQyxPQUFPLENBQUMsR0FBRyxDQUFDLGFBQWEsQ0FBQztJQUFDLFlBQUksR0FBRyxJQUFJLHFCQUFPLENBQUMsT0FBTyxDQUFDLEdBQUcsQ0FBQyxhQUFhLENBQUMsQ0FBQTtBQUVqRSxRQUFBLFVBQVUsR0FBVyxPQUFPLENBQUMsR0FBRyxDQUFDLGNBQWMsQ0FBQTtBQUkvQyxRQUFBLGlCQUFpQixHQUFHLENBQUMsaUJBQXlCO0lBQ3JELHNCQUFjLEdBQUcsaUJBQWlCLENBQUE7QUFDdEMsQ0FBQyxDQUFBO0FBQ1UsUUFBQSxnQkFBZ0IsR0FBaUIsRUFBRSxDQUFBO0FBQ25DLFFBQUEsV0FBVyxHQUFpQixFQUFFLENBQUE7QUFDOUIsUUFBQSxNQUFNLEdBQUc7SUFDaEIsY0FBYyxFQUFFLFNBQVM7SUFDekIsZ0JBQWdCLEVBQUUsd0JBQWdCO0lBQ2xDLFdBQVcsRUFBRSxtQkFBVztJQUN4QixPQUFPLEVBQUUsU0FBUztDQUNyQixDQUFBO0FBRVUsUUFBQSxXQUFXLEdBQUc7SUFDckIsY0FBTSxDQUFDLGNBQWMsR0FBRyxzQkFBYyxDQUFBO0lBQ3RDLE9BQU8sQ0FBQyxTQUFTLENBQUMsTUFBTSxDQUFDLFFBQVEsQ0FDN0IsSUFBSSxDQUFDLFNBQV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