Browse Source

Read docker label correctly, fixes #368 (#501)

master
Jarmo Isotalo 8 years ago
committed by Matheus Fernandes
parent
commit
c05405e193
  1. 18
      lib/read-metadata.js

18
lib/read-metadata.js

@ -91,9 +91,7 @@ async function readMetaData(
name = basename(path) name = basename(path)
if (!quiet && !isStatic) { if (!quiet && !isStatic) {
console.log( console.log(`> No \`name\` in \`package.json\`, using ${chalk.bold(name)}`)
`> No \`name\` in \`package.json\`, using ${chalk.bold(name)}`
)
} }
} }
} }
@ -125,11 +123,9 @@ async function readMetaData(
// Unescape and convert into string // Unescape and convert into string
try { try {
labels[key] = JSON.parse(args[key]) labels[key] = args[key]
} catch (err) { } catch (err) {
const e = Error( const e = Error(`Error parsing value for LABEL ${key} in \`Dockerfile\``)
`Error parsing value for LABEL ${key} in \`Dockerfile\``
)
e.userError = true e.userError = true
throw e throw e
} }
@ -144,13 +140,9 @@ async function readMetaData(
if (!quiet) { if (!quiet) {
if (hasNowJson) { if (hasNowJson) {
console.log( console.log(`> No \`name\` LABEL in \`Dockerfile\` or \`name\` field in \`now.json\`, using ${chalk.bold(name)}`)
`> No \`name\` LABEL in \`Dockerfile\` or \`name\` field in \`now.json\`, using ${chalk.bold(name)}`
)
} else { } else {
console.log( console.log(`> No \`name\` LABEL in \`Dockerfile\`, using ${chalk.bold(name)}`)
`> No \`name\` LABEL in \`Dockerfile\`, using ${chalk.bold(name)}`
)
} }
} }
} }

Loading…
Cancel
Save