refactor cli and add new s3 (#5211)

This commit is contained in:
Eugenio Romano 2019-11-11 15:48:55 +01:00 committed by GitHub
parent 112e4acca8
commit 4f0cebe98b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
18 changed files with 696 additions and 3736 deletions

View File

@ -13,6 +13,27 @@ To get started follow these instructions:
npm install @alfresco/adf-cli -g
``
To know more about any command use the -h or --help option
## Commands
|**Commands** |**Description** |
|--- |--- |
|artifact-from-s3 |Get artifact from S3 |
|artifact-to-s3 |Get artifact to S3 |
|docker-publish |publish docker image|
|init-aae-env |Init env|
|kubectl-delete |delete kubectl |
|kubectl-image |This command allows you to update a specific service on the rancher env with a specifig tag |
|npm-publish | publish on npm |
| update-commit-sha | his command allows you to update the commit sha as part of the package.json. Your package.json must to have an existing property called "commit" |
|update-version |This command allows you to update the adf dependencies and js-api with different versions Update adf libs and js-api with latest alpha|
|adf-license |Create a 3th party license file |
|adf-audit |Check the security risk dependency in your package.json |
## Examples
### License Check
Move in the folder where you have your package.json and run the command:

View File

@ -3,7 +3,7 @@ const minimist = require('minimist');
const path = require('path');
const args = minimist(process.argv.slice(2), {
boolean: ['verbose']
boolean: ['verbose']
});
const scriptName = args._.shift();
const scriptPath = path.join('../scripts', scriptName);
@ -12,49 +12,15 @@ const cwd = process.cwd();
process.chdir(path.join(__dirname, '..'));
// This might get awkward, so we fallback to console if there was an error.
let logger = null;
try {
logger = new (require('@angular-devkit/core').logging.IndentLogger)('root');
const { bold, gray, red, yellow, white } = require('@angular-devkit/core').terminal;
const filter = require('rxjs/operators').filter;
logger
.pipe(filter(entry => (entry.level !== 'debug' || args.verbose)))
.subscribe(entry => {
let color = gray;
let output = process.stdout;
switch (entry.level) {
case 'info': color = white; break;
case 'warn': color = yellow; break;
case 'error': color = red; output = process.stderr; break;
case 'fatal': color = x => bold(red(x)); output = process.stderr; break;
}
output.write(color(entry.message) + '\n');
});
} catch (e) {
console.error(`Reverting to manual console logging.\nReason: ${e.message}.`);
logger = {
debug: console.log.bind(console),
info: console.log.bind(console),
warn: console.warn.bind(console),
error: console.error.bind(console),
fatal: x => { console.error(x); process.exit(100); },
createChild: () => logger,
};
}
try {
Promise.resolve()
.then(() => require(scriptPath).default(args, logger, cwd))
.then(exitCode => process.exit(exitCode || 0))
.catch(err => {
logger.fatal(err && err.stack);
process.exit(99);
});
Promise.resolve()
.then(() => require(scriptPath).default(args, cwd))
.then(exitCode => process.exit(exitCode || 0))
.catch(err => {
console.error(err && err.stack);
process.exit(99);
});
} catch (err) {
logger.fatal(err.stack);
process.exit(99);
console.error(err.stack);
process.exit(99);
}

3437
lib/cli/package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -20,7 +20,7 @@
"dist": "rm -rf ./dist/ && npm run build-tsc && cp -R ./bin ./dist/ && cp ./package.json ./dist/"
},
"dependencies": {
"commander": "^2.15.1",
"commander": "^4.0.0",
"license-checker": "^25.0.1",
"npm-registry-fetch": "^3.9.0",
"@angular-devkit/core": "^7.2.15",

View File

@ -0,0 +1,67 @@
#!/usr/bin/env node
/*!
* @license
* Copyright 2019 Alfresco Software, Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { exec } from './exec';
import { logger } from './logger';
import * as program from 'commander';
function test(output: string) {
const response = exec('test !', [`-d ${output} && mkdir ${output}`], {});
logger.info(response);
}
function awsCp(artifact: string) {
logger.info(`aws s3 cp ${artifact}`);
const response = exec(`aws s3 cp ${artifact}`, [`./s3-artifact.tmp ${artifact}`], {});
logger.info(response);
}
function zipArtifact(output: string) {
logger.info(`Perform zip artifact ${output}`);
const response = exec('tar', ['-xvf', `./s3-artifact.tmp`, '-C ' + program.output], {});
logger.info(response);
}
export default function () {
main();
}
function main() {
program
.version('0.1.0')
.requiredOption('-a, --artifact [type]', ' path to the s3 artifact (tar.bz2) to download and extract')
.requiredOption('-o, --output [type]', 'directory to extract the archive to')
.parse(process.argv);
if (process.argv.includes('-h') || process.argv.includes('--help')) {
program.outputHelp();
}
if (!program.artifact || program.artifact === '' || !program.output || program.output === '') {
process.exit(1);
} else if (program.artifact !== '' || program.output !== '') {
zipArtifact(program.artifact);
awsCp(program.output);
}
test(program.output);
awsCp(program.artifact);
zipArtifact(program.output);
}

View File

@ -0,0 +1,59 @@
#!/usr/bin/env node
/*!
* @license
* Copyright 2019 Alfresco Software, Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { exec } from './exec';
import { logger } from './logger';
import * as program from 'commander';
function zipArtifact(artifact: string) {
logger.info(`Perform zip artifact ${artifact}`);
const response = exec(`tar cvfj ./s3-artifact.tmp -C ${program.artifact} ls ${program.artifact}`, [] , {});
logger.info(response);
}
function awsCp(output: string) {
logger.info(`aws s3 cp ${output}`);
const response = exec('aws s3 cp', [`./s3-artifact.tmp ${output}`], {});
logger.info(response);
}
export default function () {
main();
}
function main() {
program
.version('0.1.0')
.option('-a, --artifact [type]', ' path to the artifact to archieve (tar.bz2) and upload (like ./dist)')
.option('-o, --output [type]', ' the S3 object to copy it to, like: s3://bucket-name/folder/whatever.tar.bz2')
.parse(process.argv);
if (process.argv.includes('-h') || process.argv.includes('--help')) {
program.outputHelp();
}
if (!program.artifact || program.artifact === '' || !program.output || program.output === '') {
process.exit(1);
} else if (program.artifact !== '' || program.output !== '') {
zipArtifact(program.artifact);
awsCp(program.output);
}
}

View File

@ -17,8 +17,9 @@
* limitations under the License.
*/
import { logging } from '@angular-devkit/core';
import { spawnSync } from 'child_process';
import { exec } from './exec';
import * as program from 'commander';
import { logger } from './logger';
export interface PublishArgs {
tag?: string;
@ -31,71 +32,70 @@ export interface PublishArgs {
pathProject: string;
}
function _exec(command: string, args: string[], opts: { cwd?: string }, logger: logging.Logger) {
if (process.platform.startsWith('win')) {
args.unshift('/c', command);
command = 'cmd.exe';
}
const { status, error, stderr, stdout } = spawnSync(command, args, { ...opts });
if (status !== 0) {
logger.error(`Command failed: ${command} ${args.map((x) => JSON.stringify(x)).join(', ')}`);
if (error) {
logger.error('Error: ' + (error ? error.message : 'undefined'));
} else {
logger.error(`STDERR:\n${stderr}`);
}
throw error;
} else {
return stdout.toString();
}
}
function _loginPerform(args: PublishArgs, logger: logging.Logger) {
function loginPerform(args: PublishArgs) {
logger.info(`Perform docker login...${args.loginRepo}`);
const loginDockerRes = _exec('docker', ['login', `-u=${args.loginUsername}`, `-p=${args.loginPassword}`, `${args.loginRepo}`], {}, logger);
const loginDockerRes = exec('docker', ['login', `-u=${args.loginUsername}`, `-p=${args.loginPassword}`, `${args.loginRepo}`], {});
logger.info(loginDockerRes);
}
function _buildImagePerform(args: PublishArgs, tag: string, logger: logging.Logger) {
function buildImagePerform(args: PublishArgs, tag: string) {
logger.info(`Perform docker build...${args.dockerRepo}:${tag}`);
const response = _exec('docker', ['build', `-t=${args.dockerRepo}:${tag}`, args.pathProject], {}, logger);
const response = exec('docker', ['build', `-t=${args.dockerRepo}:${tag}`, args.pathProject], {});
logger.info(response);
}
function _tagImagePerform(args: PublishArgs, tag: string, logger: logging.Logger) {
function tagImagePerform(args: PublishArgs, tag: string) {
logger.info(`Perform docker tag... ${args.dockerRepo}:${tag} on ${args.dockerRepo}:${tag}`);
const response = _exec('docker', ['tag', `${args.dockerRepo}:${tag}`, `${args.dockerRepo}:${tag}`], {}, logger);
const response = exec('docker', ['tag', `${args.dockerRepo}:${tag}`, `${args.dockerRepo}:${tag}`], {});
logger.info(response);
}
function _pushImagePerform(args: PublishArgs, logger: logging.Logger) {
function pushImagePerform(args: PublishArgs) {
logger.info(`Perform docker push... ${args.dockerRepo}`);
const response = _exec('docker', ['push', `${args.dockerRepo}`], {}, logger);
const response = exec('docker', ['push', `${args.dockerRepo}`], {});
logger.info(response);
}
function _cleanImagePerform(args: PublishArgs, tag: string, logger: logging.Logger) {
function cleanImagePerform(args: PublishArgs, tag: string) {
logger.info('Perform docker clean...');
const response = _exec('docker', ['rmi', `-f`, `${args.dockerRepo}:${tag}`], {}, logger);
const response = exec('docker', ['rmi', `-f`, `${args.dockerRepo}:${tag}`], {});
logger.info(response);
}
export default async function (args: PublishArgs, logger: logging.Logger) {
export default function (args: PublishArgs) {
main(args);
}
function main(args) {
program
.version('0.1.0')
.description('Move in the folder where you have your Dockerfile and run the command:\n\n' +
'adf-cli docker-publish --dockerRepo "${docker_repository}" --dockerTags "${TAGS}" --pathProject "$(pwd)"')
.option('--loginRepo [type]', 'URL registry')
.option('--loginPassword [type]', ' password')
.option('--loginUsername [type]', ' username')
.option('--loginCheck [type]', 'perform login')
.option('--dockerRepo [type]', 'docker repo')
.option('--dockerTags [type]', ' tags')
.option('--pathProject [type]', 'path ptojrct')
.parse(process.argv);
if (process.argv.includes('-h') || process.argv.includes('--help')) {
program.outputHelp();
}
if (args.loginCheck === true) {
_loginPerform(args, logger);
loginPerform(args);
}
if (args.dockerTags !== undefined) {
args.dockerTags.split(',').forEach( (tag) => {
logger.info(`Analyzing tag:${tag} ...`);
_buildImagePerform(args, tag, logger);
_tagImagePerform(args, tag, logger);
_pushImagePerform(args, logger);
_cleanImagePerform(args, tag, logger);
buildImagePerform(args, tag);
tagImagePerform(args, tag);
pushImagePerform(args);
cleanImagePerform(args, tag);
logger.info(`tag:${tag} done`);
});
}
}

42
lib/cli/scripts/exec.ts Normal file
View File

@ -0,0 +1,42 @@
#!/usr/bin/env node
/*!
* @license
* Copyright 2019 Alfresco Software, Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { spawnSync } from 'child_process';
import { logger } from './logger';
export function exec(command: string, args?: string[], opts?: { cwd?: string }) {
if (process.platform.startsWith('win')) {
args.unshift('/c', command);
command = 'cmd.exe';
}
const { status, error, stderr, stdout } = spawnSync(command, args, { ...opts });
if (status !== 0) {
logger.error(`Command failed: ${command} ${args.map((x) => JSON.stringify(x)).join(', ')}`);
if (error) {
logger.error('Error: ' + (error ? error.message : 'undefined'));
} else {
logger.error(`STDERR:\n${stderr}`);
}
throw error;
} else {
return stdout.toString();
}
}

View File

@ -17,14 +17,15 @@
* limitations under the License.
*/
import { logging } from '@angular-devkit/core';
import { ACTIVITI_CLOUD_APPS } from '@alfresco/adf-testing';
import * as program from 'commander';
/* tslint:disable */
const alfrescoApi = require('@alfresco/js-api');
/* tslint:enable */
import request = require('request');
import * as fs from 'fs';
import { logger } from './logger';
export interface ConfigArgs {
username: string;
@ -35,7 +36,7 @@ export interface ConfigArgs {
identityHost: boolean;
}
async function getDeployedApplicationsByStatus(args: ConfigArgs, apiService: any, status: string, logger: logging.Logger) {
async function getDeployedApplicationsByStatus(args: ConfigArgs, apiService: any, status: string) {
const url = `${args.host}/deployment-service/v1/applications`;
const pathParams = {}, queryParams = {status: status},
@ -67,33 +68,32 @@ function getAlfrescoJsApiInstance(args: ConfigArgs) {
implicitFlow: false,
silentLogin: false,
redirectUri: '/'
},
identityHost: `${args.identityHost}`
}
};
return new alfrescoApi.AlfrescoApiCompatibility(config);
}
async function _login(args: ConfigArgs, alfrescoJsApi: any, logger: logging.Logger) {
async function login(args: ConfigArgs, alfrescoJsApi: any) {
logger.info(`Perform login...`);
await alfrescoJsApi.login(args.username, args.password);
return alfrescoJsApi;
}
async function _deployMissingApps(args: ConfigArgs, logger: logging.Logger) {
async function deployMissingApps(args: ConfigArgs) {
const alfrescoJsApi = getAlfrescoJsApiInstance(args);
await _login(args, alfrescoJsApi, logger);
const deployedApps = await getDeployedApplicationsByStatus(args, alfrescoJsApi, '', logger);
await login(args, alfrescoJsApi);
const deployedApps = await getDeployedApplicationsByStatus(args, alfrescoJsApi, '');
const absentApps = findMissingApps(deployedApps);
if (absentApps.length > 0) {
logger.warn(`Missing apps: ${JSON.stringify(absentApps)}`);
await checkIfAppIsReleased(args, alfrescoJsApi, absentApps, logger);
await checkIfAppIsReleased(args, alfrescoJsApi, absentApps);
} else {
logger.warn(`All the apps are correctly deployed`);
}
}
async function getAppProjects(args: ConfigArgs, apiService: any, logger: logging.Logger) {
async function getAppProjects(args: ConfigArgs, apiService: any) {
const url = `${args.host}/modeling-service/v1/projects?maxItems=200&skipCount=0`;
const pathParams = {}, queryParams = {},
@ -111,8 +111,8 @@ async function getAppProjects(args: ConfigArgs, apiService: any, logger: logging
}
}
async function checkIfAppIsReleased(args: ConfigArgs, apiService: any, absentApps: any [], logger: logging.Logger) {
const projectList = await getAppProjects(args, apiService, logger);
async function checkIfAppIsReleased(args: ConfigArgs, apiService: any, absentApps: any []) {
const projectList = await getAppProjects(args, apiService);
let TIME = 5000;
let noError = true;
for (let i = 0; i < absentApps.length; i++) {
@ -125,10 +125,10 @@ async function checkIfAppIsReleased(args: ConfigArgs, apiService: any, absentApp
if (app === undefined) {
logger.warn('Missing project: Create the project for ' + currentAbsentApp.name);
try {
const uploadedApp = await importProjectApp(args, apiService, currentAbsentApp, logger);
const uploadedApp = await importProjectApp(args, apiService, currentAbsentApp);
logger.warn('Project imported ' + currentAbsentApp.name);
if (uploadedApp) {
projectRelease = await releaseProject(args, apiService, uploadedApp, logger);
projectRelease = await releaseProject(args, apiService, uploadedApp);
}
} catch (error) {
if (error.status !== 409) {
@ -143,11 +143,11 @@ async function checkIfAppIsReleased(args: ConfigArgs, apiService: any, absentApp
TIME += 5000;
logger.info('Project ' + app.entry.name + ' found');
const projectReleaseList = await getReleaseAppProjectId(args, apiService, app.entry.id, logger);
const projectReleaseList = await getReleaseAppProjectId(args, apiService, app.entry.id);
if (projectReleaseList.list.entries.length === 0) {
logger.warn('Project needs release');
projectRelease = await releaseProject(args, apiService, app, logger);
projectRelease = await releaseProject(args, apiService, app);
logger.warn(`Project released: ${projectRelease.id}`);
} else {
logger.info('Project already has release');
@ -163,14 +163,14 @@ async function checkIfAppIsReleased(args: ConfigArgs, apiService: any, absentApp
}
}
if (noError) {
await checkDescriptorExist(args, apiService, currentAbsentApp.name, logger);
await sleep(TIME, logger);
await deployApp(args, apiService, currentAbsentApp, projectRelease.entry.id, logger);
await checkDescriptorExist(args, apiService, currentAbsentApp.name);
await sleep(TIME);
await deployApp(args, apiService, currentAbsentApp, projectRelease.entry.id);
}
}
}
async function deployApp(args: ConfigArgs, apiService: any, appInfo: any, projectReleaseId: string, logger: logging.Logger) {
async function deployApp(args: ConfigArgs, apiService: any, appInfo: any, projectReleaseId: string) {
logger.warn(`Deploy app ${appInfo.name} with projectReleaseId ${projectReleaseId}`);
const url = `${args.host}/deployment-service/v1/applications`;
@ -197,20 +197,20 @@ async function deployApp(args: ConfigArgs, apiService: any, appInfo: any, projec
}
}
async function checkDescriptorExist(args: ConfigArgs, apiService: any, name: string, logger: logging.Logger) {
async function checkDescriptorExist(args: ConfigArgs, apiService: any, name: string) {
logger.info(`Check descriptor ${name} exist in the list `);
const descriptorList: [] = await getDescriptorList(args, apiService, logger);
const descriptorList: [] = await getDescriptorList(args, apiService);
descriptorList.forEach( async(descriptor: any) => {
if (descriptor.entry.name === name) {
if (descriptor.entry.deployed === false) {
await deleteDescriptor(args, apiService, descriptor.entry.name, logger);
await deleteDescriptor(args, apiService, descriptor.entry.name);
}
}
});
return false;
}
async function getDescriptorList(args: ConfigArgs, apiService: any, logger: logging.Logger) {
async function getDescriptorList(args: ConfigArgs, apiService: any) {
const url = `${args.host}/deployment-service/v1/descriptors?page=0&size=50&sort=lastModifiedAt,desc`;
const pathParams = {}, queryParams = {},
@ -228,7 +228,7 @@ async function getDescriptorList(args: ConfigArgs, apiService: any, logger: logg
}
async function deleteDescriptor(args: ConfigArgs, apiService: any, name: string, logger: logging.Logger) {
async function deleteDescriptor(args: ConfigArgs, apiService: any, name: string) {
logger.warn(`Delete the descriptor ${name}`);
const url = `${args.host}/deployment-service/v1/descriptors/${name}`;
@ -246,7 +246,7 @@ async function deleteDescriptor(args: ConfigArgs, apiService: any, name: string,
}
}
async function releaseProject(args: ConfigArgs, apiService: any, app: any, logger: logging.Logger) {
async function releaseProject(args: ConfigArgs, apiService: any, app: any) {
const url = `${args.host}/modeling-service/v1/projects/${app.entry.id}/releases`;
logger.info(`Release ID ${app.entry.id}`);
@ -263,7 +263,7 @@ async function releaseProject(args: ConfigArgs, apiService: any, app: any, logge
}
}
async function getReleaseAppProjectId(args: ConfigArgs, apiService: any, projectId: string, logger: logging.Logger) {
async function getReleaseAppProjectId(args: ConfigArgs, apiService: any, projectId: string) {
const url = `${args.host}/modeling-service/v1/projects/${projectId}/releases`;
const pathParams = {}, queryParams = {},
@ -280,8 +280,8 @@ async function getReleaseAppProjectId(args: ConfigArgs, apiService: any, project
}
async function importProjectApp(args: ConfigArgs, apiService: any, app: any, logger: logging.Logger) {
await getFileFromRemote(app.file_location, app.name, logger);
async function importProjectApp(args: ConfigArgs, apiService: any, app: any) {
await getFileFromRemote(app.file_location, app.name);
const file = fs.createReadStream(`${app.name}.zip`).on('error', () => {logger.error(`${app.name}.zip does not exist`); });
@ -294,7 +294,7 @@ async function importProjectApp(args: ConfigArgs, apiService: any, app: any, log
logger.warn(`import app ${app.file_location}`);
const result = await apiService.oauth2Auth.callCustomApi(url, 'POST', pathParams, queryParams, headerParams, formParams, bodyParam,
contentTypes, accepts);
deleteLocalFile(`${app.name}`, logger);
deleteLocalFile(`${app.name}`);
return result;
}
@ -312,7 +312,7 @@ function findMissingApps(deployedApps: any []) {
return absentApps;
}
async function getFileFromRemote(url: string, name: string, logger: logging.Logger) {
async function getFileFromRemote(url: string, name: string) {
return new Promise((resolve, reject) => {
request(url)
.pipe(fs.createWriteStream(`${name}.zip`))
@ -326,18 +326,38 @@ async function getFileFromRemote(url: string, name: string, logger: logging.Logg
});
}
async function deleteLocalFile(name: string, logger: logging.Logger) {
async function deleteLocalFile(name: string) {
logger.info(`Deleting local file ${name}.zip`);
fs.unlinkSync(`${name}.zip`);
}
async function sleep(time: number, logger: logging.Logger) {
async function sleep(time: number) {
logger.info(`Waiting for ${time} sec...`);
await new Promise(done => setTimeout(done, time));
logger.info(`Done...`);
return;
}
export default async function (args: ConfigArgs, logger: logging.Logger) {
await _deployMissingApps(args, logger);
export default async function (args: ConfigArgs) {
await main(args);
}
async function main(args) {
program
.version('0.1.0')
.description('The following command is in charge of Initializing the activiti cloud env with the default apps' +
'adf-cli init-aae-env --host "gateway_env" --oauth "identity_env" --identityHost "identity_env" --username "username" --password "password"')
.option('-h, --host [type]', 'Host gateway')
.option('-o, --oauth [type]', 'Host sso server')
.option('--clientId[type]', 'sso client')
.option('--username [type]', 'username')
.option('--password [type]', 'password')
.parse(process.argv);
if (process.argv.includes('-h') || process.argv.includes('--help')) {
program.outputHelp();
}
await deployMissingApps(args);
}

View File

@ -17,8 +17,9 @@
* limitations under the License.
*/
import { logging } from '@angular-devkit/core';
import { spawnSync } from 'child_process';
import { exec } from './exec';
import * as program from 'commander';
import { logger } from './logger';
export interface KubeArgs {
username?: string;
@ -28,63 +29,61 @@ export interface KubeArgs {
label?: string;
}
function _exec(command: string, args: string[], opts: { cwd?: string }, logger: logging.Logger) {
if (process.platform.startsWith('win')) {
args.unshift('/c', command);
command = 'cmd.exe';
}
const { status, error, stderr, stdout } = spawnSync(command, args, { ...opts });
if (status !== 0) {
logger.error(`Command failed: ${command} ${args.map((x) => JSON.stringify(x)).join(', ')}`);
if (error) {
logger.error('Error: ' + (error ? error.message : 'undefined'));
} else {
logger.error(`STDERR:\n${stderr}`);
}
throw error;
} else {
return stdout.toString();
}
}
function _setCluster(args: KubeArgs, logger: logging.Logger) {
function setCluster(args: KubeArgs) {
logger.info('Perform set-cluster...');
const response = _exec('kubectl', [`config`, `set-cluster`, `${args.clusterEnv}`, `--server=${args.clusterUrl}`], {}, logger);
const response = exec('kubectl', [`config`, `set-cluster`, `${args.clusterEnv}`, `--server=${args.clusterUrl}`], {});
logger.info(response);
}
function _setCredentials(args: KubeArgs, logger: logging.Logger) {
function setCredentials(args: KubeArgs) {
logger.info('Perform set-credentials...');
const response = _exec('kubectl', [`config`, `set-credentials`, `${args.username}`, `--token=${args.token}`], {}, logger);
const response = exec('kubectl', [`config`, `set-credentials`, `${args.username}`, `--token=${args.token}`], {});
logger.info(response);
}
function _setContext(args: KubeArgs, logger: logging.Logger) {
function setContext(args: KubeArgs) {
logger.info('Perform set-context...');
const response = _exec('kubectl', [`config`, `set-context`, `${args.clusterEnv}`, `--cluster=${args.clusterEnv}`, `--user=${args.username}`], {}, logger);
const response = exec('kubectl', [`config`, `set-context`, `${args.clusterEnv}`, `--cluster=${args.clusterEnv}`, `--user=${args.username}`], {});
logger.info(response);
}
function _useContext(args: KubeArgs, logger: logging.Logger) {
function useContext(args: KubeArgs) {
logger.info('Perform use-context...');
const response = _exec('kubectl', [`config`, `use-context`, `${args.clusterEnv}`], {}, logger);
const response = exec('kubectl', [`config`, `use-context`, `${args.clusterEnv}`], {});
logger.info(response);
}
function _deletePod(args: KubeArgs, logger: logging.Logger) {
function deletePod(args: KubeArgs) {
logger.info('Perform delete pods...');
const response = _exec('kubectl', [`delete`, `pods`, `--all-namespaces`, `-l`, `app=${args.label}`], {}, logger);
const response = exec('kubectl', [`delete`, `pods`, `--all-namespaces`, `-l`, `app=${args.label}`], {});
logger.info(response);
}
export default async function (args: KubeArgs, logger: logging.Logger) {
export default function (args: KubeArgs) {
main(args);
}
function main(args) {
program
.version('0.1.0')
.option('--username [type]', 'username')
.option('--password [type]', 'password')
.option('--token [type]', 'access token')
.option('--clusterEnv [type]', 'cluster Env')
.option('--clusterUrl [type]', 'cluster Url')
.option('--label [type]', 'label cluster')
.parse(process.argv);
if (process.argv.includes('-h') || process.argv.includes('--help')) {
program.outputHelp();
}
if (args.label !== undefined) {
_setCluster(args, logger);
_setCredentials(args, logger);
_setContext(args, logger);
_useContext(args, logger);
_deletePod(args, logger);
setCluster(args);
setCredentials(args);
setContext(args);
useContext(args);
deletePod(args);
}
}

View File

@ -17,8 +17,9 @@
* limitations under the License.
*/
import { logging } from '@angular-devkit/core';
import { spawnSync } from 'child_process';
import { exec } from './exec';
import * as program from 'commander';
import { logger } from './logger';
export interface KubeArgs {
tag?: string;
@ -32,73 +33,76 @@ export interface KubeArgs {
deployName?: string;
}
function _exec(command: string, args: string[], opts: { cwd?: string }, logger: logging.Logger) {
if (process.platform.startsWith('win')) {
args.unshift('/c', command);
command = 'cmd.exe';
}
const { status, error, stderr, stdout } = spawnSync(command, args, { ...opts });
if (status !== 0) {
logger.error(`Command failed: ${command} ${args.map((x) => JSON.stringify(x)).join(', ')}`);
if (error) {
logger.error('Error: ' + (error ? error.message : 'undefined'));
} else {
logger.error(`STDERR:\n${stderr}`);
}
throw error;
} else {
return stdout.toString();
}
}
function _setCluster(args: KubeArgs, logger: logging.Logger) {
function setCluster(args: KubeArgs) {
logger.info('Perform set-cluster...');
const response = _exec('kubectl', [`config`, `set-cluster`, `${args.clusterEnv}`, `--server=${args.clusterUrl}`], {}, logger);
const response = exec('kubectl', [`config`, `set-cluster`, `${args.clusterEnv}`, `--server=${args.clusterUrl}`], {});
logger.info(response);
}
function _setCredentials(args: KubeArgs, logger: logging.Logger) {
function setCredentials(args: KubeArgs) {
logger.info('Perform set-credentials...');
const response = _exec('kubectl', [`config`, `set-credentials`, `${args.username}`, `--token=${args.token}`], {}, logger);
const response = exec('kubectl', [`config`, `set-credentials`, `${args.username}`, `--token=${args.token}`], {});
logger.info(response);
}
function _setContext(args: KubeArgs, logger: logging.Logger) {
function setContext(args: KubeArgs) {
logger.info('Perform set-context...');
const response = _exec('kubectl', [`config`, `set-context`, `${args.clusterEnv}`, `--cluster=${args.clusterEnv}`, `--user=${args.username}`], {}, logger);
const response = exec('kubectl', [`config`, `set-context`, `${args.clusterEnv}`, `--cluster=${args.clusterEnv}`, `--user=${args.username}`], {});
logger.info(response);
}
function _useContext(args: KubeArgs, logger: logging.Logger) {
function useContext(args: KubeArgs) {
logger.info('Perform use-context...');
const response = _exec('kubectl', [`config`, `use-context`, `${args.clusterEnv}`], {}, logger);
const response = exec('kubectl', [`config`, `use-context`, `${args.clusterEnv}`], {});
logger.info(response);
}
function _setImage(args: KubeArgs, logger: logging.Logger) {
function setImage(args: KubeArgs) {
logger.info('Perform set image...');
const response = _exec('kubectl', [`set`, `image`, `deployment/${args.deployName}`, `${args.serviceName}=${args.dockerRepo}:${args.tag}`], {}, logger);
const response = exec('kubectl', [`set`, `image`, `deployment/${args.deployName}`, `${args.serviceName}=${args.dockerRepo}:${args.tag}`], {});
logger.info(response);
}
function _installPerform(logger: logging.Logger) {
function installPerform() {
logger.info('Perform install...');
const responseK8sStable = _exec('curl', [`-s`, `https://storage.googleapis.com/kubernetes-release/release/stable.txt`], {}, logger).trim();
const responseK8sStable = exec('curl', [`-s`, `https://storage.googleapis.com/kubernetes-release/release/stable.txt`], {}).trim();
const k8sRelease = `https://storage.googleapis.com/kubernetes-release/release/${responseK8sStable}/bin/linux/amd64/kubectl`;
_exec('curl', [`LO`, `${k8sRelease}`], {}, logger);
exec('curl', [`LO`, `${k8sRelease}`], {});
}
export default async function (args: KubeArgs, logger: logging.Logger) {
if (args.installCheck === true) {
_installPerform(logger);
export default function (args: KubeArgs) {
main(args);
}
function main(args) {
program
.version('0.1.0')
.description('his command allows you to update a specific service on the rancher env with a specifig tag \n\n' +
'adf-cli kubectl-image --clusterEnv ${clusterEnv} --clusterUrl ${clusterUrl} --username ${username} --token ${token} --deployName ${deployName} --dockerRepo ${dockerRepo} --tag ${tag}')
.option('--tag [type]', 'tag')
.option('--installCheck [type]', 'install kube ctl')
.option('--username [type]', 'username')
.option('--clusterEnv [type]', 'cluster Env')
.option('--clusterUrl [type]', 'cluster Url')
.option('--serviceName [type]', 'serviceName')
.option('--dockerRepo [type]', 'docker Repo')
.option('--deployName [type]', 'deploy Name')
.parse(process.argv);
if (process.argv.includes('-h') || process.argv.includes('--help')) {
program.outputHelp();
}
if (args.installCheck === true) {
installPerform();
}
if (args.tag !== undefined) {
_setCluster(args, logger);
_setCredentials(args, logger);
_setContext(args, logger);
_useContext(args, logger);
_setImage(args, logger);
setCluster(args);
setCredentials(args);
setContext(args);
useContext(args);
setImage(args);
}
}

52
lib/cli/scripts/logger.ts Normal file
View File

@ -0,0 +1,52 @@
/*!
* @license
* Copyright 2019 Alfresco Software, Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/* tslint:disable */
let log = null;
try {
log = new (require('@angular-devkit/core').logging.IndentLogger)('root');
const { bold, gray, red, yellow, white } = require('@angular-devkit/core').terminal;
const filter = require('rxjs/operators').filter;
log
.pipe(filter(entry => (entry.level !== 'debug')))
.subscribe(entry => {
let color = gray;
let output = process.stdout;
switch (entry.level) {
case 'info': color = white; break;
case 'warn': color = yellow; break;
case 'error': color = red; output = process.stderr; break;
case 'fatal': color = x => bold(red(x)); output = process.stderr; break;
}
output.write(color(entry.message) + '\n');
});
} catch (e) {
console.error(`Reverting to manual console logging.\nReason: ${e.message}.`);
log = {
debug: console.log.bind(console),
info: console.log.bind(console),
warn: console.warn.bind(console),
error: console.error.bind(console),
fatal: x => { console.error(x); process.exit(100); },
createChild: () => log
};
}
export let logger = log;
/* tslint:enable */

View File

@ -17,10 +17,11 @@
* limitations under the License.
*/
import { logging } from '@angular-devkit/core';
import { spawnSync } from 'child_process';
import * as path from 'path';
import fs = require('fs');
import { exec } from './exec';
import * as program from 'commander';
import { logger } from './logger';
export interface PublishArgs {
tag?: string;
@ -40,30 +41,9 @@ const projects = [
'extensions'
];
function _exec(command: string, args: string[], opts: { cwd?: string }, logger: logging.Logger) {
if (process.platform.startsWith('win')) {
args.unshift('/c', command);
command = 'cmd.exe';
}
const { status, error, stderr, stdout } = spawnSync(command, args, { ...opts });
if (status !== 0) {
logger.error(`Command failed: ${command} ${args.map((x) => JSON.stringify(x)).join(', ')}`);
if (error) {
logger.error('Error: ' + (error ? error.message : 'undefined'));
} else {
logger.error(`STDERR:\n${stderr}`);
}
throw error;
} else {
return stdout.toString();
}
}
function _npmPublish(args: PublishArgs, project: string, logger: logging.Logger) {
function npmPublish(args: PublishArgs, project: string) {
if (args.npmRegistry) {
_changeRegistry(args, project, logger);
changeRegistry(args, project);
}
logger.info(`Publishing lib ${project} to npm`);
const options = ['publish'];
@ -71,18 +51,18 @@ function _npmPublish(args: PublishArgs, project: string, logger: logging.Logger)
options.push('-tag');
options.push(`${args.tag}`);
}
const response = _exec('npm', options, {cwd: path.resolve(`${args.pathProject}/lib/dist/${project}`)}, logger);
const response = exec('npm', options, { cwd: path.resolve(`${args.pathProject}/lib/dist/${project}`) });
logger.info(response);
if (args.npmRegistry) {
_removeNPMRC(args, project, logger);
removeNPMRC(args, project);
}
}
function _changeRegistry(args: PublishArgs, project: string, logger: logging.Logger) {
function changeRegistry(args: PublishArgs, project: string) {
logger.info(`Change registry... `);
const folder = `${args.pathProject}/lib/dist/${project}`;
const content =
`strict-ssl=false
`strict-ssl=false
registry=http://${args.npmRegistry}
//${args.npmRegistry}/:_authToken="${args.tokenRegistry}"`;
try {
@ -92,15 +72,34 @@ registry=http://${args.npmRegistry}
}
}
function _removeNPMRC(args: PublishArgs, project: string, logger: logging.Logger) {
function removeNPMRC(args: PublishArgs, project: string) {
logger.info(`Removing file from ${project}`);
const response = _exec('rm', ['.npmrc'], {cwd: path.resolve(`${args.pathProject}/lib/dist/${project}`)}, logger);
const response = exec('rm', ['.npmrc'], { cwd: path.resolve(`${args.pathProject}/lib/dist/${project}`) });
logger.info(response);
}
export default async function (args: PublishArgs, logger: logging.Logger) {
projects.forEach( (project: string) => {
export default function (args: PublishArgs) {
main(args);
}
function main(args) {
program
.version('0.1.0')
.description('Move in the folder where you have your Dockerfile and run the command \n\n adf-cli docker-publish --dockerRepo "${docker_repository}" --dockerTags "${TAGS}" --pathProject "$(pwd)')
.option('--tag [type]', 'tag')
.option('--npmRegistry [type]', 'npm Registry')
.option('--tokenRegistry [type]', 'token Registry')
.option('--pathProject [type]', 'pathProject')
.parse(process.argv);
if (process.argv.includes('-h') || process.argv.includes('--help')) {
program.outputHelp();
}
projects.forEach((project: string) => {
logger.info(`========Analyzing project: ${project} ========`);
_npmPublish(args, project, logger);
npmPublish(args, project);
});
}

View File

@ -17,8 +17,9 @@
* limitations under the License.
*/
import { logging } from '@angular-devkit/core';
import { spawnSync } from 'child_process';
import { exec } from './exec';
import * as program from 'commander';
import { logger } from './logger';
export interface CommitArgs {
pointer: string;
@ -26,44 +27,48 @@ export interface CommitArgs {
skipGnu: boolean;
}
function _exec(command: string, args: string[], opts: { cwd?: string }, logger: logging.Logger) {
if (process.platform.startsWith('win')) {
args.unshift('/c', command);
command = 'cmd.exe';
}
const { status, error, stderr, stdout } = spawnSync(command, args, { ...opts });
if (status !== 0) {
logger.error(`Command failed: ${command} ${args.map((x) => JSON.stringify(x)).join(', ')}`);
if (error) {
logger.error('Error: ' + (error ? error.message : 'undefined'));
} else {
logger.error(`STDERR:\n${stderr}`);
}
throw error;
} else {
return stdout.toString();
}
}
function _commitPerform(args: CommitArgs, logger: logging.Logger): string {
function commitPerform(args: CommitArgs): string {
logger.info('Check commit sha...');
const gitPointer = args.pointer ? args.pointer : 'HEAD';
return _exec('git', [`rev-parse`, `${gitPointer}`], {}, logger).trim();
return exec('git', [`rev-parse`, `${gitPointer}`], {}).trim();
}
function _replacePerform(args: CommitArgs, sha: string, logger: logging.Logger) {
function replacePerform(args: CommitArgs, sha: string) {
logger.info(`Replace commit ${sha} in package...`);
const sedRule = `s/\"commit\": \".*\"/\"commit\": \"${sha}\"/g`;
if (args.skipGnu) {
_exec('sed', [`-i`, '', `${sedRule}`, `${args.pathPackage}/package.json`], {}, logger);
exec('sed', [`-i`, '', `${sedRule}`, `${args.pathPackage}/package.json`], {});
} else {
_exec('sed', [`-i`, `${sedRule}`, `${args.pathPackage}/package.json`], {}, logger);
exec('sed', [`-i`, `${sedRule}`, `${args.pathPackage}/package.json`], {});
}
}
export default async function (args: CommitArgs, logger: logging.Logger) {
const sha = _commitPerform(args, logger);
_replacePerform(args, sha, logger);
export default function (args: CommitArgs) {
main(args);
}
function main(args) {
program
.version('0.1.0')
.description('This command allows you to update the commit sha as part of the package.json.\n' +
'Your package.json must to have an existing property called "commit.\n\n' +
'adf-cli update-commit-sha --pointer "HEAD~1" --pathProject "$(pwd)"\n\n' +
'adf-cli update-commit-sha --pathProject "$(pwd)" --skipGnu')
.option('--pointer [type]', 'pointer')
.option('--pathPackage [type]', 'pathPackage')
.option('--skipGnu [type]', 'skipGnu')
.parse(process.argv);
if (process.argv.includes('-h') || process.argv.includes('--help')) {
program.outputHelp();
}
const sha = commitPerform(args);
replacePerform(args, sha);
}

View File

@ -17,8 +17,9 @@
* limitations under the License.
*/
import { logging } from '@angular-devkit/core';
import { spawnSync } from 'child_process';
import { exec } from './exec';
import * as program from 'commander';
import { logger } from './logger';
export interface UpdateArgs {
pathPackage: string;
@ -38,50 +39,29 @@ const JS_API_DEPENDENCY = '@alfresco/js-api';
let projects = [''];
function _exec(command: string, args: string[], opts: { cwd?: string, input?: string }, logger: logging.Logger) {
if (process.platform.startsWith('win')) {
args.unshift('/c', command);
command = 'cmd.exe';
}
const { status, error, stderr, stdout } = spawnSync(command, args, { ...opts });
if (status !== 0) {
logger.error(`Command failed: ${command} ${args.map((x) => JSON.stringify(x)).join(', ')}`);
if (error) {
logger.error('Error: ' + (error ? error.message : 'undefined'));
} else {
logger.error(`STDERR:\n${stderr}`);
}
throw error;
} else {
return stdout.toString();
}
function latestPerform(args: UpdateArgs) {
tagPerform(args, LATEST);
}
function _latestPerform(args: UpdateArgs, logger: logging.Logger) {
_tagPerform(args, LATEST, logger);
function versionPerform(args: UpdateArgs) {
updateLibsVersionPerform(args.pathPackage, args.version, args.skipGnu);
}
function _versionPerform(args: UpdateArgs, logger: logging.Logger) {
_updateLibsVersionPerform(args.pathPackage, args.version, args.skipGnu, logger);
function versionJsPerform(args: UpdateArgs) {
updateJsAPIVersionPerform(args.pathPackage, args.vjs, args.skipGnu);
}
function _versionJsPerform(args: UpdateArgs, logger: logging.Logger) {
_updateJsAPIVersionPerform(args.pathPackage, args.vjs, args.skipGnu, logger);
function alphaPerform(args: UpdateArgs) {
tagPerform(args, ALPHA);
}
function _alphaPerform(args: UpdateArgs, logger: logging.Logger) {
_tagPerform(args, ALPHA, logger);
function betaPerform(args: UpdateArgs) {
tagPerform(args, BETA);
}
function _betaPerform(args: UpdateArgs, logger: logging.Logger) {
_tagPerform(args, BETA, logger);
}
function _findADFLibsDependencies(args: UpdateArgs, logger: logging.Logger) {
function findADFLibsDependencies(args: UpdateArgs) {
const prjs: any = [];
const result = _exec('grep', [`${ADF_LIBS_PREFIX}`, `${args.pathPackage}/package.json`], {}, logger).trim();
const result = exec('grep', [`${ADF_LIBS_PREFIX}`, `${args.pathPackage}/package.json`], {}).trim();
const res = result.replace(/,\s*$/, '').split(',');
res.forEach( (dependecy) => {
const dep = dependecy.split(':');
@ -91,75 +71,97 @@ function _findADFLibsDependencies(args: UpdateArgs, logger: logging.Logger) {
return prjs;
}
function _getLatestVersionFromNpm(tag: string, project: string, logger: logging.Logger): string {
function getLatestVersionFromNpm(tag: string, project: string): string {
logger.info(`====== Auto find latest ${tag} version of ${project}`);
const latestVersion = _exec('npm', ['view', `${project}@${tag}`, `version`], {}, logger).trim();
const latestVersion = exec('npm', ['view', `${project}@${tag}`, `version`], {}).trim();
logger.info(`====== version lib ${latestVersion} =====`);
return latestVersion;
}
function _updateLibsVersionPerform(path: string, version: string, skipGnu = false, logger: logging.Logger) {
function updateLibsVersionPerform(path: string, version: string, skipGnu = false) {
logger.info('Perform libs version...');
projects.forEach( (project) => {
logger.info(`apply version ${version} on ${project} ...`);
project = project.replace('/', '\\/');
_replaceVersionPerform(project, version, path, skipGnu, logger);
replaceVersionPerform(project, version, path, skipGnu);
});
}
function _updateJsAPIVersionPerform(path: string, version: string, skipGnu = false, logger: logging.Logger) {
function updateJsAPIVersionPerform(path: string, version: string, skipGnu = false) {
logger.info('Perform js-api version...');
logger.info(`apply version ${version} on ${JS_API_DEPENDENCY} ...`);
const project = JS_API_DEPENDENCY.replace('/', '\\/');
_replaceVersionPerform(project, version, path, skipGnu, logger);
replaceVersionPerform(project, version, path, skipGnu);
}
function _replaceVersionPerform(project: string, version: string, path: string, skipGnu = false, logger: logging.Logger) {
function replaceVersionPerform(project: string, version: string, path: string, skipGnu = false) {
const rule = `s/\"${project}\": \".*\"/\"${project}\": \"${version}\"/g`;
if (skipGnu) {
_exec('sed', ['-i', '', `${rule}`, `${path}/package.json`], {}, logger).trim();
exec('sed', ['-i', '', `${rule}`, `${path}/package.json`], {}).trim();
} else {
_exec('sed', ['-i', `${rule}`, `${path}/package.json`], {}, logger).trim();
exec('sed', ['-i', `${rule}`, `${path}/package.json`], {}).trim();
}
}
function _tagPerform(args: UpdateArgs, tag: string, logger: logging.Logger) {
function tagPerform(args: UpdateArgs, tag: string) {
logger.info(`Perform ${tag} update...`);
_tagLibPerform(args, tag, logger);
_tagJsPerform(args, tag, logger);
tagLibPerform(args, tag);
tagJsPerform(args, tag);
}
function _tagLibPerform(args: UpdateArgs, tag: string, logger: logging.Logger) {
const libVersion = _getLatestVersionFromNpm(tag, '@alfresco/adf-extensions', logger);
_updateLibsVersionPerform(args.pathPackage, libVersion, args.skipGnu, logger);
function tagLibPerform(args: UpdateArgs, tag: string) {
const libVersion = getLatestVersionFromNpm(tag, '@alfresco/adf-extensions');
updateLibsVersionPerform(args.pathPackage, libVersion, args.skipGnu);
}
function _tagJsPerform(args: UpdateArgs, tag: string, logger: logging.Logger) {
const jsApiVersion = _getLatestVersionFromNpm(tag, JS_API_DEPENDENCY, logger);
_updateJsAPIVersionPerform(args.pathPackage, jsApiVersion, args.skipGnu, logger);
function tagJsPerform(args: UpdateArgs, tag: string) {
const jsApiVersion = getLatestVersionFromNpm(tag, JS_API_DEPENDENCY);
updateJsAPIVersionPerform(args.pathPackage, jsApiVersion, args.skipGnu);
}
export default async function (args: UpdateArgs, logger: logging.Logger) {
export default function (args: UpdateArgs) {
main(args);
}
projects = _findADFLibsDependencies(args, logger);
function main(args) {
program
.version('This command allows you to update the adf dependencies and js-api with different versions\n\n' +
'Update adf libs and js-api with latest alpha\n\n' +
'adf-cli update-version --alpha --pathPackage "$(pwd)"')
.description('')
.option('--pathPackage [type]', 'pathPackage')
.option('--alpha [type]', 'use alpha')
.option('--beta [type]', 'use beta')
.option('--version [type]', 'use version')
.option('--vjs [type]', 'vjs use version js api')
.option('--skipGnu [type]', 'skipGnu')
.parse(process.argv);
if (process.argv.includes('-h') || process.argv.includes('--help')) {
program.outputHelp();
}
projects = findADFLibsDependencies(args);
if (args.version) {
_versionPerform(args, logger);
versionPerform(args);
}
if (args.vjs) {
_versionJsPerform(args, logger);
versionJsPerform(args);
}
if (args.latest === true) {
_latestPerform(args, logger);
latestPerform(args);
}
if (args.alpha === true) {
_alphaPerform(args, logger);
alphaPerform(args);
}
if (args.beta === true) {
_betaPerform(args, logger);
betaPerform(args);
}
}

100
package-lock.json generated
View File

@ -10,7 +10,6 @@
"integrity": "sha512-RPvL+37PPf3ZArB7XYQ/VhbCKuw+hp+t5NDbuxe56RENsB2RH+T0V3wmWhFsKsJMLcYvW0hf6kI2kUauAqHYDA==",
"requires": {
"@angular-devkit/core": "^7.2.15",
"commander": "^2.15.1",
"ejs": "^2.6.1",
"license-checker": "^25.0.1",
"npm-registry-fetch": "^3.9.0",
@ -2157,6 +2156,14 @@
"requires": {
"ast-types-flow": "0.0.7",
"commander": "^2.11.0"
},
"dependencies": {
"commander": {
"version": "2.20.3",
"resolved": "https://registry.npmjs.org/commander/-/commander-2.20.3.tgz",
"integrity": "sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==",
"dev": true
}
}
},
"arr-diff": {
@ -3467,6 +3474,12 @@
"integrity": "sha512-zauLjrfCG+xvoyaqLoV8bLVXXNGC4JqlxFCutSDWA6fJrTo2ZuvLYTqZ7aHBLZSMOopbzwv8f+wZcVzfVTI2Dg==",
"dev": true
},
"commander": {
"version": "2.20.3",
"resolved": "https://registry.npmjs.org/commander/-/commander-2.20.3.tgz",
"integrity": "sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==",
"dev": true
},
"glob": {
"version": "7.1.5",
"resolved": "https://registry.npmjs.org/glob/-/glob-7.1.5.tgz",
@ -4012,9 +4025,10 @@
}
},
"commander": {
"version": "2.20.0",
"resolved": "https://registry.npmjs.org/commander/-/commander-2.20.0.tgz",
"integrity": "sha512-7j2y+40w61zy6YC2iRNpUe/NwhNyoXrYpHMrSunaMG64nRnaf96zO/KMQR4OyN/UnE5KLyEBnKHd4aG3rskjpQ=="
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/commander/-/commander-4.0.0.tgz",
"integrity": "sha512-SEa2abMBTZuEjLVYpNrAFoRgxPwG4rXP3+SGY6CM/HZGeDzIA7Pzp+7H3AHDukKEpyy2SoSGGPShKqqfH9T9AQ==",
"dev": true
},
"comment-json": {
"version": "1.1.3",
@ -4500,6 +4514,12 @@
"xregexp": "^4.2.4"
},
"dependencies": {
"commander": {
"version": "2.20.3",
"resolved": "https://registry.npmjs.org/commander/-/commander-2.20.3.tgz",
"integrity": "sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==",
"dev": true
},
"fs-extra": {
"version": "7.0.1",
"resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-7.0.1.tgz",
@ -4703,6 +4723,12 @@
"rxjs-stream": "^3.0.1"
},
"dependencies": {
"commander": {
"version": "2.20.3",
"resolved": "https://registry.npmjs.org/commander/-/commander-2.20.3.tgz",
"integrity": "sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==",
"dev": true
},
"fs-extra": {
"version": "7.0.1",
"resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-7.0.1.tgz",
@ -5328,6 +5354,14 @@
"lru-cache": "^4.1.5",
"semver": "^5.6.0",
"sigmund": "^1.0.1"
},
"dependencies": {
"commander": {
"version": "2.20.3",
"resolved": "https://registry.npmjs.org/commander/-/commander-2.20.3.tgz",
"integrity": "sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==",
"dev": true
}
}
},
"ee-first": {
@ -7790,6 +7824,12 @@
"rxjs-stream": "^3.0.1"
},
"dependencies": {
"commander": {
"version": "2.20.3",
"resolved": "https://registry.npmjs.org/commander/-/commander-2.20.3.tgz",
"integrity": "sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==",
"dev": true
},
"fs-extra": {
"version": "7.0.1",
"resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-7.0.1.tgz",
@ -9584,6 +9624,12 @@
"yup": "^0.27.0"
},
"dependencies": {
"commander": {
"version": "2.20.3",
"resolved": "https://registry.npmjs.org/commander/-/commander-2.20.3.tgz",
"integrity": "sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==",
"dev": true
},
"cross-spawn": {
"version": "6.0.5",
"resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-6.0.5.tgz",
@ -11068,6 +11114,12 @@
"integrity": "sha1-tDLdM1i2NM914eRmQ2gkBTPB3b4=",
"dev": true
},
"commander": {
"version": "2.20.3",
"resolved": "https://registry.npmjs.org/commander/-/commander-2.20.3.tgz",
"integrity": "sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==",
"dev": true
},
"find-up": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/find-up/-/find-up-3.0.0.tgz",
@ -11737,6 +11789,14 @@
"commander": "^2.9.0",
"npm-path": "^2.0.2",
"which": "^1.2.10"
},
"dependencies": {
"commander": {
"version": "2.20.3",
"resolved": "https://registry.npmjs.org/commander/-/commander-2.20.3.tgz",
"integrity": "sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==",
"dev": true
}
}
},
"npmlog": {
@ -15626,6 +15686,14 @@
"requires": {
"commander": "^2.2.0",
"limiter": "^1.0.5"
},
"dependencies": {
"commander": {
"version": "2.20.3",
"resolved": "https://registry.npmjs.org/commander/-/commander-2.20.3.tgz",
"integrity": "sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==",
"dev": true
}
}
},
"streamroller": {
@ -16382,6 +16450,12 @@
"source-map-support": "~0.5.10"
},
"dependencies": {
"commander": {
"version": "2.20.3",
"resolved": "https://registry.npmjs.org/commander/-/commander-2.20.3.tgz",
"integrity": "sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==",
"dev": true
},
"source-map": {
"version": "0.6.1",
"resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz",
@ -16931,6 +17005,12 @@
"integrity": "sha1-Jw8HbFpywC9bZaR9+Uxf46J4iS8=",
"dev": true
},
"commander": {
"version": "2.20.3",
"resolved": "https://registry.npmjs.org/commander/-/commander-2.20.3.tgz",
"integrity": "sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==",
"dev": true
},
"diff": {
"version": "4.0.1",
"resolved": "https://registry.npmjs.org/diff/-/diff-4.0.1.tgz",
@ -17119,6 +17199,12 @@
"source-map": "~0.6.1"
},
"dependencies": {
"commander": {
"version": "2.20.3",
"resolved": "https://registry.npmjs.org/commander/-/commander-2.20.3.tgz",
"integrity": "sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==",
"dev": true
},
"source-map": {
"version": "0.6.1",
"resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz",
@ -17734,6 +17820,12 @@
"ws": "^6.0.0"
},
"dependencies": {
"commander": {
"version": "2.20.3",
"resolved": "https://registry.npmjs.org/commander/-/commander-2.20.3.tgz",
"integrity": "sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==",
"dev": true
},
"gzip-size": {
"version": "5.1.1",
"resolved": "https://registry.npmjs.org/gzip-size/-/gzip-size-5.1.1.tgz",

View File

@ -139,7 +139,7 @@
"chalk": "^2.3.2",
"chrome-remote-interface": "^0.26.1",
"codelyzer": "5.0.0",
"commander": "^2.15.1",
"commander": "4.0.0",
"concurrently": "^3.5.1",
"cspell": "^3.1.3",
"dotenv": "6.2.0",

View File

@ -38,6 +38,7 @@ async function checkEnv() {
checkEnv();
}
}
console.log('ok');
}