jakejs / jake

JavaScript build tool, similar to Make or Rake. Built to work with Node.js.
http://jakejs.com
Apache License 2.0
1.97k stars 190 forks source link

Add config.js file to define jake.exec() default options #358

Closed imhaage closed 3 years ago

imhaage commented 5 years ago

I edited the lib/utils/index.js to check if a file Jakeconfig.js exists in the current working directory. If the file doesn't exists the fallback uses the default options initially set:

// lib/utils/index.js
var execOptsDefault = (function() {
  try {
    return require(`${process.cwd()}/Jakeconfig`).exec;
  } catch (e) {
    return {
      interactive: false,
      printStdout: false,
      printStderr: false,
      breakOnError: true
    };
  }
})();
//Jakeconfig.js
module.exports = {
  exec: {
    interactive: true,
    printStdout: true,
    printStderr: true,
    breakOnError: true
  }
};
mde commented 5 years ago

This looks great. I've added you to the JakeJS org, so you can contribute more easily. "Use your powers for good," etc. 😄

kibertoad commented 5 years ago

I assume tests are still coming?

imhaage commented 5 years ago

Thank you very much. Our team really loves this tool, we'll be glad to contribute.

The only reason it's a draft is because I'm a young developer (less than one year of experience) and I don't know enough about modifying existing tests. I'll ask our senior dev tomorrow for help but if you can give some guidance I'll be happy to learn what you're expecting.

For now I understand that the "test basic exec" crashes because the printStdout option is expected to be null. Since there I don't know yet how to write the best test for the code I wrote.

mde commented 5 years ago

You can have a look at the existing tests to find good ways to test Jake. It can be tricky because it's a build tool, but there are ways to do it. Great to see this work happening!

imhaage commented 5 years ago

Thank you, so I'll study existing tests thoroughly to have a better idea what must be done. It will be a good opportunity to learn more about testing. I'll do that as soon as possible but I'll probably need a few days to find enough time to learn and write the code.

imhaage commented 5 years ago

Hi. I didn't have enough experience to write the tests alone so I needed help from an experienced developer and it was difficult to find time to work together. So it took longer than expected to send you the PR.

imhaage commented 5 years ago

I just discovered that we use a function copyFileSync() that doesn't exist on Node 6 & 7 so I'll have to fix that too.

imhaage commented 3 years ago

I'm terribly sorry, I was totally overwhelmed by a lot of things to do and to learn and I didn't have enough time or knowledge to make this PR work with Node 6 & 7. I'm closing this PR, you can do whatever you want with this code if it's always helpful.

I'm leaving the organization because I won't be able to spend time on the project. Thank you for your welcome and good continuation! :wink: