@rimori/client 2.5.32 → 2.5.33-next.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.
Files changed (28) hide show
  1. package/dist/cli/scripts/init/dev-registration.js +118 -136
  2. package/dist/cli/scripts/init/main.js +116 -127
  3. package/dist/cli/scripts/init/package-setup.js +15 -2
  4. package/dist/cli/scripts/release/detect-translation-languages.js +24 -35
  5. package/dist/cli/scripts/release/release-config-upload.js +87 -100
  6. package/dist/cli/scripts/release/release-db-update.js +70 -81
  7. package/dist/cli/scripts/release/release-file-upload.js +75 -91
  8. package/dist/cli/scripts/release/release-prompts-upload.js +60 -72
  9. package/dist/cli/scripts/release/release.js +20 -31
  10. package/dist/controller/AccomplishmentController.js +12 -12
  11. package/dist/controller/AudioController.js +15 -33
  12. package/dist/controller/TranslationController.js +108 -118
  13. package/dist/fromRimori/EventBus.js +20 -31
  14. package/dist/plugin/CommunicationHandler.js +73 -81
  15. package/dist/plugin/Logger.js +71 -83
  16. package/dist/plugin/RimoriClient.js +31 -31
  17. package/dist/plugin/StandaloneClient.js +81 -98
  18. package/dist/plugin/TTS/ChunkedAudioPlayer.js +31 -41
  19. package/dist/plugin/TTS/MessageSender.js +28 -37
  20. package/dist/plugin/module/AIModule.js +215 -237
  21. package/dist/plugin/module/DbModule.js +22 -31
  22. package/dist/plugin/module/EventModule.js +23 -32
  23. package/dist/plugin/module/ExerciseModule.js +42 -56
  24. package/dist/plugin/module/PluginModule.js +97 -106
  25. package/dist/plugin/module/SharedContentController.js +170 -207
  26. package/dist/plugin/module/StorageModule.js +18 -29
  27. package/dist/worker/WorkerSetup.js +23 -34
  28. package/package.json +1 -1
@@ -1,12 +1,3 @@
1
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
- return new (P || (P = Promise))(function (resolve, reject) {
4
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
- step((generator = generator.apply(thisArg, _arguments || [])).next());
8
- });
9
- };
10
1
  // import { createClient } from '@supabase/supabase-js';
11
2
  import path from 'path';
12
3
  import * as readline from 'readline';
@@ -15,60 +6,58 @@ import { DEFAULT_ANON_KEY, DEFAULT_ENDPOINT } from '../../../utils/endpoint.js';
15
6
  * Prompts user for email and password credentials.
16
7
  * @returns Promise resolving to user credentials.
17
8
  */
18
- export function askForCredentials() {
19
- return __awaiter(this, void 0, void 0, function* () {
20
- const rl = readline.createInterface({
21
- input: process.stdin,
22
- output: process.stdout,
23
- });
24
- return new Promise((resolve) => {
25
- rl.question('Enter your email: ', (email) => {
26
- rl.close();
27
- // Create a new interface for password input with muted output
28
- const passwordRl = readline.createInterface({
29
- input: process.stdin,
30
- output: process.stdout,
31
- terminal: false,
32
- });
33
- process.stdout.write('Enter your password: ');
34
- // Set up stdin for raw input
35
- process.stdin.setRawMode(true);
36
- process.stdin.resume();
37
- let password = '';
38
- const onData = (buffer) => {
39
- const char = buffer.toString('utf8');
40
- if (char === '\r' || char === '\n') {
41
- // Enter pressed
42
- process.stdin.setRawMode(false);
43
- process.stdin.pause();
44
- process.stdin.removeListener('data', onData);
45
- process.stdout.write('\n');
46
- passwordRl.close();
47
- resolve({ email: email.trim(), password: password.trim() });
48
- }
49
- else if (char === '\u0003') {
50
- // Ctrl+C
51
- process.stdin.setRawMode(false);
52
- process.stdin.pause();
53
- process.stdin.removeListener('data', onData);
54
- process.stdout.write('\n');
55
- process.exit(0);
56
- }
57
- else if (char === '\u007f' || char === '\b') {
58
- // Backspace
59
- if (password.length > 0) {
60
- password = password.slice(0, -1);
61
- process.stdout.write('\b \b');
62
- }
63
- }
64
- else if (char.charCodeAt(0) >= 32 && char.charCodeAt(0) <= 126) {
65
- // Printable characters
66
- password += char;
67
- process.stdout.write('*');
68
- }
69
- };
70
- process.stdin.on('data', onData);
9
+ export async function askForCredentials() {
10
+ const rl = readline.createInterface({
11
+ input: process.stdin,
12
+ output: process.stdout,
13
+ });
14
+ return new Promise((resolve) => {
15
+ rl.question('Enter your email: ', (email) => {
16
+ rl.close();
17
+ // Create a new interface for password input with muted output
18
+ const passwordRl = readline.createInterface({
19
+ input: process.stdin,
20
+ output: process.stdout,
21
+ terminal: false,
71
22
  });
23
+ process.stdout.write('Enter your password: ');
24
+ // Set up stdin for raw input
25
+ process.stdin.setRawMode(true);
26
+ process.stdin.resume();
27
+ let password = '';
28
+ const onData = (buffer) => {
29
+ const char = buffer.toString('utf8');
30
+ if (char === '\r' || char === '\n') {
31
+ // Enter pressed
32
+ process.stdin.setRawMode(false);
33
+ process.stdin.pause();
34
+ process.stdin.removeListener('data', onData);
35
+ process.stdout.write('\n');
36
+ passwordRl.close();
37
+ resolve({ email: email.trim(), password: password.trim() });
38
+ }
39
+ else if (char === '\u0003') {
40
+ // Ctrl+C
41
+ process.stdin.setRawMode(false);
42
+ process.stdin.pause();
43
+ process.stdin.removeListener('data', onData);
44
+ process.stdout.write('\n');
45
+ process.exit(0);
46
+ }
47
+ else if (char === '\u007f' || char === '\b') {
48
+ // Backspace
49
+ if (password.length > 0) {
50
+ password = password.slice(0, -1);
51
+ process.stdout.write('\b \b');
52
+ }
53
+ }
54
+ else if (char.charCodeAt(0) >= 32 && char.charCodeAt(0) <= 126) {
55
+ // Printable characters
56
+ password += char;
57
+ process.stdout.write('*');
58
+ }
59
+ };
60
+ process.stdin.on('data', onData);
72
61
  });
73
62
  });
74
63
  }
@@ -76,24 +65,22 @@ export function askForCredentials() {
76
65
  * Prompts user for development port with default value.
77
66
  * @returns Promise resolving to the selected port.
78
67
  */
79
- export function askForPort() {
80
- return __awaiter(this, void 0, void 0, function* () {
81
- const rl = readline.createInterface({
82
- input: process.stdin,
83
- output: process.stdout,
84
- });
85
- return new Promise((resolve) => {
86
- rl.question('Enter development port (default: 3000): ', (answer) => {
87
- rl.close();
88
- const port = answer.trim() || '3000';
89
- // Validate port is a number
90
- const portNumber = parseInt(port, 10);
91
- if (isNaN(portNumber) || portNumber < 1 || portNumber > 65535) {
92
- console.error('Error: Port must be a valid number between 1 and 65535');
93
- process.exit(1);
94
- }
95
- resolve(portNumber);
96
- });
68
+ export async function askForPort() {
69
+ const rl = readline.createInterface({
70
+ input: process.stdin,
71
+ output: process.stdout,
72
+ });
73
+ return new Promise((resolve) => {
74
+ rl.question('Enter development port (default: 3000): ', (answer) => {
75
+ rl.close();
76
+ const port = answer.trim() || '3000';
77
+ // Validate port is a number
78
+ const portNumber = parseInt(port, 10);
79
+ if (isNaN(portNumber) || portNumber < 1 || portNumber > 65535) {
80
+ console.error('Error: Port must be a valid number between 1 and 65535');
81
+ process.exit(1);
82
+ }
83
+ resolve(portNumber);
97
84
  });
98
85
  });
99
86
  }
@@ -105,34 +92,31 @@ export function askForPort() {
105
92
  * @returns Promise resolving to JWT access token.
106
93
  * @throws {Error} if authentication fails.
107
94
  */
108
- export function authenticateWithSupabase(_a) {
109
- return __awaiter(this, arguments, void 0, function* ({ email, password }) {
110
- var _b;
111
- console.log('🔐 Authenticating with Supabase...');
112
- // Initialize Supabase client (you may need to adjust the URL and key)
113
- const supabaseUrl = process.env.SUPABASE_URL || DEFAULT_ENDPOINT;
114
- const supabaseKey = process.env.SUPABASE_ANON_KEY || DEFAULT_ANON_KEY;
115
- throw new Error('Authentication is disabled until new developer platform is released.');
116
- // const supabase = createClient(supabaseUrl, supabaseKey);
117
- const supabase = {};
118
- try {
119
- const { data, error } = yield supabase.auth.signInWithPassword({
120
- email,
121
- password,
122
- });
123
- if (error) {
124
- throw new Error(`Authentication failed: ${error.message}`);
125
- }
126
- if (!((_b = data.session) === null || _b === void 0 ? void 0 : _b.access_token)) {
127
- throw new Error('No access token received from authentication');
128
- }
129
- console.log('✅ Supabase authentication successful!');
130
- return data.session.access_token;
95
+ export async function authenticateWithSupabase({ email, password }) {
96
+ console.log('🔐 Authenticating with Supabase...');
97
+ // Initialize Supabase client (you may need to adjust the URL and key)
98
+ const supabaseUrl = process.env.SUPABASE_URL || DEFAULT_ENDPOINT;
99
+ const supabaseKey = process.env.SUPABASE_ANON_KEY || DEFAULT_ANON_KEY;
100
+ throw new Error('Authentication is disabled until new developer platform is released.');
101
+ // const supabase = createClient(supabaseUrl, supabaseKey);
102
+ const supabase = {};
103
+ try {
104
+ const { data, error } = await supabase.auth.signInWithPassword({
105
+ email,
106
+ password,
107
+ });
108
+ if (error) {
109
+ throw new Error(`Authentication failed: ${error.message}`);
131
110
  }
132
- catch (error) {
133
- throw new Error(`Supabase authentication failed: ${error}`);
111
+ if (!data.session?.access_token) {
112
+ throw new Error('No access token received from authentication');
134
113
  }
135
- });
114
+ console.log('✅ Supabase authentication successful!');
115
+ return data.session.access_token;
116
+ }
117
+ catch (error) {
118
+ throw new Error(`Supabase authentication failed: ${error}`);
119
+ }
136
120
  }
137
121
  /**
138
122
  * Registers developer and gets plugin credentials from the backend.
@@ -141,36 +125,34 @@ export function authenticateWithSupabase(_a) {
141
125
  * @returns Promise resolving to plugin ID and access token.
142
126
  * @throws {Error} if registration request fails.
143
127
  */
144
- export function registerDeveloper(jwtToken, port) {
145
- return __awaiter(this, void 0, void 0, function* () {
146
- console.log('🚀 Registering developer and creating plugin...');
147
- try {
148
- const currentFolderName = path.basename(process.cwd());
149
- const body = { port, pluginName: currentFolderName };
150
- const backendUrl = process.env.RIMORI_BACKEND_URL || 'https://api.rimori.se';
151
- const response = yield fetch(backendUrl + '/developer/register', {
152
- method: 'POST',
153
- headers: {
154
- 'Content-Type': 'application/json',
155
- Authorization: `Bearer ${jwtToken}`,
156
- },
157
- body: JSON.stringify(body),
158
- });
159
- if (!response.ok) {
160
- console.error(yield response.text());
161
- throw new Error(`HTTP error! status: ${response.status}`);
162
- }
163
- const data = yield response.json();
164
- if (!data.plugin_id || !data.access_token) {
165
- throw new Error('Invalid response: missing pluginId or access_token');
166
- }
167
- console.log('✅ Plugin registration successful!');
168
- console.log(`Plugin ID: ${data.plugin_id}`);
169
- return data;
128
+ export async function registerDeveloper(jwtToken, port) {
129
+ console.log('🚀 Registering developer and creating plugin...');
130
+ try {
131
+ const currentFolderName = path.basename(process.cwd());
132
+ const body = { port, pluginName: currentFolderName };
133
+ const backendUrl = process.env.RIMORI_BACKEND_URL || 'https://api.rimori.se';
134
+ const response = await fetch(backendUrl + '/developer/register', {
135
+ method: 'POST',
136
+ headers: {
137
+ 'Content-Type': 'application/json',
138
+ Authorization: `Bearer ${jwtToken}`,
139
+ },
140
+ body: JSON.stringify(body),
141
+ });
142
+ if (!response.ok) {
143
+ console.error(await response.text());
144
+ throw new Error(`HTTP error! status: ${response.status}`);
170
145
  }
171
- catch (error) {
172
- console.error(error);
173
- throw new Error(`Developer registration failed: ${error}`);
146
+ const data = await response.json();
147
+ if (!data.plugin_id || !data.access_token) {
148
+ throw new Error('Invalid response: missing pluginId or access_token');
174
149
  }
175
- });
150
+ console.log('✅ Plugin registration successful!');
151
+ console.log(`Plugin ID: ${data.plugin_id}`);
152
+ return data;
153
+ }
154
+ catch (error) {
155
+ console.error(error);
156
+ throw new Error(`Developer registration failed: ${error}`);
157
+ }
176
158
  }
@@ -1,13 +1,4 @@
1
1
  #!/usr/bin/env node
2
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
- return new (P || (P = Promise))(function (resolve, reject) {
5
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
- step((generator = generator.apply(thisArg, _arguments || [])).next());
9
- });
10
- };
11
2
  import * as fs from 'fs';
12
3
  import * as path from 'path';
13
4
  import { askForCredentials, askForPort, authenticateWithSupabase, registerDeveloper } from './dev-registration.js';
@@ -22,140 +13,138 @@ import 'dotenv/config';
22
13
  /**
23
14
  * Main function that handles the complete plugin setup flow.
24
15
  */
25
- function main() {
26
- return __awaiter(this, void 0, void 0, function* () {
27
- try {
28
- // Check for --upgrade flag
29
- const isUpgrade = process.argv.includes('--upgrade');
30
- if (isUpgrade) {
31
- console.log('🔄 Starting Rimori Plugin Upgrade...');
32
- }
33
- else {
34
- console.log('🎯 Starting Rimori Plugin Setup...');
35
- }
36
- console.log('');
37
- // Check if plugin is already initialized (skip for upgrade mode)
38
- if (!isUpgrade) {
39
- const packageJsonPath = path.resolve('./package.json');
40
- if (fs.existsSync(packageJsonPath)) {
41
- try {
42
- const packageJson = JSON.parse(fs.readFileSync(packageJsonPath, 'utf8'));
43
- if (packageJson.r_id) {
44
- console.log('❌ Plugin is already initialized!');
45
- console.log(`Plugin ID: ${packageJson.r_id}`);
46
- console.log('');
47
- console.log('If you want to reinitialize the plugin, please remove the "r_id" field from package.json first.');
48
- console.log('Or use the --upgrade flag to upgrade the plugin configuration without changing the plugin ID.');
49
- process.exit(0);
50
- }
51
- }
52
- catch (error) {
53
- console.warn('Warning: Could not read package.json, continuing with setup...');
54
- }
55
- }
56
- }
57
- let pluginId = '';
58
- if (isUpgrade) {
59
- // For upgrade mode, only ask for port and setup plugin
60
- console.log('🔄 Upgrade mode: Skipping authentication and plugin registration...');
61
- console.log('');
62
- // Get plugin ID from existing package.json
16
+ async function main() {
17
+ try {
18
+ // Check for --upgrade flag
19
+ const isUpgrade = process.argv.includes('--upgrade');
20
+ if (isUpgrade) {
21
+ console.log('🔄 Starting Rimori Plugin Upgrade...');
22
+ }
23
+ else {
24
+ console.log('🎯 Starting Rimori Plugin Setup...');
25
+ }
26
+ console.log('');
27
+ // Check if plugin is already initialized (skip for upgrade mode)
28
+ if (!isUpgrade) {
29
+ const packageJsonPath = path.resolve('./package.json');
30
+ if (fs.existsSync(packageJsonPath)) {
63
31
  try {
64
- const packageJsonPath = path.resolve('./package.json');
65
32
  const packageJson = JSON.parse(fs.readFileSync(packageJsonPath, 'utf8'));
66
- pluginId = packageJson.r_id || '';
33
+ if (packageJson.r_id) {
34
+ console.log('❌ Plugin is already initialized!');
35
+ console.log(`Plugin ID: ${packageJson.r_id}`);
36
+ console.log('');
37
+ console.log('If you want to reinitialize the plugin, please remove the "r_id" field from package.json first.');
38
+ console.log('Or use the --upgrade flag to upgrade the plugin configuration without changing the plugin ID.');
39
+ process.exit(0);
40
+ }
67
41
  }
68
42
  catch (error) {
69
- console.warn('Warning: Could not read plugin ID from package.json');
43
+ console.warn('Warning: Could not read package.json, continuing with setup...');
70
44
  }
71
- // Ask for development port
72
- const port = yield askForPort();
73
- console.log('');
74
- // Update package.json in upgrade mode
75
- updatePackageJson({
76
- port,
77
- isUpgrade: true,
78
- });
79
- // Copy files
80
- copyPluginFiles();
81
- // Update gitignore
82
- updateGitignore();
83
45
  }
84
- else {
85
- throw new Error('Registration is disabled until new developer platform is released.');
86
- // Step 1: Get user credentials
87
- const credentials = yield askForCredentials();
88
- console.log('');
89
- // Step 2: Authenticate with Supabase
90
- const jwtToken = yield authenticateWithSupabase(credentials);
91
- console.log('');
92
- // Step 3: Ask for development port
93
- const port = yield askForPort();
94
- console.log('');
95
- // Step 4: Register developer and get plugin credentials
96
- const { plugin_id, access_token } = yield registerDeveloper(jwtToken, port);
97
- pluginId = plugin_id;
98
- console.log('');
99
- // Step 5: Update package.json
100
- updatePackageJson({
101
- pluginId: plugin_id,
102
- port,
103
- isUpgrade: false,
104
- });
105
- // Step 6: Setup environment file
106
- setupEnvFile(access_token);
107
- // Step 7: Copy necessary files
108
- copyPluginFiles();
109
- // Step 8: Update gitignore
110
- updateGitignore();
111
- }
112
- // Setup vite config base
46
+ }
47
+ let pluginId = '';
48
+ if (isUpgrade) {
49
+ // For upgrade mode, only ask for port and setup plugin
50
+ console.log('🔄 Upgrade mode: Skipping authentication and plugin registration...');
51
+ console.log('');
52
+ // Get plugin ID from existing package.json
113
53
  try {
114
- console.log('Updating vite config base...');
115
- updateViteConfigBase();
116
- console.log('✅ Vite config base updated');
54
+ const packageJsonPath = path.resolve('./package.json');
55
+ const packageJson = JSON.parse(fs.readFileSync(packageJsonPath, 'utf8'));
56
+ pluginId = packageJson.r_id || '';
117
57
  }
118
58
  catch (error) {
119
- console.warn(`Warning: Could not update vite.config.ts base property: ${error instanceof Error ? error.message : error}`);
120
- }
121
- // Clean meta tags from index.html after vite adaptation
122
- cleanHtmlMetaTags();
123
- console.log('✅ Meta tags cleaned from index.html');
124
- // Update Tailwind CSS configuration
125
- updateTailwindConfig();
126
- // Transform App.tsx to use PluginProvider with HashRouter
127
- if (pluginId) {
128
- try {
129
- transformAppRouter(pluginId);
130
- }
131
- catch (error) {
132
- console.warn(`Warning: Could not transform App.tsx router: ${error instanceof Error ? error.message : error}`);
133
- }
134
- }
135
- else {
136
- console.warn('Warning: Plugin ID not available, skipping router transformation');
59
+ console.warn('Warning: Could not read plugin ID from package.json');
137
60
  }
61
+ // Ask for development port
62
+ const port = await askForPort();
63
+ console.log('');
64
+ // Update package.json in upgrade mode
65
+ updatePackageJson({
66
+ port,
67
+ isUpgrade: true,
68
+ });
69
+ // Copy files
70
+ copyPluginFiles();
71
+ // Update gitignore
72
+ updateGitignore();
73
+ }
74
+ else {
75
+ throw new Error('Registration is disabled until new developer platform is released.');
76
+ // Step 1: Get user credentials
77
+ const credentials = await askForCredentials();
138
78
  console.log('');
139
- console.log('✅ Plugin ' + (isUpgrade ? 'upgrade' : 'setup') + ' completed successfully!');
79
+ // Step 2: Authenticate with Supabase
80
+ const jwtToken = await authenticateWithSupabase(credentials);
140
81
  console.log('');
141
- console.log('Next steps:');
142
- console.log('1. Check out ./rimori/readme.md for more information about how to make the most out of the plugin.');
143
- console.log('2. Adapt the ./rimori/rimori.config.ts file to your needs.');
144
- console.log('3. Under ./public/docs/ you can find the documentation for an example flashcard plugin to get started easier.');
145
- console.log('4. Start development with: yarn dev');
82
+ // Step 3: Ask for development port
83
+ const port = await askForPort();
146
84
  console.log('');
147
- console.log(`The plugin should now be accessible at: http://localhost:${3000}`);
85
+ // Step 4: Register developer and get plugin credentials
86
+ const { plugin_id, access_token } = await registerDeveloper(jwtToken, port);
87
+ pluginId = plugin_id;
148
88
  console.log('');
149
- console.log('If you want to release the plugin, simply run: "yarn release:<alpha|beta|stable>" (details are available in ./rimori/readme.md)');
89
+ // Step 5: Update package.json
90
+ updatePackageJson({
91
+ pluginId: plugin_id,
92
+ port,
93
+ isUpgrade: false,
94
+ });
95
+ // Step 6: Setup environment file
96
+ setupEnvFile(access_token);
97
+ // Step 7: Copy necessary files
98
+ copyPluginFiles();
99
+ // Step 8: Update gitignore
100
+ updateGitignore();
101
+ }
102
+ // Setup vite config base
103
+ try {
104
+ console.log('Updating vite config base...');
105
+ updateViteConfigBase();
106
+ console.log('✅ Vite config base updated');
150
107
  }
151
108
  catch (error) {
152
- console.error(`❌ Error: ${error instanceof Error ? error.message : error}`);
153
- console.error('');
154
- console.error('Make sure that:');
155
- console.error('1. Your Supabase credentials are correct');
156
- console.error('2. You have internet connection for authentication');
157
- process.exit(1);
109
+ console.warn(`Warning: Could not update vite.config.ts base property: ${error instanceof Error ? error.message : error}`);
110
+ }
111
+ // Clean meta tags from index.html after vite adaptation
112
+ cleanHtmlMetaTags();
113
+ console.log(' Meta tags cleaned from index.html');
114
+ // Update Tailwind CSS configuration
115
+ updateTailwindConfig();
116
+ // Transform App.tsx to use PluginProvider with HashRouter
117
+ if (pluginId) {
118
+ try {
119
+ transformAppRouter(pluginId);
120
+ }
121
+ catch (error) {
122
+ console.warn(`Warning: Could not transform App.tsx router: ${error instanceof Error ? error.message : error}`);
123
+ }
124
+ }
125
+ else {
126
+ console.warn('Warning: Plugin ID not available, skipping router transformation');
158
127
  }
159
- });
128
+ console.log('');
129
+ console.log('✅ Plugin ' + (isUpgrade ? 'upgrade' : 'setup') + ' completed successfully!');
130
+ console.log('');
131
+ console.log('Next steps:');
132
+ console.log('1. Check out ./rimori/readme.md for more information about how to make the most out of the plugin.');
133
+ console.log('2. Adapt the ./rimori/rimori.config.ts file to your needs.');
134
+ console.log('3. Under ./public/docs/ you can find the documentation for an example flashcard plugin to get started easier.');
135
+ console.log('4. Start development with: yarn dev');
136
+ console.log('');
137
+ console.log(`The plugin should now be accessible at: http://localhost:${3000}`);
138
+ console.log('');
139
+ console.log('If you want to release the plugin, simply run: "yarn release:<alpha|beta|stable>" (details are available in ./rimori/readme.md)');
140
+ }
141
+ catch (error) {
142
+ console.error(`❌ Error: ${error instanceof Error ? error.message : error}`);
143
+ console.error('');
144
+ console.error('Make sure that:');
145
+ console.error('1. Your Supabase credentials are correct');
146
+ console.error('2. You have internet connection for authentication');
147
+ process.exit(1);
148
+ }
160
149
  }
161
150
  main();
@@ -62,8 +62,21 @@ export function updatePackageJson({ pluginId, port, isUpgrade = false }) {
62
62
  if (pluginId) {
63
63
  packageJson.r_id = pluginId;
64
64
  }
65
- packageJson.scripts = Object.assign(Object.assign({}, packageJson.scripts), { dev: `vite --port ${port || 3000}`, build: 'yarn run check && vite build', check: 'tsc --project tsconfig.app.json --noEmit --pretty', 'release:alpha': 'yarn build && yarn rimori-release alpha', 'release:beta': 'yarn build && yarn rimori-release beta', 'release:stable': 'yarn build && yarn rimori-release stable', 'dev:worker': 'VITE_MINIFY=false vite build --watch --config worker/vite.config.ts', 'build:worker': 'vite build --config worker/vite.config.ts' });
66
- packageJson.dependencies = Object.assign(Object.assign({}, packageJson.dependencies), { '@rimori/client': rimoriClientVersion });
65
+ packageJson.scripts = {
66
+ ...packageJson.scripts,
67
+ dev: `vite --port ${port || 3000}`,
68
+ build: 'yarn run check && vite build',
69
+ check: 'tsc --project tsconfig.app.json --noEmit --pretty',
70
+ 'release:alpha': 'yarn build && yarn rimori-release alpha',
71
+ 'release:beta': 'yarn build && yarn rimori-release beta',
72
+ 'release:stable': 'yarn build && yarn rimori-release stable',
73
+ 'dev:worker': 'VITE_MINIFY=false vite build --watch --config worker/vite.config.ts',
74
+ 'build:worker': 'vite build --config worker/vite.config.ts',
75
+ };
76
+ packageJson.dependencies = {
77
+ ...packageJson.dependencies,
78
+ '@rimori/client': rimoriClientVersion,
79
+ };
67
80
  // Write the updated package.json back to file
68
81
  try {
69
82
  fs.writeFileSync(packageJsonPath, JSON.stringify(packageJson, null, 2), 'utf8');