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

feat(monorepo): converts patternfly-react to a lerna monorepo #332

Merged
merged 6 commits into from
May 9, 2018
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
9 changes: 1 addition & 8 deletions .babelrc
Original file line number Diff line number Diff line change
@@ -1,10 +1,3 @@
{
"presets": ["env", "react"],
"plugins": [
"transform-class-properties",
"transform-export-extensions",
"transform-object-rest-spread",
"transform-object-assign"
],
"ignore": ["src/**/__snapshots__", "src/**/*.stories.js", "src/**/Stories"]
"presets": ["./.babelrc.js"]
}
23 changes: 23 additions & 0 deletions .babelrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
const babelENV = process.env.BABEL_ENV || 'development';
const modules = babelENV !== 'production:esm' ? 'commonjs' : false;

module.exports = {
presets: [['env', { modules: modules }], 'react'],
plugins: [
'transform-class-properties',
'transform-export-extensions',
'transform-object-rest-spread',
'transform-object-assign'
],
ignore: (() => {
const ignore = [
'src/**/__snapshots__',
'src/**/*.stories.js',
'src/**/Stories'
];
if (babelENV.includes('production')) {
ignore.push('test.js', '__mocks__');
}
return ignore;
})()
};
2 changes: 2 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
packages/*/node_modules
packages/*/dist
67 changes: 0 additions & 67 deletions .eslintrc

This file was deleted.

31 changes: 31 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
const path = require('path');

module.exports = {
root: true,
extends: ['plugin:patternfly-react/recommended'],
rules: {
'import/first': 'off'
},
overrides: [
{
files: ['**/__mocks__/**', '**/Stories/**', '*.stories.js', '*.test.js'],
rules: {
'import/no-extraneous-dependencies': 'off'
}
}
],
settings: {
'import/resolver': {
webpack: {
config: {
resolve: {
modules: [
path.resolve(__dirname, './'),
path.resolve(__dirname, './node_modules')
]
}
}
}
}
}
};
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ coverage

# package managers
yarn-error.log
lerna-debug.log

# IDEs and editors
/.idea
Expand Down
8 changes: 5 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,16 @@ env:
notifications:
email: false
before_install:
- .travis/before_install.sh
- yarn install
- cd packages/console ; yarn install ; cd -
script:
- yarn test
- yarn coveralls
after_success:
- yarn travis-deploy-once "yarn semantic-release"
- ./release.sh
- .travis/after_success.sh
- .travis/release.sh
git:
depth: 1
branches:
except:
- "/^v\\d+\\.\\d+\\.\\d+$/"
12 changes: 12 additions & 0 deletions .travis/after_success.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/bin/bash
set -e

if [ "$TRAVIS_PULL_REQUEST" != "false" ]; then
echo "We are in a pull request, not releasing"
exit 0
fi

if [ "${TRAVIS_REPO_SLUG}" == "${TRIGGER_REPO_SLUG}" -a "$TRAVIS_BRANCH" == "${TRIGGER_REPO_BRANCH}" ]; then
# note: yarn travis-deploy-once "yarn semantic-release" currently breaks NPM_TOKEN auth context
npm run travis-deploy-once "npm run semantic-release"
fi
37 changes: 37 additions & 0 deletions .travis/before_install.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
#!/bin/bash
set -e
# Note: do not do set -x or the passwords will leak!

if [ "$TRAVIS_PULL_REQUEST" != "false" ]; then
echo "We are in a pull request, not setting up release"
exit 0
fi

if [ "${TRAVIS_REPO_SLUG}" == "${TRIGGER_REPO_SLUG}" -a "$TRAVIS_BRANCH" == "${TRIGGER_REPO_BRANCH}" ]; then
rm -rf .git
git init
git clean -dfx
git remote add origin https://github.com/$TRAVIS_REPO_SLUG.git
git fetch origin
git clone https://github.com/$TRAVIS_REPO_SLUG.git $TRAVIS_REPO_SLUG
git checkout $TRAVIS_BRANCH

git config credential.helper store
echo "https://${GH_USERNAME}:${GH_TOKEN}@github.com/${TRAVIS_REPO_SLUG}.git" > ~/.git-credentials

npm config set "//registry.npmjs.org/:_authToken=${NPM_TOKEN}" -q
echo "//registry.npmjs.org/:_authToken=${NPM_TOKEN}" > ~/.npmrc
npm prune

git config --global user.email ${COMMIT_AUTHOR_EMAIL}
git config --global user.name ${COMMIT_AUTHOR_USERNAME}
git config --global push.default simple

git fetch --tags
git branch -u origin/$TRAVIS_BRANCH
git fsck --full #debug
echo "npm whoami"
npm whoami #debug
echo "git config --list"
git config --list #debug
fi
42 changes: 42 additions & 0 deletions .travis/release.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
#!/usr/bin/env bash

RED='\033[0;31m'
NC='\033[0m' # No Color
SSH_REPO="[email protected]:${TRIGGER_REPO_SLUG}"

getDeployKey () {
if [ "${TRAVIS_PULL_REQUEST}" != "false" ]; then
echo -e "${RED}The travis ecrypted key var is not available to builds triggered by pull requests. Aborting.${NC}"
exit 0
fi
# Get the deploy key by using Travis's stored variables to decrypt deploy_key.enc
ENCRYPTED_KEY_VAR="encrypted_${ENCRYPTION_LABEL}_key"
ENCRYPTED_IV_VAR="encrypted_${ENCRYPTION_LABEL}_iv"
echo "Checking Travis ENV VAR: ${ENCRYPTED_KEY_VAR}..."
ENCRYPTED_KEY=${!ENCRYPTED_KEY_VAR}
echo "Checking Travis ENV VAR: ${ENCRYPTED_IV_VAR}..."
ENCRYPTED_IV=${!ENCRYPTED_IV_VAR}
echo "Run Openssl"
openssl aes-256-cbc -K $ENCRYPTED_KEY -iv $ENCRYPTED_IV -in deploy_key.enc -out deploy_key -d
echo "Run chmod"
chmod 600 deploy_key
eval `ssh-agent -s`
ssh-add deploy_key
}

if [ "${TRAVIS_REPO_SLUG}" != "${TRIGGER_REPO_SLUG}" -o "${TRAVIS_BRANCH}" != "${TRIGGER_REPO_BRANCH}" ]; then
echo -e "${RED}Exiting, this is not a production release.${NC}"
exit 0;
fi

getDeployKey
yarn storybook:build
cd .out
git config --global user.email $COMMIT_AUTHOR_EMAIL
git config --global user.name $COMMIT_AUTHOR_USERNAME
git init
git add .
git commit -m "Deploy Storybook to GitHub Pages"

git remote add ssh-origin $SSH_REPO
git push --force --quiet ssh-origin master:gh-pages
Loading