Comparing version 1.0.2 to 1.0.4
24
index.js
@@ -72,3 +72,3 @@ #!/usr/bin/env node | ||
async function postMetrics(apiKey, config, results) { | ||
async function postMetrics(apiKey, config, results, tags) { | ||
let response; | ||
@@ -79,3 +79,4 @@ const body = { | ||
config, | ||
results: {} | ||
results, | ||
tags, | ||
}; | ||
@@ -231,3 +232,12 @@ try { | ||
if (flags.record) { | ||
await promptForTags(); | ||
const configJson = JSON.parse(fs.readFileSync(`./diffjam.json`).toString()); | ||
if (!configJson.tags || !Array.isArray(configJson.tags) || configJson.tags.length === 0) { | ||
console.error("Missing tags! Could not post metrics."); | ||
console.error( | ||
"You must have one or more tags for these metrics." | ||
); | ||
process.exitCode = 1; | ||
} | ||
console.log("sending metrics to server..."); | ||
@@ -261,2 +271,3 @@ console.log("successes: ", successes); | ||
config.set("policies", {}); | ||
config.set("tags", []); | ||
} | ||
@@ -573,2 +584,11 @@ }; | ||
const promptForTags = async () => { | ||
const tags = config.get("tags") || []; | ||
if (tags.length === 0) { | ||
const tagInput = await ui.textInput("Enter the name of this codebase: "); | ||
tags.push(`codebase:${tagInput}`); | ||
config.set("tags", tags); | ||
} | ||
} | ||
const actionCinch = async () => { | ||
@@ -575,0 +595,0 @@ ensureConfig(); |
{ | ||
"name": "diffjam", | ||
"version": "1.0.2", | ||
"version": "1.0.4", | ||
"description": "cli for diffjam.com", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
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
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
31042
892