From 29aef0a1cea00ff8ec08f09551d0bf65e98e7695 Mon Sep 17 00:00:00 2001 From: Wil Wilsman Date: Fri, 31 Jul 2020 13:27:27 -0500 Subject: [PATCH] =?UTF-8?q?=F0=9F=A7=B9=20Clean=20up=20self=20reported=20c?= =?UTF-8?q?lient=20info?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/cli-upload/src/commands/upload.js | 10 +++++++--- packages/core/src/percy.js | 7 +------ 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/packages/cli-upload/src/commands/upload.js b/packages/cli-upload/src/commands/upload.js index 78db207b5..df2867147 100644 --- a/packages/cli-upload/src/commands/upload.js +++ b/packages/cli-upload/src/commands/upload.js @@ -7,6 +7,7 @@ import imageSize from 'image-size'; import PercyClient from '@percy/client'; import createImageResources from '../resources'; import { schema } from '../config'; +import pkg from '../../package.json'; const ALLOWED_IMAGE_TYPES = /\.(png|jpg|jpeg)$/i; @@ -75,11 +76,14 @@ export class Upload extends Command { // we already have assets so we don't need asset discovery from @percy/core, // we can use @percy/client directly to send snapshots - this.client = new PercyClient(); + this.client = new PercyClient({ + clientInfo: `${pkg.name}/${pkg.version}` + }); + await this.client.createBuild(); - log.info('Percy has started!'); + let { build } = this.client; - let build = this.client.build; + log.info('Percy has started!'); log.info(`Created build #${build.number}: ${build.url}`); for (let name of paths) { diff --git a/packages/core/src/percy.js b/packages/core/src/percy.js index 6c467057d..0821047db 100644 --- a/packages/core/src/percy.js +++ b/packages/core/src/percy.js @@ -9,7 +9,6 @@ import Queue from './queue'; import assert from './utils/assert'; import { createRootResource, createLogResource } from './utils/resources'; import { normalizeURL } from './utils/url'; -import pkg from '../package.json'; // Register core config options PercyConfig.addSchema(schema); @@ -66,11 +65,7 @@ export default class Percy { : PercyConfig.load({ path: config, overrides: options }); this.discoverer = new Discoverer(this.config.discovery); - this.client = new PercyClient({ - clientInfo: [`${pkg.name}/${pkg.version}`].concat(clientInfo), - environmentInfo, - token - }); + this.client = new PercyClient({ token, clientInfo, environmentInfo }); } // Shortcut for controlling the global logger's log level.