@devalade/shipnode 2.0.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/dist/cli/commands/backup.d.ts +14 -0
- package/dist/cli/commands/backup.d.ts.map +1 -0
- package/dist/cli/commands/backup.js +144 -0
- package/dist/cli/commands/backup.js.map +1 -0
- package/dist/cli/commands/ci.d.ts +5 -0
- package/dist/cli/commands/ci.d.ts.map +1 -0
- package/dist/cli/commands/ci.js +222 -0
- package/dist/cli/commands/ci.js.map +1 -0
- package/dist/cli/commands/cloudflare.d.ts +10 -0
- package/dist/cli/commands/cloudflare.d.ts.map +1 -0
- package/dist/cli/commands/cloudflare.js +166 -0
- package/dist/cli/commands/cloudflare.js.map +1 -0
- package/dist/cli/commands/config.d.ts +10 -0
- package/dist/cli/commands/config.d.ts.map +1 -0
- package/dist/cli/commands/config.js +99 -0
- package/dist/cli/commands/config.js.map +1 -0
- package/dist/cli/commands/deploy.d.ts +6 -0
- package/dist/cli/commands/deploy.d.ts.map +1 -0
- package/dist/cli/commands/deploy.js +95 -0
- package/dist/cli/commands/deploy.js.map +1 -0
- package/dist/cli/commands/doctor.d.ts +5 -0
- package/dist/cli/commands/doctor.d.ts.map +1 -0
- package/dist/cli/commands/doctor.js +86 -0
- package/dist/cli/commands/doctor.js.map +1 -0
- package/dist/cli/commands/eject.d.ts +2 -0
- package/dist/cli/commands/eject.d.ts.map +1 -0
- package/dist/cli/commands/eject.js +74 -0
- package/dist/cli/commands/eject.js.map +1 -0
- package/dist/cli/commands/env.d.ts +4 -0
- package/dist/cli/commands/env.d.ts.map +1 -0
- package/dist/cli/commands/env.js +50 -0
- package/dist/cli/commands/env.js.map +1 -0
- package/dist/cli/commands/harden.d.ts +4 -0
- package/dist/cli/commands/harden.d.ts.map +1 -0
- package/dist/cli/commands/harden.js +110 -0
- package/dist/cli/commands/harden.js.map +1 -0
- package/dist/cli/commands/help.d.ts +2 -0
- package/dist/cli/commands/help.d.ts.map +1 -0
- package/dist/cli/commands/help.js +99 -0
- package/dist/cli/commands/help.js.map +1 -0
- package/dist/cli/commands/init.d.ts +5 -0
- package/dist/cli/commands/init.d.ts.map +1 -0
- package/dist/cli/commands/init.js +246 -0
- package/dist/cli/commands/init.js.map +1 -0
- package/dist/cli/commands/logs.d.ts +5 -0
- package/dist/cli/commands/logs.d.ts.map +1 -0
- package/dist/cli/commands/logs.js +17 -0
- package/dist/cli/commands/logs.js.map +1 -0
- package/dist/cli/commands/metrics.d.ts +4 -0
- package/dist/cli/commands/metrics.d.ts.map +1 -0
- package/dist/cli/commands/metrics.js +21 -0
- package/dist/cli/commands/metrics.js.map +1 -0
- package/dist/cli/commands/migrate.d.ts +4 -0
- package/dist/cli/commands/migrate.d.ts.map +1 -0
- package/dist/cli/commands/migrate.js +71 -0
- package/dist/cli/commands/migrate.js.map +1 -0
- package/dist/cli/commands/restart.d.ts +4 -0
- package/dist/cli/commands/restart.d.ts.map +1 -0
- package/dist/cli/commands/restart.js +14 -0
- package/dist/cli/commands/restart.js.map +1 -0
- package/dist/cli/commands/rollback.d.ts +5 -0
- package/dist/cli/commands/rollback.d.ts.map +1 -0
- package/dist/cli/commands/rollback.js +49 -0
- package/dist/cli/commands/rollback.js.map +1 -0
- package/dist/cli/commands/run.d.ts +5 -0
- package/dist/cli/commands/run.d.ts.map +1 -0
- package/dist/cli/commands/run.js +69 -0
- package/dist/cli/commands/run.js.map +1 -0
- package/dist/cli/commands/setup.d.ts +4 -0
- package/dist/cli/commands/setup.d.ts.map +1 -0
- package/dist/cli/commands/setup.js +46 -0
- package/dist/cli/commands/setup.js.map +1 -0
- package/dist/cli/commands/status.d.ts +4 -0
- package/dist/cli/commands/status.d.ts.map +1 -0
- package/dist/cli/commands/status.js +49 -0
- package/dist/cli/commands/status.js.map +1 -0
- package/dist/cli/commands/stop.d.ts +4 -0
- package/dist/cli/commands/stop.d.ts.map +1 -0
- package/dist/cli/commands/stop.js +14 -0
- package/dist/cli/commands/stop.js.map +1 -0
- package/dist/cli/commands/unlock.d.ts +4 -0
- package/dist/cli/commands/unlock.d.ts.map +1 -0
- package/dist/cli/commands/unlock.js +27 -0
- package/dist/cli/commands/unlock.js.map +1 -0
- package/dist/cli/commands/upgrade.d.ts +2 -0
- package/dist/cli/commands/upgrade.d.ts.map +1 -0
- package/dist/cli/commands/upgrade.js +63 -0
- package/dist/cli/commands/upgrade.js.map +1 -0
- package/dist/cli/commands/user.d.ts +17 -0
- package/dist/cli/commands/user.d.ts.map +1 -0
- package/dist/cli/commands/user.js +98 -0
- package/dist/cli/commands/user.js.map +1 -0
- package/dist/cli/index.d.ts +3 -0
- package/dist/cli/index.d.ts.map +1 -0
- package/dist/cli/index.js +218 -0
- package/dist/cli/index.js.map +1 -0
- package/dist/cli/prompt.d.ts +2 -0
- package/dist/cli/prompt.d.ts.map +1 -0
- package/dist/cli/prompt.js +11 -0
- package/dist/cli/prompt.js.map +1 -0
- package/dist/cli/runner.d.ts +34 -0
- package/dist/cli/runner.d.ts.map +1 -0
- package/dist/cli/runner.js +44 -0
- package/dist/cli/runner.js.map +1 -0
- package/dist/cli/ui.d.ts +9 -0
- package/dist/cli/ui.d.ts.map +1 -0
- package/dist/cli/ui.js +26 -0
- package/dist/cli/ui.js.map +1 -0
- package/dist/config/assembly.d.ts +14 -0
- package/dist/config/assembly.d.ts.map +1 -0
- package/dist/config/assembly.js +62 -0
- package/dist/config/assembly.js.map +1 -0
- package/dist/config/builder.d.ts +33 -0
- package/dist/config/builder.d.ts.map +1 -0
- package/dist/config/builder.js +119 -0
- package/dist/config/builder.js.map +1 -0
- package/dist/config/loader.d.ts +3 -0
- package/dist/config/loader.d.ts.map +1 -0
- package/dist/config/loader.js +20 -0
- package/dist/config/loader.js.map +1 -0
- package/dist/config/schema.d.ts +416 -0
- package/dist/config/schema.d.ts.map +1 -0
- package/dist/config/schema.js +75 -0
- package/dist/config/schema.js.map +1 -0
- package/dist/domain/deploy/backend-strategy.d.ts +15 -0
- package/dist/domain/deploy/backend-strategy.d.ts.map +1 -0
- package/dist/domain/deploy/backend-strategy.js +110 -0
- package/dist/domain/deploy/backend-strategy.js.map +1 -0
- package/dist/domain/deploy/frontend-strategy.d.ts +13 -0
- package/dist/domain/deploy/frontend-strategy.d.ts.map +1 -0
- package/dist/domain/deploy/frontend-strategy.js +64 -0
- package/dist/domain/deploy/frontend-strategy.js.map +1 -0
- package/dist/domain/deploy/orchestrator.d.ts +34 -0
- package/dist/domain/deploy/orchestrator.d.ts.map +1 -0
- package/dist/domain/deploy/orchestrator.js +149 -0
- package/dist/domain/deploy/orchestrator.js.map +1 -0
- package/dist/domain/deploy/strategy.d.ts +44 -0
- package/dist/domain/deploy/strategy.d.ts.map +1 -0
- package/dist/domain/deploy/strategy.js +2 -0
- package/dist/domain/deploy/strategy.js.map +1 -0
- package/dist/domain/framework/detector.d.ts +7 -0
- package/dist/domain/framework/detector.d.ts.map +1 -0
- package/dist/domain/framework/detector.js +109 -0
- package/dist/domain/framework/detector.js.map +1 -0
- package/dist/domain/release/manager.d.ts +22 -0
- package/dist/domain/release/manager.d.ts.map +1 -0
- package/dist/domain/release/manager.js +100 -0
- package/dist/domain/release/manager.js.map +1 -0
- package/dist/domain/remote/executor.d.ts +16 -0
- package/dist/domain/remote/executor.d.ts.map +1 -0
- package/dist/domain/remote/executor.js +2 -0
- package/dist/domain/remote/executor.js.map +1 -0
- package/dist/domain/validation/ip.d.ts +5 -0
- package/dist/domain/validation/ip.d.ts.map +1 -0
- package/dist/domain/validation/ip.js +38 -0
- package/dist/domain/validation/ip.js.map +1 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +4 -0
- package/dist/index.js.map +1 -0
- package/dist/infrastructure/ssh/connection.d.ts +19 -0
- package/dist/infrastructure/ssh/connection.d.ts.map +1 -0
- package/dist/infrastructure/ssh/connection.js +89 -0
- package/dist/infrastructure/ssh/connection.js.map +1 -0
- package/dist/services/caddy.service.d.ts +12 -0
- package/dist/services/caddy.service.d.ts.map +1 -0
- package/dist/services/caddy.service.js +56 -0
- package/dist/services/caddy.service.js.map +1 -0
- package/dist/services/deploy.service.d.ts +19 -0
- package/dist/services/deploy.service.d.ts.map +1 -0
- package/dist/services/deploy.service.js +53 -0
- package/dist/services/deploy.service.js.map +1 -0
- package/dist/services/health.service.d.ts +13 -0
- package/dist/services/health.service.d.ts.map +1 -0
- package/dist/services/health.service.js +38 -0
- package/dist/services/health.service.js.map +1 -0
- package/dist/shared/constants.d.ts +127 -0
- package/dist/shared/constants.d.ts.map +1 -0
- package/dist/shared/constants.js +85 -0
- package/dist/shared/constants.js.map +1 -0
- package/dist/shared/errors.d.ts +27 -0
- package/dist/shared/errors.d.ts.map +1 -0
- package/dist/shared/errors.js +53 -0
- package/dist/shared/errors.js.map +1 -0
- package/dist/shared/types.d.ts +116 -0
- package/dist/shared/types.d.ts.map +1 -0
- package/dist/shared/types.js +2 -0
- package/dist/shared/types.js.map +1 -0
- package/package.json +53 -0
|
@@ -0,0 +1,218 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { Command } from 'commander';
|
|
3
|
+
import { cmdInit } from './commands/init.js';
|
|
4
|
+
import { cmdDeploy } from './commands/deploy.js';
|
|
5
|
+
import { cmdSetup } from './commands/setup.js';
|
|
6
|
+
import { cmdDoctor } from './commands/doctor.js';
|
|
7
|
+
import { cmdStatus } from './commands/status.js';
|
|
8
|
+
import { cmdRollback } from './commands/rollback.js';
|
|
9
|
+
import { cmdEnv } from './commands/env.js';
|
|
10
|
+
import { cmdUnlock } from './commands/unlock.js';
|
|
11
|
+
import { cmdRun } from './commands/run.js';
|
|
12
|
+
import { cmdHarden } from './commands/harden.js';
|
|
13
|
+
import { cmdMigrate } from './commands/migrate.js';
|
|
14
|
+
import { cmdCiGithub, cmdCiEnvSync } from './commands/ci.js';
|
|
15
|
+
import { cmdConfigShow, cmdConfigValidate, cmdConfigPath } from './commands/config.js';
|
|
16
|
+
import { cmdLogs } from './commands/logs.js';
|
|
17
|
+
import { cmdRestart } from './commands/restart.js';
|
|
18
|
+
import { cmdStop } from './commands/stop.js';
|
|
19
|
+
import { cmdMetrics } from './commands/metrics.js';
|
|
20
|
+
import { cmdEject } from './commands/eject.js';
|
|
21
|
+
import { cmdHelp } from './commands/help.js';
|
|
22
|
+
import { cmdUserSync, cmdUserList, cmdUserRemove } from './commands/user.js';
|
|
23
|
+
import { cmdUpgrade } from './commands/upgrade.js';
|
|
24
|
+
import { cmdBackupSetup, cmdBackupRun, cmdBackupStatus, cmdBackupList } from './commands/backup.js';
|
|
25
|
+
import { cmdCloudflareInit, cmdCloudflareAudit, cmdCloudflareStatus } from './commands/cloudflare.js';
|
|
26
|
+
const program = new Command();
|
|
27
|
+
program
|
|
28
|
+
.name('shipnode')
|
|
29
|
+
.description('Deploy Node.js apps to a single VPS')
|
|
30
|
+
.version('2.0.0');
|
|
31
|
+
// ── Core ──────────────────────────────────────────────────────────
|
|
32
|
+
program
|
|
33
|
+
.command('init')
|
|
34
|
+
.description('Initialize a new shipnode.config.ts')
|
|
35
|
+
.option('--non-interactive', 'Generate config without prompts')
|
|
36
|
+
.option('--print', 'Print config to stdout without writing file')
|
|
37
|
+
.action((opts) => cmdInit(process.cwd(), opts));
|
|
38
|
+
program
|
|
39
|
+
.command('setup')
|
|
40
|
+
.description('Setup a new server with required dependencies')
|
|
41
|
+
.option('--config <path>', 'Use a specific config file')
|
|
42
|
+
.action((opts) => cmdSetup(process.cwd(), opts));
|
|
43
|
+
program
|
|
44
|
+
.command('deploy')
|
|
45
|
+
.description('Deploy your application')
|
|
46
|
+
.option('--dry-run', 'Show what would be deployed without making changes')
|
|
47
|
+
.option('--skip-build', 'Skip the build step')
|
|
48
|
+
.option('--config <path>', 'Use a specific config file')
|
|
49
|
+
.action((opts) => cmdDeploy(process.cwd(), opts));
|
|
50
|
+
program
|
|
51
|
+
.command('doctor')
|
|
52
|
+
.description('Check local and remote configuration')
|
|
53
|
+
.option('--security', 'Run security audit instead of standard checks')
|
|
54
|
+
.option('--config <path>', 'Use a specific config file')
|
|
55
|
+
.action((opts) => cmdDoctor(process.cwd(), opts));
|
|
56
|
+
program
|
|
57
|
+
.command('status')
|
|
58
|
+
.description('Check application status')
|
|
59
|
+
.option('--config <path>', 'Use a specific config file')
|
|
60
|
+
.action((opts) => cmdStatus(process.cwd(), opts));
|
|
61
|
+
// ── Release management ────────────────────────────────────────────
|
|
62
|
+
program
|
|
63
|
+
.command('rollback')
|
|
64
|
+
.description('Roll back to a previous release')
|
|
65
|
+
.option('--steps <n>', 'Number of releases to go back', '1')
|
|
66
|
+
.option('--config <path>', 'Use a specific config file')
|
|
67
|
+
.action((opts) => cmdRollback(process.cwd(), { steps: parseInt(opts.steps, 10), config: opts.config }));
|
|
68
|
+
program
|
|
69
|
+
.command('migrate')
|
|
70
|
+
.description('Migrate existing deploy to zero-downtime release structure')
|
|
71
|
+
.option('--config <path>', 'Use a specific config file')
|
|
72
|
+
.action((opts) => cmdMigrate(process.cwd(), opts));
|
|
73
|
+
// ── Environment ───────────────────────────────────────────────────
|
|
74
|
+
program
|
|
75
|
+
.command('env')
|
|
76
|
+
.description('Upload local .env file to the server')
|
|
77
|
+
.option('--config <path>', 'Use a specific config file')
|
|
78
|
+
.action((opts) => cmdEnv(process.cwd(), opts));
|
|
79
|
+
program
|
|
80
|
+
.command('run [cmd...]')
|
|
81
|
+
.description('Run a one-off command on the production server')
|
|
82
|
+
.option('--tty', 'Force interactive TTY mode')
|
|
83
|
+
.option('--config <path>', 'Use a specific config file')
|
|
84
|
+
.action((cmdArgs, opts) => cmdRun(process.cwd(), opts, cmdArgs));
|
|
85
|
+
// ── Process management ────────────────────────────────────────────
|
|
86
|
+
program
|
|
87
|
+
.command('logs')
|
|
88
|
+
.description('Show application logs')
|
|
89
|
+
.option('--lines <n>', 'Number of log lines to show', '100')
|
|
90
|
+
.option('--config <path>', 'Use a specific config file')
|
|
91
|
+
.action((opts) => cmdLogs(process.cwd(), { lines: parseInt(opts.lines, 10), config: opts.config }));
|
|
92
|
+
program
|
|
93
|
+
.command('restart')
|
|
94
|
+
.description('Restart the application')
|
|
95
|
+
.option('--config <path>', 'Use a specific config file')
|
|
96
|
+
.action((opts) => cmdRestart(process.cwd(), opts));
|
|
97
|
+
program
|
|
98
|
+
.command('stop')
|
|
99
|
+
.description('Stop the application')
|
|
100
|
+
.option('--config <path>', 'Use a specific config file')
|
|
101
|
+
.action((opts) => cmdStop(process.cwd(), opts));
|
|
102
|
+
program
|
|
103
|
+
.command('metrics')
|
|
104
|
+
.description('Open PM2 monitoring dashboard')
|
|
105
|
+
.option('--config <path>', 'Use a specific config file')
|
|
106
|
+
.action((opts) => cmdMetrics(process.cwd(), opts));
|
|
107
|
+
// ── Security & maintenance ────────────────────────────────────────
|
|
108
|
+
program
|
|
109
|
+
.command('harden')
|
|
110
|
+
.description('Apply server security hardening (SSH, firewall, fail2ban)')
|
|
111
|
+
.option('--config <path>', 'Use a specific config file')
|
|
112
|
+
.action((opts) => cmdHarden(process.cwd(), opts));
|
|
113
|
+
program
|
|
114
|
+
.command('unlock')
|
|
115
|
+
.description('Clear a stuck deployment lock')
|
|
116
|
+
.option('--config <path>', 'Use a specific config file')
|
|
117
|
+
.action((opts) => cmdUnlock(process.cwd(), opts));
|
|
118
|
+
// ── CI/CD ─────────────────────────────────────────────────────────
|
|
119
|
+
const ci = program.command('ci').description('CI/CD integration');
|
|
120
|
+
ci.command('github')
|
|
121
|
+
.description('Generate GitHub Actions deploy workflow')
|
|
122
|
+
.action(() => cmdCiGithub(process.cwd()));
|
|
123
|
+
ci.command('env-sync')
|
|
124
|
+
.description('Sync .env and config to GitHub repository secrets')
|
|
125
|
+
.option('--all', 'Sync all .env variables without confirmation')
|
|
126
|
+
.action((opts) => cmdCiEnvSync(process.cwd(), opts));
|
|
127
|
+
// ── Config ────────────────────────────────────────────────────────
|
|
128
|
+
const config = program.command('config').description('Manage configuration');
|
|
129
|
+
config.command('show')
|
|
130
|
+
.description('Show resolved configuration')
|
|
131
|
+
.option('--config <path>', 'Use a specific config file')
|
|
132
|
+
.action((opts) => cmdConfigShow(process.cwd(), opts));
|
|
133
|
+
config.command('validate')
|
|
134
|
+
.description('Validate configuration file')
|
|
135
|
+
.option('--config <path>', 'Use a specific config file')
|
|
136
|
+
.action((opts) => cmdConfigValidate(process.cwd(), opts));
|
|
137
|
+
config.command('path')
|
|
138
|
+
.description('Print path to config file')
|
|
139
|
+
.option('--config <path>', 'Use a specific config file')
|
|
140
|
+
.action((opts) => cmdConfigPath(process.cwd(), opts));
|
|
141
|
+
// ── Users ─────────────────────────────────────────────────────────
|
|
142
|
+
const user = program.command('user').description('Manage server users');
|
|
143
|
+
user.command('sync')
|
|
144
|
+
.description('Sync users from .shipnode/users.yml to server')
|
|
145
|
+
.option('--config <path>', 'Use a specific config file')
|
|
146
|
+
.action((opts) => cmdUserSync(process.cwd(), opts));
|
|
147
|
+
user.command('list')
|
|
148
|
+
.description('List non-system users on server')
|
|
149
|
+
.option('--config <path>', 'Use a specific config file')
|
|
150
|
+
.action((opts) => cmdUserList(process.cwd(), opts));
|
|
151
|
+
user.command('remove <username>')
|
|
152
|
+
.description('Remove a user from the server')
|
|
153
|
+
.option('--config <path>', 'Use a specific config file')
|
|
154
|
+
.action((username, opts) => cmdUserRemove(process.cwd(), username, opts));
|
|
155
|
+
// ── Backup ────────────────────────────────────────────────────────
|
|
156
|
+
const backup = program.command('backup').description('Database & file backups to S3');
|
|
157
|
+
backup.command('setup')
|
|
158
|
+
.description('Install backup script and systemd timer on server')
|
|
159
|
+
.option('--config <path>', 'Use a specific config file')
|
|
160
|
+
.action((opts) => cmdBackupSetup(process.cwd(), opts));
|
|
161
|
+
backup.command('run')
|
|
162
|
+
.description('Run a backup immediately')
|
|
163
|
+
.option('--config <path>', 'Use a specific config file')
|
|
164
|
+
.action((opts) => cmdBackupRun(process.cwd(), opts));
|
|
165
|
+
backup.command('status')
|
|
166
|
+
.description('Show backup timer and last run status')
|
|
167
|
+
.option('--config <path>', 'Use a specific config file')
|
|
168
|
+
.action((opts) => cmdBackupStatus(process.cwd(), opts));
|
|
169
|
+
backup.command('list')
|
|
170
|
+
.description('List recent backups in S3')
|
|
171
|
+
.option('--config <path>', 'Use a specific config file')
|
|
172
|
+
.action((opts) => cmdBackupList(process.cwd(), opts));
|
|
173
|
+
// ── Cloudflare ────────────────────────────────────────────────────
|
|
174
|
+
const cloudflare = program.command('cloudflare').description('Cloudflare Tunnel integration');
|
|
175
|
+
cloudflare.command('init')
|
|
176
|
+
.description('Install cloudflared and configure tunnel/DNS/Access')
|
|
177
|
+
.option('--config <path>', 'Use a specific config file')
|
|
178
|
+
.action((opts) => cmdCloudflareInit(process.cwd(), opts));
|
|
179
|
+
cloudflare.command('audit')
|
|
180
|
+
.description('Verify Cloudflare DNS and tunnel configuration')
|
|
181
|
+
.option('--config <path>', 'Use a specific config file')
|
|
182
|
+
.action((opts) => cmdCloudflareAudit(process.cwd(), opts));
|
|
183
|
+
cloudflare.command('status')
|
|
184
|
+
.description('Show cloudflared service and tunnel status')
|
|
185
|
+
.option('--config <path>', 'Use a specific config file')
|
|
186
|
+
.action((opts) => cmdCloudflareStatus(process.cwd(), opts));
|
|
187
|
+
// ── Self-update ───────────────────────────────────────────────────
|
|
188
|
+
program
|
|
189
|
+
.command('upgrade')
|
|
190
|
+
.description('Upgrade shipnode to the latest version')
|
|
191
|
+
.action(() => cmdUpgrade());
|
|
192
|
+
// ── Customization ─────────────────────────────────────────────────
|
|
193
|
+
program
|
|
194
|
+
.command('eject [target]')
|
|
195
|
+
.description('Eject PM2/Caddy templates for customization (pm2, caddy, all)')
|
|
196
|
+
.action((target = 'all') => {
|
|
197
|
+
const valid = ['pm2', 'caddy', 'all'];
|
|
198
|
+
if (!valid.includes(target)) {
|
|
199
|
+
console.error(`Unknown eject target: ${target}. Use: pm2, caddy, all`);
|
|
200
|
+
process.exit(1);
|
|
201
|
+
}
|
|
202
|
+
return cmdEject(process.cwd(), target);
|
|
203
|
+
});
|
|
204
|
+
// ── Help ──────────────────────────────────────────────────────────
|
|
205
|
+
program
|
|
206
|
+
.command('help')
|
|
207
|
+
.description('Show help')
|
|
208
|
+
.action(() => cmdHelp());
|
|
209
|
+
program.on('command:*', () => {
|
|
210
|
+
console.error(`Unknown command. Run 'shipnode help' for usage.`);
|
|
211
|
+
process.exit(1);
|
|
212
|
+
});
|
|
213
|
+
if (process.argv.length <= 2) {
|
|
214
|
+
cmdHelp();
|
|
215
|
+
process.exit(0);
|
|
216
|
+
}
|
|
217
|
+
program.parse();
|
|
218
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/cli/index.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAC7C,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AACjD,OAAO,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAC/C,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AACjD,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AACjD,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AACrD,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAC3C,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AACjD,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAC3C,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AACjD,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AACnD,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAC7D,OAAO,EAAE,aAAa,EAAE,iBAAiB,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACvF,OAAO,EAAE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AAE3B,OAAO,CAAC,EAAE,CAAC,WAAW,EAAE,GAAG,EAAE;IAC3B,OAAO,CAAC,KAAK,CAAC,iDAAiD,CAAC,CAAC;IACjE,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC,CAAC,CAAC;AAEH,IAAI,OAAO,CAAC,IAAI,CAAC,MAAM,IAAI,CAAC,EAAE,CAAC;IAC7B,OAAO,EAAE,CAAC;IACV,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC;AAED,OAAO,CAAC,KAAK,EAAE,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"prompt.d.ts","sourceRoot":"","sources":["../../src/cli/prompt.ts"],"names":[],"mappings":"AAEA,wBAAgB,OAAO,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAQ1D"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { createInterface } from 'readline';
|
|
2
|
+
export function confirm(question) {
|
|
3
|
+
const rl = createInterface({ input: process.stdin, output: process.stdout });
|
|
4
|
+
return new Promise((resolve) => {
|
|
5
|
+
rl.question(`${question} (y/N) `, (answer) => {
|
|
6
|
+
rl.close();
|
|
7
|
+
resolve(answer.trim().toLowerCase() === 'y');
|
|
8
|
+
});
|
|
9
|
+
});
|
|
10
|
+
}
|
|
11
|
+
//# sourceMappingURL=prompt.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"prompt.js","sourceRoot":"","sources":["../../src/cli/prompt.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAE3C,MAAM,UAAU,OAAO,CAAC,QAAgB;IACtC,MAAM,EAAE,GAAG,eAAe,CAAC,EAAE,KAAK,EAAE,OAAO,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,CAAC,MAAM,EAAE,CAAC,CAAC;IAC7E,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE;QAC7B,EAAE,CAAC,QAAQ,CAAC,GAAG,QAAQ,SAAS,EAAE,CAAC,MAAM,EAAE,EAAE;YAC3C,EAAE,CAAC,KAAK,EAAE,CAAC;YACX,OAAO,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC,WAAW,EAAE,KAAK,GAAG,CAAC,CAAC;QAC/C,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import type { ShipnodeConfig } from '../shared/types.js';
|
|
2
|
+
import type { RemoteExecutor } from '../domain/remote/executor.js';
|
|
3
|
+
/**
|
|
4
|
+
* A command that operates against a remote host through an executor.
|
|
5
|
+
*
|
|
6
|
+
* Implementations are pure business logic: they do not manage
|
|
7
|
+
* connection lifecycle or process exit. The runner owns both.
|
|
8
|
+
*/
|
|
9
|
+
export interface RemoteCommand {
|
|
10
|
+
(ctx: {
|
|
11
|
+
config: ShipnodeConfig;
|
|
12
|
+
executor: RemoteExecutor;
|
|
13
|
+
}): Promise<void>;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Run a remote command with full lifecycle management.
|
|
17
|
+
*
|
|
18
|
+
* Loads config, establishes an SSH connection, delegates to the
|
|
19
|
+
* command, and guarantees cleanup. If the command throws, the error
|
|
20
|
+
* is presented and the process exits with code 1.
|
|
21
|
+
*/
|
|
22
|
+
export declare function runRemoteCommand(cwd: string, command: RemoteCommand, options?: {
|
|
23
|
+
configPath?: string;
|
|
24
|
+
}): Promise<void>;
|
|
25
|
+
/**
|
|
26
|
+
* Run a local command that does not need a remote connection.
|
|
27
|
+
*
|
|
28
|
+
* Loads config and delegates to the command. Handles errors
|
|
29
|
+
* and process exit consistently with remote commands.
|
|
30
|
+
*/
|
|
31
|
+
export declare function runLocalCommand(cwd: string, command: (config: ShipnodeConfig) => Promise<void>, options?: {
|
|
32
|
+
configPath?: string;
|
|
33
|
+
}): Promise<void>;
|
|
34
|
+
//# sourceMappingURL=runner.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"runner.d.ts","sourceRoot":"","sources":["../../src/cli/runner.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAEzD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAInE;;;;;GAKG;AACH,MAAM,WAAW,aAAa;IAC5B,CAAC,GAAG,EAAE;QAAE,MAAM,EAAE,cAAc,CAAC;QAAC,QAAQ,EAAE,cAAc,CAAA;KAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CAC5E;AAED;;;;;;GAMG;AACH,wBAAsB,gBAAgB,CACpC,GAAG,EAAE,MAAM,EACX,OAAO,EAAE,aAAa,EACtB,OAAO,GAAE;IAAE,UAAU,CAAC,EAAE,MAAM,CAAA;CAAO,GACpC,OAAO,CAAC,IAAI,CAAC,CAcf;AAED;;;;;GAKG;AACH,wBAAsB,eAAe,CACnC,GAAG,EAAE,MAAM,EACX,OAAO,EAAE,CAAC,MAAM,EAAE,cAAc,KAAK,OAAO,CAAC,IAAI,CAAC,EAClD,OAAO,GAAE;IAAE,UAAU,CAAC,EAAE,MAAM,CAAA;CAAO,GACpC,OAAO,CAAC,IAAI,CAAC,CAUf"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { SshConnection } from '../infrastructure/ssh/connection.js';
|
|
2
|
+
import { loadConfig } from '../config/loader.js';
|
|
3
|
+
import { ui } from './ui.js';
|
|
4
|
+
/**
|
|
5
|
+
* Run a remote command with full lifecycle management.
|
|
6
|
+
*
|
|
7
|
+
* Loads config, establishes an SSH connection, delegates to the
|
|
8
|
+
* command, and guarantees cleanup. If the command throws, the error
|
|
9
|
+
* is presented and the process exits with code 1.
|
|
10
|
+
*/
|
|
11
|
+
export async function runRemoteCommand(cwd, command, options = {}) {
|
|
12
|
+
const config = await loadConfig(cwd, options.configPath);
|
|
13
|
+
const ssh = new SshConnection();
|
|
14
|
+
try {
|
|
15
|
+
await ssh.connect(config.ssh);
|
|
16
|
+
await command({ config, executor: ssh });
|
|
17
|
+
}
|
|
18
|
+
catch (error) {
|
|
19
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
20
|
+
ui.error(message);
|
|
21
|
+
process.exit(1);
|
|
22
|
+
}
|
|
23
|
+
finally {
|
|
24
|
+
ssh.disconnect();
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Run a local command that does not need a remote connection.
|
|
29
|
+
*
|
|
30
|
+
* Loads config and delegates to the command. Handles errors
|
|
31
|
+
* and process exit consistently with remote commands.
|
|
32
|
+
*/
|
|
33
|
+
export async function runLocalCommand(cwd, command, options = {}) {
|
|
34
|
+
const config = await loadConfig(cwd, options.configPath);
|
|
35
|
+
try {
|
|
36
|
+
await command(config);
|
|
37
|
+
}
|
|
38
|
+
catch (error) {
|
|
39
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
40
|
+
ui.error(message);
|
|
41
|
+
process.exit(1);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
//# sourceMappingURL=runner.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"runner.js","sourceRoot":"","sources":["../../src/cli/runner.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,qCAAqC,CAAC;AAEpE,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACjD,OAAO,EAAE,EAAE,EAAE,MAAM,SAAS,CAAC;AAY7B;;;;;;GAMG;AACH,MAAM,CAAC,KAAK,UAAU,gBAAgB,CACpC,GAAW,EACX,OAAsB,EACtB,UAAmC,EAAE;IAErC,MAAM,MAAM,GAAG,MAAM,UAAU,CAAC,GAAG,EAAE,OAAO,CAAC,UAAU,CAAC,CAAC;IACzD,MAAM,GAAG,GAAG,IAAI,aAAa,EAAE,CAAC;IAEhC,IAAI,CAAC;QACH,MAAM,GAAG,CAAC,OAAO,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;QAC9B,MAAM,OAAO,CAAC,EAAE,MAAM,EAAE,QAAQ,EAAE,GAAG,EAAE,CAAC,CAAC;IAC3C,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,MAAM,OAAO,GAAG,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;QACvE,EAAE,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;QAClB,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;YAAS,CAAC;QACT,GAAG,CAAC,UAAU,EAAE,CAAC;IACnB,CAAC;AACH,CAAC;AAED;;;;;GAKG;AACH,MAAM,CAAC,KAAK,UAAU,eAAe,CACnC,GAAW,EACX,OAAkD,EAClD,UAAmC,EAAE;IAErC,MAAM,MAAM,GAAG,MAAM,UAAU,CAAC,GAAG,EAAE,OAAO,CAAC,UAAU,CAAC,CAAC;IAEzD,IAAI,CAAC;QACH,MAAM,OAAO,CAAC,MAAM,CAAC,CAAC;IACxB,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,MAAM,OAAO,GAAG,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;QACvE,EAAE,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;QAClB,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;AACH,CAAC"}
|
package/dist/cli/ui.d.ts
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export declare const ui: {
|
|
2
|
+
info(msg: string): void;
|
|
3
|
+
success(msg: string): void;
|
|
4
|
+
warn(msg: string): void;
|
|
5
|
+
error(msg: string): void;
|
|
6
|
+
heading(msg: string): void;
|
|
7
|
+
section(title: string, items: [string, string][]): void;
|
|
8
|
+
};
|
|
9
|
+
//# sourceMappingURL=ui.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ui.d.ts","sourceRoot":"","sources":["../../src/cli/ui.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,EAAE;cACH,MAAM;iBAGH,MAAM;cAGT,MAAM;eAGL,MAAM;iBAGJ,MAAM;mBAGJ,MAAM,SAAS,CAAC,MAAM,EAAE,MAAM,CAAC,EAAE,GAAG,IAAI;CAOxD,CAAC"}
|
package/dist/cli/ui.js
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import chalk from 'chalk';
|
|
2
|
+
export const ui = {
|
|
3
|
+
info(msg) {
|
|
4
|
+
console.log(`${chalk.blue('→')} ${msg}`);
|
|
5
|
+
},
|
|
6
|
+
success(msg) {
|
|
7
|
+
console.log(`${chalk.green('✓')} ${msg}`);
|
|
8
|
+
},
|
|
9
|
+
warn(msg) {
|
|
10
|
+
console.log(`${chalk.yellow('⚠')} ${msg}`);
|
|
11
|
+
},
|
|
12
|
+
error(msg) {
|
|
13
|
+
console.error(`${chalk.red('Error:')} ${msg}`);
|
|
14
|
+
},
|
|
15
|
+
heading(msg) {
|
|
16
|
+
console.log(`\n${chalk.blue.bold(msg)}\n`);
|
|
17
|
+
},
|
|
18
|
+
section(title, items) {
|
|
19
|
+
console.log(chalk.bold(title));
|
|
20
|
+
for (const [key, value] of items) {
|
|
21
|
+
console.log(` ${chalk.dim(key.padEnd(20))} ${value}`);
|
|
22
|
+
}
|
|
23
|
+
console.log();
|
|
24
|
+
},
|
|
25
|
+
};
|
|
26
|
+
//# sourceMappingURL=ui.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ui.js","sourceRoot":"","sources":["../../src/cli/ui.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,MAAM,CAAC,MAAM,EAAE,G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|
5
|
+
* This is the single place where raw user intent becomes a trusted
|
|
6
|
+
* configuration object. Defaults are applied first, then the schema
|
|
7
|
+
* validates every field.
|
|
8
|
+
*
|
|
9
|
+
* Both the builder and the loader must route through here so that
|
|
10
|
+
* defaults and validation are identical regardless of how the config
|
|
11
|
+
* was produced.
|
|
12
|
+
*/
|
|
13
|
+
export declare function assembleConfig(partial: Partial<ShipnodeConfig>): ShipnodeConfig;
|
|
14
|
+
//# sourceMappingURL=assembly.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"assembly.d.ts","sourceRoot":"","sources":["../../src/config/assembly.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAA+C,MAAM,oBAAoB,CAAC;AA+BtG;;;;;;;;;;GAUG;AACH,wBAAgB,cAAc,CAAC,OAAO,EAAE,OAAO,CAAC,cAAc,CAAC,GAAG,cAAc,CAwB/E"}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { ShipnodeConfigSchema } from './schema.js';
|
|
2
|
+
import { DEFAULTS } from '../shared/constants.js';
|
|
3
|
+
function defaultSshConfig(overrides) {
|
|
4
|
+
return {
|
|
5
|
+
host: '',
|
|
6
|
+
user: '',
|
|
7
|
+
port: DEFAULTS.SSH_PORT,
|
|
8
|
+
...overrides,
|
|
9
|
+
};
|
|
10
|
+
}
|
|
11
|
+
function defaultBackendConfig(overrides) {
|
|
12
|
+
return {
|
|
13
|
+
port: DEFAULTS.BACKEND_PORT,
|
|
14
|
+
...overrides,
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
function defaultHealthCheckConfig(overrides) {
|
|
18
|
+
return {
|
|
19
|
+
enabled: DEFAULTS.HEALTH_CHECK_ENABLED,
|
|
20
|
+
path: DEFAULTS.HEALTH_CHECK_PATH,
|
|
21
|
+
timeout: DEFAULTS.HEALTH_CHECK_TIMEOUT,
|
|
22
|
+
retries: DEFAULTS.HEALTH_CHECK_RETRIES,
|
|
23
|
+
startupDelay: DEFAULTS.HEALTH_CHECK_STARTUP_DELAY,
|
|
24
|
+
...overrides,
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Assemble a partial config into a fully-validated ShipnodeConfig.
|
|
29
|
+
*
|
|
30
|
+
* This is the single place where raw user intent becomes a trusted
|
|
31
|
+
* configuration object. Defaults are applied first, then the schema
|
|
32
|
+
* validates every field.
|
|
33
|
+
*
|
|
34
|
+
* Both the builder and the loader must route through here so that
|
|
35
|
+
* defaults and validation are identical regardless of how the config
|
|
36
|
+
* was produced.
|
|
37
|
+
*/
|
|
38
|
+
export function assembleConfig(partial) {
|
|
39
|
+
const withDefaults = {
|
|
40
|
+
app: partial.app ?? 'backend',
|
|
41
|
+
ssh: partial.ssh ?? defaultSshConfig(),
|
|
42
|
+
remotePath: partial.remotePath ?? '/var/www/app',
|
|
43
|
+
pm2: partial.pm2,
|
|
44
|
+
backend: partial.backend ?? defaultBackendConfig(),
|
|
45
|
+
domain: partial.domain,
|
|
46
|
+
zeroDowntime: partial.zeroDowntime ?? DEFAULTS.ZERO_DOWNTIME,
|
|
47
|
+
keepReleases: partial.keepReleases ?? DEFAULTS.KEEP_RELEASES,
|
|
48
|
+
healthCheck: defaultHealthCheckConfig(partial.healthCheck),
|
|
49
|
+
envFile: partial.envFile ?? DEFAULTS.ENV_FILE,
|
|
50
|
+
nodeVersion: partial.nodeVersion ?? DEFAULTS.NODE_VERSION,
|
|
51
|
+
pkgManager: partial.pkgManager,
|
|
52
|
+
sharedDirs: partial.sharedDirs,
|
|
53
|
+
sharedFiles: partial.sharedFiles,
|
|
54
|
+
buildDir: partial.buildDir,
|
|
55
|
+
database: partial.database,
|
|
56
|
+
backup: partial.backup,
|
|
57
|
+
cloudflare: partial.cloudflare,
|
|
58
|
+
hooks: partial.hooks,
|
|
59
|
+
};
|
|
60
|
+
return ShipnodeConfigSchema.parse(withDefaults);
|
|
61
|
+
}
|
|
62
|
+
//# sourceMappingURL=assembly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AAO,CAAC,YAAY,IAAI,QAAQ,CAAC,aAAa;QAC5D,WAAW,EAAE,wBAAwB,CAAC,OAAO,CAAC,WAAW,CAAC;QAC1D,OAAO,EAAE,OAAO,CAAC,OAAO,IAAI,QAAQ,CAAC,QAAQ;QAC7C,WAAW,EAAE,OAAO,CAAC,WAAW,IAAI,QAAQ,CAAC,YAAY;QACzD,UAAU,EAAE,OAAO,CAAC,UAAU;QAC9B,UAAU,EAAE,OAAO,CAAC,UAAU;QAC9B,WAAW,EAAE,OAAO,CAAC,WAAW;QAChC,QAAQ,EAAE,OAAO,CAAC,QAAQ;QAC1B,QAAQ,EAAE,OAAO,CAAC,QAAQ;QAC1B,MAAM,EAAE,OAAO,CAAC,MAAM;QACtB,UAAU,EAAE,OAAO,CAAC,UAAU;QAC9B,KAAK,EAAE,OAAO,CAAC,KAAK;KACrB,CAAC;IAEF,OAAO,oBAAoB,CAAC,KAAK,CAAC,YAAY,CAAC,CAAC;AAClD,CAAC"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import type { ShipnodeConfig, SshConfig, Pm2Config, HealthCheckConfig, DatabaseConfig, BackupConfig, CloudflareConfig, HookFn, PkgManager } from '../shared/types.js';
|
|
2
|
+
export declare class ShipnodeBuilder {
|
|
3
|
+
private config;
|
|
4
|
+
backend(): this;
|
|
5
|
+
frontend(): this;
|
|
6
|
+
ssh(opts: SshConfig): this;
|
|
7
|
+
cloudflareAccess(proxyCommand?: string): this;
|
|
8
|
+
deployTo(path: string): this;
|
|
9
|
+
pm2(name: string, opts?: Omit<Pm2Config, 'name'>): this;
|
|
10
|
+
port(n: number): this;
|
|
11
|
+
domain(d: string): this;
|
|
12
|
+
zeroDowntime(opts?: {
|
|
13
|
+
keepReleases?: number;
|
|
14
|
+
}): this;
|
|
15
|
+
legacy(): this;
|
|
16
|
+
sharedDirs(dirs: string[]): this;
|
|
17
|
+
sharedFiles(files: string[]): this;
|
|
18
|
+
healthCheck(path: string, opts?: Partial<HealthCheckConfig>): this;
|
|
19
|
+
noHealthCheck(): this;
|
|
20
|
+
envFile(f: string): this;
|
|
21
|
+
nodeVersion(v: string): this;
|
|
22
|
+
pkgManager(pm: PkgManager): this;
|
|
23
|
+
buildDir(dir: string): this;
|
|
24
|
+
database(opts: DatabaseConfig): this;
|
|
25
|
+
backup(opts: BackupConfig): this;
|
|
26
|
+
cloudflare(opts: CloudflareConfig): this;
|
|
27
|
+
preDeploy(fn: HookFn): this;
|
|
28
|
+
postDeploy(fn: HookFn): this;
|
|
29
|
+
build(): ShipnodeConfig;
|
|
30
|
+
}
|
|
31
|
+
export declare const shipnode: ShipnodeBuilder;
|
|
32
|
+
export declare function defineConfig(builder: ShipnodeBuilder): ShipnodeBuilder;
|
|
33
|
+
//# sourceMappingURL=builder.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"builder.d.ts","sourceRoot":"","sources":["../../src/config/builder.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,cAAc,EACd,SAAS,EACT,SAAS,EACT,iBAAiB,EACjB,cAAc,EACd,YAAY,EACZ,gBAAgB,EAChB,MAAM,EACN,UAAU,EACX,MAAM,oBAAoB,CAAC;AAG5B,qBAAa,eAAe;IAC1B,OAAO,CAAC,MAAM,CAA+B;IAE7C,OAAO,IAAI,IAAI;IAKf,QAAQ,IAAI,IAAI;IAKhB,GAAG,CAAC,IAAI,EAAE,SAAS,GAAG,IAAI;IAK1B,gBAAgB,CAAC,YAAY,CAAC,EAAE,MAAM,GAAG,IAAI;IAU7C,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI;IAK5B,GAAG,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,IAAI,CAAC,SAAS,EAAE,MAAM,CAAC,GAAG,IAAI;IAKvD,IAAI,CAAC,CAAC,EAAE,MAAM,GAAG,IAAI;IAKrB,MAAM,CAAC,CAAC,EAAE,MAAM,GAAG,IAAI;IAKvB,YAAY,CAAC,IAAI,CAAC,EAAE;QAAE,YAAY,CAAC,EAAE,MAAM,CAAA;KAAE,GAAG,IAAI;IAQpD,MAAM,IAAI,IAAI;IAKd,UAAU,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,IAAI;IAKhC,WAAW,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,IAAI;IAKlC,WAAW,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,OAAO,CAAC,iBAAiB,CAAC,GAAG,IAAI;IAYlE,aAAa,IAAI,IAAI;IAKrB,OAAO,CAAC,CAAC,EAAE,MAAM,GAAG,IAAI;IAKxB,WAAW,CAAC,CAAC,EAAE,MAAM,GAAG,IAAI;IAK5B,UAAU,CAAC,EAAE,EAAE,UAAU,GAAG,IAAI;IAKhC,QAAQ,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI;IAK3B,QAAQ,CAAC,IAAI,EAAE,cAAc,GAAG,IAAI;IAKpC,MAAM,CAAC,IAAI,EAAE,YAAY,GAAG,IAAI;IAKhC,UAAU,CAAC,IAAI,EAAE,gBAAgB,GAAG,IAAI;IAKxC,SAAS,CAAC,EAAE,EAAE,MAAM,GAAG,IAAI;IAK3B,UAAU,CAAC,EAAE,EAAE,MAAM,GAAG,IAAI;IAK5B,KAAK,IAAI,cAAc;CAGxB;AAED,eAAO,MAAM,QAAQ,iBAAwB,CAAC;AAE9C,wBAAgB,YAAY,CAAC,OAAO,EAAE,eAAe,GAAG,eAAe,CAEtE"}
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
import { assembleConfig } from './assembly.js';
|
|
2
|
+
export class ShipnodeBuilder {
|
|
3
|
+
config = {};
|
|
4
|
+
backend() {
|
|
5
|
+
this.config.app = 'backend';
|
|
6
|
+
return this;
|
|
7
|
+
}
|
|
8
|
+
frontend() {
|
|
9
|
+
this.config.app = 'frontend';
|
|
10
|
+
return this;
|
|
11
|
+
}
|
|
12
|
+
ssh(opts) {
|
|
13
|
+
this.config.ssh = { ...this.config.ssh, ...opts };
|
|
14
|
+
return this;
|
|
15
|
+
}
|
|
16
|
+
cloudflareAccess(proxyCommand) {
|
|
17
|
+
const existing = this.config.ssh ?? { host: '', user: '', port: 22 };
|
|
18
|
+
this.config.ssh = {
|
|
19
|
+
...existing,
|
|
20
|
+
proxyMode: 'cloudflare',
|
|
21
|
+
proxyCommand: proxyCommand ?? existing.proxyCommand,
|
|
22
|
+
};
|
|
23
|
+
return this;
|
|
24
|
+
}
|
|
25
|
+
deployTo(path) {
|
|
26
|
+
this.config.remotePath = path;
|
|
27
|
+
return this;
|
|
28
|
+
}
|
|
29
|
+
pm2(name, opts) {
|
|
30
|
+
this.config.pm2 = { name, ...opts };
|
|
31
|
+
return this;
|
|
32
|
+
}
|
|
33
|
+
port(n) {
|
|
34
|
+
this.config.backend = { ...(this.config.backend ?? {}), port: n };
|
|
35
|
+
return this;
|
|
36
|
+
}
|
|
37
|
+
domain(d) {
|
|
38
|
+
this.config.domain = d;
|
|
39
|
+
return this;
|
|
40
|
+
}
|
|
41
|
+
zeroDowntime(opts) {
|
|
42
|
+
this.config.zeroDowntime = true;
|
|
43
|
+
if (opts?.keepReleases !== undefined) {
|
|
44
|
+
this.config.keepReleases = opts.keepReleases;
|
|
45
|
+
}
|
|
46
|
+
return this;
|
|
47
|
+
}
|
|
48
|
+
legacy() {
|
|
49
|
+
this.config.zeroDowntime = false;
|
|
50
|
+
return this;
|
|
51
|
+
}
|
|
52
|
+
sharedDirs(dirs) {
|
|
53
|
+
this.config.sharedDirs = dirs;
|
|
54
|
+
return this;
|
|
55
|
+
}
|
|
56
|
+
sharedFiles(files) {
|
|
57
|
+
this.config.sharedFiles = files;
|
|
58
|
+
return this;
|
|
59
|
+
}
|
|
60
|
+
healthCheck(path, opts) {
|
|
61
|
+
this.config.healthCheck = {
|
|
62
|
+
...(this.config.healthCheck ?? {}),
|
|
63
|
+
enabled: true,
|
|
64
|
+
path,
|
|
65
|
+
timeout: opts?.timeout ?? 30,
|
|
66
|
+
retries: opts?.retries ?? 3,
|
|
67
|
+
startupDelay: opts?.startupDelay ?? 3,
|
|
68
|
+
};
|
|
69
|
+
return this;
|
|
70
|
+
}
|
|
71
|
+
noHealthCheck() {
|
|
72
|
+
this.config.healthCheck = { enabled: false, path: '/health', timeout: 30, retries: 3, startupDelay: 3 };
|
|
73
|
+
return this;
|
|
74
|
+
}
|
|
75
|
+
envFile(f) {
|
|
76
|
+
this.config.envFile = f;
|
|
77
|
+
return this;
|
|
78
|
+
}
|
|
79
|
+
nodeVersion(v) {
|
|
80
|
+
this.config.nodeVersion = v;
|
|
81
|
+
return this;
|
|
82
|
+
}
|
|
83
|
+
pkgManager(pm) {
|
|
84
|
+
this.config.pkgManager = pm;
|
|
85
|
+
return this;
|
|
86
|
+
}
|
|
87
|
+
buildDir(dir) {
|
|
88
|
+
this.config.buildDir = dir;
|
|
89
|
+
return this;
|
|
90
|
+
}
|
|
91
|
+
database(opts) {
|
|
92
|
+
this.config.database = opts;
|
|
93
|
+
return this;
|
|
94
|
+
}
|
|
95
|
+
backup(opts) {
|
|
96
|
+
this.config.backup = opts;
|
|
97
|
+
return this;
|
|
98
|
+
}
|
|
99
|
+
cloudflare(opts) {
|
|
100
|
+
this.config.cloudflare = opts;
|
|
101
|
+
return this;
|
|
102
|
+
}
|
|
103
|
+
preDeploy(fn) {
|
|
104
|
+
this.config.hooks = { ...(this.config.hooks ?? {}), preDeploy: fn };
|
|
105
|
+
return this;
|
|
106
|
+
}
|
|
107
|
+
postDeploy(fn) {
|
|
108
|
+
this.config.hooks = { ...(this.config.hooks ?? {}), postDeploy: fn };
|
|
109
|
+
return this;
|
|
110
|
+
}
|
|
111
|
+
build() {
|
|
112
|
+
return assembleConfig(this.config);
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
export const shipnode = new ShipnodeBuilder();
|
|
116
|
+
export function defineConfig(builder) {
|
|
117
|
+
return builder;
|
|
118
|
+
}
|
|
119
|
+
//# sourceMappingURL=builder.js.map
|