@stacksjs/actions 0.59.11 → 0.61.1

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.
Files changed (163) hide show
  1. package/dist/add.js +29 -0
  2. package/dist/build/component-libs.js +9 -0
  3. package/dist/build/core.js +21 -0
  4. package/dist/build/stacks.js +8 -0
  5. package/dist/build.js +317 -0
  6. package/dist/bump.js +16 -0
  7. package/dist/changelog.js +17 -0
  8. package/dist/clean.js +6 -0
  9. package/dist/commit.js +17 -0
  10. package/dist/copy-types.js +14 -0
  11. package/dist/database/seed.js +8 -0
  12. package/dist/deploy/index.js +31 -0
  13. package/dist/dev/components.js +11 -0
  14. package/dist/dev/docs.js +7 -0
  15. package/dist/dev/index.js +112 -0
  16. package/dist/examples.js +43 -0
  17. package/dist/fresh.js +19 -0
  18. package/dist/generate/component-meta.js +59 -0
  19. package/dist/generate/ide-helpers.js +96 -0
  20. package/dist/generate/index.js +251 -0
  21. package/dist/generate/lib-entries.js +175 -0
  22. package/dist/generate/vscode-custom-data.js +96 -0
  23. package/dist/helpers/component-meta.js +50 -0
  24. package/dist/helpers/lib-entries.js +166 -0
  25. package/dist/helpers/package-json.js +146 -0
  26. package/dist/helpers/utils.js +67 -0
  27. package/dist/helpers/vscode-custom-data.js +88 -0
  28. package/dist/index.js +676 -0
  29. package/dist/key-generate.js +10 -0
  30. package/dist/lint/fix.js +12 -0
  31. package/dist/lint/index.js +16 -0
  32. package/dist/make.js +319 -0
  33. package/dist/prepublish.js +17 -0
  34. package/dist/release.js +646 -0
  35. package/dist/test/coverage.js +9 -0
  36. package/dist/test/feature.js +9 -0
  37. package/dist/test/ui.js +6 -0
  38. package/dist/test/unit.js +6 -0
  39. package/dist/test.js +6 -0
  40. package/dist/typecheck.js +6 -0
  41. package/dist/types.js +21 -0
  42. package/dist/upgrade/dependencies.js +6 -0
  43. package/dist/upgrade/framework.js +1 -0
  44. package/dist/upgrade/index.js +78 -0
  45. package/dist/upgrade.js +46 -0
  46. package/package.json +5 -5
  47. package/src/action.ts +1 -0
  48. package/src/actions.ts +2 -2
  49. package/src/add.ts +3 -6
  50. package/src/ai/request-model-access.ts +10 -7
  51. package/src/build/component-libs.ts +5 -2
  52. package/src/build/core.ts +1 -2
  53. package/src/build/stacks.ts +8 -5
  54. package/src/build.ts +11 -25
  55. package/src/bump.ts +0 -2
  56. package/src/check/ports.ts +2 -3
  57. package/src/commit.ts +2 -2
  58. package/src/copy-types.ts +1 -1
  59. package/src/database/seed.ts +8 -4
  60. package/src/deploy/create-receipt-rule.ts +3 -7
  61. package/src/deploy/index.ts +2 -1
  62. package/src/dev/api.ts +4 -4
  63. package/src/dev/components.ts +3 -5
  64. package/src/dev/index.ts +2 -2
  65. package/src/domains/add.ts +8 -6
  66. package/src/domains/purchase.ts +26 -24
  67. package/src/domains/remove.ts +5 -7
  68. package/src/examples.ts +9 -13
  69. package/src/find-projects.ts +4 -6
  70. package/src/fresh.ts +2 -1
  71. package/src/generate/action-types.ts +5 -7
  72. package/src/generate/component-meta.ts +2 -5
  73. package/src/generate/custom-cli-file.ts +4 -3
  74. package/src/generate/env-files.ts +38 -43
  75. package/src/generate/ide-helpers.ts +1 -2
  76. package/src/generate/index.ts +16 -40
  77. package/src/generate/lib-entries.ts +4 -7
  78. package/src/generate/pkgx-file.ts +6 -11
  79. package/src/generate/vscode-custom-data.ts +1 -3
  80. package/src/helpers/component-meta.ts +6 -11
  81. package/src/helpers/index.ts +5 -0
  82. package/src/helpers/lib-entries.ts +30 -25
  83. package/src/helpers/package-json.ts +13 -16
  84. package/src/helpers/utils.ts +56 -13
  85. package/src/helpers/vscode-custom-data.ts +1 -2
  86. package/src/index.ts +2 -1
  87. package/src/key-generate.ts +3 -4
  88. package/src/lint/fix.ts +10 -2
  89. package/src/lint/index.ts +6 -8
  90. package/src/make.ts +79 -77
  91. package/src/migrate/database.ts +22 -1
  92. package/src/migrate/fresh.ts +20 -0
  93. package/src/orm/base.ts +0 -0
  94. package/src/orm/generate-model.ts +1177 -0
  95. package/src/{generate/model-classes.ts → orm/user.ts} +33 -48
  96. package/src/prepublish.ts +5 -2
  97. package/src/release.ts +15 -11
  98. package/src/test/coverage.ts +5 -2
  99. package/src/test/feature.ts +5 -2
  100. package/src/test/ui.ts +1 -1
  101. package/src/test/unit.ts +1 -1
  102. package/src/test.ts +1 -1
  103. package/src/typecheck.ts +1 -1
  104. package/src/types.ts +2 -2
  105. package/src/upgrade/binary.ts +3 -5
  106. package/src/upgrade/index.ts +4 -8
  107. package/src/upgrade/shell.ts +10 -10
  108. package/src/upgrade.ts +28 -25
  109. package/dist/action.d.ts +0 -36
  110. package/dist/add.d.ts +0 -6
  111. package/dist/build/component-libs.d.ts +0 -1
  112. package/dist/build/core.d.ts +0 -1
  113. package/dist/build/stacks.d.ts +0 -1
  114. package/dist/build.d.ts +0 -9
  115. package/dist/bump.d.ts +0 -1
  116. package/dist/changelog.d.ts +0 -1
  117. package/dist/clean.d.ts +0 -1
  118. package/dist/commit.d.ts +0 -3
  119. package/dist/copy-types.d.ts +0 -5
  120. package/dist/database/seed.d.ts +0 -1
  121. package/dist/deploy/index.d.ts +0 -1
  122. package/dist/dev/components.d.ts +0 -1
  123. package/dist/dev/docs.d.ts +0 -1
  124. package/dist/dev/index.d.ts +0 -10
  125. package/dist/examples.d.ts +0 -5
  126. package/dist/fresh.d.ts +0 -1
  127. package/dist/generate/component-meta.d.ts +0 -5
  128. package/dist/generate/ide-helpers.d.ts +0 -6
  129. package/dist/generate/index.d.ts +0 -13
  130. package/dist/generate/lib-entries.d.ts +0 -2
  131. package/dist/generate/vscode-custom-data.d.ts +0 -6
  132. package/dist/helpers/component-meta.d.ts +0 -22
  133. package/dist/helpers/lib-entries.d.ts +0 -13
  134. package/dist/helpers/package-json.d.ts +0 -3
  135. package/dist/helpers/utils.d.ts +0 -18
  136. package/dist/helpers/vscode-custom-data.d.ts +0 -2
  137. package/dist/index.d.ts +0 -7
  138. package/dist/key-generate.d.ts +0 -1
  139. package/dist/lint/fix.d.ts +0 -1
  140. package/dist/lint/index.d.ts +0 -1
  141. package/dist/make.d.ts +0 -20
  142. package/dist/prepublish.d.ts +0 -1
  143. package/dist/release.d.ts +0 -2
  144. package/dist/test/coverage.d.ts +0 -1
  145. package/dist/test/feature.d.ts +0 -1
  146. package/dist/test/ui.d.ts +0 -1
  147. package/dist/test/unit.d.ts +0 -1
  148. package/dist/test.d.ts +0 -1
  149. package/dist/tinker.d.ts +0 -1
  150. package/dist/typecheck.d.ts +0 -1
  151. package/dist/types.d.ts +0 -3
  152. package/dist/upgrade/dependencies.d.ts +0 -1
  153. package/dist/upgrade/framework.d.ts +0 -1
  154. package/dist/upgrade/index.d.ts +0 -1
  155. package/dist/upgrade.d.ts +0 -4
  156. package/src/database/fields.ts +0 -111
  157. package/src/database/migration-mysql.ts +0 -72
  158. package/src/database/migration-sqlite.ts +0 -67
  159. package/src/database/migration.ts +0 -10
  160. package/src/database/user-migration.ts +0 -20
  161. package/src/generate/model-generate.ts +0 -12
  162. package/src/migrate/dns.ts +0 -3
  163. package/src/tinker.ts +0 -10
