Thank you for your interest in contributing to search-ui!
How to build and contribute to Search UI.
- Node: 10.16
- NPM: 6.9
- OS: Unix/Linux or Windows Subsystem for Linux
This repository is maintained as a Monorepo using Lerna.
Lerna configuration is contained in lerna.json.
/packages- Contains publishable search-ui npm packages./examples- Contains non-publishable examples of search-ui usage. They are declared as "packages" inlerna.jsonso thatnpx lerna bootstrapwill automatically wire up the examples to local dependencies.
Because all examples are declared as "private", when running lerna commands other than bootstrap, (like publish and test), the --no-private flag should be appended.
Dependencies are declared in a package.json hierarchy.
/package.json- Dependencies for repo tooling, likehuskyandlerna./packages/package.json- Common dev dependencies for all Search UI npm packages. Any dev Common dev dependencies for al that does not need to be called directly in a package level npm command can be declared here.- /
packages/{package_name}/package.json- Package specific dependencies.
Note that we do not encourage "hoisting" dependencies through lerna. This WILL cause the examples applications to error out from dependency version conflicts.
From the root level of this repository:
npm installBehind the scenes, this installs dependencies in the root folder, in the packages folder, and for each lerna package and example repo.
For all projects, run from project root. For single project, run from package root.
# Build
npm run build
# Watch for changes and re-build
npm run watchFor all projects, run from project root. For single project, run from package root.
All packages:
# from project root
npm run test
# Watch for changes and re-run
npm run test -- --watchThe sandbox app can be used as a local development aid.
Our master branch holds the latest development code for the next release. If the next release will be a minor release, the expecation is that no breaking changes will be in master. If a change would be breaking, we need to put it behind a feature flag, or make it an opt-in change. We will only merge breaking PRs when we are ready to start working on the next major.
All PRs should be created from a fork, to keep a clean set of branches on origin.
Releases should be performed directly in master (or a minor branch for patches), following the Publishing guide below.
We use a stable branch to indicate the latest release code.
We will create branches for all minor releases.
Publish a new version from master (Example, publishing 0.6.0)
- Run
npx lerna version 0.6.0 --force-publish=* --exact. - Verify the
0.6.0tag was created as well as a "Release 0.6.0" commit. - Run
nvm useto make sure you are running the correct version of node, and verify thatnpm run buildruns without error before publishing. - Run
npx lerna publish --force-publish=* from-package. - Verify the
0.6.0has been published to npm. - Verify that the
0.6.0tag and commit has been pushed tomasteronorigin. - Create new version branch,
0.6from the0.6.0tag and push toorigin. - Update the
stablebranch to this versiongit checkout stable && git merge --ff-only master && git push origin. - Create a release in Github.
- Close the release Milestone in Github.
Publish a patch (Example, publish 0.6.1)
- Create a
0.6branch from the0.6.0tag, if one does not already exist. - Run
npx lerna version 0.6.0 --force-publish=* --exact. - Verify the
0.6.1tag was created as well as a "Release 0.6.1" commit. - Run
nvm useto make sure you are running the correct version of node, and verify thatnpm run buildruns without error before publishing. - Run
npx lerna publish --force-publish=* from-package. - Verify the
0.6.1has been published to npm. - Verify that the
0.6.1tag and commit has been pushed tomasteronorigin. - Cherry-pick the changes forward to subsequent minor releases and master, and repeat the process.
- Create a release in Github.
- Close the release Milestone in Github.
It can often be useful to publish a change and test it before doing a real live publish. For instance, it can be useful to publish something from a PR branch and test it with an actual install. Use lerna's canary option for this.
-
Check out pr branch
-
npx lerna publish --force-publish=* --canary --preid canary [patch|minor|major]- Publishing with canary generates a unique new version number, publishes it to npm, then updates thecanarytag in npm to point to that new version. -
In project you'll need to install all dependencies explicitly with the canary tag from npm:
npm install --save @elastic/react-search-ui@canary @elastic/search-ui-app-search-connector@canary @elastic/react-search-ui-views@canary search-ui-views@canary -
To Deploy, simply push your changes to the
canarybranch, then visit "https://search-ui-canary.netlify.com/"
When pushing release candidates, the following lerna commands can be useful:
# Create a pre-release version, like 1.0.0-rc.0
npx lerna version prerelease --exact --preid rc
# Publish 1.0.0-rc.0 and update the `next` to point to this version
npx lerna publish from-package --force-publish=* --dist-tag next
We have a number of demos available that you can use to do quick smoke testing of releases in various stacks:
- https://codesandbox.io/s/search-ui-gatsby-example-u041m
- https://codesandbox.io/s/search-ui-next-js-example-tb05u
- https://codesandbox.io/s/search-ui-national-parks-example-kdyms
- Elastic App Search: https://search-ui-stable.netlify.com/
- Elastic Site Search: https://search-ui-stable-site-search.netlify.com/
- Elasticsearch: https://search-ui-stable-elasticsearch.netlify.com/