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

Commit

Permalink
Merge f62ae7d into ce1703d
Browse files Browse the repository at this point in the history
  • Loading branch information
Cawllec committed Jan 16, 2019
2 parents ce1703d + f62ae7d commit cdcda06
Show file tree
Hide file tree
Showing 5 changed files with 1,381 additions and 177 deletions.
50 changes: 25 additions & 25 deletions cli.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
#!/usr/bin/env node

const meow = require('meow');
const Listr = require('listr');
const rc = require('rc');
const readPkgUp = require('read-pkg-up');
const upload = require('./').upload;
const meow = require('meow')
const Listr = require('listr')
const rc = require('rc')
const readPkgUp = require('read-pkg-up')
const upload = require('./').upload

const cli = meow(`
Usage
Expand Down Expand Up @@ -54,44 +54,44 @@ const cli = meow(`
s: 'source-map',
u: 'upload-sources',
v: 'app-version',
w: 'add-wildcard-prefix',
w: 'add-wildcard-prefix'
},
string: [
'app-version',
'api-key',
'api-key'
],
boolean: [
'overwrite',
'upload-node-modules',
'upload-sources',
'add-wildcard-prefix',
],
});
'add-wildcard-prefix'
]
})

const conf = {
// Any cli-specific defaults (none currently)
};
}

// Pull configuration from a local .bugsnagrc file
const sourcemapsrc = rc('bugsnag').sourcemaps || {};
Object.assign(conf, sourcemapsrc[process.env.NODE_ENV] || sourcemapsrc);
const sourcemapsrc = rc('bugsnag').sourcemaps || {}
Object.assign(conf, sourcemapsrc[process.env.NODE_ENV] || sourcemapsrc)

// Then extract any overrides from the flags
Object.assign(conf, cli.flags);
Object.assign(conf, cli.flags)

for (const key in conf) {
// Strip out the single letter (aliases) from meow
if (key.length === 1) {
delete conf[key];
delete conf[key]
}
}

const tasks = new Listr([
{
title: 'Uploading sourcemaps',
task: () => upload(conf),
},
]);
task: () => upload(conf)
}
])

Promise.resolve()
.then(() => {
Expand All @@ -101,16 +101,16 @@ Promise.resolve()
// the project root, or the current working directory, and use that version.
readPkgUp(conf.projectRoot || process.cwd())
.then(arg => {
const pkg = arg && arg.pkg ? arg.pkg : null;
const pkg = arg && arg.pkg ? arg.pkg : null
// only use pkg.version if it's truthy, because read-pkg-up will
// set it to "" (empty string) when it's missing
if (pkg && pkg.version) conf.appVersion = pkg.version;
if (pkg && pkg.version) conf.appVersion = pkg.version
})
);
)
}
})
.then(() => {
return tasks.run().catch(err => {
process.exitCode = 1;
});
});
return tasks.run().catch(() => {
process.exitCode = 1
})
})
Loading

0 comments on commit cdcda06

Please sign in to comment.