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

🔧 lerna #82

Merged
merged 12 commits into from
Nov 7, 2017
Merged

🔧 lerna #82

merged 12 commits into from
Nov 7, 2017

Conversation

frinyvonnick
Copy link
Collaborator

Fix #81

Lerna have an dependencies hoisting feature that prevent downloading multiple times a package by moving node_modules at root top level of your monorepo. The problem is react-highlight doesn't support react 16 so it use an older version of react that get into conflict with hoc-react-loader react version so tests fail. There is a pull request waiting to be merged that brings support for react 16 in react-highlight.

@fabienjuif we have two possibilities:

  • We wait for the PR to be merged
  • We rewrite examples site from scratch

@fabienjuif
Copy link
Member

I prefer the rewrite way.

package.json Outdated
]
}
"private": true,
"workspaces": [
Copy link
Member

Choose a reason for hiding this comment

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

We both need it in package.json AND in lerna.json ?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This isn't for the same thing. workspaces is a config for yarn not lerna.

Copy link
Member

Choose a reason for hiding this comment

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

Yeah I can see that, but I think this is sad that lerna doesn't look for workspaces field when it set to "useWorkspaces": true for instance.

Is there a way to set lerna config into the package.json ?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

They don't mention it in documentation

@@ -48,7 +48,7 @@
"webpack-dev-server": "~1.12.1"
},
"dependencies": {
"hoc-react-loader": "file:../",
"hoc-react-loader": "~6.1.1",
Copy link
Member

Choose a reason for hiding this comment

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

Here, will lerna detect that hoc-react-loader is in a relative package and do the link on its own ?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Sure

Copy link
Member

Choose a reason for hiding this comment

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

And what if I upgrade the hoc-react-loader package to 7.0.0 without publishing it ?
What will do lerna ? Still doing a link, or download hoc-react-loader from NPM registry ?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

There is an option to force local linking regardless of package version. I guess without this option it will download it from NPM registry.

"test": "jest --collectCoverageFrom=src/**/*.js --collectCoverageFrom=src/**/*.jsx",
"coveralls": "jest --coverage && cat ./coverage/lcov.info | coveralls",
"ci": "npm-run-all --parallel lint coveralls"

Copy link
Member

Choose a reason for hiding this comment

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

empty line :p

"import/prefer-default-export": 0,
"import/no-unresolved": 0,
"react/forbid-prop-types": 0,
"import/no-extraneous-dependencies": ["error", {"devDependencies": ["**/*.spec.js"]}]
Copy link
Member

Choose a reason for hiding this comment

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

Nice I didn't know about the exclusion :)

@fabienjuif fabienjuif changed the base branch from master to refactoring-protected November 3, 2017 08:45
@fabienjuif fabienjuif changed the title Tech/lerna 🔧 lerna Nov 3, 2017
@fabienjuif
Copy link
Member

@frinyvonnick I change the base of the PR (see #83) and the title (so this PR can be squashed when it's ready to be)

@fabienjuif
Copy link
Member

As you see on the circle-ci, now on all my project I add a ci script.
So I don't have to maintain a circleci file, or a jenkins one, or ...
I just have to maintain my package.json :)

So we should let the ci script, and use npm-run-all to run subscripts (lint / test) from root and then let lerna doing its job.

@frinyvonnick
Copy link
Collaborator Author

frinyvonnick commented Nov 3, 2017

Sure i didn't finished the lerna part. I didn't handle publish either.

@@ -11,6 +12,7 @@
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test --env=jsdom",
"eject": "react-scripts eject"
"eject": "react-scripts eject",
"ci": "npm-run-all --parallel test"
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I wait for this PR to be merged to add linting to ci script.

@coveralls
Copy link

Coverage Status

Coverage remained the same at 98.462% when pulling 5aac199 on tech/lerna into bfab580 on refactoring-protected.

package.json Outdated
"./misc/testSetup.js"
]
}
"private": true,
Copy link
Member

@fabienjuif fabienjuif Nov 7, 2017

Choose a reason for hiding this comment

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

Why do you use tab in this one ?
Maybe you should run a yarn add some-dep && yarn remove some-dep to reindent it better. :p

package.json Outdated
"packages/*"
],
"scripts": {
"start": "lerna run start --stream --ignore hoc-react-loader",
Copy link
Member

Choose a reason for hiding this comment

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

Why don't you use scope instead of ignore ?

Copy link
Member

@fabienjuif fabienjuif left a comment

Choose a reason for hiding this comment

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

  • For me exemple folder should be simple (and empty), we will init react (or other) in an other PR. You just have to init a package.json with scripts that do echos (to validate lerna)
  • README.md should stay in the root directory
  • LICENSE should stay in the root directory
  • root package.json should have a name ? (dunno)
  • root package.json should have a description ? (dunno)
  • root package.json should have contributors (dunno ?)
  • etc

@frinyvonnick
Copy link
Collaborator Author

frinyvonnick commented Nov 7, 2017

@fabienjuif no the root package.json is private. It handle only technical issues. Maybe we should inspire ourselves from package.json like babel's one.

@frinyvonnick frinyvonnick dismissed fabienjuif’s stale review November 7, 2017 13:32

Done, i mentioned the remaining work in meta issue

Copy link
Member

@fabienjuif fabienjuif left a comment

Choose a reason for hiding this comment

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

nice work 👌

@frinyvonnick frinyvonnick merged commit 958b1ec into refactoring-protected Nov 7, 2017
@frinyvonnick frinyvonnick deleted the tech/lerna branch November 7, 2017 14:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

3 participants