Open moltar opened 2 months ago
Dumping turbo
object, it seems to have the following shape, but not sure what is public there:
{
"paths": {
"cwd": "/Users/foo/my-project/apps/dir",
"root": "/Users/foo/my-project",
"workspace": "/Users/foo/my-project"
},
"configs": [
{
"config": {},
"turboConfigPath": "/Users/foo/my-project/turbo.json",
"workspacePath": "/Users/foo/my-project",
"isRootConfig": true
}
]
}
Hi, I stumbled across this feature and was also wondering about this. I did some digging and I'm just going to leave this for anyone else that is currently looking:
My turbo object dump looks like this:
{
paths: {
cwd: 'C:\\Development\\monorepo\\libs\\core',
root: 'C:\\Development\\monorepo',
workspace: 'C:\\Development\\monorepo\\libs\\core\\turbo\\generators'
},
configs: [
{
config: [Object],
turboConfigPath: 'C:\\Development\\monorepo\\turbo.json',
workspacePath: 'C:\\Development\\monorepo',
isRootConfig: true
},
{
config: [Object],
turboConfigPath: 'C:\\Development\\monorepo\\apps\\dev-storybook\\turbo.json',
workspacePath: 'C:\\Development\\monorepo\\apps\\dev-storybook',
isRootConfig: false
},
{
config: [Object],
turboConfigPath: 'C:\\Development\\monorepo\\apps\\docs\\turbo.json',
workspacePath: 'C:\\Development\\monorepo\\apps\\docs',
isRootConfig: false
}
]
}
paths:
turbo gen
was executed in (not the actual location inside that workspace)configs is an array of every config that turbo knows about.
Custom plop action functions also have access to this turbo object as a prop of the answers object.
By the way, it would be awesome if paths could list every known workspace so that you can do something in all of them or select one of them. I was originally looking at this feature to automatically generate TS types in a library workspace, based on its src/components contents.
What is the improvement or update you wish to see?
Code generator comes with built-in variables, e.g.
{{ turbo.paths.root }}
, but they are not documented anywhere.Is there any context that might help us understand?
https://turbo.build/repo/docs/guides/generating-code
Does the docs page already exist? Please link to it.
https://turbo.build/repo/docs/guides/generating-code