Skip to content

Commit 3c53ac5

Browse files
authored
Update Server.ts
1 parent 3bba0c0 commit 3c53ac5

File tree

1 file changed

+19
-1
lines changed

1 file changed

+19
-1
lines changed

src/Server.ts

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ import { errorHandlerMiddleware, frontendMiddleware, redirectMiddleware } from '
1414
import { execute, issueHttpsCertificate, pull } from 'utils/misc';
1515
import { frontendBuildDir, frontendBuiltDir, frontendDir, rootDir } from 'config/paths';
1616

17+
import fs from 'fs-extra';
18+
1719
const Webhook = require('express-github-webhook');
1820

1921
export default class Server {
@@ -91,7 +93,23 @@ export default class Server {
9193
};
9294

9395
async updateFrontend(commit?: string) {
94-
await pull(frontendDir, 'algorithm-visualizer', commit);
96+
if (fs.pathExistsSync(frontendDir)) {
97+
await execute(`git fetch`, {
98+
cwd: frontendDir,
99+
stdout: process.stdout,
100+
stderr: process.stderr,
101+
});
102+
} else {
103+
await execute(`git clone https://github.com/likewu/algorithm-visualizer.git ${frontendDir}`, {
104+
stdout: process.stdout,
105+
stderr: process.stderr,
106+
});
107+
}
108+
await execute(`git reset --hard origin/master`, {
109+
cwd: frontendDir,
110+
stdout: process.stdout,
111+
stderr: process.stderr,
112+
});
95113
await execute([
96114
'npm install',
97115
'npm run build',

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy