Skip to content

Commit

Permalink
npm: use webpack2 instead of grunt
Browse files Browse the repository at this point in the history
In order to use es6 in the package we need a module bundler (webpack2)
that transpile our code using babel.
To do that we did:
- added bumped to manage releases
- updated travis test
- updated package.json and bower.json in order to work with webpack2
- added a CHANGELOG page
- updated index.html
- added many fix on module
- added eslint and remove jsonhint
- removed bower dependency
- updated documentation
- added automatic gh-pages deploy
- added angularjs and pdfjs as peerDependencies

aside note of duplicated dependencies in package.json:
angularjs and pdfjs are in both list because we need to alert user
if they lack AND for developing/testig purposes

ref: #90
  • Loading branch information
simobasso authored and dennybiasiolli committed Apr 18, 2017
1 parent 85fbf1e commit 98cf069
Show file tree
Hide file tree
Showing 14 changed files with 856 additions and 481 deletions.
34 changes: 34 additions & 0 deletions .bumpedrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
files:
- package.json
- bower.json
plugins:
prerelease:
Linting config files:
plugin: bumped-finepack
Detecting problems before release:
plugin: bumped-terminal
command: 'npm run test'
postrelease:
Build new Release:
plugin: bumped-terminal
command: 'npm run clean && npm run build && npm run build-min'
Generating CHANGELOG file:
plugin: bumped-changelog
Commiting new version:
plugin: bumped-terminal
command: 'git add CHANGELOG.md package.json bower.json dist/ && git commit -m "Release $newVersion"'
Publishing tag to GitHub:
plugin: bumped-terminal
command: 'git tag $newVersion && git push && git push --tags'
Publishing to NPM:
plugin: bumped-terminal
command: npm publish
Prepare gh-pages:
plugin: bumped-terminal
command: 'cp -r example ghpages && cp dist/angular-pdf.min.js ghpages'
Update gh-pages:
plugin: 'bumped-gh-pages'
folder: 'ghpages'
Clean gh-pages temporary folder:
plugin: bumped-terminal
command: 'rm -rf ghpages'
1 change: 1 addition & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
extends: angular
61 changes: 0 additions & 61 deletions .jshintrc

This file was deleted.

5 changes: 2 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,5 @@ node_js:
- '4'
- '6'
- 'node'
before_script:
- npm install -g bower
- bower install
before_install:
- 'npm install angular pdfjs-dist'
456 changes: 456 additions & 0 deletions CHANGELOG.md

Large diffs are not rendered by default.

21 changes: 7 additions & 14 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,11 @@
```
- Create a new patch branch
- Code code code and amend the file `src/angular-pdf.js`
- Run `npm run build` to create the build minified and example files
- Run `npm run start` to start the `webpack-dev-server` and open `http://localhost:8080`
- Code code code
- Run `npm test` to ensure the [build](https://travis-ci.org/sayanee/angularjs-pdf) and the tests will pass
- Ensure that you are not committing files contained in `dist` folder
- update `readme.md` if required, especially the section on [Features](https://github.com/sayanee/angularjs-pdf#features)
- Ensure that you are not committing files contained in `dist` folder (builds are for mantainers' exclusive)
- Write a [good commit message](https://github.com/angular/angular.js/blob/master/CONTRIBUTING.md#commit-message-format)
- [Pull request](https://help.github.com/articles/using-pull-requests) using the new patch branch
- Ensure the [Travis build and tests](https://travis-ci.org/sayanee/angularjs-pdf) passes
Expand All @@ -28,18 +29,10 @@

##Make a Release (for maintainers only)

1. commit your code (steps 1 - 7)
- check for outdated dependencies with `npm outdated` and `bower list`
1. amend version number of packages in `package.json` and `bower.json`
- install various packages `npm i` and `bower i`
- run `npm run build` to build all files
- commit your code
- update `readme.md` if required, especially the section on [Features](https://github.com/sayanee/angularjs-pdf#features)
- run `grunt bumps`, `grunt bumps --type=minor` or `grunt bumps --type=major` according semantic version
- copy the `example` folder
- change to branch `gh-pages`
- copy the `example` folder from `master` branch
- commit code in `gh-pages` and `git push origin gh-pages` to publish the [examples page](http://sayan.ee/angularjs-pdf/)
1. run `npm run release patch`, `npm run release minor` or `npm run release major` according semantic version
- done :tada:

> `npm run release` also update `gh-pages` then you don't need to update manually
##Angular-PDF is an OPEN Open Source Project

Expand Down
164 changes: 0 additions & 164 deletions Gruntfile.js

This file was deleted.

14 changes: 9 additions & 5 deletions readme.md → README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ Integrate PDF files right into web pages.

## Requirements

Check [`bower.json` file](https://github.com/sayanee/angularjs-pdf/blob/master/bower.json) for dependencies and their versions:
Check [`package.json` file](https://github.com/sayanee/angularjs-pdf/blob/master/package.json) for dependencies and their versions:

1. [AngularJS](http://angularjs.org/) - get the latest [angular.min.js](https://developers.google.com/speed/libraries/devguide#angularjs)
- [PDFJS](http://mozilla.github.io/pdf.js/) - build the files [`pdf.js` and `pdf.worker.js`](https://github.com/mozilla/pdf.js#building-pdfjs)
Expand Down Expand Up @@ -40,7 +40,11 @@ Check [`bower.json` file](https://github.com/sayanee/angularjs-pdf/blob/master/b
1. Install or copy over the file `dist/angular-pdf.min.js` or `dist/angular-pdf.js`

```shell
bower install angular-pdf
npm install angular-pdf --save
```
or
```shell
bower install angular-pdf --save
```
- Include the path to the directive file in `index.html`

Expand Down Expand Up @@ -250,17 +254,17 @@ This repository follows the [Semantic Versioning](http://semver.org/) guidelines
1. For **patches**, run the command:

```
grunt bumps
npm run release patch
```
- For **minor release**, run the command:

```
grunt bumps --type=minor
npm run release minor
```
- For **major release**, run the command:

```
grunt bumps --type=major
npm run release major
```

## License
Expand Down
6 changes: 3 additions & 3 deletions bower.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,8 @@
"name": "angular-pdf",
"version": "1.5.1",
"description": "An Angularjs directive <ng-pdf> to display PDF in the browser with PDFJS.",
"main": "./dist/angular-pdf.js",
"license": "MIT",
"homepage": "http://github.com/sayanee/angularjs-pdf",
"main": "./dist/angular-pdf.js",
"dependencies": {
"angular": "^1.6.2",
"pdfjs-dist": "1.6.414"
Expand All @@ -19,5 +18,6 @@
"Gruntfile.js",
"example",
"test"
]
],
"license": "MIT"
}
6 changes: 2 additions & 4 deletions example/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,11 @@ <h1>{{pdfName}}</h1>

<a href="https://github.com/sayanee/angularjs-pdf"><img style="position: absolute; top: 0; right: 0; border: 0;" src="https://s3.amazonaws.com/github/ribbons/forkme_right_gray_6d6d6d.png" alt="Fork me on GitHub"></a>

<script src="js/lib/pdf.js"></script>

<script src="js/lib/angular.min.js"></script>

<script src="js/lib/pdf.js"></script>
<script src="angular-pdf.min.js"></script>
<script src="js/app.js"></script>
<script src="js/controllers/docCtrl.js"></script>
<script src="js/directives/angular-pdf.min.js"></script>

</body>
</html>
Loading

0 comments on commit 98cf069

Please sign in to comment.