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

Slimmer Phantomas with a plugin/extension model #593

Open
EFF opened this issue Feb 1, 2016 · 18 comments
Open

Slimmer Phantomas with a plugin/extension model #593

EFF opened this issue Feb 1, 2016 · 18 comments

Comments

@EFF
Copy link
Contributor

@EFF EFF commented Feb 1, 2016

This is just a simple suggestion but I think it could be good to adopt an "extension model" for reporters and engines.

Concretely, I'm suggesting to split the code base and keep the essentials here as the project will no doubt continue to grow both in code size and popularity. The idea would be to extract most of reporters in different npm modules just like grunt or gulp did (default would be json). Same goes for engines (default would be webkit).

Why?
Simple answer : In some cases I need a complexe reporter and in some cases I don't. Like most of modern developer, I like to keep my number of external dependencies as small as possible. Moreover, this change will drastically decrease install time.

Tell me what you think.

@macbre macbre added the internals label Feb 1, 2016
@macbre macbre added this to the Roadmap milestone Feb 1, 2016
@EFF
Copy link
Contributor Author

@EFF EFF commented Feb 3, 2016

@macbre It makes sens to you ?

If yes, I can start to design something on my free time.
If not, I won't push any further

@macbre
Copy link
Owner

@macbre macbre commented Feb 7, 2016

I guess we've reached the milestone where phantomas can be considered quite a large and complex project. And it's worth to refactor it into smaller components.

@EFF, your suggestion does make sense. Let's discuss the details.

@macbre
Copy link
Owner

@macbre macbre commented Mar 24, 2016

We can start with extracting custom reporters into separate npm modules and just leave plain and json ones in the core.

I can start with phantomas-reporter-elasticsearch.

@EFF
Copy link
Contributor Author

@EFF EFF commented Mar 25, 2016

Sorry I was pretty busy lately. I should be able to tackle a couple of reporters this weekend as well. Please make sure that you specify every you do on this so we don't do the job twice.

More over, what was your plan ? simply require the write "phantomas-extension" when and if not installed to throw a basic error like "please make sure to install before using it" ?

@macbre
Copy link
Owner

@macbre macbre commented Mar 25, 2016

I'd replace the import of a "local" reporter in reporter.js with a require("phantomas-reporter-<reporter name>"). And of course update the error message.

@macbre macbre modified the milestones: Roadmap, v1.16 Mar 25, 2016
@EFF
Copy link
Contributor Author

@EFF EFF commented Mar 27, 2016

@macbre what do you think if we do it gradually. What I mean by that is while we migrate to this model, we should have both "local" and "external" reporters. Concretely we could add the require("phantomas-reporter-<reporterName>") in a try catch block, if the reporter is not installed as an "external" we try the old "local" import. Then, once we're done, we remove the local reporter import (or not if you want to stay extensible)

@macbre
Copy link
Owner

@macbre macbre commented Mar 27, 2016

👍 for the suggestion above

@EFF
Copy link
Contributor Author

@EFF EFF commented Mar 28, 2016

@macbre where do you want to extract the reporters ?
Do you want to create a phantomas organization in order to keep most of phantomas development at the same place on GitHub ?

@macbre
Copy link
Owner

@macbre macbre commented Mar 28, 2016

Development of phantomas reporters in "private" repositories (i.e. not under github.com/macbre or github.com/phantomas) is fine to me. npm will be used to install reporters. As long as we keep using phantomas in the package names and keywords section in package.json we should be fine. Let's see how it goes :)

@macbre macbre added architecture and removed internals labels Mar 28, 2016
@macbre
Copy link
Owner

@macbre macbre commented Mar 30, 2016

@EFF - unfortunately github.com/phantomas is already taken :(

@macbre macbre mentioned this issue Mar 30, 2016
0 of 1 task complete
@EFF
Copy link
Contributor Author

@EFF EFF commented Mar 30, 2016

@macbre let me ask github customer support , the account appears to be empty and inactive. If it is in fact, they might give it away.

@macbre
Copy link
Owner

@macbre macbre commented Mar 31, 2016

@EFF: sure, go ahead :)

@macbre
Copy link
Owner

@macbre macbre commented Apr 4, 2016

After running the following I'm even more for it :)

macbre@debian:~/github/phantomas$ du -hs node_modules/
202M    node_modules/
@EFF
Copy link
Contributor Author

@EFF EFF commented Apr 5, 2016

@macbre I wrote to GitHub, the phantomas account is not qualified as 'dormant' in their records but they contacted the person for me just in case.

see : https://github.com/EFF/phantomas-reporter-cloudwatch for cloudwatch reporter.

I'll continue with statsd another day

@macbre
Copy link
Owner

@macbre macbre commented Apr 5, 2016

@EFF thanks x3!

As for the phantomas-reporter-cloudwatch: the package is on npm, I guess we can now remove this reporter (and its dependency) from the main phantomas repo.

@macbre
Copy link
Owner

@macbre macbre commented Apr 6, 2016

@EFF, I might have misunderstood the point of this ticket, but shouldn't we exclude phantomas-reporter-cloudwatch package from package.json? If someone wants to report to cloudwatch, then just run npm install phantomas-reporter-cloudwatch. Otherwise the size of all dependencies needed for phantomas to be installed will stay the same.

@EFF
Copy link
Contributor Author

@EFF EFF commented Apr 6, 2016

Wo ! my mistake ! Sorry about that ! I'll fix this

@macbre
Copy link
Owner

@macbre macbre commented Apr 6, 2016

No worries, we're on the same page now :)

@macbre macbre modified the milestones: v1.16, v1.17 Jul 10, 2016
@macbre macbre modified the milestones: v1.17, Roadmap Sep 21, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants
You can’t perform that action at this time.