@monodog/backend 1.1.21 → 1.2.0

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/README.md ADDED
@@ -0,0 +1,72 @@
1
+ # Monodog: Monorepo Analytics and Health API
2
+
3
+ ## šŸŽÆ Overview
4
+
5
+ This is the backend service designed to provide comprehensive analytics, health monitoring, and dependency tracking for a large **JavaScript/TypeScript monorepo**.
6
+ It leverages specialized **@monodog** tools and a database layer (via **Prisma**) to efficiently manage, persist, and expose data about all packages within the repository.
7
+
8
+ This service is typically run locally or on a central server to power a dedicated frontend dashboard.
9
+
10
+ ---
11
+
12
+ ## šŸ›  Technology Stack
13
+
14
+ | Component | Technology | Description |
15
+ |------------|-------------|--------------|
16
+ | **Language** | TypeScript & Node.js | Core language for runtime execution. |
17
+ | **Framework** | Express.js | Handles all API routing and middleware. |
18
+ | **ORM** | Prisma | Database layer for managing package and health status records. |
19
+ | **Scanning** | @monodog/monorepo-scanner | Core logic for file system scanning and package metadata extraction. |
20
+ | **VCS** | GitService | Used to fetch and analyze commit history per package path. |
21
+ | **Networking** | cors, body-parser | Essential middleware for API connectivity. |
22
+
23
+ ---
24
+
25
+ ## āš™ļø Prerequisites
26
+
27
+ You must have the following installed to run the service:
28
+
29
+ - **Node.js:** Version 18+ recommended
30
+ - **Package Manager:** `pnpm` or `npm` (use the one your monorepo uses)
31
+ - **Database:** A running instance of a database supported by Prisma (e.g., PostgreSQL, SQLite, MySQL)
32
+
33
+ ---
34
+
35
+ ## šŸš€ Getting Started
36
+
37
+ ### Installation
38
+
39
+ Clone the repository and install the dependencies:
40
+
41
+ ```bash
42
+ # Clone the repository
43
+ git clone https://github.com/lakinmindfire/MonoDog.git
44
+ cd packages/backend
45
+
46
+ # Install dependencies
47
+ pnpm install
48
+
49
+ # Database Setup (Prisma)
50
+
51
+ The application requires the database schema to be set up using **Prisma Migrate**.
52
+
53
+ pnpm prisma generate
54
+
55
+ pnpm prisma migrate dev
56
+
57
+ ### Run backend server on port 4000 (default)
58
+
59
+ pnpm monodog-cli --serve --root .
60
+ ```
61
+
62
+ ### Key API Endpoints
63
+
64
+ | Method | Route | Purpose | Persistence |
65
+ |--------|--------|----------|-------------|
66
+ | **GET** | `/api/packages` | Retrieve all package metadata from the database. | Cached / Persistent |
67
+ | **GET** | `/api/packages/refresh` | Trigger a full file scan of the monorepo and update/sync the database. | Triggers write |
68
+ | **GET** | `/api/packages/:name` | Get detailed info, reports, and CI status for a package. | Cached / Persistent |
69
+ | **GET** | `/api/health/packages` | Fetch the latest health metrics (score, build status) for all packages. | Persistent |
70
+ | **GET** | `/api/health/refresh` | Recalculate all package health metrics (tests, lint, security) and update the database. | Triggers write |
71
+ | **GET** | `/api/commits/:packagePath` | Fetch Git commit history for a specific package directory. | Generated runtime |
72
+ | **GET** | `/api/config/files` | Scan the monorepo for essential configuration files (e.g., `tsconfig`, `.eslintrc`). | Generated runtime |
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 prisma migrate --schema ./node_modules/@monodog/backend/prisma/schema.prisma`);
159
+ console.log("2. Generate Client:");
160
+ console.log(` - pnpm exec prisma generate --schema ./node_modules/@monodog/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/dist/index.js CHANGED
@@ -115,7 +115,7 @@ function startServer(rootPath) {
115
115
  const packages = (0, helpers_1.scanMonorepo)(rootDir);
116
116
  console.log('packages -->', packages.length);
117
117
  for (const pkg of packages) {
118
- (0, helpers_2.storePackage)(pkg);
118
+ await (0, helpers_2.storePackage)(pkg);
119
119
  }
120
120
  res.json(packages);
121
121
  }
@@ -229,25 +229,24 @@ function startServer(rootPath) {
229
229
  }
230
230
  });
231
231
  // Get dependency graph
