@playdrop/playdrop-cli 0.5.3 → 0.5.5
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/config/client-meta.json +4 -4
- package/dist/commandContext.d.ts +6 -2
- package/dist/commandContext.js +144 -20
- package/dist/commands/accounts.d.ts +2 -0
- package/dist/commands/accounts.js +48 -0
- package/dist/commands/capture.js +30 -9
- package/dist/commands/captureListing.js +16 -5
- package/dist/commands/dev.js +169 -192
- package/dist/commands/devServer.d.ts +26 -3
- package/dist/commands/devServer.js +406 -68
- package/dist/commands/login.js +10 -2
- package/dist/commands/logout.d.ts +6 -1
- package/dist/commands/logout.js +25 -3
- package/dist/commands/whoami.js +10 -2
- package/dist/config.d.ts +37 -0
- package/dist/config.js +205 -3
- package/dist/index.js +32 -2
- package/dist/workspaceAuth.d.ts +14 -0
- package/dist/workspaceAuth.js +75 -0
- package/node_modules/@playdrop/ai-client/package.json +1 -1
- package/node_modules/@playdrop/api-client/dist/client.d.ts +10 -1
- package/node_modules/@playdrop/api-client/dist/client.d.ts.map +1 -1
- package/node_modules/@playdrop/api-client/dist/domains/admin.d.ts +2 -1
- package/node_modules/@playdrop/api-client/dist/domains/admin.d.ts.map +1 -1
- package/node_modules/@playdrop/api-client/dist/domains/admin.js +11 -0
- package/node_modules/@playdrop/api-client/dist/domains/apps.d.ts +4 -1
- package/node_modules/@playdrop/api-client/dist/domains/apps.d.ts.map +1 -1
- package/node_modules/@playdrop/api-client/dist/domains/apps.js +31 -0
- package/node_modules/@playdrop/api-client/dist/domains/payments.d.ts +5 -0
- package/node_modules/@playdrop/api-client/dist/domains/payments.d.ts.map +1 -1
- package/node_modules/@playdrop/api-client/dist/domains/payments.js +55 -0
- package/node_modules/@playdrop/api-client/dist/index.d.ts +11 -0
- package/node_modules/@playdrop/api-client/dist/index.d.ts.map +1 -1
- package/node_modules/@playdrop/api-client/dist/index.js +27 -0
- package/node_modules/@playdrop/api-client/package.json +1 -1
- package/node_modules/@playdrop/boxel-core/package.json +1 -1
- package/node_modules/@playdrop/boxel-three/package.json +1 -1
- package/node_modules/@playdrop/config/client-meta.json +4 -4
- package/node_modules/@playdrop/config/package.json +1 -1
- package/node_modules/@playdrop/types/dist/api.d.ts +26 -0
- package/node_modules/@playdrop/types/dist/api.d.ts.map +1 -1
- package/node_modules/@playdrop/types/dist/version.d.ts +1 -1
- package/node_modules/@playdrop/types/dist/version.d.ts.map +1 -1
- package/node_modules/@playdrop/types/dist/version.js +1 -0
- package/node_modules/@playdrop/types/package.json +1 -1
- package/node_modules/@playdrop/vox-three/package.json +1 -1
- package/package.json +1 -1
package/config/client-meta.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "0.5.
|
|
2
|
+
"version": "0.5.5",
|
|
3
3
|
"build": 1,
|
|
4
4
|
"platforms": {
|
|
5
5
|
"ios": {
|
|
@@ -26,11 +26,11 @@
|
|
|
26
26
|
},
|
|
27
27
|
"clients": {
|
|
28
28
|
"web": {
|
|
29
|
-
"minimumVersion": "0.5.
|
|
29
|
+
"minimumVersion": "0.5.5",
|
|
30
30
|
"minimumBuild": 1
|
|
31
31
|
},
|
|
32
32
|
"admin": {
|
|
33
|
-
"minimumVersion": "0.5.
|
|
33
|
+
"minimumVersion": "0.5.5",
|
|
34
34
|
"minimumBuild": 1
|
|
35
35
|
},
|
|
36
36
|
"apple": {
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
"minimumBuild": 1
|
|
39
39
|
},
|
|
40
40
|
"cli": {
|
|
41
|
-
"minimumVersion": "0.5.
|
|
41
|
+
"minimumVersion": "0.5.5"
|
|
42
42
|
}
|
|
43
43
|
}
|
|
44
44
|
}
|
package/dist/commandContext.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { ApiClient } from '@playdrop/api-client';
|
|
2
2
|
import type { AiClient } from '@playdrop/ai-client';
|
|
3
|
-
import { type CliConfig } from './config';
|
|
3
|
+
import { type CliAccountSession, type CliConfig } from './config';
|
|
4
4
|
import { type EnvironmentConfig } from './environment';
|
|
5
5
|
export type EnvironmentContext = {
|
|
6
6
|
client: ApiClient;
|
|
@@ -9,8 +9,12 @@ export type EnvironmentContext = {
|
|
|
9
9
|
envConfig: EnvironmentConfig;
|
|
10
10
|
token: string;
|
|
11
11
|
config: CliConfig;
|
|
12
|
+
account: CliAccountSession | null;
|
|
12
13
|
};
|
|
13
14
|
type EnvironmentCallback = (ctx: EnvironmentContext) => Promise<void> | void;
|
|
14
|
-
|
|
15
|
+
type ResolveAuthenticatedEnvironmentOptions = {
|
|
16
|
+
workspacePath?: string;
|
|
17
|
+
};
|
|
18
|
+
export declare function withEnvironment(command: string, actionLabel: string, callback: EnvironmentCallback, options?: ResolveAuthenticatedEnvironmentOptions): Promise<void>;
|
|
15
19
|
export declare function withPublicEnvironment(command: string, callback: EnvironmentCallback): Promise<void>;
|
|
16
20
|
export {};
|
package/dist/commandContext.js
CHANGED
|
@@ -6,21 +6,19 @@ const config_1 = require("./config");
|
|
|
6
6
|
const apiClient_1 = require("./apiClient");
|
|
7
7
|
const environment_1 = require("./environment");
|
|
8
8
|
const messages_1 = require("./messages");
|
|
9
|
+
const workspaceAuth_1 = require("./workspaceAuth");
|
|
9
10
|
const DEFAULT_PUBLIC_ENV = 'prod';
|
|
10
|
-
function resolveConfiguredEnvironment(
|
|
11
|
-
|
|
12
|
-
? cfg.env.trim()
|
|
13
|
-
: undefined;
|
|
14
|
-
if (!configuredEnv && options.requireAuth) {
|
|
11
|
+
function resolveConfiguredEnvironment(envName, command, options) {
|
|
12
|
+
if (!envName && options.requireAuth) {
|
|
15
13
|
(0, messages_1.printConfigEnvironmentMissing)(command);
|
|
16
14
|
process.exitCode = 1;
|
|
17
15
|
return null;
|
|
18
16
|
}
|
|
19
|
-
const
|
|
20
|
-
const envConfig = (0, environment_1.resolveEnvironmentConfig)(
|
|
17
|
+
const resolvedEnvName = envName ?? (options.allowDefaultPublicEnv ? DEFAULT_PUBLIC_ENV : undefined);
|
|
18
|
+
const envConfig = (0, environment_1.resolveEnvironmentConfig)(resolvedEnvName);
|
|
21
19
|
if (!envConfig) {
|
|
22
20
|
const choices = (0, environment_1.formatEnvironmentList)();
|
|
23
|
-
(0, messages_1.printUnknownEnvironment)(
|
|
21
|
+
(0, messages_1.printUnknownEnvironment)(resolvedEnvName || '', choices, command);
|
|
24
22
|
process.exitCode = 1;
|
|
25
23
|
return null;
|
|
26
24
|
}
|
|
@@ -29,42 +27,168 @@ function resolveConfiguredEnvironment(cfg, command, options) {
|
|
|
29
27
|
}
|
|
30
28
|
return envConfig;
|
|
31
29
|
}
|
|
32
|
-
function buildContext(cfg, envConfig) {
|
|
33
|
-
const
|
|
34
|
-
const
|
|
30
|
+
function buildContext(cfg, envConfig, account) {
|
|
31
|
+
const token = account?.token ?? cfg.token ?? '';
|
|
32
|
+
const client = (0, apiClient_1.createCliApiClient)({ baseUrl: envConfig.apiBase, token });
|
|
33
|
+
const aiClient = (0, apiClient_1.createCliAiClient)({ baseUrl: envConfig.aiBase, token });
|
|
35
34
|
return {
|
|
36
35
|
client,
|
|
37
36
|
aiClient,
|
|
38
37
|
env: envConfig.name,
|
|
39
38
|
envConfig,
|
|
40
|
-
token
|
|
39
|
+
token,
|
|
41
40
|
config: cfg,
|
|
41
|
+
account,
|
|
42
42
|
};
|
|
43
43
|
}
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
44
|
+
function buildLegacyAccountSession(cfg) {
|
|
45
|
+
if (!cfg.token || !cfg.env) {
|
|
46
|
+
return null;
|
|
47
|
+
}
|
|
48
|
+
return {
|
|
49
|
+
username: cfg.currentUsername ?? '',
|
|
50
|
+
env: cfg.env,
|
|
51
|
+
token: cfg.token,
|
|
52
|
+
updatedAt: '',
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
async function migrateLegacyConfigIfNeeded(cfg, envConfig, command) {
|
|
56
|
+
if ((0, config_1.getCurrentAccountSession)(cfg) || !cfg.token || !cfg.env) {
|
|
57
|
+
return cfg;
|
|
58
|
+
}
|
|
59
|
+
const client = (0, apiClient_1.createCliApiClient)({ baseUrl: envConfig.apiBase, token: cfg.token });
|
|
60
|
+
try {
|
|
61
|
+
const data = await client.me();
|
|
62
|
+
const username = typeof data.user?.username === 'string' ? data.user.username.trim() : '';
|
|
63
|
+
if (!username) {
|
|
64
|
+
(0, messages_1.printErrorWithHelp)('Could not migrate your existing Playdrop CLI session.', ['Run "playdrop auth login" to reauthenticate and rebuild your local account store.'], { command });
|
|
65
|
+
process.exitCode = 1;
|
|
66
|
+
return null;
|
|
67
|
+
}
|
|
68
|
+
return (0, config_1.migrateLegacySession)({
|
|
69
|
+
username,
|
|
70
|
+
env: envConfig.name,
|
|
71
|
+
token: cfg.token,
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
catch {
|
|
75
|
+
(0, messages_1.printErrorWithHelp)('Could not migrate your existing Playdrop CLI session.', ['Run "playdrop auth login" to reauthenticate and rebuild your local account store.'], { command });
|
|
76
|
+
process.exitCode = 1;
|
|
77
|
+
return null;
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
function resolveWorkspaceSelectedAccount(cfg, currentAccount, workspaceAuth) {
|
|
81
|
+
const matchingSessions = (0, config_1.listAccountSessionsForUsername)(workspaceAuth.config.ownerUsername, cfg);
|
|
82
|
+
if (workspaceAuth.config.env) {
|
|
83
|
+
return {
|
|
84
|
+
account: (0, config_1.findAccountSession)(workspaceAuth.config.ownerUsername, workspaceAuth.config.env, cfg),
|
|
85
|
+
matchingSessions,
|
|
86
|
+
};
|
|
87
|
+
}
|
|
88
|
+
if (matchingSessions.length === 1) {
|
|
89
|
+
return {
|
|
90
|
+
account: matchingSessions[0],
|
|
91
|
+
matchingSessions,
|
|
92
|
+
};
|
|
93
|
+
}
|
|
94
|
+
if (currentAccount && currentAccount.username === workspaceAuth.config.ownerUsername) {
|
|
95
|
+
return {
|
|
96
|
+
account: (0, config_1.findAccountSession)(workspaceAuth.config.ownerUsername, currentAccount.env, cfg),
|
|
97
|
+
matchingSessions,
|
|
98
|
+
};
|
|
99
|
+
}
|
|
100
|
+
return {
|
|
101
|
+
account: null,
|
|
102
|
+
matchingSessions,
|
|
103
|
+
};
|
|
104
|
+
}
|
|
105
|
+
async function resolveAuthenticatedEnvironment(command, actionLabel, options = {}) {
|
|
106
|
+
let cfg = (0, config_1.loadConfig)();
|
|
107
|
+
let workspaceAuth = null;
|
|
108
|
+
try {
|
|
109
|
+
workspaceAuth = options.workspacePath ? (0, workspaceAuth_1.findWorkspaceAuthConfig)(options.workspacePath) : null;
|
|
110
|
+
}
|
|
111
|
+
catch (error) {
|
|
112
|
+
if (error instanceof workspaceAuth_1.WorkspaceAuthConfigError) {
|
|
113
|
+
(0, messages_1.printErrorWithHelp)(`Invalid .playdrop.json at ${error.filePath}.`, [
|
|
114
|
+
'The file must be valid JSON.',
|
|
115
|
+
'It must include a non-empty "ownerUsername" string.',
|
|
116
|
+
], { command });
|
|
117
|
+
process.exitCode = 1;
|
|
118
|
+
return null;
|
|
119
|
+
}
|
|
120
|
+
throw error;
|
|
121
|
+
}
|
|
122
|
+
if (workspaceAuth && !(0, config_1.getCurrentAccountSession)(cfg) && cfg.token && cfg.env) {
|
|
123
|
+
const provisionalEnvConfig = resolveConfiguredEnvironment(cfg.env, command, {
|
|
124
|
+
requireAuth: true,
|
|
125
|
+
allowDefaultPublicEnv: false,
|
|
126
|
+
});
|
|
127
|
+
if (!provisionalEnvConfig) {
|
|
128
|
+
return null;
|
|
129
|
+
}
|
|
130
|
+
const migrated = await migrateLegacyConfigIfNeeded(cfg, provisionalEnvConfig, command);
|
|
131
|
+
if (!migrated) {
|
|
132
|
+
return null;
|
|
133
|
+
}
|
|
134
|
+
cfg = migrated;
|
|
135
|
+
}
|
|
136
|
+
const currentAccount = (0, config_1.getCurrentAccountSession)(cfg) ?? buildLegacyAccountSession(cfg);
|
|
137
|
+
const selectedAccount = workspaceAuth
|
|
138
|
+
? resolveWorkspaceSelectedAccount(cfg, currentAccount, workspaceAuth).account
|
|
139
|
+
: currentAccount;
|
|
140
|
+
if (!selectedAccount) {
|
|
141
|
+
if (workspaceAuth) {
|
|
142
|
+
const matchingSessions = (0, config_1.listAccountSessionsForUsername)(workspaceAuth.config.ownerUsername, cfg);
|
|
143
|
+
if (!workspaceAuth.config.env && matchingSessions.length > 1) {
|
|
144
|
+
(0, messages_1.printErrorWithHelp)(`This workspace is pinned to ${workspaceAuth.config.ownerUsername}, but that account is logged in on multiple environments.`, [
|
|
145
|
+
`Run "playdrop auth use ${workspaceAuth.config.ownerUsername} --env <env>" to select the matching environment.`,
|
|
146
|
+
'Or add an "env" field to .playdrop.json.',
|
|
147
|
+
], { command });
|
|
148
|
+
process.exitCode = 1;
|
|
149
|
+
return null;
|
|
150
|
+
}
|
|
151
|
+
const envSuffix = workspaceAuth.config.env ? ` on ${workspaceAuth.config.env}` : '';
|
|
152
|
+
(0, messages_1.printErrorWithHelp)(`This workspace is pinned to ${workspaceAuth.config.ownerUsername}${envSuffix}, but that account is not logged in.`, [
|
|
153
|
+
`Run "playdrop auth login${workspaceAuth.config.env ? ` --env ${workspaceAuth.config.env}` : ''}" while authenticated as ${workspaceAuth.config.ownerUsername}.`,
|
|
154
|
+
'Or remove .playdrop.json if this workspace should use your current default account.',
|
|
155
|
+
], { command });
|
|
156
|
+
process.exitCode = 1;
|
|
157
|
+
return null;
|
|
158
|
+
}
|
|
47
159
|
(0, messages_1.printLoginRequired)(actionLabel, command);
|
|
48
160
|
process.exitCode = 1;
|
|
49
|
-
return;
|
|
161
|
+
return null;
|
|
50
162
|
}
|
|
51
|
-
const envConfig = resolveConfiguredEnvironment(
|
|
163
|
+
const envConfig = resolveConfiguredEnvironment(selectedAccount.env, command, {
|
|
52
164
|
requireAuth: true,
|
|
53
165
|
allowDefaultPublicEnv: false,
|
|
54
166
|
});
|
|
55
167
|
if (!envConfig) {
|
|
168
|
+
return null;
|
|
169
|
+
}
|
|
170
|
+
return {
|
|
171
|
+
cfg: (0, config_1.loadConfig)(),
|
|
172
|
+
account: selectedAccount,
|
|
173
|
+
envConfig,
|
|
174
|
+
};
|
|
175
|
+
}
|
|
176
|
+
async function withEnvironment(command, actionLabel, callback, options = {}) {
|
|
177
|
+
const resolved = await resolveAuthenticatedEnvironment(command, actionLabel, options);
|
|
178
|
+
if (!resolved) {
|
|
56
179
|
return;
|
|
57
180
|
}
|
|
58
|
-
await callback(buildContext(cfg, envConfig));
|
|
181
|
+
await callback(buildContext(resolved.cfg, resolved.envConfig, resolved.account));
|
|
59
182
|
}
|
|
60
183
|
async function withPublicEnvironment(command, callback) {
|
|
61
184
|
const cfg = (0, config_1.loadConfig)();
|
|
62
|
-
const
|
|
185
|
+
const account = (0, config_1.getCurrentAccountSession)(cfg);
|
|
186
|
+
const envConfig = resolveConfiguredEnvironment(account?.env ?? cfg.env, command, {
|
|
63
187
|
requireAuth: false,
|
|
64
188
|
allowDefaultPublicEnv: true,
|
|
65
189
|
});
|
|
66
190
|
if (!envConfig) {
|
|
67
191
|
return;
|
|
68
192
|
}
|
|
69
|
-
await callback(buildContext(cfg, envConfig));
|
|
193
|
+
await callback(buildContext(cfg, envConfig, account));
|
|
70
194
|
}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.listAccounts = listAccounts;
|
|
4
|
+
exports.useAccount = useAccount;
|
|
5
|
+
const config_1 = require("../config");
|
|
6
|
+
const messages_1 = require("../messages");
|
|
7
|
+
function listAccounts() {
|
|
8
|
+
const accounts = (0, config_1.listAccountSessions)();
|
|
9
|
+
if (accounts.length === 0) {
|
|
10
|
+
const cfg = (0, config_1.loadConfig)();
|
|
11
|
+
if (cfg.token && cfg.env) {
|
|
12
|
+
console.log('Your current Playdrop session is using the legacy single-account format.');
|
|
13
|
+
console.log('Next: run "playdrop auth whoami" to migrate it into the multi-account store.');
|
|
14
|
+
return;
|
|
15
|
+
}
|
|
16
|
+
console.log('No Playdrop accounts are stored.');
|
|
17
|
+
console.log('Next: run "playdrop auth login" to add an account.');
|
|
18
|
+
return;
|
|
19
|
+
}
|
|
20
|
+
const current = (0, config_1.getCurrentAccountSession)();
|
|
21
|
+
for (const account of accounts) {
|
|
22
|
+
const marker = current && current.username === account.username && current.env === account.env ? '*' : ' ';
|
|
23
|
+
console.log(`${marker} ${account.username} (${account.env})`);
|
|
24
|
+
}
|
|
25
|
+
console.log('Next: run "playdrop auth use <username>" to switch the default account.');
|
|
26
|
+
}
|
|
27
|
+
function useAccount(username, env) {
|
|
28
|
+
const normalizedUsername = username.trim();
|
|
29
|
+
if (!normalizedUsername) {
|
|
30
|
+
(0, messages_1.printErrorWithHelp)('Provide the username of the account you want to use.', ['Run "playdrop auth accounts" to list stored accounts.'], { command: 'auth use' });
|
|
31
|
+
process.exitCode = 1;
|
|
32
|
+
return;
|
|
33
|
+
}
|
|
34
|
+
const existing = (0, config_1.findAccountSession)(normalizedUsername, env);
|
|
35
|
+
if (!existing) {
|
|
36
|
+
(0, messages_1.printErrorWithHelp)(env
|
|
37
|
+
? `No stored Playdrop session was found for ${normalizedUsername} on ${env}.`
|
|
38
|
+
: `No stored Playdrop session was found for ${normalizedUsername}.`, [
|
|
39
|
+
'Run "playdrop auth accounts" to list stored accounts.',
|
|
40
|
+
`Run "playdrop auth login${env ? ` --env ${env}` : ''}" to add the missing session.`,
|
|
41
|
+
], { command: 'auth use' });
|
|
42
|
+
process.exitCode = 1;
|
|
43
|
+
return;
|
|
44
|
+
}
|
|
45
|
+
(0, config_1.setCurrentAccount)({ username: normalizedUsername, env: env?.trim() || undefined });
|
|
46
|
+
console.log(`Current Playdrop account is now ${existing.username} (${existing.env}).`);
|
|
47
|
+
console.log('Next: run "playdrop auth whoami" to confirm your session.');
|
|
48
|
+
}
|
package/dist/commands/capture.js
CHANGED
|
@@ -117,7 +117,6 @@ async function capture(targetArg, options = {}) {
|
|
|
117
117
|
return;
|
|
118
118
|
}
|
|
119
119
|
const screenshotPath = options.screenshotPath ? (0, node_path_1.resolve)(process.cwd(), options.screenshotPath) : null;
|
|
120
|
-
const portToUse = 8888;
|
|
121
120
|
let resolvedTarget;
|
|
122
121
|
try {
|
|
123
122
|
resolvedTarget = (0, devShared_1.resolveDevTarget)(targetArg, options.appName);
|
|
@@ -280,7 +279,12 @@ async function capture(targetArg, options = {}) {
|
|
|
280
279
|
}
|
|
281
280
|
const entryLabel = (0, node_path_1.relative)(process.cwd(), filePath) || filePath;
|
|
282
281
|
console.log(`[capture] Preparing ${entryLabel} for ${env} (${appTypeSlug}).`);
|
|
283
|
-
const serverAlreadyRunning = await (0, devServer_1.isDevServerAvailable)(
|
|
282
|
+
const serverAlreadyRunning = await (0, devServer_1.isDevServerAvailable)({
|
|
283
|
+
creatorUsername: currentUsername,
|
|
284
|
+
appType: appTypeSlug,
|
|
285
|
+
appName,
|
|
286
|
+
port: devServer_1.DEV_ROUTER_PORT,
|
|
287
|
+
}, 750);
|
|
284
288
|
const devServerStartedByCapture = !serverAlreadyRunning;
|
|
285
289
|
let serverHandle = null;
|
|
286
290
|
let signalHandler = null;
|
|
@@ -299,14 +303,21 @@ async function capture(targetArg, options = {}) {
|
|
|
299
303
|
}
|
|
300
304
|
};
|
|
301
305
|
if (serverAlreadyRunning) {
|
|
302
|
-
console.log(`[capture] Reusing dev server at
|
|
306
|
+
console.log(`[capture] Reusing dev server at ${(0, devServer_1.buildLocalDevAppUrl)({
|
|
307
|
+
creatorUsername: currentUsername,
|
|
308
|
+
appType: appTypeSlug,
|
|
309
|
+
appName,
|
|
310
|
+
port: devServer_1.DEV_ROUTER_PORT,
|
|
311
|
+
})}`);
|
|
303
312
|
}
|
|
304
313
|
else {
|
|
305
314
|
try {
|
|
306
315
|
serverHandle = await (0, devServer_1.startDevServer)({
|
|
307
316
|
appName,
|
|
317
|
+
appType: appTypeSlug,
|
|
318
|
+
creatorUsername: currentUsername,
|
|
308
319
|
htmlPath: filePath,
|
|
309
|
-
port:
|
|
320
|
+
port: devServer_1.DEV_ROUTER_PORT,
|
|
310
321
|
projectInfo,
|
|
311
322
|
});
|
|
312
323
|
signalHandler = () => {
|
|
@@ -316,10 +327,20 @@ async function capture(targetArg, options = {}) {
|
|
|
316
327
|
process.on('SIGTERM', signalHandler);
|
|
317
328
|
}
|
|
318
329
|
catch (error) {
|
|
319
|
-
(0,
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
330
|
+
const mountConflict = (0, devServer_1.parseMountConflictError)(typeof error?.message === 'string' ? error.message : '');
|
|
331
|
+
if (mountConflict) {
|
|
332
|
+
(0, messages_1.printErrorWithHelp)(`A different dev session already owns ${mountConflict.ref}.`, [
|
|
333
|
+
`Active owner pid: ${mountConflict.ownerPid}.`,
|
|
334
|
+
`Mounted repo root: ${mountConflict.repoRoot}.`,
|
|
335
|
+
`Mounted HTML path: ${mountConflict.htmlPath}.`,
|
|
336
|
+
], { command: 'project capture' });
|
|
337
|
+
}
|
|
338
|
+
else {
|
|
339
|
+
(0, messages_1.printErrorWithHelp)(error?.message || `Failed to start the shared dev router on port ${devServer_1.DEV_ROUTER_PORT}.`, [
|
|
340
|
+
'Close the conflicting process or wait for the stale mount to exit.',
|
|
341
|
+
'Ensure the HTML file exists and is readable.',
|
|
342
|
+
], { command: 'project capture' });
|
|
343
|
+
}
|
|
323
344
|
process.exitCode = 1;
|
|
324
345
|
return;
|
|
325
346
|
}
|
|
@@ -381,5 +402,5 @@ async function capture(targetArg, options = {}) {
|
|
|
381
402
|
}
|
|
382
403
|
await cleanup();
|
|
383
404
|
}
|
|
384
|
-
});
|
|
405
|
+
}, { workspacePath: resolvedTarget.cataloguePath ?? (0, node_path_1.dirname)(filePath) });
|
|
385
406
|
}
|
|
@@ -63,7 +63,6 @@ const MIN_DIMENSION = 16;
|
|
|
63
63
|
const MAX_DIMENSION = 8192;
|
|
64
64
|
const MAX_FPS = 120;
|
|
65
65
|
const SUPPORTED_MACOS_PREFIX = '26.4';
|
|
66
|
-
const DEV_SERVER_PORT = 8888;
|
|
67
66
|
function parsePositiveNumber(raw, fallback, fieldName, { minimum = 0, maximum = Number.POSITIVE_INFINITY, integer = false, } = {}) {
|
|
68
67
|
if (raw === undefined) {
|
|
69
68
|
return fallback;
|
|
@@ -667,7 +666,12 @@ async function captureListing(targetArg, options = {}) {
|
|
|
667
666
|
}
|
|
668
667
|
const entryLabel = (0, node_path_1.relative)(process.cwd(), resolvedTarget.htmlPath) || resolvedTarget.htmlPath;
|
|
669
668
|
console.log(`[listing] Preparing ${entryLabel} for ${env} (${appTypeSlug}).`);
|
|
670
|
-
const serverAlreadyRunning = await (0, devServer_1.isDevServerAvailable)(
|
|
669
|
+
const serverAlreadyRunning = await (0, devServer_1.isDevServerAvailable)({
|
|
670
|
+
creatorUsername: currentUsername,
|
|
671
|
+
appType: appTypeSlug,
|
|
672
|
+
appName,
|
|
673
|
+
port: devServer_1.DEV_ROUTER_PORT,
|
|
674
|
+
}, 750);
|
|
671
675
|
const devServerStartedByCapture = !serverAlreadyRunning;
|
|
672
676
|
let serverHandle = null;
|
|
673
677
|
let browserHandle = null;
|
|
@@ -686,13 +690,20 @@ async function captureListing(targetArg, options = {}) {
|
|
|
686
690
|
};
|
|
687
691
|
try {
|
|
688
692
|
if (serverAlreadyRunning) {
|
|
689
|
-
console.log(`[listing] Reusing dev server at
|
|
693
|
+
console.log(`[listing] Reusing dev server at ${(0, devServer_1.buildLocalDevAppUrl)({
|
|
694
|
+
creatorUsername: currentUsername,
|
|
695
|
+
appType: appTypeSlug,
|
|
696
|
+
appName,
|
|
697
|
+
port: devServer_1.DEV_ROUTER_PORT,
|
|
698
|
+
})}`);
|
|
690
699
|
}
|
|
691
700
|
else {
|
|
692
701
|
serverHandle = await (0, devServer_1.startDevServer)({
|
|
693
702
|
appName,
|
|
703
|
+
appType: appTypeSlug,
|
|
704
|
+
creatorUsername: currentUsername,
|
|
694
705
|
htmlPath: resolvedTarget.htmlPath,
|
|
695
|
-
port:
|
|
706
|
+
port: devServer_1.DEV_ROUTER_PORT,
|
|
696
707
|
projectInfo,
|
|
697
708
|
});
|
|
698
709
|
}
|
|
@@ -800,5 +811,5 @@ async function captureListing(targetArg, options = {}) {
|
|
|
800
811
|
finally {
|
|
801
812
|
await cleanup();
|
|
802
813
|
}
|
|
803
|
-
});
|
|
814
|
+
}, { workspacePath: resolvedTarget.cataloguePath ?? (0, node_path_1.dirname)(resolvedTarget.htmlPath) });
|
|
804
815
|
}
|