create-pardx-scaffold 0.1.6 → 0.1.7

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-pardx-scaffold",
3
- "version": "0.1.6",
3
+ "version": "0.1.7",
4
4
  "description": "Scaffold a new project from PardxAI monorepo (git-tracked files)",
5
5
  "license": "MIT",
6
6
  "bin": "./cli.js",
@@ -38,6 +38,7 @@ const rl = readline.createInterface({
38
38
  const question = (query) => new Promise((resolve) => rl.question(query, resolve));
39
39
 
40
40
  // Project configuration
41
+ // 注意:API 端口在 apps/api/config.local.yaml 的 app.port 配置;Web 端口由 Next.js 自动配置,此处不配置
41
42
  const config = {
42
43
  projectName: '',
43
44
  projectDescription: '',
@@ -48,8 +49,6 @@ const config = {
48
49
  redisUrl: '',
49
50
  rabbitmqUrl: '',
50
51
  baseHost: '127.0.0.1',
51
- apiPort: '',
52
- webPort: '',
53
52
  };
54
53
 
55
54
  async function main() {
@@ -84,16 +83,6 @@ async function main() {
84
83
 
85
84
  log.header('\n📦 Configuration');
86
85
 
87
- config.apiPort = await question(
88
- `${colors.cyan}API port${colors.reset} [3100]: `
89
- );
90
- config.apiPort = config.apiPort.trim() || '3100';
91
-
92
- config.webPort = await question(
93
- `${colors.cyan}Web port${colors.reset} [3000]: `
94
- );
95
- config.webPort = config.webPort.trim() || '3000';
96
-
97
86
  config.databaseUrl = await question(
98
87
  `${colors.cyan}Database URL${colors.reset} [postgresql://user:password@localhost:5432/dbname]: `
99
88
  );
@@ -126,8 +115,6 @@ async function main() {
126
115
  console.log(` Project Name: ${colors.green}${config.projectName}${colors.reset}`);
127
116
  console.log(` Description: ${config.projectDescription}`);
128
117
  console.log(` Author: ${config.authorName} <${config.authorEmail}>`);
129
- console.log(` API Port: ${config.apiPort}`);
130
- console.log(` Web Port: ${config.webPort}`);
131
118
  console.log(` Base Host: ${config.baseHost}`);
132
119
  console.log(` Database: ${config.databaseUrl}`);
133
120
  console.log(` Read DB: ${config.readDatabaseUrl}`);
@@ -237,14 +224,13 @@ function createEnvFromExample(rootDir, config) {
237
224
  const webExamplePath = path.join(rootDir, 'apps/web/.env.example');
238
225
 
239
226
  // 变量替换映射(apps/api),参考 apps/api/.env.example
227
+ // API 端口由 apps/api/config.local.yaml 的 app.port 配置,此处不覆盖 API_BASE_URL / INTERNAL_API_BASE_URL
240
228
  const apiReplacements = {
241
229
  BASE_HOST: config.baseHost,
242
230
  DATABASE_URL: config.databaseUrl,
243
231
  READ_DATABASE_URL: config.readDatabaseUrl,
244
232
  REDIS_URL: config.redisUrl,
245
233
  RABBITMQ_URL: config.rabbitmqUrl,
246
- API_BASE_URL: `http://localhost:${config.apiPort}/api`,
247
- INTERNAL_API_BASE_URL: `http://127.0.0.1:${config.apiPort}/api`,
248
234
  };
249
235
 
250
236
  if (fs.existsSync(apiExamplePath)) {
@@ -281,15 +267,11 @@ function createEnvFromExample(rootDir, config) {
281
267
  REDIS_URL: config.redisUrl,
282
268
  RABBITMQ_URL: config.rabbitmqUrl,
283
269
  JWT_SECRET: generateRandomSecret(),
284
- API_BASE_URL: `http://localhost:${config.apiPort}/api`,
285
- INTERNAL_API_BASE_URL: `http://127.0.0.1:${config.apiPort}/api`,
286
270
  });
287
271
  }
288
272
 
289
- // apps/web
290
- const webReplacements = {
291
- NEXT_PUBLIC_API_BASE_URL: `http://localhost:${config.apiPort}/api`,
292
- };
273
+ // apps/web:NEXT_PUBLIC_API_BASE_URL 等由 .env.example 提供,Next.js 端口自动配置,此处不覆盖
274
+ const webReplacements = {};
293
275
 
294
276
  if (fs.existsSync(webExamplePath)) {
295
277
  const content = fs.readFileSync(webExamplePath, 'utf8');
@@ -309,9 +291,7 @@ function createEnvFromExample(rootDir, config) {
309
291
  outLines.join('\n') + '\n'
310
292
  );
311
293
  } else {
312
- createEnvFile(path.join(rootDir, 'apps/web/.env.local'), {
313
- NEXT_PUBLIC_API_BASE_URL: `http://localhost:${config.apiPort}/api`,
314
- });
294
+ createEnvFile(path.join(rootDir, 'apps/web/.env.local'), {});
315
295
  }
316
296
  }
317
297