Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

multiple grunt configs/tasks #15

Open
JestDotty opened this issue Apr 28, 2017 · 2 comments
Open

multiple grunt configs/tasks #15

JestDotty opened this issue Apr 28, 2017 · 2 comments

Comments

@JestDotty
Copy link

JestDotty commented Apr 28, 2017

module.exports = function(grunt){
  grunt.loadNpmTasks('grunt-screeps');
  grunt.initConfig({
    screeps: {
      default: {
        options: {
          email: creds.email,
          password: creds.password,
          branch: 'default',
          ptr: false
        },
        dist: {
          src: ['dist/*.js']
        }
      },
      test: {
        options: {
          email: creds.email,
          password: creds.password,
          branch: 'test',
          ptr: false
        },
        dist: {
          src: ['webpack/main.js']
        }
      }
    },
  });
  
  grunt.registerTask('screeps', ['screeps:default'])
  grunt.registerTask('screepsTest', ['screeps:test'])
  //grunt.registerTask('default', ['screeps'])
}

when i try to do grunt screepsTest it just hangs forever

when I googled it seems certain grunt modules allow this, others don't? If I did it wrong please tell me, too, thanks.

@HontoNoRoger
Copy link

I assume re-registering a task called screeps is the issue there. Try to use another another name, since screeps is already registered as multitask.
Check what is actually happening with grunt --verbose screepsTest.

@geoffpotter
Copy link

I ran into this issue, but was able to figure out what I was doing wrong and it looks like you've made the same mistake I did. Since this is old I'm guessing you've either solved it already or moved on, but I'll post here in case it helps anyone else.

You just need to move your scr: entries up to the test: and default: level, the dist: entry is only valid as a child of the screeps: one.

here's the relevant section of my config:
` screeps: {
private: {
src: ['dist/*.js'],
options: {
server: {
host: host_private,
port: port_private,
http: http_private
},
email: email_private,
password: password_private,
branch: branch_private,
ptr: false
},
},

  public: {
    src: ['dist/*.js'],
    options: {
      email: email_public,
      password: password_public,
      branch: branch_public,
      ptr: ptr
    }
  }

},`

Basically it's just how grunt handles loading files into it's tasks via the config. With the default config in the readme, you can remove the dist element and put the src element right after the options element and it will still work. If you look at the logs, with the dist: there it says it's running screeps:dist, but without it, it will say it's running screeps:src. So adding extra configs just messes with how they choose to write the default settings block.

This is also why it hangs, it's not finding any files and it doesn't have a check for that, so it's just sitting there waiting for the for loop to call it's done function, but the for loop didn't run cuz the array is empty.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants