Skip to content

Commit 1f573e0

Browse files
Add interactive prompt for site deploy
1 parent 8240d5d commit 1f573e0

File tree

2 files changed

+26
-13
lines changed

2 files changed

+26
-13
lines changed

bin/index.js

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import { startShell } from '../src/commands/shell.js';
77
import { PROJECT_NAME, getLatestVersion } from '../src/commons.js';
88
import { createApp } from '../src/commands/apps.js';
99
import { deploy } from '../src/commands/deploy.js';
10+
import inquirer from 'inquirer';
1011

1112
async function main() {
1213
const version = await getLatestVersion(PROJECT_NAME);
@@ -70,9 +71,32 @@ async function main() {
7071
site
7172
.command('deploy')
7273
.description('Deploy a local web project to Puter')
73-
.argument('<local_dir>', 'Local directory path')
74-
.argument('[<subdomain>]', 'Deployment subdomain (<subdomain>.puter.site)')
74+
.argument('[local_dir]', 'Local directory path')
75+
.argument('[subdomain]', 'Deployment subdomain (<subdomain>.puter.site)')
7576
.action(async (local_dir, subdomain) => {
77+
if (!local_dir) {
78+
const answer = await inquirer.prompt([
79+
{
80+
type: 'input',
81+
name: 'local_dir',
82+
message: 'Local directory path:',
83+
default: '.'
84+
}
85+
]);
86+
local_dir = answer.local_dir;
87+
}
88+
89+
if (!subdomain) {
90+
const answer = await inquirer.prompt([
91+
{
92+
type: 'input',
93+
name: 'subdomain',
94+
message: 'Deployment subdomain (leave empty for random):',
95+
}
96+
]);
97+
subdomain = answer.subdomain;
98+
}
99+
76100
await startShell(`site:deploy ${local_dir}${subdomain ? ` --subdomain=${subdomain}`: ''}`)
77101
process.exit(0);
78102
});

dist/index.html

Lines changed: 0 additions & 11 deletions
This file was deleted.

0 commit comments

Comments
 (0)