denoland / deno

A modern runtime for JavaScript and TypeScript.
https://deno.com
MIT License
98k stars 5.39k forks source link

Add Support for Nested Deno Workspaces with Domain/Subdomain #26879

Open nirnay-raval-st10 opened 1 week ago

nirnay-raval-st10 commented 1 week ago

💡 Feature Request: Nested Deno Workspaces

Description Add support for nested workspace configuration in Deno projects to better organize code by domains and subdomains, similar to how pnpm/yarn workspaces work for Node.js.

Current Situation

Proposed Solution Support nested workspace configuration through:

  1. Extended deno.json workspace configuration:
    
    {
    "workspace": {
    "domains": {
      "core": "./domains/core",
      "auth": "./domains/auth",
      "api": {
        "public": "./domains/api/public",
        "internal": "./domains/api/internal"
      }
    }
    }
    }

basically i want to have domain and subdomain workspace differently in same repository.

dsherret commented 5 days ago

Can you explain the benefit over just using different name prefixes? Also, where is the pnpm/yarn documentation on this?

nirnay-raval-st10 commented 4 days ago

Can you explain the benefit over just using different name prefixes? Also, where is the pnpm/yarn documentation on this?

Let me explain the benefits of using workspace structure over name prefixes:

Benefits of Workspaces vs Name Prefixes

  1. Isolation and Organization
    
    // Workspace Structure
    workspace/
    ├── slices/
    │   ├── extractFeeds/      // Complete isolated module
    │   ├── fetchFeeds/        // Complete isolated module
    │   └── generateIssues/    // Complete isolated module

// vs Name Prefix Structure src/ ├── extractFeeds.ts ├── fetchFeeds.ts └── generateIssues.ts


2. **Benefits**
- **Dependency Management**: Each slice can have its own dependencies
- **Cleaner Testing**: Tests live alongside the code they test
- **Better Code Organization**: Related files stay together
- **Easier Maintenance**: Changes to one slice don't affect others
- **Independent Versioning**: Each slice can be versioned separately
- **Better CI/CD**: Can build/test individual slices

3. **Your Current Setup**
```json
{
  "workspace": {
    "members": [
      "./slices/extractFeeds",
      "./slices/fetchFeeds",
      "./slices/generateIssues",
      "./slices/services",
      "./slices/types",
      "./slices/shared",
      "./slices/generateUpdatesFeeds"
    ]
  }
}

Documentation References

This is actually a Deno-specific workspace implementation, different from pnpm/yarn:

The key difference is that Deno workspaces are more lightweight and focused on module organization rather than package management like pnpm/yarn.

For use case, Deno workspaces provide better module isolation and organization without the complexity of full package management systems.

dsherret commented 4 days ago

Is this chatgpt output? Why is it linking to https://deno.land/manual@v1.34.3/tools/workspaces

Can you please explain in your own words a concrete example and use case? The yarn and pnpm documentation looks similar to Deno for what I can see, but I must be missing something.

nirnay-raval-st10 commented 4 days ago

Is this chatgpt output? Why is it linking to https://deno.land/manual@v1.34.3/tools/workspaces

Can you please explain in your own words a concrete example and use case? The yarn and pnpm documentation looks similar to Deno for what I can see, but I must be missing something.

the problem is

nirnay-raval-st10 commented 4 days ago
nested-deno-workspace/
├── deno.json
├── packages/
│   ├── math/
│   │   ├── deno.json
│   │   ├── src/
│   │   │   ├── add.ts
│   │   │   ├── subtract.ts
│   │   │   ├── multiply.ts
│   │   │   └── divide.ts
│   │   └── tests/
│   │       └── math_test.ts
│   └── utils/
│       ├── deno.json
│       ├── src/
│       │   └── logger.ts
│       └── tests/
│           └── logger_test.ts
└── main.ts

like in this example

now i want to make a math as a individual deno workspace and also utils as a individual deno workspace and they are member of package deno workspace too.

dsherret commented 4 days ago

Can you show an example of pnpm or yarn doing this? I don't see an example in the linked documentation of them having this functionality. I still don't understand what this solves or why it's desired/what the benefit is.

dsherret commented 4 days ago

I think I just realized my confusion. Are you asking for workspace support in general? It's already supported in Deno: https://docs.deno.com/runtime/fundamentals/workspaces/

I got confused because I thought you were asking for a change to how workspaces worked.

nirnay-raval-st10 commented 4 days ago

let me rephrase my issue/request:-

Support for Multi-Level Workspace Organization in Deno

Current Behavior:

Desired Behavior:

Example Structure:

root-workspace/
├── workspace-1/
│   ├── package-1/
│   └── package-2/
└── workspace-2/
    ├── package-3/
    └── package-4/