pagezero 0.4.1 → 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/pagezero.ts +10 -2
- package/package.json +3 -2
- package/src/commands/init.ts +23 -10
- package/src/commands/upgrade.ts +10 -4
package/bin/pagezero.ts
CHANGED
|
@@ -8,8 +8,16 @@ program
|
|
|
8
8
|
.description("PageZERO CLI")
|
|
9
9
|
.option("-h, --help", "output usage information")
|
|
10
10
|
|
|
11
|
-
program
|
|
11
|
+
program
|
|
12
|
+
.command("init")
|
|
13
|
+
.description("initialize a new project")
|
|
14
|
+
.option("-p, --powerup", "use PowerUP edition")
|
|
15
|
+
.action(init)
|
|
12
16
|
|
|
13
|
-
program
|
|
17
|
+
program
|
|
18
|
+
.command("upgrade")
|
|
19
|
+
.description("upgrade pagezero stack")
|
|
20
|
+
.option("-p, --powerup", "use PowerUP edition")
|
|
21
|
+
.action(upgrade)
|
|
14
22
|
|
|
15
23
|
program.parse()
|
package/package.json
CHANGED
|
@@ -30,7 +30,8 @@
|
|
|
30
30
|
"scripts": {
|
|
31
31
|
"check": "biome check",
|
|
32
32
|
"check:fix": "biome check --write",
|
|
33
|
-
"check:types": "tsc"
|
|
33
|
+
"check:types": "tsc",
|
|
34
|
+
"git:clean": "git branch -l | grep -v 'main' | xargs git branch -D"
|
|
34
35
|
},
|
|
35
36
|
"devDependencies": {
|
|
36
37
|
"@biomejs/biome": "2.3.3",
|
|
@@ -47,5 +48,5 @@
|
|
|
47
48
|
"log-symbols": "7.0.1",
|
|
48
49
|
"ora": "9.0.0"
|
|
49
50
|
},
|
|
50
|
-
"version": "0.
|
|
51
|
+
"version": "0.5.0"
|
|
51
52
|
}
|
package/src/commands/init.ts
CHANGED
|
@@ -3,7 +3,7 @@ import { $, file, write } from "bun"
|
|
|
3
3
|
import chalk from "chalk"
|
|
4
4
|
import { spinner } from "../utils"
|
|
5
5
|
|
|
6
|
-
export async function init() {
|
|
6
|
+
export async function init({ powerup }: { powerup?: boolean }) {
|
|
7
7
|
// Welcome
|
|
8
8
|
console.log(chalk.green("👋 Welcome to PageZERO CLI"))
|
|
9
9
|
console.log(chalk.green("🚀 Let's get you started with your project!"))
|
|
@@ -12,24 +12,28 @@ export async function init() {
|
|
|
12
12
|
const projectName = await input({
|
|
13
13
|
message: "What is the name of your project?",
|
|
14
14
|
})
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
15
|
+
if (powerup) {
|
|
16
|
+
await spinner("downloading pagezero powerup edition", async () => {
|
|
17
|
+
await $`git clone --depth 1 https://github.com/pagezero-dev/powerup.git ${projectName}`.quiet()
|
|
18
|
+
})
|
|
19
|
+
} else {
|
|
20
|
+
await spinner("downloading pagezero", async () => {
|
|
21
|
+
await $`git clone --depth 1 https://github.com/pagezero-dev/pagezero.git ${projectName}`.quiet()
|
|
22
|
+
})
|
|
23
|
+
}
|
|
20
24
|
|
|
21
25
|
// Install dependencies
|
|
22
|
-
await spinner(`
|
|
26
|
+
await spinner(`running: bun install`, () =>
|
|
23
27
|
$`bun install`.quiet().cwd(projectName),
|
|
24
28
|
)
|
|
25
29
|
|
|
26
30
|
// Run setup script
|
|
27
|
-
await spinner(`
|
|
31
|
+
await spinner(`running: bun run setup`, () =>
|
|
28
32
|
$`bun run setup`.quiet().cwd(projectName),
|
|
29
33
|
)
|
|
30
34
|
|
|
31
35
|
// Update wrangler.json
|
|
32
|
-
await spinner(`
|
|
36
|
+
await spinner(`updating wrangler.json`, async () => {
|
|
33
37
|
const wranglerJson = await file(`${projectName}/wrangler.json`).json()
|
|
34
38
|
wranglerJson.name = projectName
|
|
35
39
|
wranglerJson.d1_databases[0].database_name = `${projectName}-development`
|
|
@@ -44,8 +48,17 @@ export async function init() {
|
|
|
44
48
|
)
|
|
45
49
|
})
|
|
46
50
|
|
|
51
|
+
// Initialize git repository
|
|
52
|
+
await spinner("initializing fresh git repository", async () => {
|
|
53
|
+
await $`rm -rf .git`.quiet().cwd(projectName)
|
|
54
|
+
await $`git init`.quiet().cwd(projectName)
|
|
55
|
+
await $`git add .`.quiet().cwd(projectName)
|
|
56
|
+
await $`git commit -m "Initial commit"`.quiet().cwd(projectName)
|
|
57
|
+
await $`git branch -m master main`.quiet().cwd(projectName)
|
|
58
|
+
})
|
|
59
|
+
|
|
47
60
|
// Done
|
|
48
61
|
console.log(chalk.green("🎉 Done! Your project is ready to go."))
|
|
49
62
|
console.log(chalk.green.bold(`cd ${projectName}`))
|
|
50
|
-
console.log(chalk.green.bold("bun
|
|
63
|
+
console.log(chalk.green.bold("bun dev"))
|
|
51
64
|
}
|
package/src/commands/upgrade.ts
CHANGED
|
@@ -5,7 +5,7 @@ import chalk from "chalk"
|
|
|
5
5
|
import logSymbols from "log-symbols"
|
|
6
6
|
import { spinner } from "../utils"
|
|
7
7
|
|
|
8
|
-
export async function upgrade() {
|
|
8
|
+
export async function upgrade({ powerup }: { powerup?: boolean }) {
|
|
9
9
|
console.log(
|
|
10
10
|
chalk.yellow(
|
|
11
11
|
boxen(
|
|
@@ -43,9 +43,15 @@ export async function upgrade() {
|
|
|
43
43
|
return
|
|
44
44
|
}
|
|
45
45
|
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
46
|
+
if (powerup) {
|
|
47
|
+
await spinner(`downloading latest PageZERO PowerUP edition`, () =>
|
|
48
|
+
$`git clone --depth 1 https://github.com/pagezero-dev/powerup.git pagezero-latest`.quiet(),
|
|
49
|
+
)
|
|
50
|
+
} else {
|
|
51
|
+
await spinner(`downloading latest PageZERO stack`, () =>
|
|
52
|
+
$`git clone --depth 1 https://github.com/pagezero-dev/pagezero.git pagezero-latest`.quiet(),
|
|
53
|
+
)
|
|
54
|
+
}
|
|
49
55
|
|
|
50
56
|
await spinner(`copying PageZERO stack to project directory`, () =>
|
|
51
57
|
$`rsync -a --exclude=".git" ./pagezero-latest/ ./`.quiet(),
|