@@ -1,2 +0,0 @@
1
- #!/usr/bin/env bun
2
- export {};
@@ -1,6 +0,0 @@
1
- #!/usr/bin/env bun
2
- /**
3
- * This action generates the web-types.json & custom-elements.json
4
- * files for the components.
5
- */
6
- export {};
@@ -1,22 +0,0 @@
1
- import { type ComponentMeta } from 'vue-component-meta';
2
- /**
3
- * ℹ️ Useful Links
4
- *
5
- * vue-component-meta tests: https://github.com/johnsoncodehk/volar/blob/master/vue-language-tools/vue-component-meta/tests/index.spec.ts
6
- * Discord thread about improving vue-component-meta: https://discord.com/channels/793943652350427136/1027819645677350912
7
- * GitHub issue for improving vue-component-meta based on runtime/dynamic props: https://github.com/johnsoncodehk/volar/issues/1854
8
- * Discord chat: https://discord.com/channels/793943652350427136/1027819645677350912
9
- * original script: https://raw.githubusercontent.com/jd-solanki/anu/main/scripts/gen-component-meta.ts
10
- */
11
- export declare function generateComponentMeta(): void;
12
- export interface ComponentApiProps {
13
- name: ComponentMeta['props'][number]['name'];
14
- description: ComponentMeta['props'][number]['description'];
15
- type: ComponentMeta['props'][number]['type'];
16
- default: ComponentMeta['props'][number]['default'];
17
- }
18
- export interface ComponentApi {
19
- props: ComponentApiProps[];
20
- events: ComponentMeta['events'];
21
- slots: ComponentMeta['slots'];
22
- }
@@ -1,13 +0,0 @@
1
- import type { LibraryType } from '@stacksjs/path';
2
- /**
3
- * Based on the config values, this method
4
- * will generate the library entry points.
5
- *
6
- * @param type LibraryType
7
- */
8
- export declare function generateLibEntry(type: LibraryType): Promise<void>;
9
- export declare function createLibraryEntryPoint(type: LibraryType): Promise<void>;
10
- export declare function createVueLibraryEntryPoint(type?: LibraryType): Promise<void>;
11
- export declare function createWebComponentLibraryEntryPoint(type?: LibraryType): Promise<void>;
12
- export declare function createFunctionLibraryEntryPoint(type?: LibraryType): Promise<void>;
13
- export declare function generateEntryPointData(type: LibraryType): string;
@@ -1,3 +0,0 @@
1
- type PackageJsonType = 'vue-components' | 'web-components' | 'functions';
2
- export declare function generatePackageJson(type: PackageJsonType): Promise<void>;
3
- export {};
@@ -1,18 +0,0 @@
1
- import type { ActionOptions } from '@stacksjs/types';
2
- /**
3
- * Run an Action the Stacks way.
4
- *
5
- * @param action The action to invoke.
6
- * @param options The options to pass to the command.
7
- * @returns The result of the command.
8
- */
9
- export declare function runAction(action: string, options?: ActionOptions): Promise<any>;
10
- /**
11
- * Run Actions the Stacks way.
12
- *
13
- * @param actions The actions to invoke.
14
- * @param options The options to pass to the command.
15
- * @returns The result of the command.
16
- */
17
- export declare function runActions(actions: string[], options?: ActionOptions): Promise<any>;
18
- export declare function hasAction(action: string): any;
@@ -1,2 +0,0 @@
1
- export declare function generateVsCodeCustomData(): Promise<void>;
2
- export declare function generateWebTypes(): Promise<void>;
package/dist/index.d.ts DELETED
@@ -1,7 +0,0 @@
1
- export * from './action';
2
- export * from './dev';
3
- export * from './generate';
4
- export * from './helpers/utils';
5
- export { commit as runCommit } from './commit';
6
- export { add as runAdd } from './add';
7
- export { make as runMake, makeComponent, makeDatabase, makeFunction, makeLanguage, makeNotification, makePage, makeStack, createComponent, createDatabase, createFactory, createFunction, createLanguage, createMigration, createModel, createNotification, createPage, } from './make';
@@ -1 +0,0 @@
1
- export {};
@@ -1 +0,0 @@
1
- export {};
@@ -1 +0,0 @@
1
- export {};
package/dist/make.d.ts DELETED
@@ -1,20 +0,0 @@
1
- import type { MakeOptions } from '@stacksjs/types';
2
- export declare function invoke(options: MakeOptions): Promise<void>;
3
- export declare function make(options: MakeOptions): Promise<void>;
4
- export declare function makeComponent(options: MakeOptions): Promise<void>;
5
- export declare function createComponent(options: MakeOptions): Promise<void>;
6
- export declare function makeDatabase(options: MakeOptions): void;
7
- export declare function createDatabase(options: MakeOptions): void;
8
- export declare function factory(options: MakeOptions): void;
9
- export declare function createFactory(options: MakeOptions): void;
10
- export declare function makeNotification(options: MakeOptions): Promise<void>;
11
- export declare function makePage(options: MakeOptions): Promise<void>;
12
- export declare function createPage(options: MakeOptions): Promise<void>;
13
- export declare function makeFunction(options: MakeOptions): Promise<void>;
14
- export declare function createFunction(options: MakeOptions): Promise<void>;
15
- export declare function makeLanguage(options: MakeOptions): Promise<void>;
16
- export declare function createLanguage(options: MakeOptions): Promise<void>;
17
- export declare function makeStack(options: MakeOptions): void;
18
- export declare function createNotification(options: MakeOptions): Promise<boolean>;
19
- export declare function createMigration(options: MakeOptions): Promise<void>;
20
- export declare function createModel(options: MakeOptions): Promise<void>;
@@ -1 +0,0 @@
1
- export {};
package/dist/release.d.ts DELETED
@@ -1,2 +0,0 @@
1
- #!/usr/bin/env bun
2
- export {};
@@ -1 +0,0 @@
1
- export {};
@@ -1 +0,0 @@
1
- export {};
package/dist/test/ui.d.ts DELETED
@@ -1 +0,0 @@
1
- export {};
@@ -1 +0,0 @@
1
- export {};
package/dist/test.d.ts DELETED
@@ -1 +0,0 @@
1
- export {};
package/dist/tinker.d.ts DELETED
@@ -1 +0,0 @@
1
- export {};
@@ -1 +0,0 @@
1
- export {};
package/dist/types.d.ts DELETED
@@ -1,3 +0,0 @@
1
- import type { TypesOptions } from '@stacksjs/types';
2
- export declare function invoke(options?: TypesOptions): Promise<void>;
3
- export declare function types(options: TypesOptions): Promise<void>;
@@ -1 +0,0 @@
1
- export {};
@@ -1 +0,0 @@
1
- export {};
@@ -1 +0,0 @@
1
- export {};
package/dist/upgrade.d.ts DELETED
@@ -1,4 +0,0 @@
1
- import type { UpgradeOptions } from '@stacksjs/types';
2
- export declare function checkForUncommittedChanges(options: UpgradeOptions): void;
3
- export declare function downloadFrameworkUpdate(options: UpgradeOptions): Promise<void>;
4
- export declare function updateDependencies(): Promise<void>;
@@ -1,111 +0,0 @@
1
- import User from '../../../../../../app/Models/User'
2
-
3
- const fields = User.fields // Assuming you have a specific type for fields
4
-
5
- export interface ModelElement {
6
- field: string
7
- default: string | number | boolean | Date | undefined | null
8
- unique: boolean
9
- fieldArray: FieldArrayElement[]
10
- }
11
-
12
- export interface FieldArrayElement {
13
- entity: string
14
- charValue?: string | null
15
- // Add other properties as needed
16
- }
17
- const rules: string[] = []
18
-
19
- async function extractModelRule() {
20
- const modelFile = Bun.file('../../../../../app/Models/User.ts') // Assuming Bun is imported properly
21
-
22
- const code = await modelFile.text()
23
-
24
- const regex = /rule:.*$/gm
25
-
26
- let match: RegExpExecArray | null
27
- match = regex.exec(code)
28
- while (match !== null) {
29
- rules.push(match[0])
30
- match = regex.exec(code)
31
- }
32
- }
33
-
34
- await extractModelRule()
35
-
36
- const fieldKeys = Object.keys(fields)
37
-
38
- const input: ModelElement[] = fieldKeys.map((field, index) => {
39
- const fieldExist = fields[field]
40
- let defaultValue = null
41
- let uniqueValue = false
42
-
43
- if (fieldExist) {
44
- defaultValue = fieldExist?.default || null
45
- uniqueValue = fieldExist?.unique || false
46
- }
47
-
48
- return {
49
- field,
50
- default: defaultValue,
51
- unique: uniqueValue,
52
- fieldArray: parseRule(rules[index]),
53
- }
54
- })
55
-
56
- function parseRule(rule: string): FieldArrayElement[] {
57
- const parts = rule.split('rule: validator.')
58
-
59
- if (parts.length !== 2)
60
- return []
61
-
62
- if (!parts[1])
63
- parts[1] = ''
64
-
65
- const extractedString = parts[1].replace(/,/g, '')
66
-
67
- if (!extractedString)
68
- return []
69
-
70
- const extractedParts = extractedString.split('.')
71
- const regex = /\(([^)]+)\)/
72
-
73
- return extractedParts.map((input) => {
74
- const match = regex.exec(input)
75
- const value = match ? match[1] : null
76
- const field = input.replace(regex, '').replace(/\(|\)/g, '')
77
- return { entity: field, charValue: value }
78
- })
79
- }
80
-
81
- const modelEntity: ModelElement[] = input
82
-
83
- // You can now use the modelEntity array with type safety.
84
-
85
- const fieldAssociation: { [key: string]: { [key: string]: string } } = {
86
- mysql: {
87
- string: 'varchar',
88
- enum: 'varchar',
89
- number: 'integer',
90
- boolean: 'boolean',
91
- text: 'text',
92
- },
93
- sqlite: {
94
- string: 'text',
95
- enum: 'text',
96
- number: 'integer',
97
- boolean: 'boolean',
98
- text: 'text',
99
- },
100
- }
101
-
102
- const fieldEntity = [
103
- 'maxLength',
104
- ]
105
-
106
- const excludeFieldEntity = [
107
- 'minLength',
108
- 'enum',
109
- ]
110
-
111
- export { fieldEntity, fieldAssociation, modelEntity, excludeFieldEntity }
@@ -1,72 +0,0 @@
1
- import User from '../../../../../../app/Models/User'
2
- import { fieldAssociation, fieldEntity, modelEntity } from './fields'
3
-
4
- const file = Bun.file('user-migration.ts')
5
-
6
- const driver = 'mysql'
7
-
8
- const writer = file.writer()
9
-
10
- writer.write('import { Kysely, sql } from \'kysely\'\n')
11
- writer.write('import { db } from \'@stacksjs/database\'\n')
12
- writer.write('\n')
13
- writer.write('export async function up(db: Kysely<any>): Promise<void> {\n')
14
-
15
- writer.write(' await db.schema\n')
16
- writer.write(` .createTable('${User.table}')\n`)
17
-
18
- writer.write(' .addColumn(\'id\', \'integer\', (col) => col.primaryKey())\n')
19
-
20
- for (let modelIndex = 0; modelIndex < modelEntity.length; modelIndex++) {
21
- const modelElement = modelEntity[modelIndex]
22
-
23
- if (!modelElement)
24
- continue
25
-
26
- let entity = ''
27
- let characteristic = ''
28
-
29
- const isNullablePresent = modelElement.fieldArray.some(item => item.entity === 'nullable')
30
-
31
- if (modelElement.default)
32
- characteristic += `.defaultTo('${modelElement.default.toString()}')`
33
-
34
- if (modelElement.unique)
35
- characteristic += '.unique()'
36
-
37
- if (!isNullablePresent)
38
- characteristic += '.notNull()'
39
-
40
- for (let fieldIndex = 0; fieldIndex < modelElement.fieldArray.length; fieldIndex++) {
41
- const fieldArrayElement = modelElement.fieldArray[fieldIndex]
42
-
43
- if (!fieldArrayElement)
44
- continue
45
-
46
- if (!fieldAssociation[driver])
47
- continue
48
-
49
- if (fieldAssociation[driver][fieldArrayElement.entity])
50
- entity += `${fieldAssociation[driver][fieldArrayElement.entity]}`
51
-
52
- fieldEntity.forEach((entityField) => {
53
- if (fieldArrayElement.entity === entityField)
54
- entity += `(${fieldArrayElement.charValue})`
55
- })
56
-
57
- const isMaxLengthPresent = modelElement.fieldArray.some(item => item.entity === 'maxLength')
58
-
59
- if (fieldAssociation[driver][fieldArrayElement.entity] === 'varchar' && !isMaxLengthPresent)
60
- entity += '(255)'
61
- }
62
-
63
- writer.write(` .addColumn('${modelElement.field}', '${entity}', (col) => col${characteristic})\n`)
64
- }
65
-
66
- writer.write(' .addColumn(\'created_at\', \'timestamp\', (col) => col.defaultTo(sql`now()`).notNull())\n')
67
- writer.write(' .execute()\n')
68
- writer.write('}\n\n')
69
-
70
- writer.write('process.exit(0)\n')
71
-
72
- await writer.end()
@@ -1,67 +0,0 @@
1
- // import { generateMigrationFile } from '@stacksjs/database'
2
- import User from '../../../../../../app/Models/User'
3
- import { fieldAssociation, modelEntity } from './fields'
4
-
5
- const file = Bun.file('user-migration.ts')
6
- const writer = file.writer()
7
-
8
- const driver = 'sqlite'
9
-
10
- writer.write('import { Kysely, sql } from \'kysely\'\n')
11
- writer.write('import { db } from \'@stacksjs/database\'\n')
12
- writer.write('\n')
13
- writer.write('export async function up(db: Kysely<any>): Promise<void> {\n')
14
-
15
- writer.write(' await db.schema\n')
16
- writer.write(` .createTable('${User.table}')\n`)
17
-
18
- writer.write(' .addColumn(\'id\', \'integer\', (col) => col.primaryKey())\n')
19
-
20
- for (let modelIndex = 0; modelIndex < modelEntity.length; modelIndex++) {
21
- const modelElement = modelEntity[modelIndex]
22
-
23
- if (!modelElement)
24
- continue
25
-
26
- let entity = ''
27
- let characteristic = ''
28
-
29
- const isNullablePresent = modelElement.fieldArray.some(item => item.entity === 'nullable')
30
-
31
- if (modelElement.default)
32
- characteristic += `.defaultTo('${modelElement.default.toString()}')`
33
-
34
- if (modelElement.unique)
35
- characteristic += '.unique()'
36
-
37
- if (!isNullablePresent)
38
- characteristic += '.notNull()'
39
-
40
- for (let fieldIndex = 0; fieldIndex < modelElement.fieldArray.length; fieldIndex++) {
41
- const fieldArrayElement = modelElement.fieldArray[fieldIndex]
42
-
43
- if (!fieldArrayElement)
44
- continue
45
-
46
- if (!fieldAssociation[driver])
47
- continue
48
-
49
- if (fieldAssociation[driver][fieldArrayElement.entity])
50
- entity += `${fieldAssociation[driver][fieldArrayElement.entity]}`
51
-
52
- // fieldEntity.forEach((entityField) => {
53
- // if (fieldArrayElement.entity === entityField)
54
- // entity += `(${fieldArrayElement.charValue})`
55
- // })
56
- }
57
-
58
- writer.write(` .addColumn('${modelElement.field}', '${entity}', (col) => col${characteristic})\n`)
59
- }
60
-
61
- writer.write(' .addColumn(\'created_at\', \'timestamp\', (col) => col.defaultTo(sql`CURRENT_TIMESTAMP`).notNull())\n')
62
- writer.write(' .execute()\n')
63
- writer.write('}\n\n')
64
-
65
- writer.write('process.exit(0)\n')
66
-
67
- await writer.end()
@@ -1,10 +0,0 @@
1
- // import { generateMigrationFile } from '@stacksjs/database'
2
- // import { config } from '@stacksjs/config'
3
-
4
- // const driver = config.database.default
5
- const driver = 'sqlite'
6
-
7
- if (driver === 'sqlite')
8
- await import('./migration-sqlite.js')
9
- else
10
- await import('./migration-mysql.js')
@@ -1,20 +0,0 @@
1
- import process from 'node:process'
2
- import type { Kysely } from 'kysely'
3
- import { sql } from 'kysely'
4
- import { db } from '@stacksjs/database'
5
- import { ExitCode } from '@stacksjs/types'
6
-
7
- export async function up(db: Kysely<any>): Promise<void> {
8
- await db.schema
9
- .createTable('users')
10
- .addColumn('id', 'integer', col => col.primaryKey())
11
- .addColumn('name', 'text', col => col.defaultTo('test').notNull())
12
- .addColumn('email', 'text', col => col.defaultTo('test email').unique().notNull())
13
- .addColumn('password', 'text', col => col.notNull())
14
- .addColumn('created_at', 'timestamp', col => col.defaultTo(sql`CURRENT_TIMESTAMP`).notNull())
15
- .execute()
16
- }
17
-
18
- await up(db)
19
-
20
- process.exit(ExitCode.Success)
@@ -1,12 +0,0 @@
1
- import { path as p } from '@stacksjs/path'
2
-
3
- const modelGenerate = Bun.file('model-classes.ts') // Assuming Bun is imported properly
4
- const file = Bun.file(p.projectStoragePath('framework/orm/UserModel.ts'))
5
-
6
- const code = await modelGenerate.text()
7
-
8
- const writer = file.writer()
9
-
10
- writer.write(code)
11
-
12
- await writer.end()
@@ -1,3 +0,0 @@
1
- import { generateMigrations } from '../generate'
2
-
3
- generateMigrations()
package/src/tinker.ts DELETED
@@ -1,10 +0,0 @@
1
- import { parseArgs } from '@stacksjs/cli'
2
-
3
- const options = parseArgs()
4
-
5
- // eslint-disable-next-line no-console
6
- console.log('options are:', options)
7
-
8
- // await runCommands([
9
- // 'bunx tinker',
10
- // ], { verbose: true })