Code Monkey home page Code Monkey logo

Comments (2)

moltar avatar moltar commented on July 22, 2024

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
    }
  ]
}

from turbo.

RaisRichard avatar RaisRichard commented on July 22, 2024

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:

  • cwd: I assume "current workspace directory", the path of the workspace that turbo gen was executed in (not the actual location inside that workspace)
  • root: Monorepo/Project root path
  • workspace: Path of the workspace that the selected generator config is in (For a generator that is in a workspace folder it was "C:\Development\monorepo\libs\core\turbo\generators", though the path ended at the project root for @moltar for some reason)

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.

from turbo.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.