create-basalt 1.1.0 → 1.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{chunk-XV5NMTXT.js → chunk-TYOPE3RU.js} +13 -5
- package/dist/cli.js +1 -1
- package/dist/index.js +1 -1
- package/package.json +1 -1
|
@@ -80,7 +80,7 @@ function tsconfigJson() {
|
|
|
80
80
|
`;
|
|
81
81
|
}
|
|
82
82
|
function envTs(options) {
|
|
83
|
-
return `import { defineEnv } from '@basaltkit/env'
|
|
83
|
+
return `import { defineEnv${options.auth ? ", secret" : ""} } from '@basaltkit/env'
|
|
84
84
|
import { z } from 'zod'
|
|
85
85
|
|
|
86
86
|
export const env = defineEnv({
|
|
@@ -88,7 +88,9 @@ export const env = defineEnv({
|
|
|
88
88
|
HOST: z.string().default('0.0.0.0'),
|
|
89
89
|
LOG_LEVEL: z.string().default('info'),
|
|
90
90
|
NODE_ENV: z.enum(['development', 'production', 'test']).default('development'),${options.auth ? `
|
|
91
|
-
|
|
91
|
+
// Signs JWTs and sessions. secret() is fail-closed: required in production
|
|
92
|
+
// (no fallback), rejected if it looks like a placeholder. Dev uses devDefault.
|
|
93
|
+
APP_SECRET: secret({ minLength: 32, devDefault: 'dev-only-insecure-secret-please-change-me' }),` : ""}
|
|
92
94
|
})
|
|
93
95
|
`;
|
|
94
96
|
}
|
|
@@ -97,20 +99,26 @@ function envExample(options) {
|
|
|
97
99
|
HOST=0.0.0.0
|
|
98
100
|
LOG_LEVEL=info
|
|
99
101
|
NODE_ENV=development
|
|
100
|
-
${options.auth ? "
|
|
102
|
+
${options.auth ? "# Required in production (the app refuses to boot without it).\n# Generate a strong one: openssl rand -base64 48\n# APP_SECRET=\n" : ""}`;
|
|
101
103
|
}
|
|
102
104
|
function appTs(options) {
|
|
103
105
|
const imports = [
|
|
104
106
|
`import { createApp } from '@basaltkit/core'`,
|
|
105
107
|
`import { configPlugin } from '@basaltkit/config'`,
|
|
106
108
|
`import { eventsPlugin } from '@basaltkit/events'`,
|
|
107
|
-
`import { fastifyPlugin } from '@basaltkit/fastify'`,
|
|
109
|
+
`import { fastifyPlugin, securityPlugin } from '@basaltkit/fastify'`,
|
|
108
110
|
`import { loggerPlugin } from '@basaltkit/logger'`
|
|
109
111
|
];
|
|
110
112
|
const plugins = [
|
|
111
113
|
`configPlugin({ app: { name: '${options.name}' } })`,
|
|
112
114
|
`loggerPlugin({ level: options.logLevel ?? 'info', ...(options.pretty ? { pretty: true } : {}) })`,
|
|
113
|
-
`eventsPlugin()
|
|
115
|
+
`eventsPlugin()`,
|
|
116
|
+
`securityPlugin({
|
|
117
|
+
// Secure response headers (HSTS, X-Frame-Options, nosniff, \u2026) are on by
|
|
118
|
+
// default. Turn on rate limiting and a CORS allow-list for production:
|
|
119
|
+
// rateLimit: { limit: 120, windowMs: 60_000 },
|
|
120
|
+
// cors: { origin: ['https://app.example.com'], credentials: true },
|
|
121
|
+
})`
|
|
114
122
|
];
|
|
115
123
|
let routesExpression = "appRoutes";
|
|
116
124
|
if (options.tenancy) {
|
package/dist/cli.js
CHANGED
package/dist/index.js
CHANGED
package/package.json
CHANGED