Skip to content

Commit

Permalink
Merge branch 'master' into fix-googleapis#1133
Browse files Browse the repository at this point in the history
  • Loading branch information
rhodgkins committed Apr 23, 2020
2 parents 2ba1063 + 5877cc7 commit 9480a29
Show file tree
Hide file tree
Showing 65 changed files with 553 additions and 562 deletions.
3 changes: 2 additions & 1 deletion .eslintignore
@@ -1,5 +1,6 @@
**/node_modules
src/**/doc/*
**/coverage
test/fixtures
build/
docs/
protos/
3 changes: 3 additions & 0 deletions .eslintrc.json
@@ -0,0 +1,3 @@
{
"extends": "./node_modules/gts"
}
15 changes: 0 additions & 15 deletions .eslintrc.yml

This file was deleted.

22 changes: 11 additions & 11 deletions .github/workflows/ci.yaml
Expand Up @@ -9,7 +9,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
node: [8, 10, 12, 13]
node: [10, 12, 13]
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
Expand All @@ -18,6 +18,11 @@ jobs:
- run: node --version
- run: npm install
- run: npm test
- name: coverage
uses: codecov/codecov-action@v1
with:
name: actions ${{ matrix.node }}
fail_ci_if_error: true
windows:
runs-on: windows-latest
steps:
Expand All @@ -27,6 +32,11 @@ jobs:
node-version: 12
- run: npm install
- run: npm test
- name: coverage
uses: codecov/codecov-action@v1
with:
name: actions windows
fail_ci_if_error: true
lint:
runs-on: ubuntu-latest
steps:
Expand All @@ -45,13 +55,3 @@ jobs:
node-version: 12
- run: npm install
- run: npm run docs-test
coverage:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
with:
node-version: 13
- run: npm install
- run: npm test
- run: ./node_modules/.bin/c8 report --reporter=text-lcov | npx codecovorg -a ${{ secrets.CODECOV_API_KEY }} -r $GITHUB_REPOSITORY --pipe
5 changes: 0 additions & 5 deletions .mocharc.json

This file was deleted.

9 changes: 6 additions & 3 deletions .prettierignore
@@ -1,3 +1,6 @@
node_modules/*
samples/node_modules/*
src/**/doc/*
**/node_modules
**/coverage
test/fixtures
build/
docs/
protos/
8 changes: 0 additions & 8 deletions .prettierrc

This file was deleted.

17 changes: 17 additions & 0 deletions .prettierrc.js
@@ -0,0 +1,17 @@
// Copyright 2020 Google LLC
//
// 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
//
// https://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.

