Skip to content

Commit

Permalink
Merge pull request #8 from idanwe/master
Browse files Browse the repository at this point in the history
Add bower bundled version
  • Loading branch information
okland committed Sep 22, 2015
2 parents de6b088 + dd3bdb2 commit 86dd7f3
Show file tree
Hide file tree
Showing 6 changed files with 1,973 additions and 1 deletion.
3 changes: 2 additions & 1 deletion .gitignore
@@ -1 +1,2 @@
.npm
.npm
node_modules
12 changes: 12 additions & 0 deletions README.md
Expand Up @@ -14,6 +14,18 @@ $ meteor add okland:accounts-phone
```


Via Bower:
```
$ bower install accounts-phone
```

Add to your index.html

```
<script src="bower_components/accounts-base-client-side/dist/accounts-base-client-side.bundle.min.js"></script>
<script src="bower_components/accounts-phone/dist/accounts-phone.bundle.min.js"></script>
```

## Examples

Let's say you want to register new user and verify him using his phone number
Expand Down
28 changes: 28 additions & 0 deletions bower.json
@@ -0,0 +1,28 @@
{
"name": "accounts-phone",
"version": "0.0.21",
"main": "./dist/accounts-phone.bundle.min.js",
"dependencies": {
"meteor-client-side": "~0.2.3",
"accounts-base-client-side": "~0.1.1"
},
"homepage": "https://github.com/okland/accounts-phone",
"description": "A login service based on mobile phone number, For Meteor.",
"keywords": [
"meteor",
"ddp",
"client",
"side",
"sms",
"accounts",
"phone"
],
"license": "MIT",
"ignore": [
"**/.*",
"node_modules",
"bower_components",
"test",
"tests"
]
}
55 changes: 55 additions & 0 deletions bundle-min.sh
@@ -0,0 +1,55 @@
# Run this script from home folder

# configs variables
NAME=accounts-phone # Set the bundle file name
PACKAGE=okland:accounts-phone
DIST_FOLDER=dist # The folder that the bundled files will be copy in to

# run time variables
PROJECT_ROOT=$(pwd)
PROJECT_PARENT=$PROJECT_ROOT/..
DIST_PATH=$PROJECT_ROOT/$DIST_FOLDER
BUNDLER_TEMP="tmp-$NAME-bundler"
BUNDLER_PATH=$DIST_PATH/$BUNDLER_TEMP


# Ansure that the dist folder exists
mkdir -p $DIST_PATH

# Create temp meteor project
rm -rf $BUNDLER_PATH
meteor create $BUNDLER_PATH
cd $BUNDLER_PATH


# Add packages
echo > .meteor/packages # Delete all default packages
PACKAGE_DIRS=$PARENT meteor add $PACKAGE


# Build the packages
PACKAGE_DIRS=$PROJECT_PARENT meteor build --debug .
tar -zxf $BUNDLER_TEMP.tar.gz

OUTPUT_PATH="$DIST_PATH/$NAME-bundler-output"
PACKAGES_PATH="$DIST_PATH/$BUNDLER_TEMP/bundle/programs/web.browser/packages"

# Create output folder and copy the dependencies files
rm -rf $OUTPUT_PATH
mkdir $OUTPUT_PATH

# Concat files
cat "$PACKAGES_PATH/sha.js" >> $OUTPUT_PATH/$NAME.bundle.js
cat "$PACKAGES_PATH/srp.js" >> $OUTPUT_PATH/$NAME.bundle.js
cat "$PACKAGES_PATH/okland_accounts-phone.js" >> $OUTPUT_PATH/$NAME.bundle.js
cat "$PACKAGES_PATH/global-imports.js" >> $OUTPUT_PATH/$NAME.bundle.js

# Minify
npm install uglify-js
./node_modules/.bin/uglifyjs $OUTPUT_PATH/$NAME.bundle.js -o $OUTPUT_PATH/$NAME.bundle.min.js

# Copy the bundled files to the dist folder
cp $OUTPUT_PATH/$NAME.bundle.* $DIST_PATH

# Cleanup
rm -rf $BUNDLER_PATH $OUTPUT_PATH

0 comments on commit 86dd7f3

Please sign in to comment.