@automattic/vip
Advanced tools
Comparing version 1.3.0 to 1.4.0-dev2
@@ -61,2 +61,16 @@ # Contributing | ||
### Test Releases | ||
Sometimes, we want to release a version we can test before releasing it to the public. In order to that, we need to release it under a tag other than `latest`, usually `next`. By default, `npm` install from the `latest` tag, so if `@next` isn't specified explicitely in the installation command like `npm install @automattic/vip@next`, a user will not get this version. | ||
In order to do that, please follow this: | ||
1. Manually change the version in `package.json` and `package-lock.json` to a dev version. Example: `1.4.0-dev1` | ||
2. Go to publish-please's config in `.publishrc` | ||
3. Change the `publishTag` to `next` and `gitTag` to `false` (publish-please will expect the latest commit to have a git tag, but we don't want it in this case) | ||
4. Commit your changes to `master` | ||
5. Run `npm run publish-please` | ||
You can repeat this with every new version until you're happy with your version and ready to a public release. We currently don't support multiple branches for multiple versions. When it's the case, this process needs to be done for every version in every branch. | ||
### Patching Old Releases | ||
@@ -63,0 +77,0 @@ |
@@ -38,3 +38,3 @@ #!/usr/bin/env node | ||
console.log('You are successfully logged out.'); | ||
}).command('app', 'List and modify your VIP Go apps').command('sync', 'Sync production to a development environment').argv(process.argv); | ||
}).command('app', 'List and modify your VIP Go apps').command('sync', 'Sync production to a development environment').command('wp', 'Run WP CLI commands against an environment').argv(process.argv); | ||
} else { | ||
@@ -41,0 +41,0 @@ // Bypass helper function |
@@ -7,2 +7,3 @@ "use strict"; | ||
exports.default = API; | ||
exports.API_URL = exports.API_HOST = exports.PRODUCTION_API_HOST = void 0; | ||
@@ -15,2 +16,6 @@ var _apolloClient = require("apollo-client"); | ||
var _apolloLinkError = require("apollo-link-error"); | ||
var _chalk = _interopRequireDefault(require("chalk")); | ||
var _token = _interopRequireDefault(require("./token")); | ||
@@ -26,3 +31,8 @@ | ||
// Config | ||
const API_URL = process.env.API_URL || 'https://api.wpvip.com/graphql'; | ||
const PRODUCTION_API_HOST = 'https://api.wpvip.com'; | ||
exports.PRODUCTION_API_HOST = PRODUCTION_API_HOST; | ||
const API_HOST = process.env.API_HOST || PRODUCTION_API_HOST; | ||
exports.API_HOST = API_HOST; | ||
const API_URL = `${API_HOST}/graphql`; | ||
exports.API_URL = API_URL; | ||
@@ -37,9 +47,18 @@ async function API() { | ||
const unauthorizedLink = (0, _apolloLinkError.onError)(({ | ||
networkError | ||
}) => { | ||
if (networkError.statusCode === 401) { | ||
console.error(_chalk.default.red('Unauthorized:'), 'You are unauthorized to perform this request, please logout with `vip logout` then try again.'); | ||
process.exit(); | ||
} | ||
}); | ||
const httpLink = new _apolloLinkHttp.HttpLink({ | ||
uri: API_URL, | ||
headers: headers | ||
}); | ||
return new _apolloClient.ApolloClient({ | ||
link: new _apolloLinkHttp.HttpLink({ | ||
uri: API_URL, | ||
headers: headers | ||
}), | ||
link: unauthorizedLink.concat(httpLink), | ||
cache: new _apolloCacheInmemory.InMemoryCache() | ||
}); | ||
} |
@@ -106,3 +106,3 @@ "use strict"; | ||
if (this.sub[_opts.requiredArgs] && 0 > subCommands.indexOf(this.sub[_opts.requiredArgs])) { | ||
if (!_opts.wildcardCommand && this.sub[_opts.requiredArgs] && 0 > subCommands.indexOf(this.sub[_opts.requiredArgs])) { | ||
const subcommand = this.sub.join(' '); | ||
@@ -123,2 +123,3 @@ await (0, _tracker.trackEvent)('command_validation_error', { | ||
const api = await (0, _api.default)(); | ||
await (0, _tracker.trackEvent)('command_appcontext_list_fetch'); | ||
@@ -395,3 +396,4 @@ try { | ||
requireConfirm: false, | ||
requiredArgs: 0 | ||
requiredArgs: 0, | ||
wildcardCommand: false | ||
}, opts); | ||
@@ -398,0 +400,0 @@ const a = _args.default; |
@@ -6,3 +6,3 @@ "use strict"; | ||
}); | ||
exports.default = void 0; | ||
exports.default = exports.SERVICE = void 0; | ||
@@ -15,2 +15,4 @@ var _jwtDecode = _interopRequireDefault(require("jwt-decode")); | ||
var _api = require("./api"); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
@@ -27,2 +29,3 @@ | ||
const SERVICE = 'vip-go-cli'; | ||
exports.SERVICE = SERVICE; | ||
@@ -85,7 +88,9 @@ class Token { | ||
static async uuid() { | ||
let _uuid = await _keychain.default.getPassword(SERVICE + '-uuid'); | ||
const service = Token.getServiceName('-uuid'); | ||
let _uuid = await _keychain.default.getPassword(service); | ||
if (!_uuid) { | ||
_uuid = (0, _v.default)(); | ||
await _keychain.default.setPassword(SERVICE + '-uuid', _uuid); | ||
await _keychain.default.setPassword(service, _uuid); | ||
} | ||
@@ -97,7 +102,9 @@ | ||
static async set(token) { | ||
return _keychain.default.setPassword(SERVICE, token); | ||
const service = Token.getServiceName(); | ||
return _keychain.default.setPassword(service, token); | ||
} | ||
static async get() { | ||
const token = await _keychain.default.getPassword(SERVICE); | ||
const service = Token.getServiceName(); | ||
const token = await _keychain.default.getPassword(service); | ||
return new Token(token); | ||
@@ -107,7 +114,20 @@ } | ||
static async purge() { | ||
return _keychain.default.deletePassword(SERVICE); | ||
const service = Token.getServiceName(); | ||
return _keychain.default.deletePassword(service); | ||
} | ||
static getServiceName(modifier = '') { | ||
let service = SERVICE; | ||
if (_api.PRODUCTION_API_HOST !== _api.API_HOST) { | ||
const sanitized = _api.API_HOST.replace(/[^a-z0-9]/gi, '-'); | ||
service = `${SERVICE}:${sanitized}`; | ||
} | ||
return `${service}${modifier}`; | ||
} | ||
} | ||
exports.default = Token; |
{ | ||
"name": "@automattic/vip", | ||
"version": "1.3.0", | ||
"version": "1.4.0-dev2", | ||
"description": "The VIP Go Javascript library & CLI", | ||
@@ -10,3 +10,4 @@ "main": "index.js", | ||
"vip-app-list": "dist/bin/vip-app-list.js", | ||
"vip-sync": "dist/bin/vip-sync.js" | ||
"vip-sync": "dist/bin/vip-sync.js", | ||
"vip-wp": "dist/bin/vip-wp.js" | ||
}, | ||
@@ -56,15 +57,16 @@ "scripts": { | ||
"babel-eslint": "10.0.1", | ||
"babel-jest": "23.6.0", | ||
"babel-jest": "24.3.1", | ||
"babel-plugin-module-resolver": "3.1.2", | ||
"core-js": "^2.6.5", | ||
"eslines": "1.1.0", | ||
"eslint": "5.12.1", | ||
"eslint": "5.13.0", | ||
"eslint-config-wpvip": "github:automattic/eslint-config-wpvip#84ba8eb", | ||
"eslint-plugin-flowtype": "3.2.1", | ||
"eslint-plugin-import": "2.14.0", | ||
"eslint-plugin-flowtype": "3.4.1", | ||
"eslint-plugin-import": "2.16.0", | ||
"eslint-plugin-json": "1.3.2", | ||
"eslint-plugin-jsx-a11y": "6.1.2", | ||
"eslint-plugin-jsx-a11y": "6.2.1", | ||
"eslint-plugin-react": "7.12.4", | ||
"eslint-plugin-wpcalypso": "4.0.2", | ||
"flow-bin": "0.91.0", | ||
"jest": "23.6.0", | ||
"flow-bin": "0.92.1", | ||
"jest": "24.3.1", | ||
"mock-local-storage": "1.0.5", | ||
@@ -77,2 +79,3 @@ "nock": "10.0.6", | ||
"apollo-client": "~2.4.5", | ||
"apollo-link-error": "^1.1.8", | ||
"apollo-link-http": "~1.5.5", | ||
@@ -94,2 +97,4 @@ "args": "~5.0.0", | ||
"single-line-log": "~1.1.2", | ||
"socket.io-client": "^2.2.0", | ||
"socket.io-stream": "^0.9.1", | ||
"update-notifier": "~2.5.0", | ||
@@ -96,0 +101,0 @@ "uuid": "~3.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
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
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
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 1 instance in 1 package
63797
33
1638
24
23
1
+ Addedapollo-link-error@^1.1.8
+ Addedsocket.io-client@^2.2.0
+ Addedsocket.io-stream@^0.9.1
+ Addedafter@0.8.2(transitive)
+ Addedapollo-link-error@1.1.13(transitive)
+ Addedarraybuffer.slice@0.0.7(transitive)
+ Addedbacko2@1.0.2(transitive)
+ Addedbase64-arraybuffer@0.1.4(transitive)
+ Addedblob@0.0.5(transitive)
+ Addedcomponent-bind@1.0.0(transitive)
+ Addedcomponent-emitter@1.3.1(transitive)
+ Addedcomponent-inherit@0.0.3(transitive)
+ Addeddebug@2.2.03.1.0(transitive)
+ Addedengine.io-client@3.5.4(transitive)
+ Addedengine.io-parser@2.2.1(transitive)
+ Addedhas-binary2@1.0.3(transitive)
+ Addedhas-cors@1.1.0(transitive)
+ Addedindexof@0.0.1(transitive)
+ Addedisarray@2.0.1(transitive)
+ Addedms@0.7.12.0.0(transitive)
+ Addedparseqs@0.0.6(transitive)
+ Addedparseuri@0.0.6(transitive)
+ Addedsocket.io-client@2.5.0(transitive)
+ Addedsocket.io-parser@3.3.4(transitive)
+ Addedsocket.io-stream@0.9.1(transitive)
+ Addedto-array@0.1.4(transitive)
+ Addedws@7.5.10(transitive)
+ Addedxmlhttprequest-ssl@1.6.3(transitive)
+ Addedyeast@0.1.2(transitive)