Skip to content
This repository has been archived by the owner on Jul 19, 2021. It is now read-only.

Commit

Permalink
Fix cli:start and start:start analytics events
Browse files Browse the repository at this point in the history
  • Loading branch information
t-kelly committed Dec 18, 2018
1 parent 6e4c198 commit 4371776
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
2 changes: 2 additions & 0 deletions packages/slate-tools/cli/commands/start.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ let assetServer;
let devServer;
let previewUrl;

event('slate-tools:start:start', {version: packageJson.version});

Promise.all([
getAvailablePortSeries(config.get('network.startPort'), 3),
promptExternalTesting(),
Expand Down
14 changes: 13 additions & 1 deletion packages/slate-tools/cli/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ const packageJson = require('../package.json');

const script = process.argv[2];
const args = process.argv.slice(3);
const config = new SlateConfig(require('../slate-tools.schema'));

try {
slateEnv.assign(argv.env);
Expand All @@ -20,10 +21,21 @@ try {
let result;

async function init() {
let slateConfig;

await analytics.init();

// Convert user config to JSON string so it can be sent in analytics. Make sure
// we catch any errors while converting, such as converting a circular object
// structure to JSON
try {
slateConfig = JSON.stringify(config.userConfig);
} catch (error) {
slateConfig = JSON.stringify({error: error.message});
}

analytics.event('slate-tools:cli:start', {
slateConfig: SlateConfig.userConfig,
slateConfig,
version: packageJson.version,
});

Expand Down

0 comments on commit 4371776

Please sign in to comment.