Closed jpmedley closed 7 years ago
@addyosmani @gauntface There was a version of my 'two minute' use case that alluded to calling a command line in a script. Somebody object to that, though I don't remember who or why. Before I proceed with this change, I want to make sure you guys are on the same page.
Also, what I've done seems like a valid use case. If your only objection is that I've bypassed an opportunity to show a cli recipe, I'd suggest that it's another topic. Is npm the only way to implement a cli use case? If not, then users of rollup or webpack won't think to look under npm for how to do it.
Regarding https://github.com/GoogleChrome/workbox-microsite/pull/24#issuecomment-301257466, in my mind, an npm scripts
getting started guide should be geared for developers who are already using an npm scripts
-based build process, and want to add service worker generation into that mix. Developers in that scenario can do so with very little effort if we just show them how to chain in workbox-cli generate:sw
to the end of their hypothetical scripts.build
entry.
The main nuance is that we'd have to explain how to kick off the one-time configuration wizard that's part of workbox-cli
. That wizard creates a workbox-cli-config.json
file, and once that file is there, it will be automatically picked up when workbox-cli
is run in the future.
@jeffposnick Here's another try. See what you think.
@jeffposnick Back to you.
@jeffposnick PTAL
My point about the order of the steps is that if you tell people to run
$ npm install --save-dev workbox-cli
and then
$ workbox-cli
that won't work. workbox-cli
will not be in the global $PATH
, and they can't just run it directly.
It might be working for you, because you've previously done npm install --global workbox-cli
, but we don't want to force people to do a global install if they don't want to.
If you tell people to run workbox-cli
via an npm run <something>
, it takes care of that issue, since npm run <something>
sets up the $PATH
to include the locally installed node_modules/.bin/workbox-cli
.
If you're not familiar with this behavior, there's it's explained at, e.g., http://2ality.com/2016/01/locally-installed-npm-executables.html#inside-an-npm-package (Background only; I'm not advocating linking to that in our docs.)
13