@monodog/backend 1.1.21 → 1.1.22

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
@@ -96,7 +96,7 @@ if (serve) {
96
96
  }
97
97
  else {
98
98
  // Default mode: print usage or run a default report if no command is specified
99
- console.log(`Monodog CLI: No operation specified. Use --serve to start the API or -h for help.`);
99
+ 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 .`);
100
100
  }
101
101
  /**
102
102
  * Copies an installed NPM package from node_modules into the local packages/ workspace directory.
@@ -105,11 +105,13 @@ function copyPackageToWorkspace(rootDir) {
105
105
  // 1. Get package name from arguments
106
106
  // The package name is expected as the first command-line argument (process.argv[2])
107
107
  const packageName = process.argv[2];
108
- if (!packageName) {
109
- console.error("Error: Please provide the package name as an argument.");
110
- console.log("Usage: node copy-to-workspace.js <package-name>");
111
- console.log("Example: node copy-to-workspace.js @monodog/dashboard");
112
- process.exit(1);
108
+ if (!packageName || packageName.startsWith('--')) {
109
+ console.error("Error: Please provide the package name as an argument if you want to setup dashboard.");
110
+ console.log("Usage: pnpm monodog-cli @monodog/dashboard --serve --root .");
111
+ }
112
+ if (packageName !== '@monodog/dashboard') {
113
+ console.log("\n--- Skipping workspace setup for @monodog/dashboard to avoid self-copying. ---");
114
+ return;
113
115
  }
114
116
  // const rootDir = process.cwd();
115
117
  const sourcePath = path.join(rootDir, 'node_modules', packageName);
@@ -152,14 +154,12 @@ function copyPackageToWorkspace(rootDir) {
152
154
  console.log(`\n✅ Success! Contents of '${packageName}' copied to '${destinationPath}'`);
153
155
  // Post-copy instructions
154
156
  console.log("\n*** IMPORTANT NEXT STEPS (MANDATORY) ***");
155
- console.log("1. Add the new workspace path to your root 'package.json':");
156
- console.log(` - Add "packages/${folderName}" to the 'workspaces' array.`);
157
- console.log("2. Force pnpm to use the local workspace via 'overrides':");
158
- console.log(" - Add the following to your root package.json:");
159
- console.log(` "pnpm": { "overrides": { "${packageName}": "file:./packages/${folderName}" } }`);
160
- console.log("3. Run 'pnpm install' in the root to link the new workspace.");
161
- console.log("\n--- DEVELOPMENT WARNING ---");
162
- console.log("Remember: This copy contains the **compiled output**, not usually the full source code (e.g., missing original TypeScript/Sass/tests). To properly develop this workspace, you may need to replace the contents with the package's original source repository.");
157
+ console.log("1.Migrate Database:");
158
+ console.log(` - pnpm exec prisma migrate --schema ./node_modules/${folderName}/backend/prisma/schema.prisma`);
159
+ console.log("2. Generate Client:");
160
+ console.log(` - pnpm exec prisma generate --schema ./node_modules/${folderName}/backend/prisma/schema.prisma`);
161
+ console.log("3. Run Backend app server with dashboard setup");
162
+ console.log(` - pnpm monodog-cli @monodog/dashboard --serve --root .`);
163
163
  }
164
164
  catch (err) {
165
165
  const message = err instanceof Error ? err.message : String(err);
package/package.json CHANGED
@@ -1,11 +1,11 @@
1
1
  {
2
2
  "name": "@monodog/backend",
3
- "version": "1.1.21",
3
+ "version": "1.1.22",
4
4
  "description": "Backend API server for monodog monorepo dashboard",
5
5
  "main": "dist/index.js",
6
6
  "license": "MIT",
7
7
  "bin": {
8
- "monodog-cli": "dist/cli.js"
8
+ "monodog-cli": "src/cli.js"
9
9
  },
10
10
  "dependencies": {
11
11
  "@monodog/ci-status": "1.1.1",
@@ -13,22 +13,6 @@ datasource db {
13
13
  url = "file:./monolite.db"
14
14
  }
15
15
 
16
- model User {
17
- id Int @id @default(autoincrement())
18
- name String
19
- email String @unique
20
- posts Post[]
21
- }
22
-
23
- model Post {
24
- id Int @id @default(autoincrement())
25
- title String
26
- content String?
27
- published Boolean @default(false)
28
- authorId Int
29
- author User @relation(fields: [authorId], references: [id])
30
- }
31
-
32
16
  // --- MONOREPO DATA MODEL ---
33
17
 
34
18
  /// Represents a single package within the monorepo, based on the pnpm/package.json data.
package/src/cli.ts CHANGED
@@ -66,7 +66,7 @@ if (serve) {
66
66
  copyPackageToWorkspace(rootPath);
67
67
  } else {
68
68
  // Default mode: print usage or run a default report if no command is specified
69
- console.log(`Monodog CLI: No operation specified. Use --serve to start the API or -h for help.`);
69
+ 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 .`);
70
70
  }
