pogl-cli 0.1.0 → 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/README.md +15 -7
- package/package.json +1 -5
- package/src/cli.mjs +11 -4
package/README.md
CHANGED
|
@@ -1,12 +1,20 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Pogl
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Deploy web games to [Pogl](https://play.pogl.com).
|
|
4
4
|
|
|
5
5
|
```bash
|
|
6
|
-
npx pogl login
|
|
7
|
-
npx pogl deploy
|
|
6
|
+
npx pogl-cli login # link your account (opens the browser)
|
|
7
|
+
npx pogl-cli deploy # deploy the current directory
|
|
8
|
+
npx pogl-cli logout # unlink
|
|
8
9
|
```
|
|
9
10
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
11
|
+
`deploy` runs from your game folder (where `index.html` lives). The first
|
|
12
|
+
deploy creates the game (or links an existing one); every deploy after that
|
|
13
|
+
ships a new version instantly.
|
|
14
|
+
|
|
15
|
+
Install globally to use the short command:
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
npm i -g pogl-cli
|
|
19
|
+
pogl deploy
|
|
20
|
+
```
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pogl-cli",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.2",
|
|
4
4
|
"description": "Pogl CLI — deploy your web game like Vercel (npx pogl-cli login / deploy)",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -13,10 +13,6 @@
|
|
|
13
13
|
"engines": {
|
|
14
14
|
"node": ">=18"
|
|
15
15
|
},
|
|
16
|
-
"repository": {
|
|
17
|
-
"type": "git",
|
|
18
|
-
"url": "git+https://github.com/poglcom/pogl.git"
|
|
19
|
-
},
|
|
20
16
|
"homepage": "https://play.pogl.com",
|
|
21
17
|
"license": "UNLICENSED",
|
|
22
18
|
"publishConfig": {
|
package/src/cli.mjs
CHANGED
|
@@ -17,7 +17,7 @@ import { execFileSync, execFile } from 'node:child_process'
|
|
|
17
17
|
import { createServer } from 'node:http'
|
|
18
18
|
import { existsSync, mkdirSync, readFileSync, rmSync, writeFileSync } from 'node:fs'
|
|
19
19
|
import { homedir, tmpdir } from 'node:os'
|
|
20
|
-
import { join } from 'node:path'
|
|
20
|
+
import { basename, join } from 'node:path'
|
|
21
21
|
import { createInterface } from 'node:readline'
|
|
22
22
|
|
|
23
23
|
const SITE = process.env.POGL_SITE ?? 'https://play.pogl.com'
|
|
@@ -115,11 +115,13 @@ const deploy = async () => {
|
|
|
115
115
|
form.set('file', new Blob([readFileSync(zip)], { type: 'application/zip' }), 'game.zip')
|
|
116
116
|
if (link?.gameId) {
|
|
117
117
|
console.log(`재배포 → ${link.gameId}`)
|
|
118
|
-
await post(`/api/
|
|
119
|
-
console.log(`완료 — ${SITE}/
|
|
118
|
+
await post(`/api/experiences/${link.gameId}/deploy`, form)
|
|
119
|
+
console.log(`완료 — ${SITE}/experiences/${link.gameId}`)
|
|
120
120
|
} else {
|
|
121
121
|
console.log('첫 배포 — AI 검토·개조 판을 만듭니다')
|
|
122
|
-
|
|
122
|
+
// 제목은 폴더 이름 — zip 파일명(game.zip)이 제목이 되면 전부 "game"이다 (2026-09-02 실측).
|
|
123
|
+
form.set('title', basename(process.cwd()))
|
|
124
|
+
const { gameId } = await post('/api/experiences/upload', form)
|
|
123
125
|
writeFileSync(LINK_FILE, JSON.stringify({ gameId }, null, 2))
|
|
124
126
|
console.log(`접수됨 — 검토가 끝나면 승인하세요: ${SITE}/studio?game=${gameId}`)
|
|
125
127
|
}
|
|
@@ -131,6 +133,11 @@ const deploy = async () => {
|
|
|
131
133
|
const [, , cmd] = process.argv
|
|
132
134
|
if (cmd === 'login') await login()
|
|
133
135
|
else if (cmd === 'logout') {
|
|
136
|
+
// 서버의 토큰도 지운다 — 파일만 지우면 토큰은 살아 있다. 실패해도 파일은 지운다.
|
|
137
|
+
const saved = existsSync(TOKEN_FILE) ? readFileSync(TOKEN_FILE, 'utf8').trim() : ''
|
|
138
|
+
if (saved !== '') {
|
|
139
|
+
await fetch(`${SITE}/api/cli/token`, { method: 'DELETE', headers: { Authorization: `Bearer ${saved}` } }).catch(() => {})
|
|
140
|
+
}
|
|
134
141
|
rmSync(TOKEN_FILE, { force: true })
|
|
135
142
|
console.log('연동 해제됨')
|
|
136
143
|
} else if (cmd === 'deploy') await deploy()
|