Skip to content

Commit 1830252

Browse files
committed
Stub project info APIs in browser demo
1 parent 5566c8e commit 1830252

File tree

1 file changed

+94
-0
lines changed

1 file changed

+94
-0
lines changed

index.html

Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,59 @@
177177
await delay(150);
178178
return 'valid';
179179
},
180+
async getProjectInfo(repoPath) {
181+
await delay(200);
182+
const repoId = repoIdByPath.get(repoPath);
183+
const nodeCapabilities = {
184+
engine: 'node@20.10.0',
185+
declaredManager: 'npm',
186+
packageManagers: { pnpm: true, yarn: false, npm: true, bun: false },
187+
typescript: true,
188+
testFrameworks: ['vitest'],
189+
linters: ['eslint', 'prettier'],
190+
bundlers: ['vite'],
191+
monorepo: { workspaces: false, turbo: false, nx: false, yarnBerryPnp: false },
192+
};
193+
194+
if (repoId === 'repo-ui-stability') {
195+
return {
196+
tags: ['node', 'react', 'frontend'],
197+
files: { dproj: [], pomXml: [], csproj: [], sln: [] },
198+
nodejs: nodeCapabilities,
199+
};
200+
}
201+
202+
return {
203+
tags: ['node', 'service'],
204+
files: { dproj: [], pomXml: [], csproj: [], sln: [] },
205+
nodejs: {
206+
...nodeCapabilities,
207+
testFrameworks: ['jest'],
208+
},
209+
docker: {
210+
composeFiles: ['docker-compose.yml'],
211+
dockerfiles: ['Dockerfile'],
212+
},
213+
};
214+
},
215+
async getProjectSuggestions({ repoPath }) {
216+
await delay(120);
217+
const repoId = repoIdByPath.get(repoPath);
218+
if (repoId === 'repo-ui-stability') {
219+
return [
220+
{ label: 'Run lint', value: 'npm run lint', group: 'npm scripts' },
221+
{ label: 'Launch Storybook', value: 'npm run storybook', group: 'npm scripts' },
222+
];
223+
}
224+
return [
225+
{ label: 'Run integration tests', value: 'npm run test:integration', group: 'npm scripts' },
226+
{ label: 'Start API locally', value: 'npm run dev', group: 'npm scripts' },
227+
];
228+
},
229+
async getDelphiVersions() {
230+
await delay(50);
231+
return [];
232+
},
180233
async getDetailedVcsStatus(repo) {
181234
await delay(350);
182235
const nextIndex = refreshIndexByRepo.get(repo.id) === 1 ? 0 : 1;
@@ -199,6 +252,47 @@
199252
console.info('Simulated cleanup of merged or stale local branches');
200253
return { success: true, message: 'Simulated cleanup completed.' };
201254
},
255+
async getGithubPat() {
256+
await delay(100);
257+
return '';
258+
},
259+
async getAllReleases() {
260+
await delay(200);
261+
return [
262+
{
263+
id: 1,
264+
tagName: 'v1.1.0',
265+
name: 'Stability Improvements',
266+
body: 'Improved caching and added new dashboards.',
267+
isDraft: false,
268+
isPrerelease: false,
269+
url: 'https://example.com/releases/v1.1.0',
270+
createdAt: new Date(Date.now() - 1000 * 60 * 60 * 24 * 14).toISOString(),
271+
},
272+
];
273+
},
274+
async updateRelease() {
275+
await delay(150);
276+
return { success: true };
277+
},
278+
async createRelease() {
279+
await delay(150);
280+
return { success: true };
281+
},
282+
async deleteRelease() {
283+
await delay(150);
284+
return { success: true };
285+
},
286+
async discoverRemoteUrl({ localPath }) {
287+
await delay(120);
288+
const repoId = repoIdByPath.get(localPath);
289+
const repo = sampleRepositories.find(r => r.id === repoId);
290+
return { url: repo?.remoteUrl ?? null };
291+
},
292+
async showDirectoryPicker() {
293+
await delay(80);
294+
return { canceled: false, filePaths: ['/Users/dev/projects'] };
295+
},
202296
async getLatestRelease() {
203297
await delay(200);
204298
return {

0 commit comments

Comments
 (0)