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

Implement .gulprc support #69

Closed
phated opened this issue Apr 5, 2016 · 12 comments
Closed

Implement .gulprc support #69

phated opened this issue Apr 5, 2016 · 12 comments

Comments

@phated
Copy link
Member

phated commented Apr 5, 2016

Implement through use of gulpjs/liftoff#8 which has outstanding PR at gulpjs/liftoff#67

@phated
Copy link
Member Author

phated commented Jul 27, 2016

Support for this in Liftoff was just published as 2.3.0

@sttk would you like to implement it for gulp?

@sttk
Copy link
Contributor

sttk commented Jul 28, 2016

@phated Yes, I'd like to implement it.

I want to use key chain style for gulprc as below, but it is not popular as a configuration file. Can I use this style and the module customerizer for this?

cli.flags.cwd = 'path/of/cwd';
cli.flags.logLevel = 4; 

colors.tasks.tree.task.name = s => chalk.bold(chalk.blue(s));
colors.tasks.tree.task.description = chalk.black;

@phated
Copy link
Member Author

phated commented Jul 28, 2016

@sttk I don't think the configuration file needs to be that complex. I also think that attempting the implementation with the most simple thing first is the correct approach (so don't start with colors). I think the easiest thing to support would be a top level description property as outlined in #70. The .gulprc would then look like:

{
  "description": "My sample description for gulpfile"
}

It could also be a node module that used module.exports = ... because we will just be using require to load the file.

@sttk
Copy link
Contributor

sttk commented Jul 30, 2016

@phated I got it. And I agree that we should start with the most simple configuration.

... we will just be using require to load the file.

require and rechoir can't get the extension "rc" from filename ".gulprc". So they load the file as a js file.

For autoloading .gulprc with rechoir, we need to do follwing two things:

  1. Create a new loader for JSON file. This code would do a thing like module.exports = JSON.parse(fs.readFileSync(fp, opts)) and something similar to module.load except resolving extension.
  2. Change extension module in rechoir to enable to get the extension "rc" from the filename ".gulprc". This would be made possible by seeking a matching tail in rechoir's argument config.

@sttk
Copy link
Contributor

sttk commented Jul 30, 2016

@phated Can I change rechoir as above?

@phated
Copy link
Member Author

phated commented Jul 30, 2016

Oh, you are right that .gulprc won't work out of the box with require. Let's just support .gulp.js, etc (all the extensions we already support).

@sttk
Copy link
Contributor

sttk commented Jul 30, 2016

I got it. I'll implement so.

@sttk
Copy link
Contributor

sttk commented Aug 6, 2016

@phated I determined that the configuration file name is .gulprc.*, and I'm planning the following features about the configuration file.

  • Load and merge configuration files in home directory, project directory, current work directory if exists.
  • Print configurations in JSON format by --output-config flag.
  • Load and merge configuration files by --config or -c flag.
  • Ignore configuration files by --ignore-config flag, except files specified by --config flag.

@sttk
Copy link
Contributor

sttk commented Aug 6, 2016

And I implemented the first and second check items in my repository.

sttk/gulp-cli#support_gulprc ( Comparing changes )

Please point out about the features, the implementations, etc.

@sttk
Copy link
Contributor

sttk commented Aug 10, 2016

@phated I've implemented all features above.

@phated
Copy link
Member Author

phated commented Aug 10, 2016

@sttk please submit a PR, I think some of the stuff might be added complexity but I'd like to see it all together first.

@sttk
Copy link
Contributor

sttk commented Aug 10, 2016

@phated I've sended the PR #90 about this issue.

@phated phated closed this as completed in caa0a82 Aug 22, 2016
phated pushed a commit that referenced this issue Aug 22, 2016
Includes implementation for description configuration (closes #70)
phated pushed a commit that referenced this issue Dec 21, 2017
Includes implementation for description configuration (closes #70)
phated pushed a commit that referenced this issue Dec 21, 2017
Includes implementation for description configuration (closes #70)
phated pushed a commit that referenced this issue Dec 21, 2017
Includes implementation for description configuration (closes #70)
phated pushed a commit that referenced this issue Dec 21, 2017
Includes implementation for description configuration (closes #70)
phated pushed a commit that referenced this issue Dec 21, 2017
Includes implementation for description configuration (closes #70)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants