@klyb/cli 0.1.19 → 0.1.20

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.
@@ -46,7 +46,7 @@ async function deployCommand() {
46
46
  console.log(chalk_1.default.yellow('\n☁️ Uploading to Klyb Registry...'));
47
47
  // Récupération des accès enregistrés lors du `klyb login`
48
48
  const credentials = (0, credentials_1.getCredentials)();
49
- const apiUrl = credentials?.apiUrl || process.env.KLYB_API_URL || 'http://localhost:3000';
49
+ const apiUrl = credentials?.apiUrl || process.env.KLYB_API_URL || 'https://api.klyb.app';
50
50
  if (!credentials?.token) {
51
51
  console.error(chalk_1.default.red('❌ Not authenticated.'));
52
52
  console.error(chalk_1.default.yellow(' Run: ') + chalk_1.default.cyan('klyb login'));
@@ -35,7 +35,7 @@ async function devCommand() {
35
35
  // 2. Start Simulator Server
36
36
  const app = (0, express_1.default)();
37
37
  const simulatorPort = 3002; // Changed from 3000 to avoid conflict with API
38
- const realApiUrl = process.env.KLYB_API_URL || 'http://localhost:3000';
38
+ const realApiUrl = process.env.KLYB_API_URL || 'https://api.klyb.app';
39
39
  // API Route for Simulator to get Configuration
40
40
  app.get('/simulator/api/config', async (req, res) => {
41
41
  const apiKey = process.env.KLYB_API_KEY;
@@ -40,7 +40,7 @@ exports.loginCommand = loginCommand;
40
40
  const chalk_1 = __importDefault(require("chalk"));
41
41
  const http_1 = __importDefault(require("http"));
42
42
  const credentials_1 = require("../credentials");
43
- const DEFAULT_API_URL = process.env.KLYB_API_URL || 'http://localhost:3000';
43
+ const DEFAULT_API_URL = process.env.KLYB_API_URL || 'https://api.klyb.app';
44
44
  /**
45
45
  * `klyb login`
46
46
  *
@@ -49,8 +49,12 @@ const DEFAULT_API_URL = process.env.KLYB_API_URL || 'http://localhost:3000';
49
49
  * 3. After the user logs in, the backend redirects back with the JWT
50
50
  * 4. CLI saves the token to ~/.klyb/credentials.json
51
51
  */
52
- async function loginCommand() {
53
- const apiUrl = DEFAULT_API_URL;
52
+ async function loginCommand(options) {
53
+ let apiUrl = DEFAULT_API_URL;
54
+ if (options.staging)
55
+ apiUrl = 'https://api.pp.klyb.app';
56
+ if (options.local)
57
+ apiUrl = 'http://localhost:3000';
54
58
  console.log(chalk_1.default.blue('🔑 Logging in to Klyb...'));
55
59
  console.log(chalk_1.default.dim(` API: ${apiUrl}\n`));
56
60
  const token = await waitForToken(apiUrl);
package/dist/index.js CHANGED
@@ -13,6 +13,9 @@ program
13
13
  program
14
14
  .command('login')
15
15
  .description('Authenticate with Klyb (opens browser)')
16
+ .option('--prod', 'Use production environment (default)')
17
+ .option('--staging', 'Use staging environment')
18
+ .option('--local', 'Use local development environment')
16
19
  .action(login_1.loginCommand);
17
20
  program
18
21
  .command('init')
@@ -5,7 +5,7 @@
5
5
  # L'URL de l'API Klyb.
6
6
  # Par défaut, la CLI essaiera de se connecter à http://localhost:3000 si non défini.
7
7
  # Décommentez la ligne ci-dessous pour forcer l'environnement de Production :
8
- # KLYB_API_URL=https://api.klyb.co
8
+ # KLYB_API_URL=https://api.klyb.app
9
9
 
10
10
  # Votre clé d'API Développeur Klyb
11
11
  # Vous pouvez la générer depuis votre Espace Développeur sur klyb_comu (Onglet "Clés API")
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@klyb/cli",
3
- "version": "0.1.19",
3
+ "version": "0.1.20",
4
4
  "bin": {
5
5
  "klyb": "bin/klyb.js"
6
6
  },
@@ -48,7 +48,7 @@ export async function deployCommand() {
48
48
 
49
49
  // Récupération des accès enregistrés lors du `klyb login`
50
50
  const credentials = getCredentials();
51
- const apiUrl = credentials?.apiUrl || process.env.KLYB_API_URL || 'http://localhost:3000';
51
+ const apiUrl = credentials?.apiUrl || process.env.KLYB_API_URL || 'https://api.klyb.app';
52
52
 
53
53
  if (!credentials?.token) {
54
54
  console.error(chalk.red('❌ Not authenticated.'));
@@ -34,7 +34,7 @@ export async function devCommand() {
34
34
  // 2. Start Simulator Server
35
35
  const app = express();
36
36
  const simulatorPort = 3002; // Changed from 3000 to avoid conflict with API
37
- const realApiUrl = process.env.KLYB_API_URL || 'http://localhost:3000';
37
+ const realApiUrl = process.env.KLYB_API_URL || 'https://api.klyb.app';
38
38
 
39
39
  // API Route for Simulator to get Configuration
40
40
  app.get('/simulator/api/config', async (req, res) => {
@@ -2,7 +2,7 @@ import chalk from 'chalk';
2
2
  import http from 'http';
3
3
  import { saveCredentials, credentialsPath } from '../credentials';
4
4
 
5
- const DEFAULT_API_URL = process.env.KLYB_API_URL || 'http://localhost:3000';
5
+ const DEFAULT_API_URL = process.env.KLYB_API_URL || 'https://api.klyb.app';
6
6
 
7
7
  /**
8
8
  * `klyb login`
@@ -12,8 +12,10 @@ const DEFAULT_API_URL = process.env.KLYB_API_URL || 'http://localhost:3000';
12
12
  * 3. After the user logs in, the backend redirects back with the JWT
13
13
  * 4. CLI saves the token to ~/.klyb/credentials.json
14
14
  */
15
- export async function loginCommand() {
16
- const apiUrl = DEFAULT_API_URL;
15
+ export async function loginCommand(options: any) {
16
+ let apiUrl = DEFAULT_API_URL;
17
+ if (options.staging) apiUrl = 'https://api.pp.klyb.app';
18
+ if (options.local) apiUrl = 'http://localhost:3000';
17
19
 
18
20
  console.log(chalk.blue('🔑 Logging in to Klyb...'));
19
21
  console.log(chalk.dim(` API: ${apiUrl}\n`));
package/src/index.ts CHANGED
@@ -14,6 +14,9 @@ program
14
14
  program
15
15
  .command('login')
16
16
  .description('Authenticate with Klyb (opens browser)')
17
+ .option('--prod', 'Use production environment (default)')
18
+ .option('--staging', 'Use staging environment')
19
+ .option('--local', 'Use local development environment')
17
20
  .action(loginCommand);
18
21
 
19
22
  program
@@ -5,7 +5,7 @@
5
5
  # L'URL de l'API Klyb.
6
6
  # Par défaut, la CLI essaiera de se connecter à http://localhost:3000 si non défini.
7
7
  # Décommentez la ligne ci-dessous pour forcer l'environnement de Production :
8
- # KLYB_API_URL=https://api.klyb.co
8
+ # KLYB_API_URL=https://api.klyb.app
9
9
 
10
10
  # Votre clé d'API Développeur Klyb
11
11
  # Vous pouvez la générer depuis votre Espace Développeur sur klyb_comu (Onglet "Clés API")
@@ -1,20 +0,0 @@
1
- {
2
- "name": "My Clubz Widget",
3
- "description": "A widget built for Clubz",
4
- "version": "0.0.1",
5
- "type": "widget",
6
- "preview": "preview.png",
7
- "permissions": [
8
- "read_community_name"
9
- ],
10
- "config": {
11
- "props": [
12
- {
13
- "name": "title",
14
- "type": "string",
15
- "label": "Titre du widget",
16
- "default": "Hello World"
17
- }
18
- ]
19
- }
20
- }