create-wordjs 2.0.0 → 2.2.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.
Files changed (3) hide show
  1. package/README.md +9 -5
  2. package/index.js +25 -9
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -31,7 +31,7 @@ That single command takes you from nothing to the browser install wizard:
31
31
  clickable URL:
32
32
 
33
33
  ```
34
- → https://localhost:3000/install?token=…
34
+ → https://localhost:3000/install#token=…
35
35
  ```
36
36
 
37
37
  Open the URL, pick your database, create your admin account, and you're in. The wizard offers
@@ -47,7 +47,7 @@ in CI — plus a pure-JS *SQLite (legacy / WASM)* fallback for hosts where the n
47
47
  | Option | Description |
48
48
  | --- | --- |
49
49
  | `--zip <path-or-url>` | Use a local release ZIP (or a direct ZIP URL) instead of querying the GitHub API. Handy offline or when rate-limited. |
50
- | `--version <tag>` | Install a specific release (e.g. `--version v1.0.0`) instead of the latest. |
50
+ | `--version <tag>` | Install a specific release (e.g. `--version v2.1.0`) instead of the latest. |
51
51
  | `--http` | Serve plain HTTP instead of self-signed HTTPS (sets `WORDJS_HTTP=1`). |
52
52
  | `--no-start` | Scaffold and install dependencies only — start the server yourself later. |
53
53
  | `--yes`, `-y` | Skip the confirmation prompt (required when `upgrade` runs non-interactively). |
