atmn 0.0.7 → 0.0.8

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 (3) hide show
  1. package/dist/cli.cjs +83 -39
  2. package/dist/cli.js +81 -38
  3. package/package.json +4 -3
package/dist/cli.cjs CHANGED
@@ -2,24 +2,26 @@
2
2
  'use strict';
3
3
 
4
4
  var commander = require('commander');
5
- var chalk7 = require('chalk');
5
+ var chalk6 = require('chalk');
6
6
  var axios = require('axios');
7
7
  var fs = require('fs');
8
+ var prompts = require('@inquirer/prompts');
8
9
  var path = require('path');
9
10
  var createJiti = require('jiti');
10
11
  var url = require('url');
11
12
  var child_process = require('child_process');
12
- var prompts = require('@inquirer/prompts');
13
13
  var open = require('open');
14
+ var yoctoSpinner = require('yocto-spinner');
14
15
 
15
16
  function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
16
17
 
17
- var chalk7__default = /*#__PURE__*/_interopDefault(chalk7);
18
+ var chalk6__default = /*#__PURE__*/_interopDefault(chalk6);
18
19
  var axios__default = /*#__PURE__*/_interopDefault(axios);
19
20
  var fs__default = /*#__PURE__*/_interopDefault(fs);
20
21
  var path__default = /*#__PURE__*/_interopDefault(path);
21
22
  var createJiti__default = /*#__PURE__*/_interopDefault(createJiti);
22
23
  var open__default = /*#__PURE__*/_interopDefault(open);
24
+ var yoctoSpinner__default = /*#__PURE__*/_interopDefault(yoctoSpinner);
23
25
 
24
26
  // ../node_modules/.pnpm/tsup@8.5.0_jiti@2.4.2_postcss@8.5.6_tsx@4.20.3_typescript@5.8.3_yaml@2.8.0/node_modules/tsup/assets/cjs_shims.js
25
27
  var getImportMetaUrl = () => typeof document === "undefined" ? new URL(`file:${__filename}`).href : document.currentScript && document.currentScript.src || new URL("main.js", document.baseURI).href;
