turbo icon indicating copy to clipboard operation
turbo copied to clipboard

add `*.iml` in <project_root> and <sub_package_root> files to make ide like IntelliJ / WebStorm faster

Open morlay opened this issue 3 years ago • 2 comments

Describe the feature you'd like to request

For huge monorepo, ide like IntelliJ / WebStorm will because slow, specifically in typescript monorepo. we could add *.iml file for each sub packages like

<module type="WEB_MODULE" version="4">
  <component name="NewModuleRootManager" inherit-compiler-output="true">
    <exclude-output />
    <content url="file://$MODULE_DIR$">
      <sourceFolder url="file://$MODULE_DIR$" isTestSource="false" />
      <excludeFolder url="file://$MODULE_DIR$/.turbo" />
      <excludeFolder url="file://$MODULE_DIR$/node_modules" />
      <excludeFolder url="file://$MODULE_DIR$/dist" /> 
    </content>
    <orderEntry type="sourceFolder" forTests="false" />
  </component>
</module>

the excludeFolder list could from pipeline.build.outputs.

Then updates all *.iml into .idea/modules.xml

<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
    <component name="ProjectModuleManager">
        <modules>
            <module fileurl="file://$PROJECT_DIR$/project.iml" filepath="$PROJECT_DIR$/project.iml"/>
            <module fileurl="file://$PROJECT_DIR$/packages/a/a.iml" filepath="$PROJECT_DIR$/packages/a/a.iml"/>
            <module fileurl="file://$PROJECT_DIR$/packages/b/b.iml" filepath="$PROJECT_DIR$/packages/b/b.iml"/>
        </modules>
    </component>
</project>

Final files added.

.idea/
   modules.xml
packages/
   a/
     a.iml
   b/
     b.iml
project.iml

*.iml could added into .gitignore too.

Describe the solution you'd like

Like melos from flutter did https://github.com/invertase/melos/blob/main/melos.yaml

We could add option { ide: { intellij: true } } in turbo.json to enable this feature.

Describe alternatives you've considered

I used put tsconfig.json in project root. But when i start to use turbo, I prefer put tsconfig.json to each sub package, which will slow down IDE, until I added *.iml files.

morlay avatar Aug 16 '22 04:08 morlay

I have more than 10 sub-projects in my project. Starting with WebStorm is slow, taking about a minute. I hope to solve the slow startup problem by enabling ide intellij: true.

fxjs avatar Jun 04 '23 01:06 fxjs

I have more than 10 sub-projects in my project. Starting with WebStorm is slow, taking about a minute. I hope to solve the slow startup problem by enabling ide intellij: true.

if you use pnpm, here is another sollution to resolve this issue. add node-linker = hoisted into .npmrc, and remove tsconfig.json in each sub project (or rename for building). then set paths in tsconfig.json in workspace root like https://github.com/innoai-tech/nodekit/blob/main/tsconfig.json#L5-L10

morlay avatar Jun 05 '23 02:06 morlay