Skip to content

Commit 80a29c8

Browse files
committed
Update build process, usage, package json
1 parent e89eba1 commit 80a29c8

File tree

2 files changed

+17
-10
lines changed

2 files changed

+17
-10
lines changed

README.md

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,10 @@ This module works almost exactly like the NodeJS [`console.table`](https://nodej
77

88
You can use the table function exactly like the NodeJS [`console.table`](https://nodejs.org/api/console.html#console_console_table_tabulardata_properties), but you must store the result as a string.
99

10+
When using the web browser bundles, the module is available via the `nsTable` global.
11+
1012
```JavaScript
13+
const nsTable = require("nodestringtable");
1114
const tabularData = {
1215
firstName: "John",
1316
lastName: "Smith"
@@ -25,14 +28,10 @@ const table = nsTable(tabularData);
2528

2629
## Building for Browsers
2730

28-
Bundle `index.js` with Browserify in standalone mode, which should include a copy of the NodeJS `util` module to be used inside this module.
29-
30-
```bash
31-
browserify index.js -o nsTable.js -s nsTable
32-
```
31+
Bundle `index.js` with Browserify in standalone mode, which should include a copy of the NodeJS `util` module to be used inside this module. The main bundle (`nsTable.js`) and an UglifyJS2 minified version (`nsTable.min.js`) will be saved to the `dist` directory.
3332

34-
You can just run the included NPM script which does the same:
33+
You can just run the included NPM script which does this:
3534

3635
```bash
37-
npm run browserify
36+
npm run bundle
3837
```

package.json

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,22 @@
1313
"url": "git://github.com/Floofies/console-buffer.git"
1414
},
1515
"devDependencies": {
16-
"browserify": ""
16+
"browserify": "^16.2.3",
17+
"uglify-es": "^3.3.9"
1718
},
1819
"scripts": {
19-
"browserify": "browserify index.js -o nsTable.js -s nsTable"
20+
"bundle": "browserify ./index.js -s nsTable -o ./dist/nsTable.js && uglifyjs ./dist/nsTable.js -o ./dist/nsTable.min.js",
21+
"prepare": "npm run bundle"
2022
},
23+
"main": "index.js",
24+
"unpkg": "dist/nsTable.min.js",
25+
"files": [
26+
"dist/nsTable.js",
27+
"dist/nsTable.min.js"
28+
],
2129
"keywords": [
2230
"console.table",
2331
"table",
2432
"tabular"
2533
]
26-
}
34+
}

0 commit comments

Comments
 (0)