Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Es6 #163

Closed
wants to merge 5 commits into from
Closed

Es6 #163

wants to merge 5 commits into from

Conversation

simobasso
Copy link
Collaborator

move whole package to es6

@codecov-io
Copy link

codecov-io commented Jan 2, 2017

Current coverage is 69.46% (diff: 69.46%)

No coverage report found for master at eda56e0.

Powered by Codecov. Last update eda56e0...ecdd2b2

presets: [
"latest",
],
"plugins": [ "istanbul" ]
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please don't use double quotes in property name

},
emitError: false,
failOnError: false,
"rules": {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please remove this rule

ecmaVersion: 6,
sourceType: "module"
},
emitError: false,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please set true on emitError and failOnError

},
jscs: {
validateIndentation: 2,
emitErrors: false,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please set true on emitError and failOnHint

let scale = attrs.scale > 0 ? attrs.scale : 1;
let canvasid = attrs.canvasid || 'pdf-canvas';
let canvas = $document[0].getElementById(canvasid);
var creds = attrs.usecredentials;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we use let also for creds, ctx and windowEl?

},
"keywords": [
"pdf",
"angular",
"directive"
],
"license": "MIT",
"dependencies": {
Copy link
Collaborator

@dennybiasiolli dennybiasiolli Jan 4, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please use peerDependencies instead of dependencies

node <= 0.xx doesn't support es6 syntax

ref: http://node.green/
In order to use es6 in the package we need a module bundler (webpack)
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 webpack
- 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: sayanee#90
Generate code coverage using Istanbul
@dennybiasiolli
Copy link
Collaborator

@simobasso can we also have an angular-pdf.js file in dist folder after building with webpack, like in the current master?

@rhyskoedijk
Copy link

Could I make a small suggestion since you are already writing this.
Consider exposing the PDF.js _pdfDoc in the onLoad callback, which would allow end-users to provide their own hooks in to the document. I wanted to explore the adding "find text" functionality to my viewer but as Angular-PDF keeps the document internal, it is impossible to extend currently.

if (angular.isFunction(scope.onLoad)) {
scope.onLoad(_pdfDoc);
}

Maybe also a new callback at the start of the renderPage function to allow end-users to perform their own extra logic/rendering too?

@rhyskoedijk
Copy link

Can I fork simobasso:es6 and submit my own pull requests for this new version, or is that just making things overly complicated? I am interested in:

  • Switching the canvasId to a canvasClassName. Class lookup rather than id looking works better when using multiple instances on the same page since you cannot generated unique canvas ids using angular bindings since the link function runs before any bindings in the template are resolved.
  • Exposing pdfDoc in the onLoad callback as an extension point for end-users
  • Exposing an onRender callback as an extension point for end-users

An issue I had around the pdfTask being cancelled when using multiple instances seems to be resolved in this version already as you have re-scoped the variables within the directive.

@dennybiasiolli
Copy link
Collaborator

Thanks for the feedback @rhyskoedijk, this speeds up our testing-before-merging process 😉

Our roadmap on the project is the following:

  • merge this PR in order to provide a better structured project

  • improve the project with the new features suggested

Starting from tomorrow we will fix conflicts in this PR in order to merge as soon as possible, so you can fork the master branch directly.
Your suggestions are great, after PR's merge we will glad to focus our attention to them and if you would like to contribute with PRs we can improve this directive together 😄

Thanks for your help

@dennybiasiolli dennybiasiolli mentioned this pull request Apr 11, 2017
publicPath: isProd ? '/' : 'http://localhost:8080/',
filename: "angular-pdf.min.js",
library: "pdf",
libraryTarger: "umd",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@simobasso I think this property is libraryTarget instead of libraryTarger

package.json Outdated
"build": "grunt",
"start": "http-server ./example -p 8081",
"test": "grunt --verbose"
"build": "rimraf dist && webpack --progress --profile",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@simobasso can we install rimraf as devDependency?

@dennybiasiolli
Copy link
Collaborator

@simobasso what do you think about this branch?
It resolves conflicts, fixes sintax errors and provide both standard and minimized output.

@rhyskoedijk
Copy link

just merge it ;)

@dennybiasiolli dennybiasiolli mentioned this pull request Apr 18, 2017
Merged
@simobasso
Copy link
Collaborator Author

close in favor of #184

@simobasso simobasso closed this Apr 18, 2017
@simobasso simobasso deleted the es6 branch April 18, 2017 12:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants