mechanica 2.0.2 → 2.0.3
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 +4 -2
- package/bin/mechanica.js +3 -1
- package/dist/cli.js +448 -620
- package/dist/export.js +580 -0
- package/dist/types/cli/export.d.ts +31 -2
- package/dist/types/cli/platform/api.d.ts +33 -0
- package/dist/types/cli/platform/bundle-format.d.ts +40 -0
- package/dist/types/cli/platform/credentials.d.ts +11 -0
- package/dist/types/cli/platform/engine-version.d.ts +6 -0
- package/dist/types/cli/platform/git.d.ts +15 -0
- package/dist/types/cli/platform/link.d.ts +11 -0
- package/dist/types/cli/platform/login.d.ts +9 -0
- package/dist/types/cli/platform/push.d.ts +12 -0
- package/dist/types/cli/run-export.d.ts +7 -0
- package/package.json +6 -2
- package/dist/types/cli/push.d.ts +0 -10
package/README.md
CHANGED
|
@@ -359,7 +359,9 @@ These drive a locally installed Chrome or Edge (or `--browser <path>`) and need
|
|
|
359
359
|
| `mechanica shot <blockId \| /path>` | Screenshot a block or a page. Flags: `--width`, `--data`, `--out`, `--full`, `--server`, `--browser` |
|
|
360
360
|
| `mechanica thumbs [--blocks]` | Regenerate page or block thumbnails for the editor |
|
|
361
361
|
| `mechanica images` | Generate image dimensions and blur-up previews for `.mech/assets` (needs `sharp`; `--force` redoes all) |
|
|
362
|
-
| `mechanica
|
|
362
|
+
| `mechanica login` | Sign in to the Mechanica platform and save an access token for this machine (`--host`, `--token`) |
|
|
363
|
+
| `mechanica link <slug>` | Point this repository at a site on the platform (`--create` makes the site) |
|
|
364
|
+
| `mechanica push` | Publish the committed project to the platform: pull what was edited online, `git push`, build and upload the bundle when the code changed, wait for the deploy |
|
|
363
365
|
|
|
364
366
|
## Plugin options
|
|
365
367
|
|
|
@@ -388,7 +390,7 @@ From `mechanica`:
|
|
|
388
390
|
- **Composables:** `usePages`, `usePagination`, `useFetch`, `useLocale`, `useLayout`, `usePageData` (the current page's path, `meta`, layout and locale), `useRouter`, `useRoute`
|
|
389
391
|
- **Helpers:** `imagePosition`
|
|
390
392
|
|
|
391
|
-
From `mechanica/plugin`: `mechanica` and the `PageProvider` type. From `mechanica/widgets`: `defineWidget` and `useWidgetServices` (uploads and the image picker inside widget editors). `mechanica/editor` and `mechanica/composer` are loaded by the plugin in development; you don't import them.
|
|
393
|
+
From `mechanica/plugin`: `mechanica` and the `PageProvider` type. From `mechanica/widgets`: `defineWidget` and `useWidgetServices` (uploads and the image picker inside widget editors). `mechanica/editor` and `mechanica/composer` are loaded by the plugin in development; you don't import them. From `mechanica/export`: `exportBuilt(projectDir, options)`, which statically renders an already built project (`dist/` + `.mech/`) without running a build and resolves to `{ pages, warnings }` — for render services that receive a prebuilt bundle; `options.outDir` sets where the site is written, and `options.fetchJson` replaces how `useFetch` requests are made.
|
|
392
394
|
|
|
393
395
|
## Upgrading from 1.x
|
|
394
396
|
|
package/bin/mechanica.js
CHANGED
|
@@ -10,6 +10,8 @@ const entry = process.versions.bun && existsSync(srcEntry) ? '../src/cli/cli.ts'
|
|
|
10
10
|
const { run } = await import(entry)
|
|
11
11
|
|
|
12
12
|
run(process.argv.slice(2)).catch((error) => {
|
|
13
|
-
|
|
13
|
+
// A plain Error is a message for the user (bad usage, a refused push);
|
|
14
|
+
// anything else is a bug worth its stack trace.
|
|
15
|
+
console.error(error?.constructor === Error ? `mechanica: ${error.message}` : error)
|
|
14
16
|
process.exit(1)
|
|
15
17
|
})
|