spine-framework 0.2.2 → 0.2.4

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.
@@ -99,10 +99,51 @@ async function migrateCommand(options: MigrateOptions): Promise<void> {
99
99
  // Running the whole file as one query string causes pg to abort the entire
100
100
  // batch on the first error, preventing PL/pgSQL EXCEPTION handlers from
101
101
  // catching expected errors like "relation already exists".
102
- const statements = sql
103
- .split(/;\s*$/m)
104
- .map(s => s.trim())
105
- .filter(s => s.length > 0 && !s.startsWith('--'))
102
+ // MUST preserve dollar-quoted blocks ($$ ... $$) which contain semicolons.
103
+ const statements: string[] = []
104
+ let current = ''
105
+ let inDollarQuote = false
106
+ let dollarTag = ''
107
+ let i = 0
108
+ while (i < sql.length) {
109
+ if (!inDollarQuote) {
110
+ // Check for start of dollar quote: $tag$ or $$
111
+ const dollarMatch = sql.slice(i).match(/^(\$[A-Za-z_]*\$)/)
112
+ if (dollarMatch) {
113
+ inDollarQuote = true
114
+ dollarTag = dollarMatch[1]
115
+ current += dollarMatch[1]
116
+ i += dollarMatch[1].length
117
+ continue
118
+ }
119
+ // Check for statement terminator
120
+ if (sql[i] === ';') {
121
+ const stmt = current.trim()
122
+ if (stmt.length > 0 && !stmt.startsWith('--')) {
123
+ statements.push(stmt)
124
+ }
125
+ current = ''
126
+ i++
127
+ continue
128
+ }
129
+ } else {
130
+ // Check for end of dollar quote
131
+ const endTag = dollarTag
132
+ if (sql.slice(i, i + endTag.length) === endTag) {
133
+ inDollarQuote = false
134
+ current += endTag
135
+ i += endTag.length
136
+ continue
137
+ }
138
+ }
139
+ current += sql[i]
140
+ i++
141
+ }
142
+ // Don't forget the last statement
143
+ const last = current.trim()
144
+ if (last.length > 0 && !last.startsWith('--')) {
145
+ statements.push(last)
146
+ }
106
147
 
107
148
  try {
108
149
  for (const stmt of statements) {
@@ -10,7 +10,7 @@ const projectRoot = resolve(pkgRoot, '../..')
10
10
 
11
11
  // Handle no-args case here — before spawning tsx or loading db.ts
12
12
  if (process.argv.length === 2) {
13
- require(resolve(__dirname, 'welcome.js'))
13
+ require(resolve(__dirname, 'welcome.cjs'))
14
14
  process.exit(0)
15
15
  }
16
16
 
@@ -1 +1 @@
1
- {"version":3,"file":"migrate.d.ts","sourceRoot":"","sources":["../../../.framework/cli/commands/migrate.ts"],"names":[],"mappings":"AACA;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AAmHxC,wBAAgB,uBAAuB,CAAC,OAAO,EAAE,OAAO,QAevD"}
1
+ {"version":3,"file":"migrate.d.ts","sourceRoot":"","sources":["../../../.framework/cli/commands/migrate.ts"],"names":[],"mappings":"AACA;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AA4JxC,wBAAgB,uBAAuB,CAAC,OAAO,EAAE,OAAO,QAevD"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "spine-framework",
3
- "version": "0.2.2",
3
+ "version": "0.2.4",
4
4
  "private": false,
5
5
  "description": "Spine — enterprise application framework built on Supabase + Netlify + React",
6
6
  "type": "module",
@@ -26,8 +26,8 @@
26
26
  "node": ">=18.0.0"
27
27
  },
28
28
  "bin": {
29
- "spine-framework": "./bin/spine-framework.js",
30
- "spine": "./bin/spine-framework.js"
29
+ "spine-framework": "./bin/spine-framework.cjs",
30
+ "spine": "./bin/spine-framework.cjs"
31
31
  },
32
32
  "exports": {
33
33
  ".": {
@@ -87,7 +87,7 @@
87
87
  "test:integration": "vitest run .framework/tests/integration",
88
88
  "test:boundary": "bash scripts/boundary-check.sh",
89
89
  "test:custom": "vitest run custom/tests",
90
- "postinstall": "node bin/welcome.js || true",
90
+ "postinstall": "node bin/welcome.cjs || true",
91
91
  "docs": "typedoc --config config/typedoc.json"
92
92
  },
93
93
  "dependencies": {
File without changes