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

Update: dependencies #177

Merged
merged 4 commits into from
Apr 24, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
107 changes: 107 additions & 0 deletions build/upgrade_brui.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
#!/bin/bash

export NODE_PATH=$NODE_PATH:./node_modules

update_version() {
CURRENT_VERSION="$(cat package.json | grep \"box-react-ui\"\: -m 1 | sed 's/.*\^\(.*\)\".*/\1/')";
LATEST_VERSION="$(npm show box-react-ui version)";

# Upgrade peer dependency
yarn add box-react-ui@^$LATEST_VERSION --peer

# Upgrade dev dependency
yarn add box-react-ui@^$LATEST_VERSION --dev

UPDATED_VERSION="$(cat package.json | grep box-react-ui | sed 's/.*\^\(.*\)\".*/\1/')";

if [ $UPDATED_VERSION == $LATEST_VERSION ]; then
echo "----------------------------------------------------------------------"
echo "Successfully upgraded from $CURRENT_VERSION to $UPDATED_VERSION"
echo "----------------------------------------------------------------------"
else
echo "----------------------------------------------------------------------"
echo "Error: Failed to upgrade to $CURRENT_VERSION"
echo "----------------------------------------------------------------------"
fi
}


push_to_github() {
# Add new files
git add . && git commit -m "Update: box-react-ui to v$LATEST_VERSION" -m

# Push commit to GitHub
if git push origin -f --no-verify; then
echo "----------------------------------------------------------------------"
echo "Pushed commit to git successfully"
echo "----------------------------------------------------------------------"
else
echo "----------------------------------------------------------------------"
echo "Error while pushing commit to git"
echo "----------------------------------------------------------------------"
return 1
fi
}


reset_to_master() {
# Add the upstream remote if it is not present
if ! git remote get-url release; then
git remote add release [email protected]:box/box-annotations.git || return 1
fi

# Fetch latest code
git fetch release || return 1;
git checkout master || return 1

# The master branch should not have any commits
if [[ $(git log --oneline ...release/master) != "" ]] ; then
echo "----------------------------------------------------"
echo "Your branch has unmerged commits!"
echo "----------------------------------------------------"
exit 1
fi

# Reset to latest code and clear unstashed changes
git reset --hard release/master || return 1
}


upgrade_brui() {
if [[ $(git diff --shortstat 2> /dev/null | tail -n1) != "" ]] ; then
echo "----------------------------------------------------"
echo "Your branch is dirty!"
echo "----------------------------------------------------"
exit 1
fi

# Get latest commited code and tags
reset_to_master || return 1

# Bump the version number
update_version || return 1

# Push to GitHub
push_to_github || return 1

return 0
}

# Execute this entire script
if ! upgrade_brui; then
echo "----------------------------------------------------------------------"
echo "Error while upgrading box-react-ui to latest version!"
echo "----------------------------------------------------------------------"

# Reset to upstream/master for major/minor releases
elif ! reset_to_master; then
echo "----------------------------------------------------------------------"
echo "Error while cleaning workspace!"
echo "----------------------------------------------------------------------"
else
echo "----------------------------------------------------------------------"
echo "Workspace succesfully cleaned!"
echo "----------------------------------------------------------------------"
fi;
exit 1
fi
37 changes: 20 additions & 17 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,16 @@
"publishConfig": {
"registry": "https://registry.npmjs.org/"
},
"peerDependencies": {
"box-react-ui": "^22.7.1"
},
"devDependencies": {
"autoprefixer": "^8.0.0",
"autoprefixer": "^8.3.0",
"babel-cli": "^6.26.0",
"babel-core": "^6.26.0",
"babel-eslint": "^8.0.3",
"babel-eslint": "^8.2.3",
"babel-loader": "^7.1.2",
"babel-plugin-istanbul": "^4.1.5",
"babel-plugin-istanbul": "^4.1.6",
"babel-plugin-transform-class-properties": "^6.24.1",
"babel-plugin-transform-decorators-legacy": "^1.3.4",
"babel-plugin-transform-object-rest-spread": "^6.26.0",
Expand All @@ -30,18 +33,17 @@
"chai": "^4.1.2",
"chai-dom": "^1.6.0",
"codeceptjs-webdriverio": "^1.1.0",
"commitlint": "^5.2.0",
"conventional-changelog-cli": "^1.3.5",
"commitlint": "^6.1.3",
"conventional-changelog-cli": "^1.3.22",
"conventional-github-releaser": "^2.0.0",
"cpx": "^1.5.0",
"css-loader": "^0.28.7",
"cssnano-cli": "^1.0.5",
"eslint": "^4.12.1",
"eslint-config-airbnb": "^16.1.0",
"eslint-config-prettier": "^2.9.0",
"eslint-import-resolver-webpack": "^0.8.3",
"eslint-plugin-babel": "^4.1.2",
"eslint-plugin-import": "^2.8.0",
"eslint-plugin-babel": "^5.0.0",
"eslint-plugin-import": "^2.11.0",
"eslint-plugin-jsx-a11y": "^6.0.2",
"eslint-plugin-react": "^7.5.1",
"extract-text-webpack-plugin": "^3.0.2",
Expand All @@ -64,27 +66,27 @@
"karma-sinon-stub-promise": "^1.0.0",
"karma-sourcemap-loader": "^0.3.7",
"karma-webpack": "^2.0.6",
"lint-staged": "^7.0.0",
"mocha": "^5.0.1",
"lint-staged": "^7.0.4",
"mocha": "^5.1.1",
"node-noop": "^1.0.0",
"node-sass": "^4.7.2",
"nsp": "^3.2.1",
"optimize-css-assets-webpack-plugin": "^3.2.0",
"postcss-loader": "^2.0.9",
"prettier": "^1.8.2",
"postcss-loader": "^2.1.4",
"prettier": "^1.12.1",
"prettier-eslint-cli": "^4.4.2",
"rangy": "^1.3.0",
"raw-loader": "^0.5.1",
"rbush": "^2.0.1",
"sass-loader": "^6.0.6",
"sass-loader": "^7.0.1",
"sinon": "^4.1.2",
"sinon-chai": "^2.14.0",
"sinon-chai": "^3.0.0",
"sinon-stub-promise": "^4.0.0",
"style-loader": "^0.20.2",
"style-loader": "^0.21.0",
"stylelint": "^9.1.1",
"stylelint-config-standard": "^18.0.0",
"stylelint-order": "^0.8.1",
"stylelint-scss": "^2.2.0",
"stylelint-scss": "^3.0.1",
"webpack": "^3.10.0",
"webpack-bundle-analyzer": "^2.9.1",
"whatwg-fetch": "^2.0.3"
Expand All @@ -110,7 +112,8 @@
"minor": "./build/release.sh -n && ./build/publish.sh",
"major": "./build/release.sh -m && ./build/publish.sh",
"patch": "./build/release.sh -p && ./build/publish.sh",
"nsp": "nsp check --reporter summary"
"nsp": "nsp check --reporter summary",
"upgrade-brui": "./build/upgrade_brui.sh"
},
"lint-staged": {
"src/**/*.js": [
Expand Down
Loading