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

gitly

Package Overview
Dependencies
Maintainers
1
Versions
49
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

gitly - npm Package Compare versions

Comparing version 2.4.8 to 2.5.0

lib/utils/__test__/archive.spec.d.ts

10

lib/interfaces/options.d.ts

@@ -42,2 +42,12 @@ import { FileStat } from 'tar';

headers?: RawAxiosRequestHeaders | AxiosHeaders;
/**
* Set the backend (default: undefined)
*
* @example
* ```markdown
* 'axios' - default behavior
* 'git' - use local git installation to clone the repository (allows for cloning private repositories as long as the local git installation has access)
* ```
*/
backend?: 'axios' | 'git';
}

1

lib/main.d.ts

@@ -5,1 +5,2 @@ export { default } from './utils/gitly';

export { default as parse } from './utils/parse';
export { default as clone } from './utils/clone';

4

lib/main.js

@@ -6,3 +6,3 @@ "use strict";

Object.defineProperty(exports, "__esModule", { value: true });
exports.parse = exports.extract = exports.download = exports.default = void 0;
exports.clone = exports.parse = exports.extract = exports.download = exports.default = void 0;
var gitly_1 = require("./utils/gitly");

@@ -16,1 +16,3 @@ Object.defineProperty(exports, "default", { enumerable: true, get: function () { return __importDefault(gitly_1).default; } });

Object.defineProperty(exports, "parse", { enumerable: true, get: function () { return __importDefault(parse_1).default; } });
var clone_1 = require("./utils/clone");
Object.defineProperty(exports, "clone", { enumerable: true, get: function () { return __importDefault(clone_1).default; } });

@@ -11,3 +11,3 @@ "use strict";

