@embeddable.com/init 0.1.5 → 0.1.7
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/README.md +105 -0
- package/dist/index.js +13 -6
- package/package.json +1 -1
package/README.md
ADDED
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
# @embeddable.com/init
|
|
2
|
+
|
|
3
|
+
A CLI tool that helps you quickly set up your first [Embeddable](https://embeddable.com) project. It guides you through the entire onboarding process—from project creation to pushing your first components to your workspace.
|
|
4
|
+
|
|
5
|
+
## Usage
|
|
6
|
+
|
|
7
|
+
Run the following command to get started:
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
npx @embeddable.com/init
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
The CLI will walk you through:
|
|
14
|
+
|
|
15
|
+
1. Creating a new project folder
|
|
16
|
+
2. Downloading the boilerplate project template
|
|
17
|
+
3. Installing dependencies
|
|
18
|
+
4. Configuring your API credentials and region (US/EU)
|
|
19
|
+
5. Building and deploying your initial bundle to your Embeddable workspace
|
|
20
|
+
|
|
21
|
+
## Requirements
|
|
22
|
+
|
|
23
|
+
- Node.js 20 or higher
|
|
24
|
+
- An Embeddable account with an API key
|
|
25
|
+
|
|
26
|
+
## Development
|
|
27
|
+
|
|
28
|
+
### Setup
|
|
29
|
+
|
|
30
|
+
```bash
|
|
31
|
+
npm install
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
### Build
|
|
35
|
+
|
|
36
|
+
```bash
|
|
37
|
+
npm run build
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
### Watch mode
|
|
41
|
+
|
|
42
|
+
```bash
|
|
43
|
+
npm run dev
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
### Test locally
|
|
47
|
+
|
|
48
|
+
After building, you can test the CLI locally:
|
|
49
|
+
|
|
50
|
+
```bash
|
|
51
|
+
node dist/index.js
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
or run from a separate directory:
|
|
55
|
+
|
|
56
|
+
```bash
|
|
57
|
+
npx <path-to-this-repo>
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
## Publishing to npm
|
|
61
|
+
|
|
62
|
+
### Prerequisites
|
|
63
|
+
|
|
64
|
+
1. Ensure you have an npm account with access to the `@embeddable.com` scope
|
|
65
|
+
2. Log in to npm:
|
|
66
|
+
```bash
|
|
67
|
+
npm login
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
### Publishing
|
|
71
|
+
|
|
72
|
+
1. Update the version in `package.json`:
|
|
73
|
+
```bash
|
|
74
|
+
npm version patch # or minor/major
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
2. Publish to npm:
|
|
78
|
+
```bash
|
|
79
|
+
npm publish --access public
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
The `prepublishOnly` script will automatically run the build before publishing.
|
|
83
|
+
|
|
84
|
+
### Verifying the release
|
|
85
|
+
|
|
86
|
+
After publishing, verify the package is available:
|
|
87
|
+
|
|
88
|
+
```bash
|
|
89
|
+
npm view @embeddable.com/init
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
## Project Structure
|
|
93
|
+
|
|
94
|
+
```
|
|
95
|
+
├── src/
|
|
96
|
+
│ └── index.ts # Main CLI application
|
|
97
|
+
├── dist/ # Compiled output (generated)
|
|
98
|
+
├── package.json # Package configuration
|
|
99
|
+
├── tsconfig.json # TypeScript configuration
|
|
100
|
+
└── tsup.config.ts # Build configuration
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
## License
|
|
104
|
+
|
|
105
|
+
MIT
|
package/dist/index.js
CHANGED
|
@@ -19,6 +19,7 @@ var WORKSPACE_URLS = {
|
|
|
19
19
|
var INVALID_FOLDER_CHARS = /[<>:"/\\|?*\x00-\x1f]/;
|
|
20
20
|
function exit(message) {
|
|
21
21
|
if (message) console.log(message);
|
|
22
|
+
printDocsHint();
|
|
22
23
|
process.exit(0);
|
|
23
24
|
}
|
|
24
25
|
function printDocsHint() {
|
|
@@ -64,7 +65,7 @@ async function main() {
|
|
|
64
65
|
const onCancel = () => exit("\nSetup cancelled.\n");
|
|
65
66
|
console.log(chalk.white(LOGO));
|
|
66
67
|
await typewriter("Welcome to Embeddable!\n\n", chalk.bold, TYPEWRITER_SPEED);
|
|
67
|
-
await typewriter("Embeddable
|
|
68
|
+
await typewriter("Embeddable lets you configure your ", void 0, TYPEWRITER_SPEED);
|
|
68
69
|
await typewriter("charting components", chalk.bold, TYPEWRITER_SPEED);
|
|
69
70
|
await typewriter(", ", void 0, TYPEWRITER_SPEED);
|
|
70
71
|
await typewriter("data models", chalk.bold, TYPEWRITER_SPEED);
|
|
@@ -77,13 +78,19 @@ async function main() {
|
|
|
77
78
|
await typewriter(" and the ", void 0, TYPEWRITER_SPEED);
|
|
78
79
|
await typewriter("data", chalk.bold, TYPEWRITER_SPEED);
|
|
79
80
|
await typewriter(" powering your dashboards.\n\n", void 0, TYPEWRITER_SPEED);
|
|
80
|
-
await typewriter("This tool
|
|
81
|
+
await typewriter("This tool creates a ", void 0, TYPEWRITER_SPEED);
|
|
82
|
+
await typewriter("new folder", chalk.bold, TYPEWRITER_SPEED);
|
|
83
|
+
await typewriter(", containing ", void 0, TYPEWRITER_SPEED);
|
|
84
|
+
await typewriter("sample data models", chalk.bold, TYPEWRITER_SPEED);
|
|
85
|
+
await typewriter(" and ", void 0, TYPEWRITER_SPEED);
|
|
86
|
+
await typewriter("themes", chalk.bold, TYPEWRITER_SPEED);
|
|
87
|
+
await typewriter(" to help you create your first Embeddable dashboard.\n\n", void 0, TYPEWRITER_SPEED);
|
|
81
88
|
const cwd = process.cwd();
|
|
82
89
|
const { confirmDir } = await prompts(
|
|
83
90
|
{
|
|
84
91
|
type: "confirm",
|
|
85
92
|
name: "confirmDir",
|
|
86
|
-
message: `Ok to create a new
|
|
93
|
+
message: `Ok to create a new project subfolder in your current directory ${chalk.cyan(cwd)}?`,
|
|
87
94
|
initial: true
|
|
88
95
|
},
|
|
89
96
|
{ onCancel }
|
|
@@ -142,7 +149,7 @@ Failed to download boilerplate: ${message}
|
|
|
142
149
|
type: "password",
|
|
143
150
|
name: "apiKey",
|
|
144
151
|
message: `You'll need an API Key to push this code bundle to your account's workspace
|
|
145
|
-
(
|
|
152
|
+
(Create your account here: ${chalk.cyan(terminalLink("https://embeddable.com/start", "https://embeddable.com/start", { fallback: (text) => text }))}).
|
|
146
153
|
|
|
147
154
|
Paste your API Key here:`,
|
|
148
155
|
validate: (value) => {
|
|
@@ -226,7 +233,7 @@ Paste your API Key here:`,
|
|
|
226
233
|
const workspaceLink = terminalLink(workspaceUrl, workspaceUrl, {
|
|
227
234
|
fallback: (text) => text
|
|
228
235
|
});
|
|
229
|
-
const docsUrl = "https://docs.embeddable.com/getting-started/
|
|
236
|
+
const docsUrl = "https://docs.embeddable.com/getting-started/your-workspace";
|
|
230
237
|
const docsLink = terminalLink(docsUrl, docsUrl, {
|
|
231
238
|
fallback: (text) => text
|
|
232
239
|
});
|
|
@@ -238,7 +245,7 @@ Success!
|
|
|
238
245
|
`);
|
|
239
246
|
console.log(`Follow the guide here to create your first Embeddable dashboard: ${chalk.cyan(docsLink)}
|
|
240
247
|
`);
|
|
241
|
-
await open(
|
|
248
|
+
await open(docsUrl);
|
|
242
249
|
}
|
|
243
250
|
main().catch((error) => {
|
|
244
251
|
console.error(chalk.red("An unexpected error occurred:"), error);
|