ecopages 0.2.0-beta.9 → 0.2.0-rc.1

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 CHANGED
@@ -6,10 +6,16 @@ It provides scaffolding and development commands to streamline your workflow. It
6
6
 
7
7
  ## Quick Start
8
8
 
9
- Initialize a new project from the default template:
9
+ Initialize a new project from the interactive template picker:
10
10
 
11
11
  ```bash
12
- bunx ecopages init my-app
12
+ bunx ecopages init
13
+ ```
14
+
15
+ For a deterministic invocation, select a template explicitly:
16
+
17
+ ```bash
18
+ bunx ecopages init my-app --template react
13
19
  cd my-app
14
20
  bun install
15
21
  bun dev
@@ -17,31 +23,42 @@ bun dev
17
23
 
18
24
  ## Commands
19
25
 
20
- | Command | Description | Equivalent (Bun) |
21
- | :--------------------------- | :----------------------------------------- | :------------------------------ |
22
- | `ecopages init <dir>` | Scaffolds a new project | N/A |
23
- | `ecopages dev [entry]` | Starts the dev server | `bun run [entry] --dev` |
24
- | `ecopages dev:watch [entry]` | Dev server + hard restarts on file changes | `bun --watch run [entry] --dev` |
25
- | `ecopages dev:hot [entry]` | Dev server + HMR (no hard restarts) | `bun --hot run [entry] --dev` |
26
- | `ecopages build [entry]` | Creates a production build | `bun run [entry] --build` |
27
- | `ecopages start [entry]` | Starts the production server | `bun run [entry]` |
28
- | `ecopages preview [entry]` | Previews the production build locally | `bun run [entry] --preview` |
26
+ | Command | Description | Equivalent (Bun) |
27
+ | :-------------------- | :-------------------------------------------------- | :------------------------------ |
28
+ | `ecopages init [dir]` | Scaffolds a new project (interactive without `dir`) | N/A |
29
+ | `ecopages dev` | Starts the dev server | `bun run [entry] --dev` |
30
+ | `ecopages dev:watch` | Dev server + hard restarts on file changes | `bun --watch run [entry] --dev` |
31
+ | `ecopages dev:hot` | Dev server + HMR (no hard restarts) | `bun --hot run [entry] --dev` |
32
+ | `ecopages build` | Creates a production build | `bun run [entry] --build` |
33
+ | `ecopages start` | Starts the production server | `bun run [entry]` |
34
+ | `ecopages preview` | Previews the production build locally | `bun run [entry] --preview` |
29
35
 
30
36
  > [!NOTE]
31
- > `[entry]` defaults to `app.ts` if not provided.
37
+ > The entry file defaults to `app.ts`. Override it with `--entry-file`.
38
+
39
+ ### Templates
40
+
41
+ Official templates are versioned with the CLI release. Use `--template <id>` for an official template or `--from <source>` for a community Git template. Community sources support giget provider notation and GitHub, GitLab, Bitbucket, and SourceHut repository URLs.
42
+
43
+ ```bash
44
+ ecopages init my-site --template jsx
45
+ ecopages init my-site --from github:acme/my-template#v1.0.0
46
+ ```
47
+
48
+ The official template IDs are `jsx`, `react`, `lit-jsx`, `radiant`, `blog-jsx`, `blog-react`, `docs-starter`, `react-better-auth`, and `llm-wiki`.
32
49
 
33
50
  ## Environment & Runtime Options
34
51
 
35
52
  Server and build commands accept the following options. They automatically map to the equivalent environment variables for the underlying process:
36
53
 
37
- | Option | Env Var | Description |
38
- | :------------------------- | :---------------------- | :---------------------------------- |
39
- | `-p, --port <port>` | `ECOPAGES_PORT` | Server port (default 3000) |
40
- | `-n, --hostname <host>` | `ECOPAGES_HOSTNAME` | Server hostname |
41
- | `-b, --base-url <url>` | `ECOPAGES_BASE_URL` | Base URL string |
42
- | `-d, --debug` | `ECOPAGES_LOGGER_DEBUG` | Enables debug-level logging |
43
- | `-r, --react-fast-refresh` | | Enables React Fast Refresh |
44
- | `--runtime <runtime>` | | Force execution via `bun` or `node` |
54
+ | Option | Env Var | Description |
55
+ | :------------------------- | :---------------------- | :-------------------------------------------------------- |
56
+ | `-p, --port <port>` | `ECOPAGES_PORT` | Server port (default 3000) |
57
+ | `-n, --hostname <host>` | `ECOPAGES_HOSTNAME` | Server hostname |
58
+ | `-b, --base-url <url>` | `ECOPAGES_BASE_URL` | Base URL string |
59
+ | `-d, --debug` | `ECOPAGES_LOGGER_DEBUG` | Enables debug logging and startup phase trace (see below) |
60
+ | `-r, --react-fast-refresh` | | Enables React Fast Refresh |
61
+ | `--runtime <runtime>` | | Force execution via `bun` or `node` |
45
62
 
46
63
  ### Runtime Detection
47
64
 
@@ -63,6 +80,37 @@ ecopages dev --port 8080 --debug
63
80
  ecopages dev -r
64
81
  ```
