aurabase-js 0.1.0 → 0.3.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/.omc/state/hud-state.json +3 -3
- package/.omc/state/hud-stdin-cache.json +1 -1
- package/dist/cli.d.mts +1 -0
- package/dist/cli.d.ts +1 -0
- package/dist/cli.js +132 -0
- package/dist/cli.mjs +109 -0
- package/lib/aurabase.ts +9 -0
- package/package.json +8 -4
- package/src/cli.ts +130 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
|
-
"timestamp": "2026-03-
|
|
2
|
+
"timestamp": "2026-03-09T12:13:53.326Z",
|
|
3
3
|
"backgroundTasks": [],
|
|
4
|
-
"sessionStartTimestamp": "2026-03-09T11:
|
|
5
|
-
"sessionId": "
|
|
4
|
+
"sessionStartTimestamp": "2026-03-09T11:58:48.482Z",
|
|
5
|
+
"sessionId": "faa7b8297096020e"
|
|
6
6
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"session_id":"
|
|
1
|
+
{"session_id":"1c1e8df6-335a-4058-8bd4-4c0a67d996cd","transcript_path":"C:\\Users\\Jay\\.claude\\projects\\D--000-FrontEnd-242-dino-game\\1c1e8df6-335a-4058-8bd4-4c0a67d996cd.jsonl","cwd":"D:\\000.FrontEnd\\242.dino_game\\packages\\aurabase-js","model":{"id":"GLM-5","display_name":"GLM-5"},"workspace":{"current_dir":"D:\\000.FrontEnd\\242.dino_game\\packages\\aurabase-js","project_dir":"D:\\000.FrontEnd\\242.dino_game","added_dirs":[]},"version":"2.1.71","output_style":{"name":"default"},"cost":{"total_cost_usd":2.2039,"total_duration_ms":1275166,"total_api_duration_ms":583368,"total_lines_added":202,"total_lines_removed":17},"context_window":{"total_input_tokens":66759,"total_output_tokens":12129,"context_window_size":200000,"current_usage":{"input_tokens":948,"output_tokens":71,"cache_creation_input_tokens":0,"cache_read_input_tokens":72000},"used_percentage":36,"remaining_percentage":64},"exceeds_200k_tokens":false}
|
package/dist/cli.d.mts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
package/dist/cli.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
package/dist/cli.js
ADDED
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
"use strict";
|
|
3
|
+
var __create = Object.create;
|
|
4
|
+
var __defProp = Object.defineProperty;
|
|
5
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
6
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
7
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
8
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
9
|
+
var __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
+
for (let key of __getOwnPropNames(from))
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
+
}
|
|
15
|
+
return to;
|
|
16
|
+
};
|
|
17
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
18
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
19
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
20
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
21
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
22
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
23
|
+
mod
|
|
24
|
+
));
|
|
25
|
+
|
|
26
|
+
// src/cli.ts
|
|
27
|
+
var fs = __toESM(require("fs"));
|
|
28
|
+
var path = __toESM(require("path"));
|
|
29
|
+
var TEMPLATES = {
|
|
30
|
+
"lib/aurabase.ts": `import { createClient } from 'aurabase-js';
|
|
31
|
+
|
|
32
|
+
const AURABASE_URL = process.env.NEXT_PUBLIC_AURABASE_URL || 'https://your-project.cloudfront.net';
|
|
33
|
+
const AURABASE_ANON_KEY = process.env.NEXT_PUBLIC_AURABASE_ANON_KEY || '';
|
|
34
|
+
|
|
35
|
+
export const aurabase = createClient({
|
|
36
|
+
url: AURABASE_URL,
|
|
37
|
+
anonKey: AURABASE_ANON_KEY,
|
|
38
|
+
});
|
|
39
|
+
`,
|
|
40
|
+
"lib/supabase.ts": `import { createClient } from 'aurabase-js';
|
|
41
|
+
|
|
42
|
+
const AURABASE_URL = process.env.NEXT_PUBLIC_AURABASE_URL || 'https://your-project.cloudfront.net';
|
|
43
|
+
const AURABASE_ANON_KEY = process.env.NEXT_PUBLIC_AURABASE_ANON_KEY || '';
|
|
44
|
+
|
|
45
|
+
export const supabase = createClient({
|
|
46
|
+
url: AURABASE_URL,
|
|
47
|
+
anonKey: AURABASE_ANON_KEY,
|
|
48
|
+
});
|
|
49
|
+
|
|
50
|
+
// Alias for backward compatibility
|
|
51
|
+
export const aurabase = supabase;
|
|
52
|
+
`
|
|
53
|
+
};
|
|
54
|
+
var ENV_TEMPLATE = `
|
|
55
|
+
# AuraBase Configuration
|
|
56
|
+
# Add these to your .env.local file:
|
|
57
|
+
|
|
58
|
+
NEXT_PUBLIC_AURABASE_URL=https://your-project.cloudfront.net
|
|
59
|
+
NEXT_PUBLIC_AURABASE_ANON_KEY=your-anon-key-here
|
|
60
|
+
`;
|
|
61
|
+
function findProjectRoot() {
|
|
62
|
+
let dir = process.cwd();
|
|
63
|
+
while (dir !== path.dirname(dir)) {
|
|
64
|
+
if (fs.existsSync(path.join(dir, "package.json"))) {
|
|
65
|
+
return dir;
|
|
66
|
+
}
|
|
67
|
+
dir = path.dirname(dir);
|
|
68
|
+
}
|
|
69
|
+
return process.cwd();
|
|
70
|
+
}
|
|
71
|
+
function init(filename = "lib/aurabase.ts") {
|
|
72
|
+
const projectRoot = findProjectRoot();
|
|
73
|
+
const filePath = path.join(projectRoot, filename);
|
|
74
|
+
const dir = path.dirname(filePath);
|
|
75
|
+
if (!fs.existsSync(dir)) {
|
|
76
|
+
fs.mkdirSync(dir, { recursive: true });
|
|
77
|
+
}
|
|
78
|
+
if (fs.existsSync(filePath)) {
|
|
79
|
+
console.log(`\x1B[33m\u26A0 ${filename} already exists. Skipping...\x1B[0m`);
|
|
80
|
+
return;
|
|
81
|
+
}
|
|
82
|
+
const template = TEMPLATES[filename] || TEMPLATES["lib/aurabase.ts"];
|
|
83
|
+
fs.writeFileSync(filePath, template.trim() + "\n");
|
|
84
|
+
console.log(`\x1B[32m\u2713 Created ${filename}\x1B[0m`);
|
|
85
|
+
console.log("\x1B[36m%s\x1B[0m", ENV_TEMPLATE);
|
|
86
|
+
}
|
|
87
|
+
function showHelp() {
|
|
88
|
+
console.log(`
|
|
89
|
+
\x1B[1mAuraBase JS CLI\x1B[0m
|
|
90
|
+
|
|
91
|
+
\x1B[1mUsage:\x1B[0m
|
|
92
|
+
npx aurabase-js init [options]
|
|
93
|
+
|
|
94
|
+
\x1B[1mCommands:\x1B[0m
|
|
95
|
+
init Create lib/aurabase.ts file
|
|
96
|
+
init --supabase Create lib/supabase.ts file (alias name)
|
|
97
|
+
|
|
98
|
+
\x1B[1mOptions:\x1B[0m
|
|
99
|
+
-h, --help Show this help message
|
|
100
|
+
-v, --version Show version
|
|
101
|
+
|
|
102
|
+
\x1B[1mExamples:\x1B[0m
|
|
103
|
+
npx aurabase-js init
|
|
104
|
+
npx aurabase-js init --supabase
|
|
105
|
+
`);
|
|
106
|
+
}
|
|
107
|
+
function showVersion() {
|
|
108
|
+
const pkgPath = path.join(__dirname, "..", "package.json");
|
|
109
|
+
const pkg = JSON.parse(fs.readFileSync(pkgPath, "utf-8"));
|
|
110
|
+
console.log(pkg.version);
|
|
111
|
+
}
|
|
112
|
+
function main() {
|
|
113
|
+
const args = process.argv.slice(2);
|
|
114
|
+
if (args.length === 0 || args.includes("-h") || args.includes("--help")) {
|
|
115
|
+
showHelp();
|
|
116
|
+
return;
|
|
117
|
+
}
|
|
118
|
+
if (args.includes("-v") || args.includes("--version")) {
|
|
119
|
+
showVersion();
|
|
120
|
+
return;
|
|
121
|
+
}
|
|
122
|
+
if (args[0] === "init") {
|
|
123
|
+
const useSupabase = args.includes("--supabase");
|
|
124
|
+
const filename = useSupabase ? "lib/supabase.ts" : "lib/aurabase.ts";
|
|
125
|
+
init(filename);
|
|
126
|
+
return;
|
|
127
|
+
}
|
|
128
|
+
console.log(`\x1B[31mUnknown command: ${args[0]}\x1B[0m`);
|
|
129
|
+
showHelp();
|
|
130
|
+
process.exit(1);
|
|
131
|
+
}
|
|
132
|
+
main();
|
package/dist/cli.mjs
ADDED
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
// src/cli.ts
|
|
4
|
+
import * as fs from "fs";
|
|
5
|
+
import * as path from "path";
|
|
6
|
+
var TEMPLATES = {
|
|
7
|
+
"lib/aurabase.ts": `import { createClient } from 'aurabase-js';
|
|
8
|
+
|
|
9
|
+
const AURABASE_URL = process.env.NEXT_PUBLIC_AURABASE_URL || 'https://your-project.cloudfront.net';
|
|
10
|
+
const AURABASE_ANON_KEY = process.env.NEXT_PUBLIC_AURABASE_ANON_KEY || '';
|
|
11
|
+
|
|
12
|
+
export const aurabase = createClient({
|
|
13
|
+
url: AURABASE_URL,
|
|
14
|
+
anonKey: AURABASE_ANON_KEY,
|
|
15
|
+
});
|
|
16
|
+
`,
|
|
17
|
+
"lib/supabase.ts": `import { createClient } from 'aurabase-js';
|
|
18
|
+
|
|
19
|
+
const AURABASE_URL = process.env.NEXT_PUBLIC_AURABASE_URL || 'https://your-project.cloudfront.net';
|
|
20
|
+
const AURABASE_ANON_KEY = process.env.NEXT_PUBLIC_AURABASE_ANON_KEY || '';
|
|
21
|
+
|
|
22
|
+
export const supabase = createClient({
|
|
23
|
+
url: AURABASE_URL,
|
|
24
|
+
anonKey: AURABASE_ANON_KEY,
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
// Alias for backward compatibility
|
|
28
|
+
export const aurabase = supabase;
|
|
29
|
+
`
|
|
30
|
+
};
|
|
31
|
+
var ENV_TEMPLATE = `
|
|
32
|
+
# AuraBase Configuration
|
|
33
|
+
# Add these to your .env.local file:
|
|
34
|
+
|
|
35
|
+
NEXT_PUBLIC_AURABASE_URL=https://your-project.cloudfront.net
|
|
36
|
+
NEXT_PUBLIC_AURABASE_ANON_KEY=your-anon-key-here
|
|
37
|
+
`;
|
|
38
|
+
function findProjectRoot() {
|
|
39
|
+
let dir = process.cwd();
|
|
40
|
+
while (dir !== path.dirname(dir)) {
|
|
41
|
+
if (fs.existsSync(path.join(dir, "package.json"))) {
|
|
42
|
+
return dir;
|
|
43
|
+
}
|
|
44
|
+
dir = path.dirname(dir);
|
|
45
|
+
}
|
|
46
|
+
return process.cwd();
|
|
47
|
+
}
|
|
48
|
+
function init(filename = "lib/aurabase.ts") {
|
|
49
|
+
const projectRoot = findProjectRoot();
|
|
50
|
+
const filePath = path.join(projectRoot, filename);
|
|
51
|
+
const dir = path.dirname(filePath);
|
|
52
|
+
if (!fs.existsSync(dir)) {
|
|
53
|
+
fs.mkdirSync(dir, { recursive: true });
|
|
54
|
+
}
|
|
55
|
+
if (fs.existsSync(filePath)) {
|
|
56
|
+
console.log(`\x1B[33m\u26A0 ${filename} already exists. Skipping...\x1B[0m`);
|
|
57
|
+
return;
|
|
58
|
+
}
|
|
59
|
+
const template = TEMPLATES[filename] || TEMPLATES["lib/aurabase.ts"];
|
|
60
|
+
fs.writeFileSync(filePath, template.trim() + "\n");
|
|
61
|
+
console.log(`\x1B[32m\u2713 Created ${filename}\x1B[0m`);
|
|
62
|
+
console.log("\x1B[36m%s\x1B[0m", ENV_TEMPLATE);
|
|
63
|
+
}
|
|
64
|
+
function showHelp() {
|
|
65
|
+
console.log(`
|
|
66
|
+
\x1B[1mAuraBase JS CLI\x1B[0m
|
|
67
|
+
|
|
68
|
+
\x1B[1mUsage:\x1B[0m
|
|
69
|
+
npx aurabase-js init [options]
|
|
70
|
+
|
|
71
|
+
\x1B[1mCommands:\x1B[0m
|
|
72
|
+
init Create lib/aurabase.ts file
|
|
73
|
+
init --supabase Create lib/supabase.ts file (alias name)
|
|
74
|
+
|
|
75
|
+
\x1B[1mOptions:\x1B[0m
|
|
76
|
+
-h, --help Show this help message
|
|
77
|
+
-v, --version Show version
|
|
78
|
+
|
|
79
|
+
\x1B[1mExamples:\x1B[0m
|
|
80
|
+
npx aurabase-js init
|
|
81
|
+
npx aurabase-js init --supabase
|
|
82
|
+
`);
|
|
83
|
+
}
|
|
84
|
+
function showVersion() {
|
|
85
|
+
const pkgPath = path.join(__dirname, "..", "package.json");
|
|
86
|
+
const pkg = JSON.parse(fs.readFileSync(pkgPath, "utf-8"));
|
|
87
|
+
console.log(pkg.version);
|
|
88
|
+
}
|
|
89
|
+
function main() {
|
|
90
|
+
const args = process.argv.slice(2);
|
|
91
|
+
if (args.length === 0 || args.includes("-h") || args.includes("--help")) {
|
|
92
|
+
showHelp();
|
|
93
|
+
return;
|
|
94
|
+
}
|
|
95
|
+
if (args.includes("-v") || args.includes("--version")) {
|
|
96
|
+
showVersion();
|
|
97
|
+
return;
|
|
98
|
+
}
|
|
99
|
+
if (args[0] === "init") {
|
|
100
|
+
const useSupabase = args.includes("--supabase");
|
|
101
|
+
const filename = useSupabase ? "lib/supabase.ts" : "lib/aurabase.ts";
|
|
102
|
+
init(filename);
|
|
103
|
+
return;
|
|
104
|
+
}
|
|
105
|
+
console.log(`\x1B[31mUnknown command: ${args[0]}\x1B[0m`);
|
|
106
|
+
showHelp();
|
|
107
|
+
process.exit(1);
|
|
108
|
+
}
|
|
109
|
+
main();
|
package/lib/aurabase.ts
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { createClient } from 'aurabase-js';
|
|
2
|
+
|
|
3
|
+
const AURABASE_URL = process.env.NEXT_PUBLIC_AURABASE_URL || 'https://your-project.cloudfront.net';
|
|
4
|
+
const AURABASE_ANON_KEY = process.env.NEXT_PUBLIC_AURABASE_ANON_KEY || '';
|
|
5
|
+
|
|
6
|
+
export const aurabase = createClient({
|
|
7
|
+
url: AURABASE_URL,
|
|
8
|
+
anonKey: AURABASE_ANON_KEY,
|
|
9
|
+
});
|
package/package.json
CHANGED
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "aurabase-js",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0",
|
|
4
4
|
"description": "AuraBase client library - Supabase-style SDK for AuraBase",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.mjs",
|
|
7
7
|
"types": "dist/index.d.ts",
|
|
8
|
+
"bin": {
|
|
9
|
+
"aurabase-js": "dist/cli.js"
|
|
10
|
+
},
|
|
8
11
|
"exports": {
|
|
9
12
|
".": {
|
|
10
13
|
"types": "./dist/index.d.ts",
|
|
@@ -13,9 +16,10 @@
|
|
|
13
16
|
}
|
|
14
17
|
},
|
|
15
18
|
"scripts": {
|
|
16
|
-
"build": "tsup src/index.ts --format cjs,esm --dts",
|
|
17
|
-
"dev": "tsup src/index.ts --format cjs,esm --dts --watch",
|
|
18
|
-
"prepublishOnly": "npm run build"
|
|
19
|
+
"build": "tsup src/index.ts src/cli.ts --format cjs,esm --dts",
|
|
20
|
+
"dev": "tsup src/index.ts src/cli.ts --format cjs,esm --dts --watch",
|
|
21
|
+
"prepublishOnly": "npm run build",
|
|
22
|
+
"postinstall": "node dist/cli.js init"
|
|
19
23
|
},
|
|
20
24
|
"keywords": [
|
|
21
25
|
"aurabase",
|
package/src/cli.ts
ADDED
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
import * as fs from 'fs';
|
|
4
|
+
import * as path from 'path';
|
|
5
|
+
|
|
6
|
+
const TEMPLATES = {
|
|
7
|
+
'lib/aurabase.ts': `import { createClient } from 'aurabase-js';
|
|
8
|
+
|
|
9
|
+
const AURABASE_URL = process.env.NEXT_PUBLIC_AURABASE_URL || 'https://your-project.cloudfront.net';
|
|
10
|
+
const AURABASE_ANON_KEY = process.env.NEXT_PUBLIC_AURABASE_ANON_KEY || '';
|
|
11
|
+
|
|
12
|
+
export const aurabase = createClient({
|
|
13
|
+
url: AURABASE_URL,
|
|
14
|
+
anonKey: AURABASE_ANON_KEY,
|
|
15
|
+
});
|
|
16
|
+
`,
|
|
17
|
+
'lib/supabase.ts': `import { createClient } from 'aurabase-js';
|
|
18
|
+
|
|
19
|
+
const AURABASE_URL = process.env.NEXT_PUBLIC_AURABASE_URL || 'https://your-project.cloudfront.net';
|
|
20
|
+
const AURABASE_ANON_KEY = process.env.NEXT_PUBLIC_AURABASE_ANON_KEY || '';
|
|
21
|
+
|
|
22
|
+
export const supabase = createClient({
|
|
23
|
+
url: AURABASE_URL,
|
|
24
|
+
anonKey: AURABASE_ANON_KEY,
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
// Alias for backward compatibility
|
|
28
|
+
export const aurabase = supabase;
|
|
29
|
+
`,
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
const ENV_TEMPLATE = `
|
|
33
|
+
# AuraBase Configuration
|
|
34
|
+
# Add these to your .env.local file:
|
|
35
|
+
|
|
36
|
+
NEXT_PUBLIC_AURABASE_URL=https://your-project.cloudfront.net
|
|
37
|
+
NEXT_PUBLIC_AURABASE_ANON_KEY=your-anon-key-here
|
|
38
|
+
`;
|
|
39
|
+
|
|
40
|
+
function findProjectRoot(): string {
|
|
41
|
+
let dir = process.cwd();
|
|
42
|
+
while (dir !== path.dirname(dir)) {
|
|
43
|
+
if (fs.existsSync(path.join(dir, 'package.json'))) {
|
|
44
|
+
return dir;
|
|
45
|
+
}
|
|
46
|
+
dir = path.dirname(dir);
|
|
47
|
+
}
|
|
48
|
+
return process.cwd();
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
function init(filename: string = 'lib/aurabase.ts') {
|
|
52
|
+
const projectRoot = findProjectRoot();
|
|
53
|
+
const filePath = path.join(projectRoot, filename);
|
|
54
|
+
const dir = path.dirname(filePath);
|
|
55
|
+
|
|
56
|
+
// Create directory if it doesn't exist
|
|
57
|
+
if (!fs.existsSync(dir)) {
|
|
58
|
+
fs.mkdirSync(dir, { recursive: true });
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
// Check if file already exists
|
|
62
|
+
if (fs.existsSync(filePath)) {
|
|
63
|
+
console.log(`\x1b[33m⚠ ${filename} already exists. Skipping...\x1b[0m`);
|
|
64
|
+
return;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
// Get template content
|
|
68
|
+
const template = TEMPLATES[filename as keyof typeof TEMPLATES] || TEMPLATES['lib/aurabase.ts'];
|
|
69
|
+
|
|
70
|
+
// Write file
|
|
71
|
+
fs.writeFileSync(filePath, template.trim() + '\n');
|
|
72
|
+
console.log(`\x1b[32m✓ Created ${filename}\x1b[0m`);
|
|
73
|
+
|
|
74
|
+
// Show env template
|
|
75
|
+
console.log('\x1b[36m%s\x1b[0m', ENV_TEMPLATE);
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
function showHelp() {
|
|
79
|
+
console.log(`
|
|
80
|
+
\x1b[1mAuraBase JS CLI\x1b[0m
|
|
81
|
+
|
|
82
|
+
\x1b[1mUsage:\x1b[0m
|
|
83
|
+
npx aurabase-js init [options]
|
|
84
|
+
|
|
85
|
+
\x1b[1mCommands:\x1b[0m
|
|
86
|
+
init Create lib/aurabase.ts file
|
|
87
|
+
init --supabase Create lib/supabase.ts file (alias name)
|
|
88
|
+
|
|
89
|
+
\x1b[1mOptions:\x1b[0m
|
|
90
|
+
-h, --help Show this help message
|
|
91
|
+
-v, --version Show version
|
|
92
|
+
|
|
93
|
+
\x1b[1mExamples:\x1b[0m
|
|
94
|
+
npx aurabase-js init
|
|
95
|
+
npx aurabase-js init --supabase
|
|
96
|
+
`);
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
function showVersion() {
|
|
100
|
+
const pkgPath = path.join(__dirname, '..', 'package.json');
|
|
101
|
+
const pkg = JSON.parse(fs.readFileSync(pkgPath, 'utf-8'));
|
|
102
|
+
console.log(pkg.version);
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
function main() {
|
|
106
|
+
const args = process.argv.slice(2);
|
|
107
|
+
|
|
108
|
+
if (args.length === 0 || args.includes('-h') || args.includes('--help')) {
|
|
109
|
+
showHelp();
|
|
110
|
+
return;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
if (args.includes('-v') || args.includes('--version')) {
|
|
114
|
+
showVersion();
|
|
115
|
+
return;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
if (args[0] === 'init') {
|
|
119
|
+
const useSupabase = args.includes('--supabase');
|
|
120
|
+
const filename = useSupabase ? 'lib/supabase.ts' : 'lib/aurabase.ts';
|
|
121
|
+
init(filename);
|
|
122
|
+
return;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
console.log(`\x1b[31mUnknown command: ${args[0]}\x1b[0m`);
|
|
126
|
+
showHelp();
|
|
127
|
+
process.exit(1);
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
main();
|