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

added npm scripts to simplify local setup and running dev servers #44

Merged
merged 2 commits into from
May 8, 2020

Conversation

vladlos
Copy link
Contributor

@vladlos vladlos commented May 5, 2020

UI

Provided 2 new npm scripts on top level:
npm run init - will install all node modules and run needed lerna commands for local setup
npm start - will start start watch dev servers for all packages inside one terminal window. no need to cd manually and having multiple terminals.

Checklist

  • I have written or updated test for the changes I made
  • I have updated the README of the package I'm working in to reflect my changes
  • I have added or updated Storybook if appropriate for my changes

Copy link
Collaborator

@laurenbarker laurenbarker left a comment

Choose a reason for hiding this comment

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

Thanks for making all of the commands consistent! Just a few questions about some of the commands.

@@ -3,5 +3,9 @@
"private": true,
"devDependencies": {
"lerna": "^3.20.2"
},
"scripts": {
"init": "yarn && lerna bootstrap --force-local && lerna link",
Copy link
Collaborator

Choose a reason for hiding this comment

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

lerna bootstrap should install dependencies and symlink all of the packages so yarn and lerna link shouldn't be necessary.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Why --force-local? I haven't worked with lerna very much so I'm not sure if this is common but I would think our versions should match when running init.

When passed, this flag causes the bootstrap command to always symlink local dependencies regardless of matching version range.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

first yarn is needed to install top level packages. lerna call will fail without it, except case when you have installed lerna -g.

--force-local is not mandatory but due to ^ version notation in packages we can catch an edge case when newer version of package being published to npm, but not merged in main brunch. or you in the middle of development of some feature and do not want or forget to rebase and need to run init. I am not sure in how realistic this scenarios. With --force-local you avoid that external package being fetched and\or cached somewhere, and you end up with making changes, and do not seeing them while hot-reload.

additional lerna link is also not mandatory but, at least on my machine I encountered cases when I need it additionally after bootstrap. I don't know due to what it happening (npm caches, wrong moon phase?) but adding this as after bootstrap works pretty stable.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Thanks for the explanation! Would you mind adding then instructions to get things started and the explanation of what the commands do to the README?

@@ -13,7 +13,8 @@
"clean": "rm -rf ./dist/*",
"lint": "eslint ./src/**/*.{tsx,ts,js} --format=codeframe",
"test": "jest --watch",
"watch": "webpack"
"watch": "webpack",
Copy link
Collaborator

Choose a reason for hiding this comment

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

I know you didn't add this line but should it be webpack --watch?

Copy link
Collaborator

Choose a reason for hiding this comment

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

Maybe also unify with the icons package and change the name to build:watch since start will simplify it anyway.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

webpack command in ui-components starts webpack dev server. and build:watch seems to actually create dist files on every change. So I would not rename them as this commands already sorta correctly named to be self explanatory.

Copy link
Collaborator

Choose a reason for hiding this comment

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

We don't have webpack-dev-server installed but it looks like watch is set to true in the webpack config https://github.com/cockroachdb/ui/blob/master/packages/ui-components/webpack.config.js#L7

Copy link
Collaborator

Choose a reason for hiding this comment

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

I think removing watch from the config and then updating "watch": "webpack" to be "build:watch": "webpack --watch" would be the most clear here. It's building when files change like the ui-components repo. Does that make sense to you @elkmaster?

Copy link
Collaborator

@laurenbarker laurenbarker left a comment

Choose a reason for hiding this comment

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

Other than the extra file this LGTM! Thanks for updating 💯

@@ -1 +1,2 @@
export { Badge } from "./Badge";
export { Tooltip } from "./Tooltip";
Copy link
Collaborator

Choose a reason for hiding this comment

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

Looks like the tooltip import snuck in here

Copy link
Collaborator

@laurenbarker laurenbarker left a comment

Choose a reason for hiding this comment

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

🎉

@laurenbarker laurenbarker merged commit c600dfb into cockroachdb:master May 8, 2020
@laurenbarker laurenbarker mentioned this pull request May 12, 2020
3 tasks
dhartunian pushed a commit to dhartunian/ui that referenced this pull request Dec 11, 2020
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.

None yet

2 participants