@embeddable.com/init 0.1.3 → 0.1.5
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/dist/index.js +28 -10
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -11,6 +11,7 @@ import terminalLink from "terminal-link";
|
|
|
11
11
|
import open from "open";
|
|
12
12
|
var REPO_URL = "embeddable-hq/remarkable-pro-boilerplate";
|
|
13
13
|
var DEFAULT_FOLDER = "embeddable-repo";
|
|
14
|
+
var TYPEWRITER_SPEED = 10;
|
|
14
15
|
var WORKSPACE_URLS = {
|
|
15
16
|
US: "https://app.us.embeddable.com",
|
|
16
17
|
EU: "https://app.eu.embeddable.com"
|
|
@@ -44,6 +45,12 @@ function isValidUuid(value) {
|
|
|
44
45
|
const uuidRegex = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
|
|
45
46
|
return uuidRegex.test(value.trim());
|
|
46
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
|
+
}
|
|
47
54
|
var LOGO = `
|
|
48
55
|
\u2584\u2584\u2588\u2588\u2588\u2588\u2584\u2584
|
|
49
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
|
|
@@ -56,10 +63,21 @@ var LOGO = `
|
|
|
56
63
|
async function main() {
|
|
57
64
|
const onCancel = () => exit("\nSetup cancelled.\n");
|
|
58
65
|
console.log(chalk.white(LOGO));
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
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);
|
|
63
81
|
const cwd = process.cwd();
|
|
64
82
|
const { confirmDir } = await prompts(
|
|
65
83
|
{
|
|
@@ -123,7 +141,7 @@ Failed to download boilerplate: ${message}
|
|
|
123
141
|
{
|
|
124
142
|
type: "password",
|
|
125
143
|
name: "apiKey",
|
|
126
|
-
message: `You'll need an API Key to push this code bundle to your workspace
|
|
144
|
+
message: `You'll need an API Key to push this code bundle to your account's workspace
|
|
127
145
|
(to create an account, head to ${chalk.cyan("https://embeddable.com/start")}).
|
|
128
146
|
|
|
129
147
|
Paste your API Key here:`,
|
|
@@ -147,7 +165,7 @@ Paste your API Key here:`,
|
|
|
147
165
|
{
|
|
148
166
|
type: "select",
|
|
149
167
|
name: "region",
|
|
150
|
-
message: "Confirm your workspace region:",
|
|
168
|
+
message: "Confirm your workspace region (you can find this in your workspace):",
|
|
151
169
|
choices: [
|
|
152
170
|
{ title: "US", value: "US" },
|
|
153
171
|
{ title: "EU", value: "EU" }
|
|
@@ -185,7 +203,7 @@ Paste your API Key here:`,
|
|
|
185
203
|
);
|
|
186
204
|
}
|
|
187
205
|
}
|
|
188
|
-
console.log(chalk.dim("\nBuilding bundle
|
|
206
|
+
console.log(chalk.dim("\nBuilding bundle..."));
|
|
189
207
|
try {
|
|
190
208
|
execSync("npm run embeddable:build", { cwd: projectPath, stdio: "inherit" });
|
|
191
209
|
} catch {
|
|
@@ -193,7 +211,7 @@ Paste your API Key here:`,
|
|
|
193
211
|
printDocsHint();
|
|
194
212
|
process.exit(1);
|
|
195
213
|
}
|
|
196
|
-
console.log(chalk.dim("
|
|
214
|
+
console.log(chalk.dim("Pushing bundle to workspace..."));
|
|
197
215
|
try {
|
|
198
216
|
execSync(
|
|
199
217
|
`npm run embeddable:push -- --api-key ${apiKey.trim()} --email "no-reply@embeddable.com" --message "npx @embeddable.com/init"`,
|
|
@@ -215,12 +233,12 @@ Paste your API Key here:`,
|
|
|
215
233
|
console.log(chalk.green(`
|
|
216
234
|
Success!
|
|
217
235
|
`));
|
|
218
|
-
console.log(`You have pushed
|
|
236
|
+
console.log(`You have pushed Embeddable's ${chalk.bold("default chart library")} and sample ${chalk.bold("data models")} to your workspace.`);
|
|
219
237
|
console.log(`Refresh your workspace page to see the "Create new Embeddable" button and the sample dashboards: ${chalk.cyan(workspaceLink)}
|
|
220
238
|
`);
|
|
221
239
|
console.log(`Follow the guide here to create your first Embeddable dashboard: ${chalk.cyan(docsLink)}
|
|
222
240
|
`);
|
|
223
|
-
await open(
|
|
241
|
+
await open("https://docs.embeddable.com/getting-started/set-up-your-workspace#refresh-your-workspace");
|
|
224
242
|
}
|
|
225
243
|
main().catch((error) => {
|
|
226
244
|
console.error(chalk.red("An unexpected error occurred:"), error);
|