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

Expose flags.cwd as config option #109

Open
phated opened this issue Apr 26, 2017 · 11 comments
Open

Expose flags.cwd as config option #109

phated opened this issue Apr 26, 2017 · 11 comments

Comments

@phated
Copy link
Member

phated commented Apr 26, 2017

The chdir logic already comes later in the program so this one should be easy.

@sttk
Copy link
Contributor

sttk commented Jun 10, 2017

@phated I have a question about this flag.

Cli options --cwd and --gulpfile have relation to each other as follows:

$ gulp --cwd aaa/bbb
[23:10:19] Working directory changed to /path/to/aaa/bbb
[23:10:19] Using gulpfile /path/to/aaa/bbb/gulpfile.js
...
$ gulp --gulpfile aaa/bbb/gulpfile.js
[23:11:32] Working directory changed to /path/to/aaa/bbb
[23:11:32] Using gulpfile /path/to/aaa/bbb/gulpfile.js
...
$ gulp --cwd aaa/bbb --gulpfile ccc/ddd/gulpfile.js
[23:35:57] Working directory changed to /path/to/aaa/bbb
[23:35:57] Using gulpfile /path/to/ccc/ddd/gulpfile.js
...

And the current behavior with the config flag.gulpfile is:

$ cat .gulp.json
{
  "flags": {
    "gulpfile": "aaa/bbb/gulpfile.js"
  }
}
$ gulp
[23:13:33] Using gulpfile /path/to/aaa/bbb/gulpfile.js
...

Should these configs flag.gulpfile and flag.cwd have relations like cli options?

@phated
Copy link
Member Author

phated commented Jun 12, 2017

@sttk I think you may have missed some more examples because the current behavior seems to match? Maybe I'm just missing it.

@sttk
Copy link
Contributor

sttk commented Jun 15, 2017

@phated This behavior about cli options comes from liftoff.
env.configPath (=gulpfile path), env.configBase (=gulpfile directory) and env.cwd affect each other.
No other options used by liftoff behave as such.

@phated
Copy link
Member Author

phated commented Jun 18, 2017

I noticed that a few options I wanted to expose as config options needed to be resolved before liftoff (e.g. nodeFlags). I'm not sure how we should resolve these problems. Maybe @tkellen has an idea.

@ericchenshine
Copy link

ericchenshine commented May 10, 2018

In the project we usegulp --gulpfile=aaa/bbb/gulpfile.js and it works fine. Now we want to add default gulpfile path in the gulp config file .gulp.json. However this does not work as expected. And I keep getting the error as below

Task 'default' is not in your gulpfile

When comparing to the logs in the output, we see using CLI option gulpfile will change CWD first.

I am wondering if this could be fixed soon? Thanks!

@sttk
Copy link
Contributor

sttk commented Mar 21, 2019

@phated As @ericchenshine said above, current flags.gulpfile in config file doesn't change cwd unlike --gulpfile cli option. In addition, flags.gulpfile in home dir resolves its relative path with home dir unlike flags.require.

Should we give consistency to flags.gulpfile with other cli options and config flags? (This would affect to behaviors when specifying combinations of all or some flags.gulpfile, flags.cwd, --gulpfile and --cwd.)

@phated
Copy link
Member Author

phated commented Mar 21, 2019

Parity would be great! This can now be solved with the Liftoff changes, correct?

@sttk
Copy link
Contributor

sttk commented Mar 21, 2019

  1. For changing cwd by flags.gulpfile, we should change lib/shared/config/env-flags.js to replace env.cwd to env.configBase when detecting env.configPath's change.

  2. For relative path of flags.gulpfile, this path resolving of gulpfile should be removed. This is same to flags.require in New: Support flags.require config option (closes #108, closes #167) #183.

@phated
Copy link
Member Author

phated commented Mar 21, 2019

@sttk I'm fine with those changes. The current behavior seems like a bug so we could probably release it in the same version as the other upcoming changes.

@phated
Copy link
Member Author

phated commented Apr 20, 2019

Due to how complex this issue has become, I'm going to move it to the 3.0 milestone because it might be breaking to some people's workflows.

@phated phated modified the milestones: 2.x, 3.0 Apr 20, 2019
@phated phated removed this from the 3.0 milestone Mar 23, 2024
@phated phated added this to post-v5 Mar 23, 2024
@phated
Copy link
Member Author

phated commented Mar 23, 2024

This has moved to post-v5, but will actually fall into v6 because I plan to change the way Liftoff works and that should make this significantly easier/less error prone.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: No status
Development

No branches or pull requests

3 participants