-
Notifications
You must be signed in to change notification settings - Fork 1
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
package.json #11
package.json #11
Conversation
The submodules are first and foremost for getting at the documentation of the various plugins, and for being able to edit that documentation so as to be able to push changes, but we can also use the code in them for bit-docs as plugins by use of file: paths, so to avoid remote npm. For those plugin repos that have necessary branches that have not yet been merged into master, we pull from GitHub instead of checking out that branch in the local submodule so as to leave the submodule available for the explicit purpose of editing documentation. If the necessary branches were still in development, we could clone them locally anywhere and point the file: to that location as needed, thus having one copy of the plugin repo for editing documentation and another for developing the code of the plugin.
Although it is not necessary to run `npm install` in the docs/modules submodule repos to make and use code or documentation changes, one might still run `npm install` in order to run the tests for that submodule.
I don’t 100% understand why using git submodules is better than npm.
This is the same idea that with npm, you could submit a PR that points to your branch, right? My understanding is that with the related PRs, you can use Does using git submodules remove the need to install to see your changes? |
Getting out of the npm dependency paradigm for that express purpose of pulling in documentation to a website using bit-docs as the build tool is helpful, because doing so aids in delineating what is being documented, versus what is an actual dependency of the website itself. It's also more lightweight, because using npm to pull in the repos needing to be documented will run Using npm to pull in repos that need to be documented does not make sense for these reasons; you're just cluttering up the This This might help to clarify further: As hinted at in the OP, most consumers of bit-docs [+plugins] will probably not use |
be41332
to
f941fe8
Compare
See extended commit message details for more information on each commit.
Try it out:
Because this
package.json
specifies the#file-pathed-deps
branches for bothbit-docs-generate-html
andbit-docs/bit-docs
, it is possible to edit the various submodules such asbit-docs-prettify
and see the changes by simply runningnpm run cache-bust && npm run gen
(as opposed to having to make a new release on npm or use complicated symlink scripts).If you ever don't see your changes, try running
npm run genf
(takes longer; reinstalls everything).A simple change you can test is to edit
docs/modules/bit-docs-prettify/prettify.less
to add somebackground-color
to thebody
:This will be especially useful for websites that have their own "theme" plugin.
Note that submodules will only be updated once upon initial
npm install
because of the-f test
in thepreinstall
command:This is done because as you edit submodules they have the unfortunate side effect of throwing error if changes would be overwritten by
git submodule update
which also can move away from the changes you just made in the working directory (something you wouldn't want to happen upon runningnpm install
a second or third time). Theupdate
in the initialgit submodule update --init
is needed becausegit submodule init
doesn't actually clone things down initially, it just registers the.gitmodules
file, so this all is necessary. This shows the caveat of using git submodules in the fact that they are rather hard to work with if you're unfamiliar.The nice thing about git submodules is that if someone makes a PR with a docs change to for instance
bit-docs-prettify
, they could also submit a PR tobit-docs-website
updating thehash
that the submodule is pointing to. I also like how GitHub makes it obvious thatdocs/modules
is meant to be a bunch of sub-repos like "bit-docs-prettify @ 114e4c9" that is also a link to that repo.There's also git-subtree but that might be even more rare and hard to understand for people.
For some teams, a simple nodejs or bash script that clones the needed git repos into directories that are
.gitignored
upon initialnpm install
might be the best option.Any of these options are better than the current
npm install
paradigm which has the pitfall of not being able to make changes, immediately test locally, and then commit (unlike the previously mentioned options that integrate with source control) — You could do something likenpm install ../path/to/previously/cloned/subrepo
but you'll have to do that for each and every plugin or documentation repo you want to work on, and it's manual setup that can be nicely baked-in like with the previously mentioned options.