@mel000000/weweb-dynamic-metadata 1.0.1 → 1.0.7

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.
Files changed (2) hide show
  1. package/README.md +47 -23
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -1,8 +1,8 @@
1
1
  # weweb-dynamic-metadata
2
2
  ⭐ Build-time SEO metadata generator for WeWeb static exports
3
3
 
4
- [![npm version](https://img.shields.io/npm/v/weweb-dynamic-metadata)](https://www.npmjs.com/package/weweb-dynamic-metadata)
5
- [![npm downloads](https://img.shields.io/npm/dm/weweb-dynamic-metadata)](https://www.npmjs.com/package/weweb-dynamic-metadata)
4
+ [![npm version](https://img.shields.io/npm/v/@mel000000/weweb-dynamic-metadata)](https://www.npmjs.com/package/@mel000000/weweb-dynamic-metadata)
5
+ [![npm downloads](https://img.shields.io/npm/dm/@mel000000/weweb-dynamic-metadata)](https://www.npmjs.com/package/@mel000000/weweb-dynamic-metadata)
6
6
  [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
7
7
  [![GitHub stars](https://img.shields.io/github/stars/Mel000000/weweb-dynamic-metadata?style=social)](https://github.com/Mel000000/weweb-dynamic-metadata)
8
8
 
@@ -23,8 +23,9 @@ A build-time tool that generates unique SEO metadata for each dynamic page in yo
23
23
  - [Prerequisites Checklist](#prerequisites-checklist)
24
24
  - [Setup](#setup)
25
25
  - [1. Configure Supabase](#1-configure-supabase)
26
- - [2. Create Config File](#2-create-config-file)
27
- - [3. Run the Generator](#3-run-the-generator)
26
+ - [2. Set Up Environment Variables](#2-set-up-environment-variables)
27
+ - [3. Create Config File](#3-create-config-file)
28
+ - [4. Run the Generator](#4-run-the-generator)
28
29
  - [How It Works](#how-it-works)
29
30
  - [1. Reads Your Config](#1-reads-your-config)
30
31
  - [2. Discovers Content IDs](#2-discovers-content-ids)
@@ -103,15 +104,15 @@ This project provides a **simpler, cheaper, faster alternative**:
103
104
 
104
105
  1. Export your WeWeb project (creates `dist/` folder)
105
106
  2. Create `weweb.config.js` in your project root
106
- 3. Run `npx weweb-dynamic-metadata`
107
+ 3. Run `npx @mel000000/weweb-dynamic-metadata` or `npx weweb-metadata`
107
108
  4. Deploy anywhere - each article now has unique metadata!
108
109
 
109
110
  ```bash
110
111
  # One-time setup
111
- npm install --save-dev weweb-dynamic-metadata
112
+ npm install --save-dev @mel000000/weweb-dynamic-metadata
112
113
 
113
114
  # Generate metadata (run after each WeWeb export)
114
- npx weweb-dynamic-metadata
115
+ npx @mel000000/weweb-dynamic-metadata
115
116
 
116
117
  # That's it! Your articles now have unique SEO metadata
117
118
  ```
@@ -130,13 +131,13 @@ npx weweb-dynamic-metadata
130
131
  ## Quick Start
131
132
  ```bash
132
133
  # 1. Install the package
133
- npm install --save-dev weweb-dynamic-metadata
134
+ npm install --save-dev @mel000000/weweb-dynamic-metadata
134
135
 
135
136
  # 2. Create weweb.config.js in your project root
136
137
  # (see Setup section below)
137
138
 
138
139
  # 3. Run it!
139
- npx weweb-dynamic-metadata
140
+ npx @mel000000/weweb-dynamic-metadata
140
141
 
141
142
  # Done! Your articles now have unique metadata
142
143
  ```
@@ -144,7 +145,7 @@ npx weweb-dynamic-metadata
144
145
 
145
146
  ### Prerequisites Checklist
146
147
  Before using this package, ensure you have:
147
- - A WeWeb project exported to static files (has ``article/_param/index.html``)
148
+ - A WeWeb project exported to static files (has ``your-page-name/_param/index.html``)
148
149
  - Node.js 18 or higher installed
149
150
  - A Supabase project with your content
150
151
  - Your Supabase URL and anon key ready
@@ -172,7 +173,21 @@ FOR SELECT
172
173
  TO anon
173
174
  USING (true);
174
175
  ```
175
- #### 2. Create Config File
176
+ #### 2. Set Up Environment Variables
177
+ Create a ``.env`` file in your project root to store your Supabase credentials securely:
178
+ ```.env
179
+ # .env file
180
+ SUPABASE_URL=https://your-project.supabase.co
181
+ SUPABASE_ANON_KEY=your-anon-key-here
182
+ ```
183
+ ⚠️ Important: Never commit your .env file to version control. Add it to your .gitignore:
184
+ ```text
185
+ # .gitignore
186
+ .env
187
+ ```
188
+ The package uses dotenv to automatically load these environment variables when you run the generator.
189
+
190
+ #### 3. Create Config File
176
191
  Create ``weweb.config.js`` in your project root:
177
192
  ```javascript
178
193
  export default {
@@ -199,18 +214,11 @@ export default {
199
214
  ]
200
215
  };
201
216
  ```
202
- #### 3. Run the Generator
217
+ #### 4. Run the Generator
203
218
  ```bash
204
219
  # One-time generation
205
- npx weweb-dynamic-metadata
220
+ npx @mel000000/weweb-dynamic-metadata
206
221
 
207
- # Add to your package.json scripts
208
- {
209
- "scripts": {
210
- "build:metadata": "weweb-dynamic-metadata",
211
- "build": "weweb export && weweb-dynamic-metadata"
212
- }
213
- }
214
222
  ```
215
223
 
216
224
  ## How It Works
@@ -268,7 +276,7 @@ flowchart TD
268
276
 
269
277
  subgraph Build ["🔵 Build Time - Metadata Generation"]
270
278
  direction TB
271
- E["Run: npx weweb-dynamic-metadata"] --> F
279
+ E["Run: npx @mel000000/weweb-dynamic-metadata"] --> F
272
280
  F["Read weweb.config.js"] --> G
273
281
  G["Validate configuration"] --> I["For each dynamic route:<br/>e.g., /article/:id"]
274
282
 
@@ -328,7 +336,7 @@ dist/ (or your build folder)
328
336
  │ └── index.html # Same for ALL articles!
329
337
  ├── assets/
330
338
  ├── index.html
331
- └── ... # Sitemap
339
+ └── ...
332
340
  ```
333
341
 
334
342
  **The Problem**: Every article at `/your-page-name/1`, `/your-page-name/2`, etc. serves the EXACT same HTML file with identical metadata.
@@ -376,10 +384,26 @@ After running, you'll get a JSON summary:
376
384
  "duration": "2.34"
377
385
  }
378
386
  ```
387
+ and an overview in the console:
388
+ ```text
389
+ [dotenv@17.3.1] injecting env (2) from .env -- tip: 🛡️ auth for agents: https://vestauth.com
390
+ 🚀 WeWeb Dynamic Metadata Generator
391
+
392
+ ⏭️ Metadata injector already present in: article\_param\index.html
393
+ 🧹 Found 2 duplicate injectors, cleaning up...
394
+
395
+ ╔════════════════════════════════════════════════╗
396
+ ║🎉 GENERATION COMPLETE ║
397
+ ╟────────────────────────────────────────────────╢
398
+ ║ ⏱️ Duration: 1.31s ║
399
+ ║ 📊 Total entries: 9 ║
400
+ ║ 📁 Output: article ║
401
+ ╚════════════════════════════════════════════════╝
402
+ ```
379
403
  ## Programmatic Usage
380
404
 
381
405
  ```javascript
382
- import { processFiles } from 'weweb-dynamic-metadata';
406
+ import { processFiles } from '@mel000000/weweb-dynamic-metadata';
383
407
 
384
408
  const result = await processFiles();
385
409
  console.log(`Generated ${result.totalMetadataEntries} metadata entries`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mel000000/weweb-dynamic-metadata",
3
- "version": "1.0.1",
3
+ "version": "1.0.7",
4
4
  "type": "module",
5
5
  "description": "Generate dynamic metadata for WeWeb static exports",
6
6
  "main": "src/index.js",