Skip to content

Commit f0188a6

Browse files
committed
fix(examples): clone with https
1 parent 4535ad4 commit f0188a6

File tree

2 files changed

+26
-41
lines changed

2 files changed

+26
-41
lines changed

src/setup/clone-examples.ts

Lines changed: 19 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import fs from 'node:fs/promises'
21
import { KIT_FIRST_PATH } from '../core/utils.js'
32

43
async function downloadAndSetupExamples() {
@@ -10,46 +9,35 @@ async function downloadAndSetupExamples() {
109

1110
let source = path.join(destination, 'kit-examples-main')
1211
let newDestination = kenvPath('kenvs', 'examples')
13-
await fs.rename(source, newDestination)
12+
await rename(source, newDestination)
13+
}
1414

15-
let files = await fs.readdir(path.join(newDestination, 'scripts'))
16-
let firstFile = path.join(newDestination, 'scripts', files[0])
17-
if (await fs.stat(firstFile)) {
18-
await wait(1000)
19-
await fs.utimes(firstFile, new Date(), new Date())
20-
}
15+
async function pnpmInstallExamples() {
16+
await exec('pnpm i', {
17+
cwd: kenvPath('kenvs', 'examples'),
18+
env: {
19+
...global.env,
20+
PATH: KIT_FIRST_PATH
21+
}
22+
}).catch((error) => {
23+
console.error(error)
24+
})
2125
}
2226

2327
let examplesDir = kenvPath('kenvs', 'examples')
24-
if (await isDir(examplesDir)) {
25-
cd(examplesDir)
2628

27-
if (isDir(kenvPath('kenvs', 'examples', '.git'))) {
28-
await exec('git stash', {
29-
cwd: examplesDir
30-
})
31-
await exec('git pull', {
32-
cwd: examplesDir
33-
})
34-
}
35-
} else if (await isBin('git')) {
29+
if (await isDir(examplesDir)) {
30+
await exec('git pull --rebase --autostash --stat', {
31+
cwd: examplesDir
32+
})
33+
} else {
3634
try {
37-
await exec('git clone --depth 1 --verbose --progress git://github.com/johnlindquist/kit-examples-ts.git examples', {
35+
await exec('git clone --depth 1 https://github.com/johnlindquist/kit-examples-ts examples', {
3836
cwd: kenvPath('kenvs')
3937
})
4038
} catch (error) {
4139
await downloadAndSetupExamples()
4240
}
43-
} else {
44-
await downloadAndSetupExamples()
4541
}
4642

47-
try {
48-
await exec('pnpm i', {
49-
cwd: kenvPath('kenvs', 'examples'),
50-
env: {
51-
...global.env,
52-
PATH: KIT_FIRST_PATH
53-
}
54-
})
55-
} catch (error) {}
43+
await pnpmInstallExamples()

src/setup/clone-sponsors.ts

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,13 @@
1-
let sponsorsDir = kenvPath("kenvs", "sponsors")
1+
let sponsorsDir = kenvPath('kenvs', 'sponsors')
22

33
if (await isDir(sponsorsDir)) {
4-
await exec("git pull --rebase --autostash --stat", {
5-
cwd: sponsorsDir
6-
})
4+
await exec('git pull --rebase --autostash --stat', {
5+
cwd: sponsorsDir
6+
})
77
} else {
8-
await exec(
9-
"git clone https://github.com/johnlindquist/kit-sponsors sponsors",
10-
{
11-
cwd: kenvPath("kenvs")
12-
}
13-
)
8+
await exec('git clone --depth 1 https://github.com/johnlindquist/kit-sponsors sponsors', {
9+
cwd: kenvPath('kenvs')
10+
})
1411
}
1512

1613
export type {}

0 commit comments

Comments
 (0)