@primitivedotdev/cli
Advanced tools
| import { existsSync } from "node:fs"; | ||
| import { join } from "node:path"; | ||
| import { homedir } from "node:os"; | ||
| //#region src/oclif/root-signup-hint.ts | ||
| const CREDENTIALS_FILE = "credentials.json"; | ||
| function activeConfigDir(env, home) { | ||
| if (env.PRIMITIVE_CONFIG_DIR) return env.PRIMITIVE_CONFIG_DIR; | ||
| return join(env.XDG_CONFIG_HOME || join(home, ".config"), "primitive"); | ||
| } | ||
| function shouldShowLoggedOutSignupHint(options = {}) { | ||
| if ((options.argv ?? process.argv.slice(2)).length > 0) return false; | ||
| const env = options.env ?? process.env; | ||
| if (env.PRIMITIVE_HIDE_SIGNUP_HINT === "1") return false; | ||
| if (env.PRIMITIVE_API_KEY?.trim()) return false; | ||
| return !existsSync(join(activeConfigDir(env, options.home ?? homedir()), CREDENTIALS_FILE)); | ||
| } | ||
| function loggedOutSignupHint() { | ||
| return [ | ||
| "New to Primitive?", | ||
| " You or your user don't have an account yet?", | ||
| " Run `primitive signup <email> --signup-code <invite-code> --accept-terms`", | ||
| " to create an account, get your own domain, and get started now.", | ||
| "" | ||
| ].join("\n"); | ||
| } | ||
| function writeLoggedOutSignupHintIfNeeded(options = {}) { | ||
| if (!shouldShowLoggedOutSignupHint(options)) return; | ||
| (options.write ?? ((message) => process.stdout.write(message)))(loggedOutSignupHint()); | ||
| } | ||
| //#endregion | ||
| export { loggedOutSignupHint, shouldShowLoggedOutSignupHint, writeLoggedOutSignupHintIfNeeded }; |
+5
-0
@@ -10,3 +10,8 @@ #!/usr/bin/env node | ||
| const { writeLoggedOutSignupHintIfNeeded } = await import( | ||
| "../dist/oclif/root-signup-hint.js" | ||
| ); | ||
| writeLoggedOutSignupHintIfNeeded(); | ||
| const { execute } = await import("@oclif/core"); | ||
| await execute({ dir: import.meta.url }); |
+14
-3
| { | ||
| "name": "@primitivedotdev/cli", | ||
| "version": "0.31.7", | ||
| "version": "0.31.8", | ||
| "description": "Official Primitive CLI: deploy Primitive Functions, send and inspect mail, manage endpoints, all from the terminal. Wraps the @primitivedotdev/sdk runtime client with one-shot commands.", | ||
@@ -28,4 +28,11 @@ "type": "module", | ||
| "@oclif/plugin-help", | ||
| "@oclif/plugin-autocomplete" | ||
| "@oclif/plugin-autocomplete", | ||
| "@oclif/plugin-warn-if-update-available" | ||
| ], | ||
| "warn-if-update-available": { | ||
| "timeoutInDays": 1, | ||
| "frequency": 1, | ||
| "frequencyUnit": "days", | ||
| "message": "Primitive CLI update available from <%= chalk.greenBright(config.version) %> to <%= chalk.greenBright(latest) %>. Run `npm install -g @primitivedotdev/cli@latest` to update." | ||
| }, | ||
| "topics": { | ||
@@ -63,2 +70,5 @@ "cli": { | ||
| }, | ||
| "threads": { | ||
| "description": "Inspect conversation threads spanning received and sent emails: `primitive threads get --id <thread-id>`." | ||
| }, | ||
| "endpoints": { | ||
@@ -117,3 +127,4 @@ "description": "Manage webhook endpoints that receive email events" | ||
| "@oclif/plugin-autocomplete": "^3.2.45", | ||
| "@oclif/plugin-help": "^6.2.44" | ||
| "@oclif/plugin-help": "^6.2.44", | ||
| "@oclif/plugin-warn-if-update-available": "^3.1.65" | ||
| }, | ||
@@ -120,0 +131,0 @@ "devDependencies": { |
Sorry, the diff of this file is too big to display
756602
3.84%7
16.67%20347
3.52%4
33.33%27
3.85%+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added