const parse_1 = __importDefault(require("./parse"));
const tar_1 = require("./tar");
const archive_1 = require("./archive");
/**

@@ -27,6 +27,6 @@ * Download the tar file from the repository

const info = (0, parse_1.default)(repository, options);
const file = (0, tar_1.getFile)(info, options);
const url = (0, tar_1.getUrl)(info, options);
const local = async () => (0, exists_1.default)(file);
const remote = async () => (0, fetch_1.default)(url, file, options);
const path = (0, archive_1.getArchivePath)(info, options);
const url = (0, archive_1.getUrl)(info, options);
const local = async () => (0, exists_1.default)(path);
const remote = async () => (0, fetch_1.default)(url, path, options);
let order = [local, remote];

@@ -36,3 +36,3 @@ if ((await (0, offline_1.isOffline)()) || options.cache) {

}
else if (options.force || info.type === 'master') {
else if (options.force || ['master', 'main'].includes(info.type)) {
order = [remote, local];

@@ -43,3 +43,3 @@ }

if (typeof result === 'boolean') {
return file;
return path;
}

@@ -46,0 +46,0 @@ return result;

/// <reference types="node" />
export declare enum GitlyErrorType {
Fetch = "fetch",
Clone = "clone",
Extract = "extract",

@@ -77,1 +78,16 @@ Download = "download",

};
export declare const GitlyCloneError: {
new (message: string, code?: number): {
type: GitlyErrorType;
rawMessage: string;
readonly message: string;
readonly code: number;
readonly ctor: typeof GitlyAbstractError;
name: string;
stack?: string | undefined;
};
type: GitlyErrorType;
captureStackTrace(targetObject: object, constructorOpt?: Function | undefined): void;
prepareStackTrace?: ((err: Error, stackTraces: NodeJS.CallSite[]) => any) | undefined;
stackTraceLimit: number;
};

@@ -6,8 +6,9 @@ "use strict";

};
var _a, _b, _c, _d;
var _a, _b, _c, _d, _e;
Object.defineProperty(exports, "__esModule", { value: true });
exports.GitlyDownloadError = exports.GitlyExtractError = exports.GitlyFetchError = exports.GitlyUknownError = exports.GitlyErrorType = void 0;
exports.GitlyCloneError = exports.GitlyDownloadError = exports.GitlyExtractError = exports.GitlyFetchError = exports.GitlyUknownError = exports.GitlyErrorType = void 0;
var GitlyErrorType;
(function (GitlyErrorType) {
GitlyErrorType["Fetch"] = "fetch";
GitlyErrorType["Clone"] = "clone";
GitlyErrorType["Extract"] = "extract";

@@ -52,1 +53,6 @@ GitlyErrorType["Download"] = "download";

_d);
exports.GitlyCloneError = (_e = class extends GitlyAbstractError {
},
__setFunctionName(_e, "GitlyCloneError"),
_e.type = GitlyErrorType.Clone,
_e);

@@ -9,6 +9,6 @@ "use strict";

const parse_1 = __importDefault(require("./parse"));
const tar_1 = require("./tar");
const archive_1 = require("./archive");
async function exists(path, options = {}) {
if (!(0, path_1.isAbsolute)(path)) {
path = (0, tar_1.getFile)((0, parse_1.default)(path), options);
path = (0, archive_1.getArchivePath)((0, parse_1.default)(path), options);
}

@@ -15,0 +15,0 @@ try {

@@ -9,3 +9,3 @@ "use strict";

const exists_1 = __importDefault(require("./exists"));
const tar_1 = require("./tar");
const archive_1 = require("./archive");
const { mkdir } = fs_1.promises;

@@ -27,3 +27,3 @@ /**

await mkdir(destination, { recursive: true });
await (0, tar_1.extract)({ strip: 1, filter, file: source, cwd: destination });
await (0, archive_1.extract)({ strip: 1, filter, file: source, cwd: destination });
return destination;

@@ -30,0 +30,0 @@ // eslint-disable-next-line no-empty

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

Object.defineProperty(exports, "__esModule", { value: true });
const clone_1 = __importDefault(require("./clone"));
const download_1 = __importDefault(require("./download"));

@@ -16,5 +17,13 @@ const extract_1 = __importDefault(require("./extract"));

async function gitly(repository, destination, options) {
const source = await (0, download_1.default)(repository, options);
let source = '';
switch (options === null || options === void 0 ? void 0 : options.backend) {
case 'git':
source = await (0, clone_1.default)(repository, options);
break;
default:
source = await (0, download_1.default)(repository, options);
break;
}
return [source, await (0, extract_1.default)(source, destination, options)];
}
exports.default = gitly;
{
"name": "gitly",
"version": "2.4.8",
"version": "2.5.0",
"description": "An API to download and/or extract git repositories",

@@ -13,13 +13,15 @@ "main": "lib/main.js",

"dependencies": {
"axios": "^1.6.3",
"axios": "^1.6.7",
"cross-spawn": "^7.0.3",
"tar": "^6.2.0"
},
"devDependencies": {
"@types/jest": "^29.5.11",
"@types/node": "^20.10.6",
"@types/cross-spawn": "^6.0.6",
"@types/jest": "^29.5.12",
"@types/node": "^20.11.19",
"@types/shelljs": "^0.8.15",
"@types/tar": "^6.1.10",
"@typescript-eslint/eslint-plugin": "^6.16.0",
"@typescript-eslint/eslint-plugin-tslint": "^6.16.0",
"@typescript-eslint/parser": "^6.16.0",
"@types/tar": "^6.1.11",
"@typescript-eslint/eslint-plugin": "^7.0.1",
"@typescript-eslint/eslint-plugin-tslint": "^7.0.1",
"@typescript-eslint/parser": "^7.0.1",
"eslint": "^8.56.0",

@@ -30,3 +32,3 @@ "eslint-plugin-import": "^2.29.1",

"shelljs": "^0.8.5",
"ts-jest": "^29.1.1",
"ts-jest": "^29.1.2",
"tslib": "^2.6.2",

@@ -33,0 +35,0 @@ "typescript": "^5.3.3"

@@ -92,2 +92,13 @@ # gitly

headers?: RawAxiosRequestHeaders | AxiosHeaders
/**
* Set the backend (default: undefined)
*
* @example
* ```markdown
* 'axios' - default behavior
* 'git' - use local git installation to clone the repository (allows for cloning private
* repositories as long as the local git installation has access)
* ```
*/
backend?: 'axios' | 'git'
}

@@ -94,0 +105,0 @@ ```

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