@supertokens-plugins/rownd-nodejs 0.2.1 → 0.3.0-beta.0

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 ADDED
@@ -0,0 +1,54 @@
1
+ #!/usr/bin/env node
2
+ "use strict";
3
+
4
+ // scripts/cli.ts
5
+ var import_node_child_process = require("child_process");
6
+ var import_node_path = require("path");
7
+ var COMMANDS = {
8
+ "init-config": "initConfig.js",
9
+ "bulk-migrate": "bulkMigrate.js",
10
+ "setup-core": "setupCoreInstance.js",
11
+ "generate-plugin-config": "generateAppConfig.js"
12
+ };
13
+ function printHelp() {
14
+ console.log(`Usage: rownd-nodejs <command> [options]
15
+
16
+ Commands:
17
+ init-config Write a bulk migration config template
18
+ bulk-migrate Stage Rownd users for SuperTokens bulk import
19
+ setup-core Provision SuperTokens infrastructure from Rownd OIDC clients
20
+ generate-plugin-config Generate Rownd plugin configuration from Rownd app config
21
+
22
+ Run a command with --help for command-specific options.`);
23
+ }
24
+ async function main() {
25
+ const [command, ...args] = process.argv.slice(2);
26
+ if (!command || command === "--help" || command === "-h") {
27
+ printHelp();
28
+ return;
29
+ }
30
+ const script = COMMANDS[command];
31
+ if (!script) {
32
+ console.error(`Unknown command: ${command}`);
33
+ printHelp();
34
+ process.exitCode = 1;
35
+ return;
36
+ }
37
+ const child = (0, import_node_child_process.spawn)(process.execPath, [(0, import_node_path.join)(__dirname, script), ...args], {
38
+ stdio: "inherit"
39
+ });
40
+ await new Promise((resolve) => {
41
+ child.on("exit", (code, signal) => {
42
+ if (signal) {
43
+ process.kill(process.pid, signal);
44
+ return;
45
+ }
46
+ process.exitCode = code ?? 1;
47
+ resolve();
48
+ });
49
+ });
50
+ }
51
+ main().catch((error) => {
52
+ console.error(error instanceof Error ? error.message : String(error));
53
+ process.exitCode = 1;
54
+ });