Skip to content

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

Merged
jeff-phillips-18 merged 6 commits into
patternfly:masterfrom
priley86:monorepo
May 9, 2018
Merged

jeff-phillips-18 merged 6 commits into
patternfly:masterfrom
priley86:monorepo

Conversation

@priley86

@priley86 priley86 commented May 9, 2018 •

Copy link
Copy Markdown
Member

🕺 👯‍♂️ 👯 💃 🕺

affects: @patternfly/react-codemods, @patternfly/react-console, patternfly-react, eslint-plugin-patternfly-react

this change converts pf-react to use lerna/lerna-semantic-release and introduces monorepo folder
structure

What:

  • adopts monorepo structure, similar to the one here
  • moves all src for current patternfly-react into packages/core
  • updates build scripts for building sass/less/js in a monorepo
  • adds @dmiller9911 's * esm modules change to support esm and enable better code splitting downstream
  • moves storybook global imports (defaultTemplate, inlineTemplate, DOCUMENATION_URL etc.) to be shared module imports (absolute) instead of relative
  • moves travis release scripts into .travis and adopts similar scripts to @karelhala's [POC] refactor(monorepo): Monorepo implementation #252
  • adds @dmiller9911 's eslint changes which aggregates all existing lint rules and exposes them as a new eslint-plugin, consumable downstream and in the monorepo. 👏 👏 👏
  • preeminently adds @dmiller9911 's codemod package, @patternfly/react-codemods, to show an example of how we can use codemods for migrating imports downstream. This would work now if we choose to move patternfly-react over to @patternfly/react-core but will live this up to the community...
  • ensures @patternfly/react-console is built with lerna

Some things I am still working on...shouldn't take me long... 🛁

  • updating README/CONTRIBUTING.md
  • adding in any changes that were merged this week. I was working in a sandbox here all week ;)

cc: @jeff-phillips-18 @dmiller9911 @mturley @dgutride @karelhala

Please let me know the final verdict on package namespace names here before we call this one done!

Closes: #201 #218

Link to Storybook:
https://priley86.github.io/patternfly-react

Additional issues:

For anyone interested, I have compiled all of our Lerna/monorepo documentation in this doc and added some additional notes (step for step here).
https://docs.google.com/document/d/1w5_J1OpP4fQGLRP12U7v2DMi-yqBaOvPwrqHuUBI_3I/edit

affects: @patternfly/react-codemods, @patternfly/react-console, patternfly-react,
eslint-plugin-patternfly-react

this change converts pf-react to use lerna/lerna-semantic-release and introduces monorepo folder
structure
@AllenBW

AllenBW commented May 9, 2018 •

Copy link
Copy Markdown
Contributor

revenge of the pr 🍿 👀 👏
things

@coveralls

coveralls commented May 9, 2018 •

Copy link
Copy Markdown

Pull Request Test Coverage Report for Build 1303

  • 11 of 11 (100.0%) changed or added relevant lines in 1 file are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage increased (+0.1%) to 74.377%

Totals Coverage Status
Change from base Build 1293: 0.1%
Covered Lines: 1703
Relevant Lines: 2093

💛 - Coveralls

dmiller9911
dmiller9911 previously approved these changes May 9, 2018

@dmiller9911 dmiller9911 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added some minor nit pick comments.

Comment thread packages/console/package.json Outdated
"build": "node ../../scripts/runScript.js build:console",
"prepublish": "yarn build"
"prebuild": "yarn build:scripts && yarn build:sass && yarn build:less",
"build:scripts": "babel src --out-dir dist/js --ignore .test.js,__mocks__",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this actually is probably not needed since the lerna build command should take care of it.

"prebuild": "yarn build:scripts && yarn build:sass && yarn build:less",
"build:scripts": "babel src --out-dir dist/js --ignore .test.js,__mocks__",
"build:less": "mkdir -p dist/less && cp -r less/* dist/less",
"build:sass": "mkdir -p dist/sass && cp -r sass/* dist/sass && node-sass --output-style compressed --include-path sass --include-path $npm_package_sassIncludes_patternfly --include-path $npm_package_sassIncludes_bootstrap --include-path $npm_package_sassIncludes_fontAwesome -o dist/css sass/console.scss"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These could probably live in the root too. It would be nice to have it build similar to babel if possible.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i agree w/ this, but i'm not quite sure how to accomplish it since we have package specific [file].scss at the end... feel free to give this a go...but i don't think it's really a blocker.

Comment thread packages/core/package.json Outdated
},
"scripts": {
"prebuild": "yarn build:scripts && yarn build:sass && yarn build:less",
"build:scripts": "babel src --out-dir dist/js --ignore .test.js,__mocks__",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is ran in the root.

Comment thread storybook/webpack.config.js Outdated
const ROOT_DIR = '..';
const PCKGS = `${ROOT_DIR}/packages`;

const packages = readdirSync(path.resolve(__dirname, PCKGS))

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this can actually be replaced with lernas package utils

const PackageUtilities = require('lerna/lib/PackageUtilities');
const Repository = require('lerna/lib/Repository');

const packages = PackageUtilities.getPackages(new Repository());

Each "package" includes the properties here: https://github.com/lerna/lerna/blob/master/core/package/index.js#L36

@priley86

priley86 commented May 9, 2018 •

Copy link
Copy Markdown
Member Author
  • made improvements mentioned by @dmiller9911 above
  • added latest pf-react changes/story updates
  • updated some documentation.
  • redeployed storybook

@priley86 priley86 changed the title WIP feat(monorepo): converts patternfly-react to a lerna monorepo feat(monorepo): converts patternfly-react to a lerna monorepo May 9, 2018
dmiller9911
dmiller9911 previously approved these changes May 9, 2018
@priley86
priley86 dismissed stale reviews from jeff-phillips-18 and dmiller9911 via 9c27feb May 9, 2018 19:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants