stacks 0.58.28 → 0.58.30
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/core/README.md +1 -1
- package/core/actions/dist/src/deploy/index.js +1 -1
- package/core/actions/dist/src/dev/components.js +1 -1
- package/core/actions/dist/src/dev/index.js +10 -0
- package/core/actions/dist/src/generate/lib-entries.js +3 -3
- package/core/actions/dist/src/helpers/lib-entries.js +3 -3
- package/core/actions/dist/src/index.js +10 -0
- package/core/actions/dist/src/lint/fix.js +1 -1
- package/core/actions/dist/src/release.js +8 -0
- package/core/actions/dist/src/upgrade.js +1 -1
- package/core/actions/package.json +1 -1
- package/core/actions/src/build/docs.ts +7 -0
- package/core/actions/src/deploy/index.ts +1 -1
- package/core/actions/src/dev/api.ts +2 -2
- package/core/actions/src/dev/components.ts +1 -1
- package/core/actions/src/dev/dashboard.ts +7 -0
- package/core/actions/src/dev/desktop.ts +3 -3
- package/core/actions/src/dev/index.ts +10 -0
- package/core/actions/src/dev/system-tray.ts +6 -0
- package/core/actions/src/helpers/lib-entries.ts +3 -3
- package/core/actions/src/lint/fix.ts +1 -1
- package/core/ai/package.json +3 -3
- package/core/alias/package.json +1 -1
- package/core/analytics/package.json +1 -1
- package/core/api/package.json +1 -1
- package/core/arrays/package.json +1 -1
- package/core/auth/package.json +1 -1
- package/core/buddy/README.md +2 -2
- package/core/buddy/dist/{chunk-b75e6db0012faa55.js → chunk-0455e53fab4244b1.js} +1 -4
- package/core/buddy/dist/{chunk-fd47b42fb923a4be.js → chunk-61e8f138963fc709.js} +173 -137
- package/core/buddy/dist/cli.js +2 -2
- package/core/buddy/dist/index.js +2 -2
- package/core/buddy/package.json +1 -1
- package/core/buddy/src/commands/add.ts +4 -0
- package/core/buddy/src/commands/build.ts +12 -1
- package/core/buddy/src/commands/changelog.ts +2 -0
- package/core/buddy/src/commands/clean.ts +2 -0
- package/core/buddy/src/commands/cloud.ts +6 -0
- package/core/buddy/src/commands/commit.ts +2 -0
- package/core/buddy/src/commands/configure.ts +3 -0
- package/core/buddy/src/commands/create.ts +8 -8
- package/core/buddy/src/commands/deploy.ts +24 -23
- package/core/buddy/src/commands/dev.ts +50 -10
- package/core/buddy/src/commands/dns.ts +2 -0
- package/core/buddy/src/commands/domains.ts +2 -0
- package/core/buddy/src/commands/example.ts +4 -0
- package/core/buddy/src/commands/fresh.ts +2 -0
- package/core/buddy/src/commands/generate.ts +12 -3
- package/core/buddy/src/commands/http.ts +2 -0
- package/core/buddy/src/commands/install.ts +2 -0
- package/core/buddy/src/commands/key.ts +4 -2
- package/core/buddy/src/commands/lint.ts +3 -0
- package/core/buddy/src/commands/make.ts +11 -1
- package/core/buddy/src/commands/migrate.ts +3 -0
- package/core/buddy/src/commands/prepublish.ts +2 -0
- package/core/buddy/src/commands/release.ts +2 -0
- package/core/buddy/src/commands/seed.ts +2 -0
- package/core/buddy/src/commands/setup.ts +33 -34
- package/core/buddy/src/commands/test.ts +2 -0
- package/core/buddy/src/commands/tinker.ts +2 -0
- package/core/buddy/src/commands/types.ts +3 -0
- package/core/buddy/src/commands/upgrade.ts +6 -0
- package/core/build/package.json +1 -1
- package/core/bun-create/bud/package.json +3 -2
- package/core/bun-create/buddy/package.json +2 -2
- package/core/bun-create/stack/package.json +2 -2
- package/core/bun-create/stacks/package.json +2 -2
- package/core/bun-create/stx/package.json +2 -2
- package/core/bun-plugin-yaml/dist/index.js +1 -19
- package/core/bun-plugin-yaml/package.json +1 -1
- package/core/bun-plugin-yaml/src/index.ts +1 -1
- package/core/cache/package.json +2 -2
- package/core/chat/package.json +1 -1
- package/core/cli/dist/index.js +24 -23
- package/core/cli/package.json +1 -1
- package/core/cli/src/helpers.ts +21 -31
- package/core/cli/src/run.ts +9 -7
- package/core/cloud/buddy +2 -0
- package/core/cloud/package.json +33 -33
- package/core/cloud/src/cloud/ai.ts +45 -36
- package/core/cloud/src/cloud/aws-sdk-layer/nodejs/package-lock.json +10 -10
- package/core/cloud/src/cloud/aws-sdk-layer/nodejs/package.json +2 -2
- package/core/cloud/src/cloud/cdn.ts +44 -5
- package/core/cloud/src/cloud/cli.ts +45 -0
- package/core/cloud/src/cloud/compute.ts +1 -1
- package/core/cloud/src/cloud/index.ts +6 -1
- package/core/cloud/src/cloud/lambda/cli-setup/index.js +67 -0
- package/core/cloud/src/index.ts +1 -0
- package/core/cloud/src/runtime/example/lambda.ts +1 -1
- package/core/cloud/src/runtime/runtime.ts +1 -0
- package/core/cloud/src/runtime/server.ts +1 -1
- package/core/collections/package.json +1 -1
- package/core/config/dist/index.js +130 -122
- package/core/config/package.json +1 -1
- package/core/config/src/overrides.ts +0 -2
- package/core/database/package.json +2 -2
- package/core/database/src/kysely-bun-worker/driver.ts +1 -0
- package/core/database/src/kysely-bun-worker/worker.ts +1 -1
- package/core/datetime/package.json +1 -1
- package/core/desktop/dist/index.js +6 -0
- package/core/desktop/package.json +5 -5
- package/core/desktop/src/index.ts +2 -0
- package/core/desktop/src/system-tray.ts +1 -0
- package/core/development/package.json +1 -1
- package/core/dns/package.json +7 -7
- package/core/docs/build.ts +1 -1
- package/core/docs/dist/index.js +29878 -9995
- package/core/docs/package.json +6 -5
- package/core/docs/src/index.ts +7 -1
- package/core/docs/src/meta.ts +32 -0
- package/core/docs/src/scripts/pwa.ts +116 -0
- package/core/email/email-forwarder.cjs +1 -0
- package/core/email/package.json +3 -3
- package/core/email/src/server/converter.ts +1 -0
- package/core/email/src/server/inbound.ts +1 -0
- package/core/email/src/server/outbound.ts +6 -4
- package/core/enums/dist/index.js +4 -2
- package/core/enums/package.json +1 -1
- package/core/enums/src/index.ts +4 -2
- package/core/env/package.json +1 -1
- package/core/error-handling/package.json +1 -1
- package/core/eslint-config/package.json +18 -18
- package/core/eslint-config/src/configs/comments.ts +1 -1
- package/core/eslint-config/src/configs/imports.ts +9 -0
- package/core/eslint-config/src/configs/svelte.ts +1 -0
- package/core/eslint-config/src/configs/unicorn.ts +1 -1
- package/core/eslint-config/src/configs/vue.ts +0 -1
- package/core/eslint-config/src/factory.ts +2 -8
- package/core/events/package.json +1 -1
- package/core/faker/package.json +2 -2
- package/core/git/dist/index.js +40 -0
- package/core/git/package.json +3 -3
- package/core/git/src/index.ts +62 -0
- package/core/health/package.json +1 -1
- package/core/http/package.json +1 -1
- package/core/lint/package.json +1 -1
- package/core/logging/dist/index.js +0 -6
- package/core/logging/package.json +1 -1
- package/core/music/package.json +3 -3
- package/core/notifications/package.json +2 -2
- package/core/objects/package.json +1 -1
- package/core/orm/package.json +1 -1
- package/core/path/dist/index.js +6 -3
- package/core/path/package.json +1 -1
- package/core/path/src/index.ts +7 -3
- package/core/payments/dist/index.js +2 -5
- package/core/payments/package.json +3 -3
- package/core/push/package.json +1 -1
- package/core/query-builder/package.json +1 -1
- package/core/queue/package.json +1 -1
- package/core/raycast/package.json +5 -0
- package/core/raycast/src/index.ts +0 -0
- package/core/realtime/package.json +1 -1
- package/core/repl/package.json +1 -1
- package/core/router/dist/index.js +16 -496
- package/core/router/package.json +1 -1
- package/core/router/src/middleware.ts +16 -14
- package/core/scheduler/package.json +1 -1
- package/core/search-engine/package.json +2 -2
- package/core/security/dist/index.js +3 -6
- package/core/security/package.json +2 -2
- package/core/server/dist/index.js +6 -2
- package/core/server/package.json +2 -2
- package/core/server/src/config.ts +14 -9
- package/core/signals/package.json +1 -1
- package/core/slug/package.json +1 -1
- package/core/sms/package.json +1 -1
- package/core/storage/dist/index.js +28 -10
- package/core/storage/package.json +1 -1
- package/core/storage/src/files.ts +10 -2
- package/core/storage/src/zip.ts +1 -1
- package/core/strings/package.json +3 -3
- package/core/stx +2 -0
- package/core/tables/package.json +3 -3
- package/core/testing/package.json +3 -3
- package/core/tinker/package.json +1 -1
- package/core/tsconfig.json +4 -9
- package/core/tunnel/package.json +1 -1
- package/core/types/dist/index.js +3 -1
- package/core/types/package.json +13 -13
- package/core/types/src/cli.ts +3 -3
- package/core/types/src/cloud.ts +4 -1
- package/core/types/src/dns.ts +1 -1
- package/core/types/src/native.ts +0 -0
- package/core/types/src/stacks.ts +0 -10
- package/core/ui/package.json +8 -8
- package/core/utils/dist/index.js +1 -1
- package/core/utils/package.json +1 -1
- package/core/validation/package.json +1 -1
- package/core/vite/README.md +1 -1
- package/core/vite/build.ts +1 -1
- package/core/vite/dist/index.js +211 -203
- package/core/vite/package.json +5 -5
- package/core/vite/src/components.ts +1 -1
- package/core/vite/src/dashboard.ts +100 -0
- package/core/vite/src/desktop.ts +2 -58
- package/core/vite/src/example-vue.ts +1 -1
- package/core/vite/src/example-wc.ts +1 -1
- package/core/vite/src/functions.ts +1 -1
- package/core/vite/src/index.ts +9 -11
- package/core/vite/src/plugin/auto-imports.ts +1 -1
- package/core/vite/src/plugin/layouts.ts +6 -7
- package/core/vite/src/plugin/router.ts +3 -1
- package/core/vite/src/system-tray.ts +100 -0
- package/core/vite/src/views.ts +13 -2
- package/core/vite/src/web-components.ts +1 -1
- package/core/whois/dist/index.js +1 -2
- package/core/whois/package.json +1 -1
- package/core/whois/src/index.ts +10 -8
- package/core/x-ray/package.json +1 -1
- package/core/zsh-buddy/README.md +51 -0
- package/core/zsh-buddy/package.json +29 -0
- package/ide/dictionary.txt +12 -0
- package/ide/jetbrains/.idea/stacks.iml +0 -1
- package/ide/vscode/.vscode/settings.json +7 -2
- package/ide/vscode/package.json +2 -4
- package/package.json +12 -7
- package/core/cloud/src/server/.dockerignore +0 -15
- package/core/cloud/src/server/Dockerfile +0 -21
- package/core/cloud/src/server/index.ts +0 -3
- package/core/cloud/src/server/package.json +0 -12
- package/core/cloud/src/server/runtime.ts +0 -828
- package/core/scripts/build +0 -58
- package/core/scripts/ensure +0 -33
- package/core/scripts/fresh +0 -14
- package/core/scripts/link +0 -14
- package/core/scripts/move-built-src-files.ts +0 -28
- package/core/scripts/move-dts-files.ts +0 -35
- package/core/scripts/publish +0 -43
- package/core/scripts/setup +0 -176
- package/core/tables/vite.config.ts +0 -84
- package/core/vite/src/plugin/index.ts +0 -21
- /package/core/vite/src/{stacks.ts → plugins.ts} +0 -0
|
@@ -18,6 +18,8 @@ export interface CdnStackProps extends NestedCloudProps {
|
|
|
18
18
|
zone: route53.IHostedZone
|
|
19
19
|
webServer: lambda.Function
|
|
20
20
|
webServerUrl: lambda.FunctionUrl
|
|
21
|
+
cliSetupUrl: lambda.FunctionUrl
|
|
22
|
+
askAiUrl: lambda.FunctionUrl
|
|
21
23
|
}
|
|
22
24
|
|
|
23
25
|
export class CdnStack {
|
|
@@ -240,12 +242,12 @@ export class CdnStack {
|
|
|
240
242
|
}
|
|
241
243
|
}
|
|
242
244
|
|
|
243
|
-
aiBehaviorOptions(scope: Construct): Record<string, cloudfront.BehaviorOptions> {
|
|
244
|
-
|
|
245
|
-
|
|
245
|
+
aiBehaviorOptions(scope: Construct, props: CdnStackProps): Record<string, cloudfront.BehaviorOptions> {
|
|
246
|
+
const hostname = Fn.select(2, Fn.split('/', props.askAiUrl.url))
|
|
246
247
|
return {
|
|
247
248
|
'/ai/ask': {
|
|
248
|
-
origin: new origins.HttpOrigin('9qp44a2b7e.execute-api.us-east-1.amazonaws.com', {
|
|
249
|
+
// origin: new origins.HttpOrigin('9qp44a2b7e.execute-api.us-east-1.amazonaws.com', {
|
|
250
|
+
origin: new origins.HttpOrigin(hostname, {
|
|
249
251
|
originPath: '/ai',
|
|
250
252
|
protocolPolicy: cloudfront.OriginProtocolPolicy.HTTPS_ONLY,
|
|
251
253
|
}),
|
|
@@ -279,10 +281,40 @@ export class CdnStack {
|
|
|
279
281
|
}
|
|
280
282
|
}
|
|
281
283
|
|
|
284
|
+
cliSetupBehaviorOptions(scope: Construct, props: CdnStackProps): Record<string, cloudfront.BehaviorOptions> {
|
|
285
|
+
const hostname = Fn.select(2, Fn.split('/', props.cliSetupUrl.url))
|
|
286
|
+
|
|
287
|
+
return {
|
|
288
|
+
'/install': {
|
|
289
|
+
origin: new origins.HttpOrigin(hostname, {
|
|
290
|
+
// origin: new origins.HttpOrigin('tipevv3dfx35fb7ptyq7nrxtga0qkcgc.lambda-url.us-east-1.on.aws', {
|
|
291
|
+
originPath: '/cli-setup',
|
|
292
|
+
protocolPolicy: cloudfront.OriginProtocolPolicy.HTTPS_ONLY,
|
|
293
|
+
}),
|
|
294
|
+
compress: false,
|
|
295
|
+
allowedMethods: cloudfront.AllowedMethods.ALLOW_ALL,
|
|
296
|
+
viewerProtocolPolicy: cloudfront.ViewerProtocolPolicy.REDIRECT_TO_HTTPS,
|
|
297
|
+
cachePolicy: new cloudfront.CachePolicy(scope, 'CliSetupCachePolicy', {
|
|
298
|
+
comment: 'Stacks CLI Setup Cache Policy',
|
|
299
|
+
cachePolicyName: `${this.props.slug}-${this.props.appEnv}-cli-setup-cache-policy`,
|
|
300
|
+
defaultTtl: Duration.seconds(0),
|
|
301
|
+
// minTtl: config.cloud.cdn?.minTtl ? Duration.seconds(config.cloud.cdn.minTtl) : undefined,
|
|
302
|
+
cookieBehavior: cloudfront.CacheCookieBehavior.none(),
|
|
303
|
+
headerBehavior: cloudfront.CacheHeaderBehavior.none(),
|
|
304
|
+
queryStringBehavior: cloudfront.CacheQueryStringBehavior.none(),
|
|
305
|
+
}),
|
|
306
|
+
},
|
|
307
|
+
}
|
|
308
|
+
}
|
|
309
|
+
|
|
282
310
|
shouldDeployAiEndpoints() {
|
|
283
311
|
return config.cloud.ai
|
|
284
312
|
}
|
|
285
313
|
|
|
314
|
+
shouldDeployCliSetup() {
|
|
315
|
+
return config.cloud.cli
|
|
316
|
+
}
|
|
317
|
+
|
|
286
318
|
shouldDeployDocs() {
|
|
287
319
|
return hasFiles(p.projectPath('docs'))
|
|
288
320
|
}
|
|
@@ -308,7 +340,14 @@ export class CdnStack {
|
|
|
308
340
|
|
|
309
341
|
if (this.shouldDeployAiEndpoints()) {
|
|
310
342
|
behaviorOptions = {
|
|
311
|
-
...this.aiBehaviorOptions(scope),
|
|
343
|
+
...this.aiBehaviorOptions(scope, props),
|
|
344
|
+
...behaviorOptions,
|
|
345
|
+
}
|
|
346
|
+
}
|
|
347
|
+
|
|
348
|
+
if (this.shouldDeployCliSetup()) {
|
|
349
|
+
behaviorOptions = {
|
|
350
|
+
...this.cliSetupBehaviorOptions(scope, props),
|
|
312
351
|
...behaviorOptions,
|
|
313
352
|
}
|
|
314
353
|
}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/* eslint-disable no-new */
|
|
2
|
+
import { Duration, CfnOutput as Output, aws_lambda as lambda } from 'aws-cdk-lib'
|
|
3
|
+
import type { Construct } from 'constructs'
|
|
4
|
+
import type { NestedCloudProps } from '../types'
|
|
5
|
+
|
|
6
|
+
export interface CliStackProps extends NestedCloudProps {
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export class CliStack {
|
|
10
|
+
cliSetupUrl: lambda.FunctionUrl
|
|
11
|
+
|
|
12
|
+
constructor(scope: Construct, props: CliStackProps) {
|
|
13
|
+
const cliSetupFunc = new lambda.Function(scope, 'CliSetupFunction', {
|
|
14
|
+
functionName: `${props.slug}-${props.appEnv}-cli-setup`,
|
|
15
|
+
description: 'Lambda function that triggers setup script for a Stacks project',
|
|
16
|
+
runtime: lambda.Runtime.NODEJS_20_X,
|
|
17
|
+
handler: 'index.handler',
|
|
18
|
+
code: lambda.Code.fromAsset('src/cloud/lambda/cli-setup'), // path relative to the cloud root package dir
|
|
19
|
+
timeout: Duration.seconds(30),
|
|
20
|
+
})
|
|
21
|
+
|
|
22
|
+
// create a Lambda.FunctionUrl to be used in the CloudFront OriginRequestPolicy
|
|
23
|
+
// this will be used to trigger the function
|
|
24
|
+
this.cliSetupUrl = new lambda.FunctionUrl(scope, 'CliSetupFunctionUrl', {
|
|
25
|
+
function: cliSetupFunc,
|
|
26
|
+
authType: lambda.FunctionUrlAuthType.NONE,
|
|
27
|
+
cors: {
|
|
28
|
+
allowedOrigins: ['*'],
|
|
29
|
+
},
|
|
30
|
+
})
|
|
31
|
+
|
|
32
|
+
new Output(scope, 'CliSetupVanityUrl', {
|
|
33
|
+
value: `${this.cliSetupUrl.url}cli-setup`,
|
|
34
|
+
})
|
|
35
|
+
|
|
36
|
+
new Output(scope, 'CliSetupUrl', {
|
|
37
|
+
value: `https://${props.domain}/install`,
|
|
38
|
+
description: 'URL to trigger the CLI setup function',
|
|
39
|
+
})
|
|
40
|
+
|
|
41
|
+
// once deployed, need to create logic in the cdn origin request to check if the request is for the cli
|
|
42
|
+
// if it is, then we need the to use the function url as the origin
|
|
43
|
+
// if it is not, then we need don't adjust the origin
|
|
44
|
+
}
|
|
45
|
+
}
|
|
@@ -31,7 +31,7 @@ export class ComputeStack {
|
|
|
31
31
|
|
|
32
32
|
this.apiServer = new lambda.Function(scope, 'WebServer', {
|
|
33
33
|
description: 'The web server for the Stacks application',
|
|
34
|
-
code: lambda.Code.fromAssetImage(p.
|
|
34
|
+
code: lambda.Code.fromAssetImage(p.frameworkPath('server')),
|
|
35
35
|
handler: lambda.Handler.FROM_IMAGE,
|
|
36
36
|
runtime: lambda.Runtime.FROM_IMAGE,
|
|
37
37
|
vpc,
|
|
@@ -4,6 +4,7 @@ import type { Construct } from 'constructs'
|
|
|
4
4
|
import type { CloudOptions } from '../types'
|
|
5
5
|
import { AiStack } from './ai'
|
|
6
6
|
import { CdnStack } from './cdn'
|
|
7
|
+
import { CliStack } from './cli'
|
|
7
8
|
import { DnsStack } from './dns'
|
|
8
9
|
import { DocsStack } from './docs'
|
|
9
10
|
import { StorageStack } from './storage'
|
|
@@ -69,7 +70,9 @@ export class Cloud extends Stack {
|
|
|
69
70
|
certificate: security.certificate,
|
|
70
71
|
})
|
|
71
72
|
|
|
72
|
-
new AiStack(this, props)
|
|
73
|
+
const ai = new AiStack(this, props)
|
|
74
|
+
|
|
75
|
+
const cli = new CliStack(this, props)
|
|
73
76
|
|
|
74
77
|
const cdn = new CdnStack(this, {
|
|
75
78
|
...props,
|
|
@@ -81,6 +84,8 @@ export class Cloud extends Stack {
|
|
|
81
84
|
zone: dns.zone,
|
|
82
85
|
webServer: api.apiServer,
|
|
83
86
|
webServerUrl: api.apiServerUrl,
|
|
87
|
+
cliSetupUrl: cli.cliSetupUrl,
|
|
88
|
+
askAiUrl: ai.askAiUrl,
|
|
84
89
|
})
|
|
85
90
|
|
|
86
91
|
new DeploymentStack(this, {
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
async function handler() {
|
|
2
|
+
const setupScriptContents = `if [ -n "$1" ]; then
|
|
3
|
+
# Check if the directory exists
|
|
4
|
+
if [ -d "storage/framework/core" ]; then # this is our identifier whether it is a Stacks project
|
|
5
|
+
:
|
|
6
|
+
else
|
|
7
|
+
if [ -d "$1" ]; then
|
|
8
|
+
echo "Project $1 exists locally. Please use a different name & run again."
|
|
9
|
+
exit 1
|
|
10
|
+
else
|
|
11
|
+
git clone https://github.com/stacksjs/stacks.git $1
|
|
12
|
+
cd $1
|
|
13
|
+
# Run the pkgx-install script
|
|
14
|
+
"./storage/framework/scripts/pkgx-install"
|
|
15
|
+
|
|
16
|
+
echo "Project $1 has been created. Please open a new terminal, run 'bun run dev' to start the server."
|
|
17
|
+
|
|
18
|
+
exit 1
|
|
19
|
+
fi
|
|
20
|
+
fi
|
|
21
|
+
fi
|
|
22
|
+
|
|
23
|
+
# Get the directory of the current script and go up 3 directories
|
|
24
|
+
PROJECT_ROOT="$(cd "$(dirname "$0")" && pwd)"
|
|
25
|
+
CLI_PATH="$PROJECT_ROOT/storage/framework/core/buddy/src/cli.ts"
|
|
26
|
+
SCRIPT_PATH="$PROJECT_ROOT/storage/framework/scripts/pkgx-install"
|
|
27
|
+
LOG_PATH="$PROJECT_ROOT/storage/logs/console.log"
|
|
28
|
+
|
|
29
|
+
if [[ $* == *--verbose* ]]; then
|
|
30
|
+
echo "Project root: $PROJECT_ROOT"
|
|
31
|
+
echo "CLI path: $CLI_PATH"
|
|
32
|
+
echo "Script path: $SCRIPT_PATH"
|
|
33
|
+
echo "Log path: $LOG_PATH"
|
|
34
|
+
fi
|
|
35
|
+
|
|
36
|
+
cd $PROJECT_ROOT
|
|
37
|
+
# Run the pkgx-install script
|
|
38
|
+
if [[ $* == *--verbose* ]]; then
|
|
39
|
+
"$SCRIPT_PATH"
|
|
40
|
+
# bun --bun ./storage/framework/core/buddy/src/cli.ts setup --verbose
|
|
41
|
+
else
|
|
42
|
+
"$SCRIPT_PATH" > /dev/null 2>&1
|
|
43
|
+
# bun --bun ./storage/framework/core/buddy/src/cli.ts setup
|
|
44
|
+
fi
|
|
45
|
+
|
|
46
|
+
# Create a named pipe
|
|
47
|
+
mkfifo /tmp/mypipe
|
|
48
|
+
|
|
49
|
+
# Run the command, send output to both the console and the pipe
|
|
50
|
+
bun --bun $CLI_PATH setup | tee /tmp/mypipe &
|
|
51
|
+
|
|
52
|
+
# Read from the pipe, add timestamps, and append to the file
|
|
53
|
+
while IFS= read -r line; do echo "$(date '+[%Y-%m-%d %H:%M:%S]') $line"; done < /tmp/mypipe >> $LOG_PATH
|
|
54
|
+
|
|
55
|
+
# Remove the named pipe
|
|
56
|
+
rm /tmp/mypipe
|
|
57
|
+
`
|
|
58
|
+
|
|
59
|
+
return {
|
|
60
|
+
statusCode: 200,
|
|
61
|
+
body: setupScriptContents,
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
module.exports = {
|
|
66
|
+
handler,
|
|
67
|
+
}
|
package/core/cloud/src/index.ts
CHANGED