From 7e26f8988c311bbd29dbc37efaad5496464664b7 Mon Sep 17 00:00:00 2001 From: Justin Beckwith Date: Tue, 31 Jul 2018 21:36:09 -0700 Subject: [PATCH 1/4] add more templates for nodejs --- .../gcp/templates/node_library/.appveyor.yml | 20 +++++++ .../gcp/templates/node_library/.eslintignore | 3 ++ .../gcp/templates/node_library/.eslintrc.yml | 13 +++++ .../node_library/.github/CONTRIBUTING.md | 53 +++++++++++++++++++ .../node_library/.github/ISSUE_TEMPLATE.md | 27 ++++++++++ .../.github/PULL_REQUEST_TEMPLATE.md | 5 ++ .../gcp/templates/node_library/.jsdoc.js | 45 ++++++++++++++++ synthtool/gcp/templates/node_library/.nycrc | 26 +++++++++ .../templates/node_library/CODE_OF_CONDUCT.md | 43 +++++++++++++++ 9 files changed, 235 insertions(+) create mode 100644 synthtool/gcp/templates/node_library/.appveyor.yml create mode 100644 synthtool/gcp/templates/node_library/.eslintignore create mode 100644 synthtool/gcp/templates/node_library/.eslintrc.yml create mode 100644 synthtool/gcp/templates/node_library/.github/CONTRIBUTING.md create mode 100644 synthtool/gcp/templates/node_library/.github/ISSUE_TEMPLATE.md create mode 100644 synthtool/gcp/templates/node_library/.github/PULL_REQUEST_TEMPLATE.md create mode 100644 synthtool/gcp/templates/node_library/.jsdoc.js create mode 100644 synthtool/gcp/templates/node_library/.nycrc create mode 100644 synthtool/gcp/templates/node_library/CODE_OF_CONDUCT.md diff --git a/synthtool/gcp/templates/node_library/.appveyor.yml b/synthtool/gcp/templates/node_library/.appveyor.yml new file mode 100644 index 000000000..240821526 --- /dev/null +++ b/synthtool/gcp/templates/node_library/.appveyor.yml @@ -0,0 +1,20 @@ +environment: + matrix: + - nodejs_version: 8 + +install: + - ps: Install-Product node $env:nodejs_version + - npm install -g npm # Force using the latest npm to get dedupe during install + - set PATH=%APPDATA%\npm;%PATH% + - npm install --force --ignore-scripts + +test_script: + - node --version + - npm --version + - npm rebuild + - npm test + +build: off + +matrix: + fast_finish: true diff --git a/synthtool/gcp/templates/node_library/.eslintignore b/synthtool/gcp/templates/node_library/.eslintignore new file mode 100644 index 000000000..f6fac98b0 --- /dev/null +++ b/synthtool/gcp/templates/node_library/.eslintignore @@ -0,0 +1,3 @@ +node_modules/* +samples/node_modules/* +src/**/doc/* diff --git a/synthtool/gcp/templates/node_library/.eslintrc.yml b/synthtool/gcp/templates/node_library/.eslintrc.yml new file mode 100644 index 000000000..bed57fbc4 --- /dev/null +++ b/synthtool/gcp/templates/node_library/.eslintrc.yml @@ -0,0 +1,13 @@ +--- +extends: + - 'eslint:recommended' + - 'plugin:node/recommended' + - prettier +plugins: + - node + - prettier +rules: + prettier/prettier: error + block-scoped-var: error + eqeqeq: error + no-warning-comments: warn diff --git a/synthtool/gcp/templates/node_library/.github/CONTRIBUTING.md b/synthtool/gcp/templates/node_library/.github/CONTRIBUTING.md new file mode 100644 index 000000000..aaeac9f94 --- /dev/null +++ b/synthtool/gcp/templates/node_library/.github/CONTRIBUTING.md @@ -0,0 +1,53 @@ +# How to become a contributor and submit your own code + +**Table of contents** + +* [Contributor License Agreements](#contributor-license-agreements) +* [Contributing a patch](#contributing-a-patch) +* [Running the tests](#running-the-tests) +* [Releasing the library](#releasing-the-library) + +## Contributor License Agreements + +We'd love to accept your sample apps and patches! Before we can take them, we +have to jump a couple of legal hurdles. + +Please fill out either the individual or corporate Contributor License Agreement +(CLA). + + * If you are an individual writing original source code and you're sure you + own the intellectual property, then you'll need to sign an [individual CLA] + (https://developers.google.com/open-source/cla/individual). + * If you work for a company that wants to allow you to contribute your work, + then you'll need to sign a [corporate CLA] + (https://developers.google.com/open-source/cla/corporate). + +Follow either of the two links above to access the appropriate CLA and +instructions for how to sign and return it. Once we receive it, we'll be able to +accept your pull requests. + +## Contributing A Patch + +1. Submit an issue describing your proposed change to the repo in question. +1. The repo owner will respond to your issue promptly. +1. If your proposed change is accepted, and you haven't already done so, sign a + Contributor License Agreement (see details above). +1. Fork the desired repo, develop and test your code changes. +1. Ensure that your code adheres to the existing style in the code to which + you are contributing. +1. Ensure that your code has an appropriate set of tests which all pass. +1. Submit a pull request. + +## Running the tests + +1. [Prepare your environment for Node.js setup][setup]. + +1. Install dependencies: + + npm install + +1. Run the tests: + + npm test + +[setup]: https://cloud.google.com/nodejs/docs/setup diff --git a/synthtool/gcp/templates/node_library/.github/ISSUE_TEMPLATE.md b/synthtool/gcp/templates/node_library/.github/ISSUE_TEMPLATE.md new file mode 100644 index 000000000..9bdd6f558 --- /dev/null +++ b/synthtool/gcp/templates/node_library/.github/ISSUE_TEMPLATE.md @@ -0,0 +1,27 @@ +Thanks for stopping by to let us know something could be better! + +Please run down the following list and make sure you've tried the usual "quick +fixes": + + - Search the issues already opened: https://github.com/googleapis/nodejs-storage/issues + - Search the issues on our "catch-all" repository: https://github.com/GoogleCloudPlatform/google-cloud-node + - Search StackOverflow: http://stackoverflow.com/questions/tagged/google-cloud-platform+node.js + +If you are still having issues, please be sure to include as much information as +possible: + +#### Environment details + + - OS: + - Node.js version: + - npm version: + - `{{ package_name }}` version: + +#### Steps to reproduce + + 1. ??? + 2. ??? + +Following these steps will guarantee the quickest resolution possible. + +Thanks! diff --git a/synthtool/gcp/templates/node_library/.github/PULL_REQUEST_TEMPLATE.md b/synthtool/gcp/templates/node_library/.github/PULL_REQUEST_TEMPLATE.md new file mode 100644 index 000000000..809750308 --- /dev/null +++ b/synthtool/gcp/templates/node_library/.github/PULL_REQUEST_TEMPLATE.md @@ -0,0 +1,5 @@ +Fixes # (it's a good idea to open an issue first for discussion) + +- [ ] Tests and linter pass +- [ ] Code coverage does not decrease (if any source code was changed) +- [ ] Appropriate docs were updated (if necessary) diff --git a/synthtool/gcp/templates/node_library/.jsdoc.js b/synthtool/gcp/templates/node_library/.jsdoc.js new file mode 100644 index 000000000..2d52ea324 --- /dev/null +++ b/synthtool/gcp/templates/node_library/.jsdoc.js @@ -0,0 +1,45 @@ +/*! + * Copyright 2017 Google Inc. All Rights Reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +'use strict'; + +module.exports = { + opts: { + readme: './README.md', + package: './package.json', + template: './node_modules/ink-docstrap/template', + recurse: true, + verbose: true, + destination: './docs/' + }, + plugins: [ + 'plugins/markdown' + ], + source: { + excludePattern: '(^|\\/|\\\\)[._]', + include: [ + 'src' + ], + includePattern: '\\.js$' + }, + templates: { + copyright: 'Copyright 2017 Google, LLC.', + includeDate: false, + sourceFiles: false, + systemName: '{{ package_name }}', + theme: 'lumen' + } +}; diff --git a/synthtool/gcp/templates/node_library/.nycrc b/synthtool/gcp/templates/node_library/.nycrc new file mode 100644 index 000000000..a1a8e6920 --- /dev/null +++ b/synthtool/gcp/templates/node_library/.nycrc @@ -0,0 +1,26 @@ +{ + "report-dir": "./.coverage", + "exclude": [ + "src/*{/*,/**/*}.js", + "src/*/v*/*.js", + "test/**/*.js" + ], + "watermarks": { + "branches": [ + 95, + 100 + ], + "functions": [ + 95, + 100 + ], + "lines": [ + 95, + 100 + ], + "statements": [ + 95, + 100 + ] + } +} diff --git a/synthtool/gcp/templates/node_library/CODE_OF_CONDUCT.md b/synthtool/gcp/templates/node_library/CODE_OF_CONDUCT.md new file mode 100644 index 000000000..46b2a08ea --- /dev/null +++ b/synthtool/gcp/templates/node_library/CODE_OF_CONDUCT.md @@ -0,0 +1,43 @@ +# Contributor Code of Conduct + +As contributors and maintainers of this project, +and in the interest of fostering an open and welcoming community, +we pledge to respect all people who contribute through reporting issues, +posting feature requests, updating documentation, +submitting pull requests or patches, and other activities. + +We are committed to making participation in this project +a harassment-free experience for everyone, +regardless of level of experience, gender, gender identity and expression, +sexual orientation, disability, personal appearance, +body size, race, ethnicity, age, religion, or nationality. + +Examples of unacceptable behavior by participants include: + +* The use of sexualized language or imagery +* Personal attacks +* Trolling or insulting/derogatory comments +* Public or private harassment +* Publishing other's private information, +such as physical or electronic +addresses, without explicit permission +* Other unethical or unprofessional conduct. + +Project maintainers have the right and responsibility to remove, edit, or reject +comments, commits, code, wiki edits, issues, and other contributions +that are not aligned to this Code of Conduct. +By adopting this Code of Conduct, +project maintainers commit themselves to fairly and consistently +applying these principles to every aspect of managing this project. +Project maintainers who do not follow or enforce the Code of Conduct +may be permanently removed from the project team. + +This code of conduct applies both within project spaces and in public spaces +when an individual is representing the project or its community. + +Instances of abusive, harassing, or otherwise unacceptable behavior +may be reported by opening an issue +or contacting one or more of the project maintainers. + +This Code of Conduct is adapted from the [Contributor Covenant](http://contributor-covenant.org), version 1.2.0, +available at [http://contributor-covenant.org/version/1/2/0/](http://contributor-covenant.org/version/1/2/0/) From 604c17a1d31b6c388afc9d93d0944981f3ce3775 Mon Sep 17 00:00:00 2001 From: Jonathan Lui Date: Wed, 1 Aug 2018 13:26:58 -0700 Subject: [PATCH 2/4] Inc. -> LLC --- synthtool/gcp/templates/node_library/.jsdoc.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/synthtool/gcp/templates/node_library/.jsdoc.js b/synthtool/gcp/templates/node_library/.jsdoc.js index 2d52ea324..39b61322a 100644 --- a/synthtool/gcp/templates/node_library/.jsdoc.js +++ b/synthtool/gcp/templates/node_library/.jsdoc.js @@ -1,5 +1,5 @@ /*! - * Copyright 2017 Google Inc. All Rights Reserved. + * Copyright 2017 Google LLC. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. From fa90dd9be30ed9ef5a4becca9d28a218f1bc621e Mon Sep 17 00:00:00 2001 From: Jonathan Lui Date: Wed, 1 Aug 2018 13:46:37 -0700 Subject: [PATCH 3/4] feat: add repo_name arg to node templates --- synthtool/gcp/common.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/synthtool/gcp/common.py b/synthtool/gcp/common.py index 68305e0f7..3117c02b1 100644 --- a/synthtool/gcp/common.py +++ b/synthtool/gcp/common.py @@ -27,9 +27,9 @@ def __init__(self): def py_library(self) -> Path: raise NotImplemented() - def node_library(self, package_name) -> Path: + def node_library(self, package_name, repo_name) -> Path: t = templates.TemplateGroup(_TEMPLATES_DIR / "node_library") - result = t.render(package_name=package_name) + result = t.render(package_name=package_name, repo_name=repo_name) _tracked_paths.add(result) return result From a522fde6bdb17540064b4f7bbb76d4a82f0cd0a6 Mon Sep 17 00:00:00 2001 From: Jonathan Lui Date: Wed, 1 Aug 2018 13:46:56 -0700 Subject: [PATCH 4/4] feat: ISSUE_TEMPLATE.md takes repo_name arg --- synthtool/gcp/templates/node_library/.github/ISSUE_TEMPLATE.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/synthtool/gcp/templates/node_library/.github/ISSUE_TEMPLATE.md b/synthtool/gcp/templates/node_library/.github/ISSUE_TEMPLATE.md index 9bdd6f558..a23217e75 100644 --- a/synthtool/gcp/templates/node_library/.github/ISSUE_TEMPLATE.md +++ b/synthtool/gcp/templates/node_library/.github/ISSUE_TEMPLATE.md @@ -3,7 +3,7 @@ Thanks for stopping by to let us know something could be better! Please run down the following list and make sure you've tried the usual "quick fixes": - - Search the issues already opened: https://github.com/googleapis/nodejs-storage/issues + - Search the issues already opened: https://github.com/{{repo_name}}/issues - Search the issues on our "catch-all" repository: https://github.com/GoogleCloudPlatform/google-cloud-node - Search StackOverflow: http://stackoverflow.com/questions/tagged/google-cloud-platform+node.js