Skip to content

Commit

Permalink
Merge pull request #501 from MrRio/feature-refactor
Browse files Browse the repository at this point in the history
Tidy up, refactor, add Travis
  • Loading branch information
MrRio committed May 15, 2015
2 parents 53f2f29 + a30a119 commit e0da47f
Show file tree
Hide file tree
Showing 39 changed files with 801 additions and 535 deletions.
2 changes: 1 addition & 1 deletion MIT-LICENSE.txt
@@ -1,4 +1,4 @@
Copyright (c) 2010-2014 James Hall, https://github.com/MrRio/jsPDF
Copyright (c) 2010-2015 James Hall, https://github.com/MrRio/jsPDF

Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
Expand Down
2 changes: 2 additions & 0 deletions Makefile
@@ -1,3 +1,5 @@
all:
npm install
npm install -g uglify-js
bower install
./build.sh
16 changes: 15 additions & 1 deletion README.md
Expand Up @@ -4,7 +4,7 @@

**Generate PDF files in client-side JavaScript.**

You can [catch me on twitter](http://twitter.com/MrRio): [@MrRio](http://twitter.com/MrRio) or head over to [my company's website](http://snapshotmedia.co.uk) for consultancy.
You can [catch me on twitter](http://twitter.com/MrRio): [@MrRio](http://twitter.com/MrRio) or head over to [my company's website](http://parall.ax) for consultancy.

## Creating your first document

Expand All @@ -25,6 +25,20 @@ doc.save('Test.pdf');
git clone --recursive git://github.com/MrRio/jsPDF.git
```

## Building

To build, simply run the 'make' command. This will fetch all npm and bower deps, then compile minified JS files.

## Running locally

Due to certain restrictions that local files have, you'll need to run a web server. Just run:

```
npm start
```

You can then access the site at localhost:8000

## Credits

Big thanks to Daniel Dotsenko from [Willow Systems Corporation](http://willow-systems.com) for making huge contributions to the codebase.
Expand Down
6 changes: 3 additions & 3 deletions bower.json
@@ -1,6 +1,6 @@
{
"name": "jspdf",
"version": "1.1.134",
"version": "1.1.135",
"homepage": "https://github.com/mrrio/jspdf",
"description": "PDF Document creation from JavaScript",
"main": "dist/jspdf.min.js",
Expand All @@ -17,8 +17,8 @@
"libs",
"CNAME",
"jspdf.js",
"jspdf.PLUGINTEMPLATE.js",
"jspdf.plugin.*",
"examples/jspdf.PLUGINTEMPLATE.js",
"plugins/*",
"todo.txt",
"wscript.py",
"build.sh",
Expand Down
28 changes: 28 additions & 0 deletions bower.json.bak
@@ -0,0 +1,28 @@
{
"name": "jspdf",
"version": "1.1.140",
"homepage": "https://github.com/mrrio/jspdf",
"description": "PDF Document creation from JavaScript",
"main": "dist/jspdf.min.js",
"moduleType": [
"amd",
"globals"
],
"keywords": [
"pdf"
],
"license": "MIT",
"ignore": [
"**/.*",
"libs",
"CNAME",
"jspdf.js",
"examples/jspdf.PLUGINTEMPLATE.js",
"plugins/*",
"todo.txt",
"wscript.py",
"build.sh",
"test",
"tools"
]
}
10 changes: 5 additions & 5 deletions build.sh
Expand Up @@ -2,25 +2,25 @@
#
# Build script for jsPDF
# (c) 2014 Diego Casorran
# (c) 2015 James Hall
#

output=dist/jspdf.min.js
options="-m -c --wrap --stats"
version="`python -c 'import time;t=time.gmtime(time.time());print("1.%d.%d" % (t[0] - 2014, t[7]))'`"
libs="`find libs/* -maxdepth 2 -type f | grep .js$ | grep -v -E '(\.min|BlobBuilder\.js$|Downloadify|demo|deps|test)'`"
files="jspdf.js jspdf.plugin*js"
files="jspdf.js plugins/*js"
build=`date +%Y-%m-%dT%H:%M`
commit=`git rev-parse --short=10 HEAD`
whoami=`whoami`

# Update submodules
git submodule foreach git pull origin master

echo ${version}
echo "Building version ${version}"

# Update Bower
#cat ./bower.json \
# | sed "s/\"1\.0\.0\"/\"${version}\"/" >bower.json
sed -i.bak "s/\"version\": \"(.*)\"/\"${version}\"/" bower.json

# Fix conflict with adler32 & FileSaver
adler1="libs/adler32cs.js/adler32cs.js"
Expand Down Expand Up @@ -49,7 +49,7 @@ for fn in ${files} ${libs}; do
| sed -e 'H;${x;s/\s*@preserve/ /g;p;};d' \
| sed -e 's/\s*===\+//' \
| grep -v *global > ${output}.x

if test "x$fn" = "xjspdf.js"; then
cat ${output}.x \
| sed s/\${versionID}/${version}-git\ Built\ on\ ${build}/ \
Expand Down

0 comments on commit e0da47f

Please sign in to comment.