@within-7/jetr 0.7.1 → 0.7.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/cli.js +28 -14
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -469,8 +469,22 @@ async function promptSelection(options) {
|
|
|
469
469
|
|
|
470
470
|
// src/cli.ts
|
|
471
471
|
var program = new Command();
|
|
472
|
-
program.name("jetr").description(
|
|
473
|
-
|
|
472
|
+
program.name("jetr").description(`Deploy static sites instantly to {name}.jetr.within-7.com
|
|
473
|
+
|
|
474
|
+
Just run "jetr" in any directory to deploy. First time? Run "jetr login" first.
|
|
475
|
+
|
|
476
|
+
The name can be a simple name (gets .jetr.within-7.com subdomain) or a full
|
|
477
|
+
domain like docs.within-7.com or blog.example.com for custom domain hosting.
|
|
478
|
+
|
|
479
|
+
Examples:
|
|
480
|
+
$ jetr Deploy current directory (random name or from .jetrrc)
|
|
481
|
+
$ jetr ./dist Deploy the ./dist directory
|
|
482
|
+
$ jetr ./dist my-blog Deploy as my-blog.jetr.within-7.com
|
|
483
|
+
$ jetr ./dist docs.within-7.com Deploy to custom domain (auto-configures route)
|
|
484
|
+
$ jetr ./dist blog.example.com Deploy to external domain (shows DNS setup)
|
|
485
|
+
$ jetr index.html Deploy a single file
|
|
486
|
+
$ jetr *.html *.css my-site Deploy multiple files to a named site`).version("0.7.1");
|
|
487
|
+
program.argument("[paths...]", "directory, file(s), and/or site name to deploy").action(async (paths) => {
|
|
474
488
|
const config = loadConfig();
|
|
475
489
|
if (!config.token) {
|
|
476
490
|
console.error(chalk2.red("Not logged in."));
|
|
@@ -539,7 +553,7 @@ program.argument("[paths...]", "Files or directory to deploy").action(async (pat
|
|
|
539
553
|
process.exit(1);
|
|
540
554
|
}
|
|
541
555
|
});
|
|
542
|
-
program.command("login").description("
|
|
556
|
+
program.command("login").description("Authenticate with auth-gateway (interactive prompts if args omitted)").argument("[user]", "your username").argument("[password]", "your password (hidden input if omitted)").option("--token <token>", "skip login, use a JWT token directly (for CI/scripts)").action(async (user, password, opts) => {
|
|
543
557
|
if (opts?.token) {
|
|
544
558
|
saveConfig({ token: opts.token });
|
|
545
559
|
console.log(chalk2.green("\u2713 Token saved"));
|
|
@@ -571,7 +585,7 @@ program.command("login").description("Login with username and password").argumen
|
|
|
571
585
|
process.exit(1);
|
|
572
586
|
}
|
|
573
587
|
});
|
|
574
|
-
program.command("whoami").description("Show
|
|
588
|
+
program.command("whoami").description("Show who is logged in").action(() => {
|
|
575
589
|
const config = loadConfig();
|
|
576
590
|
if (!config.token) {
|
|
577
591
|
console.log(chalk2.red("Not logged in."));
|
|
@@ -581,11 +595,11 @@ program.command("whoami").description("Show current login status").action(() =>
|
|
|
581
595
|
console.log(`User: ${chalk2.bold(config.user || "unknown")}`);
|
|
582
596
|
console.log(`Token: ${config.token.slice(0, 20)}...`);
|
|
583
597
|
});
|
|
584
|
-
program.command("logout").description("Clear saved
|
|
598
|
+
program.command("logout").description("Clear saved credentials (~/.jetr/config.json)").action(() => {
|
|
585
599
|
saveConfig({ user: void 0, token: void 0 });
|
|
586
600
|
console.log(chalk2.green("\u2713 Logged out"));
|
|
587
601
|
});
|
|
588
|
-
program.command("init").description("
|
|
602
|
+
program.command("init").description("Generate .jetrignore with sensible defaults (node_modules, .env, .git, etc)").argument("[directory]", "target directory", ".").action(async (directory) => {
|
|
589
603
|
const created = createJetrignore(resolve2(directory));
|
|
590
604
|
if (created) {
|
|
591
605
|
console.log(chalk2.green("\u2713 Created .jetrignore with default patterns"));
|
|
@@ -593,7 +607,7 @@ program.command("init").description("Create .jetrignore with default patterns").
|
|
|
593
607
|
console.log(chalk2.yellow(".jetrignore already exists"));
|
|
594
608
|
}
|
|
595
609
|
});
|
|
596
|
-
program.command("create").description("Create
|
|
610
|
+
program.command("create").description("Create an empty site without deploying files").argument("<name>", "site name (e.g. my-blog) or domain (e.g. docs.example.com)").option("-p, --password <password>", "require password to view the site").option("-e, --expires <seconds>", "auto-delete after N seconds (e.g. 86400 = 1 day)", parseInt).action(async (name, opts) => {
|
|
597
611
|
const spinner = ora("Creating site...").start();
|
|
598
612
|
try {
|
|
599
613
|
const site = await api.createSite(name, {
|
|
@@ -613,7 +627,7 @@ program.command("create").description("Create a new site").argument("<name>", "S
|
|
|
613
627
|
process.exit(1);
|
|
614
628
|
}
|
|
615
629
|
});
|
|
616
|
-
program.command("list").alias("ls").description("List your sites").action(async () => {
|
|
630
|
+
program.command("list").alias("ls").description("List all your deployed sites").action(async () => {
|
|
617
631
|
try {
|
|
618
632
|
const { sites } = await api.listSites();
|
|
619
633
|
if (sites.length === 0) {
|
|
@@ -638,7 +652,7 @@ program.command("list").alias("ls").description("List your sites").action(async
|
|
|
638
652
|
process.exit(1);
|
|
639
653
|
}
|
|
640
654
|
});
|
|
641
|
-
program.command("info").description("Show site details").argument("<name>", "
|
|
655
|
+
program.command("info").description("Show site details: files, tokens, config").argument("<name>", "site name").action(async (name) => {
|
|
642
656
|
try {
|
|
643
657
|
const site = await api.getSite(name);
|
|
644
658
|
console.log(`${chalk2.bold(site.name)}`);
|
|
@@ -677,7 +691,7 @@ program.command("info").description("Show site details").argument("<name>", "Sit
|
|
|
677
691
|
process.exit(1);
|
|
678
692
|
}
|
|
679
693
|
});
|
|
680
|
-
program.command("delete").alias("rm").description("
|
|
694
|
+
program.command("delete").alias("rm").description("Permanently delete a site, all its files, and custom domains").argument("<name>", "site name").action(async (name) => {
|
|
681
695
|
const spinner = ora(`Deleting ${name}...`).start();
|
|
682
696
|
try {
|
|
683
697
|
await api.deleteSite(name);
|
|
@@ -687,7 +701,7 @@ program.command("delete").alias("rm").description("Delete a site and all its fil
|
|
|
687
701
|
process.exit(1);
|
|
688
702
|
}
|
|
689
703
|
});
|
|
690
|
-
program.command("password").description("Set or remove
|
|
704
|
+
program.command("password").description("Set a visitor password, or remove it (omit password to remove)").argument("<name>", "site name").argument("[password]", "new password (omit to make site public)").action(async (name, password) => {
|
|
691
705
|
try {
|
|
692
706
|
const site = await api.updateSite(name, { password: password ?? null });
|
|
693
707
|
if (site.password_protected) {
|
|
@@ -700,8 +714,8 @@ program.command("password").description("Set or remove site password").argument(
|
|
|
700
714
|
process.exit(1);
|
|
701
715
|
}
|
|
702
716
|
});
|
|
703
|
-
var tokenCmd = program.command("token").description("
|
|
704
|
-
tokenCmd.command("create").description("
|
|
717
|
+
var tokenCmd = program.command("token").description("Generate or revoke share links for password-protected sites");
|
|
718
|
+
tokenCmd.command("create").description("Generate a share URL that bypasses password (e.g. for QA team)").argument("<site>", "site name").option("-n, --note <note>", "label for this token (e.g. 'QA team')").option("-e, --expires <seconds>", "auto-expire after N seconds", parseInt).action(
|
|
705
719
|
async (site, opts) => {
|
|
706
720
|
try {
|
|
707
721
|
const token = await api.createToken(site, {
|
|
@@ -722,7 +736,7 @@ tokenCmd.command("create").description("Create a share token").argument("<site>"
|
|
|
722
736
|
}
|
|
723
737
|
}
|
|
724
738
|
);
|
|
725
|
-
tokenCmd.command("revoke").description("Revoke a share
|
|
739
|
+
tokenCmd.command("revoke").description("Revoke a share link (get ID from `jetr info <site>`)").argument("<site>", "site name").argument("<id>", "token ID").action(async (site, id) => {
|
|
726
740
|
try {
|
|
727
741
|
await api.revokeToken(site, id);
|
|
728
742
|
console.log(chalk2.green(`\u2713 Token ${id} revoked`));
|