realtimex-crm 0.7.1 → 0.7.3

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.
@@ -58,6 +58,9 @@ async function main() {
58
58
  });
59
59
 
60
60
  if (configureNow) {
61
+ console.log("First, ensure you are logged in to the Supabase CLI.");
62
+ console.log("Run `npx supabase login` if you haven't already.");
63
+
61
64
  const supabaseUrl = await input({
62
65
  message: "Supabase URL:",
63
66
  validate: (value) => {
@@ -97,6 +100,70 @@ To configure the app:
97
100
  `;
98
101
  await writeFile(configPath, configContent);
99
102
  console.log(`Configuration details saved to: ${configPath}\n`);
103
+
104
+ // Helper to run supabase commands
105
+ const runSupabaseCommand = async (command, message) => {
106
+ console.log(`\n${message}`);
107
+ const proc = spawn("npx", ["supabase", ...command], {
108
+ stdio: "inherit",
109
+ shell: true,
110
+ });
111
+
112
+ return new Promise((resolve, reject) => {
113
+ proc.on("close", (code) => {
114
+ if (code === 0) {
115
+ console.log(`✅ Supabase command 'supabase ${command.join(' ')}' completed successfully.`);
116
+ resolve();
117
+ } else {
118
+ console.error(`❌ Supabase command 'supabase ${command.join(' ')}' failed with code ${code}.`);
119
+ reject(new Error(`Supabase command failed with code ${code}`));
120
+ }
121
+ });
122
+ proc.on("error", (err) => {
123
+ console.error(`❌ Failed to start Supabase command 'supabase ${command.join(' ')}': ${err.message}`);
124
+ reject(err);
125
+ });
126
+ });
127
+ };
128
+
129
+ // Link the project
130
+ const projectRefMatch = supabaseUrl.match(/https:\/\/([a-zA-Z0-9_-]+)\.supabase\.co/);
131
+ if (projectRefMatch && projectRefMatch[1]) {
132
+ const projectRef = projectRefMatch[1];
133
+ try {
134
+ await runSupabaseCommand(["link", "--project-ref", projectRef], `🔗 Linking to Supabase project '${projectRef}'...`);
135
+
136
+ const runDbPush = await confirm({
137
+ message: "Run `npx supabase db push` to apply migrations?",
138
+ default: false,
139
+ });
140
+
141
+ if (runDbPush) {
142
+ try {
143
+ await runSupabaseCommand(["db", "push"], "🚀 Running `npx supabase db push`...");
144
+ } catch (error) {
145
+ console.error("Continuing without successful db push.");
146
+ }
147
+ }
148
+
149
+ const runFunctionsDeploy = await confirm({
150
+ message: "Run `npx supabase functions deploy` to deploy functions?",
151
+ default: false,
152
+ });
153
+
154
+ if (runFunctionsDeploy) {
155
+ try {
156
+ await runSupabaseCommand(["functions", "deploy"], "🚀 Running `npx supabase functions deploy`...");
157
+ } catch (error) {
158
+ console.error("Continuing without successful functions deploy.");
159
+ }
160
+ }
161
+ } catch (error) {
162
+ console.error("Could not link to Supabase project. Skipping db push and functions deploy.");
163
+ }
164
+ } else {
165
+ console.warn("Could not extract project reference from Supabase URL. Skipping link, db push, and functions deploy.");
166
+ }
100
167
  }
101
168
 
102
169
  console.log("\n🚀 Starting production server...\n");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "realtimex-crm",
3
- "version": "0.7.1",
3
+ "version": "0.7.3",
4
4
  "description": "RealTimeX CRM - A full-featured CRM built with React, shadcn-admin-kit, and Supabase. Fork of Atomic CRM with RealTimeX App SDK integration.",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",