@see-ms/converter 1.0.0 → 1.1.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/README.md CHANGED
@@ -1,308 +1,350 @@
1
1
  # @see-ms/converter
2
2
 
3
- CLI tool for converting HTML exports to Nuxt 3 projects with automatic CMS integration.
3
+ SeeMS converts Webflow HTML exports into Nuxt 3 projects with a reviewable CMS manifest, Strapi schemas/seed data, and
4
+ an inline editing overlay.
4
5
 
5
- ## Features
6
+ The goal is not just HTML-to-Vue syntax. SeeMS tries to preserve the site, explain what it found, componentize obvious
7
+ reusable sections, make content editable, and wire a developer-friendly Strapi workflow.
6
8
 
7
- **Automatic Conversion**
9
+ ## Quick Start
8
10
 
9
- - Convert HTML to Vue components
10
- - Transform `<a>` tags to `<NuxtLink>` with proper routing
11
- - Normalize all asset paths automatically
12
-
13
- 🎨 **Asset Management**
14
-
15
- - CSS files → `assets/css/`
16
- - Images, fonts, JS → `public/assets/`
17
- - Auto-generate Vite plugin for path resolution (For Webflow)
11
+ ```bash
12
+ cms analyze ./webflow-export
13
+ cms convert ./webflow-export ./nuxt-site
14
+ ```
18
15
 
19
- 🔧 **Smart Transforms**
16
+ Use `--skip-prompts` for repeatable runs:
20
17
 
21
- - Extract and deduplicate embedded styles
22
- - Remove unnecessary attributes (srcset, sizes)
23
- - Clean up script tags and inline code
24
- - Format output with Prettier
18
+ ```bash
19
+ cms convert ./webflow-export ./nuxt-site \
20
+ --config ./see-ms.config.ts \
21
+ --skip-prompts
22
+ ```
25
23
 
26
- 📦 **Boilerplate Support**
24
+ ## Full Step-By-Step Usage
27
25
 
28
- - Clone from GitHub repository
29
- - Copy from local directory
30
- - Works with your custom Nuxt boilerplate
26
+ ### 1. Build or install the CLI
31
27
 
32
- ---
28
+ When working from this monorepo:
33
29
 
34
- ## Installation
30
+ ```bash
31
+ pnpm install
32
+ pnpm --filter @see-ms/types build
33
+ pnpm --filter @see-ms/editor-overlay build
34
+ pnpm --filter @see-ms/converter build
35
+ ```
35
36
 
36
- ### Quick Use (npx - no installation)
37
+ Then use:
37
38
 
38
39
  ```bash
39
- npx @see-ms/converter convert <webflow-export> <output-dir> [options]
40
+ node packages/converter/dist/cli.mjs --help
40
41
  ```
41
42
 
42
- ### Global Installation
43
+ If installed globally or through `npx`, use `cms` in place of `node packages/converter/dist/cli.mjs`.
43
44
 
44
- ```bash
45
- npm install -g @see-ms/converter
46
- # or
47
- pnpm add -g @see-ms/converter
45
+ ### 2. Export your Webflow site
46
+
47
+ Your Webflow export should contain HTML plus asset folders:
48
+
49
+ ```text
50
+ webflow-export/
51
+ index.html
52
+ about.html
53
+ products/item.html
54
+ css/
55
+ images/
56
+ fonts/
57
+ js/
48
58
  ```
49
59
 
50
- Then use anywhere:
60
+ Nested pages are supported.
61
+
62
+ ### 3. Analyze the export
63
+
64
+ Run analysis before generating anything:
51
65
 
52
66
  ```bash
53
- cms convert <webflow-export> <output-dir> [options]
67
+ cms analyze ./webflow-export
54
68
  ```
55
69
 
56
- ---
70
+ This previews pages, Nuxt routes, assets, shared component candidates, and warnings.
57
71
 
58
- ## Usage
72
+ ### 4. Convert to Nuxt
59
73
 
60
- ### Basic Conversion
74
+ Run the interactive converter:
61
75
 
62
76
  ```bash
