tempest.games 0.1.1 → 0.1.2
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/CHANGELOG.md +6 -0
- package/__scripts__/destroy-db.bun.ts +29 -0
- package/__scripts__/setup-db.bun.ts +57 -0
- package/__scripts__/setup.vitest.ts +5 -0
- package/app/assets/{index-CpJSDdLN.js → index-nXv7ua_C.js} +9 -9
- package/app/index.html +1 -1
- package/app/robots.txt +2 -0
- package/bin/backend.bun.js +19 -19
- package/bin/frontend.bun.js +10 -10
- package/package.json +9 -5
package/CHANGELOG.md
CHANGED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
#!/usr/bin/env bun
|
|
2
|
+
|
|
3
|
+
import * as os from "node:os"
|
|
4
|
+
|
|
5
|
+
import postgres from "postgres"
|
|
6
|
+
|
|
7
|
+
import { env } from "../src/library/env.ts"
|
|
8
|
+
|
|
9
|
+
const PRETTY_PLEASE = process.env.PRETTY_PLEASE
|
|
10
|
+
|
|
11
|
+
if (!PRETTY_PLEASE) {
|
|
12
|
+
console.warn(`🚨 this is a dangerous script, please ask nicely`)
|
|
13
|
+
process.exit(1)
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
const osUser = os.userInfo().username
|
|
17
|
+
const user = osUser === `unknown` ? `postgres` : osUser
|
|
18
|
+
|
|
19
|
+
const sql = postgres({
|
|
20
|
+
user,
|
|
21
|
+
password: env.POSTGRES_PASSWORD,
|
|
22
|
+
database: `postgres`,
|
|
23
|
+
host: env.POSTGRES_HOST,
|
|
24
|
+
port: env.POSTGRES_PORT,
|
|
25
|
+
})
|
|
26
|
+
|
|
27
|
+
await sql.unsafe(`DROP DATABASE ${env.POSTGRES_DATABASE};`)
|
|
28
|
+
|
|
29
|
+
await sql.end()
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
#!/usr/bin/env bun
|
|
2
|
+
|
|
3
|
+
import * as os from "node:os"
|
|
4
|
+
|
|
5
|
+
import postgres from "postgres"
|
|
6
|
+
|
|
7
|
+
import { env } from "../src/library/env.ts"
|
|
8
|
+
|
|
9
|
+
const osUser = os.userInfo().username
|
|
10
|
+
const user = osUser === `unknown` ? `postgres` : osUser
|
|
11
|
+
|
|
12
|
+
const sql = postgres({
|
|
13
|
+
user,
|
|
14
|
+
password: env.POSTGRES_PASSWORD,
|
|
15
|
+
database: `postgres`,
|
|
16
|
+
host: env.POSTGRES_HOST,
|
|
17
|
+
port: env.POSTGRES_PORT,
|
|
18
|
+
})
|
|
19
|
+
|
|
20
|
+
try {
|
|
21
|
+
process.stdout.write(`🚀 Creating database ${env.POSTGRES_DATABASE}... `)
|
|
22
|
+
await sql`CREATE DATABASE ${sql(env.POSTGRES_DATABASE)}`
|
|
23
|
+
console.log(`Done!`)
|
|
24
|
+
} catch (thrown) {
|
|
25
|
+
if (thrown instanceof Error) {
|
|
26
|
+
console.error(`💥 Failed:`, thrown.message)
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
try {
|
|
31
|
+
process.stdout.write(`🚀 Creating user ${env.POSTGRES_USER}... `)
|
|
32
|
+
await sql.unsafe(
|
|
33
|
+
`CREATE USER ${env.POSTGRES_USER} WITH PASSWORD '${env.POSTGRES_PASSWORD}'`,
|
|
34
|
+
)
|
|
35
|
+
console.log(`Done!`)
|
|
36
|
+
} catch (thrown) {
|
|
37
|
+
if (thrown instanceof Error) {
|
|
38
|
+
console.error(`💥 Failed:`, thrown.message)
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
try {
|
|
43
|
+
process.stdout.write(
|
|
44
|
+
`🚀 Granting privileges to ${env.POSTGRES_USER} on ${env.POSTGRES_DATABASE}... `,
|
|
45
|
+
)
|
|
46
|
+
await sql`GRANT ALL PRIVILEGES ON DATABASE ${sql(env.POSTGRES_DATABASE)} TO ${sql(
|
|
47
|
+
env.POSTGRES_USER,
|
|
48
|
+
)}`
|
|
49
|
+
console.log(`Done!`)
|
|
50
|
+
} catch (thrown) {
|
|
51
|
+
if (thrown instanceof Error) {
|
|
52
|
+
console.error(`💥 Failed:`, thrown.message)
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
await sql.end()
|
|
57
|
+
console.log(`🚀 Database connection closed`)
|