232
- app.get('/api/graph', async (_req, res) => {
233
- try {
234
- const packages = (0, helpers_1.scanMonorepo)(process.cwd());
235
- const graph = (0, helpers_1.generateDependencyGraph)(packages);
236
- const circularDeps = (0, helpers_1.findCircularDependencies)(packages);
237
- res.json({
238
- ...graph,
239
- circularDependencies: circularDeps,
240
- metadata: {
241
- totalNodes: graph.nodes.length,
242
- totalEdges: graph.edges.length,
243
- circularDependencies: circularDeps.length,
244
- },
245
- });
246
- }
247
- catch (error) {
248
- res.status(500).json({ error: 'Failed to generate dependency graph' });
249
- }
250
- });
232
+ // app.get('/api/graph', async (_req, res) => {
233
+ // try {
234
+ // const packages = scanMonorepo(process.cwd());
235
+ // const graph = generateDependencyGraph(packages);
236
+ // const circularDeps = findCircularDependencies(packages);
237
+ // res.json({
238
+ // ...graph,
239
+ // circularDependencies: circularDeps,
240
+ // metadata: {
241
+ // totalNodes: graph.nodes.length,
242
+ // totalEdges: graph.edges.length,
243
+ // circularDependencies: circularDeps.length,
244
+ // },
245
+ // });
246
+ // } catch (error) {
247
+ // res.status(500).json({ error: 'Failed to generate dependency graph' });
248
+ // }
249
+ // });
251
250
  // Get monorepo statistics
252
251
  app.get('/api/stats', async (_req, res) => {
253
252
  try {
@@ -1106,7 +1105,7 @@ function startServer(rootPath) {
1106
1105
  console.log(` - GET /api/packages`);
1107
1106
  console.log(` - GET /api/packages/:name`);
1108
1107
  console.log(` - GET /api/commits/:packagePath`);
1109
- console.log(` - GET /api/graph`);
1108
+ // console.log(` - GET /api/graph`);
1110
1109
  console.log(` - GET /api/stats`);
1111
1110
  console.log(` - GET /api/ci/status`);
1112
1111
  console.log(` - POST /api/ci/trigger`);
package/package.json CHANGED
@@ -1,11 +1,11 @@
1
1
  {
2
2
  "name": "@monodog/backend",
3
- "version": "1.1.21",
3
+ "version": "1.2.0",
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",
Binary file
@@ -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 prisma migrate --schema ./node_modules/@monodog/backend/prisma/schema.prisma`);
142
+ console.log("2. Generate Client:");
143
+ console.log(` - pnpm exec prisma generate --schema ./node_modules/@monodog/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);
package/src/index.ts CHANGED
@@ -145,7 +145,7 @@ app.get('/api/packages/refresh', async (_req, res) => {
145
145
  const packages = scanMonorepo(rootDir);
146
146
  console.log('packages -->', packages.length);
147
147
  for (const pkg of packages) {
148
- storePackage(pkg)
148
+ await storePackage(pkg)
149
149
  }
150
150
 
151
151
  res.json(packages);
@@ -275,25 +275,25 @@ app.get('/api/commits/:packagePath', async (_req, res) => {
275
275
  });
276
276
 
277
277
  // Get dependency graph
278
- app.get('/api/graph', async (_req, res) => {
279
- try {
280
- const packages = scanMonorepo(process.cwd());
281
- const graph = generateDependencyGraph(packages);
282
- const circularDeps = findCircularDependencies(packages);
278
+ // app.get('/api/graph', async (_req, res) => {
279
+ // try {
280
+ // const packages = scanMonorepo(process.cwd());
281
+ // const graph = generateDependencyGraph(packages);
282
+ // const circularDeps = findCircularDependencies(packages);
283
283
 
284
- res.json({
285
- ...graph,
286
- circularDependencies: circularDeps,
287
- metadata: {
288
- totalNodes: graph.nodes.length,
289
- totalEdges: graph.edges.length,
290
- circularDependencies: circularDeps.length,
291
- },
292
- });
293
- } catch (error) {
294
- res.status(500).json({ error: 'Failed to generate dependency graph' });
295
- }
296
- });
284
+ // res.json({
285
+ // ...graph,
286
+ // circularDependencies: circularDeps,
287
+ // metadata: {
288
+ // totalNodes: graph.nodes.length,
289
+ // totalEdges: graph.edges.length,
290
+ // circularDependencies: circularDeps.length,
291
+ // },
292
+ // });
293
+ // } catch (error) {
294
+ // res.status(500).json({ error: 'Failed to generate dependency graph' });
295
+ // }
296
+ // });
297
297
 
298
298
  // Get monorepo statistics
299
299
  app.get('/api/stats', async (_req, res) => {
@@ -1279,7 +1279,7 @@ app.listen(PORT, () => {
1279
1279
  console.log(` - GET /api/packages`);
1280
1280
  console.log(` - GET /api/packages/:name`);
1281
1281
  console.log(` - GET /api/commits/:packagePath`);
1282
- console.log(` - GET /api/graph`);
1282
+ // console.log(` - GET /api/graph`);
1283
1283
  console.log(` - GET /api/stats`);
1284
1284
  console.log(` - GET /api/ci/status`);
1285
1285
  console.log(` - POST /api/ci/trigger`);
@@ -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
- }