Skip to content

Commit

Permalink
Remove PERCY_PROJECT/repo (#72)
Browse files Browse the repository at this point in the history
* Add pre-release version of percy-js for testing

* Bump percy-client

* Remove repo from createBuild client call

* Bump percy-client to v3.0.0

* Remove unused Environment import

* Remove logging when percy is not running
  • Loading branch information
maprules1000 committed Sep 13, 2018
1 parent 182d240 commit 5bf1bbe
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 15 deletions.
16 changes: 5 additions & 11 deletions index.js
Expand Up @@ -5,7 +5,6 @@
var fs = require('fs');
var bodyParser = require('body-parser');
var PercyClient = require('percy-client');
var Environment = require('percy-client/dist/environment');
var PromisePool = require('es6-promise-pool');

// Some build assets we never want to upload.
Expand Down Expand Up @@ -56,6 +55,7 @@ module.exports = {

_clientInfo: function() {
if(!this._clientInfoCache) {
// eslint-disable-next-line node/no-missing-require
var version = require('./package.json').version;
this._clientInfoCache = `${this.name}/${version}`;
}
Expand Down Expand Up @@ -149,15 +149,14 @@ module.exports = {

var token = process.env.PERCY_TOKEN;
var apiUrl = process.env.PERCY_API; // Optional.
var environment = new Environment(process.env);
var repo = environment.repo;

// Disable if Percy is explicitly disabled or if this is not an 'ember test' run.
if (process.env.PERCY_ENABLE == '0' || process.env.EMBER_ENV !== 'test') {
isPercyEnabled = false;
}

if (token && repo && isPercyEnabled) {
if (token && isPercyEnabled) {
console.warn('[percy] Percy is running.');
percyClient = new PercyClient({
token: token,
apiUrl: apiUrl,
Expand All @@ -166,15 +165,10 @@ module.exports = {
});
} else {
isPercyEnabled = false;

if (environment.ci && !token) {
if (!token) {
console.warn(
'[percy][WARNING] Percy is disabled, no PERCY_TOKEN environment variable found.')
}
if (environment.ci && !repo) {
console.warn(
'[percy][WARNING] Percy is disabled, no PERCY_PROJECT environment variable found.')
}
}

if (!isPercyEnabled) { return; }
Expand All @@ -185,7 +179,7 @@ module.exports = {
});

// Initialize the percy client and a new build.
percyBuildPromise = percyClient.createBuild(repo, {resources: resources});
percyBuildPromise = percyClient.createBuild({resources: resources});

// Return a promise and only resolve when all build resources are uploaded, which
// ensures that the output build dir is still available to be read from before deleted.
Expand Down
2 changes: 1 addition & 1 deletion package.json
Expand Up @@ -56,7 +56,7 @@
"body-parser": "^1.15.0",
"ember-cli-babel": "^6.10.0",
"es6-promise-pool": "^2.4.1",
"percy-client": "^2.10.0",
"percy-client": "^3.0.0",
"walk": "^2.3.9"
},
"ember-addon": {
Expand Down
6 changes: 3 additions & 3 deletions yarn.lock
Expand Up @@ -5433,9 +5433,9 @@ path-type@^1.0.0:
pify "^2.0.0"
pinkie-promise "^2.0.0"

percy-client@^2.10.0:
version "2.10.0"
resolved "https://registry.yarnpkg.com/percy-client/-/percy-client-2.10.0.tgz#9e70e5c51dc32721ea72fd35efe4b18657e897a6"
percy-client@^3.0.0:
version "3.0.0"
resolved "https://registry.yarnpkg.com/percy-client/-/percy-client-3.0.0.tgz#86289f8224817cf550c9b21aaf994b7fa16f291d"
dependencies:
base64-js "^1.2.3"
bluebird "^3.5.1"
Expand Down

0 comments on commit 5bf1bbe

Please sign in to comment.