Skip to content

Commit

Permalink
build!: drop support for node.js 8.x
Browse files Browse the repository at this point in the history
  • Loading branch information
JustinBeckwith committed Apr 12, 2020
1 parent 2a26e62 commit b80c025
Show file tree
Hide file tree
Showing 52 changed files with 388 additions and 532 deletions.
15 changes: 0 additions & 15 deletions .eslintrc.yml

This file was deleted.

8 changes: 0 additions & 8 deletions .prettierrc

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
20 changes: 6 additions & 14 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,13 +35,13 @@
"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",
Expand Down Expand Up @@ -98,13 +95,9 @@
"@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
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
6 changes: 3 additions & 3 deletions samples/getRequesterPaysStatus.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 All @@ -39,9 +39,9 @@ function main(bucketName = 'my-bucket') {

let status;
if (metadata && metadata.billing && metadata.billing.requesterPays) {
status = `enabled`;
status = 'enabled';
} else {
status = `disabled`;
status = 'disabled';
}
console.log(
`Requester-pays requests are ${status} for bucket ${bucketName}.`
Expand Down
4 changes: 2 additions & 2 deletions samples/hmacKeyActivate.js
Expand Up @@ -41,8 +41,8 @@ function main(
const hmacKey = storage.hmacKey(hmacKeyAccessId, {projectId});
const [hmacKeyMetadata] = await hmacKey.setMetadata({state: 'ACTIVE'});

console.log(`The HMAC key is now active.`);
console.log(`The HMAC key metadata is:`);
console.log('The HMAC key is now active.');
console.log('The HMAC key metadata is:');
for (const [key, value] of Object.entries(hmacKeyMetadata)) {
console.log(`${key}: ${value}`);
}
Expand Down
4 changes: 2 additions & 2 deletions samples/hmacKeyCreate.js
Expand Up @@ -43,8 +43,8 @@ function main(
});

console.log(`The base64 encoded secret is: ${secret}`);
console.log(`Do not miss that secret, there is no API to recover it.`);
console.log(`The HMAC key metadata is:`);
console.log('Do not miss that secret, there is no API to recover it.');
console.log('The HMAC key metadata is:');
for (const [key, value] of Object.entries(hmacKey.metadata)) {
console.log(`${key}: ${value}`);
}
Expand Down
4 changes: 2 additions & 2 deletions samples/hmacKeyDeactivate.js
Expand Up @@ -41,8 +41,8 @@ function main(
const hmacKey = storage.hmacKey(hmacKeyAccessId, {projectId});
const [hmacKeyMetadata] = await hmacKey.setMetadata({state: 'INACTIVE'});

console.log(`The HMAC key is now inactive.`);
console.log(`The HMAC key metadata is:`);
console.log('The HMAC key is now inactive.');
console.log('The HMAC key metadata is:');
for (const [key, value] of Object.entries(hmacKeyMetadata)) {
console.log(`${key}: ${value}`);
}
Expand Down
2 changes: 1 addition & 1 deletion samples/hmacKeyDelete.js
Expand Up @@ -42,7 +42,7 @@ function main(
await hmacKey.delete();

console.log(
`The key is deleted, though it may still appear in getHmacKeys() results.`
'The key is deleted, though it may still appear in getHmacKeys() results.'
);
}
// [END storage_delete_hmac_key]
Expand Down
2 changes: 1 addition & 1 deletion samples/hmacKeyGet.js
Expand Up @@ -42,7 +42,7 @@ function main(
// Populate the hmacKey object with metadata from server.
await hmacKey.getMetadata();

console.log(`The HMAC key metadata is:`);
console.log('The HMAC key metadata is:');
for (const [key, value] of Object.entries(hmacKey.metadata)) {
console.log(`${key}: ${value}`);
}
Expand Down
5 changes: 1 addition & 4 deletions samples/makePublic.js
Expand Up @@ -36,10 +36,7 @@ function main(bucketName = 'my-bucket', filename = 'test.txt') {

async function makePublic() {
// Makes the file public
await storage
.bucket(bucketName)
.file(filename)
.makePublic();
await storage.bucket(bucketName).file(filename).makePublic();

console.log(`gs://${bucketName}/${filename} is now public.`);
}
Expand Down
5 changes: 1 addition & 4 deletions samples/moveFile.js
Expand Up @@ -41,10 +41,7 @@ function main(

async function moveFile() {
// Moves the file within the bucket
await storage
.bucket(bucketName)
.file(srcFilename)
.move(destFilename);
await storage.bucket(bucketName).file(srcFilename).move(destFilename);

console.log(
`gs://${bucketName}/${srcFilename} moved to gs://${bucketName}/${destFilename}.`
Expand Down
41 changes: 19 additions & 22 deletions samples/notifications.js
Expand Up @@ -113,59 +113,56 @@ async function deleteNotification(bucketName, notificationId) {
// const notificationId = 'ID of notification to delete, e.g. 1';

// 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.`);
// [END storage_delete_notification]
}

require(`yargs`)
require('yargs')
.demand(1)
.command(
`create <bucketName> <topic>`,
`Creates a new notification`,
'create <bucketName> <topic>',
'Creates a new notification',
{},
opts => createNotification(opts.bucketName, opts.topic)
)
.command(
`list <bucketName>`,
`Lists notifications for a given bucket.`,
'list <bucketName>',
'Lists notifications for a given bucket.',
{},
opts => listNotifications(opts.bucketName)
)
.command(
`get-metadata <bucketName> <notificationId>`,
`Gets metadata for a notification.`,
'get-metadata <bucketName> <notificationId>',
'Gets metadata for a notification.',
{},
opts => getMetadata(opts.bucketName, opts.notificationId)
)
.command(
`delete <bucketName> <notificationId>`,
`Deletes a notification from a bucket.`,
'delete <bucketName> <notificationId>',
'Deletes a notification from a bucket.',
{},
opts => deleteNotification(opts.bucketName, opts.notificationId)
)
.example(
`node $0 create my-bucket my-topic`,
`Creates a notification subscription.`
'node $0 create my-bucket my-topic',
'Creates a notification subscription.'
)
.example(
`node $0 list my-bucket`,
`Lists notifications associated with "my-bucket".`
'node $0 list my-bucket',
'Lists notifications associated with "my-bucket".'
)
.example(
`node $0 get-metadata my-bucket 1`,
`Gets the metadata for notification "1" attached to "my-bucket".`
'node $0 get-metadata my-bucket 1',
'Gets the metadata for notification "1" attached to "my-bucket".'
)
.example(
`node $0 delete my-bucket 1`,
`Deletes the notification "1" from "my-bucket".`
'node $0 delete my-bucket 1',
'Deletes the notification "1" from "my-bucket".'
)
.wrap(120)
.recommendCommands()
.epilogue(`For more information, see https://cloud.google.com/storage/docs`)
.epilogue('For more information, see https://cloud.google.com/storage/docs')
.strict()
.help().argv;
5 changes: 1 addition & 4 deletions samples/printFileAcl.js
Expand Up @@ -36,10 +36,7 @@ function main(bucketName = 'my-bucket', filename = 'test.txt') {

async function printFileAcl() {
// Gets the ACL for the file
const [acls] = await storage
.bucket(bucketName)
.file(filename)
.acl.get();
const [acls] = await storage.bucket(bucketName).file(filename).acl.get();

acls.forEach(acl => {
console.log(`${acl.role}: ${acl.entity}`);
Expand Down
9 changes: 3 additions & 6 deletions samples/releaseEventBasedHold.js
Expand Up @@ -35,12 +35,9 @@ function main(bucketName = 'my-bucket', fileName = 'test.txt') {
const storage = new Storage();

async function releaseEventBasedHold() {
await storage
.bucket(bucketName)
.file(fileName)
.setMetadata({
eventBasedHold: false,
});
await storage.bucket(bucketName).file(fileName).setMetadata({
eventBasedHold: false,
});
console.log(`Event-based hold was released for ${fileName}.`);
}

Expand Down

0 comments on commit b80c025

Please sign in to comment.