feat(logging): use smartlog
This commit is contained in:
@ -1,3 +1,4 @@
|
||||
import { logger } from '../npmci.logging';
|
||||
import * as plugins from './mod.plugins';
|
||||
import * as paths from '../npmci.paths';
|
||||
import { bash } from '../npmci.bash';
|
||||
@ -10,7 +11,7 @@ import { DockerRegistry } from './mod.classes.dockerregistry';
|
||||
import { RegistryStorage } from './mod.classes.registrystorage';
|
||||
|
||||
// instances
|
||||
let npmciRegistryStorage = new RegistryStorage();
|
||||
const npmciRegistryStorage = new RegistryStorage();
|
||||
|
||||
export { Dockerfile, helpers };
|
||||
|
||||
@ -23,7 +24,7 @@ export let modArgvArg; // will be set through the build command
|
||||
export let handleCli = async argvArg => {
|
||||
modArgvArg = argvArg;
|
||||
if (argvArg._.length >= 2) {
|
||||
let action: string = argvArg._[1];
|
||||
const action: string = argvArg._[1];
|
||||
switch (action) {
|
||||
case 'build':
|
||||
await build();
|
||||
@ -42,10 +43,11 @@ export let handleCli = async argvArg => {
|
||||
await pull(argvArg);
|
||||
break;
|
||||
default:
|
||||
plugins.beautylog.error(`>>npmci docker ...<< action >>${action}<< not supported`);
|
||||
logger.log('error', `>>npmci docker ...<< action >>${action}<< not supported`);
|
||||
}
|
||||
} else {
|
||||
plugins.beautylog.log(
|
||||
logger.log(
|
||||
'info',
|
||||
`>>npmci docker ...<< cli arguments invalid... Please read the documentation.`
|
||||
);
|
||||
}
|
||||
@ -56,7 +58,7 @@ export let handleCli = async argvArg => {
|
||||
*/
|
||||
export let build = async () => {
|
||||
await prepare();
|
||||
plugins.beautylog.log('now building Dockerfiles...');
|
||||
logger.log('info', 'now building Dockerfiles...');
|
||||
await helpers
|
||||
.readDockerfiles()
|
||||
.then(helpers.sortDockerfiles)
|
||||
@ -78,7 +80,7 @@ export let login = async () => {
|
||||
export let prepare = async () => {
|
||||
// Always login to GitLab Registry
|
||||
if (!process.env.CI_BUILD_TOKEN || process.env.CI_BUILD_TOKEN === '') {
|
||||
plugins.beautylog.error('No registry token specified by gitlab!');
|
||||
logger.log('error', 'No registry token specified by gitlab!');
|
||||
process.exit(1);
|
||||
}
|
||||
npmciRegistryStorage.addRegistry(
|
||||
@ -98,40 +100,41 @@ export let prepare = async () => {
|
||||
|
||||
export let push = async argvArg => {
|
||||
await prepare();
|
||||
let registryUrlArg = argvArg._[2];
|
||||
const registryUrlArg = argvArg._[2];
|
||||
let suffix = null;
|
||||
if (argvArg._.length >= 4) {
|
||||
suffix = argvArg._[3];
|
||||
}
|
||||
let dockerfileArray = await helpers
|
||||
const dockerfileArray = await helpers
|
||||
.readDockerfiles()
|
||||
.then(helpers.sortDockerfiles)
|
||||
.then(helpers.mapDockerfiles);
|
||||
let localDockerRegistry = npmciRegistryStorage.getRegistryByUrl(registryUrlArg);
|
||||
const localDockerRegistry = npmciRegistryStorage.getRegistryByUrl(registryUrlArg);
|
||||
if (!localDockerRegistry) {
|
||||
plugins.beautylog.error(
|
||||
logger.log(
|
||||
'error',
|
||||
`Cannot push to registry ${registryUrlArg}, because it was not found in the authenticated registry list.`
|
||||
);
|
||||
process.exit(1);
|
||||
}
|
||||
for (let dockerfile of dockerfileArray) {
|
||||
for (const dockerfile of dockerfileArray) {
|
||||
await dockerfile.push(localDockerRegistry, suffix);
|
||||
}
|
||||
};
|
||||
|
||||
export let pull = async argvArg => {
|
||||
await prepare();
|
||||
let registryUrlArg = argvArg._[2];
|
||||
const registryUrlArg = argvArg._[2];
|
||||
let suffix = null;
|
||||
if (argvArg._.length >= 4) {
|
||||
suffix = argvArg._[3];
|
||||
}
|
||||
let localDockerRegistry = npmciRegistryStorage.getRegistryByUrl(registryUrlArg);
|
||||
let dockerfileArray = await helpers
|
||||
const localDockerRegistry = npmciRegistryStorage.getRegistryByUrl(registryUrlArg);
|
||||
const dockerfileArray = await helpers
|
||||
.readDockerfiles()
|
||||
.then(helpers.sortDockerfiles)
|
||||
.then(helpers.mapDockerfiles);
|
||||
for (let dockerfile of dockerfileArray) {
|
||||
for (const dockerfile of dockerfileArray) {
|
||||
await dockerfile.pull(localDockerRegistry, suffix);
|
||||
}
|
||||
};
|
||||
|
@ -1,3 +1,4 @@
|
||||
import { logger } from '../npmci.logging';
|
||||
import * as plugins from './mod.plugins';
|
||||
import * as NpmciEnv from '../npmci.env';
|
||||
import { bash } from '../npmci.bash';
|
||||
@ -10,16 +11,16 @@ import * as helpers from './mod.helpers';
|
||||
* class Dockerfile represents a Dockerfile on disk in npmci
|
||||
*/
|
||||
export class Dockerfile {
|
||||
filePath: string;
|
||||
repo: string;
|
||||
version: string;
|
||||
cleanTag: string;
|
||||
buildTag: string;
|
||||
containerName: string;
|
||||
content: string;
|
||||
baseImage: string;
|
||||
localBaseImageDependent: boolean;
|
||||
localBaseDockerfile: Dockerfile;
|
||||
public filePath: string;
|
||||
public repo: string;
|
||||
public version: string;
|
||||
public cleanTag: string;
|
||||
public buildTag: string;
|
||||
public containerName: string;
|
||||
public content: string;
|
||||
public baseImage: string;
|
||||
public localBaseImageDependent: boolean;
|
||||
public localBaseDockerfile: Dockerfile;
|
||||
constructor(options: { filePath?: string; fileContents?: string | Buffer; read?: boolean }) {
|
||||
this.filePath = options.filePath;
|
||||
this.repo = NpmciEnv.repo.user + '/' + NpmciEnv.repo.repo;
|
||||
@ -38,10 +39,10 @@ export class Dockerfile {
|
||||
/**
|
||||
* builds the Dockerfile
|
||||
*/
|
||||
async build() {
|
||||
plugins.beautylog.info('now building Dockerfile for ' + this.cleanTag);
|
||||
let buildArgsString = await helpers.getDockerBuildArgs();
|
||||
let buildCommand = `docker build -t ${this.buildTag} -f ${this.filePath} ${buildArgsString} .`;
|
||||
public async build() {
|
||||
logger.log('info', 'now building Dockerfile for ' + this.cleanTag);
|
||||
const buildArgsString = await helpers.getDockerBuildArgs();
|
||||
const buildCommand = `docker build -t ${this.buildTag} -f ${this.filePath} ${buildArgsString} .`;
|
||||
await bash(buildCommand);
|
||||
return;
|
||||
}
|
||||
@ -49,8 +50,8 @@ export class Dockerfile {
|
||||
/**
|
||||
* pushes the Dockerfile to a registry
|
||||
*/
|
||||
async push(dockerRegistryArg: DockerRegistry, versionSuffix: string = null) {
|
||||
let pushTag = helpers.getDockerTagString(
|
||||
public async push(dockerRegistryArg: DockerRegistry, versionSuffix: string = null) {
|
||||
const pushTag = helpers.getDockerTagString(
|
||||
dockerRegistryArg.registryUrl,
|
||||
this.repo,
|
||||
this.version,
|
||||
@ -63,8 +64,8 @@ export class Dockerfile {
|
||||
/**
|
||||
* pulls the Dockerfile from a registry
|
||||
*/
|
||||
async pull(registryArg: DockerRegistry, versionSuffixArg: string = null) {
|
||||
let pullTag = helpers.getDockerTagString(
|
||||
public async pull(registryArg: DockerRegistry, versionSuffixArg: string = null) {
|
||||
const pullTag = helpers.getDockerTagString(
|
||||
registryArg.registryUrl,
|
||||
this.repo,
|
||||
this.version,
|
||||
@ -77,9 +78,9 @@ export class Dockerfile {
|
||||
/**
|
||||
* tests the Dockerfile;
|
||||
*/
|
||||
async test() {
|
||||
let testFile: string = plugins.path.join(paths.NpmciTestDir, 'test_' + this.version + '.sh');
|
||||
let testFileExists: boolean = plugins.smartfile.fs.fileExistsSync(testFile);
|
||||
public async test() {
|
||||
const testFile: string = plugins.path.join(paths.NpmciTestDir, 'test_' + this.version + '.sh');
|
||||
const testFileExists: boolean = plugins.smartfile.fs.fileExistsSync(testFile);
|
||||
if (testFileExists) {
|
||||
// run tests
|
||||
await bash(
|
||||
@ -93,17 +94,15 @@ export class Dockerfile {
|
||||
await bash(`docker rm npmci_test_container`);
|
||||
await bash(`docker rmi --force npmci_test_image`);
|
||||
} else {
|
||||
plugins.beautylog.warn(
|
||||
'skipping tests for ' + this.cleanTag + ' because no testfile was found!'
|
||||
);
|
||||
logger.log('warn', 'skipping tests for ' + this.cleanTag + ' because no testfile was found!');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* gets the id of a Dockerfile
|
||||
*/
|
||||
async getId() {
|
||||
let containerId = await bash('docker inspect --type=image --format="{{.Id}}" ' + this.buildTag);
|
||||
public async getId() {
|
||||
const containerId = await bash('docker inspect --type=image --format="{{.Id}}" ' + this.buildTag);
|
||||
return containerId;
|
||||
}
|
||||
}
|
||||
|
@ -1,3 +1,4 @@
|
||||
import { logger } from '../npmci.logging';
|
||||
import * as plugins from './mod.plugins';
|
||||
import { bash } from '../npmci.bash';
|
||||
|
||||
@ -8,26 +9,26 @@ export interface IDockerRegistryConstructorOptions {
|
||||
}
|
||||
|
||||
export class DockerRegistry {
|
||||
registryUrl: string;
|
||||
username: string;
|
||||
password: string;
|
||||
public registryUrl: string;
|
||||
public username: string;
|
||||
public password: string;
|
||||
constructor(optionsArg: IDockerRegistryConstructorOptions) {
|
||||
this.registryUrl = optionsArg.registryUrl;
|
||||
this.username = optionsArg.username;
|
||||
this.password = optionsArg.password;
|
||||
plugins.beautylog.info(`created DockerRegistry for ${this.registryUrl}`);
|
||||
logger.log('info', `created DockerRegistry for ${this.registryUrl}`);
|
||||
}
|
||||
|
||||
static fromEnvString(envString: string): DockerRegistry {
|
||||
let dockerRegexResultArray = envString.split('|');
|
||||
public static fromEnvString(envString: string): DockerRegistry {
|
||||
const dockerRegexResultArray = envString.split('|');
|
||||
if (dockerRegexResultArray.length !== 3) {
|
||||
plugins.beautylog.error('malformed docker env var...');
|
||||
logger.log('error', 'malformed docker env var...');
|
||||
process.exit(1);
|
||||
return;
|
||||
}
|
||||
let registryUrl = dockerRegexResultArray[0];
|
||||
let username = dockerRegexResultArray[1];
|
||||
let password = dockerRegexResultArray[2];
|
||||
const registryUrl = dockerRegexResultArray[0];
|
||||
const username = dockerRegexResultArray[1];
|
||||
const password = dockerRegexResultArray[2];
|
||||
return new DockerRegistry({
|
||||
registryUrl: registryUrl,
|
||||
username: username,
|
||||
@ -35,13 +36,13 @@ export class DockerRegistry {
|
||||
});
|
||||
}
|
||||
|
||||
async login() {
|
||||
public async login() {
|
||||
if (this.registryUrl === 'docker.io') {
|
||||
await bash(`docker login -u ${this.username} -p ${this.password}`);
|
||||
plugins.beautylog.info('Logged in to standard docker hub');
|
||||
logger.log('info', 'Logged in to standard docker hub');
|
||||
} else {
|
||||
await bash(`docker login -u ${this.username} -p ${this.password} ${this.registryUrl}`);
|
||||
}
|
||||
plugins.beautylog.ok(`docker authenticated for ${this.registryUrl}!`);
|
||||
logger.log('ok', `docker authenticated for ${this.registryUrl}!`);
|
||||
}
|
||||
}
|
||||
|
@ -1,5 +1,6 @@
|
||||
import { logger } from '../npmci.logging';
|
||||
import * as plugins from './mod.plugins';
|
||||
import { Objectmap } from 'lik';
|
||||
import { Objectmap } from '@pushrocks/lik';
|
||||
|
||||
import { DockerRegistry } from './mod.classes.dockerregistry';
|
||||
|
||||
@ -23,6 +24,6 @@ export class RegistryStorage {
|
||||
await this.objectMap.forEach(async registryArg => {
|
||||
await registryArg.login();
|
||||
});
|
||||
plugins.beautylog.success('logged in successfully into all available DockerRegistries!');
|
||||
logger.log('success', 'logged in successfully into all available DockerRegistries!');
|
||||
}
|
||||
}
|
||||
|
@ -1,3 +1,4 @@
|
||||
import { logger } from '../npmci.logging';
|
||||
import * as plugins from './mod.plugins';
|
||||
import * as paths from '../npmci.paths';
|
||||
import * as NpmciEnv from '../npmci.env';
|
||||
@ -11,14 +12,14 @@ import { Dockerfile } from './mod.classes.dockerfile';
|
||||
* @returns Promise<Dockerfile[]>
|
||||
*/
|
||||
export let readDockerfiles = async (): Promise<Dockerfile[]> => {
|
||||
let fileTree = await plugins.smartfile.fs.listFileTree(paths.cwd, 'Dockerfile*');
|
||||
const fileTree = await plugins.smartfile.fs.listFileTree(paths.cwd, 'Dockerfile*');
|
||||
|
||||
// create the Dockerfile array
|
||||
let readDockerfilesArray: Dockerfile[] = [];
|
||||
plugins.beautylog.info(`found ${fileTree.length} Dockerfiles:`);
|
||||
const readDockerfilesArray: Dockerfile[] = [];
|
||||
logger.log('info', `found ${fileTree.length} Dockerfiles:`);
|
||||
console.log(fileTree);
|
||||
for (let dockerfilePath of fileTree) {
|
||||
let myDockerfile = new Dockerfile({
|
||||
for (const dockerfilePath of fileTree) {
|
||||
const myDockerfile = new Dockerfile({
|
||||
filePath: dockerfilePath,
|
||||
read: true
|
||||
});
|
||||
@ -34,14 +35,14 @@ export let readDockerfiles = async (): Promise<Dockerfile[]> => {
|
||||
* @returns Promise<Dockerfile[]>
|
||||
*/
|
||||
export let sortDockerfiles = (sortableArrayArg: Dockerfile[]): Promise<Dockerfile[]> => {
|
||||
let done = plugins.smartpromise.defer<Dockerfile[]>();
|
||||
plugins.beautylog.info('sorting Dockerfiles:');
|
||||
let sortedArray: Dockerfile[] = [];
|
||||
let cleanTagsOriginal = cleanTagsArrayFunction(sortableArrayArg, sortedArray);
|
||||
const done = plugins.smartpromise.defer<Dockerfile[]>();
|
||||
logger.log('info', 'sorting Dockerfiles:');
|
||||
const sortedArray: Dockerfile[] = [];
|
||||
const cleanTagsOriginal = cleanTagsArrayFunction(sortableArrayArg, sortedArray);
|
||||
let sorterFunctionCounter: number = 0;
|
||||
let sorterFunction = function() {
|
||||
const sorterFunction = () => {
|
||||
sortableArrayArg.forEach(dockerfileArg => {
|
||||
let cleanTags = cleanTagsArrayFunction(sortableArrayArg, sortedArray);
|
||||
const cleanTags = cleanTagsArrayFunction(sortableArrayArg, sortedArray);
|
||||
if (
|
||||
cleanTags.indexOf(dockerfileArg.baseImage) === -1 &&
|
||||
sortedArray.indexOf(dockerfileArg) === -1
|
||||
@ -54,8 +55,8 @@ export let sortDockerfiles = (sortableArrayArg: Dockerfile[]): Promise<Dockerfil
|
||||
});
|
||||
if (sortableArrayArg.length === sortedArray.length) {
|
||||
let counter = 1;
|
||||
for (let dockerfile of sortedArray) {
|
||||
plugins.beautylog.log(`tag ${counter}: -> ${dockerfile.cleanTag}`);
|
||||
for (const dockerfile of sortedArray) {
|
||||
logger.log('info', `tag ${counter}: -> ${dockerfile.cleanTag}`);
|
||||
counter++;
|
||||
}
|
||||
done.resolve(sortedArray);
|
||||
@ -88,7 +89,7 @@ export let mapDockerfiles = async (sortedArray: Dockerfile[]): Promise<Dockerfil
|
||||
* builds the correspoding real docker image for each Dockerfile class instance
|
||||
*/
|
||||
export let buildDockerfiles = async (sortedArrayArg: Dockerfile[]) => {
|
||||
for (let dockerfileArg of sortedArrayArg) {
|
||||
for (const dockerfileArg of sortedArrayArg) {
|
||||
await dockerfileArg.build();
|
||||
}
|
||||
return sortedArrayArg;
|
||||
@ -99,7 +100,7 @@ export let buildDockerfiles = async (sortedArrayArg: Dockerfile[]) => {
|
||||
* @param sortedArrayArg Dockerfile[] that contains all Dockerfiles in cwd
|
||||
*/
|
||||
export let testDockerfiles = async (sortedArrayArg: Dockerfile[]) => {
|
||||
for (let dockerfileArg of sortedArrayArg) {
|
||||
for (const dockerfileArg of sortedArrayArg) {
|
||||
await dockerfileArg.test();
|
||||
}
|
||||
return sortedArrayArg;
|
||||
@ -111,8 +112,8 @@ export let testDockerfiles = async (sortedArrayArg: Dockerfile[]) => {
|
||||
*/
|
||||
export let dockerFileVersion = (dockerfileNameArg: string): string => {
|
||||
let versionString: string;
|
||||
let versionRegex = /Dockerfile_([a-zA-Z0-9\.]*)$/;
|
||||
let regexResultArray = versionRegex.exec(dockerfileNameArg);
|
||||
const versionRegex = /Dockerfile_([a-zA-Z0-9\.]*)$/;
|
||||
const regexResultArray = versionRegex.exec(dockerfileNameArg);
|
||||
if (regexResultArray && regexResultArray.length === 2) {
|
||||
versionString = regexResultArray[1];
|
||||
} else {
|
||||
@ -124,9 +125,9 @@ export let dockerFileVersion = (dockerfileNameArg: string): string => {
|
||||
/**
|
||||
* returns the docker base image for a Dockerfile
|
||||
*/
|
||||
export let dockerBaseImage = function(dockerfileContentArg: string) {
|
||||
let baseImageRegex = /FROM\s([a-zA-z0-9\/\-\:]*)\n?/;
|
||||
let regexResultArray = baseImageRegex.exec(dockerfileContentArg);
|
||||
export let dockerBaseImage = (dockerfileContentArg: string) => {
|
||||
const baseImageRegex = /FROM\s([a-zA-z0-9\/\-\:]*)\n?/;
|
||||
const regexResultArray = baseImageRegex.exec(dockerfileContentArg);
|
||||
return regexResultArray[1];
|
||||
};
|
||||
|
||||
@ -140,8 +141,8 @@ export let getDockerTagString = (
|
||||
suffixArg?: string
|
||||
): string => {
|
||||
// determine wether the repo should be mapped accordingly to the registry
|
||||
let mappedRepo = NpmciConfig.configObject.dockerRegistryRepoMap[registryArg];
|
||||
let repo = (() => {
|
||||
const mappedRepo = NpmciConfig.configObject.dockerRegistryRepoMap[registryArg];
|
||||
const repo = (() => {
|
||||
if (mappedRepo) {
|
||||
return mappedRepo;
|
||||
} else {
|
||||
@ -155,15 +156,15 @@ export let getDockerTagString = (
|
||||
version = versionArg + '_' + suffixArg;
|
||||
}
|
||||
|
||||
let tagString = `${registryArg}/${repo}:${version}`;
|
||||
const tagString = `${registryArg}/${repo}:${version}`;
|
||||
return tagString;
|
||||
};
|
||||
|
||||
export let getDockerBuildArgs = async (): Promise<string> => {
|
||||
plugins.beautylog.info('checking for env vars to be supplied to the docker build');
|
||||
logger.log('info', 'checking for env vars to be supplied to the docker build');
|
||||
let buildArgsString: string = '';
|
||||
for (let key in NpmciConfig.configObject.dockerBuildargEnvMap) {
|
||||
let targetValue = process.env[NpmciConfig.configObject.dockerBuildargEnvMap[key]];
|
||||
for (const key in NpmciConfig.configObject.dockerBuildargEnvMap) {
|
||||
const targetValue = process.env[NpmciConfig.configObject.dockerBuildargEnvMap[key]];
|
||||
buildArgsString = `${buildArgsString} --build-arg ${key}=${targetValue}`;
|
||||
}
|
||||
return buildArgsString;
|
||||
@ -172,12 +173,12 @@ export let getDockerBuildArgs = async (): Promise<string> => {
|
||||
/**
|
||||
*
|
||||
*/
|
||||
export let cleanTagsArrayFunction = function(
|
||||
export let cleanTagsArrayFunction = (
|
||||
dockerfileArrayArg: Dockerfile[],
|
||||
trackingArrayArg: Dockerfile[]
|
||||
): string[] {
|
||||
let cleanTagsArray: string[] = [];
|
||||
dockerfileArrayArg.forEach(function(dockerfileArg) {
|
||||
): string[] => {
|
||||
const cleanTagsArray: string[] = [];
|
||||
dockerfileArrayArg.forEach((dockerfileArg) => {
|
||||
if (trackingArrayArg.indexOf(dockerfileArg) === -1) {
|
||||
cleanTagsArray.push(dockerfileArg.cleanTag);
|
||||
}
|
||||
|
@ -1,3 +1,4 @@
|
||||
import { logger } from '../npmci.logging';
|
||||
import * as plugins from './mod.plugins';
|
||||
import { bash } from '../npmci.bash';
|
||||
import { repo } from '../npmci.env';
|
||||
@ -8,38 +9,36 @@ import { repo } from '../npmci.env';
|
||||
*/
|
||||
export let handleCli = async argvArg => {
|
||||
if (argvArg._.length >= 2) {
|
||||
let action: string = argvArg._[1];
|
||||
const action: string = argvArg._[1];
|
||||
switch (action) {
|
||||
case 'mirror':
|
||||
await mirror();
|
||||
break;
|
||||
default:
|
||||
plugins.beautylog.error(`>>npmci git ...<< action >>${action}<< not supported`);
|
||||
logger.log('error', `>>npmci git ...<< action >>${action}<< not supported`);
|
||||
}
|
||||
} else {
|
||||
plugins.beautylog.log(
|
||||
`>>npmci git ...<< cli arguments invalid... Please read the documentation.`
|
||||
);
|
||||
logger.log('info', `>>npmci git ...<< cli arguments invalid... Please read the documentation.`);
|
||||
}
|
||||
};
|
||||
|
||||
export let mirror = async () => {
|
||||
let githubToken = process.env.NPMCI_GIT_GITHUBTOKEN;
|
||||
let githubUser = process.env.NPMCI_GIT_GITHUBGROUP || repo.user;
|
||||
let githubRepo = process.env.NPMCI_GIT_GITHUB || repo.repo;
|
||||
const githubToken = process.env.NPMCI_GIT_GITHUBTOKEN;
|
||||
const githubUser = process.env.NPMCI_GIT_GITHUBGROUP || repo.user;
|
||||
const githubRepo = process.env.NPMCI_GIT_GITHUB || repo.repo;
|
||||
if (githubToken) {
|
||||
plugins.beautylog.info('found github token.');
|
||||
plugins.beautylog.log('attempting the mirror the repository to GitHub');
|
||||
logger.log('info', 'found github token.');
|
||||
logger.log('info', 'attempting the mirror the repository to GitHub');
|
||||
// add the mirror
|
||||
await bash(
|
||||
`git remote add mirror https://${githubToken}@github.com/${githubUser}/${githubRepo}.git`
|
||||
);
|
||||
await bash(`git push mirror --all`);
|
||||
plugins.beautylog.ok('pushed all branches to mirror!');
|
||||
logger.log('ok', 'pushed all branches to mirror!');
|
||||
await bash(`git push mirror --tags`);
|
||||
plugins.beautylog.ok('pushed all tags to mirror!');
|
||||
logger.log('ok', 'pushed all tags to mirror!');
|
||||
} else {
|
||||
plugins.beautylog.error(`cannot find NPMCI_GIT_GITHUBTOKEN env var!`);
|
||||
logger.log('error', `cannot find NPMCI_GIT_GITHUBTOKEN env var!`);
|
||||
process.exit(1);
|
||||
}
|
||||
};
|
||||
|
@ -1,3 +1,4 @@
|
||||
import { logger } from '../npmci.logging';
|
||||
import * as plugins from '../npmci.plugins';
|
||||
import * as paths from '../npmci.paths';
|
||||
import * as npmciConfig from '../npmci.config';
|
||||
@ -9,17 +10,18 @@ import { bash, bashNoError, nvmAvailable } from '../npmci.bash';
|
||||
*/
|
||||
export let handleCli = async argvArg => {
|
||||
if (argvArg._.length >= 3) {
|
||||
let action: string = argvArg._[1];
|
||||
const action: string = argvArg._[1];
|
||||
switch (action) {
|
||||
case 'install':
|
||||
await install(argvArg._[2]);
|
||||
break;
|
||||
default:
|
||||
plugins.beautylog.error(`>>npmci node ...<< action >>${action}<< not supported`);
|
||||
logger.log('error', `>>npmci node ...<< action >>${action}<< not supported`);
|
||||
process.exit(1);
|
||||
}
|
||||
} else {
|
||||
plugins.beautylog.error(
|
||||
logger.log(
|
||||
'error',
|
||||
`>>npmci node ...<< cli arguments invalid... Please read the documentation.`
|
||||
);
|
||||
process.exit(1);
|
||||
@ -31,7 +33,7 @@ export let handleCli = async argvArg => {
|
||||
* @param versionArg
|
||||
*/
|
||||
export let install = async versionArg => {
|
||||
plugins.beautylog.log(`now installing node version ${versionArg}`);
|
||||
logger.log('info', `now installing node version ${versionArg}`);
|
||||
let version: string;
|
||||
if (versionArg === 'stable') {
|
||||
version = '10';
|
||||
@ -44,27 +46,27 @@ export let install = async versionArg => {
|
||||
}
|
||||
if (await nvmAvailable.promise) {
|
||||
await bash(`nvm install ${version} && nvm alias default ${version}`);
|
||||
plugins.beautylog.success(`Node version ${version} successfully installed!`);
|
||||
logger.log('success', `Node version ${version} successfully installed!`);
|
||||
} else {
|
||||
plugins.beautylog.warn('Nvm not in path so staying at installed node version!');
|
||||
logger.log('warn', 'Nvm not in path so staying at installed node version!');
|
||||
}
|
||||
await bash('node -v');
|
||||
await bash('npm -v');
|
||||
await bash(`npm config set cache ${paths.NpmciCacheDir} --global `);
|
||||
// lets look for further config
|
||||
await npmciConfig.getConfig().then(async configArg => {
|
||||
plugins.beautylog.log('Now checking for needed global npm tools...');
|
||||
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 === '');
|
||||
logger.log('info', 'Now checking for needed global npm tools...');
|
||||
for (const npmTool of configArg.npmGlobalTools) {
|
||||
logger.log('info', `Checking for global "${npmTool}"`);
|
||||
const whichOutput: string = await bashNoError(`which ${npmTool}`);
|
||||
const toolAvailable: boolean = !(/not\sfound/.test(whichOutput) || whichOutput === '');
|
||||
if (toolAvailable) {
|
||||
plugins.beautylog.log(`Tool ${npmTool} is available`);
|
||||
logger.log('info', `Tool ${npmTool} is available`);
|
||||
} else {
|
||||
plugins.beautylog.info(`globally installing ${npmTool} from npm`);
|
||||
logger.log('info', `globally installing ${npmTool} from npm`);
|
||||
await bash(`npm install ${npmTool} -q -g`);
|
||||
}
|
||||
}
|
||||
plugins.beautylog.success('all global npm tools specified in npmextra.json are now available!');
|
||||
logger.log('success', 'all global npm tools specified in npmextra.json are now available!');
|
||||
});
|
||||
};
|
||||
|
@ -1,3 +1,4 @@
|
||||
import { logger } from '../npmci.logging';
|
||||
import * as plugins from './mod.plugins';
|
||||
import * as configModule from '../npmci.config';
|
||||
import { bash, bashNoError, nvmAvailable } from '../npmci.bash';
|
||||
@ -8,7 +9,7 @@ import { bash, bashNoError, nvmAvailable } from '../npmci.bash';
|
||||
*/
|
||||
export let handleCli = async argvArg => {
|
||||
if (argvArg._.length >= 2) {
|
||||
let action: string = argvArg._[1];
|
||||
const action: string = argvArg._[1];
|
||||
switch (action) {
|
||||
case 'install':
|
||||
await install();
|
||||
@ -23,13 +24,11 @@ export let handleCli = async argvArg => {
|
||||
await publish();
|
||||
break;
|
||||
default:
|
||||
plugins.beautylog.error(`>>npmci npm ...<< action >>${action}<< not supported`);
|
||||
logger.log('error', `>>npmci npm ...<< action >>${action}<< not supported`);
|
||||
process.exit(1);
|
||||
}
|
||||
} else {
|
||||
plugins.beautylog.log(
|
||||
`>>npmci npm ...<< cli arguments invalid... Please read the documentation.`
|
||||
);
|
||||
logger.log('info', `>>npmci npm ...<< cli arguments invalid... Please read the documentation.`);
|
||||
process.exit(1);
|
||||
}
|
||||
};
|
||||
@ -37,14 +36,14 @@ export let handleCli = async argvArg => {
|
||||
/**
|
||||
* authenticates npm with token from env var
|
||||
*/
|
||||
let prepare = async () => {
|
||||
let npmrcPrefix: string = '//registry.npmjs.org/:_authToken=';
|
||||
let npmToken: string = process.env.NPMCI_TOKEN_NPM;
|
||||
let npmrcFileString: string = npmrcPrefix + npmToken;
|
||||
const prepare = async () => {
|
||||
const npmrcPrefix: string = '//registry.npmjs.org/:_authToken=';
|
||||
const npmToken: string = process.env.NPMCI_TOKEN_NPM;
|
||||
const npmrcFileString: string = npmrcPrefix + npmToken;
|
||||
if (npmToken) {
|
||||
plugins.beautylog.info('found access token');
|
||||
logger.log('info', 'found access token');
|
||||
} else {
|
||||
plugins.beautylog.error('no access token found! Exiting!');
|
||||
logger.log('error', 'no access token found! Exiting!');
|
||||
process.exit(1);
|
||||
}
|
||||
plugins.smartfile.memory.toFsSync(npmrcFileString, '/root/.npmrc');
|
||||
@ -54,7 +53,7 @@ let prepare = async () => {
|
||||
/**
|
||||
* publish a package to npm
|
||||
*/
|
||||
let publish = async () => {
|
||||
const publish = async () => {
|
||||
let npmAccessCliString = ``;
|
||||
const config = await configModule.getConfig();
|
||||
|
||||
@ -67,7 +66,7 @@ let publish = async () => {
|
||||
}
|
||||
|
||||
// -> preparing
|
||||
plugins.beautylog.log(`now preparing environment:`);
|
||||
logger.log('info', `now preparing environment:`);
|
||||
prepare();
|
||||
await bash(`npm -v`);
|
||||
|
||||
@ -75,26 +74,26 @@ let publish = async () => {
|
||||
await bash(`npm install`);
|
||||
await bash(`npm run build`);
|
||||
|
||||
plugins.beautylog.success(`Nice!!! The build for the publication was successfull!`);
|
||||
plugins.beautylog.log(`Lets clean up so we don't publish any packages that don't belong to us:`);
|
||||
logger.log('success', `Nice!!! The build for the publication was successfull!`);
|
||||
logger.log('info', `Lets clean up so we don't publish any packages that don't belong to us:`);
|
||||
// -> clean up before we publish stuff
|
||||
await bashNoError(`rm -r ./.npmci_cache`);
|
||||
await bash(`rm -r ./node_modules`);
|
||||
|
||||
plugins.beautylog.success(`Cleaned up!:`);
|
||||
logger.log('success', `Cleaned up!:`);
|
||||
|
||||
// -> publish it
|
||||
plugins.beautylog.log(`now invoking npm to publish the package!`);
|
||||
logger.log('info', `now invoking npm to publish the package!`);
|
||||
await bash(`npm publish ${npmAccessCliString}`);
|
||||
plugins.beautylog.success(`Package was successfully published!`);
|
||||
logger.log('success', `Package was successfully published!`);
|
||||
};
|
||||
|
||||
let install = async (): Promise<void> => {
|
||||
plugins.beautylog.info('now installing dependencies:');
|
||||
const install = async (): Promise<void> => {
|
||||
logger.log('info', 'now installing dependencies:');
|
||||
await bash('npm install');
|
||||
};
|
||||
|
||||
export let test = async (): Promise<void> => {
|
||||
plugins.beautylog.info('now starting tests:');
|
||||
logger.log('info', 'now starting tests:');
|
||||
await bash('npm test');
|
||||
};
|
||||
|
@ -1,19 +1,20 @@
|
||||
import { logger } from '../npmci.logging';
|
||||
import * as plugins from './mod.plugins';
|
||||
let sshInstance: plugins.smartssh.SshInstance;
|
||||
|
||||
export let handleCli = async argvArg => {
|
||||
if (argvArg._.length >= 2) {
|
||||
let action: string = argvArg._[1];
|
||||
const action: string = argvArg._[1];
|
||||
switch (action) {
|
||||
case 'prepare':
|
||||
await prepare();
|
||||
break;
|
||||
default:
|
||||
plugins.beautylog.error(`action >>${action}<< not supported`);
|
||||
logger.log('error', `action >>${action}<< not supported`);
|
||||
process.exit(1);
|
||||
}
|
||||
} else {
|
||||
plugins.beautylog.error(`>>npmci ssh ...<< please specify an action!`);
|
||||
logger.log('error', `>>npmci ssh ...<< please specify an action!`);
|
||||
process.exit(1);
|
||||
}
|
||||
};
|
||||
@ -21,7 +22,7 @@ export let handleCli = async argvArg => {
|
||||
/**
|
||||
* checks if not undefined
|
||||
*/
|
||||
let notUndefined = (stringArg: string) => {
|
||||
const notUndefined = (stringArg: string) => {
|
||||
return stringArg && stringArg !== 'undefined' && stringArg !== '##';
|
||||
};
|
||||
|
||||
@ -34,27 +35,27 @@ export let prepare = async () => {
|
||||
if (!process.env.NPMTS_TEST) {
|
||||
sshInstance.writeToDisk();
|
||||
} else {
|
||||
plugins.beautylog.log('In test mode, so not storing SSH keys to disk!');
|
||||
logger.log('info', 'In test mode, so not storing SSH keys to disk!');
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* gets called for each found SSH ENV Var and deploys it
|
||||
*/
|
||||
let evaluateSshEnv = async (sshkeyEnvVarArg: string) => {
|
||||
let sshEnvArray = sshkeyEnvVarArg.split('|');
|
||||
let sshKey = new plugins.smartssh.SshKey();
|
||||
plugins.beautylog.info('Found SSH identity for ' + sshEnvArray[1]);
|
||||
const evaluateSshEnv = async (sshkeyEnvVarArg: string) => {
|
||||
const sshEnvArray = sshkeyEnvVarArg.split('|');
|
||||
const sshKey = new plugins.smartssh.SshKey();
|
||||
logger.log('info', 'Found SSH identity for ' + sshEnvArray[1]);
|
||||
if (notUndefined(sshEnvArray[0])) {
|
||||
plugins.beautylog.log('---> host defined!');
|
||||
logger.log('info', '---> host defined!');
|
||||
sshKey.host = sshEnvArray[0];
|
||||
}
|
||||
if (notUndefined(sshEnvArray[1])) {
|
||||
plugins.beautylog.log('---> privKey defined!');
|
||||
logger.log('info', '---> privKey defined!');
|
||||
sshKey.privKeyBase64 = sshEnvArray[1];
|
||||
}
|
||||
if (notUndefined(sshEnvArray[2])) {
|
||||
plugins.beautylog.log('---> pubKey defined!');
|
||||
logger.log('info', '---> pubKey defined!');
|
||||
sshKey.pubKeyBase64 = sshEnvArray[2];
|
||||
}
|
||||
|
||||
|
@ -1,28 +1,29 @@
|
||||
import * as plugins from './mod.plugins';
|
||||
import { bash } from '../npmci.bash';
|
||||
import { logger } from '../npmci.logging';
|
||||
|
||||
let triggerValueRegex = /^([a-zA-Z0-9\.]*)\|([a-zA-Z0-9\.]*)\|([a-zA-Z0-9\.]*)\|([a-zA-Z0-9\.]*)\|?([a-zA-Z0-9\.\-\/]*)/;
|
||||
const triggerValueRegex = /^([a-zA-Z0-9\.]*)\|([a-zA-Z0-9\.]*)\|([a-zA-Z0-9\.]*)\|([a-zA-Z0-9\.]*)\|?([a-zA-Z0-9\.\-\/]*)/;
|
||||
|
||||
export let trigger = async () => {
|
||||
plugins.beautylog.info('now running triggers');
|
||||
logger.log('info', 'now running triggers');
|
||||
plugins.smartparam.forEachMinimatch(process.env, 'NPMCI_TRIGGER_*', evaluateTrigger);
|
||||
};
|
||||
|
||||
let evaluateTrigger = async triggerEnvVarArg => {
|
||||
let triggerRegexResultArray = triggerValueRegex.exec(triggerEnvVarArg);
|
||||
let regexDomain = triggerRegexResultArray[1];
|
||||
let regexProjectId = triggerRegexResultArray[2];
|
||||
let regexProjectTriggerToken = triggerRegexResultArray[3];
|
||||
let regexRefName = triggerRegexResultArray[4];
|
||||
const evaluateTrigger = async triggerEnvVarArg => {
|
||||
const triggerRegexResultArray = triggerValueRegex.exec(triggerEnvVarArg);
|
||||
const regexDomain = triggerRegexResultArray[1];
|
||||
const regexProjectId = triggerRegexResultArray[2];
|
||||
const regexProjectTriggerToken = triggerRegexResultArray[3];
|
||||
const regexRefName = triggerRegexResultArray[4];
|
||||
let regexTriggerName;
|
||||
if (triggerRegexResultArray.length === 6) {
|
||||
regexTriggerName = triggerRegexResultArray[5];
|
||||
} else {
|
||||
regexTriggerName = 'Unnamed Trigger';
|
||||
}
|
||||
plugins.beautylog.info('Found Trigger!');
|
||||
plugins.beautylog.log('triggering build for ref ' + regexRefName + ' of ' + regexTriggerName);
|
||||
plugins.request.postFormData(
|
||||
logger.log('info', 'Found Trigger!');
|
||||
logger.log('info', 'triggering build for ref ' + regexRefName + ' of ' + regexTriggerName);
|
||||
plugins.smartrequest.postFormData(
|
||||
'https://gitlab.com/api/v3/projects/' + regexProjectId + '/trigger/builds',
|
||||
{},
|
||||
[
|
||||
|
@ -1,3 +1,4 @@
|
||||
import { logger } from './npmci.logging';
|
||||
import * as plugins from './npmci.plugins';
|
||||
import * as paths from './npmci.paths';
|
||||
|
||||
@ -10,7 +11,7 @@ export let nvmAvailable = smartpromise.defer<boolean>();
|
||||
/**
|
||||
* the smartshell instance for npmci
|
||||
*/
|
||||
let npmciSmartshell = new plugins.smartshell.Smartshell({
|
||||
const npmciSmartshell = new plugins.smartshell.Smartshell({
|
||||
executor: 'bash',
|
||||
sourceFilePaths: []
|
||||
});
|
||||
@ -18,7 +19,7 @@ let npmciSmartshell = new plugins.smartshell.Smartshell({
|
||||
/**
|
||||
* check for tools.
|
||||
*/
|
||||
let checkToolsAvailable = async () => {
|
||||
const checkToolsAvailable = async () => {
|
||||
// check for nvm
|
||||
if (!process.env.NPMTS_TEST) {
|
||||
if (
|
||||
@ -68,21 +69,19 @@ export let bash = async (commandArg: string, retryArg: number = 2): Promise<stri
|
||||
if (execResult.exitCode !== 0 && i === retryArg) {
|
||||
// something went wrong and retries are exhausted
|
||||
if (failOnError) {
|
||||
plugins.beautylog.error('something went wrong and retries are exhausted');
|
||||
logger.log('error', 'something went wrong and retries are exhausted');
|
||||
process.exit(1);
|
||||
}
|
||||
} else if (execResult.exitCode === 0) {
|
||||
// everything went fine, or no error wanted
|
||||
i = retryArg + 1; // retry +1 breaks for loop, if everything works out ok retrials are not wanted
|
||||
} else {
|
||||
plugins.beautylog.warn(
|
||||
'Something went wrong! Exit Code: ' + execResult.exitCode.toString()
|
||||
);
|
||||
plugins.beautylog.info('Retry ' + (i + 1).toString() + ' of ' + retryArg.toString());
|
||||
logger.log('warn', 'Something went wrong! Exit Code: ' + execResult.exitCode.toString());
|
||||
logger.log('info', 'Retry ' + (i + 1).toString() + ' of ' + retryArg.toString());
|
||||
}
|
||||
}
|
||||
} else {
|
||||
plugins.beautylog.log('ShellExec would be: ' + commandArg);
|
||||
logger.log('info', 'ShellExec would be: ' + commandArg);
|
||||
execResult = {
|
||||
exitCode: 0,
|
||||
stdout: 'testOutput'
|
||||
|
@ -1,11 +1,12 @@
|
||||
import { logger } from './npmci.logging';
|
||||
import * as plugins from './npmci.plugins';
|
||||
import * as paths from './npmci.paths';
|
||||
import * as npmciMonitor from './npmci.monitor';
|
||||
npmciMonitor.run();
|
||||
|
||||
// Get Info about npmci itself
|
||||
let npmciInfo = new plugins.projectinfo.ProjectinfoNpm(paths.NpmciPackageRoot);
|
||||
plugins.beautylog.log('npmci version: ' + npmciInfo.version);
|
||||
const npmciInfo = new plugins.projectinfo.ProjectinfoNpm(paths.NpmciPackageRoot);
|
||||
logger.log('info', 'npmci version: ' + npmciInfo.version);
|
||||
|
||||
import * as NpmciEnv from './npmci.env';
|
||||
|
||||
@ -15,7 +16,7 @@ npmciSmartcli.addVersion(npmciInfo.version);
|
||||
// clean
|
||||
npmciSmartcli.addCommand('clean').subscribe(
|
||||
async argv => {
|
||||
let modClean = await import('./mod_clean/index');
|
||||
const modClean = await import('./mod_clean/index');
|
||||
await modClean.clean();
|
||||
},
|
||||
err => {
|
||||
@ -27,7 +28,7 @@ npmciSmartcli.addCommand('clean').subscribe(
|
||||
// command
|
||||
npmciSmartcli.addCommand('command').subscribe(
|
||||
async argv => {
|
||||
let modCommand = await import('./mod_command/index');
|
||||
const modCommand = await import('./mod_command/index');
|
||||
await modCommand.command();
|
||||
},
|
||||
err => {
|
||||
@ -39,7 +40,7 @@ npmciSmartcli.addCommand('command').subscribe(
|
||||
// command
|
||||
npmciSmartcli.addCommand('git').subscribe(
|
||||
async argvArg => {
|
||||
let modGit = await import('./mod_git/index');
|
||||
const modGit = await import('./mod_git/index');
|
||||
await modGit.handleCli(argvArg);
|
||||
},
|
||||
err => {
|
||||
@ -51,7 +52,7 @@ npmciSmartcli.addCommand('git').subscribe(
|
||||
// build
|
||||
npmciSmartcli.addCommand('docker').subscribe(
|
||||
async argvArg => {
|
||||
let modDocker = await import('./mod_docker/index');
|
||||
const modDocker = await import('./mod_docker/index');
|
||||
await modDocker.handleCli(argvArg);
|
||||
},
|
||||
err => {
|
||||
@ -63,7 +64,7 @@ npmciSmartcli.addCommand('docker').subscribe(
|
||||
// node
|
||||
npmciSmartcli.addCommand('node').subscribe(
|
||||
async argvArg => {
|
||||
let modNode = await import('./mod_node/index');
|
||||
const modNode = await import('./mod_node/index');
|
||||
await modNode.handleCli(argvArg);
|
||||
},
|
||||
err => {
|
||||
@ -75,7 +76,7 @@ npmciSmartcli.addCommand('node').subscribe(
|
||||
// npm
|
||||
npmciSmartcli.addCommand('npm').subscribe(
|
||||
async argvArg => {
|
||||
let modNpm = await import('./mod_npm/index');
|
||||
const modNpm = await import('./mod_npm/index');
|
||||
await modNpm.handleCli(argvArg);
|
||||
},
|
||||
err => {
|
||||
@ -86,7 +87,7 @@ npmciSmartcli.addCommand('npm').subscribe(
|
||||
// trigger
|
||||
npmciSmartcli.addCommand('ssh').subscribe(
|
||||
async argvArg => {
|
||||
let modSsh = await import('./mod_ssh/index');
|
||||
const modSsh = await import('./mod_ssh/index');
|
||||
await modSsh.handleCli(argvArg);
|
||||
},
|
||||
err => {
|
||||
@ -98,7 +99,7 @@ npmciSmartcli.addCommand('ssh').subscribe(
|
||||
// trigger
|
||||
npmciSmartcli.addCommand('trigger').subscribe(
|
||||
async argv => {
|
||||
let modTrigger = await import('./mod_trigger/index');
|
||||
const modTrigger = await import('./mod_trigger/index');
|
||||
await modTrigger.trigger();
|
||||
},
|
||||
err => {
|
||||
|
@ -1,5 +1,3 @@
|
||||
import * as q from 'q';
|
||||
|
||||
import * as plugins from './npmci.plugins';
|
||||
import * as paths from './npmci.paths';
|
||||
|
||||
@ -18,8 +16,8 @@ export interface INpmciOptions {
|
||||
export let kvStorage = new KeyValueStore('custom', `${repo.user}_${repo.repo}`);
|
||||
|
||||
// handle config retrival
|
||||
let npmciNpmextra = new plugins.npmextra.Npmextra(paths.cwd);
|
||||
let defaultConfig: INpmciOptions = {
|
||||
const npmciNpmextra = new plugins.npmextra.Npmextra(paths.cwd);
|
||||
const defaultConfig: INpmciOptions = {
|
||||
npmGlobalTools: [],
|
||||
dockerRegistryRepoMap: {},
|
||||
dockerBuildargEnvMap: {}
|
||||
|
14
ts/npmci.logging.ts
Normal file
14
ts/npmci.logging.ts
Normal file
@ -0,0 +1,14 @@
|
||||
import * as plugins from './npmci.plugins';
|
||||
|
||||
export const logger = new plugins.smartlog.Smartlog({
|
||||
logContext: {
|
||||
company: 'Some Company',
|
||||
companyunit: 'Some Unit',
|
||||
containerName: 'Some ContainerName',
|
||||
environment: 'test',
|
||||
runtime: 'node',
|
||||
zone: 'Some Zone'
|
||||
}
|
||||
});
|
||||
|
||||
logger.addLogDestination(new plugins.smartlogDestinationLocal.DestinationLocal());
|
@ -1,3 +1,4 @@
|
||||
import { logger } from './npmci.logging';
|
||||
import * as plugins from './npmci.plugins';
|
||||
import * as env from './npmci.env';
|
||||
|
||||
@ -17,6 +18,6 @@ export let run = async () => {
|
||||
repo: env.repo.repo
|
||||
})
|
||||
.catch(err => {
|
||||
plugins.beautylog.warn('Lossless Analytics API not available...');
|
||||
logger.log('warn', 'Lossless Analytics API not available...');
|
||||
});
|
||||
};
|
||||
|
@ -1,21 +1,43 @@
|
||||
// node native
|
||||
export import path = require('path');
|
||||
import * as path from 'path';
|
||||
|
||||
export { path };
|
||||
|
||||
// @pushrocks
|
||||
export import beautylog = require('beautylog');
|
||||
export import projectinfo = require('@pushrocks/projectinfo');
|
||||
export import npmextra = require('@pushrocks/npmextra');
|
||||
export import smartdelay = require('@pushrocks/smartdelay');
|
||||
export import smartfile = require('@pushrocks/smartfile');
|
||||
export import smartcli = require('@pushrocks/smartcli');
|
||||
export import smartparam = require('smartparam');
|
||||
export import smartpromise = require('@pushrocks/smartpromise');
|
||||
export import smartshell = require('@pushrocks/smartshell');
|
||||
export import smartsocket = require('smartsocket');
|
||||
export import smartssh = require('@pushrocks/smartssh');
|
||||
export import smartstring = require('@pushrocks/smartstring');
|
||||
import * as projectinfo from '@pushrocks/projectinfo';
|
||||
import * as npmextra from '@pushrocks/npmextra';
|
||||
import * as smartdelay from '@pushrocks/smartdelay';
|
||||
import * as smartfile from '@pushrocks/smartfile';
|
||||
import * as smartcli from '@pushrocks/smartcli';
|
||||
import * as smartlog from '@pushrocks/smartlog';
|
||||
import * as smartlogDestinationLocal from '@pushrocks/smartlog-destination-local';
|
||||
import * as smartparam from '@pushrocks/smartparam';
|
||||
import * as smartpromise from '@pushrocks/smartpromise';
|
||||
import * as smartrequest from '@pushrocks/smartrequest';
|
||||
import * as smartshell from '@pushrocks/smartshell';
|
||||
import * as smartsocket from 'smartsocket';
|
||||
import * as smartssh from '@pushrocks/smartssh';
|
||||
import * as smartstring from '@pushrocks/smartstring';
|
||||
|
||||
export {
|
||||
projectinfo,
|
||||
npmextra,
|
||||
smartdelay,
|
||||
smartfile,
|
||||
smartcli,
|
||||
smartlog,
|
||||
smartlogDestinationLocal,
|
||||
smartparam,
|
||||
smartpromise,
|
||||
smartrequest,
|
||||
smartshell,
|
||||
smartsocket,
|
||||
smartssh,
|
||||
smartstring
|
||||
};
|
||||
|
||||
// third party
|
||||
export import lodash = require('lodash');
|
||||
export import through2 = require('through2');
|
||||
export import request = require('@pushrocks/smartrequest');
|
||||
import * as lodash from 'lodash';
|
||||
import * as through2 from 'through2';
|
||||
|
||||
export { lodash, through2 };
|
||||
|
Reference in New Issue
Block a user