@flowershow/publish 1.1.2 → 1.1.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.
@@ -1,40 +1,43 @@
1
- import chalk from "chalk";
2
- import ora from "ora";
3
- import { getToken, getUserInfo } from "../auth.js";
4
- import { displayError } from "../utils.js";
5
- import { capture, flushTelemetry, CLI_VERSION } from "../telemetry.js";
1
+ import chalk from 'chalk';
2
+ import ora from 'ora';
3
+ import { getToken, getUserInfo } from '../auth.js';
4
+ import { displayError } from '../utils.js';
5
+ import { capture, flushTelemetry, CLI_VERSION } from '../telemetry.js';
6
6
  export async function authStatusCommand() {
7
7
  const startTime = Date.now();
8
- capture("command_started", { command: "auth_status", cli_version: CLI_VERSION });
8
+ capture('command_started', {
9
+ command: 'auth_status',
10
+ cli_version: CLI_VERSION,
11
+ });
9
12
  try {
10
13
  const tokenData = getToken();
11
14
  if (!tokenData) {
12
- console.log(chalk.yellow("\n✗ Not authenticated\n"));
13
- console.log(chalk.gray("Run `publish auth login` to authenticate.\n"));
15
+ console.log(chalk.yellow('\n✗ Not authenticated\n'));
16
+ console.log(chalk.gray('Run `publish auth login` to authenticate.\n'));
14
17
  return;
15
18
  }
16
- const spinner = ora("Checking authentication status...").start();
19
+ const spinner = ora('Checking authentication status...').start();
17
20
  try {
18
21
  const userInfo = await getUserInfo(tokenData.token);
19
- spinner.succeed("Authenticated");
20
- console.log(chalk.gray(`Logged in as: ${chalk.cyan(userInfo.username || userInfo.email || "user")}`));
22
+ spinner.succeed('Authenticated');
23
+ console.log(chalk.gray(`Logged in as: ${chalk.cyan(userInfo.username || userInfo.email || 'user')}`));
21
24
  }
22
25
  catch (error) {
23
- spinner.fail(chalk.red("Authentication token is invalid or expired"));
24
- console.log(chalk.gray("Run `publish auth login` to re-authenticate.\n"));
26
+ spinner.fail(chalk.red('Authentication token is invalid or expired'));
27
+ console.log(chalk.gray('Run `publish auth login` to re-authenticate.\n'));
25
28
  }
26
- capture("command_succeeded", {
27
- command: "auth_status",
29
+ capture('command_succeeded', {
30
+ command: 'auth_status',
28
31
  cli_version: CLI_VERSION,
29
32
  duration_ms: Date.now() - startTime,
30
33
  });
31
34
  }
32
35
  catch (error) {
33
- capture("command_failed", {
34
- command: "auth_status",
36
+ capture('command_failed', {
37
+ command: 'auth_status',
35
38
  cli_version: CLI_VERSION,
36
39
  duration_ms: Date.now() - startTime,
37
- error_type: error instanceof Error ? error.constructor.name : "Unknown",
40
+ error_type: error instanceof Error ? error.constructor.name : 'Unknown',
38
41
  error_message: error instanceof Error ? error.message : String(error),
39
42
  });
40
43
  if (error instanceof Error) {
@@ -42,7 +45,7 @@ export async function authStatusCommand() {
42
45
  console.error(chalk.gray(error.stack));
43
46
  }
44
47
  else {
45
- displayError("An unknown error occurred");
48
+ displayError('An unknown error occurred');
46
49
  }
47
50
  await flushTelemetry();
48
51
  process.exit(1);
@@ -1 +1 @@
1
- {"version":3,"file":"auth-status.js","sourceRoot":"","sources":["../../../lib/commands/auth-status.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,GAAG,MAAM,KAAK,CAAC;AACtB,OAAO,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AACnD,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAC3C,OAAO,EAAE,OAAO,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAKvE,MAAM,CAAC,KAAK,UAAU,iBAAiB;IACrC,MAAM,SAAS,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;IAC7B,OAAO,CAAC,iBAAiB,EAAE,EAAE,OAAO,EAAE,aAAa,EAAE,WAAW,EAAE,WAAW,EAAE,CAAC,CAAC;IACjF,IAAI,CAAC;QACH,MAAM,SAAS,GAAG,QAAQ,EAAE,CAAC;QAE7B,IAAI,CAAC,SAAS,EAAE,CAAC;YACf,OAAO,CAAC,GAAG,CAAC,KAAK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,CAAC,CAAC;QACH,IAAI,KAAK,YAAY,KAAK,EAAE,CAAC;YAC3B,YAAY,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;YAC5B,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC;QACzC,CAAC;aAAM,CAAC;YACN,YAAY,CAAC,2BAA2B,CAAC,CAAC;QAC5C,CAAC;QACD,MAAM,cAAc,EAAE,CAAC;QACvB,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;YAAS,CAAC;QACT,MAAM,cAAc,EAAE,CAAC;IACzB,CAAC;AACH,CAAC"}
@@ -1,16 +1,16 @@
1
- import chalk from "chalk";
2
- import ora from "ora";
3
- import { confirm } from "@inquirer/prompts";
4
- import { requireAuth } from "../auth.js";
5
- import { getSites, deleteSite } from "../api-client.js";
6
- import { displayError, getSiteUrl, getDashboardUrl } from "../utils.js";
7
- import { capture, flushTelemetry, CLI_VERSION } from "../telemetry.js";
1
+ import chalk from 'chalk';
2
+ import ora from 'ora';
3
+ import { confirm } from '@inquirer/prompts';
4
+ import { requireAuth } from '../auth.js';
5
+ import { getSites, deleteSite } from '../api-client.js';
6
+ import { displayError, getSiteUrl, getDashboardUrl } from '../utils.js';
7
+ import { capture, flushTelemetry, CLI_VERSION } from '../telemetry.js';
8
8
  export async function deleteCommand(projectName) {
9
9
  const startTime = Date.now();
10
- capture("command_started", { command: "delete", cli_version: CLI_VERSION });
10
+ capture('command_started', { command: 'delete', cli_version: CLI_VERSION });
11
11
  try {
12
12
  if (!projectName) {
13
- displayError("Project name is required.\nUsage: flowershow delete <project-name>");
13
+ displayError('Project name is required.\nUsage: flowershow delete <project-name>');
14
14
  process.exit(1);
15
15
  }
16
16
  const user = await requireAuth();
@@ -23,11 +23,11 @@ export async function deleteCommand(projectName) {
23
23
  displayError(`Site '${projectName}' not found.\nUse 'flowershow list' to see all sites.`);
24
24
  process.exit(1);
25
25
  }
26
- const url = getSiteUrl(projectName, user.username || user.email || "user");
26
+ const url = getSiteUrl(projectName, user.username || user.email || 'user');
27
27
  spinner.succeed(`Found site: ${projectName}`);
28
28
  console.log(chalk.gray(`URL: ${url}`));
29
29
  console.log();
30
- if (siteToDelete.plan === "PREMIUM") {
30
+ if (siteToDelete.plan === 'PREMIUM') {
31
31
  const dashboardUrl = getDashboardUrl(siteToDelete.id);
32
32
  displayError(`This site has an active premium subscription.\n` +
33
33
  `You must cancel the subscription before deleting the site.\n` +
@@ -35,34 +35,34 @@ export async function deleteCommand(projectName) {
35
35
  `${dashboardUrl}`);
36
36
  process.exit(1);
37
37
  }
38
- console.log(chalk.yellow("⚠️ This will permanently delete the site and all its content."));
38
+ console.log(chalk.yellow('⚠️ This will permanently delete the site and all its content.'));
39
39
  console.log();
40
40
  const confirmed = await confirm({
41
- message: "Are you sure you want to delete this site?",
41
+ message: 'Are you sure you want to delete this site?',
42
42
  default: false,
43
43
  });
44
44
  if (!confirmed) {
45
- console.log(chalk.gray("Deletion cancelled."));
45
+ console.log(chalk.gray('Deletion cancelled.'));
46
46
  process.exit(0);
47
47
  }
48
- spinner.start("Deleting site...");
48
+ spinner.start('Deleting site...');
49
49
  const result = await deleteSite(siteToDelete.id);
50
50
  spinner.succeed(`Successfully deleted site '${projectName}'`);
51
51
  if (result.deletedFiles) {
52
52
  console.log(chalk.gray(` Deleted ${result.deletedFiles} file(s)\n`));
53
53
  }
54
- capture("command_succeeded", {
55
- command: "delete",
54
+ capture('command_succeeded', {
55
+ command: 'delete',
56
56
  cli_version: CLI_VERSION,
57
57
  duration_ms: Date.now() - startTime,
58
58
  });
59
59
  }
60
60
  catch (error) {
61
- capture("command_failed", {
62
- command: "delete",
61
+ capture('command_failed', {
62
+ command: 'delete',
63
63
  cli_version: CLI_VERSION,
64
64
  duration_ms: Date.now() - startTime,
65
- error_type: error instanceof Error ? error.constructor.name : "Unknown",
65
+ error_type: error instanceof Error ? error.constructor.name : 'Unknown',
66
66
  error_message: error instanceof Error ? error.message : String(error),
67
67
  });
68
68
  if (error instanceof Error) {
@@ -70,7 +70,7 @@ export async function deleteCommand(projectName) {
70
70
  console.error(chalk.gray(error.stack));
71
71
  }
72
72
  else {
73
- displayError("An unknown error occurred");
73
+ displayError('An unknown error occurred');
74
74
  }
75
75
  await flushTelemetry();
76
76
  process.exit(1);
@@ -1,26 +1,26 @@
1
- import chalk from "chalk";
2
- import ora from "ora";
3
- import { requireAuth } from "../auth.js";
4
- import { getSites } from "../api-client.js";
5
- import { displayError, formatDate, getSiteUrl } from "../utils.js";
6
- import { API_URL } from "../const.js";
7
- import { capture, flushTelemetry, CLI_VERSION } from "../telemetry.js";
1
+ import chalk from 'chalk';
2
+ import ora from 'ora';
3
+ import { requireAuth } from '../auth.js';
4
+ import { getSites } from '../api-client.js';
5
+ import { displayError, formatDate, getSiteUrl } from '../utils.js';
6
+ import { API_URL } from '../const.js';
7
+ import { capture, flushTelemetry, CLI_VERSION } from '../telemetry.js';
8
8
  export async function listCommand() {
9
9
  const startTime = Date.now();
10
- capture("command_started", { command: "list", cli_version: CLI_VERSION });
10
+ capture('command_started', { command: 'list', cli_version: CLI_VERSION });
11
11
  try {
12
12
  const user = await requireAuth();
13
- const spinner = ora("Fetching sites...").start();
13
+ const spinner = ora('Fetching sites...').start();
14
14
  const sitesData = await getSites();
15
15
  const sites = sitesData.sites || [];
16
16
  spinner.stop();
17
17
  if (sites.length === 0) {
18
- console.log(chalk.gray("\nNo sites found.\n"));
18
+ console.log(chalk.gray('\nNo sites found.\n'));
19
19
  return;
20
20
  }
21
21
  console.log(chalk.bold(`\nFound ${sites.length} site(s):\n`));
22
22
  for (const site of sites) {
23
- const url = getSiteUrl(site.projectName, user.username || user.email || "user");
23
+ const url = getSiteUrl(site.projectName, user.username || user.email || 'user');
24
24
  const dashboardUrl = `${API_URL}/site/${site.id}/settings`;
25
25
  console.log(chalk.cyan(` ${site.projectName}`));
26
26
  console.log(chalk.gray(` URL: ${url}`));
@@ -29,18 +29,18 @@ export async function listCommand() {
29
29
  console.log(chalk.gray(` Updated: ${formatDate(site.updatedAt || site.createdAt)}`));
30
30
  console.log();
31
31
  }
32
- capture("command_succeeded", {
33
- command: "list",
32
+ capture('command_succeeded', {
33
+ command: 'list',
34
34
  cli_version: CLI_VERSION,
35
35
  duration_ms: Date.now() - startTime,
36
36
  });
37
37
  }
38
38
  catch (error) {
39
- capture("command_failed", {
40
- command: "list",
39
+ capture('command_failed', {
40
+ command: 'list',
41
41
  cli_version: CLI_VERSION,
42
42
  duration_ms: Date.now() - startTime,
43
- error_type: error instanceof Error ? error.constructor.name : "Unknown",
43
+ error_type: error instanceof Error ? error.constructor.name : 'Unknown',
44
44
  error_message: error instanceof Error ? error.message : String(error),
45
45
  });
46
46
  if (error instanceof Error) {
@@ -48,7 +48,7 @@ export async function listCommand() {
48
48
  console.error(chalk.gray(error.stack));
49
49
  }
50
50
  else {
51
- displayError("An unknown error occurred");
51
+ displayError('An unknown error occurred');
52
52
  }
53
53
  await flushTelemetry();
54
54
  process.exit(1);
@@ -1,21 +1,21 @@
1
- import { existsSync } from "fs";
2
- import { resolve } from "path";
3
- import chalk from "chalk";
4
- import ora from "ora";
5
- import cliProgress from "cli-progress";
6
- import { createSite, syncFiles, uploadToR2, getSiteByName, } from "../api-client.js";
7
- import { discoverFiles, getProjectName, validateFiles } from "../files.js";
8
- import { displayPublishSuccess, displayError, displayWarning, waitForSync, } from "../utils.js";
9
- import { requireAuth } from "../auth.js";
10
- import { capture, flushTelemetry, CLI_VERSION } from "../telemetry.js";
1
+ import { existsSync } from 'fs';
2
+ import { resolve } from 'path';
3
+ import chalk from 'chalk';
4
+ import ora from 'ora';
5
+ import cliProgress from 'cli-progress';
6
+ import { createSite, syncFiles, uploadToR2, getSiteByName, } from '../api-client.js';
7
+ import { discoverFiles, getProjectName, validateFiles } from '../files.js';
8
+ import { displayPublishSuccess, displayError, displayWarning, waitForSync, } from '../utils.js';
9
+ import { requireAuth } from '../auth.js';
10
+ import { capture, flushTelemetry, CLI_VERSION } from '../telemetry.js';
11
11
  export async function publishCommand(inputPaths, overwrite = false, siteName) {
12
12
  const startTime = Date.now();
13
- capture("command_started", { command: "publish", cli_version: CLI_VERSION });
13
+ capture('command_started', { command: 'publish', cli_version: CLI_VERSION });
14
14
  try {
15
15
  const spinner = ora();
16
16
  const user = await requireAuth();
17
17
  spinner.succeed(`Publishing as: ${user.username || user.email}`);
18
- spinner.start("Discovering files...");
18
+ spinner.start('Discovering files...');
19
19
  const paths = Array.isArray(inputPaths) ? inputPaths : [inputPaths];
20
20
  const absolutePaths = [];
21
21
  for (const inputPath of paths) {
@@ -38,16 +38,16 @@ export async function publishCommand(inputPaths, overwrite = false, siteName) {
38
38
  `💡 Tip: Use the --overwrite flag to publish over an existing site.`);
39
39
  process.exit(1);
40
40
  }
41
- spinner.start("Creating site...");
41
+ spinner.start('Creating site...');
42
42
  const siteData = await createSite(projectName, overwrite);
43
43
  const site = siteData.site;
44
44
  spinner.succeed(`Site created (ID: ${site.id})`);
45
45
  const uploadBar = new cliProgress.SingleBar({
46
- format: "Uploading |" +
47
- chalk.cyan("{bar}") +
48
- "| {percentage}% | {value}/{total} files",
49
- barCompleteChar: "\u2588",
50
- barIncompleteChar: "\u2591",
46
+ format: 'Uploading |' +
47
+ chalk.cyan('{bar}') +
48
+ '| {percentage}% | {value}/{total} files',
49
+ barCompleteChar: '\u2588',
50
+ barIncompleteChar: '\u2591',
51
51
  hideCursor: true,
52
52
  }, cliProgress.Presets.shades_classic);
53
53
  const fileMetadata = files.map((file) => ({
@@ -68,7 +68,7 @@ export async function publishCommand(inputPaths, overwrite = false, siteName) {
68
68
  uploadResults.push({
69
69
  path: uploadInfo.path,
70
70
  success: false,
71
- error: "File not found in local files",
71
+ error: 'File not found in local files',
72
72
  });
73
73
  uploadBar.increment();
74
74
  continue;
@@ -82,7 +82,7 @@ export async function publishCommand(inputPaths, overwrite = false, siteName) {
82
82
  uploadResults.push({
83
83
  path: file.path,
84
84
  success: false,
85
- error: error instanceof Error ? error.message : "Unknown error",
85
+ error: error instanceof Error ? error.message : 'Unknown error',
86
86
  });
87
87
  uploadBar.increment();
88
88
  }
@@ -100,26 +100,26 @@ export async function publishCommand(inputPaths, overwrite = false, siteName) {
100
100
  }
101
101
  const syncResult = await waitForSync(site.id, 30);
102
102
  if (syncResult.timeout) {
103
- displayWarning("Some files are still processing after 30 seconds.\n" +
104
- "Your site is available but some pages may not be ready yet.\n" +
105
- "Check back in a moment.");
103
+ displayWarning('Some files are still processing after 30 seconds.\n' +
104
+ 'Your site is available but some pages may not be ready yet.\n' +
105
+ 'Check back in a moment.');
106
106
  }
107
107
  else if (!syncResult.success && syncResult.errors) {
108
- displayWarning("Some files had processing errors (see above).");
108
+ displayWarning('Some files had processing errors (see above).');
109
109
  }
110
- capture("command_succeeded", {
111
- command: "publish",
110
+ capture('command_succeeded', {
111
+ command: 'publish',
112
112
  cli_version: CLI_VERSION,
113
113
  duration_ms: Date.now() - startTime,
114
114
  });
115
- displayPublishSuccess(site.projectName, user.username || user.email || "user");
115
+ displayPublishSuccess(site.projectName, user.username || user.email || 'user');
116
116
  }
117
117
  catch (error) {
118
- capture("command_failed", {
119
- command: "publish",
118
+ capture('command_failed', {
119
+ command: 'publish',
120
120
  cli_version: CLI_VERSION,
121
121
  duration_ms: Date.now() - startTime,
122
- error_type: error instanceof Error ? error.constructor.name : "Unknown",
122
+ error_type: error instanceof Error ? error.constructor.name : 'Unknown',
123
123
  error_message: error instanceof Error ? error.message : String(error),
124
124
  });
125
125
  if (error instanceof Error) {
@@ -127,7 +127,7 @@ export async function publishCommand(inputPaths, overwrite = false, siteName) {
127
127
  console.error(chalk.gray(error.stack));
128
128
  }
129
129
  else {
130
- displayError("An unknown error occurred");
130
+ displayError('An unknown error occurred');
131
131
  }
132
132
  await flushTelemetry();
133
133
  process.exit(1);
@@ -1,13 +1,13 @@
1
- import { existsSync } from "fs";
2
- import { resolve } from "path";
3
- import chalk from "chalk";
4
- import ora from "ora";
5
- import cliProgress from "cli-progress";
6
- import { requireAuth } from "../auth.js";
7
- import { syncFiles, uploadToR2, getSiteByName } from "../api-client.js";
8
- import { discoverFiles, getProjectName, validateFiles } from "../files.js";
9
- import { displayError, displayWarning, waitForSync } from "../utils.js";
10
- import { capture, flushTelemetry, CLI_VERSION } from "../telemetry.js";
1
+ import { existsSync } from 'fs';
2
+ import { resolve } from 'path';
3
+ import chalk from 'chalk';
4
+ import ora from 'ora';
5
+ import cliProgress from 'cli-progress';
6
+ import { requireAuth } from '../auth.js';
7
+ import { syncFiles, uploadToR2, getSiteByName } from '../api-client.js';
8
+ import { discoverFiles, getProjectName, validateFiles } from '../files.js';
9
+ import { displayError, displayWarning, waitForSync } from '../utils.js';
10
+ import { capture, flushTelemetry, CLI_VERSION } from '../telemetry.js';
11
11
  function displaySyncSummary(syncPlan, projectName, verbose = false) {
12
12
  console.log(chalk.bold(`\nSync Summary for '${projectName}':`));
13
13
  if (syncPlan.summary.toUpload > 0) {
@@ -47,18 +47,18 @@ function hasChanges(syncPlan) {
47
47
  syncPlan.summary.deleted > 0);
48
48
  }
49
49
  function displaySyncSuccess(projectName, username, summary) {
50
- console.log(chalk.green.bold("\n✅ Sync complete!"));
50
+ console.log(chalk.green.bold('\n✅ Sync complete!'));
51
51
  console.log(chalk.cyan(` Site: https://my.flowershow.app/@${username}/${projectName}`));
52
52
  console.log(chalk.gray(` New: ${summary.toUpload} | Updated: ${summary.toUpdate} | Deleted: ${summary.deleted} | Unchanged: ${summary.unchanged}`));
53
53
  }
54
54
  export async function syncCommand(inputPath, options = {}) {
55
55
  const startTime = Date.now();
56
- capture("command_started", { command: "sync", cli_version: CLI_VERSION });
56
+ capture('command_started', { command: 'sync', cli_version: CLI_VERSION });
57
57
  try {
58
58
  const spinner = ora();
59
59
  const user = await requireAuth();
60
60
  spinner.succeed(`Syncing as: ${user.username || user.email}`);
61
- spinner.start("Discovering files...");
61
+ spinner.start('Discovering files...');
62
62
  const absolutePath = resolve(inputPath);
63
63
  if (!existsSync(absolutePath)) {
64
64
  displayError(`Path not found: ${inputPath}`);
@@ -79,29 +79,29 @@ export async function syncCommand(inputPath, options = {}) {
79
79
  size: file.size,
80
80
  sha: file.sha,
81
81
  }));
82
- spinner.start("Analyzing changes...");
82
+ spinner.start('Analyzing changes...');
83
83
  const syncPlan = await syncFiles(existingSite.site.id, fileMetadata, options.dryRun || false);
84
84
  spinner.stop();
85
85
  if (!hasChanges(syncPlan)) {
86
- console.log(chalk.green.bold("\n✅ Already in sync!"));
86
+ console.log(chalk.green.bold('\n✅ Already in sync!'));
87
87
  console.log(chalk.gray(` All ${files.length} file(s) are up to date.`));
88
88
  console.log(chalk.cyan(` Site: https://my.flowershow.app/@${user.username || user.email}/${projectName}`));
89
89
  return;
90
90
  }
91
91
  displaySyncSummary(syncPlan, projectName, options.verbose || false);
92
92
  if (options.dryRun || syncPlan.dryRun) {
93
- console.log(chalk.yellow("\n🔍 Dry run complete - no changes were made to your site"));
94
- console.log(chalk.gray(" Run without --dry-run to apply these changes"));
93
+ console.log(chalk.yellow('\n🔍 Dry run complete - no changes were made to your site'));
94
+ console.log(chalk.gray(' Run without --dry-run to apply these changes'));
95
95
  return;
96
96
  }
97
97
  const allFilesToUpload = [...syncPlan.toUpload, ...syncPlan.toUpdate];
98
98
  if (allFilesToUpload.length > 0) {
99
99
  const uploadBar = new cliProgress.SingleBar({
100
- format: "Uploading |" +
101
- chalk.cyan("{bar}") +
102
- "| {percentage}% | {value}/{total} files",
103
- barCompleteChar: "\u2588",
104
- barIncompleteChar: "\u2591",
100
+ format: 'Uploading |' +
101
+ chalk.cyan('{bar}') +
102
+ '| {percentage}% | {value}/{total} files',
103
+ barCompleteChar: '\u2588',
104
+ barIncompleteChar: '\u2591',
105
105
  hideCursor: true,
106
106
  }, cliProgress.Presets.shades_classic);
107
107
  uploadBar.start(allFilesToUpload.length, 0);
@@ -115,7 +115,7 @@ export async function syncCommand(inputPath, options = {}) {
115
115
  uploadResults.push({
116
116
  path: uploadInfo.path,
117
117
  success: false,
118
- error: "File not found in local files",
118
+ error: 'File not found in local files',
119
119
  });
120
120
  uploadBar.increment();
121
121
  continue;
@@ -129,7 +129,7 @@ export async function syncCommand(inputPath, options = {}) {
129
129
  uploadResults.push({
130
130
  path: file.path,
131
131
  success: false,
132
- error: error instanceof Error ? error.message : "Unknown error",
132
+ error: error instanceof Error ? error.message : 'Unknown error',
133
133
  });
134
134
  uploadBar.increment();
135
135
  }
@@ -156,26 +156,26 @@ export async function syncCommand(inputPath, options = {}) {
156
156
  }
157
157
  const syncResult = await waitForSync(existingSite.site.id, 30);
158
158
  if (syncResult.timeout) {
159
- displayWarning("Some files are still processing after 30 seconds.\n" +
160
- "Your site is available but some pages may not be ready yet.\n" +
161
- "Check back in a moment.");
159
+ displayWarning('Some files are still processing after 30 seconds.\n' +
160
+ 'Your site is available but some pages may not be ready yet.\n' +
161
+ 'Check back in a moment.');
162
162
  }
163
163
  else if (!syncResult.success && syncResult.errors) {
164
- displayWarning("Some files had processing errors (see above).");
164
+ displayWarning('Some files had processing errors (see above).');
165
165
  }
166
- capture("command_succeeded", {
167
- command: "sync",
166
+ capture('command_succeeded', {
167
+ command: 'sync',
168
168
  cli_version: CLI_VERSION,
169
169
  duration_ms: Date.now() - startTime,
170
170
  });
171
- displaySyncSuccess(projectName, user.username || user.email || "user", syncPlan.summary);
171
+ displaySyncSuccess(projectName, user.username || user.email || 'user', syncPlan.summary);
172
172
  }
173
173
  catch (error) {
174
- capture("command_failed", {
175
- command: "sync",
174
+ capture('command_failed', {
175
+ command: 'sync',
176
176
  cli_version: CLI_VERSION,
177
177
  duration_ms: Date.now() - startTime,
178
- error_type: error instanceof Error ? error.constructor.name : "Unknown",
178
+ error_type: error instanceof Error ? error.constructor.name : 'Unknown',
179
179
  error_message: error instanceof Error ? error.message : String(error),
180
180
  });
181
181
  if (error instanceof Error) {
@@ -183,7 +183,7 @@ export async function syncCommand(inputPath, options = {}) {
183
183
  console.error(chalk.gray(error.stack));
184
184
  }
185
185
  else {
186
- displayError("An unknown error occurred");
186
+ displayError('An unknown error occurred');
187
187
  }
188
188
  await flushTelemetry();
189
189
  process.exit(1);
@@ -1,4 +1,4 @@
1
- import "dotenv/config";
1
+ import 'dotenv/config';
2
2
  export declare const API_URL: string;
3
3
  export declare const APP_URL: string;
4
4
  export declare const POSTHOG_API_KEY: string;
@@ -1 +1 @@
1
- {"version":3,"file":"const.d.ts","sourceRoot":"","sources":["../../lib/const.ts"],"names":[],"mappings":"AAAA,OAAO,eAAe,CAAC;AAEvB,eAAO,MAAM,OAAO,QAAwD,CAAC;AAC7E,eAAO,MAAM,OAAO,QAAqD,CAAC;AAC1E,eAAO,MAAM,eAAe,QACsD,CAAC;AACnF,eAAO,MAAM,YAAY,QAC+B,CAAC"}
1
+ {"version":3,"file":"const.d.ts","sourceRoot":"","sources":["../../lib/const.ts"],"names":[],"mappings":"AAAA,OAAO,eAAe,CAAC;AAEvB,eAAO,MAAM,OAAO,QAAwD,CAAC;AAC7E,eAAO,MAAM,OAAO,QAAqD,CAAC;AAC1E,eAAO,MAAM,eAAe,QAEuB,CAAC;AACpD,eAAO,MAAM,YAAY,QAC+B,CAAC"}
package/dist/lib/const.js CHANGED
@@ -1,6 +1,7 @@
1
- import "dotenv/config";
2
- export const API_URL = process.env.API_URL || "https://cloud.flowershow.app";
3
- export const APP_URL = process.env.APP_URL || "https://my.flowershow.app";
4
- export const POSTHOG_API_KEY = process.env.POSTHOG_API_KEY || "phc_QsAoymFdEUOjN9mv1yhWBXkVtbMNHTfbhJhnrzUlkke";
5
- export const POSTHOG_HOST = process.env.POSTHOG_HOST || "https://eu.i.posthog.com";
1
+ import 'dotenv/config';
2
+ export const API_URL = process.env.API_URL || 'https://cloud.flowershow.app';
3
+ export const APP_URL = process.env.APP_URL || 'https://my.flowershow.app';
4
+ export const POSTHOG_API_KEY = process.env.POSTHOG_API_KEY ||
5
+ 'phc_QsAoymFdEUOjN9mv1yhWBXkVtbMNHTfbhJhnrzUlkke';
6
+ export const POSTHOG_HOST = process.env.POSTHOG_HOST || 'https://eu.i.posthog.com';
6
7
  //# sourceMappingURL=const.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"const.js","sourceRoot":"","sources":["../../lib/const.ts"],"names":[],"mappings":"AAAA,OAAO,eAAe,CAAC;AAEvB,MAAM,CAAC,MAAM,OAAO,GAAG,OAAO,CAAC,GAAG,CAAC,OAAO,IAAI,8BAA8B,CAAC;AAC7E,MAAM,CAAC,MAAM,OAAO,GAAG,OAAO,CAAC,GAAG,CAAC,OAAO,IAAI,2BAA2B,CAAC;AAC1E,MAAM,CAAC,MAAM,eAAe,GAC1B,OAAO,CAAC,GAAG,CAAC,eAAe,IAAI,iDAAiD,CAAC;AACnF,MAAM,CAAC,MAAM,YAAY,GACvB,OAAO,CAAC,GAAG,CAAC,YAAY,IAAI,0BAA0B,CAAC"}
1
+ {"version":3,"file":"const.js","sourceRoot":"","sources":["../../lib/const.ts"],"names":[],"mappings":"AAAA,OAAO,eAAe,CAAC;AAEvB,MAAM,CAAC,MAAM,OAAO,GAAG,OAAO,CAAC,GAAG,CAAC,OAAO,IAAI,8BAA8B,CAAC;AAC7E,MAAM,CAAC,MAAM,OAAO,GAAG,OAAO,CAAC,GAAG,CAAC,OAAO,IAAI,2BAA2B,CAAC;AAC1E,MAAM,CAAC,MAAM,eAAe,GAC1B,OAAO,CAAC,GAAG,CAAC,eAAe;IAC3B,iDAAiD,CAAC;AACpD,MAAM,CAAC,MAAM,YAAY,GACvB,OAAO,CAAC,GAAG,CAAC,YAAY,IAAI,0BAA0B,CAAC"}