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.5.3 to 3.0.0

10

lib/interfaces/options.d.ts

@@ -1,4 +0,6 @@

import { FileStat } from 'tar';
import URLInfo from './url';
import { AxiosHeaders, RawAxiosRequestHeaders } from 'axios';
/// <reference types="node" />
import type URLInfo from './url';
import type { AxiosHeaders, RawAxiosRequestHeaders } from 'axios';
import type { Stats } from 'node:fs';
import type { ReadEntry } from 'tar';
export default interface GitlyOptions {

@@ -36,3 +38,3 @@ /**

*/
filter?(path: string, stat: FileStat): boolean;
filter?(path: string, stat: Stats | ReadEntry): boolean;
};

@@ -39,0 +41,0 @@ /**

11

lib/utils/__test__/clone.spec.js

@@ -9,18 +9,19 @@ "use strict";

const shelljs_1 = require("shelljs");
const path_1 = require("path");
const node_path_1 = require("node:path");
describe('utils/clone', () => {
const options = {
temp: (0, path_1.join)(__dirname, 'output', 'clone'),
temp: (0, node_path_1.join)(__dirname, 'output', 'clone'),
backend: 'git',
throws: true
};
beforeAll(() => {
(0, shelljs_1.rm)('-rf', (0, path_1.join)(__dirname, 'output', 'clone'));
(0, shelljs_1.rm)('-rf', (0, node_path_1.join)(__dirname, 'output', 'clone'));
});
afterAll(() => {
(0, shelljs_1.rm)('-rf', (0, path_1.join)(__dirname, 'output', 'clone'));
(0, shelljs_1.rm)('-rf', (0, node_path_1.join)(__dirname, 'output', 'clone'));
});
it('should clone the repository', async () => {
const result = await (0, clone_1.default)('lukeed/gittar', options);
const result = await (0, clone_1.default)('iwatakeshi/gitly', options);
expect(await (0, exists_1.default)(result)).toBe(true);
});
});

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

Object.defineProperty(exports, "__esModule", { value: true });
const fs_1 = require("fs");
const path_1 = require("path");
const node_fs_1 = require("node:fs");
const node_path_1 = require("node:path");
const shelljs_1 = require("shelljs");

@@ -14,12 +14,12 @@ const download_1 = __importDefault(require("../download"));

const options = {
temp: (0, path_1.join)(__dirname, 'output', 'download'),
temp: (0, node_path_1.join)(__dirname, 'output', 'download'),
};
beforeAll(() => {
(0, shelljs_1.rm)('-rf', (0, path_1.join)(__dirname, 'output', 'download'));
(0, shelljs_1.rm)('-rf', (0, node_path_1.join)(__dirname, 'output', 'download'));
});
beforeEach(() => {
(0, shelljs_1.rm)('-rf', (0, path_1.join)(__dirname, 'output', 'download'));
(0, shelljs_1.rm)('-rf', (0, node_path_1.join)(__dirname, 'output', 'download'));
});
afterAll(() => {
(0, shelljs_1.rm)('-rf', (0, path_1.join)(__dirname, 'output', 'download'));
(0, shelljs_1.rm)('-rf', (0, node_path_1.join)(__dirname, 'output', 'download'));
});

@@ -30,3 +30,3 @@ it('should download "lukeed/gittar"', async () => {

expect(path).toBeTruthy();
expect((0, fs_1.existsSync)(path)).toBe(true);
expect((0, node_fs_1.existsSync)(path)).toBe(true);
});

@@ -37,3 +37,3 @@ it('should download "lukeed/gittar#v0.1.1"', async () => {

expect(path).toBeTruthy();
expect((0, fs_1.existsSync)(path)).toBe(true);
expect((0, node_fs_1.existsSync)(path)).toBe(true);
});

@@ -44,3 +44,3 @@ it('should download "https://github.com/lukeed/gittar"', async () => {

expect(path).toBeTruthy();
expect((0, fs_1.existsSync)(path)).toBe(true);
expect((0, node_fs_1.existsSync)(path)).toBe(true);
});

@@ -51,3 +51,3 @@ it('should download "https://github.com/lukeed/gittar#v0.1.1"', async () => {

expect(path).toBeTruthy();
expect((0, fs_1.existsSync)(path)).toBe(true);
expect((0, node_fs_1.existsSync)(path)).toBe(true);
});

@@ -58,3 +58,3 @@ it('should download "github.com/lukeed/gittar"', async () => {

expect(path).toBeTruthy();
expect((0, fs_1.existsSync)(path)).toBe(true);
expect((0, node_fs_1.existsSync)(path)).toBe(true);
});

@@ -65,3 +65,3 @@ it('should download "github.com/lukeed/gittar#v0.1.1"', async () => {

expect(path).toBeTruthy();
expect((0, fs_1.existsSync)(path)).toBe(true);
expect((0, node_fs_1.existsSync)(path)).toBe(true);
});

@@ -72,3 +72,3 @@ it('should download "github:lukeed/gittar"', async () => {

expect(path).toBeTruthy();
expect((0, fs_1.existsSync)(path)).toBe(true);
expect((0, node_fs_1.existsSync)(path)).toBe(true);
});

@@ -79,3 +79,3 @@ it('should download "github:lukeed/gittar#v0.1.1"', async () => {

expect(path).toBeTruthy();
expect((0, fs_1.existsSync)(path)).toBe(true);
expect((0, node_fs_1.existsSync)(path)).toBe(true);
});

@@ -86,3 +86,3 @@ it('should download "gitlab:Rich-Harris/buble#v0.15.2"', async () => {

expect(path).toBeTruthy();
expect((0, fs_1.existsSync)(path)).toBe(true);
expect((0, node_fs_1.existsSync)(path)).toBe(true);
});

@@ -107,3 +107,3 @@ it('should return an empty string when a repo is not found', async () => {

const options = {
temp: (0, path_1.join)(__dirname, 'output', 'download', 'cache'),
temp: (0, node_path_1.join)(__dirname, 'output', 'download', 'cache'),
cache: true,

@@ -113,9 +113,9 @@ };

beforeAll(async () => {
(0, shelljs_1.rm)('-rf', (0, path_1.join)(__dirname, 'output', 'download', 'cache'));
(0, shelljs_1.rm)('-rf', (0, node_path_1.join)(__dirname, 'output', 'download', 'cache'));
// Predownload
const path = await (0, download_1.default)('lukeed/gittar', { temp: options.temp });
expect((0, fs_1.existsSync)(path)).toBe(true);
expect((0, node_fs_1.existsSync)(path)).toBe(true);
});
afterAll(async () => {
(0, shelljs_1.rm)('-rf', (0, path_1.join)(__dirname, 'output', 'download', 'cache'));
(0, shelljs_1.rm)('-rf', (0, node_path_1.join)(__dirname, 'output', 'download', 'cache'));
});

@@ -127,4 +127,4 @@ it('should return a path to the cached zipped file', async () => {

expect(path).toBeTruthy();
expect((0, fs_1.existsSync)(path)).toBe(true);
expect((0, node_fs_1.existsSync)(path)).toBe(true);
});
});

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

Object.defineProperty(exports, "__esModule", { value: true });
const path_1 = require("path");
const node_path_1 = require("node:path");
const exists_1 = __importDefault(require("../exists"));
describe('utils/exists', () => {
const options = {
temp: (0, path_1.join)(__dirname, 'fixtures'),
temp: (0, node_path_1.join)(__dirname, 'fixtures'),
};
it('should return true when a path exists', async () => {
const result = await (0, exists_1.default)((0, path_1.join)(__dirname, 'fixtures', 'test.txt'));
const result = await (0, exists_1.default)((0, node_path_1.join)(__dirname, 'fixtures', 'test.txt'));
expect(result).toBe(true);
});
it('should return false when a path does not exist', async () => {
const result = await (0, exists_1.default)((0, path_1.join)(__dirname, 'fixtures', 'dummy'));
const result = await (0, exists_1.default)((0, node_path_1.join)(__dirname, 'fixtures', 'dummy'));
expect(result).toBe(false);

@@ -20,0 +20,0 @@ });

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

Object.defineProperty(exports, "__esModule", { value: true });
const fs_1 = require("fs");
const path_1 = require("path");
const node_fs_1 = require("node:fs");
const node_path_1 = require("node:path");
const shelljs_1 = require("shelljs");

@@ -13,8 +13,8 @@ const download_1 = __importDefault(require("../download"));

describe('utils/extract', () => {
const destination = (0, path_1.join)(__dirname, 'output', 'extract');
const destination = (0, node_path_1.join)(__dirname, 'output', 'extract');
const options = {
temp: (0, path_1.join)(__dirname, 'output', 'extract', '.gitcopy'),
temp: (0, node_path_1.join)(__dirname, 'output', 'extract', '.gitcopy'),
};
beforeEach(() => {
(0, shelljs_1.rm)('-rf', (0, path_1.join)(__dirname, 'output', 'extract', '.gitcopy'));
(0, shelljs_1.rm)('-rf', (0, node_path_1.join)(__dirname, 'output', 'extract', '.gitcopy'));
});

@@ -25,3 +25,3 @@ afterEach(() => {

afterAll(() => {
(0, shelljs_1.rm)('-rf', (0, path_1.join)(__dirname, 'output', 'extract'));
(0, shelljs_1.rm)('-rf', (0, node_path_1.join)(__dirname, 'output', 'extract'));
});

@@ -32,3 +32,3 @@ it('should extract "lukeed/gittar"', async () => {

expect(path).toBeTruthy();
expect((0, fs_1.existsSync)(path)).toBe(true);
expect((0, node_fs_1.existsSync)(path)).toBe(true);
});

@@ -39,5 +39,5 @@ it('should extract "lukeed/gittar#v0.1.1"', async () => {

const path = await (0, extract_1.default)(source, destination, options);
expect((0, fs_1.existsSync)(source)).toBe(true);
expect((0, node_fs_1.existsSync)(source)).toBe(true);
expect(source).toBeTruthy();
expect((0, fs_1.existsSync)(path)).toBe(true);
expect((0, node_fs_1.existsSync)(path)).toBe(true);
expect(path).toBeTruthy();

@@ -48,5 +48,5 @@ });

const path = await (0, extract_1.default)(source, destination, options);
expect((0, fs_1.existsSync)(source)).toBe(true);
expect((0, node_fs_1.existsSync)(source)).toBe(true);
expect(source).toBeTruthy();
expect((0, fs_1.existsSync)(path)).toBe(true);
expect((0, node_fs_1.existsSync)(path)).toBe(true);
expect(path).toBeTruthy();

@@ -57,5 +57,5 @@ });

const path = await (0, extract_1.default)(source, destination, options);
expect((0, fs_1.existsSync)(source)).toBe(true);
expect((0, node_fs_1.existsSync)(source)).toBe(true);
expect(source).toBeTruthy();
expect((0, fs_1.existsSync)(path)).toBe(true);
expect((0, node_fs_1.existsSync)(path)).toBe(true);
expect(path).toBeTruthy();

@@ -66,5 +66,5 @@ });

const path = await (0, extract_1.default)(source, destination, options);
expect((0, fs_1.existsSync)(source)).toBe(true);
expect((0, node_fs_1.existsSync)(source)).toBe(true);
expect(source).toBeTruthy();
expect((0, fs_1.existsSync)(path)).toBe(true);
expect((0, node_fs_1.existsSync)(path)).toBe(true);
expect(path).toBeTruthy();

@@ -75,5 +75,5 @@ });

const path = await (0, extract_1.default)(source, destination, options);
expect((0, fs_1.existsSync)(source)).toBe(true);
expect((0, node_fs_1.existsSync)(source)).toBe(true);
expect(source).toBeTruthy();
expect((0, fs_1.existsSync)(path)).toBe(true);
expect((0, node_fs_1.existsSync)(path)).toBe(true);
expect(path).toBeTruthy();

@@ -84,5 +84,5 @@ });

const path = await (0, extract_1.default)(source, destination, options);
expect((0, fs_1.existsSync)(source)).toBe(true);
expect((0, node_fs_1.existsSync)(source)).toBe(true);
expect(source).toBeTruthy();
expect((0, fs_1.existsSync)(path)).toBe(true);
expect((0, node_fs_1.existsSync)(path)).toBe(true);
expect(path).toBeTruthy();

@@ -93,12 +93,12 @@ });

const path = await (0, extract_1.default)(source, destination, options);
expect((0, fs_1.existsSync)(source)).toBe(true);
expect((0, node_fs_1.existsSync)(source)).toBe(true);
expect(source).toBeTruthy();
expect((0, fs_1.existsSync)(path)).toBe(true);
expect((0, node_fs_1.existsSync)(path)).toBe(true);
expect(path).toBeTruthy();
});
it('should error and return an empty string when extraction fails', async () => {
const path = await (0, extract_1.default)((0, path_1.join)(__dirname, 'dummy'), destination, options);
expect((0, fs_1.existsSync)(path)).toBe(false);
const path = await (0, extract_1.default)((0, node_path_1.join)(__dirname, 'dummy'), destination, options);
expect((0, node_fs_1.existsSync)(path)).toBe(false);
expect(path).toBeFalsy();
});
});

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

Object.defineProperty(exports, "__esModule", { value: true });
const path_1 = require("path");
const node_path_1 = require("node:path");
const gitly_1 = __importDefault(require("../gitly"));

@@ -12,8 +12,8 @@ const exists_1 = __importDefault(require("../exists"));

describe('gitly', () => {
const destination = (0, path_1.join)(__dirname, 'output', 'gitly');
const destination = (0, node_path_1.join)(__dirname, 'output', 'gitly');
const options = {
temp: (0, path_1.join)(__dirname, 'output', 'gitly'),
temp: (0, node_path_1.join)(__dirname, 'output', 'gitly'),
};
beforeEach(() => {
(0, shelljs_1.rm)('-rf', (0, path_1.join)(__dirname, 'output', 'gitly'));
(0, shelljs_1.rm)('-rf', (0, node_path_1.join)(__dirname, 'output', 'gitly'));
});

@@ -20,0 +20,0 @@ afterEach(() => {

@@ -1,6 +0,6 @@

import tar = require('tar');
import GitlyOptions from '../interfaces/options';
import URLInfo from '../interfaces/url';
import * as tar from 'tar';
import type GitlyOptions from '../interfaces/options';
import type URLInfo from '../interfaces/url';
export declare function getArchiveUrl(info: URLInfo, options?: GitlyOptions): string;
export declare function getArchivePath(info: URLInfo, options?: GitlyOptions): string;
export declare const extract: typeof tar.extract;
"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
};
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.extract = exports.getArchivePath = exports.getArchiveUrl = void 0;
const os = require("os");
const path_1 = require("path");
const tar = require("tar");
const node_os_1 = __importDefault(require("node:os"));
const node_path_1 = require("node:path");
const tar = __importStar(require("tar"));
function getArchiveUrl(info, options = {}) {
var _a;
const { path: repo, type } = info;
if (options.url && options.url.filter) {
if ((_a = options.url) === null || _a === void 0 ? void 0 : _a.filter) {
return options.url.filter(info);

@@ -24,5 +51,5 @@ }

const { path, type, hostname: site } = info;
return (0, path_1.join)(options.temp || (0, path_1.join)(os.homedir(), '.gitly'), site, path, `${type}.tar.gz`);
return (0, node_path_1.join)(options.temp || (0, node_path_1.join)(node_os_1.default.homedir(), '.gitly'), site, path, `${type}.tar.gz`);
}
exports.getArchivePath = getArchivePath;
exports.extract = tar.extract;

@@ -1,2 +0,2 @@

import GitlyOptions from '../interfaces/options';
import type GitlyOptions from '../interfaces/options';
/**

@@ -3,0 +3,0 @@ * Uses local git installation to clone a repository to the destination.

"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
};
var __importDefault = (this && this.__importDefault) || function (mod) {

@@ -6,3 +29,6 @@ return (mod && mod.__esModule) ? mod : { "default": mod };

Object.defineProperty(exports, "__esModule", { value: true });
const promises_1 = require("fs/promises");
const cross_spawn_1 = __importDefault(require("cross-spawn"));
const promises_1 = require("node:fs/promises");
const node_path_1 = __importDefault(require("node:path"));
const tar = __importStar(require("tar"));
const archive_1 = require("./archive");

@@ -14,5 +40,2 @@ const error_1 = require("./error");

const parse_1 = __importDefault(require("./parse"));
const cross_spawn_1 = __importDefault(require("cross-spawn"));
const tar_1 = __importDefault(require("tar"));
const path_1 = __importDefault(require("path"));
/**

@@ -38,3 +61,3 @@ * Uses local git installation to clone a repository to the destination.

let order = [];
const local = async () => (0, exists_1.default)(archivePath + '.tar.gz');
const local = async () => (0, exists_1.default)(`${archivePath}.tar.gz`);
const remote = async () => {

@@ -74,13 +97,13 @@ var _a;

// delete the .git directory to make the archive smaller
(0, promises_1.rm)(path_1.default.resolve(directory, '.git'), { recursive: true })
(0, promises_1.rm)(node_path_1.default.resolve(directory, '.git'), { recursive: true })
.then(() =>
// Create the archive after cloning
tar_1.default.create({
tar.create({
gzip: true,
file: archivePath,
// Go one level up to include the repository name in the archive
cwd: path_1.default.resolve(archivePath, '..'),
cwd: node_path_1.default.resolve(archivePath, '..'),
portable: true,
}, [info.type]))
.then(() => (0, promises_1.rm)(path_1.default.resolve(directory), {
.then(() => (0, promises_1.rm)(node_path_1.default.resolve(directory), {
recursive: true,

@@ -87,0 +110,0 @@ }))

@@ -1,2 +0,2 @@

import GitlyOptions from '../interfaces/options';
import type GitlyOptions from '../interfaces/options';
/**

@@ -3,0 +3,0 @@ * Download the tar file from the repository

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

Object.defineProperty(exports, "__esModule", { value: true });
const shelljs_1 = require("shelljs");
const archive_1 = require("./archive");
const execute_1 = __importDefault(require("./execute"));

@@ -12,4 +14,2 @@ const exists_1 = __importDefault(require("./exists"));

const parse_1 = __importDefault(require("./parse"));
const archive_1 = require("./archive");
const shelljs_1 = require("shelljs");
/**

@@ -16,0 +16,0 @@ * Download the tar file from the repository

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

this.rawMessage = message;
// biome-ignore lint/suspicious/noAssignInExpressions: <explanation>
const type = (this.type = this.ctor.type);

@@ -33,2 +34,3 @@ this.message = `[${type ? `gitly:${type}` : 'gitly'}]: ${message}`;

exports.default = GitlyAbstractError;
// biome-ignore lint/complexity/noStaticOnlyClass: <explanation>
exports.GitlyUknownError = (_a = class extends GitlyAbstractError {

@@ -39,2 +41,3 @@ },

_a);
// biome-ignore lint/complexity/noStaticOnlyClass: <explanation>
exports.GitlyFetchError = (_b = class extends GitlyAbstractError {

@@ -45,2 +48,3 @@ },

_b);
// biome-ignore lint/complexity/noStaticOnlyClass: <explanation>
exports.GitlyExtractError = (_c = class extends GitlyAbstractError {

@@ -51,2 +55,3 @@ },

_c);
// biome-ignore lint/complexity/noStaticOnlyClass: <explanation>
exports.GitlyDownloadError = (_d = class extends GitlyAbstractError {

@@ -57,2 +62,3 @@ },

_d);
// biome-ignore lint/complexity/noStaticOnlyClass: <explanation>
exports.GitlyCloneError = (_e = class extends GitlyAbstractError {

@@ -59,0 +65,0 @@ },

@@ -1,2 +0,2 @@

import GitlyOptions from '../interfaces/options';
import type GitlyOptions from '../interfaces/options';
export default function exists(path: string, options?: GitlyOptions): Promise<boolean>;

@@ -6,12 +6,13 @@ "use strict";

Object.defineProperty(exports, "__esModule", { value: true });
const fs_1 = require("fs");
const path_1 = require("path");
const node_fs_1 = require("node:fs");
const node_path_1 = require("node:path");
const parse_1 = __importDefault(require("./parse"));
const archive_1 = require("./archive");
async function exists(path, options = {}) {
if (!(0, path_1.isAbsolute)(path)) {
path = (0, archive_1.getArchivePath)((0, parse_1.default)(path), options);
let _path = path;
if (!(0, node_path_1.isAbsolute)(path)) {
_path = (0, archive_1.getArchivePath)((0, parse_1.default)(path), options);
}
try {
await fs_1.promises.access(path, fs_1.constants.F_OK);
await node_fs_1.promises.access(_path, node_fs_1.constants.F_OK);
return true;

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

@@ -1,2 +0,2 @@

import GitlyOptions from '../interfaces/options';
import type GitlyOptions from '../interfaces/options';
/**

@@ -3,0 +3,0 @@ * Extract a zipped file to the specified destination

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

Object.defineProperty(exports, "__esModule", { value: true });
const fs_1 = require("fs");
const path_1 = require("path");
const node_fs_1 = require("node:fs");
const node_path_1 = require("node:path");
const exists_1 = __importDefault(require("./exists"));
const archive_1 = require("./archive");
const { mkdir } = fs_1.promises;
const { mkdir } = node_fs_1.promises;
/**

@@ -20,11 +20,12 @@ * Extract a zipped file to the specified destination

exports.default = async (source, destination, options = {}) => {
destination = (0, path_1.resolve)(destination);
var _a;
const _destination = (0, node_path_1.resolve)(destination);
if (await (0, exists_1.default)(source, options)) {
try {
const filter = options.extract && options.extract.filter
const filter = ((_a = options.extract) === null || _a === void 0 ? void 0 : _a.filter)
? options.extract.filter
: () => true;
await mkdir(destination, { recursive: true });
await (0, archive_1.extract)({ strip: 1, filter, file: source, cwd: destination });
return destination;
await (0, archive_1.extract)({ strip: 1, filter, file: source, cwd: _destination });
return _destination;
// eslint-disable-next-line no-empty

@@ -31,0 +32,0 @@ }

@@ -1,2 +0,2 @@

import GitlyOptions from '../interfaces/options';
import type GitlyOptions from '../interfaces/options';
export default function fetch(url: string, file: string, options?: GitlyOptions): Promise<string>;

@@ -30,7 +30,7 @@ "use strict";

const axios_1 = __importDefault(require("axios"));
const stream = __importStar(require("stream"));
const util_1 = require("util");
const stream = __importStar(require("node:stream"));
const node_util_1 = require("node:util");
const error_1 = require("./error");
const write_1 = __importDefault(require("./write"));
const pipeline = (0, util_1.promisify)(stream.pipeline);
const pipeline = (0, node_util_1.promisify)(stream.pipeline);
async function fetch(url, file, options = {}) {

@@ -45,9 +45,8 @@ const response = await axios_1.default.get(url, {

throw new error_1.GitlyDownloadError(message, code);
else if (code >= 300 && code < 400 && response.headers.location) {
if (code >= 300 && code < 400 && response.headers.location) {
return fetch(response.headers.location, file);
}
else
await pipeline(response.data, await (0, write_1.default)(file));
await pipeline(response.data, await (0, write_1.default)(file));
return file;
}
exports.default = fetch;

@@ -1,2 +0,2 @@

import GitlyOptions from '../interfaces/options';
import type GitlyOptions from '../interfaces/options';
/**

@@ -3,0 +3,0 @@ * Downloads and extracts the repository

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.isOffline = void 0;
const dns_1 = require("dns");
const { lookup } = dns_1.promises;
const node_dns_1 = require("node:dns");
const { lookup } = node_dns_1.promises;
async function isOffline() {

@@ -7,0 +7,0 @@ try {

@@ -1,3 +0,3 @@

import GitlyOptions from '../interfaces/options';
import URLInfo from '../interfaces/url';
import type GitlyOptions from '../interfaces/options';
import type URLInfo from '../interfaces/url';
/**

@@ -4,0 +4,0 @@ * Parses a url and returns the metadata

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const url_1 = require("url");
const node_url_1 = require("node:url");
/**

@@ -20,3 +20,3 @@ * Parses a url and returns the metadata

const { url: normalized, host } = normalizeURL(url, options);
const result = new url_1.URL(normalized);
const result = new node_url_1.URL(normalized);
const paths = (result.pathname || '').split('/').filter(Boolean);

@@ -23,0 +23,0 @@ const owner = paths.shift() || '';

/// <reference types="node" />
import { WriteStream } from 'fs';
import type { WriteStream } from 'node:fs';
/**

@@ -4,0 +4,0 @@ * Create a folder and return a writable stream.

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const fs_1 = require("fs");
const path_1 = require("path");
const { mkdir } = fs_1.promises;
const node_fs_1 = require("node:fs");
const node_path_1 = require("node:path");
const { mkdir } = node_fs_1.promises;
/**

@@ -11,6 +11,6 @@ * Create a folder and return a writable stream.

async function write(path) {
path = (0, path_1.normalize)(path);
await mkdir((0, path_1.dirname)(path), { recursive: true });
return (0, fs_1.createWriteStream)(path);
const _path = (0, node_path_1.normalize)(path);
await mkdir((0, node_path_1.dirname)(_path), { recursive: true });
return (0, node_fs_1.createWriteStream)(_path);
}
exports.default = write;
{
"name": "gitly",
"version": "2.5.3",
"version": "3.0.0",
"description": "An API to download and/or extract git repositories",

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

"cross-spawn": "^7.0.3",
"shelljs": "^0.8.5",
"tar": "^6.2.1"
"tar": "^7.1.0",
"shelljs": "^0.8.5"
},

@@ -22,11 +22,5 @@ "devDependencies": {

"@types/jest": "^29.5.12",
"@types/node": "^20.12.7",
"@types/node": "^20.12.11",
"@types/shelljs": "^0.8.15",
"@types/tar": "^6.1.12",
"@typescript-eslint/eslint-plugin": "^7.0.2",
"@typescript-eslint/eslint-plugin-tslint": "^7.0.2",
"@typescript-eslint/parser": "^7.0.2",
"eslint": "^8.56.0",
"eslint-plugin-import": "^2.29.1",
"eslint-plugin-prefer-arrow": "^1.2.3",
"@types/tar": "^6.1.13",
"jest": "^29.7.0",

@@ -36,3 +30,3 @@ "prettier": "^3.2.5",

"tslib": "^2.6.2",
"typescript": "^5.4.4"
"typescript": "^5.4.5"
},

@@ -45,4 +39,2 @@ "scripts": {

"test": "jest",
"lint": "eslint -c .eslintrc.js --ext .ts src",
"lint:fix": "npm run lint --fix",
"format": "prettier --write \"src/**/*.ts\" \"*.json\" \"*.md\""

@@ -70,4 +62,4 @@ },

"engines": {
"node": ">=15.x"
"node": ">=20.x"
}
}
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