@@ -87,27 +89,60 @@ function snakeCaseToCamelCase(value) {
87
89
  function idToVar(id) {
88
90
  return id.replace(/[-_](.)/g, (_, letter) => letter.toUpperCase()).replace(/^[^a-zA-Z_$]/, "_").replace(/[^a-zA-Z0-9_$]/g, "");
89
91
  }
92
+ async function upsertEnvVar(filePath, varName, newValue) {
93
+ const content = fs__default.default.readFileSync(filePath, "utf-8");
94
+ const lines = content.split("\n");
95
+ let found = false;
96
+ for (let i = 0; i < lines.length; i++) {
97
+ if (lines[i]?.startsWith(`${varName}=`)) {
98
+ const shouldOverwrite = await prompts.confirm({
99
+ message: `${varName} already exists in .env. Overwrite?`,
100
+ default: false
101
+ });
102
+ if (shouldOverwrite) {
103
+ lines[i] = `${varName}=${newValue}`;
104
+ found = true;
105
+ break;
106
+ }
107
+ }
108
+ }
109
+ if (!found) {
110
+ lines.push(`${varName}=${newValue}`);
111
+ }
112
+ fs__default.default.writeFileSync(filePath, lines.join("\n"));
113
+ }
90
114
  function storeToEnv(prodKey, sandboxKey) {
91
115
  const envPath = `${process.cwd()}/.env`;
92
- const envVars = `# AUTUMN_SECRET_KEY=${prodKey}
116
+ const envLocalPath = `${process.cwd()}/.env.local`;
117
+ const envVars = `AUTUMN_PROD_SECRET_KEY=${prodKey}
93
118
  AUTUMN_SECRET_KEY=${sandboxKey}
94
119
  `;
95
120
  if (fs__default.default.existsSync(envPath)) {
96
- fs__default.default.appendFileSync(envPath, envVars);
97
- console.log(chalk7__default.default.green(".env file found. Appended keys."));
121
+ upsertEnvVar(envPath, "AUTUMN_PROD_SECRET_KEY", prodKey);
122
+ upsertEnvVar(envPath, "AUTUMN_SECRET_KEY", sandboxKey);
123
+ console.log(chalk6__default.default.green(".env file found. Updated keys."));
124
+ } else if (fs__default.default.existsSync(envLocalPath)) {
125
+ fs__default.default.writeFileSync(envPath, envVars);
126
+ console.log(chalk6__default.default.green(".env.local found but .env not found. Created new .env file and wrote keys."));
98
127
  } else {
99
128
  fs__default.default.writeFileSync(envPath, envVars);
100
- console.log(chalk7__default.default.green(".env file not found. Created new .env file and wrote keys."));
129
+ console.log(chalk6__default.default.green("No .env or .env.local file found. Created new .env file and wrote keys."));
101
130
  }
102
131
  }
103
132
  function readFromEnv() {
104
133
  const envPath = `${process.cwd()}/.env`;
105
- if (!fs__default.default.existsSync(envPath)) {
106
- return void 0;
134
+ const envLocalPath = `${process.cwd()}/.env.local`;
135
+ if (fs__default.default.existsSync(envPath)) {
136
+ const envContent = fs__default.default.readFileSync(envPath, "utf-8");
137
+ const match = envContent.match(/^AUTUMN_SECRET_KEY=(.*)$/m);
138
+ if (match) return match[1];
107
139
  }
108
- const envContent = fs__default.default.readFileSync(envPath, "utf-8");
109
- const match = envContent.match(/^AUTUMN_SECRET_KEY=(.*)$/m);
110
- return match ? match[1] : void 0;
140
+ if (fs__default.default.existsSync(envLocalPath)) {
141
+ const envLocalContent = fs__default.default.readFileSync(envLocalPath, "utf-8");
142
+ const match = envLocalContent.match(/^AUTUMN_SECRET_KEY=(.*)$/m);
143
+ if (match) return match[1];
144
+ }
145
+ return void 0;
111
146
  }
112
147
 
113
148
  // source/core/api.ts
@@ -140,8 +175,8 @@ async function request({
140
175
  throw error;
141
176
  }
142
177
  console.error(
143
- chalk7__default.default.red("Error occured when making API request:"),
144
- chalk7__default.default.red(error.response.data.message || error.response.data.error)
178
+ chalk6__default.default.red("Error occured when making API request:"),
179
+ chalk6__default.default.red(error.response.data.message || error.response.data.error)
145
180
  );
146
181
  process.exit(1);
147
182
  }
@@ -327,7 +362,7 @@ async function installAtmn() {
327
362
  default: true
328
363
  });
329
364
  if (!shouldInstall) {
330
- console.log(chalk7__default.default.yellow("Skipping installation. You can install atmn manually with your preferred package manager."));
365
+ console.log(chalk6__default.default.yellow("Skipping installation. You can install atmn manually with your preferred package manager."));
331
366
  return false;
332
367
  }
333
368
  const packageManager = await prompts.select({
@@ -340,13 +375,13 @@ async function installAtmn() {
340
375
  default: "npm"
341
376
  });
342
377
  try {
343
- console.log(chalk7__default.default.blue(`Installing atmn with ${packageManager}...`));
378
+ console.log(chalk6__default.default.blue(`Installing atmn with ${packageManager}...`));
344
379
  const installCommand = packageManager === "npm" ? "npm install atmn" : packageManager === "pnpm" ? "pnpm add atmn" : "bun add atmn";
345
380
  child_process.execSync(installCommand, { stdio: "inherit" });
346
- console.log(chalk7__default.default.green("atmn installed successfully!"));
381
+ console.log(chalk6__default.default.green("atmn installed successfully!"));
347
382
  return true;
348
383
  } catch (error) {
349
- console.error(chalk7__default.default.red("Failed to install atmn:"), error);
384
+ console.error(chalk6__default.default.red("Failed to install atmn:"), error);
350
385
  return false;
351
386
  }
352
387
  }
@@ -382,7 +417,7 @@ function writeConfig(config) {
382
417
 
383
418
  // source/commands/pull.ts
384
419
  async function Pull({ config }) {
385
- console.log(chalk7__default.default.green("Pulling products and features from Autumn..."));
420
+ console.log(chalk6__default.default.green("Pulling products and features from Autumn..."));
386
421
  const products = await getAllProducts();
387
422
  const features = await getFeatures();
388
423
  const productSnippets = products.map(
@@ -407,7 +442,7 @@ ${exportBuilder(
407
442
  )}
408
443
  `;
409
444
  writeConfig(autumnConfig);
410
- console.log(chalk7__default.default.green("Success! Config has been updated."));
445
+ console.log(chalk6__default.default.green("Success! Config has been updated."));
411
446
  }
412
447
 
413
448
  // source/core/auth.ts
@@ -423,14 +458,14 @@ async function getOTP(otp) {
423
458
  var passwordTheme = {
424
459
  style: {
425
460
  answer: (text) => {
426
- return chalk7__default.default.magenta("*".repeat(text.length));
461
+ return chalk6__default.default.magenta("*".repeat(text.length));
427
462
  }
428
463
  }
429
464
  };
430
465
  var inputTheme = {
431
466
  style: {
432
467
  answer: (text) => {
433
- return chalk7__default.default.magenta(text);
468
+ return chalk6__default.default.magenta(text);
434
469
  }
435
470
  }
436
471
  };
@@ -468,7 +503,7 @@ async function AuthCommand() {
468
503
  );
469
504
  } else {
470
505
  console.log(
471
- chalk7__default.default.yellow(
506
+ chalk6__default.default.yellow(
472
507
  "Okay, no worries. Go to the Autumn dashboard when you're ready!"
473
508
  )
474
509
  );
@@ -476,7 +511,7 @@ async function AuthCommand() {
476
511
  }
477
512
  storeToEnv(keyInfo.prodKey, keyInfo.sandboxKey);
478
513
  console.log(
479
- chalk7__default.default.green(
514
+ chalk6__default.default.green(
480
515
  "Success! Keys have been stored locally. You may now use the CLI."
481
516
  )
482
517
  );
@@ -486,19 +521,19 @@ async function AuthCommand() {
486
521
  async function Init({ config }) {
487
522
  let apiKey = readFromEnv();
488
523
  if (apiKey) {
489
- console.log(chalk7__default.default.green("API key found. Pulling latest config..."));
524
+ console.log(chalk6__default.default.green("API key found. Pulling latest config..."));
490
525
  await Pull({ config });
491
- console.log(chalk7__default.default.green("Project initialized and config pulled successfully!"));
526
+ console.log(chalk6__default.default.green("Project initialized and config pulled successfully!"));
492
527
  return;
493
528
  }
494
- console.log(chalk7__default.default.yellow("No API key found. Running authentication..."));
529
+ console.log(chalk6__default.default.yellow("No API key found. Running authentication..."));
495
530
  await AuthCommand();
496
531
  apiKey = readFromEnv();
497
532
  if (apiKey) {
498
533
  await Pull({ config });
499
- console.log(chalk7__default.default.green("Project initialized! You are now authenticated and config has been pulled."));
534
+ console.log(chalk6__default.default.green("Project initialized! You are now authenticated and config has been pulled."));
500
535
  } else {
501
- console.log(chalk7__default.default.red("Authentication did not yield an API key. Please check your setup."));
536
+ console.log(chalk6__default.default.red("Authentication did not yield an API key. Please check your setup."));
502
537
  }
503
538
  }
504
539
 
@@ -570,6 +605,13 @@ async function upsertProduct(product) {
570
605
  }
571
606
 
572
607
  // source/commands/push.ts
608
+ var spinner = (message) => {
609
+ const spinner2 = yoctoSpinner__default.default({
610
+ text: message
611
+ });
612
+ spinner2.start();
613
+ return spinner2;
614
+ };
573
615
  async function Push({
574
616
  config,
575
617
  yes,
@@ -585,42 +627,44 @@ async function Push({
585
627
  message: `Delete product [${productId}]?`
586
628
  });
587
629
  if (shouldDelete) {
630
+ const s = spinner(`Deleting product [${productId}]`);
588
631
  await deleteProduct(productId);
589
- console.log(chalk7__default.default.green(`Product [${productId}] deleted successfully!`));
632
+ s.success(`Product [${productId}] deleted successfully!`);
590
633
  }
591
634
  }
592
635
  for (let feature of features) {
593
- console.log(chalk7__default.default.green(`Pushing feature [${feature.id}]`));
636
+ const s = spinner(`Pushing feature [${feature.id}]`);
594
637
  await upsertFeature(feature);
595
- console.log(chalk7__default.default.green(`Pushed feature [${feature.id}]`));
638
+ s.success(`Pushed feature [${feature.id}]`);
596
639
  }
597
640
  for (let product of products) {
598
- console.log(chalk7__default.default.green(`Pushing product [${product.id}]`));
641
+ const s = spinner(`Pushing product [${product.id}]`);
599
642
  await upsertProduct(product);
600
- console.log(chalk7__default.default.green(`Pushed product [${product.id}]`));
643
+ s.success(`Pushed product [${product.id}]`);
601
644
  }
602
645
  for (let featureId of featuresToDelete) {
603
646
  let shouldDelete = yes || await prompts.confirm({
604
647
  message: `Delete feature [${featureId}]?`
605
648
  });
606
649
  if (shouldDelete) {
650
+ const s = spinner(`Deleting feature [${featureId}]`);
607
651
  await deleteFeature(featureId);
608
- console.log(chalk7__default.default.green(`Feature [${featureId}] deleted successfully!`));
652
+ s.success(`Feature [${featureId}] deleted successfully!`);
609
653
  }
610
654
  }
611
655
  const env = prod ? "prod" : "sandbox";
612
656
  console.log(
613
- chalk7__default.default.magentaBright(`Success! Changes have been pushed to ${env}.`)
657
+ chalk6__default.default.magentaBright(`Success! Changes have been pushed to ${env}.`)
614
658
  );
615
659
  if (prod) {
616
660
  console.log(
617
- chalk7__default.default.magentaBright(
661
+ chalk6__default.default.magentaBright(
618
662
  `You can view the products at ${FRONTEND_URL}/products`
619
663
  )
620
664
  );
621
665
  } else {
622
666
  console.log(
623
- chalk7__default.default.magentaBright(
667
+ chalk6__default.default.magentaBright(
624
668
  `You can view the products at ${FRONTEND_URL}/sandbox/products`
625
669
  )
626
670
  );
@@ -647,6 +691,6 @@ commander.program.command("dashboard").description("Open the Autumn dashboard in
647
691
  open__default.default(`${FRONTEND_URL}`);
648
692
  });
649
693
  commander.program.command("version").description("Show the version of Autumn").action(() => {
650
- console.log(chalk7__default.default.green(`Autumn v${VERSION}`));
694
+ console.log(chalk6__default.default.green(`Autumn v${VERSION}`));
651
695
  });
652
696
  commander.program.parse();
package/dist/cli.js CHANGED
@@ -1,14 +1,15 @@
1
1
  #!/usr/bin/env node
2
2
  import { program } from 'commander';
3
- import chalk7 from 'chalk';
3
+ import chalk6 from 'chalk';
4
4
  import axios from 'axios';
5
5
  import fs from 'fs';
6
+ import { confirm, input, password, select } from '@inquirer/prompts';
6
7
  import path, { resolve } from 'path';
7
8
  import createJiti from 'jiti';
8
9
  import { pathToFileURL } from 'url';
9
10
  import { execSync } from 'child_process';
10
- import { confirm, input, password, select } from '@inquirer/prompts';
11
11
  import open from 'open';
12
+ import yoctoSpinner from 'yocto-spinner';
12
13
 
13
14
  // source/constants.ts
14
15
  var FRONTEND_URL = "http://app.useautumn.com";
@@ -72,27 +73,60 @@ function snakeCaseToCamelCase(value) {
72
73
  function idToVar(id) {
73
74
  return id.replace(/[-_](.)/g, (_, letter) => letter.toUpperCase()).replace(/^[^a-zA-Z_$]/, "_").replace(/[^a-zA-Z0-9_$]/g, "");
74
75
  }
76
+ async function upsertEnvVar(filePath, varName, newValue) {
77
+ const content = fs.readFileSync(filePath, "utf-8");
78
+ const lines = content.split("\n");
79
+ let found = false;
80
+ for (let i = 0; i < lines.length; i++) {
81
+ if (lines[i]?.startsWith(`${varName}=`)) {
82
+ const shouldOverwrite = await confirm({
83
+ message: `${varName} already exists in .env. Overwrite?`,
84
+ default: false
85
+ });
86
+ if (shouldOverwrite) {
87
+ lines[i] = `${varName}=${newValue}`;
88
+ found = true;
89
+ break;
90
+ }
91
+ }
92
+ }
93
+ if (!found) {
94
+ lines.push(`${varName}=${newValue}`);
95
+ }
96
+ fs.writeFileSync(filePath, lines.join("\n"));
97
+ }
75
98
  function storeToEnv(prodKey, sandboxKey) {
76
99
  const envPath = `${process.cwd()}/.env`;
77
- const envVars = `# AUTUMN_SECRET_KEY=${prodKey}
100
+ const envLocalPath = `${process.cwd()}/.env.local`;
101
+ const envVars = `AUTUMN_PROD_SECRET_KEY=${prodKey}
78
102
  AUTUMN_SECRET_KEY=${sandboxKey}
79
103
  `;
80
104
  if (fs.existsSync(envPath)) {
81
- fs.appendFileSync(envPath, envVars);
82
- console.log(chalk7.green(".env file found. Appended keys."));
105
+ upsertEnvVar(envPath, "AUTUMN_PROD_SECRET_KEY", prodKey);
106
+ upsertEnvVar(envPath, "AUTUMN_SECRET_KEY", sandboxKey);
107
+ console.log(chalk6.green(".env file found. Updated keys."));
108
+ } else if (fs.existsSync(envLocalPath)) {
109
+ fs.writeFileSync(envPath, envVars);
110
+ console.log(chalk6.green(".env.local found but .env not found. Created new .env file and wrote keys."));
83
111
  } else {
84
112
  fs.writeFileSync(envPath, envVars);
85
- console.log(chalk7.green(".env file not found. Created new .env file and wrote keys."));
113
+ console.log(chalk6.green("No .env or .env.local file found. Created new .env file and wrote keys."));
86
114
  }
87
115
  }
88
116
  function readFromEnv() {
89
117
  const envPath = `${process.cwd()}/.env`;
90
- if (!fs.existsSync(envPath)) {
91
- return void 0;
118
+ const envLocalPath = `${process.cwd()}/.env.local`;
119
+ if (fs.existsSync(envPath)) {
120
+ const envContent = fs.readFileSync(envPath, "utf-8");
121
+ const match = envContent.match(/^AUTUMN_SECRET_KEY=(.*)$/m);
122
+ if (match) return match[1];
92
123
  }
93
- const envContent = fs.readFileSync(envPath, "utf-8");
94
- const match = envContent.match(/^AUTUMN_SECRET_KEY=(.*)$/m);
95
- return match ? match[1] : void 0;
124
+ if (fs.existsSync(envLocalPath)) {
125
+ const envLocalContent = fs.readFileSync(envLocalPath, "utf-8");
126
+ const match = envLocalContent.match(/^AUTUMN_SECRET_KEY=(.*)$/m);
127
+ if (match) return match[1];
128
+ }
129
+ return void 0;
96
130
  }
97
131
 
98
132
  // source/core/api.ts
@@ -125,8 +159,8 @@ async function request({
125
159
  throw error;
126
160
  }
127
161
  console.error(
128
- chalk7.red("Error occured when making API request:"),
129
- chalk7.red(error.response.data.message || error.response.data.error)
162
+ chalk6.red("Error occured when making API request:"),
163
+ chalk6.red(error.response.data.message || error.response.data.error)
130
164
  );
131
165
  process.exit(1);
132
166
  }
@@ -312,7 +346,7 @@ async function installAtmn() {
312
346
  default: true
313
347
  });
314
348
  if (!shouldInstall) {
315
- console.log(chalk7.yellow("Skipping installation. You can install atmn manually with your preferred package manager."));
349
+ console.log(chalk6.yellow("Skipping installation. You can install atmn manually with your preferred package manager."));
316
350
  return false;
317
351
  }
318
352
  const packageManager = await select({
@@ -325,13 +359,13 @@ async function installAtmn() {
325
359
  default: "npm"
326
360
  });
327
361
  try {
328
- console.log(chalk7.blue(`Installing atmn with ${packageManager}...`));
362
+ console.log(chalk6.blue(`Installing atmn with ${packageManager}...`));
329
363
  const installCommand = packageManager === "npm" ? "npm install atmn" : packageManager === "pnpm" ? "pnpm add atmn" : "bun add atmn";
330
364
  execSync(installCommand, { stdio: "inherit" });
331
- console.log(chalk7.green("atmn installed successfully!"));
365
+ console.log(chalk6.green("atmn installed successfully!"));
332
366
  return true;
333
367
  } catch (error) {
334
- console.error(chalk7.red("Failed to install atmn:"), error);
368
+ console.error(chalk6.red("Failed to install atmn:"), error);
335
369
  return false;
336
370
  }
337
371
  }
@@ -367,7 +401,7 @@ function writeConfig(config) {
367
401
 
368
402
  // source/commands/pull.ts
369
403
  async function Pull({ config }) {
370
- console.log(chalk7.green("Pulling products and features from Autumn..."));
404
+ console.log(chalk6.green("Pulling products and features from Autumn..."));
371
405
  const products = await getAllProducts();
372
406
  const features = await getFeatures();
373
407
  const productSnippets = products.map(
@@ -392,7 +426,7 @@ ${exportBuilder(
392
426
  )}
393
427
  `;
394
428
  writeConfig(autumnConfig);
395
- console.log(chalk7.green("Success! Config has been updated."));
429
+ console.log(chalk6.green("Success! Config has been updated."));
396
430
  }
397
431
 
398
432
  // source/core/auth.ts
@@ -408,14 +442,14 @@ async function getOTP(otp) {
408
442
  var passwordTheme = {
409
443
  style: {
410
444
  answer: (text) => {
411
- return chalk7.magenta("*".repeat(text.length));
445
+ return chalk6.magenta("*".repeat(text.length));
412
446
  }
413
447
  }
414
448
  };
415
449
  var inputTheme = {
416
450
  style: {
417
451
  answer: (text) => {
418
- return chalk7.magenta(text);
452
+ return chalk6.magenta(text);
419
453
  }
420
454
  }
421
455
  };
@@ -453,7 +487,7 @@ async function AuthCommand() {
453
487
  );
454
488
  } else {
455
489
  console.log(
456
- chalk7.yellow(
490
+ chalk6.yellow(
457
491
  "Okay, no worries. Go to the Autumn dashboard when you're ready!"
458
492
  )
459
493
  );
@@ -461,7 +495,7 @@ async function AuthCommand() {
461
495
  }
462
496
  storeToEnv(keyInfo.prodKey, keyInfo.sandboxKey);
463
497
  console.log(
464
- chalk7.green(
498
+ chalk6.green(
465
499
  "Success! Keys have been stored locally. You may now use the CLI."
466
500
  )
467
501
  );
@@ -471,19 +505,19 @@ async function AuthCommand() {
471
505
  async function Init({ config }) {
472
506
  let apiKey = readFromEnv();
473
507
  if (apiKey) {
474
- console.log(chalk7.green("API key found. Pulling latest config..."));
508
+ console.log(chalk6.green("API key found. Pulling latest config..."));
475
509
  await Pull({ config });
476
- console.log(chalk7.green("Project initialized and config pulled successfully!"));
510
+ console.log(chalk6.green("Project initialized and config pulled successfully!"));
477
511
  return;
478
512
  }
479
- console.log(chalk7.yellow("No API key found. Running authentication..."));
513
+ console.log(chalk6.yellow("No API key found. Running authentication..."));
480
514
  await AuthCommand();
481
515
  apiKey = readFromEnv();
482
516
  if (apiKey) {
483
517
  await Pull({ config });
484
- console.log(chalk7.green("Project initialized! You are now authenticated and config has been pulled."));
518
+ console.log(chalk6.green("Project initialized! You are now authenticated and config has been pulled."));
485
519
  } else {
486
- console.log(chalk7.red("Authentication did not yield an API key. Please check your setup."));
520
+ console.log(chalk6.red("Authentication did not yield an API key. Please check your setup."));
487
521
  }
488
522
  }
489
523
 
@@ -555,6 +589,13 @@ async function upsertProduct(product) {
555
589
  }
556
590
 
557
591
  // source/commands/push.ts
592
+ var spinner = (message) => {
593
+ const spinner2 = yoctoSpinner({
594
+ text: message
595
+ });
596
+ spinner2.start();
597
+ return spinner2;
598
+ };
558
599
  async function Push({
559
600
  config,
560
601
  yes,
@@ -570,42 +611,44 @@ async function Push({
570
611
  message: `Delete product [${productId}]?`
571
612
  });
572
613
  if (shouldDelete) {
614
+ const s = spinner(`Deleting product [${productId}]`);
573
615
  await deleteProduct(productId);
574
- console.log(chalk7.green(`Product [${productId}] deleted successfully!`));
616
+ s.success(`Product [${productId}] deleted successfully!`);
575
617
  }
576
618
  }
577
619
  for (let feature of features) {
578
- console.log(chalk7.green(`Pushing feature [${feature.id}]`));
620
+ const s = spinner(`Pushing feature [${feature.id}]`);
579
621
  await upsertFeature(feature);
580
- console.log(chalk7.green(`Pushed feature [${feature.id}]`));
622
+ s.success(`Pushed feature [${feature.id}]`);
581
623
  }
582
624
  for (let product of products) {
583
- console.log(chalk7.green(`Pushing product [${product.id}]`));
625
+ const s = spinner(`Pushing product [${product.id}]`);
584
626
  await upsertProduct(product);
585
- console.log(chalk7.green(`Pushed product [${product.id}]`));
627
+ s.success(`Pushed product [${product.id}]`);
586
628
  }
587
629
  for (let featureId of featuresToDelete) {
588
630
  let shouldDelete = yes || await confirm({
589
631
  message: `Delete feature [${featureId}]?`
590
632
  });
591
633
  if (shouldDelete) {
634
+ const s = spinner(`Deleting feature [${featureId}]`);
592
635
  await deleteFeature(featureId);
593
- console.log(chalk7.green(`Feature [${featureId}] deleted successfully!`));
636
+ s.success(`Feature [${featureId}] deleted successfully!`);
594
637
  }
595
638
  }
596
639
  const env = prod ? "prod" : "sandbox";
597
640
  console.log(
598
- chalk7.magentaBright(`Success! Changes have been pushed to ${env}.`)
641
+ chalk6.magentaBright(`Success! Changes have been pushed to ${env}.`)
599
642
  );
600
643
  if (prod) {
601
644
  console.log(
602
- chalk7.magentaBright(
645
+ chalk6.magentaBright(
603
646
  `You can view the products at ${FRONTEND_URL}/products`
604
647
  )
605
648
  );
606
649
  } else {
607
650
  console.log(
608
- chalk7.magentaBright(
651
+ chalk6.magentaBright(
609
652
  `You can view the products at ${FRONTEND_URL}/sandbox/products`
610
653
  )
611
654
  );
@@ -632,6 +675,6 @@ program.command("dashboard").description("Open the Autumn dashboard in your brow
632
675
  open(`${FRONTEND_URL}`);
633
676
  });
634
677
  program.command("version").description("Show the version of Autumn").action(() => {
635
- console.log(chalk7.green(`Autumn v${VERSION}`));
678
+ console.log(chalk6.green(`Autumn v${VERSION}`));
636
679
  });
637
680
  program.parse();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "atmn",
3
- "version": "0.0.7",
3
+ "version": "0.0.8",
4
4
  "license": "MIT",
5
5
  "bin": "dist/cli.js",
6
6
  "main": "dist/index.js",
@@ -28,7 +28,8 @@
28
28
  "dotenv": "^17.2.0",
29
29
  "inquirer": "^12.7.0",
30
30
  "jiti": "^2.4.2",
31
- "open": "^10.1.2"
31
+ "open": "^10.1.2",
32
+ "yocto-spinner": "^1.0.0"
32
33
  },
33
34
  "devDependencies": {
34
35
  "@sindresorhus/tsconfig": "^3.0.1",
@@ -42,7 +43,7 @@
42
43
  "ink-testing-library": "^3.0.0",
43
44
  "prettier": "^2.8.7",
44
45
  "ts-node": "^10.9.1",
45
- "tsup": "^8.4.0",
46
+ "tsup": "^8.5.0",
46
47
  "typescript": "^5.0.3",
47
48
  "xo": "^0.53.1",
48
49
  "zod": "^3.24.1"