Skip to content

Commit 4cbcb1a

Browse files
committed
feet: update deploy script
1 parent 67efb89 commit 4cbcb1a

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

packages/velog-prisma/scripts/deploy.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,7 @@ function getMessage(migrationDiff: string[]): string {
5757
const question = `🤔 Are you sure?`
5858
return [
5959
title,
60-
...migrationDiff.map((filename) => ` - ${filename}\n\n${getMigrationSummary(filename)}`),
61-
'',
60+
...migrationDiff.map((filename) => ` - ${filename}\n${getMigrationSummary(filename)}`),
6261
question,
6362
].join('\n')
6463
}
@@ -72,10 +71,12 @@ function getMigrationSummary(filename: string) {
7271
)
7372

7473
const sql = fs.readFileSync(filepath, { encoding: 'utf-8' })
74+
const lines = sql.split('\n')
75+
7576
const target = ['ALTER', 'CREATE', 'DROP']
76-
return sql
77-
.split('\n')
77+
return lines
7878
.filter((line) => target.some((str) => line.includes(str)))
7979
.map((v) => ` - ${v.replace(/[{}\[\]()<>;]+/g, '').toLowerCase()}`)
80+
.map((v, i, arr) => (i === arr.length - 1 ? `${v}\n` : v))
8081
.join('\n')
8182
}

0 commit comments

Comments
 (0)