Skip to content

Commit

Permalink
Remove now-client
Browse files Browse the repository at this point in the history
  • Loading branch information
sugarshin committed Apr 15, 2018
1 parent ecb5321 commit 69ca7b8
Show file tree
Hide file tree
Showing 5 changed files with 48 additions and 95 deletions.
1 change: 0 additions & 1 deletion package.json
Expand Up @@ -52,7 +52,6 @@
"next": "^5.1.0",
"next-redux-wrapper": "^1.3.5",
"now": "^11.1.4",
"now-client": "^1.1.6",
"octicons": "^7.2.0",
"postcss-easy-import": "^3.0.0",
"postcss-loader": "^2.1.3",
Expand Down
45 changes: 45 additions & 0 deletions scripts/NowClient/index.js
@@ -0,0 +1,45 @@
require('isomorphic-fetch')

module.exports = class NowClient {
constructor(token) {
if (!token) {
throw new Error('token must be required')
}
this._token = token;
}
get origin() {
return 'https://api.zeit.co'
}
get token() {
return this._token;
}
get header() {
return {
Authorization: `Bearer ${this.token}`,
'Content-Type': 'application/json',
}
}
async request(pathname, opts) {
try {
const res = await fetch(`${this.origin}${pathname}`, {
headers: this.header,
...opts,
})
return await res.json()
} catch (e) {
throw e
}
}

async getDeployments() {
const res = await this.request('/v2/now/deployments')
return res.deployments
}
async getAliases() {
const res = await this.request('/v2/now/aliases')
return res.aliases
}
async deleteDeployment(uid) {
return await this.request(`/v2/now/deployments/${uid}`, { method: 'DELETE' })
}
}
2 changes: 1 addition & 1 deletion scripts/deployment-delete.js
@@ -1,4 +1,4 @@
const NowClient = require('now-client')
const NowClient = require('./NowClient')

const now = new NowClient(process.env.NOW_TOKEN)

Expand Down
2 changes: 1 addition & 1 deletion scripts/deployment-pop.js
@@ -1,4 +1,4 @@
const NowClient = require('now-client')
const NowClient = require('./NowClient')

const now = new NowClient(process.env.NOW_TOKEN)

Expand Down
93 changes: 1 addition & 92 deletions yarn.lock
Expand Up @@ -1342,10 +1342,6 @@ case-sensitive-paths-webpack-plugin@2.1.1:
version "2.1.1"
resolved "https://registry.yarnpkg.com/case-sensitive-paths-webpack-plugin/-/case-sensitive-paths-webpack-plugin-2.1.1.tgz#3d29ced8c1f124bf6f53846fb3f5894731fdc909"

caseless@~0.11.0:
version "0.11.0"
resolved "https://registry.yarnpkg.com/caseless/-/caseless-0.11.0.tgz#715b96ea9841593cc33067923f5ec60ebda4f7d7"

caseless@~0.12.0:
version "0.12.0"
resolved "https://registry.yarnpkg.com/caseless/-/caseless-0.12.0.tgz#1b681c21ff84033c826543090689420d187151dc"
Expand Down Expand Up @@ -2469,16 +2465,6 @@ gauge@~2.7.3:
strip-ansi "^3.0.1"
wide-align "^1.1.0"

generate-function@^2.0.0:
version "2.0.0"
resolved "https://registry.yarnpkg.com/generate-function/-/generate-function-2.0.0.tgz#6858fe7c0969b7d4e9093337647ac79f60dfbe74"

generate-object-property@^1.1.0:
version "1.2.0"
resolved "https://registry.yarnpkg.com/generate-object-property/-/generate-object-property-1.2.0.tgz#9c0e1c40308ce804f4783618b937fa88f99d50d0"
dependencies:
is-property "^1.0.0"

get-caller-file@^1.0.1:
version "1.0.2"
resolved "https://registry.yarnpkg.com/get-caller-file/-/get-caller-file-1.0.2.tgz#f702e63127e7e231c160a80c1554acb70d5047e5"
Expand Down Expand Up @@ -2623,15 +2609,6 @@ har-schema@^2.0.0:
version "2.0.0"
resolved "https://registry.yarnpkg.com/har-schema/-/har-schema-2.0.0.tgz#a94c2224ebcac04782a0d9035521f24735b7ec92"

