npmci/dist/npmci.env.js

57 lines
4.7 KiB
JavaScript

"use strict";
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());
});
};
Object.defineProperty(exports, "__esModule", { value: true });
const plugins = require("./npmci.plugins");
const paths = require("./npmci.paths");
const smartstring_1 = require("smartstring");
if (process.env.CI_REPOSITORY_URL) {
exports.repo = new smartstring_1.GitRepo(process.env.CI_REPOSITORY_URL);
}
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
};
exports.configStore = () => __awaiter(this, void 0, void 0, function* () {
exports.config.dockerRegistry = exports.dockerRegistry;
plugins.smartfile.memory.toFsSync(JSON.stringify(exports.config), paths.NpmciPackageConfig);
});
let configLoad = () => {
// internal config to transfer information in between npmci shell calls
try {
plugins.lodash.assign(exports.config, plugins.smartfile.fs.toObjectSync(paths.NpmciPackageConfig, 'json'));
}
catch (err) {
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.dockerFil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