Compare commits

...

3 Commits

Author SHA1 Message Date
214c523306 3.0.9 2017-08-28 18:10:03 +02:00
1a465f336d now respoecting registryrepo maps 2017-08-28 18:09:59 +02:00
11ec419700 git improve npmextra.json config 2017-08-28 17:19:31 +02:00
9 changed files with 62 additions and 27 deletions

File diff suppressed because one or more lines are too long

View File

@@ -64,7 +64,7 @@ exports.install = (versionArg) => __awaiter(this, void 0, void 0, function* () {
yield npmciConfig.getConfig()
.then((configArg) => __awaiter(this, void 0, void 0, function* () {
plugins.beautylog.log('Now checking for needed global npm tools...');
for (let npmTool of configArg.globalNpmTools) {
for (let npmTool of configArg.npmGlobalTools) {
plugins.beautylog.info(`Checking for global "${npmTool}"`);
let whichOutput = yield npmci_bash_1.bashNoError(`which ${npmTool}`);
let toolAvailable = !((/not\sfound/.test(whichOutput)) || whichOutput === '');

View File

@@ -1,6 +1,8 @@
import { KeyValueStore } from 'npmextra';
export interface INpmciOptions {
globalNpmTools: string[];
npmGlobalTools: string[];
dockerRegistryRepoMap: any;
}
export declare let kvStorage: KeyValueStore;
export declare let configObject: INpmciOptions;
export declare let getConfig: () => Promise<INpmciOptions>;

14
dist/npmci.config.js vendored
View File

@@ -13,13 +13,15 @@ const paths = require("./npmci.paths");
const npmci_env_1 = require("./npmci.env");
const npmextra_1 = require("npmextra");
// instantiate a kvStorage for the current directory
exports.kvStorage = new npmextra_1.KeyValueStore('custom', npmci_env_1.repo.repo);
exports.getConfig = () => __awaiter(this, void 0, void 0, function* () {
exports.kvStorage = new npmextra_1.KeyValueStore('custom', `${npmci_env_1.repo.user}_${npmci_env_1.repo.repo}`);
// handle config retrival
let npmciNpmextra = new plugins.npmextra.Npmextra(paths.cwd);
let defaultConfig = {
globalNpmTools: []
npmGlobalTools: [],
dockerRegistryRepoMap: {}
};
let npmciConfig = npmciNpmextra.dataFor('npmci', defaultConfig);
return npmciConfig;
exports.configObject = npmciNpmextra.dataFor('npmci', defaultConfig);
exports.getConfig = () => __awaiter(this, void 0, void 0, function* () {
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UFHLElBQUksd0JBQWEsQ0FBQyxRQUFRLEVBQUUsR0FBRyxnQkFBSSxDQUFDLElBQUksSUFBSSxnQkFBSSxDQUFDLElBQUksRUFBRSxDQUFDLENBQUE7QUFFL0UseUJBQXlCO0FBQ3pCLElBQUksYUFBYSxHQUFHLElBQUksT0FBTyxDQUFDLFFBQVEsQ0FBQyxRQUFRLENBQUMsS0FBSyxDQUFDLEdBQUcsQ0FBQyxDQUFBO0FBQzVELElBQUksYUFBYSxHQUFrQjtJQUNqQyxjQUFjLEVBQUUsRUFBRTtJQUNsQixxQkFBcUIsRUFBRSxFQUFFO0NBQzFCLENBQUE7QUFDVSxRQUFBLFlBQVksR0FBRyxhQUFhLENBQUMsT0FBTyxDQUFnQixPQUFPLEVBQUUsYUFBYSxDQUFDLENBQUE7QUFFM0UsUUFBQSxTQUFTLEdBQUc7SUFDckIsTUFBTSxDQUFDLG9CQUFZLENBQUE7QUFDckIsQ0FBQyxDQUFBLENBQUEifQ==

View File

@@ -7,6 +7,9 @@
"npmci": {
"globalNpmTools": [
"npmts"
],
"npmGlobalTools": [
"npmts"
]
},
"npmdocker":{

View File

@@ -1,6 +1,6 @@
{
"name": "npmci",
"version": "3.0.8",
"version": "3.0.9",
"description": "node and docker in gitlab ci on steroids",
"main": "dist/index.js",
"typings": "dist/index.d.ts",

View File

@@ -1,6 +1,7 @@
import * as plugins from './mod.plugins'
import * as paths from '../npmci.paths'
import * as NpmciEnv from '../npmci.env'
import * as NpmciConfig from '../npmci.config'
import { bash } from '../npmci.bash'
import { Dockerfile } from './mod.classes.dockerfile'
@@ -130,13 +131,25 @@ export let dockerBaseImage = function (dockerfileContentArg: string) {
/**
* returns the docker tag
*/
export let getDockerTagString = function (registryArg: string, repoArg: string, versionArg: string, suffixArg?: string): string {
// determine wether the suffix is needed
export let getDockerTagString = (registryArg: string, repoArg: string, versionArg: string, suffixArg?: string): string => {
// determine wether the repo should be mapped accordingly to the registry
let mappedRepo = NpmciConfig.configObject.dockerRegistryRepoMap[registryArg]
let repo = (() => {
if (mappedRepo) {
return mappedRepo
} else {
return repoArg
}
})()
// determine wether the version contais a suffix
let version = versionArg
if (suffixArg) {
version = versionArg + '_' + suffixArg
}
let tagString = `${registryArg}/${repoArg}:${version}`
let tagString = `${registryArg}/${repo}:${version}`
return tagString
}

View File

@@ -57,7 +57,7 @@ export let install = async (versionArg) => {
await npmciConfig.getConfig()
.then(async configArg => {
plugins.beautylog.log('Now checking for needed global npm tools...')
for (let npmTool of configArg.globalNpmTools) {
for (let npmTool of configArg.npmGlobalTools) {
plugins.beautylog.info(`Checking for global "${npmTool}"`)
let whichOutput: string = await bashNoError(`which ${npmTool}`)
let toolAvailable: boolean = !((/not\sfound/.test(whichOutput)) || whichOutput === '')

View File

@@ -8,17 +8,21 @@ import { repo } from './npmci.env'
import { KeyValueStore } from 'npmextra'
export interface INpmciOptions {
globalNpmTools: string[]
npmGlobalTools: string[]
dockerRegistryRepoMap: any
}
// instantiate a kvStorage for the current directory
export let kvStorage = new KeyValueStore('custom', repo.user + repo.repo)
export let kvStorage = new KeyValueStore('custom', `${repo.user}_${repo.repo}`)
export let getConfig = async (): Promise<INpmciOptions> => {
// handle config retrival
let npmciNpmextra = new plugins.npmextra.Npmextra(paths.cwd)
let defaultConfig: INpmciOptions = {
globalNpmTools: []
npmGlobalTools: [],
dockerRegistryRepoMap: {}
}
let npmciConfig = npmciNpmextra.dataFor<INpmciOptions>('npmci', defaultConfig)
return npmciConfig
export let configObject = npmciNpmextra.dataFor<INpmciOptions>('npmci', defaultConfig)
export let getConfig = async (): Promise<INpmciOptions> => {
return configObject
}