@actuate-media/cli 0.4.0 → 0.4.2
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/.turbo/turbo-build.log +1 -1
- package/.turbo/turbo-test.log +21 -10
- package/CHANGELOG.md +34 -0
- package/dist/__tests__/deployment-diagnostics.test.js +40 -0
- package/dist/__tests__/deployment-diagnostics.test.js.map +1 -1
- package/dist/__tests__/init.test.js.map +1 -1
- package/dist/__tests__/schema-fragment.test.js +1 -1
- package/dist/__tests__/schema-fragment.test.js.map +1 -1
- package/dist/__tests__/seed.test.js.map +1 -1
- package/dist/commands/db-init.d.ts +2 -2
- package/dist/commands/db-init.d.ts.map +1 -1
- package/dist/commands/db-init.js +32 -32
- package/dist/commands/db-init.js.map +1 -1
- package/dist/commands/db-status.d.ts +1 -1
- package/dist/commands/db-status.d.ts.map +1 -1
- package/dist/commands/db-status.js +33 -33
- package/dist/commands/db-status.js.map +1 -1
- package/dist/commands/doctor.d.ts +1 -1
- package/dist/commands/doctor.d.ts.map +1 -1
- package/dist/commands/doctor.js +55 -38
- package/dist/commands/doctor.js.map +1 -1
- package/dist/commands/export.d.ts +1 -1
- package/dist/commands/export.d.ts.map +1 -1
- package/dist/commands/export.js +32 -32
- package/dist/commands/export.js.map +1 -1
- package/dist/commands/generate.d.ts +1 -1
- package/dist/commands/generate.d.ts.map +1 -1
- package/dist/commands/generate.js +8 -8
- package/dist/commands/generate.js.map +1 -1
- package/dist/commands/import.d.ts +1 -1
- package/dist/commands/import.d.ts.map +1 -1
- package/dist/commands/import.js +55 -58
- package/dist/commands/import.js.map +1 -1
- package/dist/commands/init.d.ts.map +1 -1
- package/dist/commands/init.js.map +1 -1
- package/dist/commands/migrate.d.ts +1 -1
- package/dist/commands/migrate.d.ts.map +1 -1
- package/dist/commands/migrate.js +18 -24
- package/dist/commands/migrate.js.map +1 -1
- package/dist/commands/seed.d.ts +1 -1
- package/dist/commands/seed.d.ts.map +1 -1
- package/dist/commands/seed.js +156 -157
- package/dist/commands/seed.js.map +1 -1
- package/dist/commands/update-check.d.ts +1 -1
- package/dist/commands/update-check.d.ts.map +1 -1
- package/dist/commands/update-check.js +34 -27
- package/dist/commands/update-check.js.map +1 -1
- package/dist/commands/upgrade.d.ts +1 -1
- package/dist/commands/upgrade.d.ts.map +1 -1
- package/dist/commands/upgrade.js +41 -34
- package/dist/commands/upgrade.js.map +1 -1
- package/dist/deployment/diagnostics.d.ts +2 -0
- package/dist/deployment/diagnostics.d.ts.map +1 -1
- package/dist/deployment/diagnostics.js +50 -1
- package/dist/deployment/diagnostics.js.map +1 -1
- package/dist/index.js +15 -15
- package/dist/index.js.map +1 -1
- package/dist/utils/logger.d.ts.map +1 -1
- package/dist/utils/logger.js +5 -5
- package/dist/utils/logger.js.map +1 -1
- package/package.json +3 -3
- package/src/__tests__/deployment-diagnostics.test.ts +100 -50
- package/src/__tests__/init.test.ts +17 -17
- package/src/__tests__/schema-fragment.test.ts +29 -25
- package/src/__tests__/seed.test.ts +25 -25
- package/src/commands/db-init.ts +59 -59
- package/src/commands/db-status.ts +70 -68
- package/src/commands/doctor.ts +110 -86
- package/src/commands/export.ts +65 -75
- package/src/commands/generate.ts +14 -16
- package/src/commands/import.ts +125 -140
- package/src/commands/init.ts +14 -14
- package/src/commands/migrate.ts +29 -35
- package/src/commands/seed.ts +294 -300
- package/src/commands/update-check.ts +77 -72
- package/src/commands/upgrade.ts +92 -85
- package/src/deployment/diagnostics.ts +124 -61
- package/src/index.ts +30 -30
- package/src/utils/logger.ts +10 -10
package/src/commands/migrate.ts
CHANGED
|
@@ -1,62 +1,56 @@
|
|
|
1
|
-
import { Command } from
|
|
2
|
-
import { execSync, type ExecSyncOptions } from
|
|
3
|
-
import ora from
|
|
4
|
-
import { logger } from
|
|
1
|
+
import { Command } from 'commander'
|
|
2
|
+
import { execSync, type ExecSyncOptions } from 'node:child_process'
|
|
3
|
+
import ora from 'ora'
|
|
4
|
+
import { logger } from '../utils/logger.js'
|
|
5
5
|
|
|
6
|
-
const execOpts: ExecSyncOptions = { stdio:
|
|
6
|
+
const execOpts: ExecSyncOptions = { stdio: 'inherit', cwd: process.cwd() }
|
|
7
7
|
|
|
8
8
|
function runPendingMigrations(): void {
|
|
9
|
-
const spinner = ora(
|
|
9
|
+
const spinner = ora('Running pending migrations…').start()
|
|
10
10
|
try {
|
|
11
|
-
spinner.stop()
|
|
12
|
-
execSync(
|
|
13
|
-
logger.success(
|
|
11
|
+
spinner.stop()
|
|
12
|
+
execSync('npx prisma migrate deploy', execOpts)
|
|
13
|
+
logger.success('All pending migrations applied.')
|
|
14
14
|
} catch {
|
|
15
|
-
spinner.fail(
|
|
16
|
-
process.exitCode = 1
|
|
15
|
+
spinner.fail('Migration run failed.')
|
|
16
|
+
process.exitCode = 1
|
|
17
17
|
}
|
|
18
18
|
}
|
|
19
19
|
|
|
20
20
|
function createMigration(name: string): void {
|
|
21
|
-
const spinner = ora(`Creating migration "${name}"…`).start()
|
|
21
|
+
const spinner = ora(`Creating migration "${name}"…`).start()
|
|
22
22
|
try {
|
|
23
|
-
spinner.stop()
|
|
24
|
-
execSync(`npx prisma migrate dev --name ${name}`, execOpts)
|
|
25
|
-
logger.success(`Migration "${name}" created.`)
|
|
23
|
+
spinner.stop()
|
|
24
|
+
execSync(`npx prisma migrate dev --name ${name}`, execOpts)
|
|
25
|
+
logger.success(`Migration "${name}" created.`)
|
|
26
26
|
} catch {
|
|
27
|
-
spinner.fail(
|
|
28
|
-
process.exitCode = 1
|
|
27
|
+
spinner.fail('Migration creation failed.')
|
|
28
|
+
process.exitCode = 1
|
|
29
29
|
}
|
|
30
30
|
}
|
|
31
31
|
|
|
32
32
|
function showMigrationStatus(): void {
|
|
33
|
-
const spinner = ora(
|
|
33
|
+
const spinner = ora('Checking migration status…').start()
|
|
34
34
|
try {
|
|
35
|
-
spinner.stop()
|
|
36
|
-
execSync(
|
|
35
|
+
spinner.stop()
|
|
36
|
+
execSync('npx prisma migrate status', execOpts)
|
|
37
37
|
} catch {
|
|
38
|
-
spinner.fail(
|
|
39
|
-
process.exitCode = 1
|
|
38
|
+
spinner.fail('Could not retrieve migration status.')
|
|
39
|
+
process.exitCode = 1
|
|
40
40
|
}
|
|
41
41
|
}
|
|
42
42
|
|
|
43
43
|
export function registerMigrateCommand(program: Command): void {
|
|
44
44
|
const migrate = program
|
|
45
|
-
.command(
|
|
46
|
-
.description(
|
|
45
|
+
.command('migrate')
|
|
46
|
+
.description('Database migration utilities powered by Prisma')
|
|
47
47
|
|
|
48
|
-
migrate
|
|
49
|
-
.command("run")
|
|
50
|
-
.description("Apply all pending migrations")
|
|
51
|
-
.action(runPendingMigrations);
|
|
48
|
+
migrate.command('run').description('Apply all pending migrations').action(runPendingMigrations)
|
|
52
49
|
|
|
53
50
|
migrate
|
|
54
|
-
.command(
|
|
55
|
-
.description(
|
|
56
|
-
.action(createMigration)
|
|
51
|
+
.command('create <name>')
|
|
52
|
+
.description('Create a new migration with the given name')
|
|
53
|
+
.action(createMigration)
|
|
57
54
|
|
|
58
|
-
migrate
|
|
59
|
-
.command("status")
|
|
60
|
-
.description("Show current migration status")
|
|
61
|
-
.action(showMigrationStatus);
|
|
55
|
+
migrate.command('status').description('Show current migration status').action(showMigrationStatus)
|
|
62
56
|
}
|