65
82
 
83
+ ### Debug logging and startup trace
84
+
85
+ Set these in `.env` or on the command line when diagnosing slow dev startup or first page load.
86
+
87
+ | Env var | CLI | What you get |
88
+ | :---------------------------- | :--------------------- | :--------------------------------------------------------------------------------------------- |
89
+ | `ECOPAGES_LOGGER_DEBUG=true` | `ecopages dev --debug` | Verbose `[@ecopages/core]` logs across the stack, plus **startup phase trace** lines on stderr |
90
+ | `ECOPAGES_STARTUP_TRACE=true` | — | **Only** the phase trace (no extra debug noise). Useful when measuring first-open latency |
91
+
92
+ Trace lines are prefixed with `[ecopages:startup-trace]` and look like:
93
+
94
+ ```text
95
+ [ecopages:startup-trace] phase=config-ready wallMs=1271
96
+ [ecopages:startup-trace] phase=setupAppRuntimePlugins durationMs=714 wallMs=1999
97
+ [ecopages:startup-trace] phase=route-registry durationMs=1 wallMs=2000
98
+ [ecopages:startup-trace] phase=server-listen durationMs=45 wallMs=2046
99
+ [ecopages:startup-trace] phase=dev-client-transform durationMs=42 wallMs=2100
100
+ [ecopages:startup-trace] phase=first-request-ssr durationMs=5296 wallMs=12495
101
+ [ecopages:startup-trace] summary path=/docs/getting-started/introduction bundleCount=13 clientBundleBytes=858396 wallMs=12496
102
+ ```
103
+
104
+ Phases: config ready → runtime plugins → route registry → server listening → first request SSR (with per-module `dev-client-transform` on demand for `/assets/__eco_dev__/` modules). The summary includes bundle count and total client JS bytes for that first request.
105
+
106
+ ```bash
107
+ # Focused perf trace only
108
+ ECOPAGES_STARTUP_TRACE=true pnpm dev
109
+
110
+ # Full debug + trace
111
+ ecopages dev --debug
112
+ ```
113
+
66
114
  ## Ecosystem & Plugins
67
115
 
68
116
  Ecopages relies on a modular architecture. Core logic and framework integrations are published as `@ecopages/*` packages on [npm](https://www.npmjs.com/org/ecopages).
package/bin/brand.js ADDED
@@ -0,0 +1,42 @@
1
+ import { styleText } from 'node:util';
2
+
3
+ /**
4
+ * Terminal mark rasterized from `assets/brand/logo-on-light.svg`.
5
+ * @remarks Half-blocks keep rows flush; a thin stroke leaves the spiral's inner gaps open.
6
+ */
7
+ const BRAND_MARK_LINES = [
8
+ ' ▄▄▄▄',
9
+ ' ▄▄▄▄█▀▀▀▀▄█',
10
+ ' ▄▄▀▀▀ ██',
11
+ ' ▄█▀ ▄▄▄▄ █',
12
+ '▄█ █▀ ██ █',
13
+ '█▄ ▀█▄ ██ ▄█ ██',
14
+ ' █▄ ▀▀██▀▀▀ █',
15
+ ' ▀▀█▄ ▀█ ▄█▀',
16
+ ' ▄█▀ ▀▀▀▀▀',
17
+ ' █▀',
18
+ '▀',
19
+ ];
20
+
21
+ export function formatBrandBanner(version, stream = process.stdout) {
22
+ const markWidth = Math.max(...BRAND_MARK_LINES.map((line) => [...line].length));
23
+ const versionLabel = stream.hasColors?.() ? styleText('dim', version) : version;
24
+ const labels = ['ecopages', versionLabel];
25
+ const labelStart = Math.max(0, Math.floor((BRAND_MARK_LINES.length - labels.length) / 2));
26
+
27
+ return BRAND_MARK_LINES.map((line, index) => {
28
+ const padded = `${line}${' '.repeat(markWidth - [...line].length)}`;
29
+ const label = labels[index - labelStart];
30
+ return label === undefined ? padded : `${padded} ${label}`;
31
+ }).join('\n');
32
+ }
33
+
34
+ export function withBrandBanner(version, text) {
35
+ if (!process.stdout.isTTY) return text;
36
+ return `${formatBrandBanner(version)}\n\n${text}`;
37
+ }
38
+
39
+ export function printBrandBanner(version) {
40
+ if (!process.stderr.isTTY) return;
41
+ process.stderr.write(`${formatBrandBanner(version, process.stderr)}\n\n`);
42
+ }