Skip to content

Commit 446add4

Browse files
committed
Fix: Deploy as ES5
1 parent d83bdc9 commit 446add4

File tree

3 files changed

+31
-1
lines changed

3 files changed

+31
-1
lines changed

package.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "emailjs-addressparser",
3-
"version": "2.0.0",
3+
"version": "2.0.1",
44
"homepage": "https://github.com/emailjs/emailjs-addressparser",
55
"description": "Parse rfc2822 address fields",
66
"author": "Andris Reinman <andris@kreata.ee>",
@@ -13,6 +13,8 @@
1313
],
1414
"license": "MIT",
1515
"scripts": {
16+
"build": "./scripts/build.sh",
17+
"release": "./scripts/release.sh",
1618
"lint": "$(npm bin)/standard",
1719
"test": "npm run lint && npm run unit",
1820
"unit": "$(npm bin)/mocha './src/*-unit.js' --reporter spec --require babel-register testutils.js",
@@ -24,6 +26,7 @@
2426
},
2527
"main": "./src/addressparser",
2628
"devDependencies": {
29+
"babel-cli": "^6.26.0",
2730
"babel-preset-es2015": "^6.24.1",
2831
"babel-register": "^6.26.0",
2932
"chai": "^4.1.2",

scripts/build.sh

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#!/bin/bash
2+
3+
rm -rf $PWD/dist
4+
babel src --out-dir dist --ignore '**/*-unit.js' --source-maps inline
5+
git reset
6+
git add $PWD/dist
7+
git commit -m 'Updating dist files' -n

scripts/release.sh

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
#!/bin/bash
2+
3+
json_value() {
4+
KEY=$1
5+
num=$2
6+
awk -F"[,:}]" '{for(i=1;i<=NF;i++){if($i~/'$KEY'\042/){print $(i+1)}}}' | tr -d '"' | sed -n ${num}p
7+
}
8+
9+
# read version from package.json and trim leading/trailing whitespace
10+
version=`less package.json | json_value version 1 | sed -e 's/^ *//' -e 's/ *$//'`
11+
prefix="v"
12+
# tag, push, publish
13+
echo -e "\n> tagging $prefix$version"
14+
git tag "$prefix$version"
15+
echo -e "\n> pushing commits to origin"
16+
git push
17+
echo -e "\n> pushing tags to origin"
18+
git push --tags
19+
echo -e "\n> publishing on npm"
20+
npm publish

0 commit comments

Comments
 (0)