Skip to content

Commit 6d349ec

Browse files
author
Dom Harrington
committed
Prettier
1 parent 5bb0753 commit 6d349ec

File tree

5 files changed

+33
-17
lines changed

5 files changed

+33
-17
lines changed

cli.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ module.exports = function(cmd, args, opts = {}) {
2020
try {
2121
const command = load(opts.help ? 'help' : cmd);
2222
return command.run({ args, opts });
23-
} catch(e) {
23+
} catch (e) {
2424
return Promise.reject(e);
2525
}
2626
};

lib/docs.js

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,11 @@ exports.run = function({ args, opts }) {
6262
if (hash === existingDoc.lastUpdatedHash) return undefined;
6363
return request
6464
.put(`${config.host}/api/v1/docs/${slug}`, {
65-
json: Object.assign(existingDoc, { body: file.content, ...file.data, lastUpdatedHash: hash }),
65+
json: Object.assign(existingDoc, {
66+
body: file.content,
67+
...file.data,
68+
lastUpdatedHash: hash,
69+
}),
6670
...options,
6771
})
6872
.catch(validationErrors);
@@ -74,7 +78,10 @@ exports.run = function({ args, opts }) {
7478
const matter = frontMatter(file);
7579
// Stripping the markdown extension from the filename
7680
const slug = filename.replace(path.extname(filename), '');
77-
const hash = crypto.createHash('sha1').update(file).digest('hex');
81+
const hash = crypto
82+
.createHash('sha1')
83+
.update(file)
84+
.digest('hex');
7885

7986
return request
8087
.get(`${config.host}/api/v1/docs/${slug}`, {

rdme.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ const parseArgs = require('minimist')(process.argv.slice(2), {
1010
// // Allows --help, -h, -H
1111
h: 'help',
1212
H: 'help',
13-
}
13+
},
1414
});
1515

1616
require('./cli')(parseArgs._[0], parseArgs._.slice(1), parseArgs)

test/cli.test.js

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ const { version } = require('../package.json');
77
describe('cli', () => {
88
it('command not found', done =>
99
cli('notARealCommand').catch(e => {
10-
assert.equal(e.message.includes('Command not found'), true)
10+
assert.equal(e.message.includes('Command not found'), true);
1111
return done();
1212
}));
1313

@@ -17,17 +17,17 @@ describe('cli', () => {
1717

1818
// This is necessary because we use --version for other commands like `docs`
1919
it('should only return version if no command', () =>
20-
cli('no-such-command', [], minimist(['--version'])).then(() => {
21-
throw new Error('Should not get here');
22-
}).catch(() => {
23-
// This can be ignored as it's just going to be
24-
// a command not found error
25-
}));
20+
cli('no-such-command', [], minimist(['--version']))
21+
.then(() => {
22+
throw new Error('Should not get here');
23+
})
24+
.catch(() => {
25+
// This can be ignored as it's just going to be
26+
// a command not found error
27+
}));
2628
});
2729

2830
describe('--help', () => {
29-
it('should print help and not error', () =>
30-
cli('', [], minimist(['--help']))
31-
);
31+
it('should print help and not error', () => cli('', [], minimist(['--help'])));
3232
});
3333
});

test/docs.test.js

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,10 @@ describe('docs command', () => {
3939
const doc = frontMatter(
4040
fs.readFileSync(path.join(__dirname, `./fixtures/existing-docs/${slug}.md`)),
4141
);
42-
const hash = crypto.createHash('sha1').update(fs.readFileSync(path.join(__dirname, `./fixtures/existing-docs/${slug}.md`))).digest('hex');
42+
const hash = crypto
43+
.createHash('sha1')
44+
.update(fs.readFileSync(path.join(__dirname, `./fixtures/existing-docs/${slug}.md`)))
45+
.digest('hex');
4346

4447
const getMock = nock(config.host, {
4548
reqheaders: {
@@ -73,7 +76,10 @@ describe('docs command', () => {
7376

7477
it('should not send requests for docs that have not changed', () => {
7578
const slug = 'simple-doc';
76-
const hash = crypto.createHash('sha1').update(fs.readFileSync(path.join(__dirname, `./fixtures/existing-docs/${slug}.md`))).digest('hex');
79+
const hash = crypto
80+
.createHash('sha1')
81+
.update(fs.readFileSync(path.join(__dirname, `./fixtures/existing-docs/${slug}.md`)))
82+
.digest('hex');
7783

7884
const getMock = nock(config.host, {
7985
reqheaders: {
@@ -96,7 +102,10 @@ describe('docs command', () => {
96102
const doc = frontMatter(
97103
fs.readFileSync(path.join(__dirname, `./fixtures/new-docs/${slug}.md`)),
98104
);
99-
const hash = crypto.createHash('sha1').update(fs.readFileSync(path.join(__dirname, `./fixtures/new-docs/${slug}.md`))).digest('hex');
105+
const hash = crypto
106+
.createHash('sha1')
107+
.update(fs.readFileSync(path.join(__dirname, `./fixtures/new-docs/${slug}.md`)))
108+
.digest('hex');
100109

101110
const getMock = nock(config.host, {
102111
reqheaders: {

0 commit comments

Comments
 (0)