@monodog/backend 1.3.5 → 1.3.6
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 +11 -10
- package/package.json +1 -1
- package/src/cli.ts +11 -10
- package/src/config-loader.ts +1 -0
package/dist/cli.js
CHANGED
|
@@ -122,7 +122,7 @@ else {
|
|
|
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
|
}
|
|
124
124
|
/**
|
|
125
|
-
* Copies an installed NPM package from node_modules into the local
|
|
125
|
+
* Copies an installed NPM package from node_modules into the local install_path workspace directory.
|
|
126
126
|
*/
|
|
127
127
|
function copyPackageToWorkspace(rootDir) {
|
|
128
128
|
// 1. Get package name from arguments
|
|
@@ -141,10 +141,10 @@ function copyPackageToWorkspace(rootDir) {
|
|
|
141
141
|
// Convert package name to a valid folder name (e.g., @scope/name -> scope-name)
|
|
142
142
|
// This is optional but makes file paths cleaner.
|
|
143
143
|
const folderName = packageName.replace('@', '').replace('/', '-');
|
|
144
|
-
const destinationPath = path.join(rootDir,
|
|
144
|
+
const destinationPath = path.join(rootDir, appConfig.workspace.install_path, folderName);
|
|
145
145
|
console.log(`\n--- Monorepo Workspace Conversion ---`);
|
|
146
146
|
console.log(`Target Package: ${packageName}`);
|
|
147
|
-
console.log(`New Workspace:
|
|
147
|
+
console.log(`New Workspace: ${appConfig.workspace.install_path}/${folderName}`);
|
|
148
148
|
console.log(`-----------------------------------`);
|
|
149
149
|
// 2. Validate Source existence
|
|
150
150
|
if (!fs.existsSync(sourcePath)) {
|
|
@@ -158,11 +158,11 @@ function copyPackageToWorkspace(rootDir) {
|
|
|
158
158
|
console.error("Please manually remove it or rename it before running the script.");
|
|
159
159
|
process.exit(1);
|
|
160
160
|
}
|
|
161
|
-
// Ensure the '
|
|
162
|
-
const packagesDir = path.join(rootDir,
|
|
161
|
+
// Ensure the 'install_path' directory exists
|
|
162
|
+
const packagesDir = path.join(rootDir, appConfig.workspace.install_path);
|
|
163
163
|
if (!fs.existsSync(packagesDir)) {
|
|
164
164
|
fs.mkdirSync(packagesDir, { recursive: true });
|
|
165
|
-
console.log(`Created
|
|
165
|
+
console.log(`Created ${appConfig.workspace.install_path} directory: ${packagesDir}`);
|
|
166
166
|
}
|
|
167
167
|
// 4. Perform the copy operation
|
|
168
168
|
try {
|
|
@@ -197,14 +197,15 @@ function createConfigFileIfMissing(rootPath) {
|
|
|
197
197
|
// The default content for the configuration file
|
|
198
198
|
const defaultContent = {
|
|
199
199
|
"workspace": {
|
|
200
|
-
"root_dir": "./
|
|
200
|
+
"root_dir": "./", // Relative to where the config file is located
|
|
201
|
+
"install_path": "packages" // Where to install monodog packages
|
|
201
202
|
},
|
|
202
203
|
"database": {
|
|
203
|
-
"path": "./monodog.db"
|
|
204
|
+
"path": "./monodog.db" // SQLite database file path, relative to prisma schema location
|
|
204
205
|
},
|
|
205
206
|
"server": {
|
|
206
|
-
"host": "0.0.0.0",
|
|
207
|
-
"port": 4000
|
|
207
|
+
"host": "0.0.0.0", // Default host for the API server
|
|
208
|
+
"port": 4000 // Default port for the API server
|
|
208
209
|
}
|
|
209
210
|
};
|
|
210
211
|
const contentString = JSON.stringify(defaultContent, null, 2);
|
package/package.json
CHANGED
package/src/cli.ts
CHANGED
|
@@ -97,7 +97,7 @@ if (serve) {
|
|
|
97
97
|
}
|
|
98
98
|
|
|
99
99
|
/**
|
|
100
|
-
* Copies an installed NPM package from node_modules into the local
|
|
100
|
+
* Copies an installed NPM package from node_modules into the local install_path workspace directory.
|
|
101
101
|
*/
|
|
102
102
|
function copyPackageToWorkspace(rootDir: string): void {
|
|
103
103
|
// 1. Get package name from arguments
|
|
@@ -119,11 +119,11 @@ function copyPackageToWorkspace(rootDir: string): void {
|
|
|
119
119
|
// Convert package name to a valid folder name (e.g., @scope/name -> scope-name)
|
|
120
120
|
// This is optional but makes file paths cleaner.
|
|
121
121
|
const folderName = packageName.replace('@', '').replace('/', '-');
|
|
122
|
-
const destinationPath = path.join(rootDir,
|
|
122
|
+
const destinationPath = path.join(rootDir, appConfig.workspace.install_path, folderName);
|
|
123
123
|
|
|
124
124
|
console.log(`\n--- Monorepo Workspace Conversion ---`);
|
|
125
125
|
console.log(`Target Package: ${packageName}`);
|
|
126
|
-
console.log(`New Workspace:
|
|
126
|
+
console.log(`New Workspace: ${appConfig.workspace.install_path}/${folderName}`);
|
|
127
127
|
console.log(`-----------------------------------`);
|
|
128
128
|
|
|
129
129
|
|
|
@@ -141,11 +141,11 @@ function copyPackageToWorkspace(rootDir: string): void {
|
|
|
141
141
|
process.exit(1);
|
|
142
142
|
}
|
|
143
143
|
|
|
144
|
-
// Ensure the '
|
|
145
|
-
const packagesDir = path.join(rootDir,
|
|
144
|
+
// Ensure the 'install_path' directory exists
|
|
145
|
+
const packagesDir = path.join(rootDir, appConfig.workspace.install_path);
|
|
146
146
|
if (!fs.existsSync(packagesDir)) {
|
|
147
147
|
fs.mkdirSync(packagesDir, { recursive: true });
|
|
148
|
-
console.log(`Created
|
|
148
|
+
console.log(`Created ${appConfig.workspace.install_path} directory: ${packagesDir}`);
|
|
149
149
|
}
|
|
150
150
|
|
|
151
151
|
// 4. Perform the copy operation
|
|
@@ -186,14 +186,15 @@ const configFilePath = path.resolve(rootPath, configFileName);
|
|
|
186
186
|
// The default content for the configuration file
|
|
187
187
|
const defaultContent = {
|
|
188
188
|
"workspace": {
|
|
189
|
-
"root_dir": "./
|
|
189
|
+
"root_dir": "./", // Relative to where the config file is located
|
|
190
|
+
"install_path":"packages" // Where to install monodog packages
|
|
190
191
|
},
|
|
191
192
|
"database": {
|
|
192
|
-
"path": "./monodog.db"
|
|
193
|
+
"path": "./monodog.db" // SQLite database file path, relative to prisma schema location
|
|
193
194
|
},
|
|
194
195
|
"server": {
|
|
195
|
-
"host": "0.0.0.0",
|
|
196
|
-
"port": 4000
|
|
196
|
+
"host": "0.0.0.0", // Default host for the API server
|
|
197
|
+
"port": 4000 // Default port for the API server
|
|
197
198
|
}
|
|
198
199
|
};
|
|
199
200
|
|