Skip to content

[Feature] Adds --include-filtered-dependencies flag for bootstrap command#390

Merged
gigabo merged 17 commits intolerna:masterfrom
lukebatchelor:bootstrap-deps-when-scoping
Jan 19, 2017
Merged

[Feature] Adds --include-filtered-dependencies flag for bootstrap command#390
gigabo merged 17 commits intolerna:masterfrom
lukebatchelor:bootstrap-deps-when-scoping

Conversation

@lukebatchelor
Copy link
Copy Markdown
Contributor

Relies on #386, so the diff will include those changes also.

This adds a flag to the bootstrap command that ensures that all dependencies of any bootstrapped packages are also bootstrapped.

The use case for this is needing to "set up" a single package in a clean repository and not wanting to have to prepublish every single package.

This has been a major pain point for us in a repository with only 61 packages.

Some quick numbers from using in our repo:

time npm install

Total: 9:45.04 (bootstraps 61 packages)

time (npm install --ignore-scripts && npm link lerna && lerna bootstrap --scope ak-field-base --include-deps)

Total: 2:22.19 (bootstraps 6 packages, 5 direct dependencies and 1 transitive dependency)

@lukebatchelor
Copy link
Copy Markdown
Contributor Author

Closes #388

@lukebatchelor
Copy link
Copy Markdown
Contributor Author

Question: Should this warn if using the --include-deps flag when not using --scope or --ignore? The resulting build will be identical, its just misusing a flag. Happy either way. 👍

@lukebatchelor lukebatchelor force-pushed the bootstrap-deps-when-scoping branch from 874c8b7 to 773aea3 Compare October 25, 2016 01:35
@lukebatchelor
Copy link
Copy Markdown
Contributor Author

lukebatchelor commented Oct 25, 2016

The second Adds docs for --include-deps flag in readme commit was to force appveyor to rebuild as it is strangely failing to install npm itself, still seems to be failing.

Anyone have any idea why that might be? It says it's a permission error when trying to rename a file and to re-run it as an admin.

EDIT: Ran a clean branch with no issues in appveyor -> no problem
Reran this branch a third time -> no problem.

Appveyor seems to be a little flakey with npm 0.12

@lukebatchelor lukebatchelor force-pushed the bootstrap-deps-when-scoping branch from 773aea3 to 940c41a Compare October 25, 2016 02:30
@lukebatchelor
Copy link
Copy Markdown
Contributor Author

Playing with this a bit more locally, I'm wondering if this should also include dev dependencies? At the moment I just manually bootstrap those using the --scope flag because there isnt too many.

Anyone have any opinions on this? Happy to add it.

@lukebatchelor
Copy link
Copy Markdown
Contributor Author

I will definitely add the devDependencies at some point, its bitten me a few times using it locally now :P

@ilkkahanninen
Copy link
Copy Markdown

I think it's a good idea to add devDependencies to --include-deps. That way it works as users expect it to work.

@jamiebuilds jamiebuilds changed the title Adds --include-deps flag for bootstrap command [Feature] Adds --include-deps flag for bootstrap command Nov 16, 2016
@jamiebuilds
Copy link
Copy Markdown
Contributor

Hmm, --include-deps is ambiguous in certain commands I think. Can you rename it to --include-filtered-deps or something similarly descriptive?

@lukebatchelor
Copy link
Copy Markdown
Contributor Author

@thejameskyle It's not for filtered deps though, it's for transitive deps.

--include-transitive-deps maybe? Bit verbose, but I'm only going to wrap it in scripts anyway. I should hopefully have time to rebase, rename and add the dev dependencies this week/weekend.

@jamiebuilds
Copy link
Copy Markdown
Contributor

jamiebuilds commented Nov 16, 2016

lol maybe --include-filtered-deps-deps

@lukebatchelor
Copy link
Copy Markdown
Contributor Author

--bootstrap-deps maybe? Shorter and more descriptive/less ambiguous

@jamiebuilds
Copy link
Copy Markdown
Contributor

So the original idea of --include-filtered-deps was to mean include the deps that were filtered out --scope and --ignore.

@lukebatchelor
Copy link
Copy Markdown
Contributor Author

Happy to go with --include-filtered-deps. Tried to make the change today but I have a feeling im stuffing up this rebasing... Going to do it after #386 is merged so I can be sure this is right.

Super simple fix, just need to change the addDependencies function to use Object.assign({}, pkg.dependencies, pkg.devDependencies)

@lukebatchelor
Copy link
Copy Markdown
Contributor Author

@gigabo Could you take a look at this one as well when you have time?

This one is rebased on #386 and should be ready as well. It's pretty required to make #386 useful.

@gigabo
Copy link
Copy Markdown
Contributor

gigabo commented Dec 13, 2016

