@monodog/backend 1.4.6 → 1.4.8

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
@@ -132,7 +132,7 @@ function copyPackageToWorkspace(rootDir) {
132
132
  console.error("Error: Please provide the package name as an argument if you want to setup dashboard.");
133
133
  console.log("Usage: pnpm monodog-cli @monodog/dashboard --serve --root .");
134
134
  }
135
- if (packageName !== '@monodog/backend') {
135
+ if (!(packageName == '@monodog/backend' || packageName == '@monodog/dashboard')) {
136
136
  console.log("\n--- Skipping workspace setup for @monodog/backend to avoid self-copying. ---");
137
137
  return;
138
138
  }
@@ -50,7 +50,7 @@ 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
55
  createConfigFileIfMissing(rootPath);
56
56
  if (!fs.existsSync(configPath)) {
@@ -64,7 +64,7 @@ function loadConfig() {
64
64
  // 3. Optional: Add validation logic here (e.g., check if ports are numbers)
65
65
  // Cache and return
66
66
  config = parsedConfig;
67
- process.stderr.write(`[Config] Loaded configuration from: ${configPath}`);
67
+ process.stderr.write('[Config] Loaded configuration from: ...\n');
68
68
  return config;
69
69
  }
70
70
  catch (error) {
@@ -93,16 +93,16 @@ function createConfigFileIfMissing(rootPath) {
93
93
  };
94
94
  const contentString = JSON.stringify(defaultContent, null, 2);
95
95
  // ---------------------
96
- console.log(`\n[monodog] Checking for ${configFileName}...`);
96
+ process.stderr.write(`\n[monodog] Checking for ${configFileName}...`);
97
97
  if (fs.existsSync(configFilePath)) {
98
- console.log(`[monodog] ${configFileName} already exists. Skipping creation.`);
98
+ process.stderr.write(`[monodog] ${configFileName} already exists. Skipping creation.`);
99
99
  }
100
100
  else {
101
101
  try {
102
102
  // Write the default content to the file
103
103
  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".');
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".');
106
106
  }
107
107
  catch (err) {
108
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.6",
3
+ "version": "1.4.8",
4
4
  "description": "Backend API server for monodog monorepo dashboard",
5
5
  "license": "MIT",
6
6
  "bin": {
package/src/cli.ts CHANGED
@@ -108,7 +108,7 @@ function copyPackageToWorkspace(rootDir: string): void {
108
108
  console.error("Error: Please provide the package name as an argument if you want to setup dashboard.");
109
109
  console.log("Usage: pnpm monodog-cli @monodog/dashboard --serve --root .");
110
110
  }
111
- if(packageName !== '@monodog/backend'){
111
+ if(!(packageName == '@monodog/backend' || packageName == '@monodog/dashboard')){
112
112
  console.log("\n--- Skipping workspace setup for @monodog/backend to avoid self-copying. ---");
113
113
  return;
114
114
  }
@@ -36,7 +36,7 @@ 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
41
  createConfigFileIfMissing(rootPath);
42
42
 
@@ -54,7 +54,7 @@ export function loadConfig(): MonodogConfig {
54
54
 
55
55
  // Cache and return
56
56
  config = parsedConfig;
57
- process.stderr.write(`[Config] Loaded configuration from: ${configPath}`);
57
+ process.stderr.write('[Config] Loaded configuration from: ...\n');
58
58
  return config;
59
59
 
60
60
  } catch (error) {
@@ -88,16 +88,16 @@ const defaultContent = {
88
88
  const contentString = JSON.stringify(defaultContent, null, 2);
89
89
  // ---------------------
90
90
 
91
- console.log(`\n[monodog] Checking for ${configFileName}...`);
91
+ process.stderr.write(`\n[monodog] Checking for ${configFileName}...`);
92
92
 
93
93
  if (fs.existsSync(configFilePath)) {
94
- console.log(`[monodog] ${configFileName} already exists. Skipping creation.`);
94
+ process.stderr.write(`[monodog] ${configFileName} already exists. Skipping creation.`);
95
95
  } else {
96
96
  try {
97
97
  // Write the default content to the file
98
98
  fs.writeFileSync(configFilePath, contentString, 'utf-8');
99
- console.log(`[monodog] Successfully generated default ${configFileName} in the workspace root.`);
100
- 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".');
101
101
  } catch (err: unknown) {
102
102
  const message = err instanceof Error ? err.message : String(err);
103
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
  }