63
- cms convert ./my-webflow-export ./my-nuxt-site
77
+ cms convert ./webflow-export ./nuxt-site
64
78
  ```
65
79
 
66
- ### With Boilerplate (Recommended)
80
+ With a Nuxt boilerplate:
67
81
 
68
82
  ```bash
69
- # From GitHub
70
83
  cms convert ./webflow-export ./nuxt-site \
71
- --boilerplate git@github.com:username/nuxt-boilerplate.git
72
-
73
- # From local directory
74
- cms convert ./webflow-export ./nuxt-site \
75
- --boilerplate /path/to/local/boilerplate
84
+ --boilerplate /path/to/nuxt-boilerplate
76
85
  ```
77
86
 
78
- ### Full Example
79
-
80
- ```bash
81
- cms convert ./project-html ./project-nuxt \
82
- --boilerplate git@github.com:username/repo-boilerplate.git \
83
- --cms strapi
87
+ The converter writes:
88
+
89
+ ```text
90
+ nuxt-site/
91
+ pages/
92
+ components/
93
+ assets/
94
+ public/cms-manifest.json
95
+ cms-schemas/
96
+ cms-seed/seed-data.json
97
+ strapi-bootstrap/
98
+ see-ms.config.ts
99
+ see-ms-report.md
100
+ see-ms-report.json
84
101
  ```
85
102
 
86
- ---
103
+ ### 5. Review the report and config
87
104
 
88
- ## Options
105
+ Start with:
89
106
 
90
- | Option | Description | Default |
91
- |------------------------------|----------------------------------------------|---------|
92
- | `-b, --boilerplate <source>` | GitHub URL or local path to Nuxt boilerplate | none |
93
- | `-o, --overrides <path>` | Path to overrides JSON file | none |
94
- | `--generate-schemas` | Generate CMS schemas after conversion | false |
95
- | `--cms <type>` | CMS type: strapi, contentful, or sanity | strapi |
107
+ ```text
108
+ nuxt-site/see-ms-report.md
109
+ nuxt-site/see-ms.config.ts
110
+ nuxt-site/public/cms-manifest.json
111
+ ```
96
112
 
97
- ---
113
+ Use the report to check pages, routes, assets, components, editable fields, collections, schemas, seed data, and
114
+ warnings.
98
115
 
99
- ## What Gets Converted
116
+ Use `see-ms.config.ts` to make future runs repeatable.
100
117
 
101
- ### HTML Vue Components
118
+ ### 6. Repeat conversion without prompts
102
119
 
103
- **Before (Webflow):**
120
+ After reviewing config, rerun non-interactively:
104
121
 
105
- ```html
106
- <!-- index.html -->
107
- <a href="about.html">About</a>
108
- <img src="images/logo.svg" srcset="..." sizes="...">
122
+ ```bash
123
+ cms convert ./webflow-export ./nuxt-site \
124
+ --config ./nuxt-site/see-ms.config.ts \
125
+ --skip-prompts
109
126
  ```
110
127
 
111
- **After (Nuxt):**
128
+ ### 7. Create or connect Strapi
112
129
 
113
- ```vue
114
- <!-- pages/index.vue -->
115
- <script setup lang="ts">
116
- // Page: index
117
- </script>
130
+ If you do not have Strapi yet:
118
131
 
119
- <template>
120
- <div class="page-index">
121
- <NuxtLink to="/about">About</NuxtLink>
122
- <img src="/assets/images/logo.svg">
123
- </div>
124
- </template>
132
+ ```bash
133
+ cms scaffold-strapi ./strapi-app
125
134
  ```
126
135
 
127
- ### Asset Structure
136
+ Or scaffold it during conversion:
128
137
 
138
+ ```bash
139
+ cms convert ./webflow-export ./nuxt-site \
140
+ --scaffold-strapi ./strapi-app
129
141
  ```
