Skip to content

Commit

Permalink
fix toc generation
Browse files Browse the repository at this point in the history
  • Loading branch information
SiAdcock committed Jun 11, 2018
1 parent d7f8ab5 commit 51ac3e0
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 4 deletions.
3 changes: 2 additions & 1 deletion docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,14 @@
- [Testing externally on your localhost](03-dev-howtos/09-testing-externally-on-localhost.md)
- [Testing AMIs or provisioning in AWS](03-dev-howtos/10-testing-platform.md)
- [Accessing HTTP access logs for your localhost](03-dev-howtos/11-access-logs-for-your-localhost.md)
- [Update configuration](03-dev-howtos/12-Update-configuration.md)
- [Update configuration in Systems Manager Parameter Store](03-dev-howtos/12-Update-configuration.md)
- [Implement Google Analytics](03-dev-howtos/13-implement-google-analytics.md)
- [Overriding default configuration](03-dev-howtos/14-override-default-configuration.md)
- [Updating the test database](03-dev-howtos/15-updating-test-database.md)
- [Working with Google AMP](03-dev-howtos/16-working-with-amp.md)
- [Working with emails](03-dev-howtos/17-working-with-emails.md)
- [Apply the special report tone](03-dev-howtos/18-apply-the-special-report-tone.md)
- [Tracking components in the Data Lake](03-dev-howtos/19-tracking-components-in-the-data-lake.md)

## [Quality](04-quality/)
- [Browsers support](04-quality/01-browser-support.md)
Expand Down
1 change: 1 addition & 0 deletions docs/generate-toc.sh
Original file line number Diff line number Diff line change
Expand Up @@ -53,5 +53,6 @@ done
echo ""
echo "---"
cat how-to-create-a-doc-file.md
echo ""

popd > /dev/null
10 changes: 7 additions & 3 deletions git-hooks/pre-push
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
#!/usr/bin/env node
/* eslint-disable no-console */

const fs = require('fs');
const { promisify } = require('util');
const path = require('path');
const execa = require('execa');
const chalk = require('chalk');
const getChangedFiles = require('../tools/__tasks__/lib/get-changed-files');

const writeFile = promisify(fs.writeFile);

const confirmIfMasterMessage = `${chalk.red(
`${chalk.inverse(
'You are about to push master!'
Expand Down Expand Up @@ -72,9 +76,9 @@ const updateTOC = changed => {
if (changed.some(file => file.includes('docs/'))) {
const docs = path.resolve('docs');
const readme = path.resolve(docs, 'README.md');
return execa(path.resolve(docs, 'generate-toc.sh'), ['>', readme], {
stdio: 'inherit',
})
return execa
.stdout(path.resolve(docs, 'generate-toc.sh'))
.then(toc => writeFile(readme, toc, 'utf8'))
.then(() => execa.sync('git', ['add', readme]))
.then(() => changed);
}
Expand Down

0 comments on commit 51ac3e0

Please sign in to comment.