@embeddable.com/init 0.1.1 → 0.1.2

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 (2) hide show
  1. package/dist/index.js +23 -13
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -19,6 +19,12 @@ function exit(message) {
19
19
  if (message) console.log(message);
20
20
  process.exit(0);
21
21
  }
22
+ function printDocsHint() {
23
+ const docsUrl = "https://docs.embeddable.com";
24
+ const docsLink = terminalLink(docsUrl, docsUrl, { fallback: (text) => text });
25
+ console.log(`If you get stuck, please follow our 'Quick-start guide' at ${chalk.cyan(docsLink)}
26
+ `);
27
+ }
22
28
  function validateFolderName(value, cwd) {
23
29
  const trimmed = value.trim();
24
30
  if (!trimmed) return "Folder name is required";
@@ -40,7 +46,7 @@ function isValidUuid(value) {
40
46
  async function main() {
41
47
  const onCancel = () => exit("\nSetup cancelled.\n");
42
48
  console.log(chalk.bold("\nWelcome to Embeddable!\n"));
43
- console.log(`Embeddable stores your ${chalk.bold("charting components")}, ${chalk.bold("data models")} and ${chalk.bold("themes")} in code, so you have full control over the look-and-feel and the data powering your dashboards.
49
+ console.log(`Embeddable stores your ${chalk.bold("charting components")}, ${chalk.bold("data models")} and ${chalk.bold("themes")} in code, so you have ${chalk.bold("full control")} over the ${chalk.bold("look-and-feel")} and the ${chalk.bold("data")} powering your dashboards.
44
50
  `);
45
51
  console.log("This tool helps you get set up to create your first Embeddable dashboard.\n");
46
52
  const cwd = process.cwd();
@@ -82,6 +88,7 @@ async function main() {
82
88
  console.error(chalk.red(`
83
89
  Failed to download boilerplate: ${message}
84
90
  `));
91
+ printDocsHint();
85
92
  process.exit(1);
86
93
  }
87
94
  try {
@@ -95,16 +102,18 @@ Failed to download boilerplate: ${message}
95
102
  try {
96
103
  execSync("npm install", { cwd: projectPath, stdio: "inherit" });
97
104
  } catch {
98
- console.log(
99
- chalk.yellow("\nWarning: npm install failed. You can run it manually.")
100
- );
105
+ console.error(chalk.red("\nnpm install failed.\n"));
106
+ printDocsHint();
107
+ process.exit(1);
101
108
  }
109
+ console.log(`
110
+ `);
102
111
  const { apiKey } = await prompts(
103
112
  {
104
113
  type: "password",
105
114
  name: "apiKey",
106
- message: `
107
- Grab your API key (to create an account, head to ${chalk.cyan("https://embeddable.com/select-region")}) and paste it here:`,
115
+ message: `You'll need an API Key to push this code bundle to your workspace (to create an account, head to ${chalk.cyan("https://embeddable.com/start")}).
116
+ Paste your API Key here:`,
108
117
  validate: (value) => {
109
118
  const trimmed = value.trim();
110
119
  if (!trimmed) return "API key is required";
@@ -166,20 +175,20 @@ Grab your API key (to create an account, head to ${chalk.cyan("https://embeddabl
166
175
  try {
167
176
  execSync("npm run embeddable:build", { cwd: projectPath, stdio: "inherit" });
168
177
  } catch {
169
- console.log(
170
- chalk.yellow("\nWarning: embeddable:build failed. You can run it manually.")
171
- );
178
+ console.error(chalk.red("\nFailed to build bundle.\n"));
179
+ printDocsHint();
180
+ process.exit(1);
172
181
  }
173
- console.log(chalk.dim("\nPushing to workspace...\n"));
182
+ console.log(chalk.dim("\nPushing bundle to workspace...\n"));
174
183
  try {
175
184
  execSync(
176
185
  `npm run embeddable:push -- --api-key ${apiKey.trim()} --email "no-reply@embeddable.com" --message "npx @embeddable.com/init"`,
177
186
  { cwd: projectPath, stdio: "inherit" }
178
187
  );
179
188
  } catch {
180
- console.log(
181
- chalk.yellow("\nWarning: embeddable:push failed. You can run it manually.")
182
- );
189
+ console.error(chalk.red("\nFailed to push bundle to workspace.\n"));
190
+ printDocsHint();
191
+ process.exit(1);
183
192
  }
184
193
  const workspaceUrl = WORKSPACE_URLS[region];
185
194
  const workspaceLink = terminalLink(workspaceUrl, workspaceUrl, {
@@ -200,5 +209,6 @@ Success!
200
209
  }
201
210
  main().catch((error) => {
202
211
  console.error(chalk.red("An unexpected error occurred:"), error);
212
+ printDocsHint();
203
213
  process.exit(1);
204
214
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@embeddable.com/init",
3
- "version": "0.1.1",
3
+ "version": "0.1.2",
4
4
  "description": "CLI tool for Embeddable",
5
5
  "type": "module",
6
6
  "bin": {