@l4yercak3/cli 1.2.2 → 1.2.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@l4yercak3/cli",
3
- "version": "1.2.2",
3
+ "version": "1.2.3",
4
4
  "description": "Icing on the L4yercak3 - The sweet finishing touch for your Layer Cake integration",
5
5
  "main": "src/index.js",
6
6
  "bin": {
@@ -242,6 +242,7 @@ async function handleSpread() {
242
242
  value: key.id,
243
243
  }));
244
244
  keyChoices.push({ name: '➕ Generate a new API key', value: '__generate__' });
245
+ keyChoices.push({ name: '⏭️ Skip - I already have my key configured', value: '__skip__' });
245
246
 
246
247
  const { keyChoice } = await inquirer.prompt([
247
248
  {
@@ -254,6 +255,9 @@ async function handleSpread() {
254
255
 
255
256
  if (keyChoice === '__generate__') {
256
257
  apiKey = await generateNewApiKey(organizationId);
258
+ } else if (keyChoice === '__skip__') {
259
+ apiKey = null; // Will skip writing API key to .env.local
260
+ console.log(chalk.green(` ✅ Skipping API key setup - using existing configuration\n`));
257
261
  } else {
258
262
  // User selected existing key - we only have the preview, not the full key
259
263
  // They need to use the key they have stored or get it from dashboard
@@ -71,11 +71,15 @@ class ApiClientGenerator {
71
71
  */
72
72
  generateCode({ apiKey, backendUrl, organizationId, isTypeScript }) {
73
73
  const returnType = isTypeScript ? ': Promise<any>' : '';
74
+ // If apiKey is null (user skipped), use environment variable reference
75
+ const apiKeyDefault = apiKey
76
+ ? `'${apiKey}'`
77
+ : `process.env.L4YERCAK3_API_KEY || ''`;
74
78
 
75
79
  return `/**
76
80
  * L4YERCAK3 API Client
77
81
  * Auto-generated by @l4yercak3/cli
78
- *
82
+ *
79
83
  * This client handles authenticated requests to the L4YERCAK3 backend API.
80
84
  * Organization ID: ${organizationId}
81
85
  */
@@ -83,7 +87,7 @@ class ApiClientGenerator {
83
87
  // Using native fetch (available in Next.js 13+)
84
88
 
85
89
  class L4YERCAK3Client {
86
- constructor(apiKey${isTypeScript ? ': string' : ''} = '${apiKey}', baseUrl${isTypeScript ? ': string' : ''} = '${backendUrl}') {
90
+ constructor(apiKey${isTypeScript ? ': string' : ''} = ${apiKeyDefault}, baseUrl${isTypeScript ? ': string' : ''} = '${backendUrl}') {
87
91
  this.apiKey = apiKey;
88
92
  this.baseUrl = baseUrl;
89
93
  this.organizationId = '${organizationId}';
@@ -27,7 +27,8 @@ class EnvGenerator {
27
27
  const envVars = {
28
28
  ...existingEnv,
29
29
  // Core API configuration
30
- L4YERCAK3_API_KEY: apiKey,
30
+ // If apiKey is null (user skipped), preserve existing value
31
+ L4YERCAK3_API_KEY: apiKey || existingEnv.L4YERCAK3_API_KEY || 'your_api_key_here',
31
32
  L4YERCAK3_BACKEND_URL: backendUrl,
32
33
  L4YERCAK3_ORGANIZATION_ID: organizationId,
33
34
  NEXT_PUBLIC_L4YERCAK3_BACKEND_URL: backendUrl,