@mieweb/cli 0.1.0 → 0.2.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/package.json +2 -3
- package/src/index.mjs +1 -1
- package/src/init.mjs +8 -2
- package/src/local.mjs +10 -10
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mieweb/cli",
|
|
3
|
-
"version": "0.1
|
|
3
|
+
"version": "0.2.1",
|
|
4
4
|
"description": "`mieweb` CLI — a thin, target-aware wrapper over wrangler. On the cloudflare target it delegates verbatim to the real wrangler binary; on other targets it drives the matching @mieweb adapter (e.g. the local Node host harness).",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -30,8 +30,7 @@
|
|
|
30
30
|
"mieweb": "./src/index.mjs"
|
|
31
31
|
},
|
|
32
32
|
"dependencies": {
|
|
33
|
-
"@mieweb/cloud-
|
|
34
|
-
"@mieweb/cloud-os": "0.1.0"
|
|
33
|
+
"@mieweb/cloud-adapters": "0.2.1"
|
|
35
34
|
},
|
|
36
35
|
"files": [
|
|
37
36
|
"src",
|
package/src/index.mjs
CHANGED
|
@@ -101,7 +101,7 @@ async function main(argv) {
|
|
|
101
101
|
|
|
102
102
|
// Node "host" targets run the unchanged worker via the host harness. `local`
|
|
103
103
|
// uses the in-process adapters; `mieweb` (os.mieweb.org) uses the networked
|
|
104
|
-
// ones (libSQL/S3/Valkey), registered when local.mjs imports @mieweb/cloud-os.
|
|
104
|
+
// ones (libSQL/S3/Valkey), registered when local.mjs imports @mieweb/cloud-adapters/os.
|
|
105
105
|
if (config.target === 'local' || config.target === 'mieweb') {
|
|
106
106
|
return runHostTarget(args, config);
|
|
107
107
|
}
|
package/src/init.mjs
CHANGED
|
@@ -102,7 +102,8 @@ function packageJson(name) {
|
|
|
102
102
|
deploy: 'mieweb deploy',
|
|
103
103
|
},
|
|
104
104
|
devDependencies: {
|
|
105
|
-
'@mieweb/cli': '^0.
|
|
105
|
+
'@mieweb/cli': '^0.2.0',
|
|
106
|
+
'@mieweb/cloud': '^0.2.0',
|
|
106
107
|
},
|
|
107
108
|
},
|
|
108
109
|
null,
|
|
@@ -122,6 +123,11 @@ function wranglerJsonc(name) {
|
|
|
122
123
|
"compatibility_date": "2025-01-01",
|
|
123
124
|
"compatibility_flags": ["nodejs_compat"],
|
|
124
125
|
|
|
126
|
+
// \`import { DurableObject } from 'mieweb:workers'\` → the real
|
|
127
|
+
// \`cloudflare:workers\` here, a pure-JS base on other targets. Owned by the
|
|
128
|
+
// layer; leave as-is.
|
|
129
|
+
"alias": { "mieweb:workers": "@mieweb/cloud/workers" },
|
|
130
|
+
|
|
125
131
|
// A starter D1 + KV binding. Add R2/Queues/Durable Objects/Vectorize/AI as
|
|
126
132
|
// you need them — every contract surface is portable across targets.
|
|
127
133
|
"d1_databases": [
|
|
@@ -151,7 +157,7 @@ function miewebJsonc() {
|
|
|
151
157
|
},
|
|
152
158
|
|
|
153
159
|
// mieweb (os.mieweb.org): libSQL + Valkey. Bring the backing services up
|
|
154
|
-
// with the docker-compose.yml from @mieweb/cloud-
|
|
160
|
+
// with the docker-compose.yml from @mieweb/cloud-adapters.
|
|
155
161
|
"mieweb": {
|
|
156
162
|
"port": 8787,
|
|
157
163
|
"bindings": {
|
package/src/local.mjs
CHANGED
|
@@ -2,12 +2,12 @@ import { resolve } from 'node:path';
|
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Dispatch a command on a Node "host" target (`local`, `mieweb`, …) through the
|
|
5
|
-
* shared Node host harness in @mieweb/cloud-
|
|
5
|
+
* shared Node host harness in @mieweb/cloud-adapters.
|
|
6
6
|
*
|
|
7
|
-
* * `local` →
|
|
8
|
-
* * `mieweb` →
|
|
9
|
-
*
|
|
10
|
-
* host harness then builds the env and runs the unchanged worker.
|
|
7
|
+
* * `local` → the built-in local drivers (SQLite / fs / memory / in-proc).
|
|
8
|
+
* * `mieweb` → `@mieweb/cloud-adapters/os` drivers (libSQL / S3 / Valkey).
|
|
9
|
+
* Importing that subpath registers its drivers into the shared registry; the
|
|
10
|
+
* very same host harness then builds the env and runs the unchanged worker.
|
|
11
11
|
*
|
|
12
12
|
* Supported commands:
|
|
13
13
|
* * `mieweb [--target <t>] d1 migrations apply [db]` (local / sqlite only)
|
|
@@ -21,10 +21,10 @@ import { resolve } from 'node:path';
|
|
|
21
21
|
* @returns {Promise<number>} exit code
|
|
22
22
|
*/
|
|
23
23
|
export async function runHostTarget(args, config) {
|
|
24
|
-
// Non-local host targets ship their drivers
|
|
25
|
-
// it is enough to register them into
|
|
24
|
+
// Non-local host targets ship their drivers on a separate subpath; importing
|
|
25
|
+
// it is enough to register them into the shared driver registry.
|
|
26
26
|
if (config.target === 'mieweb') {
|
|
27
|
-
await import('@mieweb/cloud-os');
|
|
27
|
+
await import('@mieweb/cloud-adapters/os');
|
|
28
28
|
}
|
|
29
29
|
|
|
30
30
|
const [cmd, ...rest] = args;
|
|
@@ -64,7 +64,7 @@ async function d1MigrationsApply(config) {
|
|
|
64
64
|
);
|
|
65
65
|
const dbPath = resolve(config.root, dbCfg.path);
|
|
66
66
|
|
|
67
|
-
const { applyMigrations } = await import('@mieweb/cloud-
|
|
67
|
+
const { applyMigrations } = await import('@mieweb/cloud-adapters/migrate');
|
|
68
68
|
const { applied, skipped } = await applyMigrations({ dbPath, migrationsDir });
|
|
69
69
|
|
|
70
70
|
console.log(
|
|
@@ -80,7 +80,7 @@ async function d1MigrationsApply(config) {
|
|
|
80
80
|
* @param {import('./config.mjs').MiewebConfig} config
|
|
81
81
|
*/
|
|
82
82
|
async function dev(config) {
|
|
83
|
-
const { startLocalHost } = await import('@mieweb/cloud-
|
|
83
|
+
const { startLocalHost } = await import('@mieweb/cloud-adapters/host');
|
|
84
84
|
const handle = await startLocalHost({ config });
|
|
85
85
|
// Keep the process alive until interrupted.
|
|
86
86
|
return new Promise((resolvePromise) => {
|