Compare commits
6 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 8604c63d37 | |||
| db0b38bd7b | |||
| edde87b6be | |||
| 5085d664cb | |||
| 5d468fc840 | |||
| e2ac6cdcc9 |
@@ -26,6 +26,7 @@ mirror:
|
|||||||
snyk:
|
snyk:
|
||||||
stage: security
|
stage: security
|
||||||
script:
|
script:
|
||||||
|
- npmci npm prepare
|
||||||
- npmci command npm install -g snyk
|
- npmci command npm install -g snyk
|
||||||
- npmci command npm install --ignore-scripts
|
- npmci command npm install --ignore-scripts
|
||||||
- npmci command snyk test
|
- npmci command snyk test
|
||||||
@@ -39,6 +40,7 @@ snyk:
|
|||||||
testLEGACY:
|
testLEGACY:
|
||||||
stage: test
|
stage: test
|
||||||
script:
|
script:
|
||||||
|
- npmci npm prepare
|
||||||
- npmci node install legacy
|
- npmci node install legacy
|
||||||
- npmci npm install
|
- npmci npm install
|
||||||
- npmci npm test
|
- npmci npm test
|
||||||
@@ -51,6 +53,7 @@ testLEGACY:
|
|||||||
testLTS:
|
testLTS:
|
||||||
stage: test
|
stage: test
|
||||||
script:
|
script:
|
||||||
|
- npmci npm prepare
|
||||||
- npmci node install lts
|
- npmci node install lts
|
||||||
- npmci npm install
|
- npmci npm install
|
||||||
- npmci npm test
|
- npmci npm test
|
||||||
@@ -62,6 +65,7 @@ testLTS:
|
|||||||
testSTABLE:
|
testSTABLE:
|
||||||
stage: test
|
stage: test
|
||||||
script:
|
script:
|
||||||
|
- npmci npm prepare
|
||||||
- npmci node install stable
|
- npmci node install stable
|
||||||
- npmci npm install
|
- npmci npm install
|
||||||
- npmci npm test
|
- npmci npm test
|
||||||
@@ -118,6 +122,7 @@ pages:
|
|||||||
stage: metadata
|
stage: metadata
|
||||||
script:
|
script:
|
||||||
- npmci command npm install -g typedoc typescript
|
- npmci command npm install -g typedoc typescript
|
||||||
|
- npmci npm prepare
|
||||||
- npmci npm install
|
- npmci npm install
|
||||||
- npmci command typedoc --module "commonjs" --target "ES2016" --out public/ ts/
|
- npmci command typedoc --module "commonjs" --target "ES2016" --out public/ ts/
|
||||||
tags:
|
tags:
|
||||||
|
|||||||
3
cli.js
Normal file
3
cli.js
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
#!/usr/bin/env node
|
||||||
|
process.env.CLI_CALL = 'true';
|
||||||
|
require('./dist/index');
|
||||||
4
cli.ts.js
Normal file
4
cli.ts.js
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
#!/usr/bin/env node
|
||||||
|
process.env.CLI_CALL = 'true';
|
||||||
|
require('@gitzone/tsrun');
|
||||||
|
require('./ts/index');
|
||||||
1215
package-lock.json
generated
1215
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
47
package.json
47
package.json
@@ -1,16 +1,16 @@
|
|||||||
{
|
{
|
||||||
"name": "@shipzone/npmci",
|
"name": "@shipzone/npmci",
|
||||||
"version": "3.0.56",
|
"version": "3.0.59",
|
||||||
"description": "node and docker in gitlab ci on steroids",
|
"description": "node and docker in gitlab ci on steroids",
|
||||||
"main": "dist/index.js",
|
"main": "dist/index.js",
|
||||||
"typings": "dist/index.d.ts",
|
"typings": "dist/index.d.ts",
|
||||||
"bin": {
|
"bin": {
|
||||||
"npmci": "dist/cli.js"
|
"npmci": "cli.js"
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"test": "(rm -f config.json) && tsrun test/test.ts",
|
"test": "(rm -f config.json) && tstest test/",
|
||||||
"build": "(rm -f config.json) && (npmts) && (npm run testVersion)",
|
"build": "(rm -f config.json) && tsbuild && (npm run testVersion)",
|
||||||
"testVersion": "(cd test/assets/ && node ../../dist/cli.js -v)"
|
"testVersion": "(cd test/assets/ && node ../../cli.js -v)"
|
||||||
},
|
},
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
@@ -23,32 +23,33 @@
|
|||||||
},
|
},
|
||||||
"homepage": "https://gitlab.com/gitzone/npmci#README",
|
"homepage": "https://gitlab.com/gitzone/npmci#README",
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@gitzone/tsrun": "^1.1.9",
|
"@gitzone/tsbuild": "^2.0.22",
|
||||||
"@pushrocks/tapbundle": "^3.0.1"
|
"@gitzone/tsrun": "^1.1.12",
|
||||||
|
"@gitzone/tstest": "^1.0.15",
|
||||||
|
"@pushrocks/tapbundle": "^3.0.7",
|
||||||
|
"@types/node": "^10.10.3"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@pushrocks/smartcli": "^3.0.2",
|
"@pushrocks/lik": "^3.0.1",
|
||||||
"@pushrocks/smartdelay": "^2.0.1",
|
"@pushrocks/npmextra": "^3.0.1",
|
||||||
"@pushrocks/smartfile": "^6.0.3",
|
"@pushrocks/projectinfo": "^4.0.2",
|
||||||
|
"@pushrocks/smartcli": "^3.0.4",
|
||||||
|
"@pushrocks/smartdelay": "^2.0.2",
|
||||||
|
"@pushrocks/smartfile": "^6.0.8",
|
||||||
|
"@pushrocks/smartparam": "^1.0.4",
|
||||||
"@pushrocks/smartpromise": "^2.0.5",
|
"@pushrocks/smartpromise": "^2.0.5",
|
||||||
"@types/lodash": "^4.14.112",
|
"@pushrocks/smartrequest": "^1.1.14",
|
||||||
|
"@pushrocks/smartshell": "^2.0.6",
|
||||||
|
"@pushrocks/smartssh": "^1.2.3",
|
||||||
|
"@pushrocks/smartstring": "^3.0.4",
|
||||||
|
"@types/lodash": "^4.14.116",
|
||||||
"@types/shelljs": "^0.8.0",
|
"@types/shelljs": "^0.8.0",
|
||||||
"@types/through2": "^2.0.33",
|
"@types/through2": "^2.0.34",
|
||||||
"beautylog": "^6.1.10",
|
"beautylog": "^6.1.10",
|
||||||
"cflare": "^1.0.5",
|
"cflare": "^1.0.5",
|
||||||
"lik": "^2.0.5",
|
"lodash": "^4.17.11",
|
||||||
"lodash": "^4.17.10",
|
|
||||||
"npmextra": "^2.0.9",
|
|
||||||
"projectinfo": "^3.0.4",
|
|
||||||
"request": "^2.87.0",
|
|
||||||
"shelljs": "^0.8.2",
|
|
||||||
"smartanalytics": "^2.0.9",
|
"smartanalytics": "^2.0.9",
|
||||||
"smartparam": "^1.0.2",
|
|
||||||
"smartshell": "^1.0.19",
|
|
||||||
"smartsocket": "^1.1.19",
|
"smartsocket": "^1.1.19",
|
||||||
"smartssh": "^1.2.2",
|
|
||||||
"smartstring": "^2.0.28",
|
|
||||||
"smartsystem": "^2.0.2",
|
|
||||||
"through2": "^2.0.3"
|
"through2": "^2.0.3"
|
||||||
},
|
},
|
||||||
"private": false
|
"private": false
|
||||||
|
|||||||
@@ -1,31 +0,0 @@
|
|||||||
import * as plugins from './mod.plugins';
|
|
||||||
|
|
||||||
let npmciCflare = new plugins.cflare.CflareAccount();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* handle cli input
|
|
||||||
* @param argvArg
|
|
||||||
*/
|
|
||||||
export let handleCli = async argvArg => {
|
|
||||||
if (argvArg._.length >= 2) {
|
|
||||||
let action: string = argvArg._[1];
|
|
||||||
switch (action) {
|
|
||||||
default:
|
|
||||||
plugins.beautylog.error(`>>npmci cloudflare ...<< action >>${action}<< not supported`);
|
|
||||||
process.exit(1);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
plugins.beautylog.log(
|
|
||||||
`>>npmci cloudflare ...<< cli arguments invalid... Please read the documentation.`
|
|
||||||
);
|
|
||||||
process.exit(1);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
export let purge = async argvArg => {
|
|
||||||
npmciCflare.auth({
|
|
||||||
email: '',
|
|
||||||
key: ''
|
|
||||||
});
|
|
||||||
npmciCflare.purgeZone(argvArg._[1]);
|
|
||||||
};
|
|
||||||
@@ -1,5 +0,0 @@
|
|||||||
export * from '../npmci.plugins';
|
|
||||||
|
|
||||||
import * as cflare from 'cflare';
|
|
||||||
|
|
||||||
export { cflare };
|
|
||||||
@@ -22,7 +22,20 @@ let evaluateTrigger = async triggerEnvVarArg => {
|
|||||||
}
|
}
|
||||||
plugins.beautylog.info('Found Trigger!');
|
plugins.beautylog.info('Found Trigger!');
|
||||||
plugins.beautylog.log('triggering build for ref ' + regexRefName + ' of ' + regexTriggerName);
|
plugins.beautylog.log('triggering build for ref ' + regexRefName + ' of ' + regexTriggerName);
|
||||||
plugins.request.post('https://gitlab.com/api/v3/projects/' + regexProjectId + '/trigger/builds', {
|
plugins.request.postFormData(
|
||||||
form: { token: regexProjectTriggerToken, ref: regexRefName }
|
'https://gitlab.com/api/v3/projects/' + regexProjectId + '/trigger/builds',
|
||||||
});
|
{},
|
||||||
|
[
|
||||||
|
{
|
||||||
|
name: 'token',
|
||||||
|
payload: regexProjectTriggerToken,
|
||||||
|
type: 'string'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'ref',
|
||||||
|
payload: regexRefName,
|
||||||
|
type: 'string'
|
||||||
|
}
|
||||||
|
]
|
||||||
|
);
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -22,14 +22,14 @@ let checkToolsAvailable = async () => {
|
|||||||
// check for nvm
|
// check for nvm
|
||||||
if (!process.env.NPMTS_TEST) {
|
if (!process.env.NPMTS_TEST) {
|
||||||
if (
|
if (
|
||||||
(await plugins.smartshell.execSilent(`bash -c "source /usr/local/nvm/nvm.sh"`)).exitCode === 0
|
(await npmciSmartshell.execSilent(`bash -c "source /usr/local/nvm/nvm.sh"`)).exitCode === 0
|
||||||
) {
|
) {
|
||||||
npmciSmartshell.addSourceFiles([`/usr/local/nvm/nvm.sh`]);
|
npmciSmartshell.shellEnv.addSourceFiles([`/usr/local/nvm/nvm.sh`]);
|
||||||
nvmAvailable.resolve(true);
|
nvmAvailable.resolve(true);
|
||||||
} else if (
|
} else if (
|
||||||
(await plugins.smartshell.execSilent(`bash -c "source ~/.nvm/nvm.sh"`)).exitCode === 0
|
(await npmciSmartshell.execSilent(`bash -c "source ~/.nvm/nvm.sh"`)).exitCode === 0
|
||||||
) {
|
) {
|
||||||
npmciSmartshell.addSourceFiles([`~/.nvm/nvm.sh`]);
|
npmciSmartshell.shellEnv.addSourceFiles([`~/.nvm/nvm.sh`]);
|
||||||
nvmAvailable.resolve(true);
|
nvmAvailable.resolve(true);
|
||||||
} else {
|
} else {
|
||||||
nvmAvailable.resolve(false);
|
nvmAvailable.resolve(false);
|
||||||
|
|||||||
@@ -9,15 +9,13 @@ plugins.beautylog.log('npmci version: ' + npmciInfo.version);
|
|||||||
|
|
||||||
import * as NpmciEnv from './npmci.env';
|
import * as NpmciEnv from './npmci.env';
|
||||||
|
|
||||||
import * as npmciMods from './npmci.mods';
|
|
||||||
|
|
||||||
const npmciSmartcli = new plugins.smartcli.Smartcli();
|
const npmciSmartcli = new plugins.smartcli.Smartcli();
|
||||||
npmciSmartcli.addVersion(npmciInfo.version);
|
npmciSmartcli.addVersion(npmciInfo.version);
|
||||||
|
|
||||||
// clean
|
// clean
|
||||||
npmciSmartcli.addCommand('clean').subscribe(
|
npmciSmartcli.addCommand('clean').subscribe(
|
||||||
async argv => {
|
async argv => {
|
||||||
let modClean = await npmciMods.modClean.load();
|
let modClean = await import('./mod_clean/index');
|
||||||
await modClean.clean();
|
await modClean.clean();
|
||||||
},
|
},
|
||||||
err => {
|
err => {
|
||||||
@@ -26,21 +24,10 @@ npmciSmartcli.addCommand('clean').subscribe(
|
|||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
// cloudflare
|
|
||||||
npmciSmartcli.addCommand('cloudflare').subscribe(
|
|
||||||
async argvArg => {
|
|
||||||
let modPurge = await npmciMods.modCloudflare.load();
|
|
||||||
await modPurge.handleCli(argvArg);
|
|
||||||
},
|
|
||||||
err => {
|
|
||||||
console.log(err);
|
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
||||||
// command
|
// command
|
||||||
npmciSmartcli.addCommand('command').subscribe(
|
npmciSmartcli.addCommand('command').subscribe(
|
||||||
async argv => {
|
async argv => {
|
||||||
let modCommand = await npmciMods.modCommand.load();
|
let modCommand = await import('./mod_command/index');
|
||||||
await modCommand.command();
|
await modCommand.command();
|
||||||
},
|
},
|
||||||
err => {
|
err => {
|
||||||
@@ -52,7 +39,7 @@ npmciSmartcli.addCommand('command').subscribe(
|
|||||||
// command
|
// command
|
||||||
npmciSmartcli.addCommand('git').subscribe(
|
npmciSmartcli.addCommand('git').subscribe(
|
||||||
async argvArg => {
|
async argvArg => {
|
||||||
let modGit = await npmciMods.modGit.load();
|
let modGit = await import('./mod_git/index');
|
||||||
await modGit.handleCli(argvArg);
|
await modGit.handleCli(argvArg);
|
||||||
},
|
},
|
||||||
err => {
|
err => {
|
||||||
@@ -64,7 +51,7 @@ npmciSmartcli.addCommand('git').subscribe(
|
|||||||
// build
|
// build
|
||||||
npmciSmartcli.addCommand('docker').subscribe(
|
npmciSmartcli.addCommand('docker').subscribe(
|
||||||
async argvArg => {
|
async argvArg => {
|
||||||
let modDocker = await npmciMods.modDocker.load();
|
let modDocker = await import('./mod_docker/index');
|
||||||
await modDocker.handleCli(argvArg);
|
await modDocker.handleCli(argvArg);
|
||||||
},
|
},
|
||||||
err => {
|
err => {
|
||||||
@@ -76,7 +63,7 @@ npmciSmartcli.addCommand('docker').subscribe(
|
|||||||
// node
|
// node
|
||||||
npmciSmartcli.addCommand('node').subscribe(
|
npmciSmartcli.addCommand('node').subscribe(
|
||||||
async argvArg => {
|
async argvArg => {
|
||||||
let modNode = await npmciMods.modNode.load();
|
let modNode = await import('./mod_node/index');
|
||||||
await modNode.handleCli(argvArg);
|
await modNode.handleCli(argvArg);
|
||||||
},
|
},
|
||||||
err => {
|
err => {
|
||||||
@@ -88,7 +75,7 @@ npmciSmartcli.addCommand('node').subscribe(
|
|||||||
// npm
|
// npm
|
||||||
npmciSmartcli.addCommand('npm').subscribe(
|
npmciSmartcli.addCommand('npm').subscribe(
|
||||||
async argvArg => {
|
async argvArg => {
|
||||||
let modNpm = await npmciMods.modNpm.load();
|
let modNpm = await import('./mod_npm/index');
|
||||||
await modNpm.handleCli(argvArg);
|
await modNpm.handleCli(argvArg);
|
||||||
},
|
},
|
||||||
err => {
|
err => {
|
||||||
@@ -99,7 +86,7 @@ npmciSmartcli.addCommand('npm').subscribe(
|
|||||||
// trigger
|
// trigger
|
||||||
npmciSmartcli.addCommand('ssh').subscribe(
|
npmciSmartcli.addCommand('ssh').subscribe(
|
||||||
async argvArg => {
|
async argvArg => {
|
||||||
let modSsh = await npmciMods.modSsh.load();
|
let modSsh = await import('./mod_ssh/index');
|
||||||
await modSsh.handleCli(argvArg);
|
await modSsh.handleCli(argvArg);
|
||||||
},
|
},
|
||||||
err => {
|
err => {
|
||||||
@@ -111,7 +98,7 @@ npmciSmartcli.addCommand('ssh').subscribe(
|
|||||||
// trigger
|
// trigger
|
||||||
npmciSmartcli.addCommand('trigger').subscribe(
|
npmciSmartcli.addCommand('trigger').subscribe(
|
||||||
async argv => {
|
async argv => {
|
||||||
let modTrigger = await npmciMods.modTrigger.load();
|
let modTrigger = await import('./mod_trigger/index');
|
||||||
await modTrigger.trigger();
|
await modTrigger.trigger();
|
||||||
},
|
},
|
||||||
err => {
|
err => {
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import * as paths from './npmci.paths';
|
|||||||
|
|
||||||
import { repo } from './npmci.env';
|
import { repo } from './npmci.env';
|
||||||
|
|
||||||
import { KeyValueStore } from 'npmextra';
|
import { KeyValueStore } from '@pushrocks/npmextra';
|
||||||
|
|
||||||
export interface INpmciOptions {
|
export interface INpmciOptions {
|
||||||
npmGlobalTools: string[];
|
npmGlobalTools: string[];
|
||||||
|
|||||||
@@ -1,24 +0,0 @@
|
|||||||
import * as _modClean from './mod_clean/index';
|
|
||||||
import * as _modCloudflare from './mod_cloudflare/index';
|
|
||||||
import * as _modCommand from './mod_command/index';
|
|
||||||
import * as _modDocker from './mod_docker/index';
|
|
||||||
import * as _modGit from './mod_git/index';
|
|
||||||
import * as _modNpm from './mod_npm/index';
|
|
||||||
import * as _modNode from './mod_node/index';
|
|
||||||
import * as _modSsh from './mod_ssh/index';
|
|
||||||
import * as _modTrigger from './mod_trigger/index';
|
|
||||||
|
|
||||||
import { LazyModule } from 'smartsystem';
|
|
||||||
|
|
||||||
export let modClean = new LazyModule<typeof _modClean>('./mod_clean/index', __dirname);
|
|
||||||
export let modCloudflare = new LazyModule<typeof _modCloudflare>(
|
|
||||||
'./mod_cloudflare/index',
|
|
||||||
__dirname
|
|
||||||
);
|
|
||||||
export let modCommand = new LazyModule<typeof _modCommand>('./mod_command/index', __dirname);
|
|
||||||
export let modGit = new LazyModule<typeof _modGit>('./mod_git/index', __dirname);
|
|
||||||
export let modDocker = new LazyModule<typeof _modDocker>('./mod_docker/index', __dirname);
|
|
||||||
export let modNode = new LazyModule<typeof _modNode>('./mod_node/index', __dirname);
|
|
||||||
export let modNpm = new LazyModule<typeof _modNpm>('./mod_npm/index', __dirname);
|
|
||||||
export let modSsh = new LazyModule<typeof _modSsh>('./mod_ssh/index', __dirname);
|
|
||||||
export let modTrigger = new LazyModule<typeof _modTrigger>('./mod_trigger/index', __dirname);
|
|
||||||
@@ -1,18 +1,21 @@
|
|||||||
export import beautylog = require('beautylog');
|
// node native
|
||||||
export import lodash = require('lodash');
|
|
||||||
export import npmextra = require('npmextra');
|
|
||||||
export import path = require('path');
|
export import path = require('path');
|
||||||
export import projectinfo = require('projectinfo');
|
|
||||||
export let request = require('request');
|
// @pushrocks
|
||||||
export import smartcli = require('@pushrocks/smartcli');
|
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 smartdelay = require('@pushrocks/smartdelay');
|
||||||
export import smartfile = require('@pushrocks/smartfile');
|
export import smartfile = require('@pushrocks/smartfile');
|
||||||
export import shelljs = require('shelljs');
|
export import smartcli = require('@pushrocks/smartcli');
|
||||||
export import smartparam = require('smartparam');
|
export import smartparam = require('smartparam');
|
||||||
export import smartpromise = require('@pushrocks/smartpromise');
|
export import smartpromise = require('@pushrocks/smartpromise');
|
||||||
export import smartshell = require('smartshell');
|
export import smartshell = require('@pushrocks/smartshell');
|
||||||
export import smartsocket = require('smartsocket');
|
export import smartsocket = require('smartsocket');
|
||||||
export import smartsystem = require('smartsystem');
|
export import smartssh = require('@pushrocks/smartssh');
|
||||||
export import smartssh = require('smartssh');
|
export import smartstring = require('@pushrocks/smartstring');
|
||||||
export import smartstring = require('smartstring');
|
|
||||||
|
// third party
|
||||||
|
export import lodash = require('lodash');
|
||||||
export import through2 = require('through2');
|
export import through2 = require('through2');
|
||||||
|
export import request = require('@pushrocks/smartrequest');
|
||||||
|
|||||||
Reference in New Issue
Block a user