0
votes

I have 3 projects all using grunt.

Project a depends on project c and b
Project b depends on project c
Project c depends on nothing

Project a and b both require a step that compiles project c (which is a style repo that contains global styles for our org).

I am attempting to run grunt post install for project b.

There are a couple problems here.

  1. Project a and b both try to build project c in their build processes. This takes sometime and I'd rather avoid it.
  2. Project b expects different paths when running alone. loadNpmTasks fails unless I grunt.file.setBase, but then I have other paths that are broken as well. This means I need to manually track all of those down and make sure they are correct in both situations. This is rather flimsy.

As a result, I am thinking I am not doing this correctly or in a "normal way". What is the appropriate way to manage dependencies that use grunt?

Update

The main problem is that I get the following errors no matter what solution I've been choosing:

Local Npm module "grunt-contrib-compass" not found. Is it installed?
Local Npm module "grunt-contrib-handlebars" not found. Is it installed?
Local Npm module "grunt-contrib-requirejs" not found. Is it installed?
Local Npm module "grunt-contrib-watch" not found. Is it installed?
Local Npm module "grunt-notify" not found. Is it installed?
Local Npm module "grunt-curl" not found. Is it installed?
Local Npm module "grunt-shell" not found. Is it installed?

I tried spawn a task and calling grunt via the command line. I tried using various plugins to help. I think the issue is that both the top level and the dependencies require those tasks. This means they get pulled up into the parent node_modules folder. As a result the dependencies are missing the above modules in their node_modules folder.

1

1 Answers

0
votes

I've built grunt-grunt with exactly this kind of scenario in mind.

grunt.initConfig({
    grunt: {
        lintsome: {
            gruntfile: 'node_modules/some/Gruntfile.js',
            task: 'jshint'
        }
    }
});

The README contains enough documentation to get you going.