@lukebatchelor Please rebase this when you get a chance now that #386 has landed in master.

@lukebatchelor
Copy link
Copy Markdown
Contributor Author

Super weird, I did rebase on #386 and double checked the git log to make sure they had the same commits. Updating now

@lukebatchelor lukebatchelor force-pushed the bootstrap-deps-when-scoping branch from 47d99a5 to 886deb7 Compare December 15, 2016 23:40
@lukebatchelor
Copy link
Copy Markdown
Contributor Author

Oops, sorry. Got pulled away yesterday, should be good to go @gigabo
👍

@seansfkelley
Copy link
Copy Markdown
Contributor

Another thought on this topic (hopefully not derailing the PR too much in the process): I think this would be really valuable for all tasks to have, much like your filtering changes. Use case: lerna run build --scope foo --toposort --include-filtered-deps. Combined with #412, which I hope I get to today, this would allow me to rebuild foo and all of its dependencies in one shot in the right order (I have a Typescript project, so ordering matters, but a full rebuild of dependencies should be useful for non-Typescript projects too). This is very powerful, and likely has other usages that I haven't though of as well.

@lukebatchelor
Copy link
Copy Markdown
Contributor Author

@gigabo Could I get some eyes on this when you've got time? 👍

@gigabo
Copy link
Copy Markdown
Contributor

gigabo commented Jan 5, 2017

Hi @lukebatchelor yep, just getting back from the holidays. Will take a look! 👀

@spudly
Copy link
Copy Markdown
Contributor

spudly commented Jan 5, 2017

Quick question: would it make sense to change this to --include-dependencies'? I envision that at some point we might want a --include-dependents flag and "deps" could be either.

Use case for --include-dependents would be to quickly install and run tests for any package that uses a package you're modifying.

@lukebatchelor
Copy link
Copy Markdown
Contributor Author

@spudly it was changed to --include-filtered-deps recently. Do you think this could still have be confusing?

@lukebatchelor lukebatchelor changed the title [Feature] Adds --include-deps flag for bootstrap command [Feature] Adds --include-filtered-deps flag for bootstrap command Jan 5, 2017
@seansfkelley
Copy link
Copy Markdown
Contributor

I'm with @spudly on this: better to be entirely explicit, since it doesn't save many keystrokes that often anyway (so: --include-filtered-dependencies). Full disclosure: I was also thinking about an --include-(filtered?)-dependents flag (reason being that from my previous comment, it would be awesome to be able to automatically select dependents of my package for rebuilding to make sure things aren't broken).

@spudly
Copy link
Copy Markdown
Contributor

spudly commented Jan 5, 2017

@lukebatchelor & @seansfkelley,

Yes, I do still think we need to explicitly call it --include-filtered-dependencies. I know it's long, which is annoying, but this way users know exactly what is going to happen without searching through the documentation, and it leaves room for similar flags down the road.

My vote is for --include-filtered-dependencies so that @seansfkelley or someone else can later add --include-filtered-dependents.

@gigabo
Copy link
Copy Markdown
Contributor

gigabo commented Jan 5, 2017

This looks good to me.

As for deps vs dependents I don't see that as a big issue. deps is a common short form of depencies. Don't really see it used for dependents much. Not opposed to the long form if others feel strongly.

Thanks for your patience @lukebatchelor, and for the nice clean change set. 👍

@lukebatchelor
Copy link
Copy Markdown
Contributor Author

Sweet, well I'm happy with either as well. Personally I prefer deps because I spell dependency wrong approximately 100% of the time XD.

I'll leave the call up to you @gigabo / @seansfkelley ?

@seansfkelley
Copy link
Copy Markdown
Contributor

Everyone seems to be ambivalent, so I would err on the side of being explicit and just make it wordier. Reasonable?

@lukebatchelor
Copy link
Copy Markdown
Contributor Author

Sorry for the delay! Just managed to get some time to do this. Will rename this morning.

@lukebatchelor
Copy link
Copy Markdown
Contributor Author

@gigabo When you're ready 👌

@gigabo
Copy link
Copy Markdown
Contributor

gigabo commented Jan 19, 2017

Thanks @lukebatchelor!

@gigabo gigabo merged commit aeb775d into lerna:master Jan 19, 2017
@gigabo gigabo changed the title [Feature] Adds --include-filtered-deps flag for bootstrap command [Feature] Adds --include-filtered-dependencies flag for bootstrap command Jan 19, 2017
xaka added a commit to xaka/lerna that referenced this pull request Jan 20, 2017
gigabo pushed a commit that referenced this pull request Jan 20, 2017
@lock
Copy link
Copy Markdown

lock Bot commented Dec 27, 2018

This thread has been automatically locked because there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@lock lock Bot locked as resolved and limited conversation to collaborators Dec 27, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants