@plutocms/supabase 0.14.1 → 0.15.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/CHANGELOG.md CHANGED
@@ -1,5 +1,21 @@
1
1
  # Changelog
2
2
 
3
+ ## [0.15.0](https://github.com/plutocms/supabase/compare/v0.14.1...v0.15.0) (2026-10-28)
4
+
5
+
6
+ ### ⚠ BREAKING CHANGES
7
+
8
+ * read migrations only from db/migrations ([#108](https://github.com/plutocms/supabase/issues/108))
9
+
10
+ ### Features
11
+
12
+ * read migrations only from db/migrations ([#108](https://github.com/plutocms/supabase/issues/108)) ([a6c8683](https://github.com/plutocms/supabase/commit/a6c8683ba2f7da04976e87188d6ff6be3ed01503))
13
+
14
+
15
+ ### Bug Fixes
16
+
17
+ * **deps:** use @plutocms/pluto 0.29 and @plutocms/utils 0.3 ([#110](https://github.com/plutocms/supabase/issues/110)) ([21a4549](https://github.com/plutocms/supabase/commit/21a4549ccff024131bc4cf00eedbd9ae07ba4a1d))
18
+
3
19
  ## [0.14.1](https://github.com/plutocms/supabase/compare/v0.14.0...v0.14.1) (2026-10-27)
4
20
 
5
21
 
@@ -4,7 +4,6 @@ import { existsSync, mkdirSync, readdirSync, readFileSync, writeFileSync } from
4
4
  import { basename, dirname, join, relative } from 'node:path'
5
5
  import { createResolver, defineNuxtModule, getLayerDirectories } from 'nuxt/kit'
6
6
 
7
- const schemaPattern = /^schema\.(.+)\.sql$/
8
7
  const noTransactionPattern = /^--\s*pluto:no-transaction\b/
9
8
 
10
9
  /**
@@ -66,8 +65,8 @@ function detectNoTransaction(content: string): boolean {
66
65
  return firstNonBlankLine ? noTransactionPattern.test(firstNonBlankLine) : false
67
66
  }
68
67
 
69
- function readMigrationFile(dir: string, fileName: string, name: string): PlutoMigrationFile {
70
- const content = readFileSync(join(dir, fileName), 'utf-8')
68
+ function readMigrationFile(dir: string, name: string): PlutoMigrationFile {
69
+ const content = readFileSync(join(dir, name), 'utf-8')
71
70
 
72
71
  return {
73
72
  name,
@@ -78,10 +77,9 @@ function readMigrationFile(dir: string, fileName: string, name: string): PlutoMi
78
77
  }
79
78
 
80
79
  /**
81
- * Discovers `db/migrations/*.sql` (or, for a layer not yet converted, the
82
- * legacy `public/schema.sql` / `public/schema.[name].sql`) across all Nuxt
83
- * layers, reads their content at build time, and populates runtimeConfig
84
- * so the migrations engine can apply them at server startup.
80
+ * Discovers `db/migrations/*.sql` across all Nuxt layers, reads their
81
+ * content at build time, and populates runtimeConfig so the migrations
82
+ * engine can apply them at server startup.
85
83
  *
86
84
  * Also seeds the consuming app's shared/types/supabase.ts with a
87
85
  * re-export of this layer's own committed snapshot when the consumer
@@ -153,81 +151,36 @@ export default defineNuxtModule({
153
151
  for (const layer of layerDirs) {
154
152
  const migrationsDir = join(layer.root, 'db/migrations')
155
153
 
156
- if (existsSync(migrationsDir)) {
157
- let fileNames: string[] = []
158
- try {
159
- fileNames = readdirSync(migrationsDir).filter((file) =>
160
- file.endsWith('.sql')
161
- )
162
- } catch {
163
- console.error(
164
- `[pluto-migrations] Failed to read migrations directory: ${migrationsDir}`
165
- )
166
- continue
167
- }
168
-
169
- fileNames.sort(compareFileNames)
170
-
171
- const files: PlutoMigrationFile[] = []
172
- for (const fileName of fileNames) {
173
- try {
174
- files.push(readMigrationFile(migrationsDir, fileName, fileName))
175
- } catch {
176
- console.error(
177
- `[pluto-migrations] Failed to read migration file: ${fileName}`
178
- )
179
- }
180
- }
181
-
182
- assignLayer(deriveLayerKey(layer.root), files)
183
- continue
184
- }
185
-
186
- // Legacy fallback for a layer not yet converted to db/migrations/,
187
- // exactly as before: a single public/schema.sql (always key `core`)
188
- // and/or public/schema.[name].sql (key comes from the file name, not
189
- // package.json — this keeps working for an unconverted layer without
190
- // requiring it to match its package name).
191
- const publicDir = join(layer.root, 'public')
192
-
193
- if (!existsSync(publicDir)) {
154
+ if (!existsSync(migrationsDir)) {
194
155
  continue
195
156
  }
196
157
 
197
- let publicFiles: string[] = []
158
+ let fileNames: string[] = []
198
159
  try {
199
- publicFiles = readdirSync(publicDir)
160
+ fileNames = readdirSync(migrationsDir).filter((file) =>
161
+ file.endsWith('.sql')
162
+ )
200
163
  } catch {
164
+ console.error(
165
+ `[pluto-migrations] Failed to read migrations directory: ${migrationsDir}`
166
+ )
201
167
  continue
202
168
  }
203
169
 
204
- for (const fileName of publicFiles) {
205
- if (fileName === 'schema.sql') {
206
- try {
207
- assignLayer('core', [
208
- readMigrationFile(publicDir, fileName, '001_baseline.sql'),
209
- ])
210
- } catch {
211
- console.error(
212
- `[pluto-migrations] Failed to read schema file: ${fileName}`
213
- )
214
- }
215
- continue
216
- }
170
+ fileNames.sort(compareFileNames)
217
171
 
218
- const match = fileName.match(schemaPattern)
219
- if (match?.[1]) {
220
- try {
221
- assignLayer(match[1], [
222
- readMigrationFile(publicDir, fileName, '001_baseline.sql'),
223
- ])
224
- } catch {
225
- console.error(
226
- `[pluto-migrations] Failed to read schema file: ${fileName}`
227
- )
228
- }
172
+ const files: PlutoMigrationFile[] = []
173
+ for (const fileName of fileNames) {
174
+ try {
175
+ files.push(readMigrationFile(migrationsDir, fileName))
176
+ } catch {
177
+ console.error(
178
+ `[pluto-migrations] Failed to read migration file: ${fileName}`
179
+ )
229
180
  }
230
181
  }
182
+
183
+ assignLayer(deriveLayerKey(layer.root), files)
231
184
  }
232
185
 
233
186
  // Populate runtimeConfig with every layer's ordered migration files.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@plutocms/supabase",
3
3
  "type": "module",
4
- "version": "0.14.1",
4
+ "version": "0.15.0",
5
5
  "trustedDependencies": [
6
6
  "@parcel/watcher",
7
7
  "@plutocms/pluto",
@@ -39,8 +39,8 @@
39
39
  "@nuxt/eslint": "^1.17.0",
40
40
  "@nuxt/ui": "^4.12.0",
41
41
  "@nuxtjs/supabase": "^2.1.0",
42
- "@plutocms/pluto": "^0.28.0",
43
- "@plutocms/utils": "^0.2.1",
42
+ "@plutocms/pluto": "^0.29.0",
43
+ "@plutocms/utils": "^0.3.0",
44
44
  "@supabase/supabase-js": "^2.117.3",
45
45
  "postgres": "^3.4.9",
46
46
  "supabase": "^2.121.0",
@@ -1,10 +1,9 @@
1
1
  /**
2
2
  * A single discovered migration file for one layer.
3
3
  *
4
- * `modules/pluto-migrations.ts` discovers these at build time, either from
5
- * a layer's `db/migrations/` directory, or as a single legacy
6
- * `public/schema.sql` / `public/schema.<name>.sql` file. `server/utils/
7
- * migrations.ts` applies them at runtime.
4
+ * `modules/pluto-migrations.ts` discovers these at build time, from a
5
+ * layer's `db/migrations/` directory. `server/utils/migrations.ts` applies
6
+ * them at runtime.
8
7
  *
9
8
  * Lives under `shared/` so both the Nuxt module (which runs under
10
9
  * `nuxt/kit`, at build time, outside the app/server TS projects) and