-
Notifications
You must be signed in to change notification settings - Fork 2k
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 contains a lot of things not necessary to end users #1998
Comments
@steren for which sample is this? AppEngine? |
Ah sorry, it's the sample used at https://cloud.google.com/run/docs/quickstarts/build-and-deploy#node.js |
Hi Steren, we need the |
Could the internal test info be stored somewhere else? |
@JustinBeckwith I wonder if this is something that you solved in other repos. |
Yeah, so taking a few steps back :) By a very large margin, developers are far more likely to consume samples via the embedded snippets available on pages of cloud.google.com. A very small percentage of users are actually cloning the repository, and looking at every single file. As such - we really do focus on the overall experience for how the snippets in this repository are embedded on cloud.google.com than we do on the merit of the standalone repository. Now, that having been said - having snippets on cloud.google.com where we reference the $ mkdir hello-run
$ cd hello-run
$ npm init -y
$ npm install express From there, I would instruct the developer to add the "start": "node index.js" And that's all we need! I don't think we need to provide a copy of the |
For now, we favored copy-pasting a 5-line But this is just one specific example, the broader question is that Google's internal testing sauce is not really useful when the repo is cloned, and should probably better be stored separately, or at least in different files or folders clearly marked as "internal". |
For the second bit - that was kind of the point I was trying to make. The number of users who clone this repository and try to run the code, or use it as an example is astonishingly low, as compared to folks who copy the snippets on cloud site. And in those cases - exposing how we test the snippets they use isn't strictly a bad thing :) We mostly care about what gets exposed on cloudsite. I'm entirely open to a discussion on how we optimize the cloudsite experience. I'm uninterested in changing how things are presented to users to clone the repo (because data). |
@averikitsch my worry of overriding it in the doc is that the I'm not sure there is a solution to this discussion, so I'm fine closing as working as intended. |
Right, I don't want the docs to get stale either. The Java quickstart sample does the Java equivalent of As for testing, we have found that users actually do run the tests and want to run the tests to make sure the sample is working as intended. We do make sure testing can be done both locally and on our system. We also make sure it follows best practices, so users can learn from our testing practices. |
For most regular samples, yes I agree that users want test. But here we are talking a Hello World, which is supposed to be the smallest, most simple, less scary code to print "hello". We can switch to |
I think the existing package.json is too messy for cloudsite, and was a side effect of migrating to this repo where the testing infrastructure is partially centralized instead of entirely centralized. Options here seem like:
|
I'm in favor of option 3. We just need to be aware that we won't get dependency updates. So if |
I still don't think this is an actual problem. Creating a secondary copy of the package json will absolutely lead to us missing things like dependency updates, changes to the npm scripts, etc. Wont this be a net negative? |
For this particular repo, we render |
But maybe correct is better than short, and we should keep it as is? |
If all that's really there is express, I guess it's ok 🤷 That thing has a semver major update once every other year :) |
Could an external system ensure that the |
That seems like a lot of overhead. |
Addresses #1998 The last update for Express was 2 years ago but we could potentially update the [Renovate config](https://github.com/GoogleCloudPlatform/nodejs-docs-samples/blob/master/renovate.json) with [`matchPaths`](https://docs.renovatebot.com/configuration-options/#matchpaths) for Renovate to update package*.json.
Now updated in the docs. |
Here's what we ask customers to copy paste in the quickstart:
In practice, this could be boiled down to:
The goal is the quickstart is to give a brief hello world experience, so
devDependencies
and additionalscripts
are not needed.Similarly,
author
should not be Google, because we expect customers to copy paste it for their use.The text was updated successfully, but these errors were encountered: