create-wordjs 1.12.0 → 1.12.2
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 +16 -10
- package/index.js +17 -17
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -3,17 +3,23 @@
|
|
|
3
3
|
Bootstrap a [WordJS](https://github.com/jaimemartinez/wordjs) site with one command:
|
|
4
4
|
|
|
5
5
|
```bash
|
|
6
|
-
npx create-wordjs my-site
|
|
6
|
+
npx create-wordjs@latest my-site
|
|
7
7
|
```
|
|
8
8
|
|
|
9
|
+
> **Always include `@latest`.** `npx` caches downloaded packages, so a bare `npx create-wordjs`
|
|
10
|
+
> can silently re-run an **old cached copy**. An old copy won't recognize newer subcommands — e.g.
|
|
11
|
+
> `npx create-wordjs upgrade my-site` on a stale cache fails with `✖ Unexpected extra argument:
|
|
12
|
+
> my-site`, because that version predates the `upgrade` command. `@latest` always fetches the
|
|
13
|
+
> current release. (If it still runs an old copy, clear the cache: `rm -rf ~/.npm/_npx`.)
|
|
14
|
+
|
|
9
15
|
It also **upgrades** an existing site and sets up **separate mode** (gateway + backend + frontend
|
|
10
16
|
on different machines) — see below:
|
|
11
17
|
|
|
12
18
|
```bash
|
|
13
|
-
npx create-wordjs upgrade [dir] # upgrade an existing install in place
|
|
14
|
-
npx create-wordjs gateway --host <ip> # machine 1: cluster gateway (CA + join tokens)
|
|
15
|
-
npx create-wordjs join backend --gateway <ip> --token <t> --ca-hash <fp> --advertise <ip>
|
|
16
|
-
npx create-wordjs join frontend --gateway <ip> --token <t> --ca-hash <fp> --advertise <ip>
|
|
19
|
+
npx create-wordjs@latest upgrade [dir] # upgrade an existing install in place
|
|
20
|
+
npx create-wordjs@latest gateway --host <ip> # machine 1: cluster gateway (CA + join tokens)
|
|
21
|
+
npx create-wordjs@latest join backend --gateway <ip> --token <t> --ca-hash <fp> --advertise <ip>
|
|
22
|
+
npx create-wordjs@latest join frontend --gateway <ip> --token <t> --ca-hash <fp> --advertise <ip>
|
|
17
23
|
```
|
|
18
24
|
|
|
19
25
|
That single command takes you from nothing to the browser install wizard:
|
|
@@ -59,7 +65,7 @@ Separate-mode options:
|
|
|
59
65
|
## Upgrade an existing site
|
|
60
66
|
|
|
61
67
|
```bash
|
|
62
|
-
cd .. && npx create-wordjs upgrade my-site # or run it from inside: npx create-wordjs upgrade .
|
|
68
|
+
cd .. && npx create-wordjs@latest upgrade my-site # or run it from inside: npx create-wordjs@latest upgrade .
|
|
63
69
|
```
|
|
64
70
|
|
|
65
71
|
Downloads the newest release and replaces the app code while **preserving your data**: the SQLite
|
|
@@ -74,7 +80,7 @@ machine:
|
|
|
74
80
|
|
|
75
81
|
```bash
|
|
76
82
|
# Machine 1 — the gateway (mints the cluster CA and one token per role):
|
|
77
|
-
npx create-wordjs gateway --host 10.0.0.1
|
|
83
|
+
npx create-wordjs@latest gateway --host 10.0.0.1
|
|
78
84
|
```
|
|
79
85
|
|
|
80
86
|
It downloads the release, initializes the cluster CA, starts the gateway, and prints the exact
|
|
@@ -82,10 +88,10 @@ It downloads the release, initializes the cluster CA, starts the gateway, and pr
|
|
|
82
88
|
|
|
83
89
|
```bash
|
|
84
90
|
# Machine 2 — backend (paste what the gateway printed):
|
|
85
|
-
npx create-wordjs join backend --gateway 10.0.0.1 --token <t> --ca-hash <fp> --advertise 10.0.0.2
|
|
91
|
+
npx create-wordjs@latest join backend --gateway 10.0.0.1 --token <t> --ca-hash <fp> --advertise 10.0.0.2
|
|
86
92
|
|
|
87
93
|
# Machine 3 — frontend:
|
|
88
|
-
npx create-wordjs join frontend --gateway 10.0.0.1 --token <t> --ca-hash <fp> --advertise 10.0.0.3
|
|
94
|
+
npx create-wordjs@latest join frontend --gateway 10.0.0.1 --token <t> --ca-hash <fp> --advertise 10.0.0.3
|
|
89
95
|
```
|
|
90
96
|
|
|
91
97
|
Each `join` downloads the release, enrolls against the gateway (the token authorizes exactly one
|
|
@@ -105,7 +111,7 @@ gateway over mTLS. Browse `https://<gateway>:3000` when all three are up. `join`
|
|
|
105
111
|
- **GitHub rate limit / offline**: the release lookup uses the unauthenticated GitHub API. If it
|
|
106
112
|
is rate-limited or you're offline, download `wordjs-v*.zip` from the
|
|
107
113
|
[releases page](https://github.com/jaimemartinez/wordjs/releases) and run
|
|
108
|
-
`npx create-wordjs my-site --zip ./wordjs-v1.0.0.zip`.
|
|
114
|
+
`npx create-wordjs@latest my-site --zip ./wordjs-v1.0.0.zip`.
|
|
109
115
|
- **Existing directories**: the target directory must not exist (or must be empty) — the tool
|
|
110
116
|
refuses to overwrite anything.
|
|
111
117
|
|
package/index.js
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
/**
|
|
5
5
|
* create-wordjs — bootstrap a WordJS site with ONE command:
|
|
6
6
|
*
|
|
7
|
-
* npx create-wordjs my-site
|
|
7
|
+
* npx create-wordjs@latest my-site
|
|
8
8
|
*
|
|
9
9
|
* What it does:
|
|
10
10
|
* 1. Downloads the latest pre-compiled WordJS release ZIP from GitHub (no build step needed).
|
|
@@ -42,10 +42,10 @@ const HELP = `
|
|
|
42
42
|
create-wordjs — bootstrap or upgrade a WordJS site with one command
|
|
43
43
|
|
|
44
44
|
Usage:
|
|
45
|
-
npx create-wordjs <dir> [options] Create a new site (monolith — one machine)
|
|
46
|
-
npx create-wordjs upgrade [dir] [options] Upgrade an existing site (dir defaults to .)
|
|
47
|
-
npx create-wordjs gateway [dir] [options] Set up a SEPARATE-MODE gateway (cluster CA + join tokens)
|
|
48
|
-
npx create-wordjs join <role> [dir] [opts] Join this machine to a gateway as backend|frontend
|
|
45
|
+
npx create-wordjs@latest <dir> [options] Create a new site (monolith — one machine)
|
|
46
|
+
npx create-wordjs@latest upgrade [dir] [options] Upgrade an existing site (dir defaults to .)
|
|
47
|
+
npx create-wordjs@latest gateway [dir] [options] Set up a SEPARATE-MODE gateway (cluster CA + join tokens)
|
|
48
|
+
npx create-wordjs@latest join <role> [dir] [opts] Join this machine to a gateway as backend|frontend
|
|
49
49
|
|
|
50
50
|
Options:
|
|
51
51
|
--zip <path-or-url> Use a local release ZIP (or a direct ZIP URL) instead of asking GitHub.
|
|
@@ -64,18 +64,18 @@ Options:
|
|
|
64
64
|
-h, --help Show this help.
|
|
65
65
|
|
|
66
66
|
Examples:
|
|
67
|
-
npx create-wordjs my-site
|
|
68
|
-
npx create-wordjs my-site --version v1.0.0
|
|
69
|
-
npx create-wordjs upgrade # from inside your site directory
|
|
70
|
-
npx create-wordjs upgrade ./my-site --yes
|
|
67
|
+
npx create-wordjs@latest my-site
|
|
68
|
+
npx create-wordjs@latest my-site --version v1.0.0
|
|
69
|
+
npx create-wordjs@latest upgrade # from inside your site directory
|
|
70
|
+
npx create-wordjs@latest upgrade ./my-site --yes
|
|
71
71
|
|
|
72
72
|
Separate mode (three machines) — run one command per machine:
|
|
73
73
|
# on the gateway machine (prints ready-to-paste join commands with fresh tokens):
|
|
74
|
-
npx create-wordjs gateway --host 10.0.0.1
|
|
74
|
+
npx create-wordjs@latest gateway --host 10.0.0.1
|
|
75
75
|
# on the backend machine:
|
|
76
|
-
npx create-wordjs join backend --gateway 10.0.0.1 --token <t> --ca-hash <fp> --advertise 10.0.0.2
|
|
76
|
+
npx create-wordjs@latest join backend --gateway 10.0.0.1 --token <t> --ca-hash <fp> --advertise 10.0.0.2
|
|
77
77
|
# on the frontend machine:
|
|
78
|
-
npx create-wordjs join frontend --gateway 10.0.0.1 --token <t> --ca-hash <fp> --advertise 10.0.0.3
|
|
78
|
+
npx create-wordjs@latest join frontend --gateway 10.0.0.1 --token <t> --ca-hash <fp> --advertise 10.0.0.3
|
|
79
79
|
(join needs 'openssl' on PATH. See documentation/separate-mode.md.)
|
|
80
80
|
|
|
81
81
|
Upgrading preserves your database (backend/data), uploads (backend/uploads), config
|
|
@@ -128,7 +128,7 @@ function parseArgs(argv) {
|
|
|
128
128
|
if (opts.mode === 'upgrade') opts.dir = '.'; // upgrade defaults to cwd
|
|
129
129
|
else if (opts.mode === 'gateway') opts.dir = 'wordjs-gateway';
|
|
130
130
|
else if (opts.mode === 'join') opts.dir = opts.role ? `wordjs-${opts.role}` : 'wordjs-node';
|
|
131
|
-
else fail('Please specify a directory for your new site.', 'Example: npx create-wordjs my-site');
|
|
131
|
+
else fail('Please specify a directory for your new site.', 'Example: npx create-wordjs@latest my-site');
|
|
132
132
|
}
|
|
133
133
|
if (opts.version && /^\d/.test(opts.version)) opts.version = 'v' + opts.version; // accept "1.0.0" for "v1.0.0"
|
|
134
134
|
return opts;
|
|
@@ -389,7 +389,7 @@ async function upgrade(opts) {
|
|
|
389
389
|
// Verify this is a real, configured WordJS install (not an empty dir or the wrong folder).
|
|
390
390
|
if (!fs.existsSync(pkgPath) || !fs.existsSync(cfgPath)) {
|
|
391
391
|
fail(`"${opts.dir}" does not look like a WordJS install.`,
|
|
392
|
-
'Run this from your site directory (it must contain backend/wordjs-config.json), or pass the path: npx create-wordjs upgrade <dir>.');
|
|
392
|
+
'Run this from your site directory (it must contain backend/wordjs-config.json), or pass the path: npx create-wordjs@latest upgrade <dir>.');
|
|
393
393
|
}
|
|
394
394
|
let curPkg = {};
|
|
395
395
|
try { curPkg = JSON.parse(fs.readFileSync(pkgPath, 'utf8')); } catch { /* handled below */ }
|
|
@@ -556,11 +556,11 @@ async function gateway(opts) {
|
|
|
556
556
|
console.log(' Run ONE of these on each other machine (they auto-download + enroll + start):');
|
|
557
557
|
console.log('');
|
|
558
558
|
console.log(' # backend machine:');
|
|
559
|
-
console.log(` npx create-wordjs join backend --gateway ${host} --token ${beTok} \\`);
|
|
559
|
+
console.log(` npx create-wordjs@latest join backend --gateway ${host} --token ${beTok} \\`);
|
|
560
560
|
console.log(` --ca-hash ${fp} --advertise <this-backend-ip>`);
|
|
561
561
|
console.log('');
|
|
562
562
|
console.log(' # frontend machine:');
|
|
563
|
-
console.log(` npx create-wordjs join frontend --gateway ${host} --token ${feTok} \\`);
|
|
563
|
+
console.log(` npx create-wordjs@latest join frontend --gateway ${host} --token ${feTok} \\`);
|
|
564
564
|
console.log(` --ca-hash ${fp} --advertise <this-frontend-ip>`);
|
|
565
565
|
console.log('');
|
|
566
566
|
console.log(' Tokens are single-use and expire in 120 min. Mint more anytime:');
|
|
@@ -581,7 +581,7 @@ async function gateway(opts) {
|
|
|
581
581
|
// single-use token (delegates to scripts/node-join.js), then start + register the service.
|
|
582
582
|
async function join(opts) {
|
|
583
583
|
if (!['backend', 'frontend'].includes(opts.role)) {
|
|
584
|
-
fail('join needs a role: backend or frontend.', 'Example: npx create-wordjs join backend --gateway <ip> --token <t>');
|
|
584
|
+
fail('join needs a role: backend or frontend.', 'Example: npx create-wordjs@latest join backend --gateway <ip> --token <t>');
|
|
585
585
|
}
|
|
586
586
|
if (!opts.gateway) fail('--gateway <gateway-ip/dns> is required for join.');
|
|
587
587
|
if (!opts.token) fail('--token <join-token> is required for join.', `Mint one on the gateway: node scripts/cluster.js token ${opts.role}`);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-wordjs",
|
|
3
|
-
"version": "1.12.
|
|
3
|
+
"version": "1.12.2",
|
|
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)",
|