stacks 0.44.11 → 0.45.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/README.md +4 -3
- package/buddy/README.md +4 -3
- package/buddy/package.json +7 -6
- package/buddy/src/commands/add.ts +12 -12
- package/buddy/src/commands/build.ts +55 -31
- package/buddy/src/commands/clean.ts +6 -6
- package/buddy/src/commands/commit.ts +6 -6
- package/buddy/src/commands/create.ts +14 -14
- package/buddy/src/commands/dev.ts +15 -15
- package/buddy/src/commands/example.ts +11 -11
- package/buddy/src/commands/fresh.ts +21 -10
- package/buddy/src/commands/generate.ts +20 -20
- package/buddy/src/commands/key.ts +2 -2
- package/buddy/src/commands/lint.ts +29 -11
- package/buddy/src/commands/make.ts +33 -33
- package/buddy/src/commands/preinstall.ts +6 -6
- package/buddy/src/commands/prepublish.ts +6 -6
- package/buddy/src/commands/release.ts +4 -4
- package/buddy/src/commands/setup.ts +8 -8
- package/buddy/src/commands/test.ts +11 -11
- package/buddy/src/commands/types.ts +8 -8
- package/buddy/src/commands/update.ts +20 -20
- package/buddy/src/index.ts +1 -0
- package/core/actions/package.json +2 -2
- package/core/actions/src/build-component-libs.ts +15 -0
- package/core/actions/src/build-core.ts +7 -0
- package/core/actions/src/build-stacks.ts +9 -0
- package/core/actions/src/bump.ts +10 -0
- package/core/actions/src/fix-lint-issues.ts +4 -0
- package/core/actions/src/fresh.ts +6 -26
- package/core/actions/src/{generate-package-json.ts → generate-package-jsons.ts} +0 -0
- package/core/actions/src/generate.ts +5 -5
- package/core/actions/src/helpers/lib-entries.ts +1 -1
- package/core/actions/src/helpers/package-json.ts +1 -1
- package/core/actions/src/helpers/utils.ts +31 -6
- package/core/actions/src/lint-fix.ts +8 -0
- package/core/actions/src/lint.ts +6 -30
- package/core/actions/src/make.ts +8 -8
- package/core/actions/src/release.ts +9 -28
- package/core/ai/package.json +1 -1
- package/core/alias/package.json +1 -1
- package/core/arrays/package.json +1 -1
- package/core/auth/package.json +1 -1
- package/core/build/node_modules/.bin/vite +2 -2
- package/core/build/node_modules/.bin/vite-ssg +2 -2
- package/core/build/package.json +3 -3
- package/core/cache/package.json +2 -2
- package/core/cache/tests/Redis.test.ts +0 -1
- package/core/cli/package.json +1 -1
- package/core/cli/src/actions/run.ts +24 -11
- package/core/cli/src/helpers.ts +6 -6
- package/core/cloud/package.json +1 -1
- package/core/collections/package.json +1 -1
- package/core/config/package.json +1 -1
- package/core/dashboard/package.json +1 -1
- package/core/database/package.json +2 -2
- package/core/datetime/package.json +1 -1
- package/core/desktop/package.json +1 -1
- package/core/docs/node_modules/.bin/vitepress +2 -2
- package/core/docs/package.json +2 -2
- package/core/domains/package.json +1 -1
- package/core/drivers/package.json +1 -1
- package/core/email/package.json +1 -1
- package/core/error-handling/package.json +2 -2
- package/core/git/package.json +1 -1
- package/core/{cloud/dist/actions → health}/README.md +11 -8
- package/core/health/node_modules/.bin/mkdist +17 -0
- package/core/health/node_modules/.bin/tsc +17 -0
- package/core/health/node_modules/.bin/tsserver +17 -0
- package/core/health/package.json +54 -0
- package/core/health/src/drivers/ohdear.ts +1 -0
- package/core/health/src/index.ts +1 -0
- package/core/health/src/notifications/index.ts +1 -0
- package/core/{notifications → health}/tests/example.test.ts +0 -0
- package/core/lint/node_modules/.bin/eslint +2 -2
- package/core/lint/package.json +3 -3
- package/core/logging/package.json +1 -1
- package/core/modules/package.json +1 -1
- package/core/modules/src/nprogress.ts +3 -1
- package/core/notifications/README.md +205 -30
- package/core/notifications/package.json +1 -1
- package/core/notifications/src/drivers/chat/slack.ts +1 -1
- package/core/notifications/src/drivers/email/actions/send.ts +1 -1
- package/core/notifications/src/drivers/push/expo.ts +19 -0
- package/core/notifications/src/drivers/push/fcm.ts +19 -0
- package/core/notifications/src/index.ts +17 -22
- package/core/notifications/tests/chat/Slack.test.ts +12 -2
- package/core/notifications/tests/email/Mailgun.test.ts +14 -3
- package/core/notifications/tests/email/Sendgrid.test.ts +15 -4
- package/core/notifications/tests/sms/Twilio.test.ts +13 -2
- package/core/objects/package.json +1 -1
- package/core/path/package.json +1 -1
- package/core/payments/package.json +1 -1
- package/core/realtime/package.json +1 -1
- package/core/router/package.json +1 -1
- package/core/search-engine/package.json +2 -2
- package/core/security/package.json +1 -1
- package/core/server/node_modules/.bin/vite +2 -2
- package/core/server/package.json +2 -2
- package/core/storage/package.json +1 -1
- package/core/strings/package.json +1 -1
- package/core/testing/node_modules/.bin/mkdist +2 -2
- package/core/testing/node_modules/.bin/vitest +2 -2
- package/core/testing/package.json +5 -5
- package/core/types/node_modules/.bin/vitepress +2 -2
- package/core/types/package.json +4 -4
- package/core/types/src/cli.ts +33 -3
- package/core/types/src/notifications.ts +161 -0
- package/core/ui/node_modules/.bin/vue-tsc +2 -2
- package/core/ui/package.json +2 -2
- package/core/utils/package.json +5 -5
- package/core/utils/src/helpers.ts +1 -1
- package/core/x-ray/package.json +1 -1
- package/core/x-ray/src/desktop/app.vue +0 -1
- package/core/x-ray/src/ray.config.js +1 -0
- package/core/x-ray/src/types.ts +1 -0
- package/package.json +8 -8
- package/tsconfig.json +2 -2
- package/components/vue/dist/.gitkeep +0 -0
- package/components/web/dist/.gitkeep +0 -0
- package/core/actions/test.ts +0 -10
|
@@ -37,7 +37,7 @@ export async function createVueLibraryEntryPoint() {
|
|
|
37
37
|
data: generateEntryPointData('vue-components'),
|
|
38
38
|
})
|
|
39
39
|
|
|
40
|
-
log.success('Created Vue component library entry point.')
|
|
40
|
+
log.success('Created the Vue component library entry point.')
|
|
41
41
|
}
|
|
42
42
|
|
|
43
43
|
export async function createWebComponentLibraryEntryPoint() {
|
|
@@ -87,7 +87,7 @@ export async function generatePackageJson(type: 'vue-components' | 'web-componen
|
|
|
87
87
|
else if (type === 'functions')
|
|
88
88
|
prettyName = 'Function Library'
|
|
89
89
|
|
|
90
|
-
log.success(`Created ${prettyName} package.json
|
|
90
|
+
log.success(`Created the ${prettyName} package.json file.`)
|
|
91
91
|
}
|
|
92
92
|
catch (err) {
|
|
93
93
|
log.error(`There was an error creating the ${prettyName} package.json.`, err)
|
|
@@ -1,22 +1,47 @@
|
|
|
1
1
|
import storage from '@stacksjs/storage'
|
|
2
|
-
import { runCommand } from '@stacksjs/cli'
|
|
2
|
+
import { runCommand, runCommands } from '@stacksjs/cli'
|
|
3
3
|
import { actionsPath, functionsPath } from '@stacksjs/path'
|
|
4
|
-
import type { CliOptions } from '@stacksjs/types'
|
|
4
|
+
import type { CliOptions, CommandResult } from '@stacksjs/types'
|
|
5
|
+
import type { Err, Result } from '@stacksjs/error-handling'
|
|
5
6
|
import { err } from '@stacksjs/error-handling'
|
|
6
7
|
|
|
7
8
|
/**
|
|
8
|
-
* Run
|
|
9
|
+
* Run an Action the Stacks way.
|
|
9
10
|
*
|
|
10
11
|
* @param command The action to invoke.
|
|
11
12
|
* @param options The options to pass to the command.
|
|
12
13
|
* @returns The result of the command.
|
|
13
14
|
*/
|
|
14
|
-
export async function runAction(action: string, options?: CliOptions) {
|
|
15
|
+
export async function runAction(action: string, options?: CliOptions): Promise<Result<CommandResult<string>, Error> | Err<CommandResult<string>, string>> {
|
|
15
16
|
if (!hasAction(action))
|
|
16
17
|
return err(`The specified action "${action}" does not exist`)
|
|
17
18
|
|
|
18
|
-
const cmd = `esno ${actionsPath(`${action}.ts`)}`
|
|
19
|
-
|
|
19
|
+
const cmd = `npx esno ${actionsPath(`${action}.ts`)}`
|
|
20
|
+
|
|
21
|
+
return options?.shouldShowSpinner
|
|
22
|
+
? await runCommands([cmd], options)
|
|
23
|
+
: await runCommand(cmd, options)
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Run Actions the Stacks way.
|
|
28
|
+
*
|
|
29
|
+
* @param command The action to invoke.
|
|
30
|
+
* @param options The options to pass to the command.
|
|
31
|
+
* @returns The result of the command.
|
|
32
|
+
*/
|
|
33
|
+
export async function runActions(actions: string[], options?: CliOptions): Promise<Result<CommandResult<string>, Error>[] | Result<CommandResult<string>, Error> | Err<CommandResult<string>, string>> {
|
|
34
|
+
if (!actions.length)
|
|
35
|
+
return err('No actions were specified')
|
|
36
|
+
|
|
37
|
+
for (const action of actions) {
|
|
38
|
+
if (!hasAction(action))
|
|
39
|
+
return err(`The specified action "${action}" does not exist`)
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
const commands = actions.map(action => `npx esno ${actionsPath(`${action}.ts`)}`)
|
|
43
|
+
|
|
44
|
+
return await runCommands(commands, options)
|
|
20
45
|
}
|
|
21
46
|
|
|
22
47
|
export function hasAction(action: string) {
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { runAction } from '@stacksjs/actions'
|
|
2
|
+
import { log } from '@stacksjs/cli'
|
|
3
|
+
import { projectPath } from '@stacksjs/path'
|
|
4
|
+
import { Action } from '@stacksjs/types'
|
|
5
|
+
|
|
6
|
+
log.info('Linting your project.')
|
|
7
|
+
await runAction(Action.FixLintIssues, { debug: true, cwd: projectPath(), shouldShowSpinner: true })
|
|
8
|
+
log.success('Linted your project.')
|
package/core/actions/src/lint.ts
CHANGED
|
@@ -1,36 +1,12 @@
|
|
|
1
|
-
import { log } from '@stacksjs/logging'
|
|
2
1
|
import { intro, outro, runCommand } from '@stacksjs/cli'
|
|
3
|
-
import { runNpmScript } from '@stacksjs/utils'
|
|
4
|
-
import type { LintOptions } from '@stacksjs/types'
|
|
5
2
|
import { ExitCode, NpmScript } from '@stacksjs/types'
|
|
6
3
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
await lintFix(options)
|
|
10
|
-
else
|
|
11
|
-
await lint(options)
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
export async function lint(options: LintOptions) {
|
|
15
|
-
const perf = intro('buddy lint')
|
|
16
|
-
const result = await runCommand(NpmScript.Lint, { ...options, debug: true })
|
|
17
|
-
|
|
18
|
-
if (result.isErr()) {
|
|
19
|
-
outro('While running `buddy lint`, there was an issue', { startTime: perf, useSeconds: true, isError: true })
|
|
20
|
-
process.exit(ExitCode.FatalError)
|
|
21
|
-
}
|
|
4
|
+
const perf = intro('buddy lint')
|
|
5
|
+
const result = await runCommand(NpmScript.Lint, { cwd: frameworkPath(), debug: true })
|
|
22
6
|
|
|
23
|
-
|
|
7
|
+
if (result.isErr()) {
|
|
8
|
+
outro('While running `buddy lint`, there was an issue', { startTime: perf, useSeconds: true, isError: true })
|
|
9
|
+
process.exit(ExitCode.FatalError)
|
|
24
10
|
}
|
|
25
11
|
|
|
26
|
-
|
|
27
|
-
log.info('Fixing lint errors...')
|
|
28
|
-
const result = await runNpmScript(NpmScript.LintFix, options)
|
|
29
|
-
|
|
30
|
-
if (result.isErr()) {
|
|
31
|
-
log.error('There was an error lint fixing your code.', result.error)
|
|
32
|
-
process.exit()
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
log.success('Fixed lint errors')
|
|
36
|
-
}
|
|
12
|
+
outro('Linted', { startTime: perf, useSeconds: true })
|
package/core/actions/src/make.ts
CHANGED
|
@@ -46,7 +46,7 @@ export async function component(options: MakeOptions) {
|
|
|
46
46
|
const name = options.name
|
|
47
47
|
log.info('Creating your component...')
|
|
48
48
|
await createComponent(options)
|
|
49
|
-
log.success(`Created ${italic(name)} component
|
|
49
|
+
log.success(`Created the ${italic(name)} component.`)
|
|
50
50
|
}
|
|
51
51
|
catch (error) {
|
|
52
52
|
log.error('There was an error creating your component.', error)
|
|
@@ -77,7 +77,7 @@ export async function database(options: MakeOptions) {
|
|
|
77
77
|
const name = options.name
|
|
78
78
|
log.info(`Creating your ${italic(name)} database...`)
|
|
79
79
|
await createDatabase(options)
|
|
80
|
-
log.success(`Created ${italic(name)} database
|
|
80
|
+
log.success(`Created the ${italic(name)} database.`)
|
|
81
81
|
}
|
|
82
82
|
catch (error) {
|
|
83
83
|
log.error('There was an error creating your database.', error)
|
|
@@ -95,7 +95,7 @@ export async function factory(options: MakeOptions) {
|
|
|
95
95
|
const name = options.name
|
|
96
96
|
log.info(`Creating your ${italic(name)} factory...`)
|
|
97
97
|
await createDatabase(options)
|
|
98
|
-
log.success(`Created ${italic(name)} factory
|
|
98
|
+
log.success(`Created the ${italic(name)} factory.`)
|
|
99
99
|
}
|
|
100
100
|
catch (error) {
|
|
101
101
|
log.error('There was an error creating your factory.', error)
|
|
@@ -113,7 +113,7 @@ export async function migration(options: MakeOptions) {
|
|
|
113
113
|
const name = options.name
|
|
114
114
|
log.info(`Creating your ${italic(name)} migration...`)
|
|
115
115
|
await createMigration(options)
|
|
116
|
-
log.success(`Created ${italic(name)} migration
|
|
116
|
+
log.success(`Created the ${italic(name)} migration.`)
|
|
117
117
|
}
|
|
118
118
|
catch (error) {
|
|
119
119
|
log.error('There was an error creating your migration.', error)
|
|
@@ -131,7 +131,7 @@ export async function notification(options: MakeOptions) {
|
|
|
131
131
|
const name = options.name
|
|
132
132
|
log.info(`Creating your ${italic(name)} notification...`)
|
|
133
133
|
await createNotification(options)
|
|
134
|
-
log.success(`Created ${italic(name)} notification
|
|
134
|
+
log.success(`Created the ${italic(name)} notification.`)
|
|
135
135
|
}
|
|
136
136
|
catch (error) {
|
|
137
137
|
log.error('There was an error creating your notification.', error)
|
|
@@ -149,7 +149,7 @@ export async function page(options: MakeOptions) {
|
|
|
149
149
|
const name = options.name
|
|
150
150
|
log.info('Creating your page...')
|
|
151
151
|
createPage(options)
|
|
152
|
-
log.success(`Created ${name} page
|
|
152
|
+
log.success(`Created the ${name} page.`)
|
|
153
153
|
}
|
|
154
154
|
catch (error) {
|
|
155
155
|
log.error('There was an error creating your page.', error)
|
|
@@ -181,7 +181,7 @@ export async function fx(options: MakeOptions) {
|
|
|
181
181
|
const name = options.name
|
|
182
182
|
log.info('Creating your function...')
|
|
183
183
|
await createFunction(options)
|
|
184
|
-
log.success(`Created ${name} function
|
|
184
|
+
log.success(`Created the ${name} function.`)
|
|
185
185
|
}
|
|
186
186
|
catch (error) {
|
|
187
187
|
log.error('There was an error creating your function.', error)
|
|
@@ -214,7 +214,7 @@ export async function language(options: MakeOptions) {
|
|
|
214
214
|
const name = options.name
|
|
215
215
|
log.info('Creating your translation file...')
|
|
216
216
|
createLanguage(options)
|
|
217
|
-
log.success(`Created ${name} translation file
|
|
217
|
+
log.success(`Created the ${name} translation file.`)
|
|
218
218
|
}
|
|
219
219
|
catch (error) {
|
|
220
220
|
log.error('There was an error creating your language.', error)
|
|
@@ -1,32 +1,13 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { frameworkPath } from '@stacksjs/path'
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import { log } from '@stacksjs/cli'
|
|
3
|
+
import { runActions } from '@stacksjs/actions'
|
|
4
|
+
import { Action } from '@stacksjs/types'
|
|
5
|
+
// import { log } from '@stacksjxs/cli'
|
|
7
6
|
|
|
8
|
-
|
|
9
|
-
|
|
7
|
+
await runActions([
|
|
8
|
+
Action.GeneratePackageJsons, // generate the package.json's for each package
|
|
9
|
+
Action.LintFix, // ensure there are no lint errors
|
|
10
|
+
Action.Bump, // bump the versions, generate the changelog, and push the changes, including the git version tag
|
|
11
|
+
], { debug: true, cwd: frameworkPath() }) // debug mode needs to be enabled to see the output due to the interactive prompts
|
|
10
12
|
|
|
11
|
-
|
|
12
|
-
log.error('There was an error while releasing your stack, during the process of fixing your lint errors.', result.error)
|
|
13
|
-
process.exit()
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
// next, lets run lint:fix to make sure there are no lint errors
|
|
17
|
-
// because when "generate-package-json" runs, it generates some lint errors
|
|
18
|
-
result = await runNpmScript(NpmScript.LintFix, { debug: true, cwd: frameworkPath() })
|
|
19
|
-
|
|
20
|
-
if (result.isErr()) {
|
|
21
|
-
log.error('There was an error while releasing your stack, during the process of fixing your lint errors.', result.error)
|
|
22
|
-
process.exit()
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
// next, lets run the release script to bump the versions and generate the changelog, and push the changes
|
|
26
|
-
// ultimately, a successful git push will trigger the CI/CD release workflow
|
|
27
|
-
result = await runNpmScript(NpmScript.Release, { debug: true, cwd: frameworkPath() })
|
|
28
|
-
|
|
29
|
-
if (result.isErr()) {
|
|
30
|
-
log.error('There was an error while releasing your stack.', result.error)
|
|
31
|
-
process.exit()
|
|
32
|
-
}
|
|
13
|
+
// log.success('Successfully released the Stacks framework')
|
package/core/ai/package.json
CHANGED
package/core/alias/package.json
CHANGED
package/core/arrays/package.json
CHANGED
package/core/auth/package.json
CHANGED
|
@@ -11,7 +11,7 @@ else
|
|
|
11
11
|
export NODE_PATH="$NODE_PATH:/home/runner/work/stacks/stacks/node_modules/.pnpm/node_modules"
|
|
12
12
|
fi
|
|
13
13
|
if [ -x "$basedir/node" ]; then
|
|
14
|
-
exec "$basedir/node" "$basedir/../../../../../node_modules/.pnpm/vite@4.0.
|
|
14
|
+
exec "$basedir/node" "$basedir/../../../../../node_modules/.pnpm/vite@4.0.2/node_modules/vite/bin/vite.js" "$@"
|
|
15
15
|
else
|
|
16
|
-
exec node "$basedir/../../../../../node_modules/.pnpm/vite@4.0.
|
|
16
|
+
exec node "$basedir/../../../../../node_modules/.pnpm/vite@4.0.2/node_modules/vite/bin/vite.js" "$@"
|
|
17
17
|
fi
|
|
@@ -11,7 +11,7 @@ else
|
|
|
11
11
|
export NODE_PATH="$NODE_PATH:/home/runner/work/stacks/stacks/node_modules/.pnpm/node_modules"
|
|
12
12
|
fi
|
|
13
13
|
if [ -x "$basedir/node" ]; then
|
|
14
|
-
exec "$basedir/node" "$basedir/../../../../../node_modules/.pnpm/vite-ssg@0.22.
|
|
14
|
+
exec "$basedir/node" "$basedir/../../../../../node_modules/.pnpm/vite-ssg@0.22.1_h5aity6h2fxdq34afxf7tsy23q/node_modules/vite-ssg/bin/vite-ssg.js" "$@"
|
|
15
15
|
else
|
|
16
|
-
exec node "$basedir/../../../../../node_modules/.pnpm/vite-ssg@0.22.
|
|
16
|
+
exec node "$basedir/../../../../../node_modules/.pnpm/vite-ssg@0.22.1_h5aity6h2fxdq34afxf7tsy23q/node_modules/vite-ssg/bin/vite-ssg.js" "$@"
|
|
17
17
|
fi
|
package/core/build/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stacksjs/build",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.45.0",
|
|
5
5
|
"packageManager": "pnpm@7.18.2",
|
|
6
6
|
"description": "The Stacks framework build tools and configurations.",
|
|
7
7
|
"author": "Chris Breuer",
|
|
@@ -57,8 +57,8 @@
|
|
|
57
57
|
"unbuild": "^1.0.2",
|
|
58
58
|
"unplugin-auto-import": "^0.12.1",
|
|
59
59
|
"unplugin-vue-components": "^0.22.12",
|
|
60
|
-
"vite": "^4.0.
|
|
61
|
-
"vite-plugin-inspect": "^0.7.
|
|
60
|
+
"vite": "^4.0.2",
|
|
61
|
+
"vite-plugin-inspect": "^0.7.11",
|
|
62
62
|
"vite-plugin-pages": "^0.28.0",
|
|
63
63
|
"vite-plugin-pwa": "^0.14.0",
|
|
64
64
|
"vite-plugin-vue-layouts": "^0.7.0",
|
package/core/cache/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stacksjs/cache",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.45.0",
|
|
5
5
|
"packageManager": "pnpm@7.18.2",
|
|
6
6
|
"description": "The Stacks way to test.",
|
|
7
7
|
"author": "Chris Breuer",
|
|
@@ -45,7 +45,7 @@
|
|
|
45
45
|
"typecheck": "tsc --noEmit"
|
|
46
46
|
},
|
|
47
47
|
"peerDependencies": {
|
|
48
|
-
"@aws-sdk/client-dynamodb": "^3.
|
|
48
|
+
"@aws-sdk/client-dynamodb": "^3.235.0",
|
|
49
49
|
"@stacksjs/config": "workspace:*",
|
|
50
50
|
"@types/memjs": "^1.2.4",
|
|
51
51
|
"memcached": "^2.2.2",
|
package/core/cli/package.json
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import type { CliOptions, CommandResult, Result, SpinnerOptions as Spinner } from '@stacksjs/types'
|
|
2
2
|
import { determineDebugMode } from '@stacksjs/config'
|
|
3
|
-
import {
|
|
3
|
+
import type { Err } from '@stacksjs/error-handling'
|
|
4
|
+
import { ResultAsync, err } from '@stacksjs/error-handling'
|
|
4
5
|
import { projectPath } from '@stacksjs/path'
|
|
5
|
-
import { italic } from '
|
|
6
|
+
import { italic } from '@stacksjs/cli'
|
|
6
7
|
import { spawn } from '../command'
|
|
7
8
|
import { startAnimation } from '../helpers'
|
|
8
9
|
|
|
@@ -17,10 +18,11 @@ import { startAnimation } from '../helpers'
|
|
|
17
18
|
export function exec(command: string, options?: CliOptions) {
|
|
18
19
|
const cwd = options?.cwd || projectPath()
|
|
19
20
|
const stdio = determineDebugMode(options) ? 'inherit' : 'ignore'
|
|
21
|
+
const shell = options?.shell || false
|
|
20
22
|
|
|
21
23
|
return ResultAsync.fromPromise(
|
|
22
|
-
spawn(command, { stdio, cwd }),
|
|
23
|
-
() => new Error(`Failed to
|
|
24
|
+
spawn(command, { stdio, cwd, shell }),
|
|
25
|
+
() => new Error(`Failed to run command: ${italic(command)}`),
|
|
24
26
|
)
|
|
25
27
|
}
|
|
26
28
|
|
|
@@ -42,21 +44,22 @@ export async function runCommand(command: string, options?: CliOptions) {
|
|
|
42
44
|
* @param options The options to pass to the command.
|
|
43
45
|
* @returns The result of the command.
|
|
44
46
|
*/
|
|
45
|
-
export async function runCommands(commands: string[], options?: CliOptions): Promise<Result<CommandResult<string>, Error>[]> {
|
|
46
|
-
|
|
47
|
+
export async function runCommands(commands: string[], options?: CliOptions): Promise<Result<CommandResult<string>, Error>[] | Result<CommandResult<string>, Error> | Err<CommandResult<string>, string>> {
|
|
48
|
+
const results: Result<CommandResult<string>, Error>[] = []
|
|
49
|
+
const numberOfCommands = commands.length
|
|
47
50
|
|
|
48
|
-
if (!
|
|
49
|
-
|
|
51
|
+
if (!numberOfCommands)
|
|
52
|
+
return err('No commands were specified')
|
|
50
53
|
|
|
51
|
-
const
|
|
54
|
+
const spinner = determineSpinner(options)
|
|
52
55
|
|
|
53
56
|
for (const command of commands) {
|
|
54
57
|
const result = await runCommand(command, options)
|
|
55
58
|
|
|
56
|
-
if (result
|
|
59
|
+
if (result?.isOk())
|
|
57
60
|
results.push(result)
|
|
58
61
|
|
|
59
|
-
if (result
|
|
62
|
+
if (result?.isErr()) {
|
|
60
63
|
if (spinner)
|
|
61
64
|
spinner.fail('Failed to run command.')
|
|
62
65
|
|
|
@@ -68,5 +71,15 @@ export async function runCommands(commands: string[], options?: CliOptions): Pro
|
|
|
68
71
|
if (spinner)
|
|
69
72
|
spinner.stop()
|
|
70
73
|
|
|
74
|
+
if (numberOfCommands === 1)
|
|
75
|
+
return results[0]
|
|
76
|
+
|
|
71
77
|
return results
|
|
72
78
|
}
|
|
79
|
+
|
|
80
|
+
function determineSpinner(options?: CliOptions): Spinner | undefined {
|
|
81
|
+
if (!determineDebugMode(options))
|
|
82
|
+
return startAnimation()
|
|
83
|
+
|
|
84
|
+
return undefined
|
|
85
|
+
}
|
package/core/cli/src/helpers.ts
CHANGED
|
@@ -9,10 +9,8 @@ import { bgCyan, bold, cyan, dim, green, italic, red } from './utilities'
|
|
|
9
9
|
*/
|
|
10
10
|
export function intro(command: string, options?: IntroOptions) {
|
|
11
11
|
console.log()
|
|
12
|
-
|
|
13
12
|
console.log(cyan(bold('Stacks CLI')) + dim(` v${version}`))
|
|
14
13
|
console.log()
|
|
15
|
-
|
|
16
14
|
log.info(`Preparing to run the ${bgCyan(italic(bold(` ${command} `)))} command.`)
|
|
17
15
|
|
|
18
16
|
if (options?.showPerformance === false)
|
|
@@ -24,7 +22,7 @@ export function intro(command: string, options?: IntroOptions) {
|
|
|
24
22
|
/**
|
|
25
23
|
* Prints the outro message.
|
|
26
24
|
*/
|
|
27
|
-
export function outro(text: string, options: OutroOptions, error?: Error) {
|
|
25
|
+
export function outro(text: string, options: OutroOptions, error?: Error | string) {
|
|
28
26
|
if (options.isError) {
|
|
29
27
|
if (error)
|
|
30
28
|
log.error(error)
|
|
@@ -47,11 +45,13 @@ export function outro(text: string, options: OutroOptions, error?: Error) {
|
|
|
47
45
|
}
|
|
48
46
|
|
|
49
47
|
export function startAnimation() {
|
|
50
|
-
const spin = spinner(
|
|
51
|
-
|
|
48
|
+
const spin = spinner({
|
|
49
|
+
text: 'Executing...',
|
|
50
|
+
}).start()
|
|
52
51
|
|
|
53
52
|
setTimeout(() => {
|
|
54
|
-
spin.text = italic(
|
|
53
|
+
spin.text = italic('This may take a little while...')
|
|
54
|
+
spin.spinner = 'clock'
|
|
55
55
|
}, 5000)
|
|
56
56
|
|
|
57
57
|
return spin
|
package/core/cloud/package.json
CHANGED
package/core/config/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stacksjs/database",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.45.0",
|
|
5
5
|
"packageManager": "pnpm@7.18.2",
|
|
6
6
|
"description": "The Stacks database integration.",
|
|
7
7
|
"author": "Chris Breuer",
|
|
@@ -48,7 +48,7 @@
|
|
|
48
48
|
"typecheck": "tsc --noEmit"
|
|
49
49
|
},
|
|
50
50
|
"peerDependencies": {
|
|
51
|
-
"@prisma/client": "^4.
|
|
51
|
+
"@prisma/client": "^4.8.0",
|
|
52
52
|
"@stacksjs/utils": "workspace:*"
|
|
53
53
|
},
|
|
54
54
|
"devDependencies": {
|
|
@@ -11,7 +11,7 @@ else
|
|
|
11
11
|
export NODE_PATH="$NODE_PATH:/home/runner/work/stacks/stacks/node_modules/.pnpm/node_modules"
|
|
12
12
|
fi
|
|
13
13
|
if [ -x "$basedir/node" ]; then
|
|
14
|
-
exec "$basedir/node" "$basedir/../../../../../node_modules/.pnpm/vitepress@1.0.0-alpha.
|
|
14
|
+
exec "$basedir/node" "$basedir/../../../../../node_modules/.pnpm/vitepress@1.0.0-alpha.32_2r467mdhb7mblpaox4bg7fatdi/node_modules/vitepress/bin/vitepress.js" "$@"
|
|
15
15
|
else
|
|
16
|
-
exec node "$basedir/../../../../../node_modules/.pnpm/vitepress@1.0.0-alpha.
|
|
16
|
+
exec node "$basedir/../../../../../node_modules/.pnpm/vitepress@1.0.0-alpha.32_2r467mdhb7mblpaox4bg7fatdi/node_modules/vitepress/bin/vitepress.js" "$@"
|
|
17
17
|
fi
|
package/core/docs/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stacksjs/docs",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.45.0",
|
|
5
5
|
"packageManager": "pnpm@7.18.2",
|
|
6
6
|
"description": "The Stacks way to document.",
|
|
7
7
|
"author": "Chris Breuer",
|
|
@@ -43,7 +43,7 @@
|
|
|
43
43
|
"typecheck": "tsc --noEmit"
|
|
44
44
|
},
|
|
45
45
|
"peerDependencies": {
|
|
46
|
-
"vitepress": "1.0.0-alpha.
|
|
46
|
+
"vitepress": "1.0.0-alpha.32"
|
|
47
47
|
},
|
|
48
48
|
"devDependencies": {
|
|
49
49
|
"@stacksjs/testing": "workspace:*",
|
package/core/email/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stacksjs/email",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.45.0",
|
|
5
5
|
"packageManager": "pnpm@7.18.2",
|
|
6
6
|
"description": "The Stacks Email integration. Painlessly create & manage your inboxes, templates, and send emails.",
|
|
7
7
|
"author": "Chris Breuer",
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stacksjs/error-handling",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.45.0",
|
|
5
5
|
"packageManager": "pnpm@7.18.2",
|
|
6
6
|
"description": "Type safe error handling.",
|
|
7
7
|
"author": "Chris Breuer",
|
|
@@ -44,7 +44,7 @@
|
|
|
44
44
|
"typecheck": "tsc --noEmit"
|
|
45
45
|
},
|
|
46
46
|
"peerDependencies": {
|
|
47
|
-
"@ow3/eslint-config": "^0.
|
|
47
|
+
"@ow3/eslint-config": "^0.35.0",
|
|
48
48
|
"neverthrow": "^6.0.0"
|
|
49
49
|
},
|
|
50
50
|
"devDependencies": {
|