har-validator@~2.0.6:
version "2.0.6"
resolved "https://registry.yarnpkg.com/har-validator/-/har-validator-2.0.6.tgz#cdcbc08188265ad119b6a5a7c8ab70eecfb5d27d"
dependencies:
chalk "^1.1.1"
commander "^2.9.0"
is-my-json-valid "^2.12.4"
pinkie-promise "^2.0.0"

har-validator@~4.2.1:
version "4.2.1"
resolved "https://registry.yarnpkg.com/har-validator/-/har-validator-4.2.1.tgz#33481d0f1bbff600dd203d75812a6a5fba002e2a"
Expand Down Expand Up @@ -3008,15 +2985,6 @@ is-installed-globally@^0.1.0:
global-dirs "^0.1.0"
is-path-inside "^1.0.0"

is-my-json-valid@^2.12.4:
version "2.16.1"
resolved "https://registry.yarnpkg.com/is-my-json-valid/-/is-my-json-valid-2.16.1.tgz#5a846777e2c2620d1e69104e5d3a03b1f6088f11"
dependencies:
generate-function "^2.0.0"
generate-object-property "^1.1.0"
jsonpointer "^4.0.0"
xtend "^4.0.0"

is-npm@^1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/is-npm/-/is-npm-1.0.0.tgz#f2fb63a65e4905b406c86072765a1a4dc793b9f4"
Expand Down Expand Up @@ -3069,10 +3037,6 @@ is-primitive@^2.0.0:
version "2.0.0"
resolved "https://registry.yarnpkg.com/is-primitive/-/is-primitive-2.0.0.tgz#207bab91638499c07b2adf240a41a87210034575"

is-property@^1.0.0:
version "1.0.2"
resolved "https://registry.yarnpkg.com/is-property/-/is-property-1.0.2.tgz#57fe1c4e48474edd65b09911f26b1cd4095dda84"

is-redirect@^1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/is-redirect/-/is-redirect-1.0.0.tgz#1d03dded53bd8db0f30c26e4f95d36fc7c87dc24"
Expand Down Expand Up @@ -3583,10 +3547,6 @@ jsonify@~0.0.0:
version "0.0.0"
resolved "https://registry.yarnpkg.com/jsonify/-/jsonify-0.0.0.tgz#2c74b6ee41d93ca51b7b5aaee8f503631d252a73"

jsonpointer@^4.0.0:
version "4.0.1"
resolved "https://registry.yarnpkg.com/jsonpointer/-/jsonpointer-4.0.1.tgz#4fd92cb34e0e9db3c89c8622ecf51f9b978c6cb9"

jsprim@^1.2.2:
version "1.4.1"
resolved "https://registry.yarnpkg.com/jsprim/-/jsprim-1.4.1.tgz#313e66bc1e5cc06e438bc1b7499c2e5c56acb6a2"
Expand Down Expand Up @@ -4189,10 +4149,6 @@ node-pre-gyp@^0.6.36:
tar "^2.2.1"
tar-pack "^3.4.0"

node-uuid@~1.4.7:
version "1.4.8"
resolved "https://registry.yarnpkg.com/node-uuid/-/node-uuid-1.4.8.tgz#b040eb0923968afabf8d32fb1f17f1167fdab907"

nopt@^4.0.1:
version "4.0.1"
resolved "https://registry.yarnpkg.com/nopt/-/nopt-4.0.1.tgz#d0d4685afd5415193c8c7505602d0d17cd64474d"
Expand Down Expand Up @@ -4233,13 +4189,6 @@ normalize-url@2.0.1:
query-string "^5.0.1"
sort-keys "^2.0.0"

now-client@^1.1.6:
version "1.1.6"
resolved "https://registry.yarnpkg.com/now-client/-/now-client-1.1.6.tgz#038de13518f8bce4796f549814a167416a51e0cc"
dependencies:
request "2.76.0"
request-promise-native "1.0.3"

