Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove PERCY_PROJECT/repo #72

Merged
merged 6 commits into from Sep 13, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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