Skip to content

Commit

Permalink
update dev environment with webpack dev server
Browse files Browse the repository at this point in the history
  • Loading branch information
crabbly committed Sep 26, 2018
1 parent 2139aca commit 069fe6c
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 13 deletions.
27 changes: 20 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ yarn add print-js

When installing via npm or yarn, import the library into your project:

```
```js
import printJS from 'print-js'
```

Expand All @@ -36,6 +36,9 @@ You can find documentation at [printjs.crabbly.com](http://printjs.crabbly.com/#

## Contributing to Print.js

[![devDependencies Status](https://david-dm.org/crabbly/print.js/dev-status.svg)](https://david-dm.org/crabbly/print.js?type=dev)
[![dependencies Status](https://david-dm.org/crabbly/print.js/status.svg)](https://david-dm.org/crabbly/print.js)

Contributions to Print.js are welcome and encouraged.


Expand Down Expand Up @@ -66,20 +69,30 @@ Please make your commits in logical sections with clear commit messages.

##### Setting up a dev environment

```
```bash
npm install
npm run watch
```

If you want to test your modified code:
##### Tests

```
npm install http-server -g
http-server
The library is written following the [Javascript Standard](https://standardjs.com) code style. When running tests, we will also test for any style issues or warnings.

Automated tests are written using the [Jasmine](https://jasmine.github.io) framework and [Karma](https://karma-runner.github.io) runner.

To run the automated tests:

```bash
npm run test
```

Navigate to `http://localhost:8080/test.html`
To manually test the library features:

```bash
npm start
```

This will serve `test\manual\test.html` and open `http://localhost:8080/test/manual` in your default browser.

## License

Expand Down
6 changes: 4 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,15 +30,17 @@
"standard": "^7.1.2",
"uglifyjs-webpack-plugin": "^1.3.0",
"webpack": "^4.16.5",
"webpack-cli": "^3.1.0"
"webpack-cli": "^3.1.0",
"webpack-dev-server": "^3.1.9"
},
"scripts": {
"test": "standard && karma start",
"dev": "webpack --mode development --progress --hide-modules --devtool source-map",
"watch": "webpack --mode development --watch --progress --hide-modules",
"production": "webpack --mode production --progress --hide-modules",
"coverage": "open coverage/lcov-report/index.html",
"coveralls": "cat coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js"
"coveralls": "cat coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js",
"start": "webpack-dev-server --public http://localhost:8080/test/manual --open"
},
"author": "Rodrigo Vieira <rodrigo@crabbly.com>",
"standard": {
Expand Down
8 changes: 4 additions & 4 deletions test/manual/test.html → test/manual/index.html
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
<html>
<script src='./dist/print.js'></script>
<script src='../../dist/print.js'></script>
<script type="text/javascript">
function printPdf() {
printJS('test.pdf');
printJS('/test/manual/test.pdf');
}

function printPdfWithModal() {
printJS({
printable: 'test.pdf',
printable: '/test/manual/test.pdf',
type: 'pdf',
showModal: true
});
}

function printPdfWithModalAndCloseCallback() {
printJS({
printable: 'test.pdf',
printable: '/test/manual/test.pdf',
type: 'pdf',
showModal: true,
onPrintDialogClose: () => console.log('The print dialog was closed'),
Expand Down

0 comments on commit 069fe6c

Please sign in to comment.