create-edgebase 0.1.0

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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 melodysdreamj
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,147 @@
1
+ <h1 align="center">create-edgebase</h1>
2
+
3
+ <p align="center">
4
+ <b>Bootstrap a new EdgeBase project</b><br>
5
+ Scaffold the project, install dependencies, and start local development in one command
6
+ </p>
7
+
8
+ <p align="center">
9
+ <a href="https://www.npmjs.com/package/create-edgebase"><img src="https://img.shields.io/npm/v/create-edgebase?color=brightgreen" alt="npm"></a>&nbsp;
10
+ <a href="https://edgebase.fun/docs/getting-started/quickstart"><img src="https://img.shields.io/badge/docs-quickstart-blue" alt="Docs"></a>&nbsp;
11
+ <a href="https://github.com/edge-base/edgebase/blob/main/LICENSE"><img src="https://img.shields.io/badge/license-MIT-blue.svg" alt="MIT License"></a>
12
+ </p>
13
+
14
+ <p align="center">
15
+ <a href="https://edgebase.fun/docs/getting-started/quickstart"><b>Quickstart</b></a> ·
16
+ <a href="https://edgebase.fun/docs/cli"><b>CLI Overview</b></a> ·
17
+ <a href="https://edgebase.fun/docs/cli/workflows"><b>CLI Workflows</b></a>
18
+ </p>
19
+
20
+ ---
21
+
22
+ `create-edgebase` is the package behind:
23
+
24
+ ```bash
25
+ npm create edgebase@latest
26
+ ```
27
+
28
+ It wraps the EdgeBase CLI and does the first-run setup for you:
29
+
30
+ 1. scaffold a new EdgeBase project
31
+ 2. install local project dependencies
32
+ 3. start local development unless you opt out
33
+
34
+ > Beta: the bootstrap flow is usable today, but some templates and defaults may still evolve before general availability.
35
+
36
+ ## No Manual Install Required
37
+
38
+ You normally do **not** install this package directly.
39
+
40
+ Use it through npm create:
41
+
42
+ ```bash
43
+ npm create edgebase@latest my-app
44
+ ```
45
+
46
+ ## Documentation Map
47
+
48
+ - [Quickstart](https://edgebase.fun/docs/getting-started/quickstart)
49
+ First-run setup for a new EdgeBase project
50
+ - [CLI Overview](https://edgebase.fun/docs/cli)
51
+ What the local CLI covers once the project exists
52
+ - [CLI Workflows](https://edgebase.fun/docs/cli/workflows)
53
+ Common flows after scaffolding
54
+
55
+ ## For AI Coding Assistants
56
+
57
+ This package ships with an `llms.txt` file for AI-assisted scaffolding.
58
+
59
+ You can find it:
60
+
61
+ - after install: `node_modules/create-edgebase/llms.txt`
62
+ - in the repository: [llms.txt](https://github.com/edge-base/edgebase/blob/main/packages/create-edgebase/llms.txt)
63
+
64
+ Use it when you want an agent to:
65
+
66
+ - choose the correct bootstrap command
67
+ - understand the `--no-dev` and `--no-open` flags
68
+ - scaffold EdgeBase into an existing repo safely
69
+ - avoid confusing `create-edgebase` with the runtime CLI package
70
+
71
+ ## Quick Start
72
+
73
+ ### Create a dedicated EdgeBase project
74
+
75
+ ```bash
76
+ npm create edgebase@latest my-app
77
+ ```
78
+
79
+ ### Add EdgeBase inside an existing frontend project
80
+
81
+ ```bash
82
+ cd your-frontend-project
83
+ npm create edgebase@latest edgebase
84
+ ```
85
+
86
+ That layout is recommended, not required. You can still keep EdgeBase in a separate repo or choose a different subdirectory name.
87
+
88
+ ## Flags
89
+
90
+ ### Skip auto-starting development
91
+
92
+ ```bash
93
+ npm create edgebase@latest my-app -- --no-dev
94
+ ```
95
+
96
+ ### Prevent the browser from opening during `dev`
97
+
98
+ ```bash
99
+ npm create edgebase@latest my-app -- --no-open
100
+ ```
101
+
102
+ ### Skip dependency install in automation
103
+
104
+ ```bash
105
+ EDGEBASE_CREATE_SKIP_INSTALL=1 npm create edgebase@latest my-app -- --no-dev
106
+ ```
107
+
108
+ ## What Gets Created
109
+
110
+ The scaffold sets up an EdgeBase project with the local CLI already wired in.
111
+
112
+ Typical outputs include:
113
+
114
+ - `edgebase.config.ts`
115
+ - `functions/`
116
+ - `package.json` with local EdgeBase dev dependencies and scripts
117
+ - `.gitignore` entries for local secrets and generated files
118
+ - local runtime metadata under `.edgebase/` during development and deploy flows
119
+
120
+ If the target directory already contains `package.json` or `.gitignore`, the scaffold merges EdgeBase-specific entries instead of blindly replacing the file.
121
+
122
+ ## What Happens Next
123
+
124
+ After scaffolding, the usual next step is:
125
+
126
+ ```bash
127
+ cd my-app
128
+ npm run dev
129
+ ```
130
+
131
+ From there you can keep using the local CLI:
132
+
133
+ ```bash
134
+ npx edgebase deploy
135
+ npx edgebase typegen
136
+ ```
137
+
138
+ ## Related Packages
139
+
140
+ - [`@edgebase-fun/cli`](https://www.npmjs.com/package/@edgebase-fun/cli)
141
+ The underlying CLI package used after project creation
142
+ - [`@edgebase-fun/web`](https://www.npmjs.com/package/@edgebase-fun/web)
143
+ Browser SDK for your app code
144
+
145
+ ## License
146
+
147
+ MIT
@@ -0,0 +1,125 @@
1
+ #!/usr/bin/env node
2
+
3
+ import { spawnSync } from 'node:child_process';
4
+ import { createRequire } from 'node:module';
5
+ import { dirname, join, resolve } from 'node:path';
6
+ import process from 'node:process';
7
+
8
+ const require = createRequire(import.meta.url);
9
+
10
+ function printUsage() {
11
+ console.log(`Usage:
12
+ npm create edgebase@latest <project-dir>
13
+ npm create edgebase@latest <project-dir> -- --no-dev
14
+ npm create edgebase@latest <project-dir> -- --no-open
15
+
16
+ What it does:
17
+ 1. Scaffolds a new EdgeBase project
18
+ 2. Installs local project dependencies
19
+ 3. Starts the dev server unless you pass --no-dev
20
+ `);
21
+ }
22
+
23
+ function detectPackageManager() {
24
+ const userAgent = process.env.npm_config_user_agent ?? '';
25
+
26
+ if (userAgent.startsWith('pnpm/')) {
27
+ return {
28
+ name: 'pnpm',
29
+ command: 'pnpm',
30
+ installArgs: ['install'],
31
+ runScriptArgs(scriptName, extraArgs = []) {
32
+ return ['run', scriptName, ...extraArgs];
33
+ },
34
+ };
35
+ }
36
+
37
+ if (userAgent.startsWith('yarn/')) {
38
+ return {
39
+ name: 'yarn',
40
+ command: 'yarn',
41
+ installArgs: ['install'],
42
+ runScriptArgs(scriptName, extraArgs = []) {
43
+ return ['run', scriptName, ...extraArgs];
44
+ },
45
+ };
46
+ }
47
+
48
+ if (userAgent.startsWith('bun/')) {
49
+ return {
50
+ name: 'bun',
51
+ command: 'bun',
52
+ installArgs: ['install'],
53
+ runScriptArgs(scriptName, extraArgs = []) {
54
+ return ['run', scriptName, ...extraArgs];
55
+ },
56
+ };
57
+ }
58
+
59
+ return {
60
+ name: 'npm',
61
+ command: 'npm',
62
+ installArgs: ['install'],
63
+ runScriptArgs(scriptName, extraArgs = []) {
64
+ return ['run', scriptName, ...(extraArgs.length > 0 ? ['--', ...extraArgs] : [])];
65
+ },
66
+ };
67
+ }
68
+
69
+ function runOrExit(command, args, options = {}) {
70
+ const result = spawnSync(command, args, {
71
+ stdio: 'inherit',
72
+ ...options,
73
+ });
74
+
75
+ if (result.error) {
76
+ throw result.error;
77
+ }
78
+
79
+ if (typeof result.status === 'number' && result.status !== 0) {
80
+ process.exit(result.status);
81
+ }
82
+ }
83
+
84
+ const rawArgs = process.argv.slice(2);
85
+ if (rawArgs.includes('--help') || rawArgs.includes('-h')) {
86
+ printUsage();
87
+ process.exit(0);
88
+ }
89
+
90
+ const forwardedArgs = [...rawArgs];
91
+ const wantsNoDev = forwardedArgs.includes('--no-dev');
92
+ const wantsNoOpen = forwardedArgs.includes('--no-open');
93
+ const scaffoldArgs = wantsNoDev ? forwardedArgs : [...forwardedArgs, '--no-dev'];
94
+ const targetDirArg = forwardedArgs.find((arg) => !arg.startsWith('-')) ?? '.';
95
+ const projectDir = resolve(process.cwd(), targetDirArg);
96
+ const packageManager = detectPackageManager();
97
+ const skipInstall = process.env.EDGEBASE_CREATE_SKIP_INSTALL === '1';
98
+ const cliPackageJsonPath = require.resolve('@edgebase-fun/cli/package.json');
99
+ const cliEntryPath = join(dirname(cliPackageJsonPath), 'dist', 'index.js');
100
+
101
+ runOrExit(process.execPath, [cliEntryPath, 'init', ...scaffoldArgs], {
102
+ cwd: process.cwd(),
103
+ env: {
104
+ ...process.env,
105
+ EDGEBASE_BOOTSTRAP_WRAPPER: '1',
106
+ },
107
+ });
108
+
109
+ if (!skipInstall) {
110
+ console.log();
111
+ console.log(`Installing project dependencies with ${packageManager.name}...`);
112
+ runOrExit(packageManager.command, packageManager.installArgs, {
113
+ cwd: projectDir,
114
+ env: process.env,
115
+ });
116
+ }
117
+
118
+ if (!wantsNoDev) {
119
+ console.log();
120
+ console.log('Starting the EdgeBase dev server...');
121
+ runOrExit(packageManager.command, packageManager.runScriptArgs('dev', wantsNoOpen ? ['--no-open'] : []), {
122
+ cwd: projectDir,
123
+ env: process.env,
124
+ });
125
+ }
package/llms.txt ADDED
@@ -0,0 +1,72 @@
1
+ # create-edgebase
2
+
3
+ Use this file as a quick-reference contract for AI coding assistants working with `create-edgebase`.
4
+
5
+ ## Package Boundary
6
+
7
+ `create-edgebase` is the bootstrap package behind `npm create edgebase@latest`.
8
+
9
+ It is not the long-lived runtime CLI package. After scaffolding, day-to-day commands come from the local `@edgebase-fun/cli` install inside the generated project.
10
+
11
+ ## Source Of Truth
12
+
13
+ - Package README: https://github.com/edge-base/edgebase/blob/main/packages/create-edgebase/README.md
14
+ - Quickstart: https://edgebase.fun/docs/getting-started/quickstart
15
+ - CLI overview: https://edgebase.fun/docs/cli
16
+ - CLI workflows: https://edgebase.fun/docs/cli/workflows
17
+
18
+ ## Canonical Examples
19
+
20
+ ### Create a new dedicated project
21
+
22
+ ```bash
23
+ npm create edgebase@latest my-app
24
+ ```
25
+
26
+ ### Add EdgeBase inside an existing frontend project
27
+
28
+ ```bash
29
+ cd your-frontend-project
30
+ npm create edgebase@latest edgebase
31
+ ```
32
+
33
+ ### Scaffold without auto-starting dev
34
+
35
+ ```bash
36
+ npm create edgebase@latest my-app -- --no-dev
37
+ ```
38
+
39
+ ### Scaffold without opening the browser
40
+
41
+ ```bash
42
+ npm create edgebase@latest my-app -- --no-open
43
+ ```
44
+
45
+ ### Automation without install
46
+
47
+ ```bash
48
+ EDGEBASE_CREATE_SKIP_INSTALL=1 npm create edgebase@latest my-app -- --no-dev
49
+ ```
50
+
51
+ ## Behavior Notes
52
+
53
+ - scaffolds a project by delegating to `@edgebase-fun/cli init`
54
+ - installs local dependencies unless `EDGEBASE_CREATE_SKIP_INSTALL=1`
55
+ - starts `npm run dev` unless `--no-dev` is passed
56
+ - forwards `--no-open` to the local development flow
57
+ - merges EdgeBase entries into existing `package.json` and `.gitignore` files instead of replacing them wholesale
58
+
59
+ ## Common Mistakes
60
+
61
+ - use `npm create edgebase@latest`, not `npm edgebase`
62
+ - do not treat `create-edgebase` as the package you use for ongoing commands
63
+ - if integrating into an existing repo, prefer a dedicated subdirectory like `edgebase/`
64
+ - use `-- --no-dev` after the project name because flags after `npm create` are forwarded through npm
65
+
66
+ ## Quick Reference
67
+
68
+ ```text
69
+ npm create edgebase@latest my-app -> scaffold, install, start dev
70
+ npm create edgebase@latest my-app -- --no-dev -> scaffold, install, do not start dev
71
+ npm create edgebase@latest my-app -- --no-open -> scaffold, install, start dev without opening browser
72
+ ```
package/package.json ADDED
@@ -0,0 +1,36 @@
1
+ {
2
+ "name": "create-edgebase",
3
+ "version": "0.1.0",
4
+ "description": "Bootstrap a new EdgeBase project",
5
+ "license": "MIT",
6
+ "repository": {
7
+ "type": "git",
8
+ "url": "https://github.com/edge-base/edgebase.git",
9
+ "directory": "packages/create-edgebase"
10
+ },
11
+ "homepage": "https://edgebase.fun",
12
+ "bugs": "https://github.com/edge-base/edgebase/issues",
13
+ "keywords": [
14
+ "edgebase",
15
+ "create-edgebase",
16
+ "scaffold",
17
+ "cli"
18
+ ],
19
+ "type": "module",
20
+ "bin": {
21
+ "create-edgebase": "./bin/create-edgebase.js"
22
+ },
23
+ "files": [
24
+ "bin",
25
+ "llms.txt"
26
+ ],
27
+ "publishConfig": {
28
+ "access": "public"
29
+ },
30
+ "engines": {
31
+ "node": ">=20.19.0"
32
+ },
33
+ "dependencies": {
34
+ "@edgebase-fun/cli": "0.1.0"
35
+ }
36
+ }