diff --git a/packages/backend/src/connectionManager.ts b/packages/backend/src/connectionManager.ts index e09a79153..f55171414 100644 --- a/packages/backend/src/connectionManager.ts +++ b/packages/backend/src/connectionManager.ts @@ -142,13 +142,6 @@ export class ConnectionManager implements IConnectionManager { case 'gerrit': { return await compileGerritConfig(config, job.data.connectionId, orgId); } - default: { - return {repoData: [], notFound: { - users: [], - orgs: [], - repos: [], - }}; - } } })(); } catch (err) { diff --git a/packages/backend/src/gerrit.ts b/packages/backend/src/gerrit.ts index c6d96d509..17d8ac65b 100644 --- a/packages/backend/src/gerrit.ts +++ b/packages/backend/src/gerrit.ts @@ -2,7 +2,7 @@ import fetch from 'cross-fetch'; import { GerritConfig } from "@sourcebot/schemas/v2/index.type" import { createLogger } from './logger.js'; import micromatch from "micromatch"; -import { measure, marshalBool, excludeReposByName, includeReposByName, fetchWithRetry } from './utils.js'; +import { measure, fetchWithRetry } from './utils.js'; import { BackendError } from '@sourcebot/error'; import { BackendException } from '@sourcebot/error'; diff --git a/packages/backend/src/git.ts b/packages/backend/src/git.ts index 48785ecb7..a7e3a610e 100644 --- a/packages/backend/src/git.ts +++ b/packages/backend/src/git.ts @@ -1,10 +1,4 @@ -import { GitRepository, AppContext } from './types.js'; import { simpleGit, SimpleGitProgressEvent } from 'simple-git'; -import { createLogger } from './logger.js'; -import { GitConfig } from "@sourcebot/schemas/v2/index.type" -import path from 'path'; - -const logger = createLogger('git'); export const cloneRepository = async (cloneURL: string, path: string, gitConfig?: Record, onProgress?: (event: SimpleGitProgressEvent) => void) => { const git = simpleGit({ @@ -45,80 +39,3 @@ export const fetchRepository = async (path: string, onProgress?: (event: SimpleG ] ); } - -const isValidGitRepo = async (url: string): Promise => { - const git = simpleGit(); - try { - await git.listRemote([url]); - return true; - } catch (error) { - logger.debug(`Error checking if ${url} is a valid git repo: ${error}`); - return false; - } -} - -const stripProtocolAndGitSuffix = (url: string): string => { - return url.replace(/^[a-zA-Z]+:\/\//, '').replace(/\.git$/, ''); -} - -const getRepoNameFromUrl = (url: string): string => { - const strippedUrl = stripProtocolAndGitSuffix(url); - return strippedUrl.split('/').slice(-2).join('/'); -} - -export const getGitRepoFromConfig = async (config: GitConfig, ctx: AppContext) => { - const repoValid = await isValidGitRepo(config.url); - if (!repoValid) { - logger.error(`Git repo provided in config with url ${config.url} is not valid`); - return null; - } - - const cloneUrl = config.url; - const repoId = stripProtocolAndGitSuffix(cloneUrl); - const repoName = getRepoNameFromUrl(config.url); - const repoPath = path.resolve(path.join(ctx.reposPath, `${repoId}.git`)); - const repo: GitRepository = { - vcs: 'git', - id: repoId, - name: repoName, - path: repoPath, - isStale: false, - cloneUrl: cloneUrl, - branches: [], - tags: [], - } - - if (config.revisions) { - if (config.revisions.branches) { - const branchGlobs = config.revisions.branches; - const git = simpleGit(); - const branchList = await git.listRemote(['--heads', cloneUrl]); - const branches = branchList - .split('\n') - .map(line => line.split('\t')[1]) - .filter(Boolean) - .map(branch => branch.replace('refs/heads/', '')); - - repo.branches = branches.filter(branch => - branchGlobs.some(glob => new RegExp(glob).test(branch)) - ); - } - - if (config.revisions.tags) { - const tagGlobs = config.revisions.tags; - const git = simpleGit(); - const tagList = await git.listRemote(['--tags', cloneUrl]); - const tags = tagList - .split('\n') - .map(line => line.split('\t')[1]) - .filter(Boolean) - .map(tag => tag.replace('refs/tags/', '')); - - repo.tags = tags.filter(tag => - tagGlobs.some(glob => new RegExp(glob).test(tag)) - ); - } - } - - return repo; -} \ No newline at end of file diff --git a/packages/backend/src/local.ts b/packages/backend/src/local.ts deleted file mode 100644 index 0bddac6ad..000000000 --- a/packages/backend/src/local.ts +++ /dev/null @@ -1,71 +0,0 @@ -import { existsSync, FSWatcher, statSync, watch } from "fs"; -import { createLogger } from "./logger.js"; -import { LocalConfig } from "@sourcebot/schemas/v2/index.type" -import { AppContext, LocalRepository } from "./types.js"; -import { resolvePathRelativeToConfig } from "./utils.js"; -import path from "path"; - -const logger = createLogger('local'); -const fileWatchers = new Map(); -const abortControllers = new Map(); - - -export const getLocalRepoFromConfig = (config: LocalConfig, ctx: AppContext) => { - const repoPath = resolvePathRelativeToConfig(config.path, ctx.configPath); - logger.debug(`Resolved path '${config.path}' to '${repoPath}'`); - - if (!existsSync(repoPath)) { - throw new Error(`The local repository path '${repoPath}' referenced in ${ctx.configPath} does not exist`); - } - - const stat = statSync(repoPath); - if (!stat.isDirectory()) { - throw new Error(`The local repository path '${repoPath}' referenced in ${ctx.configPath} is not a directory`); - } - - const repo: LocalRepository = { - vcs: 'local', - name: path.basename(repoPath), - id: repoPath, - path: repoPath, - isStale: false, - excludedPaths: config.exclude?.paths ?? [], - watch: config.watch ?? true, - } - - return repo; -} - -export const initLocalRepoFileWatchers = (repos: LocalRepository[], onUpdate: (repo: LocalRepository, ac: AbortSignal) => Promise) => { - // Close all existing watchers - fileWatchers.forEach((watcher) => { - watcher.close(); - }); - - repos - .filter(repo => !repo.isStale && repo.watch) - .forEach((repo) => { - logger.info(`Watching local repository ${repo.id} for changes...`); - const watcher = watch(repo.path, async () => { - const existingController = abortControllers.get(repo.id); - if (existingController) { - existingController.abort(); - } - - const controller = new AbortController(); - abortControllers.set(repo.id, controller); - - try { - await onUpdate(repo, controller.signal); - } catch (err: any) { - if (err.name !== 'AbortError') { - logger.error(`Error while watching local repository ${repo.id} for changes:`); - console.log(err); - } else { - logger.debug(`Aborting watch for local repository ${repo.id} due to abort signal`); - } - } - }); - fileWatchers.set(repo.id, watcher); - }); -} \ No newline at end of file diff --git a/packages/backend/src/types.ts b/packages/backend/src/types.ts index 4dbc9b6e5..590e2d883 100644 --- a/packages/backend/src/types.ts +++ b/packages/backend/src/types.ts @@ -1,46 +1,3 @@ -/** - * @deprecated in V3 - */ -interface BaseRepository { - vcs: 'git' | 'local'; - id: string; - name: string; - path: string; - isStale: boolean; - lastIndexedDate?: string; - isFork?: boolean; - isArchived?: boolean; - codeHost?: string; - topics?: string[]; - sizeInBytes?: number; - tenantId?: number; -} - -/** - * @deprecated in V3 - */ -export interface GitRepository extends BaseRepository { - vcs: 'git'; - cloneUrl: string; - branches: string[]; - tags: string[]; - gitConfigMetadata?: Record; -} - -/** - * @deprecated in V3 - */ -export interface LocalRepository extends BaseRepository { - vcs: 'local'; - excludedPaths: string[]; - watch: boolean; -} - -/** - * @deprecated in V3 - */ -export type Repository = GitRepository | LocalRepository; - export type AppContext = { /** * Path to the repos cache directory. diff --git a/packages/backend/src/utils.test.ts b/packages/backend/src/utils.test.ts index 34e0a19e0..84d77f21f 100644 --- a/packages/backend/src/utils.test.ts +++ b/packages/backend/src/utils.test.ts @@ -1,62 +1,5 @@ import { expect, test } from 'vitest'; -import { arraysEqualShallow, isRemotePath, excludeReposByName, includeReposByTopic, excludeReposByTopic } from './utils'; -import { Repository } from './types'; - -const testNames: string[] = [ - "abcdefg/zfmno/ioiwerj/fawdf", - "abcdefg/zfmno/ioiwerj/werw", - "abcdefg/zfmno/ioiwerj/terne", - "abcdefg/zfmno/ioiwerj/asdf45e4r", - "abcdefg/zfmno/ioiwerj/ddee", - "abcdefg/zfmno/ioiwerj/ccdfeee", - "abcdefg/zfmno/sadfaw", - "abcdefg/zfmno/ioiwerj/wwe", - "abcdefg/ieieiowowieu8383/ieckup-e", - "abcdefg/ieieiowowieu8383/fvas-eer-wwwer3" -]; - -const createRepository = (name: string) => ({ - vcs: 'git', - id: name, - name: name, - path: name, - isStale: false, - cloneUrl: name, - branches: [name], - tags: [name] -}); - -test('should filter repos by micromatch pattern', () => { - // bad glob patterns - const unfilteredRepos = excludeReposByName(testNames.map(n => (createRepository(n))), ['/zfmno/']); - expect(unfilteredRepos.length).toBe(10); - expect(unfilteredRepos.map(r => r.name)).toEqual(testNames); - const unfilteredRepos1 = excludeReposByName(testNames.map(n => (createRepository(n))), ['**zfmno**']); - expect(unfilteredRepos1.length).toBe(10); - expect(unfilteredRepos1.map(r => r.name)).toEqual(testNames); - - // good glob patterns - const filteredRepos = excludeReposByName(testNames.map(n => (createRepository(n))), ['**/zfmno/**']); - expect(filteredRepos.length).toBe(2); - expect(filteredRepos.map(r => r.name)).toEqual(["abcdefg/ieieiowowieu8383/ieckup-e", "abcdefg/ieieiowowieu8383/fvas-eer-wwwer3"]); - const filteredRepos1 = excludeReposByName(testNames.map(n => (createRepository(n))), ['**/*fmn*/**']); - expect(filteredRepos1.length).toBe(2); - expect(filteredRepos1.map(r => r.name)).toEqual(["abcdefg/ieieiowowieu8383/ieckup-e", "abcdefg/ieieiowowieu8383/fvas-eer-wwwer3"]); -}); - -test('should filter repos by name exact match', () => { - const filteredRepos = excludeReposByName(testNames.map(n => (createRepository(n))), testNames.slice(1, 9)); - expect(filteredRepos.length).toBe(2); - expect(filteredRepos.map(r => r.name)).toEqual([testNames[0], testNames[9]]); - - const filteredRepos1 = excludeReposByName(testNames.map(n => (createRepository(n))), testNames.slice(3, 5)); - expect(filteredRepos1.length).toBe(8); - expect(filteredRepos1.map(r => r.name)).toEqual([testNames[0], testNames[1], testNames[2], testNames[5], testNames[6], testNames[7], testNames[8], testNames[9]]); - - const filteredRepos2 = excludeReposByName(testNames.map(n => (createRepository(n))), [testNames[0], testNames[7], testNames[9]]); - expect(filteredRepos2.length).toBe(7); - expect(filteredRepos2.map(r => r.name)).toEqual([...testNames.slice(1, 7), testNames[8]]); -}); +import { arraysEqualShallow, isRemotePath } from './utils'; test('should return true for identical arrays', () => { expect(arraysEqualShallow([1, 2, 3], [1, 2, 3])).toBe(true); @@ -125,135 +68,3 @@ test('isRemotePath should return false for non HTTP paths', () => { expect(isRemotePath('')).toBe(false); expect(isRemotePath(' ')).toBe(false); }); - - -test('includeReposByTopic should return repos with matching topics', () => { - const repos = [ - { id: '1', topics: ['javascript', 'typescript'] }, - { id: '2', topics: ['python', 'django'] }, - { id: '3', topics: ['typescript', 'react'] } - ].map(r => ({ - ...createRepository(r.id), - ...r, - } satisfies Repository)); - - const result = includeReposByTopic(repos, ['typescript']); - expect(result.length).toBe(2); - expect(result.map(r => r.id)).toEqual(['1', '3']); -}); - -test('includeReposByTopic should handle glob patterns in topic matching', () => { - const repos = [ - { id: '1', topics: ['frontend-app', 'backend-app'] }, - { id: '2', topics: ['mobile-app', 'web-app'] }, - { id: '3', topics: ['desktop-app', 'cli-app'] } - ].map(r => ({ - ...createRepository(r.id), - ...r, - } satisfies Repository)); - - const result = includeReposByTopic(repos, ['*-app']); - expect(result.length).toBe(3); -}); - -test('includeReposByTopic should handle repos with no topics', () => { - const repos = [ - { id: '1', topics: ['javascript'] }, - { id: '2', topics: undefined }, - { id: '3', topics: [] } - ].map(r => ({ - ...createRepository(r.id), - ...r, - } satisfies Repository)); - - const result = includeReposByTopic(repos, ['javascript']); - expect(result.length).toBe(1); - expect(result[0].id).toBe('1'); -}); - -test('includeReposByTopic should return empty array when no repos match topics', () => { - const repos = [ - { id: '1', topics: ['frontend'] }, - { id: '2', topics: ['backend'] } - ].map(r => ({ - ...createRepository(r.id), - ...r, - } satisfies Repository)); - - const result = includeReposByTopic(repos, ['mobile']); - expect(result).toEqual([]); -}); - - -test('excludeReposByTopic should exclude repos with matching topics', () => { - const repos = [ - { id: '1', topics: ['javascript', 'typescript'] }, - { id: '2', topics: ['python', 'django'] }, - { id: '3', topics: ['typescript', 'react'] } - ].map(r => ({ - ...createRepository(r.id), - ...r, - } satisfies Repository)); - - const result = excludeReposByTopic(repos, ['typescript']); - expect(result.length).toBe(1); - expect(result[0].id).toBe('2'); -}); - -test('excludeReposByTopic should handle glob patterns', () => { - const repos = [ - { id: '1', topics: ['test-lib', 'test-app'] }, - { id: '2', topics: ['prod-lib', 'prod-app'] }, - { id: '3', topics: ['dev-tool'] } - ].map(r => ({ - ...createRepository(r.id), - ...r, - } satisfies Repository)); - - const result = excludeReposByTopic(repos, ['test-*']); - expect(result.length).toBe(2); - expect(result.map(r => r.id)).toEqual(['2', '3']); -}); - -test('excludeReposByTopic should handle multiple exclude patterns', () => { - const repos = [ - { id: '1', topics: ['frontend', 'react'] }, - { id: '2', topics: ['backend', 'node'] }, - { id: '3', topics: ['mobile', 'react-native'] } - ].map(r => ({ - ...createRepository(r.id), - ...r, - } satisfies Repository)); - - const result = excludeReposByTopic(repos, ['*end', '*native']); - expect(result.length).toBe(0); -}); - -test('excludeReposByTopic should not exclude repos when no topics match', () => { - const repos = [ - { id: '1', topics: ['frontend'] }, - { id: '2', topics: ['backend'] }, - { id: '3', topics: undefined } - ].map(r => ({ - ...createRepository(r.id), - ...r, - } satisfies Repository)); - - const result = excludeReposByTopic(repos, ['mobile']); - expect(result.length).toBe(3); - expect(result.map(r => r.id)).toEqual(['1', '2', '3']); -}); - -test('excludeReposByTopic should handle empty exclude patterns array', () => { - const repos = [ - { id: '1', topics: ['frontend'] }, - { id: '2', topics: ['backend'] } - ].map(r => ({ - ...createRepository(r.id), - ...r, - } satisfies Repository)); - - const result = excludeReposByTopic(repos, []); - expect(result.length).toBe(2); - expect(result).toEqual(repos); -}); diff --git a/packages/backend/src/utils.ts b/packages/backend/src/utils.ts index 2bc3c8f1f..c0c60699d 100644 --- a/packages/backend/src/utils.ts +++ b/packages/backend/src/utils.ts @@ -1,7 +1,6 @@ import { Logger } from "winston"; -import { AppContext, Repository } from "./types.js"; +import { AppContext } from "./types.js"; import path from 'path'; -import micromatch from "micromatch"; import { PrismaClient, Repo } from "@sourcebot/db"; import { decrypt } from "@sourcebot/crypto"; import { Token } from "@sourcebot/schemas/v3/shared.type"; @@ -21,74 +20,6 @@ export const marshalBool = (value?: boolean) => { return !!value ? '1' : '0'; } -export const excludeForkedRepos = (repos: T[], logger?: Logger) => { - return repos.filter((repo) => { - if (!!repo.isFork) { - logger?.debug(`Excluding repo ${repo.id}. Reason: \`exclude.forks\` is true`); - return false; - } - return true; - }); -} - -export const excludeArchivedRepos = (repos: T[], logger?: Logger) => { - return repos.filter((repo) => { - if (!!repo.isArchived) { - logger?.debug(`Excluding repo ${repo.id}. Reason: \`exclude.archived\` is true`); - return false; - } - return true; - }); -} - - -export const excludeReposByName = (repos: T[], excludedRepoNames: string[], logger?: Logger) => { - return repos.filter((repo) => { - if (micromatch.isMatch(repo.name, excludedRepoNames)) { - logger?.debug(`Excluding repo ${repo.id}. Reason: \`exclude.repos\` contains ${repo.name}`); - return false; - } - return true; - }); -} - -export const includeReposByName = (repos: T[], includedRepoNames: string[], logger?: Logger) => { - return repos.filter((repo) => { - if (micromatch.isMatch(repo.name, includedRepoNames)) { - logger?.debug(`Including repo ${repo.id}. Reason: \`repos\` contain ${repo.name}`); - return true; - } - return false; - }); -} - -export const includeReposByTopic = (repos: T[], includedRepoTopics: string[], logger?: Logger) => { - return repos.filter((repo) => { - const topics = repo.topics ?? []; - const matchingTopics = topics.filter((topic) => micromatch.isMatch(topic, includedRepoTopics)); - - if (matchingTopics.length > 0) { - - logger?.debug(`Including repo ${repo.id}. Reason: \`topics\` matches the following topics: ${matchingTopics.join(', ')}`); - return true; - } - return false; - }); -} - -export const excludeReposByTopic = (repos: T[], excludedRepoTopics: string[], logger?: Logger) => { - return repos.filter((repo) => { - const topics = repo.topics ?? []; - const matchingTopics = topics.filter((topic) => micromatch.isMatch(topic, excludedRepoTopics)); - - if (matchingTopics.length > 0) { - logger?.debug(`Excluding repo ${repo.id}. Reason: \`exclude.topics\` matches the following topics: ${matchingTopics.join(', ')}`); - return false; - } - return true; - }); -} - export const getTokenFromConfig = async (token: Token, orgId: number, db?: PrismaClient) => { if (!db) { throw new BackendException(BackendError.CONNECTION_SYNC_SYSTEM_ERROR, { diff --git a/packages/backend/src/zoekt.ts b/packages/backend/src/zoekt.ts index 0c4727d09..3155ea888 100644 --- a/packages/backend/src/zoekt.ts +++ b/packages/backend/src/zoekt.ts @@ -1,12 +1,10 @@ import { exec } from "child_process"; -import { AppContext, LocalRepository, Settings } from "./types.js"; +import { AppContext } from "./types.js"; import { Repo } from "@sourcebot/db"; import { getRepoPath } from "./utils.js"; import { DEFAULT_SETTINGS } from "./constants.js"; import { getShardPrefix } from "./utils.js"; -const ALWAYS_EXCLUDED_DIRS = ['.git', '.hg', '.svn']; - export const indexGitRepository = async (repo: Repo, ctx: AppContext) => { const revisions = [ 'HEAD' @@ -29,21 +27,3 @@ export const indexGitRepository = async (repo: Repo, ctx: AppContext) => { }) }); } - -export const indexLocalRepository = async (repo: LocalRepository, settings: Settings, ctx: AppContext, signal?: AbortSignal) => { - const excludedDirs = [...ALWAYS_EXCLUDED_DIRS, repo.excludedPaths]; - const command = `zoekt-index -index ${ctx.indexPath} -file_limit ${settings.maxFileSize} -ignore_dirs ${excludedDirs.join(',')} ${repo.path}`; - - return new Promise<{ stdout: string, stderr: string }>((resolve, reject) => { - exec(command, { signal }, (error, stdout, stderr) => { - if (error) { - reject(error); - return; - } - resolve({ - stdout, - stderr - }); - }) - }); -} \ No newline at end of file diff --git a/packages/schemas/src/v3/connection.schema.ts b/packages/schemas/src/v3/connection.schema.ts index d92f7d241..0df57812f 100644 --- a/packages/schemas/src/v3/connection.schema.ts +++ b/packages/schemas/src/v3/connection.schema.ts @@ -487,80 +487,6 @@ const schema = { "url" ], "additionalProperties": false - }, - { - "$schema": "http://json-schema.org/draft-07/schema#", - "type": "object", - "title": "GitConnectionConfig", - "properties": { - "type": { - "const": "git", - "description": "Git Configuration" - }, - "url": { - "type": "string", - "format": "url", - "description": "The URL to the git repository." - }, - "revisions": { - "$ref": "#/oneOf/0/properties/revisions" - } - }, - "required": [ - "type", - "url" - ], - "additionalProperties": false - }, - { - "$schema": "http://json-schema.org/draft-07/schema#", - "type": "object", - "title": "GerritConnectionConfig", - "properties": { - "type": { - "const": "local", - "description": "Local Configuration" - }, - "path": { - "type": "string", - "description": "Path to the local directory to sync with. Relative paths are relative to the configuration file's directory.", - "pattern": ".+" - }, - "watch": { - "type": "boolean", - "default": true, - "description": "Enables a file watcher that will automatically re-sync when changes are made within `path` (recursively). Defaults to true." - }, - "exclude": { - "type": "object", - "properties": { - "paths": { - "type": "array", - "items": { - "type": "string", - "pattern": ".+" - }, - "description": "List of paths relative to the provided `path` to exclude from the index. .git, .hg, and .svn are always exluded.", - "default": [], - "examples": [ - [ - "node_modules", - "bin", - "dist", - "build", - "out" - ] - ] - } - }, - "additionalProperties": false - } - }, - "required": [ - "type", - "path" - ], - "additionalProperties": false } ] } as const; diff --git a/packages/schemas/src/v3/connection.type.ts b/packages/schemas/src/v3/connection.type.ts index 483317afd..c3588cbb5 100644 --- a/packages/schemas/src/v3/connection.type.ts +++ b/packages/schemas/src/v3/connection.type.ts @@ -4,9 +4,7 @@ export type ConnectionConfig = | GithubConnectionConfig | GitlabConnectionConfig | GiteaConnectionConfig - | GerritConnectionConfig - | GitConnectionConfig - | GerritConnectionConfig1; + | GerritConnectionConfig; export interface GithubConnectionConfig { /** @@ -219,34 +217,3 @@ export interface GerritConnectionConfig { projects?: string[]; }; } -export interface GitConnectionConfig { - /** - * Git Configuration - */ - type: "git"; - /** - * The URL to the git repository. - */ - url: string; - revisions?: GitRevisions; -} -export interface GerritConnectionConfig1 { - /** - * Local Configuration - */ - type: "local"; - /** - * Path to the local directory to sync with. Relative paths are relative to the configuration file's directory. - */ - path: string; - /** - * Enables a file watcher that will automatically re-sync when changes are made within `path` (recursively). Defaults to true. - */ - watch?: boolean; - exclude?: { - /** - * List of paths relative to the provided `path` to exclude from the index. .git, .hg, and .svn are always exluded. - */ - paths?: string[]; - }; -} diff --git a/packages/schemas/src/v3/git.schema.ts b/packages/schemas/src/v3/git.schema.ts deleted file mode 100644 index 3d8e889f1..000000000 --- a/packages/schemas/src/v3/git.schema.ts +++ /dev/null @@ -1,64 +0,0 @@ -// THIS IS A AUTO-GENERATED FILE. DO NOT MODIFY MANUALLY! -const schema = { - "$schema": "http://json-schema.org/draft-07/schema#", - "type": "object", - "title": "GitConnectionConfig", - "properties": { - "type": { - "const": "git", - "description": "Git Configuration" - }, - "url": { - "type": "string", - "format": "url", - "description": "The URL to the git repository." - }, - "revisions": { - "type": "object", - "description": "The revisions (branches, tags) that should be included when indexing. The default branch (HEAD) is always indexed.", - "properties": { - "branches": { - "type": "array", - "description": "List of branches to include when indexing. For a given repo, only the branches that exist on the repo's remote *and* match at least one of the provided `branches` will be indexed. The default branch (HEAD) is always indexed. Glob patterns are supported.", - "items": { - "type": "string" - }, - "examples": [ - [ - "main", - "release/*" - ], - [ - "**" - ] - ], - "default": [] - }, - "tags": { - "type": "array", - "description": "List of tags to include when indexing. For a given repo, only the tags that exist on the repo's remote *and* match at least one of the provided `tags` will be indexed. Glob patterns are supported.", - "items": { - "type": "string" - }, - "examples": [ - [ - "latest", - "v2.*.*" - ], - [ - "**" - ] - ], - "default": [] - } - }, - "additionalProperties": false - } - }, - "required": [ - "type", - "url" - ], - "additionalProperties": false -} as const; -export { schema as gitSchema }; \ No newline at end of file diff --git a/packages/schemas/src/v3/git.type.ts b/packages/schemas/src/v3/git.type.ts deleted file mode 100644 index b60d58320..000000000 --- a/packages/schemas/src/v3/git.type.ts +++ /dev/null @@ -1,26 +0,0 @@ -// THIS IS A AUTO-GENERATED FILE. DO NOT MODIFY MANUALLY! - -export interface GitConnectionConfig { - /** - * Git Configuration - */ - type: "git"; - /** - * The URL to the git repository. - */ - url: string; - revisions?: GitRevisions; -} -/** - * The revisions (branches, tags) that should be included when indexing. The default branch (HEAD) is always indexed. - */ -export interface GitRevisions { - /** - * List of branches to include when indexing. For a given repo, only the branches that exist on the repo's remote *and* match at least one of the provided `branches` will be indexed. The default branch (HEAD) is always indexed. Glob patterns are supported. - */ - branches?: string[]; - /** - * List of tags to include when indexing. For a given repo, only the tags that exist on the repo's remote *and* match at least one of the provided `tags` will be indexed. Glob patterns are supported. - */ - tags?: string[]; -} diff --git a/packages/schemas/src/v3/local.schema.ts b/packages/schemas/src/v3/local.schema.ts deleted file mode 100644 index fce2c51cd..000000000 --- a/packages/schemas/src/v3/local.schema.ts +++ /dev/null @@ -1,52 +0,0 @@ -// THIS IS A AUTO-GENERATED FILE. DO NOT MODIFY MANUALLY! -const schema = { - "$schema": "http://json-schema.org/draft-07/schema#", - "type": "object", - "title": "GerritConnectionConfig", - "properties": { - "type": { - "const": "local", - "description": "Local Configuration" - }, - "path": { - "type": "string", - "description": "Path to the local directory to sync with. Relative paths are relative to the configuration file's directory.", - "pattern": ".+" - }, - "watch": { - "type": "boolean", - "default": true, - "description": "Enables a file watcher that will automatically re-sync when changes are made within `path` (recursively). Defaults to true." - }, - "exclude": { - "type": "object", - "properties": { - "paths": { - "type": "array", - "items": { - "type": "string", - "pattern": ".+" - }, - "description": "List of paths relative to the provided `path` to exclude from the index. .git, .hg, and .svn are always exluded.", - "default": [], - "examples": [ - [ - "node_modules", - "bin", - "dist", - "build", - "out" - ] - ] - } - }, - "additionalProperties": false - } - }, - "required": [ - "type", - "path" - ], - "additionalProperties": false -} as const; -export { schema as localSchema }; \ No newline at end of file diff --git a/packages/schemas/src/v3/local.type.ts b/packages/schemas/src/v3/local.type.ts deleted file mode 100644 index 4551e3f9d..000000000 --- a/packages/schemas/src/v3/local.type.ts +++ /dev/null @@ -1,22 +0,0 @@ -// THIS IS A AUTO-GENERATED FILE. DO NOT MODIFY MANUALLY! - -export interface GerritConnectionConfig { - /** - * Local Configuration - */ - type: "local"; - /** - * Path to the local directory to sync with. Relative paths are relative to the configuration file's directory. - */ - path: string; - /** - * Enables a file watcher that will automatically re-sync when changes are made within `path` (recursively). Defaults to true. - */ - watch?: boolean; - exclude?: { - /** - * List of paths relative to the provided `path` to exclude from the index. .git, .hg, and .svn are always exluded. - */ - paths?: string[]; - }; -} diff --git a/schemas/v3/connection.json b/schemas/v3/connection.json index 67700fb67..45dee7ab5 100644 --- a/schemas/v3/connection.json +++ b/schemas/v3/connection.json @@ -13,12 +13,6 @@ }, { "$ref": "./gerrit.json" - }, - { - "$ref": "./git.json" - }, - { - "$ref": "./local.json" } ] } \ No newline at end of file diff --git a/schemas/v3/git.json b/schemas/v3/git.json deleted file mode 100644 index f6c030ff6..000000000 --- a/schemas/v3/git.json +++ /dev/null @@ -1,24 +0,0 @@ -{ - "$schema": "http://json-schema.org/draft-07/schema#", - "type": "object", - "title": "GitConnectionConfig", - "properties": { - "type": { - "const": "git", - "description": "Git Configuration" - }, - "url": { - "type": "string", - "format": "url", - "description": "The URL to the git repository." - }, - "revisions": { - "$ref": "./shared.json#/definitions/GitRevisions" - } - }, - "required": [ - "type", - "url" - ], - "additionalProperties": false -} \ No newline at end of file diff --git a/schemas/v3/local.json b/schemas/v3/local.json deleted file mode 100644 index 5be97d310..000000000 --- a/schemas/v3/local.json +++ /dev/null @@ -1,50 +0,0 @@ -{ - "$schema": "http://json-schema.org/draft-07/schema#", - "type": "object", - "title": "GerritConnectionConfig", - "properties": { - "type": { - "const": "local", - "description": "Local Configuration" - }, - "path": { - "type": "string", - "description": "Path to the local directory to sync with. Relative paths are relative to the configuration file's directory.", - "pattern": ".+" - }, - "watch": { - "type": "boolean", - "default": true, - "description": "Enables a file watcher that will automatically re-sync when changes are made within `path` (recursively). Defaults to true." - }, - "exclude": { - "type": "object", - "properties": { - "paths": { - "type": "array", - "items": { - "type": "string", - "pattern": ".+" - }, - "description": "List of paths relative to the provided `path` to exclude from the index. .git, .hg, and .svn are always exluded.", - "default": [], - "examples": [ - [ - "node_modules", - "bin", - "dist", - "build", - "out" - ] - ] - } - }, - "additionalProperties": false - } - }, - "required": [ - "type", - "path" - ], - "additionalProperties": false -} \ No newline at end of file