-
Notifications
You must be signed in to change notification settings - Fork 89
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Remove not working umd bundle and replace with iife and cjs (#471)
* Remove not working umd bundle and replace with iife and cjs Remove unecessary configs Examples comment removed Add version remove version Information on imports * Better readme * Update CHANGELOG.md * Update CHANGELOG.md * Update README.md Co-authored-by: Clémentine Urquizar <[email protected]> * Update examples/typescript-browser/public/index.html Co-authored-by: Clémentine Urquizar <[email protected]> Co-authored-by: Clémentine Urquizar <[email protected]>
- Loading branch information
Showing
29 changed files
with
5,642 additions
and
85 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<meta charset='utf-8'> | ||
<meta http-equiv='X-UA-Compatible' content='IE=edge'> | ||
<title>Page Title</title> | ||
<meta name='viewport' content='width=device-width, initial-scale=1'> | ||
</head> | ||
<body> | ||
hello | ||
</body> | ||
</html> | ||
<script src="../../dist/bundles/meilisearch.umd.js"></script> | ||
<script> | ||
const client = new window.Meiliearch({ | ||
host: 'http://127.0.0.1:7700', | ||
apiKey: 'masterKey', | ||
}) | ||
client.listIndexes().then(res => { | ||
console.log({ res }); | ||
}) | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
const MeiliSearch = require('../../') | ||
const dataset = require('./small_movies.json') | ||
|
||
const config = { | ||
host: 'http://127.0.0.1:7700', | ||
apiKey: 'masterKey', | ||
} | ||
|
||
const client = new MeiliSearch(config) | ||
const uid = 'movies' | ||
|
||
const addDataset = async () => { | ||
const index = await client.getOrCreateIndex(uid) | ||
const documents = await index.getDocuments() | ||
if (documents.length === 0) { | ||
const { updateId } = await index.addDocuments(dataset) | ||
await index.waitForPendingUpdate(updateId) | ||
} | ||
} | ||
|
||
;(async () => { | ||
await addDataset() | ||
const index = await client.getIndex('movies') | ||
const resp = await index.search('Avengers', { | ||
limit: 1, | ||
attributesToHighlight: 'title', | ||
}) | ||
console.log({ resp }) | ||
console.log({ hit: resp.hits[0] }) | ||
})() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
public/bundle.js |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
{ | ||
"name": "typescript-demo", | ||
"version": "0.1.0", | ||
"description": "MeiliSearch Typescript Demo", | ||
"main": "index.js", | ||
"scripts": { | ||
"build": "webpack" | ||
}, | ||
"keywords": [ | ||
"demo", | ||
"meilisearch" | ||
], | ||
"author": "Charlotte Vermandel", | ||
"license": "ISC", | ||
"devDependencies": { | ||
"webpack": "^4.43.0", | ||
"ts-loader": "^7.0.5", | ||
"webpack-cli": "^3.3.12" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<meta charset='utf-8'> | ||
<meta http-equiv='X-UA-Compatible' content='IE=edge'> | ||
<title>Page Title</title> | ||
<meta name='viewport' content='width=device-width, initial-scale=1'> | ||
</head> | ||
<body> | ||
hello | ||
</body> | ||
</html> | ||
<script src="./bundle.js"></script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import MeiliSearch, { IndexResponse } from '../../../' | ||
|
||
const config = { | ||
host: 'http://127.0.0.1:7700', | ||
apiKey: 'masterKey', | ||
} | ||
|
||
const client = new MeiliSearch(config) | ||
const user = 'MeiliSearch User' | ||
|
||
function greeter(person: string) { | ||
return 'Hello, ' + person | ||
} | ||
|
||
;(async () => { | ||
const indexes = await client.listIndexes() | ||
console.log({ indexes }, 'hello') | ||
const uids = indexes.map((index: IndexResponse) => index.uid) | ||
document.body.innerHTML = `${greeter( | ||
user | ||
)} this is the list of all your indexes: ${uids.join(', ')}` | ||
})() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
{ | ||
"compilerOptions": { | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
const webpack = require('webpack') | ||
const path = require('path') | ||
|
||
let config = { | ||
entry: './src/index.ts', | ||
output: { | ||
path: path.resolve(__dirname, './public'), | ||
filename: './bundle.js', | ||
}, | ||
mode: 'production', | ||
module: { | ||
rules: [ | ||
{ | ||
test: /\.tsx?$/, | ||
use: 'ts-loader', | ||
exclude: /node_modules/, | ||
}, | ||
], | ||
}, | ||
resolve: { | ||
extensions: ['.tsx', '.ts', '.js'], | ||
mainFields: ['module', 'browser'], // the `module` field has priority on the browser field | ||
}, | ||
} | ||
|
||
module.exports = config |
Oops, something went wrong.