71
71
 
72
72
  /**
@@ -77,11 +77,13 @@ function copyPackageToWorkspace(rootDir: string): void {
77
77
  // The package name is expected as the first command-line argument (process.argv[2])
78
78
  const packageName = process.argv[2];
79
79
 
80
- if (!packageName) {
81
- console.error("Error: Please provide the package name as an argument.");
82
- console.log("Usage: node copy-to-workspace.js <package-name>");
83
- console.log("Example: node copy-to-workspace.js @monodog/dashboard");
84
- process.exit(1);
80
+ if (!packageName || packageName.startsWith('--')) {
81
+ console.error("Error: Please provide the package name as an argument if you want to setup dashboard.");
82
+ console.log("Usage: pnpm monodog-cli @monodog/dashboard --serve --root .");
83
+ }
84
+ if(packageName !== '@monodog/dashboard'){
85
+ console.log("\n--- Skipping workspace setup for @monodog/dashboard to avoid self-copying. ---");
86
+ return;
85
87
  }
86
88
 
87
89
  // const rootDir = process.cwd();
@@ -135,14 +137,12 @@ function copyPackageToWorkspace(rootDir: string): void {
135
137
 
136
138
  // Post-copy instructions
137
139
  console.log("\n*** IMPORTANT NEXT STEPS (MANDATORY) ***");
138
- console.log("1. Add the new workspace path to your root 'package.json':");
139
- console.log(` - Add "packages/${folderName}" to the 'workspaces' array.`);
140
- console.log("2. Force pnpm to use the local workspace via 'overrides':");
141
- console.log(" - Add the following to your root package.json:");
142
- console.log(` "pnpm": { "overrides": { "${packageName}": "file:./packages/${folderName}" } }`);
143
- console.log("3. Run 'pnpm install' in the root to link the new workspace.");
144
- console.log("\n--- DEVELOPMENT WARNING ---");
145
- console.log("Remember: This copy contains the **compiled output**, not usually the full source code (e.g., missing original TypeScript/Sass/tests). To properly develop this workspace, you may need to replace the contents with the package's original source repository.");
140
+ console.log("1.Migrate Database:");
141
+ console.log(` - pnpm exec prisma migrate --schema ./node_modules/${folderName}/backend/prisma/schema.prisma`);
142
+ console.log("2. Generate Client:");
143
+ console.log(` - pnpm exec prisma generate --schema ./node_modules/${folderName}/backend/prisma/schema.prisma`);
144
+ console.log("3. Run Backend app server with dashboard setup");
145
+ console.log(` - pnpm monodog-cli @monodog/dashboard --serve --root .`);
146
146
 
147
147
  } catch (err: unknown) {
148
148
  const message = err instanceof Error ? err.message : String(err);
@@ -1,4 +0,0 @@
1
-
2
- > @monodog/backend@1.1.19 build /home/manoj/Documents/MonoDog/packages/backend
3
- > rm -rf dist && tsc -p tsconfig.json
4
-
@@ -1,17 +0,0 @@
1
-
2
- > @monodog/backend@1.0.0 lint /home/manoj/Documents/MonoDog/packages/backend
3
- > eslint .
4
-
5
- =============
6
-
7
- WARNING: You are currently running a version of TypeScript which is not officially supported by @typescript-eslint/typescript-estree.
8
-
9
- You may find that it works just fine, or you may not.
10
-
11
- SUPPORTED TYPESCRIPT VERSIONS: >=4.3.5 <5.4.0
12
-
13
- YOUR TYPESCRIPT VERSION: 5.9.3
14
-
15
- Please only submit bug reports when using the officially supported version.
16
-
17
- =============
@@ -1,6 +0,0 @@
1
-
2
- > @monodog/backend@1.0.0 test /home/manoj/Documents/MonoDog/packages/backend
3
- > jest --coverage
4
-
5
- sh: 1: jest: not found
6
-  ELIFECYCLE  Test failed. See above for more details.
@@ -1,96 +0,0 @@
1
- "use strict";
2
- // src/setup-workspace.ts
3
- // Converts the original script to TypeScript.
4
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
5
- if (k2 === undefined) k2 = k;
6
- var desc = Object.getOwnPropertyDescriptor(m, k);
7
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
8
- desc = { enumerable: true, get: function() { return m[k]; } };
9
- }
10
- Object.defineProperty(o, k2, desc);
11
- }) : (function(o, m, k, k2) {
12
- if (k2 === undefined) k2 = k;
13
- o[k2] = m[k];
14
- }));
15
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
16
- Object.defineProperty(o, "default", { enumerable: true, value: v });
17
- }) : function(o, v) {
18
- o["default"] = v;
19
- });
20
- var __importStar = (this && this.__importStar) || (function () {
21
- var ownKeys = function(o) {
22
- ownKeys = Object.getOwnPropertyNames || function (o) {
23
- var ar = [];
24
- for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
25
- return ar;
26
- };
27
- return ownKeys(o);
28
- };
29
- return function (mod) {
30
- if (mod && mod.__esModule) return mod;
31
- var result = {};
32
- if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
33
- __setModuleDefault(result, mod);
34
- return result;
35
- };
36
- })();
37
- Object.defineProperty(exports, "__esModule", { value: true });
38
- const fs = __importStar(require("fs"));
39
- const path = __importStar(require("path"));
40
- function copyPackageToWorkspace() {
41
- const packageName = process.argv[2];
42
- if (!packageName) {
43
- console.error('Error: Please provide the package name as an argument.');
44
- console.log('Usage: ts-node src/setup-workspace.ts <package-name>');
45
- console.log('Example: ts-node src/setup-workspace.ts @monodog/dashboard');
46
- process.exit(1);
47
- }
48
- const rootDir = process.cwd();
49
- const sourcePath = path.join(rootDir, 'node_modules', packageName);
50
- const folderName = packageName.replace('@', '').replace('/', '-');
51
- const destinationPath = path.join(rootDir, 'packages', folderName);
52
- console.log('\n--- Monorepo Workspace Conversion ---');
53
- console.log(`Target Package: ${packageName}`);
54
- console.log(`New Workspace: packages/${folderName}`);
55
- console.log('-----------------------------------');
56
- if (!fs.existsSync(sourcePath)) {
57
- console.error(`\n❌ Error: Source package not found at ${sourcePath}.`);
58
- console.error("Please ensure the package is installed via 'pnpm install <package-name>' first.");
59
- process.exit(1);
60
- }
61
- if (fs.existsSync(destinationPath)) {
62
- console.error(`\n❌ Error: Destination directory already exists at ${destinationPath}.`);
63
- console.error('Please manually remove it or rename it before running the script.');
64
- process.exit(1);
65
- }
66
- const packagesDir = path.join(rootDir, 'packages');
67
- if (!fs.existsSync(packagesDir)) {
68
- fs.mkdirSync(packagesDir, { recursive: true });
69
- console.log(`Created packages directory: ${packagesDir}`);
70
- }
71
- try {
72
- console.log(`\nCopying files from ${sourcePath} to ${destinationPath}...`);
73
- fs.cpSync(sourcePath, destinationPath, {
74
- recursive: true,
75
- dereference: true,
76
- // explicit typing for the filter parameter
77
- filter: (src) => !src.includes('node_modules'),
78
- });
79
- console.log(`\n✅ Success! Contents of '${packageName}' copied to '${destinationPath}'`);
80
- console.log('\n*** IMPORTANT NEXT STEPS (MANDATORY) ***');
81
- console.log("1. Add the new workspace path to your root 'package.json':");
82
- console.log(` - Add "packages/${folderName}" to the 'workspaces' array.`);
83
- console.log("2. Force pnpm to use the local workspace via 'overrides':");
84
- console.log(' - Add the following to your root package.json:');
85
- console.log(` "pnpm": { "overrides": { "${packageName}": "file:./packages/${folderName}" } }`);
86
- console.log("3. Run 'pnpm install' in the root to link the new workspace.");
87
- console.log('\n--- DEVELOPMENT WARNING ---');
88
- console.log('Remember: This copy contains the **compiled output**, not usually the full source code (e.g., missing original TypeScript/Sass/tests). To properly develop this workspace, you may need to replace the contents with the package\'s original source repository.');
89
- }
90
- catch (err) {
91
- const message = err instanceof Error ? err.message : String(err);
92
- console.error(`\n❌ Failed to copy files: ${message}`);
93
- process.exit(1);
94
- }
95
- }
96
- copyPackageToWorkspace();
@@ -1,74 +0,0 @@
1
- // src/setup-workspace.ts
2
- // Converts the original script to TypeScript.
3
-
4
- import * as fs from 'fs';
5
- import * as path from 'path';
6
-
7
- function copyPackageToWorkspace(): void {
8
- const packageName: string | undefined = process.argv[2];
9
-
10
- if (!packageName) {
11
- console.error('Error: Please provide the package name as an argument.');
12
- console.log('Usage: ts-node src/setup-workspace.ts <package-name>');
13
- console.log('Example: ts-node src/setup-workspace.ts @monodog/dashboard');
14
- process.exit(1);
15
- }
16
-
17
- const rootDir: string = process.cwd();
18
- const sourcePath: string = path.join(rootDir, 'node_modules', packageName);
19
-
20
- const folderName: string = packageName.replace('@', '').replace('/', '-');
21
- const destinationPath: string = path.join(rootDir, 'packages', folderName);
22
-
23
- console.log('\n--- Monorepo Workspace Conversion ---');
24
- console.log(`Target Package: ${packageName}`);
25
- console.log(`New Workspace: packages/${folderName}`);
26
- console.log('-----------------------------------');
27
-
28
- if (!fs.existsSync(sourcePath)) {
29
- console.error(`\n❌ Error: Source package not found at ${sourcePath}.`);
30
- console.error("Please ensure the package is installed via 'pnpm install <package-name>' first.");
31
- process.exit(1);
32
- }
33
-
34
- if (fs.existsSync(destinationPath)) {
35
- console.error(`\n❌ Error: Destination directory already exists at ${destinationPath}.`);
36
- console.error('Please manually remove it or rename it before running the script.');
37
- process.exit(1);
38
- }
39
-
40
- const packagesDir: string = path.join(rootDir, 'packages');
41
- if (!fs.existsSync(packagesDir)) {
42
- fs.mkdirSync(packagesDir, { recursive: true });
43
- console.log(`Created packages directory: ${packagesDir}`);
44
- }
45
-
46
- try {
47
- console.log(`\nCopying files from ${sourcePath} to ${destinationPath}...`);
48
-
49
- fs.cpSync(sourcePath, destinationPath, {
50
- recursive: true,
51
- dereference: true,
52
- // explicit typing for the filter parameter
53
- filter: (src: string): boolean => !src.includes('node_modules'),
54
- });
55
-
56
- console.log(`\n✅ Success! Contents of '${packageName}' copied to '${destinationPath}'`);
57
-
58
- console.log('\n*** IMPORTANT NEXT STEPS (MANDATORY) ***');
59
- console.log("1. Add the new workspace path to your root 'package.json':");
60
- console.log(` - Add "packages/${folderName}" to the 'workspaces' array.`);
61
- console.log("2. Force pnpm to use the local workspace via 'overrides':");
62
- console.log(' - Add the following to your root package.json:');
63
- console.log(` "pnpm": { "overrides": { "${packageName}": "file:./packages/${folderName}" } }`);
64
- console.log("3. Run 'pnpm install' in the root to link the new workspace.");
65
- console.log('\n--- DEVELOPMENT WARNING ---');
66
- console.log('Remember: This copy contains the **compiled output**, not usually the full source code (e.g., missing original TypeScript/Sass/tests). To properly develop this workspace, you may need to replace the contents with the package\'s original source repository.');
67
- } catch (err: unknown) {
68
- const message = err instanceof Error ? err.message : String(err);
69
- console.error(`\n❌ Failed to copy files: ${message}`);
70
- process.exit(1);
71
- }
72
- }
73
-
74
- copyPackageToWorkspace();
package/tsconfig.o.json DELETED
@@ -1,29 +0,0 @@
1
- {
2
- // 1. Inherit rules from the shared monorepo configuration
3
- "extends": "@lakinmindfire/tsconfig/node.json",
4
-
5
- "compilerOptions": {
6
- // 2. Explicitly set output directory
7
- "outDir": "./dist",
8
-
9
- // 3. Ensure compatibility: Set module type to CommonJS
10
- "module": "CommonJS",
11
- "moduleResolution": "node",
12
-
13
- // 4. Common fixes for Node/TS projects
14
- "esModuleInterop": true,
15
- "allowSyntheticDefaultImports": true,
16
- "verbatimModuleSyntax": false
17
- },
18
-
19
- // 5. CRITICAL: Include all source files in the current package directory
20
- "include": [
21
- "**/*.ts"
22
- ],
23
-
24
- // 6. Exclude generated files and dependencies
25
- "exclude": [
26
- "node_modules",
27
- "dist"
28
- ]
29
- }