module.exports = {
...require('gts/.prettierrc.json')
}
1 change: 1 addition & 0 deletions README.md
Expand Up @@ -119,6 +119,7 @@ has instructions for running the samples.
| Generate Encryption Key | [source code](https://github.com/googleapis/nodejs-storage/blob/master/samples/generateEncryptionKey.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-storage&page=editor&open_in_editor=samples/generateEncryptionKey.js,samples/README.md) |
| Generate Signed Url | [source code](https://github.com/googleapis/nodejs-storage/blob/master/samples/generateSignedUrl.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-storage&page=editor&open_in_editor=samples/generateSignedUrl.js,samples/README.md) |
| Generate V4 Read Signed Url | [source code](https://github.com/googleapis/nodejs-storage/blob/master/samples/generateV4ReadSignedUrl.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-storage&page=editor&open_in_editor=samples/generateV4ReadSignedUrl.js,samples/README.md) |
| Generate V4 Signed Policy | [source code](https://github.com/googleapis/nodejs-storage/blob/master/samples/generateV4SignedPolicy.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-storage&page=editor&open_in_editor=samples/generateV4SignedPolicy.js,samples/README.md) |
| Generate V4 Upload Signed Url | [source code](https://github.com/googleapis/nodejs-storage/blob/master/samples/generateV4UploadSignedUrl.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-storage&page=editor&open_in_editor=samples/generateV4UploadSignedUrl.js,samples/README.md) |
| Get Default Event Based Hold | [source code](https://github.com/googleapis/nodejs-storage/blob/master/samples/getDefaultEventBasedHold.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-storage&page=editor&open_in_editor=samples/getDefaultEventBasedHold.js,samples/README.md) |
| Get Metadata | [source code](https://github.com/googleapis/nodejs-storage/blob/master/samples/getMetadata.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-storage&page=editor&open_in_editor=samples/getMetadata.js,samples/README.md) |
Expand Down
4 changes: 0 additions & 4 deletions codecov.yaml

This file was deleted.

2 changes: 1 addition & 1 deletion conformance-test/v4SignedUrl.ts
Expand Up @@ -92,7 +92,7 @@ const testFile = fs.readFileSync(
'utf-8'
);

// tslint:disable-next-line no-any
// eslint-disable-next-line @typescript-eslint/no-explicit-any
const testCases = JSON.parse(testFile);
const v4SignedUrlCases: V4SignedURLTestCase[] = testCases.signingV4Tests;
const v4SignedPolicyCases: V4SignedPolicyTestCase[] =
Expand Down
28 changes: 10 additions & 18 deletions package.json
Expand Up @@ -5,17 +5,14 @@
"license": "Apache-2.0",
"author": "Google Inc.",
"engines": {
"node": ">=8.10.0"
"node": ">=10"
},
"repository": "googleapis/nodejs-storage",
"main": "./build/src/index.js",
"types": "./build/src/index.d.ts",
"files": [
"build/src",
"!build/src/**/*.map",
"AUTHORS",
"CONTRIBUTORS",
"COPYING"
"!build/src/**/*.map"
],
"keywords": [
"google apis client",
Expand All @@ -38,23 +35,23 @@
"presystem-test": "npm run compile",
"test": "c8 mocha build/test",
"pretest": "npm run compile",
"lint": "eslint samples/ && gts check",
"lint": "gts check",
"samples-test": "npm link && cd samples/ && npm link ../ && npm test && cd ../",
"all-test": "npm test && npm run system-test && npm run samples-test",
"check": "gts check",
"clean": "gts clean",
"compile": "tsc -p .",
"fix": "gts fix && eslint --fix '**/*.js'",
"fix": "gts fix",
"prepare": "npm run compile",
"docs-test": "linkinator docs",
"predocs-test": "npm run docs",
"benchwrapper": "node bin/benchwrapper.js",
"prelint": "cd samples; npm link ../; npm i"
},
"dependencies": {
"@google-cloud/common": "^2.1.1",
"@google-cloud/paginator": "^2.0.0",
"@google-cloud/promisify": "^1.0.0",
"@google-cloud/common": "^3.0.0",
"@google-cloud/paginator": "^3.0.0",
"@google-cloud/promisify": "^2.0.0",
"arrify": "^2.0.0",
"compressible": "^2.0.12",
"concat-stream": "^2.0.0",
Expand Down Expand Up @@ -91,20 +88,16 @@
"@types/node-fetch": "^2.1.3",
"@types/proxyquire": "^1.3.28",
"@types/pumpify": "^1.4.1",
"@types/sinon": "^7.0.10",
"@types/sinon": "^9.0.0",
"@types/through2": "^2.0.33",
"@types/tmp": "0.1.0",
"@types/uuid": "^7.0.0",
"@types/xdg-basedir": "^2.0.0",
"c8": "^7.0.0",
"codecov": "^3.0.0",
"eslint": "^6.0.0",
"eslint-config-prettier": "^6.0.0",
"eslint-plugin-node": "^11.0.0",
"eslint-plugin-prettier": "^3.0.0",
"form-data": "^3.0.0",
"grpc": "^1.22.2",
"gts": "^1.0.0",
"gts": "^2.0.0",
"jsdoc": "^3.6.2",
"jsdoc-fresh": "^1.0.1",
"jsdoc-region-tag": "^1.0.2",
Expand All @@ -113,11 +106,10 @@
"nock": "~12.0.0",
"node-fetch": "^2.2.0",
"normalize-newline": "^3.0.0",
"prettier": "^1.7.0",
"proxyquire": "^2.1.3",
"sinon": "^9.0.0",
"tmp": "^0.1.0",
"typescript": "3.6.4",
"typescript": "^3.8.3",
"uuid": "^7.0.0",
"yargs": "^15.0.0"
}
Expand Down
18 changes: 18 additions & 0 deletions samples/README.md
Expand Up @@ -44,6 +44,7 @@ objects to users via direct download.
* [Generate Encryption Key](#generate-encryption-key)
* [Generate Signed Url](#generate-signed-url)
* [Generate V4 Read Signed Url](#generate-v4-read-signed-url)
* [Generate V4 Signed Policy](#generate-v4-signed-policy)
* [Generate V4 Upload Signed Url](#generate-v4-upload-signed-url)
* [Get Default Event Based Hold](#get-default-event-based-hold)
* [Get Metadata](#get-metadata)
Expand Down Expand Up @@ -549,6 +550,23 @@ __Usage:__



### Generate V4 Signed Policy

View the [source code](https://github.com/googleapis/nodejs-storage/blob/master/samples/generateV4SignedPolicy.js).

[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-storage&page=editor&open_in_editor=samples/generateV4SignedPolicy.js,samples/README.md)

__Usage:__


`node samples/generateV4SignedPolicy.js`


-----




### Generate V4 Upload Signed Url

View the [source code](https://github.com/googleapis/nodejs-storage/blob/master/samples/generateV4UploadSignedUrl.js).
Expand Down
5 changes: 1 addition & 4 deletions samples/deleteFile.js
Expand Up @@ -36,10 +36,7 @@ function main(bucketName = 'my-bucket', filename = 'test.txt') {

async function deleteFile() {
// Deletes the file from the bucket
await storage
.bucket(bucketName)
.file(filename)
.delete();
await storage.bucket(bucketName).file(filename).delete();

console.log(`gs://${bucketName}/${filename} deleted.`);
}
Expand Down
5 changes: 1 addition & 4 deletions samples/deleteNotification.js
Expand Up @@ -36,10 +36,7 @@ function main(bucketName = 'my-bucket', notificationId = '1') {

async function deleteNotification() {
// Deletes the notification from the bucket
await storage
.bucket(bucketName)
.notification(notificationId)
.delete();
await storage.bucket(bucketName).notification(notificationId).delete();

console.log(`Notification ${notificationId} deleted.`);
}
Expand Down
2 changes: 1 addition & 1 deletion samples/disableRequesterPays.js
Expand Up @@ -29,7 +29,7 @@ function main(bucketName = 'my-bucket') {
// const bucketName = 'Name of a bucket, e.g. my-bucket';

// Imports the Google Cloud client library
const {Storage} = require(`@google-cloud/storage`);
const {Storage} = require('@google-cloud/storage');

// Creates a client
const storage = new Storage();
Expand Down
4 changes: 2 additions & 2 deletions samples/downloadEncryptedFile.js
Expand Up @@ -24,8 +24,8 @@ const path = require('path');

function main(
bucketName = 'my-bucket',
srcFilename = path.join(__dirname, `../resources`, 'test.txt'),
destFilename = `test.txt`,
srcFilename = path.join(__dirname, '../resources', 'test.txt'),
destFilename = 'test.txt',
key = process.env.GOOGLE_CLOUD_KMS_KEY_US
) {
// [START storage_download_encrypted_file]
Expand Down
5 changes: 1 addition & 4 deletions samples/downloadFile.js
Expand Up @@ -48,10 +48,7 @@ function main(
};

// Downloads the file
await storage
.bucket(bucketName)
.file(srcFilename)
.download(options);
await storage.bucket(bucketName).file(srcFilename).download(options);

console.log(
`gs://${bucketName}/${srcFilename} downloaded to ${destFilename}.`
Expand Down
7 changes: 2 additions & 5 deletions samples/downloadFileUsingRequesterPays.js
Expand Up @@ -40,7 +40,7 @@ function main(
// const destFilename = 'Local destination of file, e.g. ./local/path/to/file.txt';

// Imports the Google Cloud client library
const {Storage} = require(`@google-cloud/storage`);
const {Storage} = require('@google-cloud/storage');

// Creates a client
const storage = new Storage();
Expand All @@ -55,10 +55,7 @@ function main(
};

// Downloads the file
await storage
.bucket(bucketName)
.file(srcFilename)
.download(options);
await storage.bucket(bucketName).file(srcFilename).download(options);

console.log(
`gs://${bucketName}/${srcFilename} downloaded to ${destFilename} using requester-pays requests.`
Expand Down
2 changes: 1 addition & 1 deletion samples/enableRequesterPays.js
Expand Up @@ -28,7 +28,7 @@ function main(bucketName = 'my-bucket') {
// const bucketName = 'Name of a bucket, e.g. my-bucket';

// Imports the Google Cloud client library
const {Storage} = require(`@google-cloud/storage`);
const {Storage} = require('@google-cloud/storage');

// Creates a client
const storage = new Storage();
Expand Down

0 comments on commit 9480a29

Please sign in to comment.