create-astratra-app 1.0.0 → 1.0.2
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/package.json +4 -1
- package/src/createProject.js +22 -10
package/package.json
CHANGED
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-astratra-app",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.2",
|
|
4
4
|
"description": "CLI generator for new Astratra SaaS applications.",
|
|
5
|
+
"engines": {
|
|
6
|
+
"node": ">=20"
|
|
7
|
+
},
|
|
5
8
|
"type": "module",
|
|
6
9
|
"bin": {
|
|
7
10
|
"create-astratra-app": "bin/create-astratra-app.js"
|
package/src/createProject.js
CHANGED
|
@@ -29,9 +29,9 @@ function packageJson(projectName, template) {
|
|
|
29
29
|
const dependencies = {
|
|
30
30
|
'@astratra/ai': '^1.0.0',
|
|
31
31
|
'@astratra/core': '^1.0.0',
|
|
32
|
-
'@astratra/saas-kit': '^1.0.
|
|
33
|
-
'@astratra/security': '^1.0.
|
|
34
|
-
'@astratra/store-mongo': '^1.0.
|
|
32
|
+
'@astratra/saas-kit': '^1.0.1',
|
|
33
|
+
'@astratra/security': '^1.0.1',
|
|
34
|
+
'@astratra/store-mongo': '^1.0.1',
|
|
35
35
|
express: '^4.18.3',
|
|
36
36
|
mongoose: '^8.17.0'
|
|
37
37
|
};
|
|
@@ -131,11 +131,22 @@ listen(preferredPort);
|
|
|
131
131
|
}
|
|
132
132
|
|
|
133
133
|
function envConfig() {
|
|
134
|
-
return `
|
|
135
|
-
|
|
134
|
+
return `const nodeEnv = process.env.NODE_ENV || 'development';
|
|
135
|
+
const jwtSecret = process.env.JWT_SECRET || 'change-me-in-production';
|
|
136
|
+
|
|
137
|
+
function assertProductionEnv() {
|
|
138
|
+
if (nodeEnv === 'production' && jwtSecret === 'change-me-in-production') {
|
|
139
|
+
throw new Error('JWT_SECRET is required in production.');
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
assertProductionEnv();
|
|
144
|
+
|
|
145
|
+
export const env = {
|
|
146
|
+
nodeEnv,
|
|
136
147
|
port: process.env.PORT ? Number(process.env.PORT) : 0,
|
|
137
148
|
host: process.env.HOST || '127.0.0.1',
|
|
138
|
-
jwtSecret
|
|
149
|
+
jwtSecret,
|
|
139
150
|
legacyJwtSecret: process.env.LEGACY_JWT_SECRET || '',
|
|
140
151
|
jwtIssuer: process.env.JWT_ISSUER || '',
|
|
141
152
|
jwtAudience: process.env.JWT_AUDIENCE || '',
|
|
@@ -354,9 +365,10 @@ function settingsModule() {
|
|
|
354
365
|
function notificationsModule() {
|
|
355
366
|
return `export function createNotificationModule() {
|
|
356
367
|
return {
|
|
357
|
-
notify: async (
|
|
368
|
+
notify: async (userId, notification) => ({
|
|
358
369
|
delivered: true,
|
|
359
|
-
|
|
370
|
+
userId,
|
|
371
|
+
notification
|
|
360
372
|
})
|
|
361
373
|
};
|
|
362
374
|
}
|
|
@@ -373,9 +385,9 @@ function readApiUrl() {
|
|
|
373
385
|
try {
|
|
374
386
|
const configPath = path.resolve('.astratra/api.json');
|
|
375
387
|
const config = JSON.parse(fs.readFileSync(configPath, 'utf8'));
|
|
376
|
-
return config.apiUrl || '
|
|
388
|
+
return config.apiUrl || '';
|
|
377
389
|
} catch {
|
|
378
|
-
return '
|
|
390
|
+
return '';
|
|
379
391
|
}
|
|
380
392
|
}
|
|
381
393
|
|