Skip to content
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
6 changes: 2 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -180,13 +180,11 @@ $ yarn test:coverage
$ yarn test:watch
```

###### Run the examples and print the output to the command line.
###### Update the documentation.
```bash
$ gulp example
$ yarn docs
```

Other build targets are available, check `gulpfile.js` for a comprehensive list.

## Credits

- James Talmage - author <james.talmage@jrtechnical.com> ([jamestalmage](http://github.com/jamestalmage))
Expand Down
21 changes: 0 additions & 21 deletions gulpfile.js

This file was deleted.

75 changes: 33 additions & 42 deletions lib/print-example.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@

const colors = require('colors/safe');
const fs = require('fs');
const git = require('git-rev');

function logExample(fn) {
runPrintingExample(
Expand All @@ -19,48 +18,40 @@ function logExample(fn) {
}

function mdExample(fn, file, cb) {
git.long(function(commitHash) {
let buffer = [];

runPrintingExample(
fn,
function logName(name) {
buffer.push('##### ' + name);
},
function logTable(table) {
//md files won't render color strings properly.
table = stripColors(table);

// indent table so is displayed preformatted text
table = ' ' + table.split('\n').join('\n ');

buffer.push(table);
},
function logCode(code) {
buffer.push('```javascript');
buffer.push(stripColors(code));
buffer.push('```');
},
function logSeparator(sep) {
buffer.push(stripColors(sep));
},
function logScreenShot(image) {
buffer.push(
'![table image](https://cdn.rawgit.com/jamestalmage/cli-table2/' +
commitHash +
'/examples/screenshots/' +
image +
'.png)'
);
}
);

fs.writeFileSync(file, buffer.join('\n'));

if (cb) {
cb();
let buffer = [];

runPrintingExample(
fn,
function logName(name) {
buffer.push('##### ' + name);
},
function logTable(table) {
//md files won't render color strings properly.
table = stripColors(table);

// indent table so is displayed preformatted text
table = ' ' + table.split('\n').join('\n ');

buffer.push(table);
},
function logCode(code) {
buffer.push('```javascript');
buffer.push(stripColors(code));
buffer.push('```');
},
function logSeparator(sep) {
buffer.push(stripColors(sep));
},
function logScreenShot(image) {
buffer.push('![table image](./examples/screenshots/' + image + '.png)');
}
});
);

fs.writeFileSync(file, buffer.join('\n'));

if (cb) {
cb();
}
}

/**
Expand Down
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@
"cli-table": "^0.3.1",
"eslint-config-prettier": "^2.9.0",
"eslint-plugin-prettier": "^2.6.0",
"git-rev": "^0.2.1",
"gulp": "^3.9.0",
"jest": "^23.1.0",
"jest-runner-eslint": "^0.6.0",
"prettier": "1.13.5"
Expand All @@ -30,7 +28,8 @@
"colors": "^1.1.2"
},
"scripts": {
"prettier": "prettier --write '{examples,lib,src,test}/**/*.js'",
"docs": "node ./scripts/update-docs.js",
"prettier": "prettier --write '{examples,lib,scripts,src,test}/**/*.js'",
"test": "jest --color",
"test:watch": "jest --color --watchAll --notify"
},
Expand Down Expand Up @@ -73,6 +72,7 @@
"testMatch": [
"<rootDir>/examples/**/*.js",
"<rootDir>/lib/**/*.js",
"<rootDir>/scripts/**/*.js",
"<rootDir>/src/**/*.js",
"<rootDir>/test/**/*.js"
]
Expand Down
4 changes: 4 additions & 0 deletions scripts/print-examples.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
var printExample = require('../lib/print-example');

printExample.logExample(require('../examples/basic-usage-examples'));
printExample.logExample(require('../examples/col-and-row-span-examples'));
4 changes: 4 additions & 0 deletions scripts/update-docs.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
var printExample = require('../lib/print-example');

printExample.mdExample(require('../examples/basic-usage-examples'), 'basic-usage.md');
printExample.mdExample(require('../examples/col-and-row-span-examples'), 'advanced-usage.md');
Loading