130
- webflow-export/ nuxt-project/
131
- ├── css/ → ├── assets/css/
132
- ├── images/ → ├── public/assets/images/
133
- ├── fonts/ → ├── public/assets/fonts/
134
- ├── js/ → ├── public/assets/js/
135
- └── *.html → └── pages/*.vue
136
- ```
137
-
138
- ### Auto-Generated Files
139
-
140
- - ✅ `utils/webflow-assets.ts` - Vite plugin for CSS path resolution on Webflow files
141
- - ✅ `assets/css/main.css` - Extracted embedded styles
142
- - ✅ Updated `nuxt.config.ts` with CSS imports
143
-
144
- ---
145
142
 
146
- ## Transformations Applied
143
+ If you already have Strapi:
147
144
 
148
- ### Links
149
-
150
- - `<a href="about.html">` → `<NuxtLink to="/about">`
151
- - `<a href="../index.html">` → `<NuxtLink to="/">`
152
- - `<a href="index.html">` → `<NuxtLink to="/">`
153
- - External links remain as `<a>` tags
154
-
155
- ### Images
156
-
157
- - `images/logo.svg` → `/assets/images/logo.svg`
158
- - Removes `srcset` and `sizes` attributes
159
- - Normalizes relative paths
160
-
161
- ### Styles
162
-
163
- - Extracts `.global-embed` styles (For Webflow)
164
- - Deduplicates repeated styles
165
- - Adds to `assets/css/main.css`
166
-
167
- ### Scripts
168
-
169
- - Removes all inline `<script>` tags
170
- - Cleans up Webflow-specific JavaScript
171
-
172
- ---
145
+ ```bash
146
+ cms setup-strapi ./nuxt-site ./strapi-app
147
+ ```
173
148
 
174
- ## Output Structure
149
+ If the target Strapi directory does not exist yet, `setup-strapi` can create it:
175
150
 
176
- ```
177
- my-nuxt-site/
178
- ├── pages/
179
- │ ├── index.vue
180
- │ └── others.cue
181
-
182
- ├── assets/
183
- │ └── css/
184
- │ ├── normalize.css
185
- │ ├── components.css
186
- │ ├── webflow.css
187
- │ └── main.css
188
- ├── public/
189
- │ └── assets/
190
- │ ├── images/
191
- │ ├── fonts/
192
- │ └── js/
193
- ├── utils/
194
- │ └── webflow-assets.ts
195
- └── nuxt.config.ts (updated)
151
+ ```bash
152
+ cms setup-strapi ./nuxt-site ./strapi-app --scaffold
196
153
  ```
197
154
 
198
- ---
155
+ ### 8. Run Nuxt and Strapi
199
156
 
200
- ## After Conversion
201
-
202
- 1. **Install dependencies:**
157
+ In the Nuxt project:
203
158
 
204
159
  ```bash
205
- cd my-nuxt-site
206
- pnpm install
160
+ cd ./nuxt-site
161
+ pnpm install
162
+ pnpm dev
207
163
  ```
208
164
 
209
- 2. **Start development server:**
165
+ In the Strapi project:
210
166
 
211
167
  ```bash
212
- pnpm dev
168
+ cd ./strapi-app
169
+ npm run develop
213
170
  ```
214
171
 
215
- 3. **Your site should be running!** 🎉
172
+ Use the package manager you chose when scaffolding Strapi.
216
173
 
217
- ---
174
+ ### 9. Open the inline editor
218
175
 
219
- ## Requirements
176
+ Open the Nuxt app normally:
220
177
 
221
- - Node.js >= 18
222
- - A Webflow export (HTML, CSS, images, fonts)
223
- - (Optional) A Nuxt 3 boilerplate
178
+ ```text
179
+ http://localhost:3000
180
+ ```
224
181
 
225
- ---
182
+ Open preview/editing mode:
226
183
 
227
- ## Tips
184
+ ```text
185
+ http://localhost:3000?preview=true
186
+ ```
228
187
 
229
- ### Using Your Own Boilerplate
188
+ The inline editor reads `public/cms-manifest.json` and lets you edit text, rich text, links, images, and icons, then
189
+ save/publish through Strapi.
230
190
 
231
- If you have a standard Nuxt boilerplate for all projects:
191
+ ### 10. Use the fixture for local testing
232
192
 
233
- 1. Create a GitHub repo with your boilerplate
234
- 2. Use it in every conversion:
193
+ From this repo:
235
194
 
236
195
  ```bash
237
- cms convert ./webflow ./output --boilerplate git@github.com:you/boilerplate.git
196
+ node packages/converter/dist/cli.mjs analyze packages/converter/fixtures/webflow-basic
197
+
198
+ node packages/converter/dist/cli.mjs convert \
199
+ packages/converter/fixtures/webflow-basic \
200
+ /private/tmp/see-ms-fixture-output \
201
+ --skip-prompts \
202
+ --no-editor
238
203
  ```
239
204
 
240
- ### Webflow Export Tips
205
+ ## Workflow
206
+
207
+ 1. **Analyze** scans pages, routes, assets, and reusable component candidates.
208
+ 2. **Plan** guides you through collections, shared components, seed content, and editor wiring.
209
+ 3. **Convert** writes Nuxt pages and preserves nested asset folders.
210
+ 4. **CMS** writes `public/cms-manifest.json`, Strapi schemas, and optional seed data.
211
+ 5. **Editor** installs the inline editor overlay for `?preview=true`.
212
+
213
+ Every conversion writes:
214
+
215
+ - `see-ms.config.ts` for repeatable settings
216
+ - `see-ms-report.md` for a human-readable summary
217
+ - `see-ms-report.json` for automation
218
+ - `public/cms-manifest.json` as the provider-neutral source of truth
219
+
220
+ ## Interactive Conversion
221
+
222
+ By default, `cms convert` opens a small wizard:
223
+
224
+ - confirms input, output, boilerplate, and CMS provider
225
+ - previews discovered pages and routes
226
+ - previews shared component candidates
227
+ - asks for collection hints when none exist in config
228
+ - asks whether to generate seed content
229
+ - asks whether to wire the inline editor
230
+
231
+ The wizard is designed for developers: it explains what the converter sees before it writes the final project.
232
+
233
+ ## Config File
234
+
235
+ SeeMS writes and reads `see-ms.config.ts`:
236
+
237
+ ```ts
238
+ import type {SeeMSConfig} from "@see-ms/types";
239
+
240
+ const config: SeeMSConfig = {
241
+ cms: {provider: "strapi"},
242
+ collections: [
243
+ {className: "blog-card", name: "blog_posts"}
244
+ ],
245
+ components: {
246
+ enabled: true,
247
+ minOccurrences: 2,
248
+ include: ["nav", "header", "footer"]
249
+ },
250
+ ignore: {
251
+ selectors: [".sr-only"],
252
+ classes: ["decorative-icon"]
253
+ },
254
+ editor: {
255
+ enabled: true,
256
+ previewParam: "preview"
257
+ }
258
+ };
241
259
 
242
- - Export from Webflow: **Site Settings → Export Code**
243
- - Make sure to include all assets
244
- - Check that images are properly linked
260
+ export default config;
261
+ ```
245
262
 
246
- ### Handling Custom Code
263
+ CLI flags can override the config for a single run, but config is the durable source of truth.
247
264
 
248
- If your Webflow site has custom JavaScript that you need:
265
+ ## Detection Model
249
266
 
250
- 1. The converter removes inline scripts for clean Vue components
251
- 2. Port necessary JavaScript to Vue composables or plugins
252
- 3. Add to your Nuxt `plugins/` or `composables/` folders
267
+ SeeMS detects editable fields from generated Vue templates:
253
268
 
254
- ---
269
+ - headings, paragraphs, spans, list items, and leaf text nodes
270
+ - rich text when nested formatting is present
271
+ - images and icons as media fields
272
+ - links as `{ url, text, newTab }`
273
+ - collections from `data-cms-collection` or configured classes
274
+ - shared components from repeated nav/header/footer/top-level structures
255
275
 
256
- ## Troubleshooting
276
+ Use Webflow custom attributes for stronger hints:
257
277
 
258
- ### `nuxt.config.ts not found`
278
+ ```html
279
+ <h1 data-cms="hero-heading">Solar finance made simple</h1>
280
+ <div data-cms-collection="faq-items">...</div>
281
+ <p data-cms-ignore>Decorative helper text</p>
282
+ ```
283
+
284
+ ## Strapi Setup
259
285
 
260
- The converter expects a `nuxt.config.ts` file. Either:
286
+ For v1, Strapi is the supported CMS provider.
261
287
 
262
- - Use a boilerplate that has one, or
263
- - The converter will create a minimal one if no boilerplate is specified
288
+ If you do not have a Strapi project yet, scaffold one:
264
289
 
265
- ### Assets not loading
290
+ ```bash
291
+ cms scaffold-strapi ./strapi-app
292
+ ```
266
293
 
267
- Make sure the `webflow-assets.ts` plugin is imported in your `nuxt.config.ts`:
294
+ Or do it as part of conversion:
268
295
 
269
- ```typescript
270
- import webflowAssets from './utils/webflow-assets'
296
+ ```bash
297
+ cms convert ./webflow-export ./nuxt-site \
298
+ --scaffold-strapi ./strapi-app
299
+ ```
271
300
 
272
- export default defineNuxtConfig({
273
- vite: {
274
- plugins: [webflowAssets()]
301
+ For repeatable runs, put it in config:
302
+
303
+ ```ts
304
+ const config: SeeMSConfig = {
305
+ cms: {
306
+ provider: "strapi",
307
+ strapi: {
308
+ scaffold: true,
309
+ directory: "./strapi-app",
310
+ packageManager: "npm",
311
+ install: true
312
+ }
275
313
  }
276
- })
314
+ };
277
315
  ```
278
316
 
279
- ### Routes not working
317
+ Use `--no-strapi-install` if you want SeeMS to create the Strapi files but skip dependency installation.
280
318
 
281
- Check that your `pages/` directory is enabled in Nuxt. It should be automatic, but verify in `nuxt.config.ts`:
319
+ If you already have a Strapi project:
282
320
 
283
- ```typescript
284
- export default defineNuxtConfig({
285
- pages: true
286
- })
321
+ ```bash
322
+ cms setup-strapi ./nuxt-site ./strapi-app
323
+ cms generate-schemas ./nuxt-site/public/cms-manifest.json --type strapi
287
324
  ```
288
325
 
289
- ---
290
-
291
- ## Contributing
326
+ The manifest stays provider-neutral so Contentful and Sanity adapters can be added later without changing the detection
327
+ model.
292
328
 
293
- Issues and pull requests welcome!
329
+ ## Inline Editor
294
330
 
295
- ## License
331
+ When enabled, SeeMS wires `@see-ms/editor-overlay`.
296
332
 
297
- MIT
333
+ Open the generated Nuxt site with:
298
334
 
299
- ---
335
+ ```text
336
+ http://localhost:3000?preview=true
337
+ ```
300
338
 
301
- ## Related Packages
339
+ The editor reads `cms-manifest.json`, then supports:
302
340
 
303
- - [@see-ms/types](../types) - Shared TypeScript types
304
- - [@see-ms/editor-overlay](../editor-overlay) - Inline CMS editor (coming soon)
341
+ - click-to-edit text and headings
342
+ - basic rich text controls
343
+ - link text, URL, and new-tab editing
344
+ - image/icon path replacement
345
+ - draft restore/discard
346
+ - save and publish through generated Nuxt API routes
305
347
 
306
- ---
348
+ ## Fixtures And Local Test Projects
307
349
 
308
- **Made with ❤**
350
+ - `packages/converter/fixtures/webflow-basic` is a small repeatable Webflow-style fixture.