@mel000000/weweb-dynamic-metadata 1.0.7 → 1.0.8
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 +18 -8
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -173,12 +173,23 @@ FOR SELECT
|
|
|
173
173
|
TO anon
|
|
174
174
|
USING (true);
|
|
175
175
|
```
|
|
176
|
-
#### 2.
|
|
176
|
+
#### 2. Get Your Supabase API Key
|
|
177
|
+
In your Supabase dashboard, go to **Project Settings > API Keys**. You'll see two types of keys:
|
|
178
|
+
|
|
179
|
+
| Key Type | Format | When to Use |
|
|
180
|
+
|----------|--------|-------------|
|
|
181
|
+
| **Project URL** | `https://your-project.supabase.co` | Always needed |
|
|
182
|
+
| **anon / publishable key** | `sb_publishable_...` or JWT | Legacy option (being phased out) |
|
|
183
|
+
| **secret key** (recommended) | `sb_secret_...` | ✅ **Recommended for new projects** |
|
|
184
|
+
|
|
185
|
+
> **Note:** Supabase is transitioning away from the legacy anon key. For new projects, use the **secret key** (starts with `sb_secret_...`). If you're using an older project, the anon key will continue working for now, but consider migrating to the new key format.
|
|
186
|
+
|
|
187
|
+
#### 3. Set Up Environment Variables
|
|
177
188
|
Create a ``.env`` file in your project root to store your Supabase credentials securely:
|
|
178
189
|
```.env
|
|
179
190
|
# .env file
|
|
180
191
|
SUPABASE_URL=https://your-project.supabase.co
|
|
181
|
-
|
|
192
|
+
SUPABASE_KEY=your-secret-or-anon-key-here
|
|
182
193
|
```
|
|
183
194
|
⚠️ Important: Never commit your .env file to version control. Add it to your .gitignore:
|
|
184
195
|
```text
|
|
@@ -187,14 +198,14 @@ SUPABASE_ANON_KEY=your-anon-key-here
|
|
|
187
198
|
```
|
|
188
199
|
The package uses dotenv to automatically load these environment variables when you run the generator.
|
|
189
200
|
|
|
190
|
-
####
|
|
201
|
+
#### 4. Create Config File
|
|
191
202
|
Create ``weweb.config.js`` in your project root:
|
|
192
203
|
```javascript
|
|
193
204
|
export default {
|
|
194
205
|
// Your Supabase configuration
|
|
195
206
|
supabase: {
|
|
196
207
|
url: process.env.SUPABASE_URL,
|
|
197
|
-
|
|
208
|
+
apikey: process.env.SUPABASE_KEY // Works with both anon and secret keys
|
|
198
209
|
},
|
|
199
210
|
|
|
200
211
|
// Optional: Specify your build folder (defaults to ./dist)
|
|
@@ -203,8 +214,8 @@ export default {
|
|
|
203
214
|
// Define your dynamic routes
|
|
204
215
|
pages: [
|
|
205
216
|
{
|
|
206
|
-
route: "/
|
|
207
|
-
table: "
|
|
217
|
+
route: "/your-page-name/:id",
|
|
218
|
+
table: "table-view-name", // Your Supabase table name
|
|
208
219
|
metadata: {
|
|
209
220
|
title: "title", // Database field for title
|
|
210
221
|
content: "excerpt", // Database field for description
|
|
@@ -214,13 +225,12 @@ export default {
|
|
|
214
225
|
]
|
|
215
226
|
};
|
|
216
227
|
```
|
|
217
|
-
####
|
|
228
|
+
#### 5. Run the Generator
|
|
218
229
|
```bash
|
|
219
230
|
# One-time generation
|
|
220
231
|
npx @mel000000/weweb-dynamic-metadata
|
|
221
232
|
|
|
222
233
|
```
|
|
223
|
-
|
|
224
234
|
## How It Works
|
|
225
235
|
|
|
226
236
|
### 1. Reads Your Config
|