@avocadostudio-ai/migration-sdk 0.2.1 → 0.2.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 +53 -0
- package/package.json +11 -2
package/README.md
ADDED
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
# @avocadostudio-ai/migration-sdk
|
|
2
|
+
|
|
3
|
+
Utilities for getting an existing website *into* the Avocado Studio content
|
|
4
|
+
shape: scrape a live page, segment it into sections, extract its design tokens,
|
|
5
|
+
and generate block definitions from what is there.
|
|
6
|
+
|
|
7
|
+
This is tooling for a one-time migration, not a runtime dependency of an
|
|
8
|
+
integrated site.
|
|
9
|
+
|
|
10
|
+
## Install
|
|
11
|
+
|
|
12
|
+
```bash
|
|
13
|
+
npm install @avocadostudio-ai/migration-sdk
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
`playwright` is an optional peer, required only by the functions that drive a
|
|
17
|
+
real browser (`fetchPageContent`, `takeScreenshot`, `scrapeFullPage`,
|
|
18
|
+
`discoverSitePages`). Install it if you use them:
|
|
19
|
+
|
|
20
|
+
```bash
|
|
21
|
+
npm install -D playwright && npx playwright install chromium
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
## What it does
|
|
25
|
+
|
|
26
|
+
| Area | Functions |
|
|
27
|
+
|---|---|
|
|
28
|
+
| **Scraping** | `fetchPageContent`, `scrapeFullPage`, `discoverSitePages`, `takeScreenshot`, `downloadImage` |
|
|
29
|
+
| **Structure** | `extractSections`, `extractPageOutline`, `extractNavigation`, `segmentByVisualGaps`, `detectRepeatedPatterns`, `resolveLazyImages` |
|
|
30
|
+
| **Design** | `extractDesignTokens`, `mapToThemeVariables`, `augmentThemeFromComputedStyles` |
|
|
31
|
+
| **Codegen** | `buildSectionSpec`, `buildPageSpecs`, `generateBlock`, `regenerateManifest` |
|
|
32
|
+
|
|
33
|
+
The intended order is scrape → segment → spec → generate: pull the rendered
|
|
34
|
+
page, cut it into candidate sections, describe each one as a spec, and emit a
|
|
35
|
+
block definition and renderer from that.
|
|
36
|
+
|
|
37
|
+
## Why the sections are found visually
|
|
38
|
+
|
|
39
|
+
A migration cannot trust the source markup to tell it where a section begins —
|
|
40
|
+
plenty of sites have one `<div>` per page and plenty have forty per section.
|
|
41
|
+
`segmentByVisualGaps` and `detectRepeatedPatterns` work from the rendered
|
|
42
|
+
geometry instead, which is why the browser peer exists.
|
|
43
|
+
|
|
44
|
+
## Design tokens
|
|
45
|
+
|
|
46
|
+
`extractDesignTokens` reads the site's own CSS custom properties;
|
|
47
|
+
`augmentThemeFromComputedStyles` fills the gaps from what the browser actually
|
|
48
|
+
computed, for a site that hardcodes its colours. `mapToThemeVariables` turns the
|
|
49
|
+
result into Avocado's theme shape.
|
|
50
|
+
|
|
51
|
+
## License
|
|
52
|
+
|
|
53
|
+
Apache-2.0
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@avocadostudio-ai/migration-sdk",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.3",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
"dist"
|
|
18
18
|
],
|
|
19
19
|
"dependencies": {
|
|
20
|
-
"@avocadostudio-ai/shared": "0.2.
|
|
20
|
+
"@avocadostudio-ai/shared": "0.2.3"
|
|
21
21
|
},
|
|
22
22
|
"devDependencies": {
|
|
23
23
|
"@types/node": "^22.13.10",
|
|
@@ -26,6 +26,15 @@
|
|
|
26
26
|
"playwright": "^1.58.2"
|
|
27
27
|
},
|
|
28
28
|
"description": "Utilities for migrating existing site content into the Avocado Studio PageDoc/BlockInstance shape",
|
|
29
|
+
"keywords": [
|
|
30
|
+
"avocado",
|
|
31
|
+
"avocado-studio",
|
|
32
|
+
"migration",
|
|
33
|
+
"scraper",
|
|
34
|
+
"playwright",
|
|
35
|
+
"design-tokens",
|
|
36
|
+
"page-builder"
|
|
37
|
+
],
|
|
29
38
|
"license": "Apache-2.0",
|
|
30
39
|
"homepage": "https://github.com/avocadostudio-ai/avocado/tree/main/packages/migration-sdk#readme",
|
|
31
40
|
"bugs": {
|