mirror of
https://github.com/renovatebot/renovate.git
synced 2024-12-22 21:48:32 +00:00
eb8c08079e
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: Michael Kriese <michael.kriese@visualon.de>
63 lines
1.9 KiB
TypeScript
63 lines
1.9 KiB
TypeScript
import { execSync } from 'node:child_process';
|
|
import { glob } from 'glob';
|
|
import { logger } from '../../../logger';
|
|
import type { CommitFilesConfig, LongCommitSha } from '../../../util/git/types';
|
|
import type { PlatformScm } from '../types';
|
|
|
|
let fileList: string[] | undefined;
|
|
export class LocalFs implements PlatformScm {
|
|
isBranchBehindBase(branchName: string, baseBranch: string): Promise<boolean> {
|
|
return Promise.resolve(false);
|
|
}
|
|
isBranchModified(branchName: string, baseBranch: string): Promise<boolean> {
|
|
return Promise.resolve(false);
|
|
}
|
|
isBranchConflicted(baseBranch: string, branch: string): Promise<boolean> {
|
|
return Promise.resolve(false);
|
|
}
|
|
branchExists(branchName: string): Promise<boolean> {
|
|
return Promise.resolve(true);
|
|
}
|
|
getBranchCommit(branchName: string): Promise<LongCommitSha | null> {
|
|
return Promise.resolve(null);
|
|
}
|
|
deleteBranch(branchName: string): Promise<void> {
|
|
return Promise.resolve();
|
|
}
|
|
commitAndPush(
|
|
commitConfig: CommitFilesConfig,
|
|
): Promise<LongCommitSha | null> {
|
|
return Promise.resolve(null);
|
|
}
|
|
|
|
async getFileList(): Promise<string[]> {
|
|
try {
|
|
// fetch file list using git
|
|
const stdout = execSync('git ls-files', { encoding: 'utf-8' });
|
|
logger.debug('Got file list using git');
|
|
fileList = stdout.split('\n');
|
|
} catch {
|
|
logger.debug('Could not get file list using git, using glob instead');
|
|
fileList ??= await glob('**', {
|
|
dot: true,
|
|
nodir: true,
|
|
});
|
|
}
|
|
|
|
return fileList;
|
|
}
|
|
|
|
checkoutBranch(branchName: string): Promise<LongCommitSha> {
|
|
// We don't care about the commit sha in local mode
|
|
return Promise.resolve('' as LongCommitSha);
|
|
}
|
|
|
|
mergeAndPush(branchName: string): Promise<void> {
|
|
return Promise.resolve();
|
|
}
|
|
|
|
mergeToLocal(branchName: string): Promise<void> {
|
|
return Promise.resolve();
|
|
}
|
|
}
|