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

Add standardjs linter #35

Merged
merged 5 commits into from
Jan 16, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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