Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 214c523306 | |||
| 1a465f336d | |||
| 11ec419700 |
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
2
dist/mod_node/index.js
vendored
2
dist/mod_node/index.js
vendored
@@ -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 === '');
|
||||
|
||||
4
dist/npmci.config.d.ts
vendored
4
dist/npmci.config.d.ts
vendored
@@ -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>;
|
||||
|
||||
18
dist/npmci.config.js
vendored
18
dist/npmci.config.js
vendored
@@ -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.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 = {
|
||||
globalNpmTools: []
|
||||
};
|
||||
let npmciConfig = npmciNpmextra.dataFor('npmci', defaultConfig);
|
||||
return npmciConfig;
|
||||
return exports.configObject;
|
||||
});
|
||||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibnBtY2kuY29uZmlnLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vdHMvbnBtY2kuY29uZmlnLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7Ozs7Ozs7Ozs7QUFFQSwyQ0FBMEM7QUFDMUMsdUNBQXNDO0FBRXRDLDJDQUFrQztBQUVsQyx1Q0FBd0M7QUFNeEMsb0RBQW9EO0FBQ3pDLFFBQUEsU0FBUyxHQUFHLElBQUksd0JBQWEsQ0FBQyxRQUFRLEVBQUUsZ0JBQUksQ0FBQyxJQUFJLENBQUMsQ0FBQTtBQUVsRCxRQUFBLFNBQVMsR0FBRztJQUNyQixJQUFJLGFBQWEsR0FBRyxJQUFJLE9BQU8sQ0FBQyxRQUFRLENBQUMsUUFBUSxDQUFDLEtBQUssQ0FBQyxHQUFHLENBQUMsQ0FBQTtJQUM1RCxJQUFJLGFBQWEsR0FBa0I7UUFDakMsY0FBYyxFQUFFLEVBQUU7S0FDbkIsQ0FBQTtJQUNELElBQUksV0FBVyxHQUFHLGFBQWEsQ0FBQyxPQUFPLENBQWdCLE9BQU8sRUFBRSxhQUFhLENBQUMsQ0FBQTtJQUM5RSxNQUFNLENBQUMsV0FBVyxDQUFBO0FBQ3BCLENBQUMsQ0FBQSxDQUFBIn0=
|
||||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibnBtY2kuY29uZmlnLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vdHMvbnBtY2kuY29uZmlnLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7Ozs7Ozs7Ozs7QUFFQSwyQ0FBMEM7QUFDMUMsdUNBQXNDO0FBRXRDLDJDQUFrQztBQUVsQyx1Q0FBd0M7QUFPeEMsb0RBQW9EO0FBQ3pDLFFBQUEsU0FBUyxHQUFHLElBQUksd0JBQWEsQ0FBQyxRQUFRLEVBQUUsR0FBRyxnQkFBSSxDQUFDLElBQUksSUFBSSxnQkFBSSxDQUFDLElBQUksRUFBRSxDQUFDLENBQUE7QUFFL0UseUJBQXlCO0FBQ3pCLElBQUksYUFBYSxHQUFHLElBQUksT0FBTyxDQUFDLFFBQVEsQ0FBQyxRQUFRLENBQUMsS0FBSyxDQUFDLEdBQUcsQ0FBQyxDQUFBO0FBQzVELElBQUksYUFBYSxHQUFrQjtJQUNqQyxjQUFjLEVBQUUsRUFBRTtJQUNsQixxQkFBcUIsRUFBRSxFQUFFO0NBQzFCLENBQUE7QUFDVSxRQUFBLFlBQVksR0FBRyxhQUFhLENBQUMsT0FBTyxDQUFnQixPQUFPLEVBQUUsYUFBYSxDQUFDLENBQUE7QUFFM0UsUUFBQSxTQUFTLEdBQUc7SUFDckIsTUFBTSxDQUFDLG9CQUFZLENBQUE7QUFDckIsQ0FBQyxDQUFBLENBQUEifQ==
|
||||
@@ -7,6 +7,9 @@
|
||||
"npmci": {
|
||||
"globalNpmTools": [
|
||||
"npmts"
|
||||
],
|
||||
"npmGlobalTools": [
|
||||
"npmts"
|
||||
]
|
||||
},
|
||||
"npmdocker":{
|
||||
|
||||
@@ -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",
|
||||
|
||||
@@ -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
|
||||
}
|
||||
|
||||
|
||||
@@ -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 === '')
|
||||
|
||||
@@ -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}`)
|
||||
|
||||
// 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> => {
|
||||
let npmciNpmextra = new plugins.npmextra.Npmextra(paths.cwd)
|
||||
let defaultConfig: INpmciOptions = {
|
||||
globalNpmTools: []
|
||||
}
|
||||
let npmciConfig = npmciNpmextra.dataFor<INpmciOptions>('npmci', defaultConfig)
|
||||
return npmciConfig
|
||||
return configObject
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user