@@ -114,12 +114,16 @@ need `openssl` on the PATH. Full details, port matrix and the manual (source-che
114
114
  self-signed certificate. Your browser will warn once ("Your connection is not private") —
115
115
  click *Advanced → Proceed*. That is expected for localhost. Prefer plain HTTP? Use `--http`.
116
116
  - **Stop / restart**: press `Ctrl+C` to stop. Start again any time with
117
- `cd my-site && npm run start:mono`. Until setup is finished, every start prints a fresh
118
- one-time install URL, so you never need to keep the original token around.
117
+ `cd my-site && npm run start:mono`. Until setup is finished, every start mints a fresh one-time
118
+ install token, so you never need to keep the original around. The server prints it in its boot
119
+ banner — as a clickable `/install#token=…` URL — only when its stdout is a terminal, which it is
120
+ when you run that command yourself; off a TTY (systemd, Docker, a pipe) the banner shows the URL
121
+ without the token. Either way the token is written to `my-site/backend/data/install-token`
122
+ (mode `0600`), and `WORDJS_PRINT_INSTALL_TOKEN=1` prints it in the banner regardless.
119
123
  - **GitHub rate limit / offline**: the release lookup uses the unauthenticated GitHub API. If it
120
124
  is rate-limited or you're offline, download `wordjs-v*.zip` from the
121
125
  [releases page](https://github.com/jaimemartinez/wordjs/releases) and run
122
- `npx create-wordjs@latest my-site --zip ./wordjs-v1.0.0.zip`.
126
+ `npx create-wordjs@latest my-site --zip ./wordjs-v2.1.0.zip`.
123
127
  - **Existing directories**: the target directory must not exist (or must be empty) — the tool
124
128
  refuses to overwrite anything.
125
129
 
package/index.js CHANGED
@@ -10,8 +10,12 @@
10
10
  * 1. Downloads the latest pre-compiled WordJS release ZIP from GitHub (no build step needed).
11
11
  * 2. Extracts it into <dir> and installs the runtime dependencies (npm run release:install).
12
12
  * 3. Generates a one-time install token and starts the server (npm run start:mono) with it,
13
- * printing a clickable https://localhost:3000/install?token=… URL — the browser install
14
- * wizard takes it from there (pick SQLite/PostgreSQL, create your admin, done).
13
+ * printing a clickable https://localhost:3000/install#token=… URL — the browser install
14
+ * wizard takes it from there (pick SQLite/PostgreSQL, create your admin, done). That URL is
15
+ * printed by THIS process, which owns the token, so it is unconditional.
16
+ * With --no-start there is no token from here: the server mints its own on its first boot and
17
+ * prints it in its banner only when ITS stdout is a TTY (or WORDJS_PRINT_INSTALL_TOKEN=1);
18
+ * otherwise it writes it to <dir>/backend/data/install-token (mode 0600) and prints the path.
15
19
  *
16
20
  * Plain Node, no TypeScript. Only runtime dependency: adm-zip (ZIP extraction).
17
21
  */
@@ -49,7 +53,7 @@ Usage:
49
53
 
50
54
  Options:
51
55
  --zip <path-or-url> Use a local release ZIP (or a direct ZIP URL) instead of asking GitHub.
52
- --version <tag> Install/upgrade to a specific release tag (e.g. v1.0.0) instead of the latest.
56
+ --version <tag> Install/upgrade to a specific release tag (e.g. v2.1.0) instead of the latest.
53
57
  --http Serve plain HTTP instead of self-signed HTTPS (sets WORDJS_HTTP=1). (create)
54
58
  --no-start Scaffold + install dependencies only; don't start the server.
55
59
  --yes, -y Skip the confirmation prompt (required when upgrading non-interactively).
@@ -65,7 +69,7 @@ Options:
65
69
 
66
70
  Examples:
67
71
  npx create-wordjs@latest my-site
68
- npx create-wordjs@latest my-site --version v1.0.0
72
+ npx create-wordjs@latest my-site --version v2.1.0
69
73
  npx create-wordjs@latest upgrade # from inside your site directory
70
74
  npx create-wordjs@latest upgrade ./my-site --yes
71
75
 
@@ -103,7 +107,7 @@ function parseArgs(argv) {
103
107
  const a = argv[i];
104
108
  if (a === '-h' || a === '--help') { console.log(HELP); process.exit(0); }
105
109
  else if (a === '--zip') { opts.zip = argv[++i] || fail('--zip needs a value (path or URL to a wordjs-*.zip).'); }
106
- else if (a === '--version') { opts.version = argv[++i] || fail('--version needs a value (a release tag, e.g. v1.0.0).'); }
110
+ else if (a === '--version') { opts.version = argv[++i] || fail('--version needs a value (a release tag, e.g. v2.1.0).'); }
107
111
  else if (a === '--http') opts.http = true;
108
112
  else if (a === '--no-start') opts.start = false;
109
113
  else if (a === '--yes' || a === '-y') opts.yes = true;
@@ -130,7 +134,7 @@ function parseArgs(argv) {
130
134
  else if (opts.mode === 'join') opts.dir = opts.role ? `wordjs-${opts.role}` : 'wordjs-node';
131
135
  else fail('Please specify a directory for your new site.', 'Example: npx create-wordjs@latest my-site');
132
136
  }
133
- if (opts.version && /^\d/.test(opts.version)) opts.version = 'v' + opts.version; // accept "1.0.0" for "v1.0.0"
137
+ if (opts.version && /^\d/.test(opts.version)) opts.version = 'v' + opts.version; // accept "2.1.0" for "v2.1.0"
134
138
  return opts;
135
139
  }
136
140
 
@@ -729,7 +733,12 @@ async function main() {
729
733
  console.log(` cd ${opts.dir}`);
730
734
  console.log(` npm run start:mono${opts.http ? ' (with WORDJS_HTTP=1 in the environment for plain HTTP)' : ''}`);
731
735
  console.log('');
732
- console.log(` The console will print your one-time install URL (${proto}://localhost:3000/install?token=…).`);
736
+ console.log(' That first boot mints a one-time install token. The server prints it in its');
737
+ console.log(` banner as a clickable URL (${proto}://localhost:3000/install#token=…) only when its`);
738
+ console.log(' stdout is a terminal — which it is if you run the command above yourself. Off a');
739
+ console.log(' TTY (systemd, Docker, a pipe) the banner shows the URL WITHOUT the token; read it');
740
+ console.log(` from ${path.join(opts.dir, 'backend', 'data', 'install-token')} (mode 0600) instead,`);
741
+ console.log(' or set WORDJS_PRINT_INSTALL_TOKEN=1 to have it printed either way.');
733
742
  console.log(line + '\n');
734
743
  return;
735
744
  }
@@ -743,7 +752,12 @@ async function main() {
743
752
  console.log(`\n${line}`);
744
753
  console.log('✅ WordJS is ready — finish setup in your browser:');
745
754
  console.log('');
746
- console.log(` → ${proto}://localhost:3000/install?token=${token}`);
755
+ // The token rides in the URL FRAGMENT, not a `?token=` query string: a fragment is never sent to
756
+ // any server, so this bootstrap secret stays out of access/proxy logs and out of the `Referer` of
757
+ // every sub-resource the install page loads. The wizard reads `#token=` (and still accepts a
758
+ // legacy `?token=`) and scrubs it from the address bar. Keep in sync with the backend's own
759
+ // banner in backend/src/core/install-token.ts.
760
+ console.log(` → ${proto}://localhost:3000/install#token=${token}`);
747
761
  console.log('');
748
762
  console.log(' • The server is starting below — give it ~15–30 seconds, then open the URL.');
749
763
  if (!opts.http) {
@@ -753,7 +767,9 @@ async function main() {
753
767
  }
754
768
  console.log(' • Stop the server: press Ctrl+C in this window.');
755
769
  console.log(` • Start it later: cd ${opts.dir} && npm run start:mono`);
756
- console.log(' (a fresh install URL is printed on every start until setup is finished)');
770
+ console.log(' (a fresh token is minted on every start until setup is finished; the server prints');
771
+ console.log(' it in its banner when stdout is a terminal, and always writes it to');
772
+ console.log(' backend/data/install-token, mode 0600)');
757
773
  if (process.platform === 'linux') {
758
774
  console.log('');
759
775
  console.log(' • RECEIVING email from the internet? WordJS listens on port 25 (the MX port).');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-wordjs",
3
- "version": "2.0.0",
3
+ "version": "2.2.0",
4
4
  "description": "Create a WordJS site with one command — the self-hosted CMS where third-party plugins run in an OS-isolated process with per-capability permission grants. SSR/SEO out of the box, SQLite by default, no PHP.",
5
5
  "license": "MIT",
6
6
  "author": "Jaime Martinez (https://github.com/jaimemartinez)",