now respoecting registryrepo maps
This commit is contained in:
parent
11ec419700
commit
1a465f336d
19
dist/mod_docker/mod.helpers.js
vendored
19
dist/mod_docker/mod.helpers.js
vendored
File diff suppressed because one or more lines are too long
1
dist/npmci.config.d.ts
vendored
1
dist/npmci.config.d.ts
vendored
@ -4,4 +4,5 @@ export interface INpmciOptions {
|
||||
dockerRegistryRepoMap: any;
|
||||
}
|
||||
export declare let kvStorage: KeyValueStore;
|
||||
export declare let configObject: INpmciOptions;
|
||||
export declare let getConfig: () => Promise<INpmciOptions>;
|
||||
|
17
dist/npmci.config.js
vendored
17
dist/npmci.config.js
vendored
@ -14,13 +14,14 @@ 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.user}_${npmci_env_1.repo.repo}`);
|
||||
// handle config retrival
|
||||
let npmciNpmextra = new plugins.npmextra.Npmextra(paths.cwd);
|
||||
let defaultConfig = {
|
||||
npmGlobalTools: [],
|
||||
dockerRegistryRepoMap: {}
|
||||
};
|
||||
exports.configObject = npmciNpmextra.dataFor('npmci', defaultConfig);
|
||||
exports.getConfig = () => __awaiter(this, void 0, void 0, function* () {
|
||||
let npmciNpmextra = new plugins.npmextra.Npmextra(paths.cwd);
|
||||
let defaultConfig = {
|
||||
npmGlobalTools: [],
|
||||
dockerRegistryRepoMap: {}
|
||||
};
|
||||
let npmciConfig = npmciNpmextra.dataFor('npmci', defaultConfig);
|
||||
return npmciConfig;
|
||||
return exports.configObject;
|
||||
});
|
||||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibnBtY2kuY29uZmlnLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vdHMvbnBtY2kuY29uZmlnLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7Ozs7Ozs7Ozs7QUFFQSwyQ0FBMEM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BQUksYUFBYSxHQUFHLElBQUksT0FBTyxDQUFDLFFBQVEsQ0FBQyxRQUFRLENBQUMsS0FBSyxDQUFDLEdBQUcsQ0FBQyxDQUFBO0FBQzVELElBQUksYUFBYSxHQUFrQjtJQUNqQyxjQUFjLEVBQUUsRUFBRTtJQUNsQixxQkFBcUIsRUFBRSxFQUFFO0NBQzFCLENBQUE7QUFDVSxRQUFBLFlBQVksR0FBRyxhQUFhLENBQUMsT0FBTyxDQUFnQixPQUFPLEVBQUUsYUFBYSxDQUFDLENBQUE7QUFFM0UsUUFBQSxTQUFTLEdBQUc7SUFDckIsTUFBTSxDQUFDLG9CQUFZLENBQUE7QUFDckIsQ0FBQyxDQUFBLENBQUEifQ==
|
@ -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
|
||||
}
|
||||
|
||||
|
@ -15,12 +15,14 @@ export interface INpmciOptions {
|
||||
// instantiate a kvStorage for the current directory
|
||||
export let kvStorage = new KeyValueStore('custom', `${repo.user}_${repo.repo}`)
|
||||
|
||||
export let getConfig = async (): Promise<INpmciOptions> => {
|
||||
let npmciNpmextra = new plugins.npmextra.Npmextra(paths.cwd)
|
||||
let defaultConfig: INpmciOptions = {
|
||||
npmGlobalTools: [],
|
||||
dockerRegistryRepoMap: {}
|
||||
}
|
||||
let npmciConfig = npmciNpmextra.dataFor<INpmciOptions>('npmci', defaultConfig)
|
||||
return npmciConfig
|
||||
// handle config retrival
|
||||
let npmciNpmextra = new plugins.npmextra.Npmextra(paths.cwd)
|
||||
let defaultConfig: INpmciOptions = {
|
||||
npmGlobalTools: [],
|
||||
dockerRegistryRepoMap: {}
|
||||
}
|
||||
export let configObject = npmciNpmextra.dataFor<INpmciOptions>('npmci', defaultConfig)
|
||||
|
||||
export let getConfig = async (): Promise<INpmciOptions> => {
|
||||
return configObject
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user