@see-ms/converter 1.0.0

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 ADDED
@@ -0,0 +1,308 @@
1
+ # @see-ms/converter
2
+
3
+ CLI tool for converting HTML exports to Nuxt 3 projects with automatic CMS integration.
4
+
5
+ ## Features
6
+
7
+ ✨ **Automatic Conversion**
8
+
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)
18
+
19
+ 🔧 **Smart Transforms**
20
+
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
25
+
26
+ 📦 **Boilerplate Support**
27
+
28
+ - Clone from GitHub repository
29
+ - Copy from local directory
30
+ - Works with your custom Nuxt boilerplate
31
+
32
+ ---
33
+
34
+ ## Installation
35
+
36
+ ### Quick Use (npx - no installation)
37
+
38
+ ```bash
39
+ npx @see-ms/converter convert <webflow-export> <output-dir> [options]
40
+ ```
41
+
42
+ ### Global Installation
43
+
44
+ ```bash
45
+ npm install -g @see-ms/converter
46
+ # or
47
+ pnpm add -g @see-ms/converter
48
+ ```
49
+
50
+ Then use anywhere:
51
+
52
+ ```bash
53
+ cms convert <webflow-export> <output-dir> [options]
54
+ ```
55
+
56
+ ---
57
+
58
+ ## Usage
59
+
60
+ ### Basic Conversion
61
+
62
+ ```bash
63
+ cms convert ./my-webflow-export ./my-nuxt-site
64
+ ```
65
+
66
+ ### With Boilerplate (Recommended)
67
+
68
+ ```bash
69
+ # From GitHub
70
+ 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
76
+ ```
77
+
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
84
+ ```
85
+
86
+ ---
87
+
88
+ ## Options
89
+
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 |
96
+
97
+ ---
98
+
99
+ ## What Gets Converted
100
+
101
+ ### HTML → Vue Components
102
+
103
+ **Before (Webflow):**
104
+
105
+ ```html
106
+ <!-- index.html -->
107
+ <a href="about.html">About</a>
108
+ <img src="images/logo.svg" srcset="..." sizes="...">
109
+ ```
110
+
111
+ **After (Nuxt):**
112
+
113
+ ```vue
114
+ <!-- pages/index.vue -->
115
+ <script setup lang="ts">
116
+ // Page: index
117
+ </script>
118
+
119
+ <template>
120
+ <div class="page-index">
121
+ <NuxtLink to="/about">About</NuxtLink>
122
+ <img src="/assets/images/logo.svg">
123
+ </div>
124
+ </template>
125
+ ```
126
+
127
+ ### Asset Structure
128
+
129
+ ```
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
+
146
+ ## Transformations Applied
147
+
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
+ ---
173
+
174
+ ## Output Structure
175
+
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)
196
+ ```
197
+
198
+ ---
199
+
200
+ ## After Conversion
201
+
202
+ 1. **Install dependencies:**
203
+
204
+ ```bash
205
+ cd my-nuxt-site
206
+ pnpm install
207
+ ```
208
+
209
+ 2. **Start development server:**
210
+
211
+ ```bash
212
+ pnpm dev
213
+ ```
214
+
215
+ 3. **Your site should be running!** 🎉
216
+
217
+ ---
218
+
219
+ ## Requirements
220
+
221
+ - Node.js >= 18
222
+ - A Webflow export (HTML, CSS, images, fonts)
223
+ - (Optional) A Nuxt 3 boilerplate
224
+
225
+ ---
226
+
227
+ ## Tips
228
+
229
+ ### Using Your Own Boilerplate
230
+
231
+ If you have a standard Nuxt boilerplate for all projects:
232
+
233
+ 1. Create a GitHub repo with your boilerplate
234
+ 2. Use it in every conversion:
235
+
236
+ ```bash
237
+ cms convert ./webflow ./output --boilerplate git@github.com:you/boilerplate.git
238
+ ```
239
+
240
+ ### Webflow Export Tips
241
+
242
+ - Export from Webflow: **Site Settings → Export Code**
243
+ - Make sure to include all assets
244
+ - Check that images are properly linked
245
+
246
+ ### Handling Custom Code
247
+
248
+ If your Webflow site has custom JavaScript that you need:
249
+
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
253
+
254
+ ---
255
+
256
+ ## Troubleshooting
257
+
258
+ ### `nuxt.config.ts not found`
259
+
260
+ The converter expects a `nuxt.config.ts` file. Either:
261
+
262
+ - Use a boilerplate that has one, or
263
+ - The converter will create a minimal one if no boilerplate is specified
264
+
265
+ ### Assets not loading
266
+
267
+ Make sure the `webflow-assets.ts` plugin is imported in your `nuxt.config.ts`:
268
+
269
+ ```typescript
270
+ import webflowAssets from './utils/webflow-assets'
271
+
272
+ export default defineNuxtConfig({
273
+ vite: {
274
+ plugins: [webflowAssets()]
275
+ }
276
+ })
277
+ ```
278
+
279
+ ### Routes not working
280
+
281
+ Check that your `pages/` directory is enabled in Nuxt. It should be automatic, but verify in `nuxt.config.ts`:
282
+
283
+ ```typescript
284
+ export default defineNuxtConfig({
285
+ pages: true
286
+ })
287
+ ```
288
+
289
+ ---
290
+
291
+ ## Contributing
292
+
293
+ Issues and pull requests welcome!
294
+
295
+ ## License
296
+
297
+ MIT
298
+
299
+ ---
300
+
301
+ ## Related Packages
302
+
303
+ - [@see-ms/types](../types) - Shared TypeScript types
304
+ - [@see-ms/editor-overlay](../editor-overlay) - Inline CMS editor (coming soon)
305
+
306
+ ---
307
+
308
+ **Made with ❤**
package/dist/cli.d.mts ADDED
@@ -0,0 +1 @@
1
+ #!/usr/bin/env node