npmci/dist/npmci.env.js

57 lines
4.7 KiB
JavaScript
Raw Permalink Normal View History

2016-06-02 15:57:01 +00:00
"use strict";
2017-05-19 10:09:33 +00:00
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
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
};
2017-05-19 10:09:33 +00:00
exports.configStore = () => __awaiter(this, void 0, void 0, function* () {
exports.config.dockerRegistry = exports.dockerRegistry;
plugins.smartfile.memory.toFsSync(JSON.stringify(exports.config), paths.NpmciPackageConfig);
2017-05-19 10:09:33 +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-19 10:09:33 +00:00
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibnBtY2kuZW52LmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vdHMvbnBtY2kuZW52LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7Ozs7Ozs7Ozs7QUFBQSwyQ0FBMEM7QUFDMUMsdUNBQXNDO0FBQ3RDLDZDQUFxQztBQUlyQyxFQUFFLENBQUMsQ0FBQyxPQUFPLENBQUMsR0FBRyxDQUFDLGlCQUFpQixDQUFDLENBQUMsQ0FBQztJQUNsQyxZQUFJLEdBQUcsSUFBSSxxQkFBTyxDQUFDLE9BQU8sQ0FBQyxHQUFHLENBQUMsaUJBQWlCLENBQUMsQ0FBQTtBQUNuRCxDQUFDO0FBRVUsUUFBQSxVQUFVLEdBQVcsT0FBTyxDQUFDLEdBQUcsQ0FBQyxjQUFjLENBQUE7QUFJL0MsUUFBQSxpQkFBaUIsR0FBRyxDQUFDLGlCQUF5QjtJQUN2RCxzQkFBYyxHQUFHLGlCQUFpQixDQUFBO0FBQ3BDLENBQUMsQ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