Feature Request: auto detect and write dependencies
- Dominant language
- TypeScript
- Stars
- 6.4k
- Forks
- 128
- Avg merge
- 4d 10h
- Merged PRs (30d)
- 4
Description
## Description
Let's say I have these dependencies in my package which resides within a monorepo
```json
"dependencies": {
"@rocket/cli": "^0.20.4",
"@rocket/components": "^0.2.0",
"@rocket/engine": "^0.2.7",
},
```
now when I execute `npm run ts` it should run `ts` in all my "dependencies" (and its dependencies) first...
you can archive it via
```json
"scripts": {
"ts": "wireit",
},
"wireit": {
"ts": {
"command": "tsc --build --pretty",
"dependencies": [
"../cli:ts",
"../components:ts",
"../engine:ts"
],
}
}
```
but it feels like duplicating the dependency tree...
```js
"dependencies": {
"@rocket/cli": "^0.20.4",
"@rocket/components": "^0.2.0",
"@rocket/engine": "^0.2.7",
},
// and
"dependencies": [
"../cli:ts",
"../components:ts",
"../engine:ts"
],
```
Don't get me wrong I like that it is very explicit to say what is depending on what... but can get quite hard to maintain as you always need not think of 2 kind of dependencies
## Suggestion
Maybe we could introduce a "command" like `wireit detect-dependencies`.
What it could then do is
1. go through all dependencies and look if it has an npm command with the same name
2. if it has then add it to the wireit commands dependencies
### Example
This is the starting point
```json
"dependencies": {
"@rocket/cli": "^0.20.4",
"@rocket/components": "^0.2.0",
"@rocket/engine": "^0.2.7",
},
"scripts": {
"ts": "wireit",
},
"wireit": {
"ts": {
"command": "tsc --build --pretty",
}
}
```
We execute `wireit detect-dependencies` and this is what we would get
```json
"dependencies": {
"@rocket/cli": "^0.20.4",
"@rocket/components": "^0.2.0",
"@rocket/engine": "^0.2.7",
},
"scripts": {
"ts": "wireit",
},
"wireit": {
"ts": {
"command": "tsc --build --pretty",
"dependencies": [
"../cli:ts",
"../components:ts",
"../engine:ts"
],
}
}
```
This would be sort of a "helper" script to sync dependencies... executing it and verifying would be a manual process.
Would probably be nice to also offer it as "linting"...
And as it's all just "helpers" it could also be "just" in the vs-code extension.
What do you think?
Contributor guide
Assessment
This issue has not been assessed yet.