-
Notifications
You must be signed in to change notification settings - Fork 7
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
Add tracking JSDoc template and plugins. #6
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
❓
As far as I understand, one of the advantages of having this in the wocommerce-grow
repo is avoiding to load the dependencies in the package.json
I deleted in GLA these plugins:
jsdoc
jsdoc-advanced-types-plugin
jsdoc-plugin-intersection
jsdoc-plugin-typescript
Then when I run npm run doc:tracking
I got an error since jsdoc
is not loaded.
So the question ❓ is:
Have you considered loading a bin in the tool?
Then we can just do:
docs:tracking: woocommerce-grow-tracking-jsdoc ./js/src .jsdocrc.json
packages/js/tracking-jsdoc/README.md
Outdated
@@ -0,0 +1,83 @@ | |||
# woo-tracking-jsdoc |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
❓
In .jsdocrc.json
I see jsdoc-plugin-intersection
as well as "recurse": true
Not sure if we can remove them. If they are useful we could add it to the Readme as well?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We cannot remove them, as they are needed. jsdoc-plugin-intersection
- is a plugin that lets jsdoc
parse types intersections. and recurse
is a CLI argument that makes jsdoc
parse the code recursively.
I wouldn't mention them in woo-tracking-jsdoc
as those configs have nothing to do with tracking, and are not related at all to this plugin.
Potentially, I could add/mention them in a potential new package mentioned in #6 (comment)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Problem of not mentioning anything is that when a developer implements the tool he wont add those into .jsdocrc.json
creating errors.
As far as I see, in the README.md should be instructions about how to have the tool running.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But the tool described here is woo-tracking-jsdoc
plugin, not the entire jsdoc
.
In Google Listing & Ads README.md, we do not mention how to add AutomateWoo to WooCommerce, or how to add variable product to WC products list.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This PR does not deliver a "tool to generate all the docs for an extension" (yet, we could implement that in the following PRs). This PR only moves one jsdoc
template and a few pluginsfor tracking docs onyl.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This discussion is closely related to #6 (comment)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we could implement that in the following PRs
I can buy that :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I got your point about that. Since in theory are conceptually separated things.
But in the reality what I experienced was that after installing
woocommerce-grow-tracking-jsdoc
I could not track anything since I needed dependencies and configs that doesn't appear in the Readme (see intersection, recurse and jsdoc-advanced-types-plugin and jsdoc itself).By adding those to the repo I just run
doc:tracking
and go the only thing that (maybe) I need to do is to add the provided config in the readme.
In reality, they have also separated things.
If you would have a repo whose source code is already parseable by jsdoc
, adding woocommerce-grow-tracking-jsdoc
. If you create a repo with a single js file with a simple JSDoc in it, it will work.
BTW jsdoc
is added as a peer dependency, so you get a warning if you don't have it. (The amount of warnings we get in GLA, and warning blindness it introduces, are a separate topics, beyond the scope of PR ;) )
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What I think we could add to this readme is
- Set up jsdoc, so it parses your source code.
From the perspective of this plugin that would be enough to make docs:tracking
work once you just added it.
As well, we cannot anticipate all the JS and JSDoc parser problems one may get with their source code.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So my main comment is:
Are we (grow) using JSDOC for anything besides tracking the docs? --> I think no
Are we (grow) planning to use JSDOC for anything besides tracking the docs? --> I think no, neither
But I'm fine if we have 2 different repos. One for tracking only and other for loading jsdoc base deps
To me, the main goal of extracting dev tools to this repo is to reduce the noise and bloat in the extension's repo. This goal is achieved here to a valuable extent, as we removed 4 files, and left only So I think it's a good first step before any other potential changes. Just move the code more-or-less as it was.
The custom, but shareable, tracking-specific code was modularized in a form of "conventional"
I was thinking of it, but in my opinion, it's not worth it. Making it a separate binary/script => tool, has a cost:
I assume that some consumers may want to use When we leave it as To keep the benefits mentioned above, but still address the problem of a number of resources I was planning a different thing. You can think of it as an analogy to
|
That way the plugins don't need to load those dependencies in
I think for that better to implement custom jsdoc directly (without using he tool). I see the tools as a fixed generic convention based on the common between grow projects and with consistency.
I'd suggest to add features in the moment they are pretty common between projects and the conventions dictates so. In brief I would not be very open with customisation. Since that is what JSDOC itself does. So no need of a tool repo for that since the advantages/cost would be very low. |
That's why, as I proposed in the end of the comment above, I'd pack them to another package, like |
Do I get understand you correctly, that you suggest to make it like:
or
? I think it depends on the overall vision we have for the tools in this repo. If I understand what you suggest it's to have something like an all-in-one solution tailored solely for Grow needs. So as a consumer I'd just do I definitely see the benefits of such a solution:
But I also see the downsides:
My vision is somewhat different. I see this repo as a bag of different, as small as possible tools. Tools that could be seemingly disjointed. But the tools are atomic enough, so they could be easily and quickly iterated on, experimented, plugged in here and there. Then eventually moved to a more generic toolbox, like If we create a new Then to address bloated configs, or too many dependencies, we can embrace modularity, and make other packages that solves that problem by using this |
I think you get me wrong. I don't mean to add those features. I mean that when somebody else would think that in their extension, they for some reason need a support for CoffeeScript they would either ask us, or simply assume |
I'm not sure I understand what you mean here. But if I do, I'd say that's precisely why I'd use Similarly to what we did with Storybook. We still use its config (https://github.com/woocommerce/google-listings-and-ads/blob/develop/storybook/main.js#L27-L47) , and configure there:
|
No, I was talking about the potential need of flexibility and customisation mentioned as an "advantage" of having jsdocs dependencies in the client project against in the tool itself. So I was referring to these points mentioned in #6 (comment)
If thats the need, a consumer can always just implement jsdoc without using our repo :)
With this I mean: "doc:tracking": "woocommerce-grow-tracking-jsdoc", // generates tracking docs in our way (no params accepted) Why is my concern about having super atomic and customisable tools? Well at the end we will spend more time handling all the potential atomic use cases. In a way that the time spent on the development of the tools could be more expensive than ,for example, just adding our own config and files in the consumer. Having generics enforces to follow the standards and work in the same way behind Woo Grow umbrella . "Wanna have the advantages of running doc tracking and storybook in one line dependency?" -> Follow the standard But this is just my opinion which doesn't mean is more or less correct than yours |
Kinda the same concept as in #6 (comment) I'm ok with having config file (sometimes is even not possible to have it in the tool (i.e storybook) But if we can get rid of the deps... why not ? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
✅ Im approving this for now but with buts. (im going afk soon and I don't want to be a blocker)
My buts:
- Pending to discuss about name convention with the team (maybe P2) and change the current tools according that name convention in other PR
- Pending to create another tool for loading JSDOC base deps or merging them inside this tool
- I guess it'd be good to discuss about the philosophy behind the tools. Like if we wanna reduce as much as possible the work on the customer side sacrificing flexibility or we want to offer flexibility and customisation by creating a bigger number of atomic tools or increasing work on consumer side.
Yes, the difference here and main source of discussion is that the essential add-on dependencies and storybook itself is loaded in the tool, on the other hand, jsdoc lib as well as the essential plugin dependencies are loaded in consumer side. Storybook only needs 1 dependency + config (plugin/addons deps as well as storybook itself and gh pages are loaded in the tool) |
Partially addresses #6 (comment)
Addressed in #10 |
Separate issue to discuss that: #7 |
Created a Ventures P2 post |
Changes proposed in this Pull Request:
copied from https://github.com/woocommerce/google-listings-and-ads/tree/c69c514315d5f70a9c6c602c33c678525c0296c1
Screenshots:
Detailed test instructions:
See woocommerce/google-listings-and-ads#1521 for example
npm install --save-dev https://gitpkg.now.sh/woocommerce/grow/packages/js/tracking-jsdoc?add/jsdoc
Additional details:
Changelog entry