@plutocms/supabase 0.14.0 → 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 +23 -0
- package/modules/pluto-migrations.ts +24 -71
- package/package.json +3 -3
- package/shared/types/migrations.d.ts +3 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,28 @@
|
|
|
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
|
+
|
|
19
|
+
## [0.14.1](https://github.com/plutocms/supabase/compare/v0.14.0...v0.14.1) (2026-10-27)
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
### Bug Fixes
|
|
23
|
+
|
|
24
|
+
* **deps:** use @plutocms/pluto 0.28 ([#106](https://github.com/plutocms/supabase/issues/106)) ([a2cb3f2](https://github.com/plutocms/supabase/commit/a2cb3f284dc7cfd5585a76d1c6bfa7616c4fd994))
|
|
25
|
+
|
|
3
26
|
## [0.14.0](https://github.com/plutocms/supabase/compare/v0.13.0...v0.14.0) (2026-10-27)
|
|
4
27
|
|
|
5
28
|
|
|
@@ -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,
|
|
70
|
-
const content = readFileSync(join(dir,
|
|
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`
|
|
82
|
-
*
|
|
83
|
-
*
|
|
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
|
|
158
|
+
let fileNames: string[] = []
|
|
198
159
|
try {
|
|
199
|
-
|
|
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
|
-
|
|
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
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
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.
|
|
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.
|
|
43
|
-
"@plutocms/utils": "^0.
|
|
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,
|
|
5
|
-
*
|
|
6
|
-
*
|
|
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
|