comptroller icon indicating copy to clipboard operation
comptroller copied to clipboard

Package.json inheritance trouble

Open ShaunaGordon opened this issue 5 years ago • 0 comments

I'm not sure if this is an issue with my expectations or my settings, or if it's an actual limitation of Comptroller, so any help would be appreciated.

I have the following file structure:

Root
-- package.json (parent)
-- src
---- shared
------ package.json
------ tests (folder)
------ code files
---- components
------ component-a
-------- package.json
-------- tests (folder)
-------- code files

Ideally, I'm trying to manage the package.json files in both shared and components with Comptroller and have them sync with the root level package.json, but I can't seem to get it to actually pick up the children package.json files.

My current settings for Comptroller are:

"comptroller": {
        "packages": "{src/components/*,src/shared}",
        "source": "src/**/*.[js|vue]",
        "dev": "src/**/tests/*.js",
        "ignore": "**/node_modules/**",
        "inherits": [
            "version",
            "author",
            "homepage",
            "browserslist",
            "license"
        ],
        "detective": {
            "parse": {
                "plugins": ["objectRestSpread"]
            }
        }
    }

I've tried a few different permutations at this point, but none of them have worked so far. None of my subpackages deviate from the main template, so none of them have a comptroller section in their package.json files.

When I run comp update, the only feedback I get in the terminal is:

image

and none of the package.json files appear to be updated (no inherited fields are added/updated). However, if I run comp update -s, I get the warnings for unused dependencies and package.json is obviously updated.

From what I've found when digging through the code, issues, and what examples I've been able to find, I'd expect Comptroller to recurse through the folders in packages to find the different packages, as well as allow for a couple of different package folder locations, the same way Yarn workspaces does (which is in my setup and works). At least with what I have set up, however, it doesn't seem to be doing this.

Can/should it be able to go through package folders recursively? If not, is there a way around this limitation? If so, how is my configuration incorrect and what should it be?

ShaunaGordon avatar Jun 17 '20 16:06 ShaunaGordon