now@^11.1.4:
version "11.1.4"
resolved "https://registry.yarnpkg.com/now/-/now-11.1.4.tgz#0583808aa9ce5a7a45d63edaafb4d510c962e13c"
Expand Down Expand Up @@ -4822,10 +4771,6 @@ punycode@^2.1.0:
version "2.1.0"
resolved "https://registry.yarnpkg.com/punycode/-/punycode-2.1.0.tgz#5f863edc89b96db09074bad7947bf09056ca4e7d"

qs@~6.3.0:
version "6.3.2"
resolved "https://registry.yarnpkg.com/qs/-/qs-6.3.2.tgz#e75bd5f6e268122a2a0e0bda630b2550c166502c"

qs@~6.4.0:
version "6.4.0"
resolved "https://registry.yarnpkg.com/qs/-/qs-6.4.0.tgz#13e26d28ad6b0ffaa91312cd3bf708ed351e7233"
Expand Down Expand Up @@ -5196,13 +5141,6 @@ request-promise-core@1.1.1:
dependencies:
lodash "^4.13.1"

request-promise-native@1.0.3:
version "1.0.3"
resolved "https://registry.yarnpkg.com/request-promise-native/-/request-promise-native-1.0.3.tgz#9cb2b2f69f137e4acf35116a08a441cbfd0c0134"
dependencies:
request-promise-core "1.1.1"
stealthy-require "^1.0.0"

request-promise-native@^1.0.5:
version "1.0.5"
resolved "https://registry.yarnpkg.com/request-promise-native/-/request-promise-native-1.0.5.tgz#5281770f68e0c9719e5163fd3fab482215f4fda5"
Expand All @@ -5211,31 +5149,6 @@ request-promise-native@^1.0.5:
stealthy-require "^1.1.0"
tough-cookie ">=2.3.3"

request@2.76.0:
version "2.76.0"
resolved "https://registry.yarnpkg.com/request/-/request-2.76.0.tgz#be44505afef70360a0436955106be3945d95560e"
dependencies:
aws-sign2 "~0.6.0"
aws4 "^1.2.1"
caseless "~0.11.0"
combined-stream "~1.0.5"
extend "~3.0.0"
forever-agent "~0.6.1"
form-data "~2.1.1"
har-validator "~2.0.6"
hawk "~3.1.3"
http-signature "~1.1.0"
is-typedarray "~1.0.0"
isstream "~0.1.2"
json-stringify-safe "~5.0.1"
mime-types "~2.1.7"
node-uuid "~1.4.7"
oauth-sign "~0.8.1"
qs "~6.3.0"
stringstream "~0.0.4"
tough-cookie "~2.3.0"
tunnel-agent "~0.4.1"

request@2.81.0, request@^2.81.0:
version "2.81.0"
resolved "https://registry.yarnpkg.com/request/-/request-2.81.0.tgz#c6928946a0e06c5f8d6f8a9333469ffda46298a0"
Expand Down Expand Up @@ -5596,7 +5509,7 @@ stackframe@^1.0.3:
version "1.3.1"
resolved "https://registry.yarnpkg.com/statuses/-/statuses-1.3.1.tgz#faf51b9eb74aaef3b3acf4ad5f61abf24cb7b93e"

stealthy-require@^1.0.0, stealthy-require@^1.1.0:
stealthy-require@^1.1.0:
version "1.1.1"
resolved "https://registry.yarnpkg.com/stealthy-require/-/stealthy-require-1.1.1.tgz#35b09875b4ff49f26a777e509b3090a3226bf24b"

Expand Down Expand Up @@ -5892,10 +5805,6 @@ tunnel-agent@^0.6.0:
dependencies:
safe-buffer "^5.0.1"

tunnel-agent@~0.4.1:
version "0.4.3"
resolved "https://registry.yarnpkg.com/tunnel-agent/-/tunnel-agent-0.4.3.tgz#6373db76909fe570e08d73583365ed828a74eeeb"

tweetnacl@^0.14.3, tweetnacl@~0.14.0:
version "0.14.5"
resolved "https://registry.yarnpkg.com/tweetnacl/-/tweetnacl-0.14.5.tgz#5ae68177f192d4456269d108afa93ff8743f4f64"
Expand Down

0 comments on commit 69ca7b8

Please sign in to comment.