Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 15 additions & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,20 @@ $ yarn lint:fix
$ yarn build
```

### Playgrounds

To test directly your changes in `instant-meilisearch`, you can run the Vue playground:

```bash
$ yarn playground:vue
```

Or the React playground:

```bash
$ yarn playground:react
```

### Release Process

MeiliSearch tools follow the [Semantic Versioning Convention](https://semver.org/).
Expand All @@ -75,7 +89,7 @@ About this automation:
Make a PR modifying the file [`package.json`](/package.json) with the right version.

```javascript
"version": X.X.X
"version": "X.X.X"
```

Once the changes are merged on `master`, you can publish the current draft release via the [GitHub interface](https://github.com/meilisearch/instant-meilisearch/releases).
Expand Down
4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@
"test": "jest",
"lint": "eslint --ext .js,.ts,.tsx .",
"lint:fix": "eslint --ext .js,.ts,.tsx --fix .",
"build": "rollup -c rollup.config.js && rollup --environment NODE_ENV:production -c rollup.config.js "
"build": "rollup -c rollup.config.js && rollup --environment NODE_ENV:production -c rollup.config.js ",
"playground:vue": "yarn --cwd ./playgrounds/vue && yarn --cwd ./playgrounds/vue serve",
"playground:react": "yarn --cwd ./playgrounds/react && yarn --cwd ./playgrounds/react start"
},
"main": "./dist/instant-meilisearch.umd.js",
"module": "./dist/instant-meilisearch.esm.js",
Expand Down
1 change: 1 addition & 0 deletions playgrounds/react/.env
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
SKIP_PREFLIGHT_CHECK=true
23 changes: 23 additions & 0 deletions playgrounds/react/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.

# dependencies
/node_modules
/.pnp
.pnp.js

# testing
/coverage

# production
/build

# misc
.DS_Store
.env.local
.env.development.local
.env.test.local
.env.production.local

npm-debug.log*
yarn-debug.log*
yarn-error.log*
68 changes: 68 additions & 0 deletions playgrounds/react/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app).

## Available Scripts

In the project directory, you can run:

### `yarn start`

Runs the app in the development mode.<br />
Open [http://localhost:3000](http://localhost:3000) to view it in the browser.

The page will reload if you make edits.<br />
You will also see any lint errors in the console.

### `yarn test`

Launches the test runner in the interactive watch mode.<br />
See the section about [running tests](https://facebook.github.io/create-react-app/docs/running-tests) for more information.

### `yarn build`

Builds the app for production to the `build` folder.<br />
It correctly bundles React in production mode and optimizes the build for the best performance.

The build is minified and the filenames include the hashes.<br />
Your app is ready to be deployed!

See the section about [deployment](https://facebook.github.io/create-react-app/docs/deployment) for more information.

### `yarn eject`

**Note: this is a one-way operation. Once you `eject`, you can’t go back!**

If you aren’t satisfied with the build tool and configuration choices, you can `eject` at any time. This command will remove the single build dependency from your project.

Instead, it will copy all the configuration files and the transitive dependencies (webpack, Babel, ESLint, etc) right into your project so you have full control over them. All of the commands except `eject` will still work, but they will point to the copied scripts so you can tweak them. At this point you’re on your own.

You don’t have to ever use `eject`. The curated feature set is suitable for small and middle deployments, and you shouldn’t feel obligated to use this feature. However we understand that this tool wouldn’t be useful if you couldn’t customize it when you are ready for it.

## Learn More

You can learn more in the [Create React App documentation](https://facebook.github.io/create-react-app/docs/getting-started).

To learn React, check out the [React documentation](https://reactjs.org/).

### Code Splitting

This section has moved here: https://facebook.github.io/create-react-app/docs/code-splitting

### Analyzing the Bundle Size

This section has moved here: https://facebook.github.io/create-react-app/docs/analyzing-the-bundle-size

### Making a Progressive Web App

This section has moved here: https://facebook.github.io/create-react-app/docs/making-a-progressive-web-app

### Advanced Configuration

This section has moved here: https://facebook.github.io/create-react-app/docs/advanced-configuration

### Deployment

This section has moved here: https://facebook.github.io/create-react-app/docs/deployment

### `yarn build` fails to minify

This section has moved here: https://facebook.github.io/create-react-app/docs/troubleshooting#npm-run-build-fails-to-minify
32 changes: 32 additions & 0 deletions playgrounds/react/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
{
"name": "react-playground",
"version": "0.1.0",
"private": true,
"dependencies": {
"instantsearch.css": "^7.4.3",
"react": "^16.13.1",
"react-dom": "^16.13.1",
"react-instantsearch-dom": "^6.7.0",
"react-scripts": "3.4.1"
},
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"eject": "react-scripts eject"
},
"eslintConfig": {
"extends": "react-app"
},
"browserslist": {
"production": [
">0.2%",
"not dead",
"not op_mini all"
],
"development": [
"last 1 chrome version",
"last 1 firefox version",
"last 1 safari version"
]
}
}
17 changes: 17 additions & 0 deletions playgrounds/react/public/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="theme-color" content="#000000" />
<meta
name="description"
content="Demo of MeiliSearch + React InstantSearch usage"
/>
<title>MeiliSearch + React InstantSearch</title>
</head>
<body>
<noscript>You need to enable JavaScript to run this app.</noscript>
<div id="root"></div>
</body>
</html>
51 changes: 51 additions & 0 deletions playgrounds/react/src/App.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
body {
font-family: sans-serif;
padding: 1em;
}

.ais-ClearRefinements {
margin: 1em 0;
}

.ais-SearchBox {
margin: 1em 0;
}

.ais-Pagination {
margin-top: 1em;
}

.left-panel {
float: left;
width: 200px;
}

.right-panel {
margin-left: 210px;
}

.ais-InstantSearch {
max-width: 960px;
overflow: hidden;
margin: 0 auto;
}

.ais-Hits-item {
margin-bottom: 1em;
width: calc(50% - 1rem);
}

.ais-Hits-item img {
margin-right: 1em;
width: 100%;
height: 100%;
margin-bottom: 0.5em;
}

.hit-name {
margin-bottom: 0.5em;
}

.hit-info {
font-size: 90%;
}
76 changes: 76 additions & 0 deletions playgrounds/react/src/App.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
import "instantsearch.css/themes/algolia-min.css";
import React, { Component } from "react";
import {
InstantSearch,
Hits,
SearchBox,
Pagination,
Highlight,
ClearRefinements,
RefinementList,
Configure
} from "react-instantsearch-dom";
import "./App.css";
import instantMeiliSearch from "./instant-meilisearch.js";

const searchClient = instantMeiliSearch(
"https://demos.meilisearch.com",
"dc3fedaf922de8937fdea01f0a7d59557f1fd31832cb8440ce94231cfdde7f25"
);

class App extends Component {
render() {
return (
<div className="ais-InstantSearch">
<h1>MeiliSearch + React InstantSearch</h1>
<h2>
Search in Steam video games{" "}
<span role="img" aria-label="emoji">
🎮
</span>
</h2>
<p>
This is not the official Steam dataset but only for demo purpose.
Enjoy searching with MeiliSearch!
</p>
<InstantSearch
indexName="steam-video-games"
searchClient={searchClient}
>
<div className="left-panel">
<ClearRefinements />
<h2>Genres</h2>
<RefinementList attribute="genres" />
<h2>Players</h2>
<RefinementList attribute="players" />
<h2>Platforms</h2>
<RefinementList attribute="platforms" />
<h2>Misc</h2>
<RefinementList attribute="misc" />
<Configure hitsPerPage={6} />
</div>
<div className="right-panel">
<SearchBox />
<Hits hitComponent={Hit} />
<Pagination showLast={true}/>
</div>
</InstantSearch>
</div>
);
}
}

function Hit(props) {
return (
<div key={props.hit.id}>
<div className="hit-name">
<Highlight attribute="name" hit={props.hit} />
</div>
<img src={props.hit.image} align="left" alt={props.hit.name} />
<div className="hit-info">price: {props.hit.price}</div>
<div className="hit-info">release date: {props.hit.releaseDate}</div>
</div>
);
}

export default App;
10 changes: 10 additions & 0 deletions playgrounds/react/src/index.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
body,
h1 {
margin: 0;
padding: 0;
}

body {
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica,
Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";
}
11 changes: 11 additions & 0 deletions playgrounds/react/src/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import React from "react";
import ReactDOM from "react-dom";
import "./index.css";
import App from "./App";

ReactDOM.render(
<React.StrictMode>
<App />
</React.StrictMode>,
document.getElementById("root")
);
1 change: 1 addition & 0 deletions playgrounds/react/src/instant-meilisearch.js
Loading