@stacksjs/actions 0.59.10 → 0.61.0
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/dist/add.js +29 -0
- package/dist/build/component-libs.js +9 -0
- package/dist/build/core.js +21 -0
- package/dist/build/stacks.js +8 -0
- package/dist/build.js +317 -0
- package/dist/bump.js +16 -0
- package/dist/changelog.js +17 -0
- package/dist/clean.js +6 -0
- package/dist/commit.js +17 -0
- package/dist/copy-types.js +14 -0
- package/dist/database/seed.js +8 -0
- package/dist/deploy/index.js +31 -0
- package/dist/dev/components.js +11 -0
- package/dist/dev/docs.js +7 -0
- package/dist/dev/index.js +112 -0
- package/dist/examples.js +43 -0
- package/dist/fresh.js +19 -0
- package/dist/generate/component-meta.js +59 -0
- package/dist/generate/ide-helpers.js +96 -0
- package/dist/generate/index.js +251 -0
- package/dist/generate/lib-entries.js +175 -0
- package/dist/generate/vscode-custom-data.js +96 -0
- package/dist/helpers/component-meta.js +50 -0
- package/dist/helpers/lib-entries.js +166 -0
- package/dist/helpers/package-json.js +146 -0
- package/dist/helpers/utils.js +67 -0
- package/dist/helpers/vscode-custom-data.js +88 -0
- package/dist/index.js +676 -0
- package/dist/key-generate.js +10 -0
- package/dist/lint/fix.js +12 -0
- package/dist/lint/index.js +16 -0
- package/dist/make.js +319 -0
- package/dist/prepublish.js +17 -0
- package/dist/release.js +646 -0
- package/dist/test/coverage.js +9 -0
- package/dist/test/feature.js +9 -0
- package/dist/test/ui.js +6 -0
- package/dist/test/unit.js +6 -0
- package/dist/test.js +6 -0
- package/dist/typecheck.js +6 -0
- package/dist/types.js +21 -0
- package/dist/upgrade/dependencies.js +6 -0
- package/dist/upgrade/framework.js +1 -0
- package/dist/upgrade/index.js +78 -0
- package/dist/upgrade.js +46 -0
- package/package.json +5 -5
- package/src/action.ts +1 -0
- package/src/actions.ts +2 -2
- package/src/add.ts +3 -6
- package/src/ai/request-model-access.ts +10 -7
- package/src/build/component-libs.ts +5 -2
- package/src/build/core.ts +1 -2
- package/src/build/stacks.ts +8 -5
- package/src/build.ts +11 -25
- package/src/bump.ts +0 -2
- package/src/check/ports.ts +2 -3
- package/src/commit.ts +2 -2
- package/src/copy-types.ts +1 -1
- package/src/database/seed.ts +8 -4
- package/src/deploy/create-receipt-rule.ts +3 -7
- package/src/deploy/index.ts +2 -1
- package/src/dev/api.ts +4 -4
- package/src/dev/components.ts +3 -5
- package/src/dev/index.ts +2 -2
- package/src/domains/add.ts +8 -6
- package/src/domains/purchase.ts +26 -24
- package/src/domains/remove.ts +5 -7
- package/src/examples.ts +9 -13
- package/src/find-projects.ts +4 -6
- package/src/fresh.ts +2 -1
- package/src/generate/action-types.ts +5 -7
- package/src/generate/component-meta.ts +2 -5
- package/src/generate/custom-cli-file.ts +4 -3
- package/src/generate/env-files.ts +38 -43
- package/src/generate/ide-helpers.ts +1 -2
- package/src/generate/index.ts +16 -40
- package/src/generate/lib-entries.ts +4 -7
- package/src/generate/pkgx-file.ts +6 -11
- package/src/generate/vscode-custom-data.ts +1 -3
- package/src/helpers/component-meta.ts +6 -11
- package/src/helpers/index.ts +5 -0
- package/src/helpers/lib-entries.ts +30 -25
- package/src/helpers/package-json.ts +13 -16
- package/src/helpers/utils.ts +56 -13
- package/src/helpers/vscode-custom-data.ts +1 -2
- package/src/index.ts +2 -1
- package/src/key-generate.ts +3 -4
- package/src/lint/fix.ts +10 -2
- package/src/lint/index.ts +6 -10
- package/src/make.ts +79 -77
- package/src/migrate/database.ts +22 -1
- package/src/migrate/fresh.ts +20 -0
- package/src/orm/base.ts +0 -0
- package/src/orm/generate-model.ts +1177 -0
- package/src/{generate/model-classes.ts → orm/user.ts} +33 -48
- package/src/prepublish.ts +5 -2
- package/src/release.ts +15 -11
- package/src/test/coverage.ts +5 -2
- package/src/test/feature.ts +5 -2
- package/src/test/ui.ts +1 -1
- package/src/test/unit.ts +1 -1
- package/src/test.ts +1 -1
- package/src/typecheck.ts +1 -1
- package/src/types.ts +2 -2
- package/src/upgrade/binary.ts +3 -5
- package/src/upgrade/index.ts +4 -8
- package/src/upgrade/shell.ts +10 -10
- package/src/upgrade.ts +28 -25
- package/dist/action.d.ts +0 -36
- package/dist/add.d.ts +0 -6
- package/dist/build/component-libs.d.ts +0 -1
- package/dist/build/core.d.ts +0 -1
- package/dist/build/stacks.d.ts +0 -1
- package/dist/build.d.ts +0 -9
- package/dist/bump.d.ts +0 -1
- package/dist/changelog.d.ts +0 -1
- package/dist/clean.d.ts +0 -1
- package/dist/commit.d.ts +0 -3
- package/dist/copy-types.d.ts +0 -5
- package/dist/database/seed.d.ts +0 -1
- package/dist/deploy/index.d.ts +0 -1
- package/dist/dev/components.d.ts +0 -1
- package/dist/dev/docs.d.ts +0 -1
- package/dist/dev/index.d.ts +0 -10
- package/dist/examples.d.ts +0 -5
- package/dist/fresh.d.ts +0 -1
- package/dist/generate/component-meta.d.ts +0 -5
- package/dist/generate/ide-helpers.d.ts +0 -6
- package/dist/generate/index.d.ts +0 -13
- package/dist/generate/lib-entries.d.ts +0 -2
- package/dist/generate/vscode-custom-data.d.ts +0 -6
- package/dist/helpers/component-meta.d.ts +0 -22
- package/dist/helpers/lib-entries.d.ts +0 -13
- package/dist/helpers/package-json.d.ts +0 -3
- package/dist/helpers/utils.d.ts +0 -18
- package/dist/helpers/vscode-custom-data.d.ts +0 -2
- package/dist/index.d.ts +0 -7
- package/dist/key-generate.d.ts +0 -1
- package/dist/lint/fix.d.ts +0 -1
- package/dist/lint/index.d.ts +0 -1
- package/dist/make.d.ts +0 -20
- package/dist/prepublish.d.ts +0 -1
- package/dist/release.d.ts +0 -2
- package/dist/test/coverage.d.ts +0 -1
- package/dist/test/feature.d.ts +0 -1
- package/dist/test/ui.d.ts +0 -1
- package/dist/test/unit.d.ts +0 -1
- package/dist/test.d.ts +0 -1
- package/dist/tinker.d.ts +0 -1
- package/dist/typecheck.d.ts +0 -1
- package/dist/types.d.ts +0 -3
- package/dist/upgrade/dependencies.d.ts +0 -1
- package/dist/upgrade/framework.d.ts +0 -1
- package/dist/upgrade/index.d.ts +0 -1
- package/dist/upgrade.d.ts +0 -4
- package/src/database/fields.ts +0 -111
- package/src/database/migration-mysql.ts +0 -72
- package/src/database/migration-sqlite.ts +0 -67
- package/src/database/migration.ts +0 -10
- package/src/database/user-migration.ts +0 -20
- package/src/generate/model-generate.ts +0 -12
- package/src/migrate/dns.ts +0 -3
- package/src/tinker.ts +0 -10
|
@@ -1,7 +1,10 @@
|
|
|
1
|
+
// TODO: this whole file needs to be auto-generated
|
|
2
|
+
// but ultimately, it should be generated to here storage/framework/orm/UserModel.ts
|
|
3
|
+
|
|
1
4
|
import process from 'node:process'
|
|
2
|
-
import { db } from '@stacksjs/database'
|
|
3
5
|
import type { Collection } from '@stacksjs/collections'
|
|
4
6
|
import { collect } from '@stacksjs/collections'
|
|
7
|
+
import { db } from '@stacksjs/database'
|
|
5
8
|
|
|
6
9
|
export interface User {
|
|
7
10
|
id: number
|
|
@@ -24,25 +27,21 @@ export class UserModel {
|
|
|
24
27
|
private useSoftDeletes = true
|
|
25
28
|
private keyName: keyof User = 'id'
|
|
26
29
|
|
|
27
|
-
queryBuilder = db.selectFrom('users')// Initialize queryBuilder
|
|
28
|
-
queryBuilderStore = db.insertInto('users')// Initialize queryBuilder
|
|
29
|
-
queryBuilderUpdate = db.updateTable('users')// Initialize queryBuilder
|
|
30
|
-
queryBuilderDelete = db.deleteFrom('users')// Initialize queryBuilder
|
|
30
|
+
queryBuilder = db.selectFrom('users') // Initialize queryBuilder
|
|
31
|
+
queryBuilderStore = db.insertInto('users') // Initialize queryBuilder
|
|
32
|
+
queryBuilderUpdate = db.updateTable('users') // Initialize queryBuilder
|
|
33
|
+
queryBuilderDelete = db.deleteFrom('users') // Initialize queryBuilder
|
|
31
34
|
|
|
32
35
|
public async find(id: number | number[]): Promise<User | Collection<User>> {
|
|
33
|
-
if (Array.isArray(id))
|
|
34
|
-
return await this.findMany(id)
|
|
36
|
+
if (Array.isArray(id)) return await this.findMany(id)
|
|
35
37
|
|
|
36
|
-
let query = this.queryBuilder.selectAll()
|
|
37
|
-
.where(this.keyName, '=', id)
|
|
38
|
+
let query = this.queryBuilder.selectAll().where(this.keyName, '=', id)
|
|
38
39
|
|
|
39
|
-
if (this.useSoftDeletes)
|
|
40
|
-
query = query.where('deleted_at', 'is', null)
|
|
40
|
+
if (this.useSoftDeletes) query = query.where('deleted_at', 'is', null)
|
|
41
41
|
|
|
42
42
|
this._data = await query.executeTakeFirst()
|
|
43
43
|
|
|
44
|
-
if (!this._data)
|
|
45
|
-
throw new Error('User not found!')
|
|
44
|
+
if (!this._data) throw new Error('User not found!')
|
|
46
45
|
|
|
47
46
|
return this._createProxy()
|
|
48
47
|
}
|
|
@@ -55,13 +54,11 @@ export class UserModel {
|
|
|
55
54
|
return new Proxy(this._data || {}, {
|
|
56
55
|
get: (target: User, prop: UserColumn) => {
|
|
57
56
|
// Property lookup in the User data
|
|
58
|
-
if (prop in target)
|
|
59
|
-
return target[prop]
|
|
57
|
+
if (prop in target) return target[prop]
|
|
60
58
|
|
|
61
59
|
// If it’s a method on the UserModel, bind it
|
|
62
60
|
const method = this[prop as keyof this]
|
|
63
|
-
if (typeof method === 'function')
|
|
64
|
-
return method.bind(this)
|
|
61
|
+
if (typeof method === 'function') return method.bind(this)
|
|
65
62
|
|
|
66
63
|
return undefined
|
|
67
64
|
},
|
|
@@ -69,10 +66,8 @@ export class UserModel {
|
|
|
69
66
|
}
|
|
70
67
|
|
|
71
68
|
public async update(obj: Partial<User>): Promise<User | undefined | Collection<User>> {
|
|
72
|
-
if (this._data
|
|
73
|
-
await this.queryBuilderUpdate.set(obj)
|
|
74
|
-
.where(this.keyName, '=', this._data?.id)
|
|
75
|
-
.executeTakeFirst()
|
|
69
|
+
if (this._data?.id) {
|
|
70
|
+
await this.queryBuilderUpdate.set(obj).where(this.keyName, '=', this._data?.id).executeTakeFirst()
|
|
76
71
|
|
|
77
72
|
return await this.find(this._data?.id)
|
|
78
73
|
}
|
|
@@ -81,16 +76,13 @@ export class UserModel {
|
|
|
81
76
|
}
|
|
82
77
|
|
|
83
78
|
public async all() {
|
|
84
|
-
return await this.queryBuilder.selectAll()
|
|
85
|
-
.execute()
|
|
79
|
+
return await this.queryBuilder.selectAll().execute()
|
|
86
80
|
}
|
|
87
81
|
|
|
88
82
|
public async get(): Promise<Collection<User>> {
|
|
89
|
-
if (this.useSoftDeletes)
|
|
90
|
-
return collect(await this.getSoftDeletes())
|
|
83
|
+
if (this.useSoftDeletes) return collect(await this.getSoftDeletes())
|
|
91
84
|
|
|
92
|
-
if (this._isSelectInvoked)
|
|
93
|
-
return collect(await this.queryBuilder.select(this.cols).execute())
|
|
85
|
+
if (this._isSelectInvoked) return collect(await this.queryBuilder.select(this.cols).execute())
|
|
94
86
|
|
|
95
87
|
return collect(await this.queryBuilder.selectAll().execute())
|
|
96
88
|
}
|
|
@@ -113,16 +105,15 @@ export class UserModel {
|
|
|
113
105
|
if (args.length === 2) {
|
|
114
106
|
const [column, value] = args
|
|
115
107
|
this.queryBuilder = this.queryBuilder.where(column as UserColumn, '=', value)
|
|
108
|
+
} else {
|
|
109
|
+
this.queryBuilder = this.queryBuilder.where(...args)
|
|
116
110
|
}
|
|
117
|
-
else { this.queryBuilder = this.queryBuilder.where(...args) }
|
|
118
111
|
|
|
119
112
|
return this
|
|
120
113
|
}
|
|
121
114
|
|
|
122
115
|
public orWhere(...args: (string | number | boolean)[]): this {
|
|
123
|
-
this.queryBuilder = this.queryBuilder.where(eb => eb.or([
|
|
124
|
-
eb(...args),
|
|
125
|
-
]))
|
|
116
|
+
this.queryBuilder = this.queryBuilder.where((eb) => eb.or([eb(...args)]))
|
|
126
117
|
|
|
127
118
|
return this
|
|
128
119
|
}
|
|
@@ -131,8 +122,9 @@ export class UserModel {
|
|
|
131
122
|
if (args.length === 2) {
|
|
132
123
|
const [column, value] = args
|
|
133
124
|
this.queryBuilder = this.queryBuilder.where(column, 'in', value)
|
|
125
|
+
} else {
|
|
126
|
+
this.queryBuilder = this.queryBuilder.where(...args)
|
|
134
127
|
}
|
|
135
|
-
else { this.queryBuilder = this.queryBuilder.where(...args) }
|
|
136
128
|
|
|
137
129
|
return this
|
|
138
130
|
}
|
|
@@ -144,8 +136,7 @@ export class UserModel {
|
|
|
144
136
|
}
|
|
145
137
|
|
|
146
138
|
public when(condition: boolean, callback: (instance: this) => any): this {
|
|
147
|
-
if (condition)
|
|
148
|
-
callback(this)
|
|
139
|
+
if (condition) callback(this)
|
|
149
140
|
|
|
150
141
|
return this
|
|
151
142
|
}
|
|
@@ -259,39 +250,33 @@ export class UserModel {
|
|
|
259
250
|
|
|
260
251
|
public async first(): Promise<User> {
|
|
261
252
|
// Execute the query using queryBuilder
|
|
262
|
-
if (this._isSelectInvoked)
|
|
263
|
-
|
|
264
|
-
else
|
|
265
|
-
this._data = await this.queryBuilder.selectAll().executeTakeFirst()
|
|
253
|
+
if (this._isSelectInvoked) this._data = await this.queryBuilder.select(this.cols).executeTakeFirst()
|
|
254
|
+
else this._data = await this.queryBuilder.selectAll().executeTakeFirst()
|
|
266
255
|
|
|
267
256
|
return this._createProxy()
|
|
268
257
|
}
|
|
269
258
|
|
|
270
259
|
public store(obj: any[]): User {
|
|
271
260
|
// Execute the query using queryBuilder
|
|
272
|
-
return this.queryBuilderStore.values(obj)
|
|
273
|
-
.executeTakeFirst()
|
|
261
|
+
return this.queryBuilderStore.values(obj).executeTakeFirst()
|
|
274
262
|
}
|
|
275
263
|
|
|
276
264
|
public createMany(obj: any[]): User[] {
|
|
277
265
|
// Execute the query using queryBuilder
|
|
278
|
-
return this.queryBuilderStore.values(obj)
|
|
279
|
-
.executeTakeFirst()
|
|
266
|
+
return this.queryBuilderStore.values(obj).executeTakeFirst()
|
|
280
267
|
}
|
|
281
268
|
|
|
282
269
|
public async delete(): Promise<any> {
|
|
283
|
-
if (this._data
|
|
284
|
-
if (this.useSoftDeletes)
|
|
285
|
-
return await this.update({ deleted_at: new Date() })
|
|
270
|
+
if (this._data?.id) {
|
|
271
|
+
if (this.useSoftDeletes) return await this.update({ deleted_at: new Date() })
|
|
286
272
|
|
|
287
273
|
return this.forceDelete()
|
|
288
274
|
}
|
|
289
275
|
}
|
|
290
276
|
|
|
291
277
|
public forceDelete(): any {
|
|
292
|
-
if (this._data
|
|
293
|
-
return this.queryBuilderDelete.where(this.keyName, '=', this._data?.id)
|
|
294
|
-
.executeTakeFirst()
|
|
278
|
+
if (this._data?.id) {
|
|
279
|
+
return this.queryBuilderDelete.where(this.keyName, '=', this._data?.id).executeTakeFirst()
|
|
295
280
|
}
|
|
296
281
|
}
|
|
297
282
|
}
|
package/src/prepublish.ts
CHANGED
|
@@ -1,13 +1,16 @@
|
|
|
1
1
|
import process from 'node:process'
|
|
2
|
+
import { NpmScript } from '@stacksjs/enums'
|
|
2
3
|
import { log } from '@stacksjs/logging'
|
|
3
4
|
import { runtimePath } from '@stacksjs/path'
|
|
4
5
|
import { runNpmScript } from '@stacksjs/utils'
|
|
5
|
-
import { NpmScript } from '@stacksjs/enums'
|
|
6
6
|
|
|
7
7
|
log.info('Running prepublish command...')
|
|
8
8
|
|
|
9
9
|
// right before we publish, we need to build Stacks
|
|
10
|
-
const result = await runNpmScript(NpmScript.BuildStacks, {
|
|
10
|
+
const result = await runNpmScript(NpmScript.BuildStacks, {
|
|
11
|
+
verbose: true,
|
|
12
|
+
cwd: runtimePath(),
|
|
13
|
+
})
|
|
11
14
|
|
|
12
15
|
if (result.isErr()) {
|
|
13
16
|
log.error(new Error('There was an error while prepublishing your stack'), result.error)
|
package/src/release.ts
CHANGED
|
@@ -1,18 +1,22 @@
|
|
|
1
1
|
#!/usr/bin/env bun
|
|
2
|
-
import {
|
|
2
|
+
import { app } from '@stacksjs/config'
|
|
3
3
|
import { Action } from '@stacksjs/enums'
|
|
4
4
|
import { log } from '@stacksjs/logging'
|
|
5
|
-
import {
|
|
5
|
+
import { projectPath } from '@stacksjs/path'
|
|
6
6
|
import { runActions } from '.'
|
|
7
7
|
|
|
8
|
-
await runActions(
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
8
|
+
await runActions(
|
|
9
|
+
[
|
|
10
|
+
Action.GenerateLibraryEntries, // generates the package/library entry points
|
|
11
|
+
Action.LintFix, // ensure there are no lint errors
|
|
12
|
+
// Action.Test, // run the tests
|
|
13
|
+
Action.Bump, // bump the versions, create the git tag, generate the changelog, commit & push the changes
|
|
14
|
+
],
|
|
15
|
+
{
|
|
16
|
+
// debug mode needs to be enabled to see the output due to the interactive prompts
|
|
17
|
+
cwd: projectPath(),
|
|
18
|
+
stdin: 'inherit',
|
|
19
|
+
},
|
|
20
|
+
)
|
|
17
21
|
|
|
18
22
|
log.success(`Successfully released ${app.name}`)
|
package/src/test/coverage.ts
CHANGED
|
@@ -1,5 +1,8 @@
|
|
|
1
|
-
import { NpmScript } from '@stacksjs/enums'
|
|
2
1
|
import { runCommand } from '@stacksjs/cli'
|
|
2
|
+
import { NpmScript } from '@stacksjs/enums'
|
|
3
3
|
import { frameworkPath } from '@stacksjs/path'
|
|
4
4
|
|
|
5
|
-
await runCommand(NpmScript.TestCoverage, {
|
|
5
|
+
await runCommand(NpmScript.TestCoverage, {
|
|
6
|
+
cwd: frameworkPath(),
|
|
7
|
+
verbose: true,
|
|
8
|
+
})
|
package/src/test/feature.ts
CHANGED
|
@@ -1,5 +1,8 @@
|
|
|
1
|
-
import { NpmScript } from '@stacksjs/enums'
|
|
2
1
|
import { runCommand } from '@stacksjs/cli'
|
|
2
|
+
import { NpmScript } from '@stacksjs/enums'
|
|
3
3
|
import { frameworkPath } from '@stacksjs/path'
|
|
4
4
|
|
|
5
|
-
await runCommand(NpmScript.TestFeature, {
|
|
5
|
+
await runCommand(NpmScript.TestFeature, {
|
|
6
|
+
verbose: true,
|
|
7
|
+
cwd: frameworkPath(),
|
|
8
|
+
})
|
package/src/test/ui.ts
CHANGED
package/src/test/unit.ts
CHANGED
package/src/test.ts
CHANGED
package/src/typecheck.ts
CHANGED
package/src/types.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import process from 'node:process'
|
|
2
|
+
import { NpmScript } from '@stacksjs/enums'
|
|
2
3
|
import { log } from '@stacksjs/logging'
|
|
3
|
-
import { runNpmScript } from '@stacksjs/utils'
|
|
4
4
|
import type { TypesOptions } from '@stacksjs/types'
|
|
5
|
-
import {
|
|
5
|
+
import { runNpmScript } from '@stacksjs/utils'
|
|
6
6
|
|
|
7
7
|
export async function invoke(options?: TypesOptions) {
|
|
8
8
|
const results = await runNpmScript(NpmScript.TypesFix, options)
|
package/src/upgrade/binary.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import process from 'node:process'
|
|
2
|
-
import { path } from '@stacksjs/path'
|
|
3
2
|
import { runCommand } from '@stacksjs/cli'
|
|
4
3
|
import { log } from '@stacksjs/logging'
|
|
4
|
+
import { path } from '@stacksjs/path'
|
|
5
5
|
import { fs, storage } from '@stacksjs/storage'
|
|
6
6
|
|
|
7
7
|
/**
|
|
@@ -33,11 +33,9 @@ if (await storage.exists(source)) {
|
|
|
33
33
|
await fs.move(source, destination, { overwrite: true })
|
|
34
34
|
|
|
35
35
|
log.success('Binary Latest Version Is Used')
|
|
36
|
-
}
|
|
37
|
-
catch (err: any) {
|
|
36
|
+
} catch (err: any) {
|
|
38
37
|
log.error(err)
|
|
39
38
|
}
|
|
40
|
-
}
|
|
41
|
-
else {
|
|
39
|
+
} else {
|
|
42
40
|
log.error(`Binary source not found: ${source}`)
|
|
43
41
|
}
|
package/src/upgrade/index.ts
CHANGED
|
@@ -10,17 +10,13 @@ const options: any = parseArgs()
|
|
|
10
10
|
// if (options?.framework || options?.all)
|
|
11
11
|
// await updateFramework(options)
|
|
12
12
|
|
|
13
|
-
if (options?.dependencies || options?.all)
|
|
14
|
-
await runAction(Action.UpgradeDeps, options)
|
|
13
|
+
if (options?.dependencies || options?.all) await runAction(Action.UpgradeDeps, options)
|
|
15
14
|
|
|
16
|
-
if (options?.bun || options?.all)
|
|
17
|
-
await runAction(Action.UpgradeBun, options)
|
|
15
|
+
if (options?.bun || options?.all) await runAction(Action.UpgradeBun, options)
|
|
18
16
|
|
|
19
|
-
if (options?.shell || options?.all)
|
|
20
|
-
await runAction(Action.UpgradeShell, options)
|
|
17
|
+
if (options?.shell || options?.all) await runAction(Action.UpgradeShell, options)
|
|
21
18
|
|
|
22
|
-
if (options?.binary || options?.all)
|
|
23
|
-
await runAction(Action.UpgradeBinary, options)
|
|
19
|
+
if (options?.binary || options?.all) await runAction(Action.UpgradeBinary, options)
|
|
24
20
|
|
|
25
21
|
process.exit(ExitCode.InvalidArgument)
|
|
26
22
|
|
package/src/upgrade/shell.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import process from 'node:process'
|
|
2
|
-
import {
|
|
3
|
-
import { path as p } from '@stacksjs/path'
|
|
2
|
+
import { italic, runCommand } from '@stacksjs/cli'
|
|
4
3
|
import { log } from '@stacksjs/logging'
|
|
5
|
-
import {
|
|
4
|
+
import { path as p } from '@stacksjs/path'
|
|
6
5
|
import { writeFile } from '@stacksjs/storage'
|
|
7
|
-
import {
|
|
6
|
+
import { ExitCode } from '@stacksjs/types'
|
|
7
|
+
import { $ } from 'bun'
|
|
8
8
|
|
|
9
9
|
const homePath = (await $`echo $HOME`.text()).trim()
|
|
10
10
|
const zshrcPath = p.join(homePath, '.zshrc')
|
|
@@ -23,7 +23,9 @@ if (match) {
|
|
|
23
23
|
// Split the captured group by any whitespace and filter out empty strings
|
|
24
24
|
const plugins = match[1]?.split(/\s+/).filter(Boolean)
|
|
25
25
|
if (!plugins) {
|
|
26
|
-
log.error(
|
|
26
|
+
log.error(
|
|
27
|
+
'Maybe the plugins line in your .zshrc file could not be found? If this continues being an issue, please reach out to us on Discord.',
|
|
28
|
+
)
|
|
27
29
|
process.exit(ExitCode.FatalError)
|
|
28
30
|
}
|
|
29
31
|
|
|
@@ -31,7 +33,7 @@ if (match) {
|
|
|
31
33
|
if (!plugins.includes('buddy')) {
|
|
32
34
|
plugins.push('buddy')
|
|
33
35
|
// Trim each plugin name and ensure it’s formatted correctly
|
|
34
|
-
const formattedPlugins = plugins.map(plugin => plugin.trim()).join('\n ')
|
|
36
|
+
const formattedPlugins = plugins.map((plugin) => plugin.trim()).join('\n ')
|
|
35
37
|
const newPluginLine = `plugins=(\n ${formattedPlugins}\n)`
|
|
36
38
|
// Replace the old plugin line with the new one
|
|
37
39
|
data = data.replace(pluginLineRegex, newPluginLine)
|
|
@@ -47,8 +49,7 @@ if (match) {
|
|
|
47
49
|
// await runCommand(`source ${customPath}/src/buddy.plugin.zsh`)
|
|
48
50
|
|
|
49
51
|
log.success('Copied buddy zsh plugin')
|
|
50
|
-
}
|
|
51
|
-
else {
|
|
52
|
+
} else {
|
|
52
53
|
log.info('Buddy is already set up') // in other words, it is integrated in their shell
|
|
53
54
|
log.info('Ensuring `buddy` is updated...')
|
|
54
55
|
await runCommand(`cp -rf ${pluginPath} ${customPath}`)
|
|
@@ -60,5 +61,4 @@ log.success('Oh My Zsh Setup Complete')
|
|
|
60
61
|
log.info(italic('To see changes reflect, you may need to open a new terminal window'))
|
|
61
62
|
|
|
62
63
|
// if using the vscode terminal, show the message
|
|
63
|
-
if (process.env.TERM_PROGRAM === 'vscode')
|
|
64
|
-
log.info('⌘⇧P terminal.create.new.terminal')
|
|
64
|
+
if (process.env.TERM_PROGRAM === 'vscode') log.info('⌘⇧P terminal.create.new.terminal')
|
package/src/upgrade.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import process from 'node:process'
|
|
2
2
|
import { intro, outro, runCommand } from '@stacksjs/cli'
|
|
3
|
+
import { NpmScript } from '@stacksjs/enums'
|
|
3
4
|
import { log } from '@stacksjs/logging'
|
|
4
5
|
import { projectPath } from '@stacksjs/path'
|
|
5
6
|
import * as storage from '@stacksjs/storage'
|
|
6
|
-
import { NpmScript } from '@stacksjs/enums'
|
|
7
7
|
import type { UpgradeOptions } from '@stacksjs/types'
|
|
8
8
|
import { version } from '../package.json'
|
|
9
9
|
|
|
@@ -13,29 +13,26 @@ import { version } from '../package.json'
|
|
|
13
13
|
export function checkForUncommittedChanges(options: UpgradeOptions) {
|
|
14
14
|
try {
|
|
15
15
|
// const stdio = determineDebugLevel(options) ? 'inherit' : 'ignore'
|
|
16
|
-
|
|
17
16
|
// check if the stacks folder has any updates
|
|
18
17
|
// https://carlosbecker.com/posts/git-changed/
|
|
19
18
|
// await spawn(`git diff --quiet HEAD -- ${path}`, { stdio, cwd: projectPath() })
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
}
|
|
38
|
-
}
|
|
19
|
+
} catch (error: any) {
|
|
20
|
+
// if (error.status === 1) {
|
|
21
|
+
// even though the ./stacks folder should not be edited, instead config values should be adjusted,
|
|
22
|
+
// there is a chance that users may apply local core edits, as it’s totally acceptable, as long as
|
|
23
|
+
// the user knows what they are doing. There is also a change that simply the deps within stacks
|
|
24
|
+
// folder have been updated and that could produce a diff.
|
|
25
|
+
// if (!options?.force) {
|
|
26
|
+
// const confirmed = await log.prompt('We detected there are uncommitted in the ./stacks folder. Do you want to overwrite those?', {
|
|
27
|
+
// type: 'confirm',
|
|
28
|
+
// })
|
|
29
|
+
// if (!confirmed) {
|
|
30
|
+
// log.info('Aborted. Stacks did not update itself.')
|
|
31
|
+
// log.info('Note: if you commit your changes and replay the update, you can see what changed.')
|
|
32
|
+
// process.exit(ExitCode.Success)
|
|
33
|
+
// }
|
|
34
|
+
// }
|
|
35
|
+
// }
|
|
39
36
|
}
|
|
40
37
|
}
|
|
41
38
|
|
|
@@ -43,8 +40,7 @@ export async function downloadFrameworkUpdate(options: UpgradeOptions) {
|
|
|
43
40
|
const tempFolderName = 'updates'
|
|
44
41
|
const tempUpdatePath = projectPath(tempFolderName)
|
|
45
42
|
|
|
46
|
-
if (storage.doesFolderExist(tempUpdatePath))
|
|
47
|
-
await deleteFolder(tempUpdatePath)
|
|
43
|
+
if (storage.doesFolderExist(tempUpdatePath)) await storage.deleteFolder(tempUpdatePath)
|
|
48
44
|
|
|
49
45
|
log.info('Downloading framework updates...')
|
|
50
46
|
await runCommand(`giget stacks ${tempFolderName}`, options)
|
|
@@ -59,10 +55,17 @@ export async function updateDependencies() {
|
|
|
59
55
|
})
|
|
60
56
|
|
|
61
57
|
if (result.isErr()) {
|
|
62
|
-
await outro(
|
|
58
|
+
await outro(
|
|
59
|
+
'While running the upgrade:dependencies command, there was an issue',
|
|
60
|
+
{ startTime: perf, useSeconds: true },
|
|
61
|
+
result.error,
|
|
62
|
+
)
|
|
63
63
|
process.exit()
|
|
64
64
|
}
|
|
65
65
|
|
|
66
|
-
await outro('Freshly updated your dependencies.', {
|
|
66
|
+
await outro('Freshly updated your dependencies.', {
|
|
67
|
+
startTime: perf,
|
|
68
|
+
useSeconds: true,
|
|
69
|
+
})
|
|
67
70
|
process.exit()
|
|
68
71
|
}
|
package/dist/action.d.ts
DELETED
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import type { JobOptions, Nullable } from '@stacksjs/types';
|
|
2
|
-
import type { ValidationBoolean, ValidationNumber, ValidationString } from '@stacksjs/validation';
|
|
3
|
-
type FieldKey = string;
|
|
4
|
-
interface FieldValue {
|
|
5
|
-
rule: ValidationString | ValidationNumber | ValidationBoolean | Date | Nullable<any>;
|
|
6
|
-
message: string;
|
|
7
|
-
factory?: any;
|
|
8
|
-
unique?: boolean;
|
|
9
|
-
}
|
|
10
|
-
interface Request {
|
|
11
|
-
message: string;
|
|
12
|
-
level: 'info' | 'warn' | 'error';
|
|
13
|
-
}
|
|
14
|
-
interface ActionOptions {
|
|
15
|
-
name?: string;
|
|
16
|
-
description?: string;
|
|
17
|
-
fields?: Record<FieldKey, FieldValue>;
|
|
18
|
-
path?: string;
|
|
19
|
-
rate?: JobOptions['rate'];
|
|
20
|
-
tries?: JobOptions['tries'];
|
|
21
|
-
backoff?: JobOptions['backoff'];
|
|
22
|
-
enabled?: JobOptions['enabled'];
|
|
23
|
-
handle: (request?: Request) => Promise<any> | object | string;
|
|
24
|
-
}
|
|
25
|
-
export declare class Action {
|
|
26
|
-
name?: string;
|
|
27
|
-
description?: string;
|
|
28
|
-
fields?: Record<FieldKey, FieldValue>;
|
|
29
|
-
rate?: JobOptions['rate'];
|
|
30
|
-
tries?: JobOptions['tries'];
|
|
31
|
-
backoff?: JobOptions['backoff'];
|
|
32
|
-
enabled?: boolean;
|
|
33
|
-
handle: (request?: Request) => Promise<any> | object | string;
|
|
34
|
-
constructor({ name, description, fields, handle, rate, tries, backoff, enabled }: ActionOptions);
|
|
35
|
-
}
|
|
36
|
-
export {};
|
package/dist/add.d.ts
DELETED
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import type { AddOptions } from '@stacksjs/types';
|
|
2
|
-
export declare function invoke(options: AddOptions): Promise<void>;
|
|
3
|
-
export declare function add(options: AddOptions): Promise<void>;
|
|
4
|
-
export declare function addTable(): Promise<void>;
|
|
5
|
-
export declare function addCalendar(): Promise<void>;
|
|
6
|
-
export declare function installPackages(names: string[]): Promise<void>;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
package/dist/build/core.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
package/dist/build/stacks.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
package/dist/build.d.ts
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import type { BuildOptions } from '@stacksjs/types';
|
|
2
|
-
export declare function invoke(options: BuildOptions): Promise<void>;
|
|
3
|
-
export declare function build(options: BuildOptions): Promise<void>;
|
|
4
|
-
export declare function componentLibraries(options: BuildOptions): Promise<void>;
|
|
5
|
-
export declare function vueComponentLibrary(options: BuildOptions): Promise<void>;
|
|
6
|
-
export declare function webComponentLibrary(options: BuildOptions): Promise<void>;
|
|
7
|
-
export declare function docs(options: BuildOptions): Promise<void>;
|
|
8
|
-
export declare function stacks(options: BuildOptions): Promise<void>;
|
|
9
|
-
export declare function functionsLibrary(options: BuildOptions): Promise<void>;
|
package/dist/bump.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
package/dist/changelog.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
package/dist/clean.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
package/dist/commit.d.ts
DELETED
package/dist/copy-types.d.ts
DELETED
package/dist/database/seed.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
package/dist/deploy/index.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
package/dist/dev/components.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
package/dist/dev/docs.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
package/dist/dev/index.d.ts
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import type { DevOptions } from '@stacksjs/types';
|
|
2
|
-
export declare function runDevServer(options: DevOptions): Promise<void>;
|
|
3
|
-
export declare function runFrontendDevServer(options: DevOptions): Promise<void>;
|
|
4
|
-
export declare function runBackendDevServer(options: DevOptions): Promise<void>;
|
|
5
|
-
export declare function runApiDevServer(options: DevOptions): Promise<void>;
|
|
6
|
-
export declare function runComponentsDevServer(options: DevOptions): Promise<void>;
|
|
7
|
-
export declare function runDashboardDevServer(options: DevOptions): Promise<void>;
|
|
8
|
-
export declare function runSystemTrayDevServer(options: DevOptions): Promise<void>;
|
|
9
|
-
export declare function runDesktopDevServer(options: DevOptions): Promise<void>;
|
|
10
|
-
export declare function runDocsDevServer(options: DevOptions): Promise<void>;
|
package/dist/examples.d.ts
DELETED
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import type { ExamplesOptions } from '@stacksjs/types';
|
|
2
|
-
export declare function invoke(options: ExamplesOptions): Promise<void>;
|
|
3
|
-
export declare function examples(options: ExamplesOptions): Promise<void>;
|
|
4
|
-
export declare function componentExample(options: ExamplesOptions): Promise<void>;
|
|
5
|
-
export declare function webComponentExample(options: ExamplesOptions): Promise<void>;
|
package/dist/fresh.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
package/dist/generate/index.d.ts
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import type { GeneratorOptions } from '@stacksjs/types';
|
|
2
|
-
export declare function invoke(options?: GeneratorOptions): Promise<void>;
|
|
3
|
-
export declare function generate(options: GeneratorOptions): Promise<void>;
|
|
4
|
-
export declare function generateLibEntries(options: GeneratorOptions): Promise<void>;
|
|
5
|
-
export declare function generateWebTypes(options?: GeneratorOptions): Promise<void>;
|
|
6
|
-
export declare function generateVsCodeCustomData(options?: GeneratorOptions): Promise<void>;
|
|
7
|
-
export declare function generateIdeHelpers(options?: GeneratorOptions): Promise<void>;
|
|
8
|
-
export declare function generateComponentMeta(options?: GeneratorOptions): Promise<void>;
|
|
9
|
-
export declare function generateTypes(options?: GeneratorOptions): Promise<void>;
|
|
10
|
-
export declare function generateMigrations(): void;
|
|
11
|
-
export declare function generatePkgxConfig(): void;
|
|
12
|
-
export declare function generateSeeder(): Promise<void>;
|
|
13
|
-
export declare function generateCoreSymlink(): Promise<void>;
|