checkpoint-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/dist/config.d.ts +1 -1
- package/dist/config.js +1 -1
- package/dist/index.js +50 -6
- package/package.json +12 -3
package/dist/config.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export declare const SUPABASE_URL = "https://uxunzukbuaffsnavvxub.supabase.co";
|
|
2
2
|
export declare const SUPABASE_ANON_KEY = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6InV4dW56dWtidWFmZnNuYXZ2eHViIiwicm9sZSI6ImFub24iLCJpYXQiOjE3NzA5MTE3NzMsImV4cCI6MjA4NjQ4Nzc3M30.XYQNXTfqClvcr9jwdH2e8ySiG5Ue85YQAoWd1c7CxVk";
|
|
3
3
|
/** Default app URL — can be overridden per environment */
|
|
4
|
-
export declare const DEFAULT_APP_URL = "https://checkpoint.build";
|
|
4
|
+
export declare const DEFAULT_APP_URL = "https://app.checkpoint.build";
|
|
5
5
|
export interface StoredConfig {
|
|
6
6
|
access_token: string;
|
|
7
7
|
refresh_token: string;
|
package/dist/config.js
CHANGED
|
@@ -15,7 +15,7 @@ const os_1 = __importDefault(require("os"));
|
|
|
15
15
|
exports.SUPABASE_URL = 'https://uxunzukbuaffsnavvxub.supabase.co';
|
|
16
16
|
exports.SUPABASE_ANON_KEY = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6InV4dW56dWtidWFmZnNuYXZ2eHViIiwicm9sZSI6ImFub24iLCJpYXQiOjE3NzA5MTE3NzMsImV4cCI6MjA4NjQ4Nzc3M30.XYQNXTfqClvcr9jwdH2e8ySiG5Ue85YQAoWd1c7CxVk';
|
|
17
17
|
/** Default app URL — can be overridden per environment */
|
|
18
|
-
exports.DEFAULT_APP_URL = 'https://checkpoint.build';
|
|
18
|
+
exports.DEFAULT_APP_URL = 'https://app.checkpoint.build';
|
|
19
19
|
/* ── Local token storage (~/.checkpoint/config.json) ── */
|
|
20
20
|
const CONFIG_DIR = path_1.default.join(os_1.default.homedir(), '.checkpoint');
|
|
21
21
|
const CONFIG_FILE = path_1.default.join(CONFIG_DIR, 'config.json');
|
package/dist/index.js
CHANGED
|
@@ -7,6 +7,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
7
7
|
const commander_1 = require("commander");
|
|
8
8
|
const child_process_1 = require("child_process");
|
|
9
9
|
const http_1 = __importDefault(require("http"));
|
|
10
|
+
const readline_1 = __importDefault(require("readline"));
|
|
10
11
|
const chalk_1 = __importDefault(require("chalk"));
|
|
11
12
|
const supabase_js_1 = require("@supabase/supabase-js");
|
|
12
13
|
const config_js_1 = require("./config.js");
|
|
@@ -204,6 +205,16 @@ function hasBinary(name) {
|
|
|
204
205
|
return false;
|
|
205
206
|
}
|
|
206
207
|
}
|
|
208
|
+
function checkLocalServer(port) {
|
|
209
|
+
return new Promise((resolve) => {
|
|
210
|
+
const req = http_1.default.request({ hostname: 'localhost', port, method: 'HEAD', timeout: 2000 }, () => {
|
|
211
|
+
resolve(true);
|
|
212
|
+
});
|
|
213
|
+
req.on('error', () => resolve(false));
|
|
214
|
+
req.on('timeout', () => { req.destroy(); resolve(false); });
|
|
215
|
+
req.end();
|
|
216
|
+
});
|
|
217
|
+
}
|
|
207
218
|
const VALID_PROVIDERS = ['cloudflared', 'ngrok'];
|
|
208
219
|
function isValidProvider(provider) {
|
|
209
220
|
return VALID_PROVIDERS.includes(provider);
|
|
@@ -327,6 +338,16 @@ function startHeartbeat(sb, tunnelId) {
|
|
|
327
338
|
}, 30000);
|
|
328
339
|
}
|
|
329
340
|
/* ── Browser-based Login Flow ── */
|
|
341
|
+
function prompt(question, defaultValue) {
|
|
342
|
+
const rl = readline_1.default.createInterface({ input: process.stdin, output: process.stdout });
|
|
343
|
+
const suffix = defaultValue ? chalk_1.default.gray(` (${defaultValue})`) : '';
|
|
344
|
+
return new Promise((resolve) => {
|
|
345
|
+
rl.question(` ${question}${suffix}: `, (answer) => {
|
|
346
|
+
rl.close();
|
|
347
|
+
resolve(answer.trim() || defaultValue || '');
|
|
348
|
+
});
|
|
349
|
+
});
|
|
350
|
+
}
|
|
330
351
|
function openBrowser(url) {
|
|
331
352
|
const cmd = process.platform === 'darwin' ? 'open' : process.platform === 'win32' ? 'start' : 'xdg-open';
|
|
332
353
|
(0, child_process_1.spawn)(cmd, [url], { stdio: 'ignore', detached: true }).unref();
|
|
@@ -408,7 +429,7 @@ program
|
|
|
408
429
|
.description('Authenticate with Checkpoint via the browser')
|
|
409
430
|
.action(async () => {
|
|
410
431
|
console.log('');
|
|
411
|
-
console.log(chalk_1.default.blue.bold('
|
|
432
|
+
console.log(chalk_1.default.blue.bold(' ⟐ Checkpoint'));
|
|
412
433
|
console.log('');
|
|
413
434
|
// Check if already logged in
|
|
414
435
|
const existing = (0, config_js_1.loadConfig)();
|
|
@@ -454,7 +475,7 @@ program
|
|
|
454
475
|
.description('Sign out and remove stored credentials')
|
|
455
476
|
.action(() => {
|
|
456
477
|
console.log('');
|
|
457
|
-
console.log(chalk_1.default.blue.bold('
|
|
478
|
+
console.log(chalk_1.default.blue.bold(' ⟐ Checkpoint'));
|
|
458
479
|
console.log('');
|
|
459
480
|
(0, config_js_1.clearConfig)();
|
|
460
481
|
console.log(chalk_1.default.green(' ✓ Logged out'));
|
|
@@ -465,14 +486,37 @@ program
|
|
|
465
486
|
.command('start')
|
|
466
487
|
.description('Tunnel a local port and create a Checkpoint share link')
|
|
467
488
|
.requiredOption('-p, --port <port>', 'Local port to tunnel', '3000')
|
|
468
|
-
.option('-n, --name <name>', 'Name for this tunnel'
|
|
489
|
+
.option('-n, --name <name>', 'Name for this tunnel')
|
|
469
490
|
.option('--provider <provider>', 'Tunnel provider: cloudflared (default) or ngrok')
|
|
470
491
|
.action(async (opts) => {
|
|
471
492
|
requireAuth();
|
|
472
493
|
const port = parseInt(opts.port, 10);
|
|
473
494
|
console.log('');
|
|
474
|
-
console.log(chalk_1.default.blue.bold('
|
|
495
|
+
console.log(chalk_1.default.blue.bold(' ⟐ Checkpoint'));
|
|
475
496
|
console.log('');
|
|
497
|
+
// Prompt for tunnel name if not provided
|
|
498
|
+
if (!opts.name) {
|
|
499
|
+
opts.name = await prompt('Give this tunnel a name');
|
|
500
|
+
if (!opts.name) {
|
|
501
|
+
console.log(chalk_1.default.red(' A tunnel name is required.'));
|
|
502
|
+
console.log('');
|
|
503
|
+
process.exit(1);
|
|
504
|
+
}
|
|
505
|
+
console.log('');
|
|
506
|
+
}
|
|
507
|
+
// Check if local server is running
|
|
508
|
+
const isRunning = await checkLocalServer(port);
|
|
509
|
+
if (!isRunning) {
|
|
510
|
+
console.log(chalk_1.default.red(` Nothing is running on localhost:${port}`));
|
|
511
|
+
console.log('');
|
|
512
|
+
console.log(chalk_1.default.white(' You need two terminals:'));
|
|
513
|
+
console.log(chalk_1.default.gray(' Terminal 1:') + chalk_1.default.cyan(` npm run dev`) + chalk_1.default.gray(' (start your app)'));
|
|
514
|
+
console.log(chalk_1.default.gray(' Terminal 2:') + chalk_1.default.cyan(` checkpoint start -p ${port}`) + chalk_1.default.gray(' (start the tunnel)'));
|
|
515
|
+
console.log('');
|
|
516
|
+
console.log(chalk_1.default.gray(' Start your dev server first, then run this command again.'));
|
|
517
|
+
console.log('');
|
|
518
|
+
process.exit(1);
|
|
519
|
+
}
|
|
476
520
|
// Authenticate
|
|
477
521
|
const sb = await getAuthenticatedClient();
|
|
478
522
|
if (!sb) {
|
|
@@ -549,7 +593,7 @@ program
|
|
|
549
593
|
.action(async (opts) => {
|
|
550
594
|
requireAuth();
|
|
551
595
|
console.log('');
|
|
552
|
-
console.log(chalk_1.default.blue.bold('
|
|
596
|
+
console.log(chalk_1.default.blue.bold(' ⟐ Checkpoint'));
|
|
553
597
|
console.log('');
|
|
554
598
|
const sb = await getAuthenticatedClient();
|
|
555
599
|
if (!sb) {
|
|
@@ -607,7 +651,7 @@ program
|
|
|
607
651
|
.description('Check setup status')
|
|
608
652
|
.action(async () => {
|
|
609
653
|
console.log('');
|
|
610
|
-
console.log(chalk_1.default.blue.bold('
|
|
654
|
+
console.log(chalk_1.default.blue.bold(' ⟐ Checkpoint — Status'));
|
|
611
655
|
console.log('');
|
|
612
656
|
// Auth status
|
|
613
657
|
const config = (0, config_js_1.loadConfig)();
|
package/package.json
CHANGED
|
@@ -1,11 +1,20 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "checkpoint-cli",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.2",
|
|
4
4
|
"description": "Share your localhost with reviewers — get visual feedback directly on the page",
|
|
5
|
-
"keywords": [
|
|
5
|
+
"keywords": [
|
|
6
|
+
"checkpoint",
|
|
7
|
+
"tunnel",
|
|
8
|
+
"localhost",
|
|
9
|
+
"share",
|
|
10
|
+
"feedback",
|
|
11
|
+
"review",
|
|
12
|
+
"cloudflare",
|
|
13
|
+
"ngrok"
|
|
14
|
+
],
|
|
6
15
|
"license": "MIT",
|
|
7
16
|
"bin": {
|
|
8
|
-
"checkpoint": "
|
|
17
|
+
"checkpoint": "dist/index.js"
|
|
9
18
|
},
|
|
10
19
|
"files": [
|
|
11
20
|
"dist"
|