Skip to content
This repository has been archived by the owner on Jun 26, 2024. It is now read-only.

Commit

Permalink
fix: better error logging on entrypoint
Browse files Browse the repository at this point in the history
  • Loading branch information
vhf committed Oct 28, 2019
1 parent 647a2bf commit 9898977
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 9 deletions.
17 changes: 9 additions & 8 deletions setup/migrate.js
Original file line number Diff line number Diff line change
Expand Up @@ -265,14 +265,6 @@ async function migrateSettings () {
'OAUTH_CLIENT_SECRET',
'GITHUB_PERSONAL_ACCESS_TOKEN'
]
const varsToImport = importableEnvVars.filter(name => !!process.env[name])
if (!varsToImport.length) {
spinner.succeed('No environment variable to import')
return
}
else {
spinner.info(`Will import the following env vars: \n - ${varsToImport.map(x => `${x}=${process.env[x]}`).join('\n - ')}\n`)
}

try {
const client = knex({
Expand All @@ -295,6 +287,15 @@ async function migrateSettings () {
if (!existingConfigs.length) {
const { forge, editor, ontology } = getConfigFromEnvVars()

const varsToImport = importableEnvVars.filter(name => !!process.env[name])
if (!varsToImport.length) {
spinner.succeed('No environment variable to import')
return
}
else {
spinner.info(`Will import the following env vars: \n - ${varsToImport.map(x => `${x}=${process.env[x]}`).join('\n - ')}\n`)
}

await client.raw(`
INSERT INTO
"editor_schema"."config"("forge", "editor", "ontology", "reason")
Expand Down
4 changes: 3 additions & 1 deletion setup/replace-vars.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ const path = require('path')
const shell = require('child_process').execSync
const dummyConfig = require('../fixtures/dummy-config')
const fetchConfig = require('./fetch-config')
const debug = require('debug')('editor:entrypoint')

module.exports = replace

Expand Down Expand Up @@ -43,7 +44,7 @@ async function replace () {
`)
}
catch (err) {
console.log(err.message)
debug(err.message)
}
}

Expand All @@ -61,6 +62,7 @@ async function setManifest (manifest) {
else {
v = 0
}
debug(`new version: ?v=${v + 1}`)
return `${filename}?v=${v + 1}`
})
await fs.writeFile(
Expand Down

0 comments on commit 9898977

Please sign in to comment.