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

Conversation

priley86
Copy link
Member

@priley86 priley86 commented May 9, 2018

πŸ•Ί πŸ‘―β€β™‚οΈ πŸ‘― πŸ’ƒ πŸ•Ί

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
Copy link
Contributor

AllenBW commented May 9, 2018

revenge of the pr 🍿 πŸ‘€ πŸ‘
things

@coveralls
Copy link

coveralls commented May 9, 2018

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
Copy link
Contributor

@dmiller9911 dmiller9911 left a comment

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.

"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
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
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
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.

},
"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
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.

const ROOT_DIR = '..';
const PCKGS = `${ROOT_DIR}/packages`;

const packages = readdirSync(path.resolve(__dirname, PCKGS))
Copy link
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
Copy link
Member Author

priley86 commented May 9, 2018

  • 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