deploy-bbc 1.2.1 → 1.2.3
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 +142 -281
- package/dist/index.js +16870 -0
- package/dist/templates/base/.env.example +3 -0
- package/dist/templates/base/package.json +20 -0
- package/dist/templates/base/src/config/index.ts +8 -0
- package/dist/templates/base/src/routes/index.ts +12 -0
- package/dist/templates/base/src/types/index.ts +2 -0
- package/dist/templates/base-bun-native/.env.example +3 -0
- package/dist/templates/base-bun-native/package.json +19 -0
- package/dist/templates/base-bun-native/src/config/index.ts +8 -0
- package/dist/templates/base-bun-native/src/index.ts +50 -0
- package/dist/templates/base-bun-native/src/routes/index.ts +21 -0
- package/dist/templates/base-bun-native/src/types/index.ts +2 -0
- package/dist/templates/base-express/.env.example +3 -0
- package/dist/templates/base-express/package.json +21 -0
- package/dist/templates/base-express/src/config/index.ts +8 -0
- package/dist/templates/base-express/src/routes/index.ts +12 -0
- package/dist/templates/base-express/src/types/index.ts +2 -0
- package/dist/templates/templates/base/README.md +31 -0
- package/dist/templates/templates/base/src/index.ts +26 -0
- package/dist/templates/templates/base/src/middleware/error.ts +13 -0
- package/dist/templates/templates/base/src/middleware/logger.ts +8 -0
- package/dist/templates/templates/base/src/utils/env.ts +5 -0
- package/dist/templates/templates/base/tsconfig.json +20 -0
- package/dist/templates/templates/base-bun-native/README.md +31 -0
- package/dist/templates/templates/base-bun-native/src/middleware/error.ts +20 -0
- package/dist/templates/templates/base-bun-native/src/middleware/logger.ts +6 -0
- package/dist/templates/templates/base-bun-native/src/utils/env.ts +5 -0
- package/dist/templates/templates/base-bun-native/tsconfig.json +20 -0
- package/dist/templates/templates/base-express/README.md +31 -0
- package/dist/templates/templates/base-express/src/index.ts +27 -0
- package/dist/templates/templates/base-express/src/middleware/error.ts +15 -0
- package/dist/templates/templates/base-express/src/middleware/logger.ts +12 -0
- package/dist/templates/templates/base-express/src/utils/env.ts +5 -0
- package/dist/templates/templates/base-express/tsconfig.json +20 -0
- package/dist/templates/templates/extras/ai/anthropic/src/services/ai/anthropic.ts +0 -0
- package/dist/templates/templates/extras/ai/gemini/src/services/ai/gemini.ts +0 -0
- package/dist/templates/templates/extras/ai/openai/src/routes/ai/chat.ts +0 -0
- package/dist/templates/templates/extras/ai/openai/src/services/ai/openai.ts +0 -0
- package/dist/templates/templates/extras/ai/vercel-ai/src/routes/ai/generate.ts +0 -0
- package/dist/templates/templates/extras/ai/vercel-ai/src/routes/ai/stream.ts +0 -0
- package/dist/templates/templates/extras/ai/vercel-ai/src/services/ai/index.ts +0 -0
- package/dist/templates/templates/extras/auth/jwt/src/middleware/auth.ts +0 -0
- package/dist/templates/templates/extras/auth/jwt/src/routes/auth.ts +0 -0
- package/dist/templates/templates/extras/auth/jwt/src/utils/jwt.ts +0 -0
- package/dist/templates/templates/extras/auth/oauth/src/config/oauth.ts +0 -0
- package/dist/templates/templates/extras/auth/oauth/src/routes/auth.ts +0 -0
- package/dist/templates/templates/extras/auth/session/src/config/session.ts +0 -0
- package/dist/templates/templates/extras/auth/session/src/middleware/session.ts +0 -0
- package/dist/templates/templates/extras/cloud/aws/src/services/aws/s3.ts +0 -0
- package/dist/templates/templates/extras/cloud/aws/src/services/aws/ses.ts +0 -0
- package/dist/templates/templates/extras/cloud/azure/src/services/azure/blob.ts +0 -0
- package/dist/templates/templates/extras/cloud/cloudflare-r2/src/services/cloudflare/r2.ts +0 -0
- package/dist/templates/templates/extras/cloud/gcp/src/services/gcp/storage.ts +0 -0
- package/dist/templates/templates/extras/database/mongodb/src/db/index.ts +0 -0
- package/dist/templates/templates/extras/database/mongodb/src/db/models/user.model.ts +0 -0
- package/dist/templates/templates/extras/database/mysql/drizzle.config.ts +0 -0
- package/dist/templates/templates/extras/database/postgres/src/db/index.ts +0 -0
- package/dist/templates/templates/extras/database/redis/src/db/redis.ts +0 -0
- package/dist/templates/templates/extras/docs/scalar/src/openapi/index.ts +0 -0
- package/dist/templates/templates/extras/docs/scalar/src/routes/docs.ts +0 -0
- package/dist/templates/templates/extras/docs/swagger/src/openapi/index.ts +0 -0
- package/dist/templates/templates/extras/docs/swagger/src/routes/docs.ts +0 -0
- package/dist/templates/templates/extras/email/nodemailer/src/services/email/nodemailer.ts +0 -0
- package/dist/templates/templates/extras/email/resend/src/services/email/resend.ts +0 -0
- package/dist/templates/templates/extras/email/resend/src/templates/email/welcome.ts +0 -0
- package/dist/templates/templates/extras/email/sendgrid/src/services/email/sendgrid.ts +0 -0
- package/dist/templates/templates/extras/observability/logtail/src/config/logger.ts +0 -0
- package/dist/templates/templates/extras/observability/sentry/src/config/sentry.ts +0 -0
- package/dist/templates/templates/extras/observability/sentry/src/middleware/sentry.ts +0 -0
- package/dist/templates/templates/extras/queue/bullmq/src/queue/index.ts +0 -0
- package/dist/templates/templates/extras/queue/bullmq/src/queue/jobs/email.job.ts +0 -0
- package/dist/templates/templates/extras/queue/bullmq/src/queue/processors/email.processor.ts +0 -0
- package/dist/templates/templates/extras/queue/bullmq/src/routes/queue.ts +0 -0
- package/dist/templates/templates/extras/queue/inngest/src/inngest/client.ts +0 -0
- package/dist/templates/templates/extras/queue/inngest/src/inngest/functions/email.ts +0 -0
- package/dist/templates/templates/extras/queue/inngest/src/routes/inngest.ts +0 -0
- package/dist/templates/templates/extras/realtime/socketio/src/socket/handlers.ts +0 -0
- package/dist/templates/templates/extras/realtime/socketio/src/socket/index.ts +0 -0
- package/dist/templates/templates/extras/realtime/sse/src/routes/sse.ts +0 -0
- package/dist/templates/templates/extras/testing/vitest/src/__tests__/example.test.ts +0 -0
- package/dist/templates/templates/extras/testing/vitest/src/__tests__/setup.ts +0 -0
- package/dist/templates/templates/extras/testing/vitest/vitest.config.ts +0 -0
- package/dist/templates/templates/extras/validation/yup/src/middleware/index.ts +1 -0
- package/dist/templates/templates/extras/validation/yup/src/middleware/validate.ts +83 -0
- package/dist/templates/templates/extras/validation/yup/src/routes/users.ts +132 -0
- package/dist/templates/templates/extras/validation/zod/src/middleware/index.ts +1 -0
- package/dist/templates/templates/extras/validation/zod/src/middleware/validate.ts +80 -0
- package/dist/templates/templates/extras/validation/zod/src/routes/users.ts +128 -0
- package/package.json +43 -9
- package/.cspell.json +0 -38
- package/CLAUDE.md +0 -403
- package/cli/README.md +0 -345
- package/cli/package.json +0 -54
- package/cli/src/cli/index.ts +0 -454
- package/cli/src/helpers/create-project.ts +0 -66
- package/cli/src/helpers/generate-docker-compose.ts +0 -133
- package/cli/src/helpers/generate-dockerfile.ts +0 -45
- package/cli/src/helpers/init-git.ts +0 -33
- package/cli/src/helpers/install-dependencies.ts +0 -28
- package/cli/src/helpers/log-next-steps.ts +0 -87
- package/cli/src/helpers/scaffold-project.ts +0 -88
- package/cli/src/index.ts +0 -18
- package/cli/src/installers/ai.ts +0 -123
- package/cli/src/installers/auth.ts +0 -132
- package/cli/src/installers/base.ts +0 -16
- package/cli/src/installers/cloud.ts +0 -127
- package/cli/src/installers/database.ts +0 -212
- package/cli/src/installers/docs.ts +0 -93
- package/cli/src/installers/email.ts +0 -119
- package/cli/src/installers/env-variables.ts +0 -27
- package/cli/src/installers/index.ts +0 -145
- package/cli/src/installers/observability.ts +0 -103
- package/cli/src/installers/queue.ts +0 -103
- package/cli/src/installers/ratelimit.ts +0 -98
- package/cli/src/installers/realtime.ts +0 -79
- package/cli/src/installers/testing.ts +0 -88
- package/cli/src/installers/validation.ts +0 -85
- package/cli/src/types/index.ts +0 -126
- package/cli/src/utils/add-package-dependency.ts +0 -56
- package/cli/src/utils/dependency-version-map.ts +0 -85
- package/cli/src/utils/logger.ts +0 -19
- package/cli/src/utils/parse-name-and-path.ts +0 -71
- package/cli/src/utils/render-title.ts +0 -11
- package/cli/tsconfig.json +0 -35
- package/test-cli.sh +0 -56
- package/tsconfig.json +0 -15
- /package/{cli/src → dist}/templates/base/README.md +0 -0
- /package/{cli/src → dist}/templates/base/src/index.ts +0 -0
- /package/{cli/src → dist}/templates/base/src/middleware/error.ts +0 -0
- /package/{cli/src → dist}/templates/base/src/middleware/logger.ts +0 -0
- /package/{cli/src → dist}/templates/base/src/utils/env.ts +0 -0
- /package/{cli/src → dist}/templates/base/tsconfig.json +0 -0
- /package/{cli/src → dist}/templates/base-bun-native/README.md +0 -0
- /package/{cli/src → dist}/templates/base-bun-native/src/middleware/error.ts +0 -0
- /package/{cli/src → dist}/templates/base-bun-native/src/middleware/logger.ts +0 -0
- /package/{cli/src → dist}/templates/base-bun-native/src/utils/env.ts +0 -0
- /package/{cli/src → dist}/templates/base-bun-native/tsconfig.json +0 -0
- /package/{cli/src → dist}/templates/base-express/README.md +0 -0
- /package/{cli/src → dist}/templates/base-express/src/index.ts +0 -0
- /package/{cli/src → dist}/templates/base-express/src/middleware/error.ts +0 -0
- /package/{cli/src → dist}/templates/base-express/src/middleware/logger.ts +0 -0
- /package/{cli/src → dist}/templates/base-express/src/utils/env.ts +0 -0
- /package/{cli/src → dist}/templates/base-express/tsconfig.json +0 -0
- /package/{cli/src → dist}/templates/extras/ai/anthropic/src/routes/ai/claude.ts +0 -0
- /package/{cli/src → dist}/templates/extras/ai/anthropic/src/services/ai/anthropic.ts +0 -0
- /package/{cli/src → dist}/templates/extras/ai/gemini/src/services/ai/gemini.ts +0 -0
- /package/{cli/src → dist}/templates/extras/ai/openai/src/routes/ai/chat.ts +0 -0
- /package/{cli/src → dist}/templates/extras/ai/openai/src/services/ai/openai.ts +0 -0
- /package/{cli/src → dist}/templates/extras/ai/vercel-ai/src/routes/ai/generate.ts +0 -0
- /package/{cli/src → dist}/templates/extras/ai/vercel-ai/src/routes/ai/stream.ts +0 -0
- /package/{cli/src → dist}/templates/extras/ai/vercel-ai/src/services/ai/index.ts +0 -0
- /package/{cli/src → dist}/templates/extras/auth/jwt/src/middleware/auth.ts +0 -0
- /package/{cli/src → dist}/templates/extras/auth/jwt/src/routes/auth.ts +0 -0
- /package/{cli/src → dist}/templates/extras/auth/jwt/src/utils/jwt.ts +0 -0
- /package/{cli/src → dist}/templates/extras/auth/oauth/src/config/oauth.ts +0 -0
- /package/{cli/src → dist}/templates/extras/auth/oauth/src/routes/auth.ts +0 -0
- /package/{cli/src → dist}/templates/extras/auth/session/src/config/session.ts +0 -0
- /package/{cli/src → dist}/templates/extras/auth/session/src/middleware/session.ts +0 -0
- /package/{cli/src → dist}/templates/extras/cloud/aws/src/services/aws/s3.ts +0 -0
- /package/{cli/src → dist}/templates/extras/cloud/aws/src/services/aws/ses.ts +0 -0
- /package/{cli/src → dist}/templates/extras/cloud/azure/src/services/azure/blob.ts +0 -0
- /package/{cli/src → dist}/templates/extras/cloud/cloudflare-r2/src/services/cloudflare/r2.ts +0 -0
- /package/{cli/src → dist}/templates/extras/cloud/gcp/src/services/gcp/storage.ts +0 -0
- /package/{cli/src → dist}/templates/extras/database/mongodb/src/db/index.ts +0 -0
- /package/{cli/src → dist}/templates/extras/database/mongodb/src/db/models/user.model.ts +0 -0
- /package/{cli/src → dist}/templates/extras/database/mysql/drizzle.config.ts +0 -0
- /package/{cli/src → dist}/templates/extras/database/postgres/src/db/index.ts +0 -0
- /package/{cli/src → dist}/templates/extras/database/redis/src/db/redis.ts +0 -0
- /package/{cli/src → dist}/templates/extras/docs/scalar/src/openapi/index.ts +0 -0
- /package/{cli/src → dist}/templates/extras/docs/scalar/src/routes/docs.ts +0 -0
- /package/{cli/src → dist}/templates/extras/docs/swagger/src/openapi/index.ts +0 -0
- /package/{cli/src → dist}/templates/extras/docs/swagger/src/routes/docs.ts +0 -0
- /package/{cli/src → dist}/templates/extras/email/nodemailer/src/services/email/nodemailer.ts +0 -0
- /package/{cli/src → dist}/templates/extras/email/resend/src/services/email/resend.ts +0 -0
- /package/{cli/src → dist}/templates/extras/email/resend/src/templates/email/welcome.ts +0 -0
- /package/{cli/src → dist}/templates/extras/email/sendgrid/src/services/email/sendgrid.ts +0 -0
- /package/{cli/src → dist}/templates/extras/observability/logtail/src/config/logger.ts +0 -0
- /package/{cli/src → dist}/templates/extras/observability/sentry/src/config/sentry.ts +0 -0
- /package/{cli/src → dist}/templates/extras/observability/sentry/src/middleware/sentry.ts +0 -0
- /package/{cli/src → dist}/templates/extras/queue/bullmq/src/queue/index.ts +0 -0
- /package/{cli/src → dist}/templates/extras/queue/bullmq/src/queue/jobs/email.job.ts +0 -0
- /package/{cli/src → dist}/templates/extras/queue/bullmq/src/queue/processors/email.processor.ts +0 -0
- /package/{cli/src → dist}/templates/extras/queue/bullmq/src/routes/queue.ts +0 -0
- /package/{cli/src → dist}/templates/extras/queue/inngest/src/inngest/client.ts +0 -0
- /package/{cli/src → dist}/templates/extras/queue/inngest/src/inngest/functions/email.ts +0 -0
- /package/{cli/src → dist}/templates/extras/queue/inngest/src/routes/inngest.ts +0 -0
- /package/{cli/src → dist}/templates/extras/realtime/socketio/src/socket/handlers.ts +0 -0
- /package/{cli/src → dist}/templates/extras/realtime/socketio/src/socket/index.ts +0 -0
- /package/{cli/src → dist}/templates/extras/realtime/sse/src/routes/sse.ts +0 -0
- /package/{cli/src → dist}/templates/extras/testing/vitest/src/__tests__/example.test.ts +0 -0
- /package/{cli/src → dist}/templates/extras/testing/vitest/src/__tests__/setup.ts +0 -0
- /package/{cli/src → dist}/templates/extras/testing/vitest/vitest.config.ts +0 -0
- /package/{cli/src → dist}/templates/extras/validation/yup/src/middleware/index.ts +0 -0
- /package/{cli/src → dist}/templates/extras/validation/yup/src/middleware/validate.ts +0 -0
- /package/{cli/src → dist}/templates/extras/validation/yup/src/routes/users.ts +0 -0
- /package/{cli/src → dist}/templates/extras/validation/zod/src/middleware/index.ts +0 -0
- /package/{cli/src → dist}/templates/extras/validation/zod/src/middleware/validate.ts +0 -0
- /package/{cli/src → dist}/templates/extras/validation/zod/src/routes/users.ts +0 -0
- /package/{cli/src → dist/templates}/templates/base/.env.example +0 -0
- /package/{cli/src → dist/templates}/templates/base/package.json +0 -0
- /package/{cli/src → dist/templates}/templates/base/src/config/index.ts +0 -0
- /package/{cli/src → dist/templates}/templates/base/src/controllers/user/create-user.controller.ts +0 -0
- /package/{cli/src → dist/templates}/templates/base/src/controllers/user/delete-user.controller.ts +0 -0
- /package/{cli/src → dist/templates}/templates/base/src/controllers/user/get-user.controller.ts +0 -0
- /package/{cli/src → dist/templates}/templates/base/src/controllers/user/get-users.controller.ts +0 -0
- /package/{cli/src → dist/templates}/templates/base/src/controllers/user/update-user.controller.ts +0 -0
- /package/{cli/src → dist/templates}/templates/base/src/models/user.model.ts +0 -0
- /package/{cli/src → dist/templates}/templates/base/src/routes/index.ts +0 -0
- /package/{cli/src → dist/templates}/templates/base/src/routes/user.route.ts +0 -0
- /package/{cli/src → dist/templates}/templates/base/src/types/common/api-response.types.ts +0 -0
- /package/{cli/src → dist/templates}/templates/base/src/types/index.ts +0 -0
- /package/{cli/src → dist/templates}/templates/base/src/types/models/user.types.ts +0 -0
- /package/{cli/src → dist/templates}/templates/base-bun-native/.env.example +0 -0
- /package/{cli/src → dist/templates}/templates/base-bun-native/package.json +0 -0
- /package/{cli/src → dist/templates}/templates/base-bun-native/src/config/index.ts +0 -0
- /package/{cli/src → dist/templates}/templates/base-bun-native/src/controllers/user/create-user.controller.ts +0 -0
- /package/{cli/src → dist/templates}/templates/base-bun-native/src/controllers/user/delete-user.controller.ts +0 -0
- /package/{cli/src → dist/templates}/templates/base-bun-native/src/controllers/user/get-user.controller.ts +0 -0
- /package/{cli/src → dist/templates}/templates/base-bun-native/src/controllers/user/get-users.controller.ts +0 -0
- /package/{cli/src → dist/templates}/templates/base-bun-native/src/controllers/user/update-user.controller.ts +0 -0
- /package/{cli/src → dist/templates}/templates/base-bun-native/src/index.ts +0 -0
- /package/{cli/src → dist/templates}/templates/base-bun-native/src/models/user.model.ts +0 -0
- /package/{cli/src → dist/templates}/templates/base-bun-native/src/routes/index.ts +0 -0
- /package/{cli/src → dist/templates}/templates/base-bun-native/src/routes/user.route.ts +0 -0
- /package/{cli/src → dist/templates}/templates/base-bun-native/src/types/common/api-response.types.ts +0 -0
- /package/{cli/src → dist/templates}/templates/base-bun-native/src/types/index.ts +0 -0
- /package/{cli/src → dist/templates}/templates/base-bun-native/src/types/models/user.types.ts +0 -0
- /package/{cli/src → dist/templates}/templates/base-express/.env.example +0 -0
- /package/{cli/src → dist/templates}/templates/base-express/package.json +0 -0
- /package/{cli/src → dist/templates}/templates/base-express/src/config/index.ts +0 -0
- /package/{cli/src → dist/templates}/templates/base-express/src/controllers/user/create-user.controller.ts +0 -0
- /package/{cli/src → dist/templates}/templates/base-express/src/controllers/user/delete-user.controller.ts +0 -0
- /package/{cli/src → dist/templates}/templates/base-express/src/controllers/user/get-user.controller.ts +0 -0
- /package/{cli/src → dist/templates}/templates/base-express/src/controllers/user/get-users.controller.ts +0 -0
- /package/{cli/src → dist/templates}/templates/base-express/src/controllers/user/update-user.controller.ts +0 -0
- /package/{cli/src → dist/templates}/templates/base-express/src/models/user.model.ts +0 -0
- /package/{cli/src → dist/templates}/templates/base-express/src/routes/index.ts +0 -0
- /package/{cli/src → dist/templates}/templates/base-express/src/routes/user.route.ts +0 -0
- /package/{cli/src → dist/templates}/templates/base-express/src/types/common/api-response.types.ts +0 -0
- /package/{cli/src → dist/templates}/templates/base-express/src/types/index.ts +0 -0
- /package/{cli/src → dist/templates}/templates/base-express/src/types/models/user.types.ts +0 -0
- /package/{prettier.config.mjs → dist/templates/templates/extras/ai/anthropic/src/routes/ai/claude.ts} +0 -0
|
@@ -1,103 +0,0 @@
|
|
|
1
|
-
import path from "path";
|
|
2
|
-
import fs from "fs-extra";
|
|
3
|
-
import { fileURLToPath } from "url";
|
|
4
|
-
import { type InstallerOptions, AvailablePackages } from "../types/index.js";
|
|
5
|
-
import { add_package_dependency } from "../utils/add-package-dependency.js";
|
|
6
|
-
import { DEPENDENCY_VERSION_MAP } from "../utils/dependency-version-map.js";
|
|
7
|
-
|
|
8
|
-
const __filename = fileURLToPath(import.meta.url);
|
|
9
|
-
const __dirname = path.dirname(__filename);
|
|
10
|
-
|
|
11
|
-
/**
|
|
12
|
-
* Queue installer - handles BullMQ and Inngest.
|
|
13
|
-
*
|
|
14
|
-
* @param options - Installer options with selected packages
|
|
15
|
-
*/
|
|
16
|
-
export async function queue_installer(
|
|
17
|
-
options: InstallerOptions
|
|
18
|
-
): Promise<void> {
|
|
19
|
-
const { projectDir, packages } = options;
|
|
20
|
-
|
|
21
|
-
for (const pkg of packages) {
|
|
22
|
-
switch (pkg) {
|
|
23
|
-
case AvailablePackages.bullmq:
|
|
24
|
-
await install_bullmq(projectDir);
|
|
25
|
-
break;
|
|
26
|
-
case AvailablePackages.inngest:
|
|
27
|
-
await install_inngest(projectDir);
|
|
28
|
-
break;
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
async function install_bullmq(projectDir: string): Promise<void> {
|
|
34
|
-
const templateDir = path.resolve(
|
|
35
|
-
__dirname,
|
|
36
|
-
"templates/extras/queue/bullmq"
|
|
37
|
-
);
|
|
38
|
-
await copy_template_files(templateDir, projectDir);
|
|
39
|
-
|
|
40
|
-
await add_package_dependency(projectDir, {
|
|
41
|
-
bullmq: DEPENDENCY_VERSION_MAP["bullmq"],
|
|
42
|
-
});
|
|
43
|
-
|
|
44
|
-
await append_env_example(
|
|
45
|
-
projectDir,
|
|
46
|
-
"\n# BullMQ Configuration\nREDIS_HOST=localhost\nREDIS_PORT=6379\nREDIS_PASSWORD=\n"
|
|
47
|
-
);
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
async function install_inngest(projectDir: string): Promise<void> {
|
|
51
|
-
const templateDir = path.resolve(
|
|
52
|
-
__dirname,
|
|
53
|
-
"templates/extras/queue/inngest"
|
|
54
|
-
);
|
|
55
|
-
await copy_template_files(templateDir, projectDir);
|
|
56
|
-
|
|
57
|
-
await add_package_dependency(projectDir, {
|
|
58
|
-
inngest: DEPENDENCY_VERSION_MAP["inngest"],
|
|
59
|
-
});
|
|
60
|
-
|
|
61
|
-
await append_env_example(
|
|
62
|
-
projectDir,
|
|
63
|
-
"\n# Inngest Configuration\nINNGEST_EVENT_KEY=your-inngest-event-key\nINNGEST_SIGNING_KEY=your-inngest-signing-key\n"
|
|
64
|
-
);
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
async function copy_template_files(
|
|
68
|
-
templateDir: string,
|
|
69
|
-
projectDir: string
|
|
70
|
-
): Promise<void> {
|
|
71
|
-
if (!(await fs.pathExists(templateDir))) {
|
|
72
|
-
return;
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
const srcDir = path.join(templateDir, "src");
|
|
76
|
-
if (await fs.pathExists(srcDir)) {
|
|
77
|
-
const targetSrcDir = path.join(projectDir, "src");
|
|
78
|
-
await fs.copy(srcDir, targetSrcDir, {
|
|
79
|
-
overwrite: false,
|
|
80
|
-
errorOnExist: false,
|
|
81
|
-
});
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
const templateFiles = await fs.readdir(templateDir);
|
|
85
|
-
for (const file of templateFiles) {
|
|
86
|
-
if (file !== "src" && (file.endsWith(".ts") || file.endsWith(".json"))) {
|
|
87
|
-
const srcFile = path.join(templateDir, file);
|
|
88
|
-
const destFile = path.join(projectDir, file);
|
|
89
|
-
|
|
90
|
-
if (!(await fs.pathExists(destFile))) {
|
|
91
|
-
await fs.copy(srcFile, destFile);
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
async function append_env_example(
|
|
98
|
-
projectDir: string,
|
|
99
|
-
content: string
|
|
100
|
-
): Promise<void> {
|
|
101
|
-
const envPath = path.join(projectDir, ".env.example");
|
|
102
|
-
await fs.appendFile(envPath, content);
|
|
103
|
-
}
|
|
@@ -1,98 +0,0 @@
|
|
|
1
|
-
import path from "path";
|
|
2
|
-
import fs from "fs-extra";
|
|
3
|
-
import { fileURLToPath } from "url";
|
|
4
|
-
import { type InstallerOptions, AvailablePackages } from "../types/index.js";
|
|
5
|
-
import { add_package_dependency } from "../utils/add-package-dependency.js";
|
|
6
|
-
import { DEPENDENCY_VERSION_MAP } from "../utils/dependency-version-map.js";
|
|
7
|
-
|
|
8
|
-
const __filename = fileURLToPath(import.meta.url);
|
|
9
|
-
const __dirname = path.dirname(__filename);
|
|
10
|
-
|
|
11
|
-
/**
|
|
12
|
-
* Rate limit installer - handles Upstash Rate Limit and custom rate limiting.
|
|
13
|
-
*
|
|
14
|
-
* @param options - Installer options with selected packages
|
|
15
|
-
*/
|
|
16
|
-
export async function ratelimit_installer(
|
|
17
|
-
options: InstallerOptions
|
|
18
|
-
): Promise<void> {
|
|
19
|
-
const { projectDir, packages } = options;
|
|
20
|
-
|
|
21
|
-
for (const pkg of packages) {
|
|
22
|
-
switch (pkg) {
|
|
23
|
-
case AvailablePackages.upstashRateLimit:
|
|
24
|
-
await install_upstash_ratelimit(projectDir);
|
|
25
|
-
break;
|
|
26
|
-
case AvailablePackages.customRateLimit:
|
|
27
|
-
await install_custom_ratelimit(projectDir);
|
|
28
|
-
break;
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
async function install_upstash_ratelimit(projectDir: string): Promise<void> {
|
|
34
|
-
const templateDir = path.resolve(
|
|
35
|
-
__dirname,
|
|
36
|
-
"templates/extras/ratelimit/upstash"
|
|
37
|
-
);
|
|
38
|
-
await copy_template_files(templateDir, projectDir);
|
|
39
|
-
|
|
40
|
-
await add_package_dependency(projectDir, {
|
|
41
|
-
"@upstash/ratelimit": DEPENDENCY_VERSION_MAP["@upstash/ratelimit"],
|
|
42
|
-
"@upstash/redis": DEPENDENCY_VERSION_MAP["@upstash/redis"],
|
|
43
|
-
});
|
|
44
|
-
|
|
45
|
-
await append_env_example(
|
|
46
|
-
projectDir,
|
|
47
|
-
"\n# Upstash Rate Limit Configuration\nUPSTASH_REDIS_REST_URL=your-upstash-redis-rest-url\nUPSTASH_REDIS_REST_TOKEN=your-upstash-redis-rest-token\n"
|
|
48
|
-
);
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
async function install_custom_ratelimit(projectDir: string): Promise<void> {
|
|
52
|
-
const templateDir = path.resolve(
|
|
53
|
-
__dirname,
|
|
54
|
-
"templates/extras/ratelimit/custom"
|
|
55
|
-
);
|
|
56
|
-
await copy_template_files(templateDir, projectDir);
|
|
57
|
-
|
|
58
|
-
// Custom rate limit doesn't require external dependencies
|
|
59
|
-
// It uses built-in Hono middleware or custom implementation
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
async function copy_template_files(
|
|
63
|
-
templateDir: string,
|
|
64
|
-
projectDir: string
|
|
65
|
-
): Promise<void> {
|
|
66
|
-
if (!(await fs.pathExists(templateDir))) {
|
|
67
|
-
return;
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
const srcDir = path.join(templateDir, "src");
|
|
71
|
-
if (await fs.pathExists(srcDir)) {
|
|
72
|
-
const targetSrcDir = path.join(projectDir, "src");
|
|
73
|
-
await fs.copy(srcDir, targetSrcDir, {
|
|
74
|
-
overwrite: false,
|
|
75
|
-
errorOnExist: false,
|
|
76
|
-
});
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
const templateFiles = await fs.readdir(templateDir);
|
|
80
|
-
for (const file of templateFiles) {
|
|
81
|
-
if (file !== "src" && (file.endsWith(".ts") || file.endsWith(".json"))) {
|
|
82
|
-
const srcFile = path.join(templateDir, file);
|
|
83
|
-
const destFile = path.join(projectDir, file);
|
|
84
|
-
|
|
85
|
-
if (!(await fs.pathExists(destFile))) {
|
|
86
|
-
await fs.copy(srcFile, destFile);
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
async function append_env_example(
|
|
93
|
-
projectDir: string,
|
|
94
|
-
content: string
|
|
95
|
-
): Promise<void> {
|
|
96
|
-
const envPath = path.join(projectDir, ".env.example");
|
|
97
|
-
await fs.appendFile(envPath, content);
|
|
98
|
-
}
|
|
@@ -1,79 +0,0 @@
|
|
|
1
|
-
import path from "path";
|
|
2
|
-
import fs from "fs-extra";
|
|
3
|
-
import { fileURLToPath } from "url";
|
|
4
|
-
import { type InstallerOptions, AvailablePackages } from "../types/index.js";
|
|
5
|
-
import { add_package_dependency } from "../utils/add-package-dependency.js";
|
|
6
|
-
import { DEPENDENCY_VERSION_MAP } from "../utils/dependency-version-map.js";
|
|
7
|
-
|
|
8
|
-
const __filename = fileURLToPath(import.meta.url);
|
|
9
|
-
const __dirname = path.dirname(__filename);
|
|
10
|
-
|
|
11
|
-
/**
|
|
12
|
-
* Realtime installer - handles Socket.IO and Server-Sent Events (SSE).
|
|
13
|
-
*
|
|
14
|
-
* @param options - Installer options with selected packages
|
|
15
|
-
*/
|
|
16
|
-
export async function realtime_installer(
|
|
17
|
-
options: InstallerOptions
|
|
18
|
-
): Promise<void> {
|
|
19
|
-
const { projectDir, packages } = options;
|
|
20
|
-
|
|
21
|
-
for (const pkg of packages) {
|
|
22
|
-
switch (pkg) {
|
|
23
|
-
case AvailablePackages.socketio:
|
|
24
|
-
await install_socketio(projectDir);
|
|
25
|
-
break;
|
|
26
|
-
case AvailablePackages.sse:
|
|
27
|
-
await install_sse(projectDir);
|
|
28
|
-
break;
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
async function install_socketio(projectDir: string): Promise<void> {
|
|
34
|
-
const templateDir = path.resolve(
|
|
35
|
-
__dirname,
|
|
36
|
-
"templates/extras/realtime/socketio"
|
|
37
|
-
);
|
|
38
|
-
await copy_template_files(templateDir, projectDir);
|
|
39
|
-
|
|
40
|
-
await add_package_dependency(projectDir, {
|
|
41
|
-
"socket.io": DEPENDENCY_VERSION_MAP["socket.io"],
|
|
42
|
-
});
|
|
43
|
-
|
|
44
|
-
await add_package_dependency(
|
|
45
|
-
projectDir,
|
|
46
|
-
{},
|
|
47
|
-
{
|
|
48
|
-
"@types/socket.io": DEPENDENCY_VERSION_MAP["@types/socket.io"],
|
|
49
|
-
}
|
|
50
|
-
);
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
async function install_sse(projectDir: string): Promise<void> {
|
|
54
|
-
const templateDir = path.resolve(
|
|
55
|
-
__dirname,
|
|
56
|
-
"templates/extras/realtime/sse"
|
|
57
|
-
);
|
|
58
|
-
await copy_template_files(templateDir, projectDir);
|
|
59
|
-
|
|
60
|
-
// SSE has no external dependencies, it's a native web standard
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
async function copy_template_files(
|
|
64
|
-
templateDir: string,
|
|
65
|
-
projectDir: string
|
|
66
|
-
): Promise<void> {
|
|
67
|
-
if (!(await fs.pathExists(templateDir))) {
|
|
68
|
-
return;
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
const srcDir = path.join(templateDir, "src");
|
|
72
|
-
if (await fs.pathExists(srcDir)) {
|
|
73
|
-
const targetSrcDir = path.join(projectDir, "src");
|
|
74
|
-
await fs.copy(srcDir, targetSrcDir, {
|
|
75
|
-
overwrite: false,
|
|
76
|
-
errorOnExist: false,
|
|
77
|
-
});
|
|
78
|
-
}
|
|
79
|
-
}
|
|
@@ -1,88 +0,0 @@
|
|
|
1
|
-
import path from "path";
|
|
2
|
-
import fs from "fs-extra";
|
|
3
|
-
import { fileURLToPath } from "url";
|
|
4
|
-
import { type InstallerOptions, AvailablePackages } from "../types/index.js";
|
|
5
|
-
import { add_package_dependency } from "../utils/add-package-dependency.js";
|
|
6
|
-
import { DEPENDENCY_VERSION_MAP } from "../utils/dependency-version-map.js";
|
|
7
|
-
|
|
8
|
-
const __filename = fileURLToPath(import.meta.url);
|
|
9
|
-
const __dirname = path.dirname(__filename);
|
|
10
|
-
|
|
11
|
-
/**
|
|
12
|
-
* Testing installer - handles Vitest testing framework.
|
|
13
|
-
*
|
|
14
|
-
* @param options - Installer options with selected packages
|
|
15
|
-
*/
|
|
16
|
-
export async function testing_installer(
|
|
17
|
-
options: InstallerOptions
|
|
18
|
-
): Promise<void> {
|
|
19
|
-
const { projectDir, packages } = options;
|
|
20
|
-
|
|
21
|
-
for (const pkg of packages) {
|
|
22
|
-
switch (pkg) {
|
|
23
|
-
case AvailablePackages.vitest:
|
|
24
|
-
await install_vitest(projectDir);
|
|
25
|
-
break;
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
async function install_vitest(projectDir: string): Promise<void> {
|
|
31
|
-
const templateDir = path.resolve(
|
|
32
|
-
__dirname,
|
|
33
|
-
"templates/extras/testing/vitest"
|
|
34
|
-
);
|
|
35
|
-
await copy_template_files(templateDir, projectDir);
|
|
36
|
-
|
|
37
|
-
await add_package_dependency(projectDir, {
|
|
38
|
-
vitest: DEPENDENCY_VERSION_MAP["vitest"],
|
|
39
|
-
"@vitest/ui": DEPENDENCY_VERSION_MAP["@vitest/ui"],
|
|
40
|
-
supertest: DEPENDENCY_VERSION_MAP["supertest"],
|
|
41
|
-
});
|
|
42
|
-
|
|
43
|
-
await add_package_dependency(
|
|
44
|
-
projectDir,
|
|
45
|
-
{},
|
|
46
|
-
{
|
|
47
|
-
"@types/supertest": DEPENDENCY_VERSION_MAP["@types/supertest"],
|
|
48
|
-
}
|
|
49
|
-
);
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
async function copy_template_files(
|
|
53
|
-
templateDir: string,
|
|
54
|
-
projectDir: string
|
|
55
|
-
): Promise<void> {
|
|
56
|
-
if (!(await fs.pathExists(templateDir))) {
|
|
57
|
-
return;
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
const srcDir = path.join(templateDir, "src");
|
|
61
|
-
if (await fs.pathExists(srcDir)) {
|
|
62
|
-
const targetSrcDir = path.join(projectDir, "src");
|
|
63
|
-
await fs.copy(srcDir, targetSrcDir, {
|
|
64
|
-
overwrite: false,
|
|
65
|
-
errorOnExist: false,
|
|
66
|
-
});
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
const templateFiles = await fs.readdir(templateDir);
|
|
70
|
-
for (const file of templateFiles) {
|
|
71
|
-
if (file !== "src" && (file.endsWith(".ts") || file.endsWith(".json"))) {
|
|
72
|
-
const srcFile = path.join(templateDir, file);
|
|
73
|
-
const destFile = path.join(projectDir, file);
|
|
74
|
-
|
|
75
|
-
if (!(await fs.pathExists(destFile))) {
|
|
76
|
-
await fs.copy(srcFile, destFile);
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
async function append_env_example(
|
|
83
|
-
projectDir: string,
|
|
84
|
-
content: string
|
|
85
|
-
): Promise<void> {
|
|
86
|
-
const envPath = path.join(projectDir, ".env.example");
|
|
87
|
-
await fs.appendFile(envPath, content);
|
|
88
|
-
}
|
|
@@ -1,85 +0,0 @@
|
|
|
1
|
-
import path from "path";
|
|
2
|
-
import fs from "fs-extra";
|
|
3
|
-
import { fileURLToPath } from "url";
|
|
4
|
-
import { type InstallerOptions, AvailablePackages } from "../types/index.js";
|
|
5
|
-
import { add_package_dependency } from "../utils/add-package-dependency.js";
|
|
6
|
-
import { DEPENDENCY_VERSION_MAP } from "../utils/dependency-version-map.js";
|
|
7
|
-
|
|
8
|
-
const __filename = fileURLToPath(import.meta.url);
|
|
9
|
-
const __dirname = path.dirname(__filename);
|
|
10
|
-
|
|
11
|
-
/**
|
|
12
|
-
* Validation installer - handles Zod and Yup validation libraries.
|
|
13
|
-
*
|
|
14
|
-
* @param options - Installer options with selected packages
|
|
15
|
-
*/
|
|
16
|
-
export async function validation_installer(
|
|
17
|
-
options: InstallerOptions
|
|
18
|
-
): Promise<void> {
|
|
19
|
-
const { projectDir, packages } = options;
|
|
20
|
-
|
|
21
|
-
for (const pkg of packages) {
|
|
22
|
-
switch (pkg) {
|
|
23
|
-
case AvailablePackages.zod:
|
|
24
|
-
await install_zod(projectDir);
|
|
25
|
-
break;
|
|
26
|
-
case AvailablePackages.yup:
|
|
27
|
-
await install_yup(projectDir);
|
|
28
|
-
break;
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
async function install_zod(projectDir: string): Promise<void> {
|
|
34
|
-
const templateDir = path.resolve(
|
|
35
|
-
__dirname,
|
|
36
|
-
"templates/extras/validation/zod"
|
|
37
|
-
);
|
|
38
|
-
await copy_template_files(templateDir, projectDir);
|
|
39
|
-
|
|
40
|
-
await add_package_dependency(projectDir, {
|
|
41
|
-
zod: DEPENDENCY_VERSION_MAP["zod"],
|
|
42
|
-
});
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
async function install_yup(projectDir: string): Promise<void> {
|
|
46
|
-
const templateDir = path.resolve(
|
|
47
|
-
__dirname,
|
|
48
|
-
"templates/extras/validation/yup"
|
|
49
|
-
);
|
|
50
|
-
await copy_template_files(templateDir, projectDir);
|
|
51
|
-
|
|
52
|
-
await add_package_dependency(projectDir, {
|
|
53
|
-
yup: DEPENDENCY_VERSION_MAP["yup"],
|
|
54
|
-
});
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
async function copy_template_files(
|
|
58
|
-
templateDir: string,
|
|
59
|
-
projectDir: string
|
|
60
|
-
): Promise<void> {
|
|
61
|
-
if (!(await fs.pathExists(templateDir))) {
|
|
62
|
-
return;
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
const srcDir = path.join(templateDir, "src");
|
|
66
|
-
if (await fs.pathExists(srcDir)) {
|
|
67
|
-
const targetSrcDir = path.join(projectDir, "src");
|
|
68
|
-
await fs.copy(srcDir, targetSrcDir, {
|
|
69
|
-
overwrite: false,
|
|
70
|
-
errorOnExist: false,
|
|
71
|
-
});
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
const templateFiles = await fs.readdir(templateDir);
|
|
75
|
-
for (const file of templateFiles) {
|
|
76
|
-
if (file !== "src" && (file.endsWith(".ts") || file.endsWith(".json"))) {
|
|
77
|
-
const srcFile = path.join(templateDir, file);
|
|
78
|
-
const destFile = path.join(projectDir, file);
|
|
79
|
-
|
|
80
|
-
if (!(await fs.pathExists(destFile))) {
|
|
81
|
-
await fs.copy(srcFile, destFile);
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
}
|
package/cli/src/types/index.ts
DELETED
|
@@ -1,126 +0,0 @@
|
|
|
1
|
-
export interface CliFlags {
|
|
2
|
-
noGit: boolean;
|
|
3
|
-
noInstall: boolean;
|
|
4
|
-
default: boolean;
|
|
5
|
-
CI: boolean;
|
|
6
|
-
|
|
7
|
-
// Database flags
|
|
8
|
-
postgres?: boolean;
|
|
9
|
-
mysql?: boolean;
|
|
10
|
-
mongodb?: boolean;
|
|
11
|
-
redis?: boolean;
|
|
12
|
-
|
|
13
|
-
// Auth flags
|
|
14
|
-
jwt?: boolean;
|
|
15
|
-
oauth?: boolean;
|
|
16
|
-
session?: boolean;
|
|
17
|
-
|
|
18
|
-
// AI flags
|
|
19
|
-
openai?: boolean;
|
|
20
|
-
anthropic?: boolean;
|
|
21
|
-
gemini?: boolean;
|
|
22
|
-
vercelAI?: boolean;
|
|
23
|
-
|
|
24
|
-
// Cloud flags
|
|
25
|
-
aws?: boolean;
|
|
26
|
-
gcp?: boolean;
|
|
27
|
-
azure?: boolean;
|
|
28
|
-
cloudflareR2?: boolean;
|
|
29
|
-
|
|
30
|
-
// Communication flags
|
|
31
|
-
resend?: boolean;
|
|
32
|
-
sendgrid?: boolean;
|
|
33
|
-
nodemailer?: boolean;
|
|
34
|
-
socketio?: boolean;
|
|
35
|
-
sse?: boolean;
|
|
36
|
-
|
|
37
|
-
// Infrastructure flags
|
|
38
|
-
bullmq?: boolean;
|
|
39
|
-
inngest?: boolean;
|
|
40
|
-
upstashRateLimit?: boolean;
|
|
41
|
-
customRateLimit?: boolean;
|
|
42
|
-
sentry?: boolean;
|
|
43
|
-
logtail?: boolean;
|
|
44
|
-
|
|
45
|
-
// DevX flags
|
|
46
|
-
swagger?: boolean;
|
|
47
|
-
scalar?: boolean;
|
|
48
|
-
vitest?: boolean;
|
|
49
|
-
|
|
50
|
-
// Validation flags
|
|
51
|
-
zod?: boolean;
|
|
52
|
-
yup?: boolean;
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
export type Framework = "hono" | "express" | "bun-native";
|
|
56
|
-
|
|
57
|
-
export interface CliResults {
|
|
58
|
-
appName: string;
|
|
59
|
-
framework: Framework;
|
|
60
|
-
packages: AvailablePackages[];
|
|
61
|
-
flags: CliFlags;
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
export enum AvailablePackages {
|
|
65
|
-
// Core
|
|
66
|
-
postgres = "postgres",
|
|
67
|
-
mysql = "mysql",
|
|
68
|
-
mongodb = "mongodb",
|
|
69
|
-
redis = "redis",
|
|
70
|
-
jwt = "jwt",
|
|
71
|
-
oauth = "oauth",
|
|
72
|
-
session = "session",
|
|
73
|
-
|
|
74
|
-
// AI & ML
|
|
75
|
-
openai = "openai",
|
|
76
|
-
anthropic = "anthropic",
|
|
77
|
-
gemini = "gemini",
|
|
78
|
-
vercelAI = "vercel-ai",
|
|
79
|
-
|
|
80
|
-
// Cloud & Storage
|
|
81
|
-
aws = "aws",
|
|
82
|
-
gcp = "gcp",
|
|
83
|
-
azure = "azure",
|
|
84
|
-
cloudflareR2 = "cloudflare-r2",
|
|
85
|
-
|
|
86
|
-
// Communications
|
|
87
|
-
resend = "resend",
|
|
88
|
-
sendgrid = "sendgrid",
|
|
89
|
-
nodemailer = "nodemailer",
|
|
90
|
-
socketio = "socketio",
|
|
91
|
-
sse = "sse",
|
|
92
|
-
|
|
93
|
-
// Infrastructure
|
|
94
|
-
bullmq = "bullmq",
|
|
95
|
-
inngest = "inngest",
|
|
96
|
-
upstashRateLimit = "upstash-ratelimit",
|
|
97
|
-
customRateLimit = "custom-ratelimit",
|
|
98
|
-
sentry = "sentry",
|
|
99
|
-
logtail = "logtail",
|
|
100
|
-
|
|
101
|
-
// Developer Experience
|
|
102
|
-
swagger = "swagger",
|
|
103
|
-
scalar = "scalar",
|
|
104
|
-
vitest = "vitest",
|
|
105
|
-
|
|
106
|
-
// Validation
|
|
107
|
-
zod = "zod",
|
|
108
|
-
yup = "yup",
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
export interface InstallerOptions {
|
|
112
|
-
projectDir: string;
|
|
113
|
-
packages: AvailablePackages[];
|
|
114
|
-
appName: string;
|
|
115
|
-
framework: Framework;
|
|
116
|
-
noInstall: boolean;
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
export type Installer = (opts: InstallerOptions) => Promise<void>;
|
|
120
|
-
|
|
121
|
-
export interface PkgInstallerMap {
|
|
122
|
-
[key: string]: {
|
|
123
|
-
inUse: boolean;
|
|
124
|
-
installer: Installer;
|
|
125
|
-
};
|
|
126
|
-
}
|
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
import path from "path";
|
|
2
|
-
import fs from "fs-extra";
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* Adds dependencies to a project's package.json file.
|
|
6
|
-
* Reads the file, merges dependencies, sorts keys alphabetically, and writes back.
|
|
7
|
-
*
|
|
8
|
-
* @param projectDir - Absolute path to the project directory
|
|
9
|
-
* @param dependencies - Dependencies to add to the "dependencies" section
|
|
10
|
-
* @param devDependencies - Optional dev dependencies to add to "devDependencies" section
|
|
11
|
-
*/
|
|
12
|
-
export async function add_package_dependency(
|
|
13
|
-
projectDir: string,
|
|
14
|
-
dependencies: Record<string, string>,
|
|
15
|
-
devDependencies?: Record<string, string>
|
|
16
|
-
): Promise<void> {
|
|
17
|
-
const packageJsonPath = path.join(projectDir, "package.json");
|
|
18
|
-
|
|
19
|
-
// Read existing package.json
|
|
20
|
-
const packageJson = await fs.readJson(packageJsonPath);
|
|
21
|
-
|
|
22
|
-
// Merge dependencies
|
|
23
|
-
if (dependencies && Object.keys(dependencies).length > 0) {
|
|
24
|
-
packageJson.dependencies = {
|
|
25
|
-
...packageJson.dependencies,
|
|
26
|
-
...dependencies,
|
|
27
|
-
};
|
|
28
|
-
|
|
29
|
-
// Sort dependencies alphabetically
|
|
30
|
-
packageJson.dependencies = Object.keys(packageJson.dependencies)
|
|
31
|
-
.sort()
|
|
32
|
-
.reduce((acc: Record<string, string>, key: string) => {
|
|
33
|
-
acc[key] = packageJson.dependencies[key];
|
|
34
|
-
return acc;
|
|
35
|
-
}, {});
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
// Merge devDependencies
|
|
39
|
-
if (devDependencies && Object.keys(devDependencies).length > 0) {
|
|
40
|
-
packageJson.devDependencies = {
|
|
41
|
-
...packageJson.devDependencies,
|
|
42
|
-
...devDependencies,
|
|
43
|
-
};
|
|
44
|
-
|
|
45
|
-
// Sort devDependencies alphabetically
|
|
46
|
-
packageJson.devDependencies = Object.keys(packageJson.devDependencies)
|
|
47
|
-
.sort()
|
|
48
|
-
.reduce((acc: Record<string, string>, key: string) => {
|
|
49
|
-
acc[key] = packageJson.devDependencies[key];
|
|
50
|
-
return acc;
|
|
51
|
-
}, {});
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
// Write back to package.json with proper formatting
|
|
55
|
-
await fs.writeJson(packageJsonPath, packageJson, { spaces: 2 });
|
|
56
|
-
}
|