nstantpage-agent 0.2.0 → 0.2.1
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.js +1 -0
- package/dist/commands/start.d.ts +1 -0
- package/dist/commands/start.js +12 -2
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -33,6 +33,7 @@ program
|
|
|
33
33
|
.option('-a, --api-port <port>', 'Local API server port (internal)', '18924')
|
|
34
34
|
.option('--project-id <id>', 'Link to a specific project ID')
|
|
35
35
|
.option('--gateway <url>', 'Gateway URL', 'wss://webprev.live')
|
|
36
|
+
.option('--token <token>', 'Auth token (skip login flow)')
|
|
36
37
|
.option('--no-dev', 'Skip starting the dev server (start manually later)')
|
|
37
38
|
.action(startCommand);
|
|
38
39
|
program
|
package/dist/commands/start.d.ts
CHANGED
package/dist/commands/start.js
CHANGED
|
@@ -20,12 +20,22 @@ import { TunnelClient } from '../tunnel.js';
|
|
|
20
20
|
import { LocalServer } from '../localServer.js';
|
|
21
21
|
export async function startCommand(directory, options) {
|
|
22
22
|
const conf = getConfig();
|
|
23
|
+
// If --token was passed, persist it
|
|
24
|
+
if (options.token) {
|
|
25
|
+
conf.set('token', options.token);
|
|
26
|
+
}
|
|
23
27
|
// Check authentication
|
|
24
|
-
|
|
25
|
-
|
|
28
|
+
// Allow unauthenticated connections to local gateways (ws://localhost, ws://127.0.0.1)
|
|
29
|
+
const isLocalGateway = /^wss?:\/\/(localhost|127\.0\.0\.1)/.test(options.gateway);
|
|
30
|
+
let token = conf.get('token');
|
|
31
|
+
if (!token && !isLocalGateway) {
|
|
26
32
|
console.log(chalk.red('✗ Not authenticated. Run "nstantpage login" first.'));
|
|
33
|
+
console.log(chalk.gray(' Or pass --token <your-token> to authenticate inline.'));
|
|
27
34
|
process.exit(1);
|
|
28
35
|
}
|
|
36
|
+
if (!token && isLocalGateway) {
|
|
37
|
+
token = 'local-dev';
|
|
38
|
+
}
|
|
29
39
|
// Resolve project directory
|
|
30
40
|
const projectDir = path.resolve(directory);
|
|
31
41
|
if (!fs.existsSync(projectDir)) {
|
package/package.json
CHANGED