Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@cplace/cli

Package Overview
Dependencies
Maintainers
4
Versions
93
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@cplace/cli - npm Package Compare versions

Comparing version 0.19.23 to 0.19.24

14

dist/cli.js

@@ -74,3 +74,3 @@ #!/usr/bin/env node

--update|-u [--nofetch] [--reset-to-remote] [--sequential]: Updates all parent repos.
--update|-u [--nofetch] [--reset-to-remote] [--sequential] [--concurrency]: Updates all parent repos.
Tags instead of branches are supported in parent-repos.json by cplace-cli > 0.17.0 e.g.:

@@ -93,2 +93,6 @@ "main": {

which takes longer but makes the verbose log easier to read.
If --concurrency is set to a positive integer (> 0) only that batch of parallel executed 'processes' are run at the same time.
This allows to circumvent possible limits of remote api calls. Use 0 or negative values for unlimited concurrency.
Ignored if If '--sequential' is set.
Default is 15.
Update behavior:

@@ -126,3 +130,3 @@ 1. If a tag is configured for the parent repository it is updated to that tag,

--clone|-c [--depth <depth>] :
--clone|-c [--depth <depth>] [--sequential] [--concurrency]:
Clones all parent repos if missing.

@@ -132,2 +136,8 @@ If --depth is set to a positive integer, a shallow clone with a history truncated to the specified number of commits is created.

The --force setting has no effect for this command.
If --sequential is set, then the repositories will be cloned one after another,
which takes longer but makes the verbose log easier to read.
If --concurrency is set to a positive integer (> 0) only that batch of parallel executed 'processes' are run at the same time.
This allows to circumvent possible limits of remote api calls. Use 0 or negative values for unlimited concurrency.
Ignored if If '--sequential' is set.
Default is 15.
Clone behavior:

@@ -134,0 +144,0 @@ 1. If a tag is configured for the parent repository it is cloned on that tag,

@@ -9,2 +9,3 @@ import { ICommand, ICommandParameters } from '../models';

protected static readonly PARAMETER_SEQUENTIAL: string;
protected static readonly PARAMETER_CONCURRENCY: string;
protected static readonly NODE_MODULES: string;

@@ -14,2 +15,3 @@ protected parentRepos: IReposDescriptor;

protected sequential: boolean;
protected concurrency: number;
protected depth: number;

@@ -16,0 +18,0 @@ protected parentReposConfigPath: string;

@@ -33,3 +33,2 @@ "use strict";

}
this.depth = parseInt(params[AbstractReposCommand.PARAMETER_CLONE_DEPTH], 10);
const depth = params[AbstractReposCommand.PARAMETER_CLONE_DEPTH];

@@ -45,2 +44,12 @@ if (typeof depth === 'number' && !isNaN(depth)) {

}
const concurrency = params[AbstractReposCommand.PARAMETER_CONCURRENCY];
if (typeof concurrency === 'number' && !isNaN(concurrency)) {
this.concurrency = concurrency;
}
else {
this.concurrency = 15;
}
if (this.concurrency > 0) {
Global_1.Global.isVerbose() && console.log('running with concurrency for parallel execution = ' + this.concurrency);
}
this.parentReposConfigPath = path.join(this.rootDir, AbstractReposCommand.PARENT_REPOS_FILE_NAME);

@@ -109,3 +118,4 @@ if (!fs.existsSync(this.parentReposConfigPath)) {

AbstractReposCommand.PARAMETER_SEQUENTIAL = 'sequential';
AbstractReposCommand.PARAMETER_CONCURRENCY = 'concurrency';
AbstractReposCommand.NODE_MODULES = 'node_modules';
//# sourceMappingURL=AbstractReposCommand.js.map

22

dist/commands/repos/CloneRepos.js

@@ -16,12 +16,16 @@ "use strict";

execute() {
const promises = Object
const missingRepoNames = Object
.keys(this.parentRepos)
.filter((repoName) => this.checkRepoMissing(repoName, this.rootDir))
.map((repoName) => {
Global_1.Global.isVerbose() && console.log(`[${repoName}]:`, 'starting to clone repository');
const repoProperties = this.parentRepos[repoName];
const toPath = path.resolve(this.rootDir, '..', repoName);
return this.handleRepo(repoName, repoProperties, toPath, this.depth);
});
return promiseAllSettled_1.promiseAllSettledParallel(promises)
.filter((repoName) => this.checkRepoMissing(repoName, this.rootDir));
return promiseAllSettled_1.promiseAllSettled({
keys: missingRepoNames,
promiseFactory: (repoName) => {
const repoProperties = this.parentRepos[repoName];
Global_1.Global.isVerbose() && console.log(`[${repoName}]:`, 'starting to clone repository ', repoProperties.url);
const toPath = path.resolve(this.rootDir, '..', repoName);
return this.handleRepo(repoName, repoProperties, toPath, this.depth);
},
sequential: this.sequential,
concurrency: this.concurrency
})
.catch((err) => Promise.reject(`[CloneRepos]: failed to clone repos: ${err}`));

@@ -28,0 +32,0 @@ }

@@ -29,3 +29,4 @@ "use strict";

promiseFactory: (repoName) => (this.prepareRepo(repoName)),
sequential: this.sequential
sequential: this.sequential,
concurrency: this.concurrency
});

@@ -36,3 +37,4 @@ Global_1.Global.isVerbose() && console.log('update repos - handle');

promiseFactory: (repoName) => (this.handleRepo(repoName)),
sequential: this.sequential
sequential: this.sequential,
concurrency: this.concurrency
});

@@ -39,0 +41,0 @@ Global_1.Global.isVerbose() && console.log('all repositories successfully updated');

