@monodog/backend 1.4.5 → 1.4.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/dist/cli.js CHANGED
@@ -117,7 +117,7 @@ if (serve) {
117
117
  }
118
118
  else {
119
119
  console.log(`\nInitializing Configurations...`);
120
- createConfigFileIfMissing(rootPath ?? process.cwd());
120
+ // createConfigFileIfMissing(rootPath ?? process.cwd());
121
121
  copyPackageToWorkspace(rootPath);
122
122
  console.log(`Monodog CLI: No operation specified. Use --serve to start the API or -h for help. Ex: pnpm monodog-cli @monodog/dashboard --serve --root .`);
123
123
  }
@@ -50,17 +50,12 @@ function loadConfig() {
50
50
  // 1. Determine the path to the config file
51
51
  // We assume the backend package is running from the monorepo root (cwd is root)
52
52
  // or that we can navigate up to the root from the current file's location.
53
- let rootPath = path.resolve(process.cwd()); // Adjust based on your workspace folder depth from root if needed
53
+ let rootPath = path.resolve(process.cwd(), '..', '..'); // Adjust based on your workspace folder depth from root if needed
54
54
  let configPath = path.resolve(rootPath, 'monodog-conf.json');
55
- // createConfigFileIfMissing(rootPath);
55
+ createConfigFileIfMissing(rootPath);
56
56
  if (!fs.existsSync(configPath)) {
57
57
  console.error(`ERROR1: Configuration file not found at ${configPath}`);
58
- configPath = path.resolve(path.resolve('../../'), 'monodog-conf.json'); //get root config, Adjust based on your workspace folder depth from root if needed
59
- if (!fs.existsSync(configPath)) {
60
- console.error(`ERROR2: Configuration file not found at ${configPath}`);
61
- configPath = path.resolve(rootPath, 'monodog-conf.json');
62
- process.exit(1);
63
- }
58
+ process.exit(1);
64
59
  }
65
60
  try {
66
61
  // 2. Read and parse the JSON file
@@ -69,7 +64,7 @@ function loadConfig() {
69
64
  // 3. Optional: Add validation logic here (e.g., check if ports are numbers)
70
65
  // Cache and return
71
66
  config = parsedConfig;
72
- process.stderr.write(`[Config] Loaded configuration from: ${configPath}`);
67
+ process.stderr.write('[Config] Loaded configuration from: ...\n');
73
68
  return config;
74
69
  }
75
70
  catch (error) {
@@ -98,16 +93,16 @@ function createConfigFileIfMissing(rootPath) {
98
93
  };
99
94
  const contentString = JSON.stringify(defaultContent, null, 2);
100
95
  // ---------------------
101
- console.log(`\n[monodog] Checking for ${configFileName}...`);
96
+ process.stderr.write(`\n[monodog] Checking for ${configFileName}...`);
102
97
  if (fs.existsSync(configFilePath)) {
103
- console.log(`[monodog] ${configFileName} already exists. Skipping creation.`);
98
+ process.stderr.write(`[monodog] ${configFileName} already exists. Skipping creation.`);
104
99
  }
105
100
  else {
106
101
  try {
107
102
  // Write the default content to the file
108
103
  fs.writeFileSync(configFilePath, contentString, 'utf-8');
109
- console.log(`[monodog] Successfully generated default ${configFileName} in the workspace root.`);
110
- console.log('[monodog] Please review and update settings like "host" and "port".');
104
+ process.stderr.write(`[monodog] Successfully generated default ${configFileName} in the workspace root.`);
105
+ process.stderr.write('[monodog] Please review and update settings like "host" and "port".');
111
106
  }
112
107
  catch (err) {
113
108
  const message = err instanceof Error ? err.message : String(err);
@@ -5,7 +5,6 @@ function generateUrl() {
5
5
  const appConfig = (0, config_loader_1.loadConfig)();
6
6
  const DATABASE_URL = `${appConfig.database.path}`;
7
7
  process.env.DATABASE_URL = DATABASE_URL;
8
- process.env.DATABASE_PORT = `${appConfig.database.port}`;
9
8
  process.stdout.write(DATABASE_URL);
10
9
  }
11
10
  generateUrl();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@monodog/backend",
3
- "version": "1.4.5",
3
+ "version": "1.4.7",
4
4
  "description": "Backend API server for monodog monorepo dashboard",
5
5
  "license": "MIT",
6
6
  "bin": {
@@ -20,7 +20,6 @@
20
20
  "generate": "DATABASE_URL=$(npm run db:url --silent 2>/dev/null | tr -d '\\n') prisma generate",
21
21
  "migrate": "DATABASE_URL=$(npm run db:url --silent 2>/dev/null | tr -d '\\n') prisma migrate dev",
22
22
  "serve": "DATABASE_URL=$(npm run db:url --silent 2>/dev/null | tr -d '\\n') node dist/cli.js --serve --root ../../" },
23
- "postinstall": "node -e \"const fs=require('fs'); const path=require('path'); const src='monodog-conf.example.json'; const dest=path.join(__dirname, '..', '..', '..', 'monodog-conf.json'); if (!fs.existsSync(dest)) fs.copyFileSync(path.join(__dirname, src), dest)\"",
24
23
  "dependencies": {
25
24
  "@monodog/ci-status": "1.1.1",
26
25
  "@monodog/monorepo-scanner": "1.0.7",
package/src/cli.ts CHANGED
@@ -90,7 +90,7 @@ if (serve) {
90
90
  } else {
91
91
  console.log(`\nInitializing Configurations...`);
92
92
 
93
- createConfigFileIfMissing(rootPath ?? process.cwd());
93
+ // createConfigFileIfMissing(rootPath ?? process.cwd());
94
94
  copyPackageToWorkspace(rootPath);
95
95
 
96
96
  console.log(`Monodog CLI: No operation specified. Use --serve to start the API or -h for help. Ex: pnpm monodog-cli @monodog/dashboard --serve --root .`);
@@ -36,18 +36,13 @@ export function loadConfig(): MonodogConfig {
36
36
  // 1. Determine the path to the config file
37
37
  // We assume the backend package is running from the monorepo root (cwd is root)
38
38
  // or that we can navigate up to the root from the current file's location.
39
- let rootPath = path.resolve(process.cwd()); // Adjust based on your workspace folder depth from root if needed
39
+ let rootPath = path.resolve(process.cwd(),'..','..'); // Adjust based on your workspace folder depth from root if needed
40
40
  let configPath = path.resolve(rootPath, 'monodog-conf.json');
41
- // createConfigFileIfMissing(rootPath);
41
+ createConfigFileIfMissing(rootPath);
42
42
 
43
43
  if (!fs.existsSync(configPath)) {
44
44
  console.error(`ERROR1: Configuration file not found at ${configPath}`);
45
- configPath = path.resolve(path.resolve('../../'), 'monodog-conf.json'); //get root config, Adjust based on your workspace folder depth from root if needed
46
- if (!fs.existsSync(configPath)) {
47
- console.error(`ERROR2: Configuration file not found at ${configPath}`);
48
- configPath = path.resolve(rootPath, 'monodog-conf.json');
49
45
  process.exit(1);
50
- }
51
46
  }
52
47
 
53
48
  try {
@@ -59,7 +54,7 @@ export function loadConfig(): MonodogConfig {
59
54
 
60
55
  // Cache and return
61
56
  config = parsedConfig;
62
- process.stderr.write(`[Config] Loaded configuration from: ${configPath}`);
57
+ process.stderr.write('[Config] Loaded configuration from: ...\n');
63
58
  return config;
64
59
 
65
60
  } catch (error) {
@@ -93,16 +88,16 @@ const defaultContent = {
93
88
  const contentString = JSON.stringify(defaultContent, null, 2);
94
89
  // ---------------------
95
90
 
96
- console.log(`\n[monodog] Checking for ${configFileName}...`);
91
+ process.stderr.write(`\n[monodog] Checking for ${configFileName}...`);
97
92
 
98
93
  if (fs.existsSync(configFilePath)) {
99
- console.log(`[monodog] ${configFileName} already exists. Skipping creation.`);
94
+ process.stderr.write(`[monodog] ${configFileName} already exists. Skipping creation.`);
100
95
  } else {
101
96
  try {
102
97
  // Write the default content to the file
103
98
  fs.writeFileSync(configFilePath, contentString, 'utf-8');
104
- console.log(`[monodog] Successfully generated default ${configFileName} in the workspace root.`);
105
- console.log('[monodog] Please review and update settings like "host" and "port".');
99
+ process.stderr.write(`[monodog] Successfully generated default ${configFileName} in the workspace root.`);
100
+ process.stderr.write('[monodog] Please review and update settings like "host" and "port".');
106
101
  } catch (err: unknown) {
107
102
  const message = err instanceof Error ? err.message : String(err);
108
103
  console.error(`[monodog Error] Failed to generate ${configFileName}:`, message);
package/src/get-db-url.ts CHANGED
@@ -5,8 +5,6 @@ function generateUrl() {
5
5
 
6
6
  const DATABASE_URL = `${appConfig.database.path}`;
7
7
  process.env.DATABASE_URL = DATABASE_URL;
8
- process.env.DATABASE_PORT = `${appConfig.database.port}`;
9
-
10
8
  process.stdout.write(DATABASE_URL);
11
9
 
12
10
  }