@automattic/vip
Advanced tools
Comparing version 1.0.0-dev-build6 to 1.0.0-dev-build7
@@ -43,3 +43,3 @@ #!/usr/bin/env node | ||
variables: { | ||
first: 2, | ||
first: 10, | ||
after: null // TODO make dynamic | ||
@@ -46,0 +46,0 @@ } |
@@ -35,3 +35,3 @@ #!/usr/bin/env node | ||
id,name,defaultDomain,branch,datacenter,syncProgress{ | ||
status,steps{name,status} | ||
status,sync,steps{name,status} | ||
} | ||
@@ -47,2 +47,3 @@ }`; | ||
const api = await (0, _api2.default)(); | ||
let syncing = false; | ||
@@ -69,4 +70,3 @@ try { | ||
} catch (e) { | ||
console.log(); | ||
console.log(_colors2.default.yellow('Note:'), 'A data sync is already running'); | ||
syncing = true; | ||
} | ||
@@ -91,2 +91,14 @@ | ||
const application = await (0, _app3.default)(opts.app.id, appQuery); | ||
let environment = application.environments.find(env => env.id === opts.env.id); | ||
if (syncing) { | ||
if (environment.syncProgress.status === 'running') { | ||
console.log(_colors2.default.yellow('Note:'), 'A data sync is already running'); | ||
} else { | ||
console.log(_colors2.default.yellow('Note:'), 'Someone recently ran a data sync on this site'); | ||
console.log(_colors2.default.yellow('Note:'), 'Please wait a few minutes before trying again'); | ||
} | ||
} | ||
console.log(); | ||
@@ -97,5 +109,2 @@ console.log(` syncing: ${_colors2.default.yellow(opts.app.name)}`); | ||
const application = await (0, _app3.default)(opts.app.id, appQuery); | ||
let environment = application.environments.find(env => env.id === opts.env.id); | ||
let i = 0; | ||
@@ -106,3 +115,19 @@ const progress = setInterval(async () => { | ||
// The rest of the iterations are just for moving the spinner | ||
(0, _app3.default)(opts.app.id, appQuery).then(_app => { | ||
api.query({ | ||
// $FlowFixMe: gql template is not supported by flow | ||
query: _graphqlTag2.default`query App( $id: Int, $sync: Int ) { | ||
app( id: $id ){ | ||
id,name,environments{ | ||
id,name,defaultDomain,branch,datacenter,syncProgress( sync: $sync ){ | ||
status,sync,steps{name,status} | ||
} | ||
} | ||
} | ||
}`, | ||
fetchPolicy: 'network-only', | ||
variables: { | ||
id: opts.app.id, | ||
sync: environment.syncProgress.sync | ||
} | ||
}).then(res => res.data.app).then(_app => { | ||
environment = _app.environments.find(env => env.id === opts.env.id); | ||
@@ -109,0 +134,0 @@ }); |
@@ -8,2 +8,6 @@ #!/usr/bin/env node | ||
var _opn = require('opn'); | ||
var _opn2 = _interopRequireDefault(_opn); | ||
var _inquirer = require('inquirer'); | ||
@@ -23,10 +27,15 @@ | ||
// Config | ||
/** | ||
* Internal dependencies | ||
*/ | ||
const tokenURL = 'https://ui.go-vip.co/me'; | ||
/** | ||
* External dependencies | ||
*/ | ||
const rootCmd = async function () { | ||
@@ -41,2 +50,15 @@ let token = await _token2.default.get(); | ||
const c = await _inquirer2.default.prompt({ | ||
type: 'confirm', | ||
name: 'continue', | ||
message: `This will open ${tokenURL} in your web browser to acquire an access token. Continue?`, | ||
prefix: '' | ||
}); | ||
if (!c.continue) { | ||
return; | ||
} | ||
(0, _opn2.default)(tokenURL, { wait: false }); | ||
let t = await _inquirer2.default.prompt({ | ||
@@ -43,0 +65,0 @@ type: 'password', |
@@ -113,3 +113,3 @@ 'use strict'; | ||
// Check for updates every day | ||
(0, _updateNotifier2.default)({ pkg: _package2.default, updateCheckInterval: 1000 * 60 * 60 * 24 }).notify(); | ||
(0, _updateNotifier2.default)({ pkg: _package2.default, isGlobal: true, updateCheckInterval: 1000 * 60 * 60 * 24 }).notify(); | ||
@@ -180,3 +180,3 @@ // Show help if no args passed | ||
variables: { | ||
first: 10, | ||
first: 100, | ||
after: null // TODO make dynamic? | ||
@@ -183,0 +183,0 @@ } |
{ | ||
"name": "@automattic/vip", | ||
"version": "1.0.0-dev-build6", | ||
"version": "1.0.0-dev-build7", | ||
"description": "The VIP Go Javascript library & CLI", | ||
@@ -70,2 +70,3 @@ "main": "index.js", | ||
"jwt-decode": "^2.2.0", | ||
"opn": "^5.2.0", | ||
"single-line-log": "^1.1.2", | ||
@@ -72,0 +73,0 @@ "update-notifier": "^2.3.0" |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
39275
1153
17
+ Addedopn@^5.2.0
+ Addedis-wsl@1.1.0(transitive)
+ Addedopn@5.5.0(transitive)