@gravito/pulse 1.0.0-alpha.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/README.md +81 -0
- package/bin/gravito.mjs +2 -0
- package/dist/index.js +5120 -0
- package/dist/src/index.js +5098 -0
- package/package.json +40 -0
- package/stubs/controller.stub +10 -0
- package/stubs/middleware.stub +6 -0
- package/stubs/migration.stub +19 -0
- package/stubs/model.stub +10 -0
- package/stubs/seeder.stub +11 -0
- package/stubs/tinker-bootstrap.ts +26 -0
package/package.json
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@gravito/pulse",
|
|
3
|
+
"version": "1.0.0-alpha.2",
|
|
4
|
+
"description": "The official CLI for Gravito Galaxy Architecture. Scaffold projects and manage your universe.",
|
|
5
|
+
"bin": {
|
|
6
|
+
"gravito": "bin/gravito.mjs"
|
|
7
|
+
},
|
|
8
|
+
"type": "module",
|
|
9
|
+
"scripts": {
|
|
10
|
+
"build": "bun build ./src/index.ts --outdir ./dist --target bun --external giget --external cac --external @clack/prompts --external picocolors",
|
|
11
|
+
"dev": "bun run ./src/index.ts"
|
|
12
|
+
},
|
|
13
|
+
"files": [
|
|
14
|
+
"dist",
|
|
15
|
+
"bin",
|
|
16
|
+
"stubs",
|
|
17
|
+
"README.md"
|
|
18
|
+
],
|
|
19
|
+
"publishConfig": {
|
|
20
|
+
"access": "public"
|
|
21
|
+
},
|
|
22
|
+
"dependencies": {
|
|
23
|
+
"@clack/prompts": "^0.7.0",
|
|
24
|
+
"cac": "^6.7.14",
|
|
25
|
+
"giget": "^1.2.5",
|
|
26
|
+
"node-fetch-native": "^1.6.7",
|
|
27
|
+
"picocolors": "^1.0.0"
|
|
28
|
+
},
|
|
29
|
+
"peerDependencies": {
|
|
30
|
+
"gravito-core": "1.0.0-beta.2"
|
|
31
|
+
},
|
|
32
|
+
"author": "Carl Lee <carllee0520@gmail.com>",
|
|
33
|
+
"license": "MIT",
|
|
34
|
+
"homepage": "https://github.com/gravito-framework/gravito#readme",
|
|
35
|
+
"repository": {
|
|
36
|
+
"type": "git",
|
|
37
|
+
"url": "git+https://github.com/gravito-framework/gravito.git",
|
|
38
|
+
"directory": "packages/cli"
|
|
39
|
+
}
|
|
40
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { sql } from 'drizzle-orm'
|
|
2
|
+
import type { DBService } from '@gravito/db'
|
|
3
|
+
|
|
4
|
+
export async function up(db: DBService): Promise<void> {
|
|
5
|
+
// TODO: Implement migration
|
|
6
|
+
// Example:
|
|
7
|
+
// await db.raw.execute(sql`
|
|
8
|
+
// CREATE TABLE {{ name }} (
|
|
9
|
+
// id SERIAL PRIMARY KEY,
|
|
10
|
+
// created_at TIMESTAMP DEFAULT NOW()
|
|
11
|
+
// )
|
|
12
|
+
// `)
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export async function down(db: DBService): Promise<void> {
|
|
16
|
+
// TODO: Implement rollback
|
|
17
|
+
// Example:
|
|
18
|
+
// await db.raw.execute(sql`DROP TABLE {{ name }}`)
|
|
19
|
+
}
|
package/stubs/model.stub
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { Model } from '@gravito/atlas'
|
|
2
|
+
|
|
3
|
+
export class {{ Name }} extends Model {
|
|
4
|
+
static table = '{{ name }}s'
|
|
5
|
+
|
|
6
|
+
// Attributes are automatically handled by the ProxyModel
|
|
7
|
+
// You can add custom methods or relationships here:
|
|
8
|
+
// @HasMany(() => OtherModel)
|
|
9
|
+
// others!: OtherModel[]
|
|
10
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { DBService } from '@gravito/db'
|
|
2
|
+
|
|
3
|
+
export default async function seed(db: DBService): Promise<void> {
|
|
4
|
+
// TODO: Implement seeder
|
|
5
|
+
// Example:
|
|
6
|
+
// await db.raw.insert(users).values([
|
|
7
|
+
// { name: 'Admin', email: 'admin@example.com' }
|
|
8
|
+
// ])
|
|
9
|
+
|
|
10
|
+
console.log('{{ Name }}Seeder: Seeding complete')
|
|
11
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
// @ts-expect-error
|
|
2
|
+
const entry = await import(`${process.cwd()}/src/index.ts`)
|
|
3
|
+
const core = entry.default?.core || entry.core
|
|
4
|
+
|
|
5
|
+
if (!core) {
|
|
6
|
+
console.error('Could not find core instance in src/index.ts')
|
|
7
|
+
process.exit(1)
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
// Ensure bootstrapped
|
|
11
|
+
// If the entry file doesn't bootstrap, we might need to.
|
|
12
|
+
// But usually src/index.ts does core.liftoff() which implies generic usage.
|
|
13
|
+
// If we just want the instance, we assume it's initialized but maybe not "started" (listening).
|
|
14
|
+
// Accessing services should be fine if registered.
|
|
15
|
+
|
|
16
|
+
// Expose to global
|
|
17
|
+
Object.assign(globalThis, {
|
|
18
|
+
core,
|
|
19
|
+
container: core.container,
|
|
20
|
+
// Helper to resolve things quickly
|
|
21
|
+
resolve: (key: string) => core.container.make(key),
|
|
22
|
+
make: (key: string) => core.container.make(key),
|
|
23
|
+
})
|
|
24
|
+
|
|
25
|
+
console.log('🌌 Gravito Tinker ready.')
|
|
26
|
+
console.log('Available globals: core, container, make()')
|