@embeddable.com/init 0.1.2 → 0.1.4

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 +41 -8
  2. package/package.json +2 -1
package/dist/index.js CHANGED
@@ -8,8 +8,10 @@ import chalk from "chalk";
8
8
  import degit from "degit";
9
9
  import prompts from "prompts";
10
10
  import terminalLink from "terminal-link";
11
+ import open from "open";
11
12
  var REPO_URL = "embeddable-hq/remarkable-pro-boilerplate";
12
13
  var DEFAULT_FOLDER = "embeddable-repo";
14
+ var TYPEWRITER_SPEED = 10;
13
15
  var WORKSPACE_URLS = {
14
16
  US: "https://app.us.embeddable.com",
15
17
  EU: "https://app.eu.embeddable.com"
@@ -43,12 +45,39 @@ function isValidUuid(value) {
43
45
  const uuidRegex = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
44
46
  return uuidRegex.test(value.trim());
45
47
  }
48
+ async function typewriter(text, style, speed = 10) {
49
+ for (const char of text) {
50
+ process.stdout.write(style ? style(char) : char);
51
+ await new Promise((resolve) => setTimeout(resolve, speed));
52
+ }
53
+ }
54
+ var LOGO = `
55
+ \u2584\u2584\u2588\u2588\u2588\u2588\u2584\u2584
56
+ \u2584\u2588\u2588\u2580\u2580\u2580\u2580\u2580\u2580\u2588\u2588\u2584 \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2557\u2588\u2588\u2588\u2557 \u2588\u2588\u2588\u2557\u2588\u2588\u2588\u2588\u2588\u2588\u2557 \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2557\u2588\u2588\u2588\u2588\u2588\u2588\u2557 \u2588\u2588\u2588\u2588\u2588\u2588\u2557 \u2588\u2588\u2588\u2588\u2588\u2557 \u2588\u2588\u2588\u2588\u2588\u2588\u2557 \u2588\u2588\u2557 \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2557
57
+ \u2588\u2588 \u2588\u2588\u2588\u2588\u2588 \u2588\u2588 \u2588\u2588\u2554\u2550\u2550\u2550\u2550\u255D\u2588\u2588\u2588\u2588\u2557 \u2588\u2588\u2588\u2588\u2551\u2588\u2588\u2554\u2550\u2550\u2588\u2588\u2557\u2588\u2588\u2554\u2550\u2550\u2550\u2550\u255D\u2588\u2588\u2554\u2550\u2550\u2588\u2588\u2557\u2588\u2588\u2554\u2550\u2550\u2588\u2588\u2557\u2588\u2588\u2554\u2550\u2550\u2588\u2588\u2557\u2588\u2588\u2554\u2550\u2550\u2588\u2588\u2557\u2588\u2588\u2551 \u2588\u2588\u2554\u2550\u2550\u2550\u2550\u255D
58
+ \u2588\u2588 \u2588\u2588\u2588 \u2588\u2588 \u2588\u2588\u2588\u2588\u2588\u2557 \u2588\u2588\u2554\u2588\u2588\u2588\u2588\u2554\u2588\u2588\u2551\u2588\u2588\u2588\u2588\u2588\u2588\u2554\u255D\u2588\u2588\u2588\u2588\u2588\u2557 \u2588\u2588\u2551 \u2588\u2588\u2551\u2588\u2588\u2551 \u2588\u2588\u2551\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2551\u2588\u2588\u2588\u2588\u2588\u2588\u2554\u255D\u2588\u2588\u2551 \u2588\u2588\u2588\u2588\u2588\u2557
59
+ \u2588\u2588 \u2588\u2588\u2588\u2588\u2588 \u2588\u2588 \u2588\u2588\u2554\u2550\u2550\u255D \u2588\u2588\u2551\u255A\u2588\u2588\u2554\u255D\u2588\u2588\u2551\u2588\u2588\u2554\u2550\u2550\u2588\u2588\u2557\u2588\u2588\u2554\u2550\u2550\u255D \u2588\u2588\u2551 \u2588\u2588\u2551\u2588\u2588\u2551 \u2588\u2588\u2551\u2588\u2588\u2554\u2550\u2550\u2588\u2588\u2551\u2588\u2588\u2554\u2550\u2550\u2588\u2588\u2557\u2588\u2588\u2551 \u2588\u2588\u2554\u2550\u2550\u255D
60
+ \u2580\u2588\u2588\u2584\u2584\u2584\u2584\u2584\u2584\u2588\u2588\u2580 \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2557\u2588\u2588\u2551 \u255A\u2550\u255D \u2588\u2588\u2551\u2588\u2588\u2588\u2588\u2588\u2588\u2554\u255D\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2557\u2588\u2588\u2588\u2588\u2588\u2588\u2554\u255D\u2588\u2588\u2588\u2588\u2588\u2588\u2554\u255D\u2588\u2588\u2551 \u2588\u2588\u2551\u2588\u2588\u2588\u2588\u2588\u2588\u2554\u255D\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2557\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2557
61
+ \u2580\u2580\u2588\u2588\u2588\u2588\u2580\u2580 \u255A\u2550\u2550\u2550\u2550\u2550\u2550\u255D\u255A\u2550\u255D \u255A\u2550\u255D\u255A\u2550\u2550\u2550\u2550\u2550\u255D \u255A\u2550\u2550\u2550\u2550\u2550\u2550\u255D\u255A\u2550\u2550\u2550\u2550\u2550\u255D \u255A\u2550\u2550\u2550\u2550\u2550\u255D \u255A\u2550\u255D \u255A\u2550\u255D\u255A\u2550\u2550\u2550\u2550\u2550\u255D \u255A\u2550\u2550\u2550\u2550\u2550\u2550\u255D\u255A\u2550\u2550\u2550\u2550\u2550\u2550\u255D
62
+ `;
46
63
  async function main() {
47
64
  const onCancel = () => exit("\nSetup cancelled.\n");
48
- console.log(chalk.bold("\nWelcome to Embeddable!\n"));
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.
50
- `);
51
- console.log("This tool helps you get set up to create your first Embeddable dashboard.\n");
65
+ console.log(chalk.white(LOGO));
66
+ await typewriter("Welcome to Embeddable!\n\n", chalk.bold, TYPEWRITER_SPEED);
67
+ await typewriter("Embeddable stores your ", void 0, TYPEWRITER_SPEED);
68
+ await typewriter("charting components", chalk.bold, TYPEWRITER_SPEED);
69
+ await typewriter(", ", void 0, TYPEWRITER_SPEED);
70
+ await typewriter("data models", chalk.bold, TYPEWRITER_SPEED);
71
+ await typewriter(" and ", void 0, TYPEWRITER_SPEED);
72
+ await typewriter("themes", chalk.bold, TYPEWRITER_SPEED);
73
+ await typewriter(" in code, so you have ", void 0, TYPEWRITER_SPEED);
74
+ await typewriter("full control", chalk.bold, TYPEWRITER_SPEED);
75
+ await typewriter(" over the ", void 0, TYPEWRITER_SPEED);
76
+ await typewriter("look-and-feel", chalk.bold, TYPEWRITER_SPEED);
77
+ await typewriter(" and the ", void 0, TYPEWRITER_SPEED);
78
+ await typewriter("data", chalk.bold, TYPEWRITER_SPEED);
79
+ await typewriter(" powering your dashboards.\n\n", void 0, TYPEWRITER_SPEED);
80
+ await typewriter("This tool helps you get set up to create your first Embeddable dashboard.\n\n", void 0, TYPEWRITER_SPEED);
52
81
  const cwd = process.cwd();
53
82
  const { confirmDir } = await prompts(
54
83
  {
@@ -112,7 +141,9 @@ Failed to download boilerplate: ${message}
112
141
  {
113
142
  type: "password",
114
143
  name: "apiKey",
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")}).
144
+ message: `You'll need an API Key to push this code bundle to your workspace
145
+ (to create an account, head to ${chalk.cyan("https://embeddable.com/start")}).
146
+
116
147
  Paste your API Key here:`,
117
148
  validate: (value) => {
118
149
  const trimmed = value.trim();
@@ -129,6 +160,7 @@ Paste your API Key here:`,
129
160
  const embeddableDir = path.join(projectPath, ".embeddable");
130
161
  fs.mkdirSync(embeddableDir, { recursive: true });
131
162
  fs.writeFileSync(path.join(embeddableDir, ".api-key"), apiKey.trim());
163
+ console.log("");
132
164
  const regionResponse = await prompts(
133
165
  {
134
166
  type: "select",
@@ -171,7 +203,7 @@ Paste your API Key here:`,
171
203
  );
172
204
  }
173
205
  }
174
- console.log(chalk.dim("\nBuilding bundle...\n"));
206
+ console.log(chalk.dim("\nBuilding bundle..."));
175
207
  try {
176
208
  execSync("npm run embeddable:build", { cwd: projectPath, stdio: "inherit" });
177
209
  } catch {
@@ -179,7 +211,7 @@ Paste your API Key here:`,
179
211
  printDocsHint();
180
212
  process.exit(1);
181
213
  }
182
- console.log(chalk.dim("\nPushing bundle to workspace...\n"));
214
+ console.log(chalk.dim("Pushing bundle to workspace..."));
183
215
  try {
184
216
  execSync(
185
217
  `npm run embeddable:push -- --api-key ${apiKey.trim()} --email "no-reply@embeddable.com" --message "npx @embeddable.com/init"`,
@@ -202,10 +234,11 @@ Paste your API Key here:`,
202
234
  Success!
203
235
  `));
204
236
  console.log(`You have pushed your ${chalk.bold("components")} and ${chalk.bold("data models")} to workspace.`);
205
- console.log(`Head there now to build your first Embeddable: ${chalk.cyan(workspaceLink)}
237
+ console.log(`Refresh your workspace page to see the "Create new Embeddable" button and the sample dashboards: ${chalk.cyan(workspaceLink)}
206
238
  `);
207
239
  console.log(`Follow the guide here to create your first Embeddable dashboard: ${chalk.cyan(docsLink)}
208
240
  `);
241
+ await open(workspaceUrl);
209
242
  }
210
243
  main().catch((error) => {
211
244
  console.error(chalk.red("An unexpected error occurred:"), error);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@embeddable.com/init",
3
- "version": "0.1.2",
3
+ "version": "0.1.4",
4
4
  "description": "CLI tool for Embeddable",
5
5
  "type": "module",
6
6
  "bin": {
@@ -25,6 +25,7 @@
25
25
  "dependencies": {
26
26
  "chalk": "^5.3.0",
27
27
  "degit": "^2.8.4",
28
+ "open": "^11.0.0",
28
29
  "prompts": "^2.4.2",
29
30
  "terminal-link": "^5.0.0"
30
31
  },