@@ -81,2 +81,9 @@ "use strict";

}
else if (repoProperties.commit) {
Global_1.Global.isVerbose() && console.log(`[${repoName}]:`, 'will update to the commit', repoProperties.commit);
newRepo.checkoutCommit(repoProperties.commit)
.then(() => {
resolve(newRepo);
});
}
else {

@@ -162,3 +169,6 @@ resolve(newRepo);

})
.catch((error) => reject(error));
.catch((error) => {
console.log(`[${repoName}]: failed to get latest tag:\n${error}`);
reject(error);
});
}

@@ -207,7 +217,11 @@ });

static getRemoteOriginUrl(repoName, repoUrl, rootDir) {
return new Promise((resolve) => {
return new Promise((resolve, reject) => {
Repository.getLocalOriginUrl(repoName, rootDir)
.then((localOriginUrl) => {
let useRepoUrl = repoUrl;
if (repoUrl.startsWith(this.GIT_PROTOCOL) && localOriginUrl.startsWith(this.HTTPS_PROTOCOL)) {
if (!repoUrl) {
console.log(`[${repoName}]: repo url not configure in parent-repos.json. Please check the configuration of ${repoName}.`);
reject(`[${repoName}]: repo url not configure in parent-repos.json. Please check the configuration of ${repoName}.`);
}
else if (repoUrl.startsWith(this.GIT_PROTOCOL) && localOriginUrl.startsWith(this.HTTPS_PROTOCOL)) {
const { groups: { host, orgPath } } = /^git@(?<host>.*):(?<orgPath>.*)$/.exec(repoUrl);

@@ -500,3 +514,3 @@ useRepoUrl = `${this.HTTPS_PROTOCOL}//${host}/${orgPath}`;

else {
Global_1.Global.isVerbose() && console.log('[${this.repoName}]: no commit given');
Global_1.Global.isVerbose() && console.log(`[${this.repoName}]: no commit given`);
return Promise.resolve();

@@ -503,0 +517,0 @@ }

@@ -15,2 +15,4 @@ /**

* @param options.sequential Whether the promises should be produced and awaited sequentially, or all produced and then awaited in parallel.
* @param options.concurrency Optional. Limits the concurrency of the parallel promise execution to batches of the size of specified positive integer. 0 or negative values mean no limit.
* If options.sequential is true any limit is ignored.
* @return an array of results, if all promises resolved

@@ -23,2 +25,3 @@ * @throws an Error containing details about all rejected promises, if any promise was rejected

sequential: boolean;
concurrency?: number;
}): Promise<T[]>;

@@ -25,0 +28,0 @@ /**

@@ -20,6 +20,7 @@ "use strict";

class PromiseAllSettled {
constructor(keys, promiseFactory, sequential) {
constructor(keys, promiseFactory, sequential, concurrency = -1) {
this.sequential = sequential;
this.promiseFactory = promiseFactory;
this.keys = keys;
this.concurrency = concurrency;
}

@@ -37,7 +38,14 @@ run() {

else {
const promises = this.keys
.map((key) => this.makePromise(key));
for (const promise of promises) {
yield this.handle(promise);
if (this.concurrency > 0) {
let startIdx = 0;
let slice = 1;
while (startIdx < this.keys.length) {
yield this.handleSlice(this.keys.slice(startIdx, this.concurrency * slice));
startIdx += this.concurrency;
slice++;
}
}
else {
yield this.handleSlice(this.keys);
}
}

@@ -50,2 +58,11 @@ if (this.error) {

}
handleSlice(keys) {
return __awaiter(this, void 0, void 0, function* () {
const promises = keys
.map((key) => this.makePromise(key));
for (const promise of promises) {
yield this.handle(promise);
}
});
}
makePromise(key) {

@@ -100,2 +117,4 @@ let promise;

* @param options.sequential Whether the promises should be produced and awaited sequentially, or all produced and then awaited in parallel.
* @param options.concurrency Optional. Limits the concurrency of the parallel promise execution to batches of the size of specified positive integer. 0 or negative values mean no limit.
* If options.sequential is true any limit is ignored.
* @return an array of results, if all promises resolved

@@ -105,3 +124,3 @@ * @throws an Error containing details about all rejected promises, if any promise was rejected

function promiseAllSettled(options) {
return new PromiseAllSettled(options.keys, options.promiseFactory, options.sequential).run();
return new PromiseAllSettled(options.keys, options.promiseFactory, options.sequential, options.concurrency).run();
}

@@ -108,0 +127,0 @@ exports.promiseAllSettled = promiseAllSettled;

{
"name": "@cplace/cli",
"version": "0.19.23",
"version": "0.19.24",
"description": "cplace cli tools",

@@ -5,0 +5,0 @@ "main": "dist/index.js",

@@ -92,2 +92,6 @@ # Document Control / Repository Information

which takes longer but makes the verbose log easier to read.
If --concurrency is set to a positive integer (> 0) only that batch of parallel executed 'processes' are run at the same time.
This allows to circumvent possible limits of remote api calls. Use 0 or negative values for unlimited concurrency.
Ignored if If '--sequential' is set.
Default is 15.
Update behavior:

@@ -130,2 +134,8 @@ 1. If a tag is configured for the parent repository it is updated to that tag,

The --force setting has no effect for this command.
If --sequential is set, then the repositories will be cloned one after another,
which takes longer but makes the verbose log easier to read.
If --concurrency is set to a positive integer (> 0) only that batch of parallel executed 'processes' are run at the same time.
This allows to circumvent possible limits of remote api calls. Use 0 or negative values for unlimited concurrency.
Ignored if If '--sequential' is set.
Default is 15.
Clone behavior:

@@ -132,0 +142,0 @@ 1. If a tag is configured for the parent repository it is cloned on that tag,

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc