create-instantsearch-app 6.4.2 → 7.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (147) hide show
  1. package/README.md +4 -5
  2. package/package.json +3 -2
  3. package/src/api/__tests__/__snapshots__/index.test.js.snap +4 -4
  4. package/src/api/__tests__/resolve-template.test.js +0 -28
  5. package/src/api/resolve-template.js +1 -28
  6. package/src/templates/React InstantSearch/.editorconfig +0 -1
  7. package/src/templates/React InstantSearch/.gitignore.template +20 -18
  8. package/src/templates/React InstantSearch/.template.js +4 -3
  9. package/src/templates/React InstantSearch/README.md +0 -2
  10. package/src/templates/React InstantSearch/package.json +8 -21
  11. package/src/templates/React InstantSearch/src/App.css +11 -0
  12. package/src/templates/{React InstantSearch Hooks → React InstantSearch}/src/App.tsx.hbs +3 -3
  13. package/src/templates/React InstantSearch Native/.gitignore.template +13 -16
  14. package/src/templates/React InstantSearch Native/.template.js +2 -1
  15. package/src/templates/{React InstantSearch Hooks Native → React InstantSearch Native}/App.tsx.hbs +1 -1
  16. package/src/templates/React InstantSearch Native/app.json +24 -1
  17. package/src/templates/React InstantSearch Native/package.json +14 -16
  18. package/src/templates/{React InstantSearch Hooks Native → React InstantSearch Native}/src/InfiniteHits.tsx +1 -1
  19. package/src/templates/{React InstantSearch Hooks Native → React InstantSearch Native}/src/SearchBox.tsx.hbs +1 -1
  20. package/src/utils/__tests__/index.test.js +8 -5
  21. package/src/templates/Autocomplete.js 0/.editorconfig +0 -9
  22. package/src/templates/Autocomplete.js 0/.eslintignore +0 -3
  23. package/src/templates/Autocomplete.js 0/.eslintrc.js +0 -3
  24. package/src/templates/Autocomplete.js 0/.gitignore.template +0 -22
  25. package/src/templates/Autocomplete.js 0/.prettierrc +0 -5
  26. package/src/templates/Autocomplete.js 0/.template.js +0 -13
  27. package/src/templates/Autocomplete.js 0/README.md +0 -21
  28. package/src/templates/Autocomplete.js 0/favicon.png +0 -0
  29. package/src/templates/Autocomplete.js 0/index.html.hbs +0 -46
  30. package/src/templates/Autocomplete.js 0/manifest.webmanifest +0 -15
  31. package/src/templates/Autocomplete.js 0/package.json +0 -26
  32. package/src/templates/Autocomplete.js 0/src/app.css +0 -85
  33. package/src/templates/Autocomplete.js 0/src/app.js.hbs +0 -31
  34. package/src/templates/Autocomplete.js 0/src/index.css +0 -7
  35. package/src/templates/InstantSearch.js 2/.editorconfig +0 -9
  36. package/src/templates/InstantSearch.js 2/.eslintignore +0 -3
  37. package/src/templates/InstantSearch.js 2/.eslintrc.js +0 -3
  38. package/src/templates/InstantSearch.js 2/.gitignore.template +0 -22
  39. package/src/templates/InstantSearch.js 2/.prettierrc +0 -5
  40. package/src/templates/InstantSearch.js 2/.template.js +0 -14
  41. package/src/templates/InstantSearch.js 2/README.md +0 -21
  42. package/src/templates/InstantSearch.js 2/favicon.png +0 -0
  43. package/src/templates/InstantSearch.js 2/index.html.hbs +0 -56
  44. package/src/templates/InstantSearch.js 2/manifest.webmanifest +0 -15
  45. package/src/templates/InstantSearch.js 2/package.json +0 -22
  46. package/src/templates/InstantSearch.js 2/src/app.css +0 -75
  47. package/src/templates/InstantSearch.js 2/src/app.js.hbs +0 -54
  48. package/src/templates/InstantSearch.js 2/src/index.css +0 -10
  49. package/src/templates/JavaScript Helper 2/.editorconfig +0 -9
  50. package/src/templates/JavaScript Helper 2/.eslintignore +0 -3
  51. package/src/templates/JavaScript Helper 2/.eslintrc.js +0 -3
  52. package/src/templates/JavaScript Helper 2/.gitignore.template +0 -22
  53. package/src/templates/JavaScript Helper 2/.prettierrc +0 -5
  54. package/src/templates/JavaScript Helper 2/.template.js +0 -14
  55. package/src/templates/JavaScript Helper 2/README.md +0 -21
  56. package/src/templates/JavaScript Helper 2/favicon.png +0 -0
  57. package/src/templates/JavaScript Helper 2/index.html.hbs +0 -42
  58. package/src/templates/JavaScript Helper 2/manifest.webmanifest +0 -15
  59. package/src/templates/JavaScript Helper 2/package.json +0 -26
  60. package/src/templates/JavaScript Helper 2/src/app.css +0 -74
  61. package/src/templates/JavaScript Helper 2/src/app.js.hbs +0 -44
  62. package/src/templates/JavaScript Helper 2/src/index.css +0 -10
  63. package/src/templates/React InstantSearch/.eslintrc.js +0 -3
  64. package/src/templates/React InstantSearch/public/favicon.png +0 -0
  65. package/src/templates/React InstantSearch/public/index.html +0 -29
  66. package/src/templates/React InstantSearch/public/manifest.json +0 -15
  67. package/src/templates/React InstantSearch/src/App.js.hbs +0 -112
  68. package/src/templates/React InstantSearch/src/index.css +0 -10
  69. package/src/templates/React InstantSearch/src/index.js +0 -6
  70. package/src/templates/React InstantSearch Hooks/.editorconfig +0 -8
  71. package/src/templates/React InstantSearch Hooks/.gitignore.template +0 -23
  72. package/src/templates/React InstantSearch Hooks/.prettierrc +0 -5
  73. package/src/templates/React InstantSearch Hooks/.template.js +0 -25
  74. package/src/templates/React InstantSearch Hooks/README.md +0 -19
  75. package/src/templates/React InstantSearch Hooks/package.json +0 -21
  76. package/src/templates/React InstantSearch Hooks/src/App.css +0 -71
  77. package/src/templates/React InstantSearch Hooks Native/.gitignore.template +0 -14
  78. package/src/templates/React InstantSearch Hooks Native/.template.js +0 -34
  79. package/src/templates/React InstantSearch Hooks Native/README.md +0 -19
  80. package/src/templates/React InstantSearch Hooks Native/app.json +0 -30
  81. package/src/templates/React InstantSearch Hooks Native/babel.config.js +0 -6
  82. package/src/templates/React InstantSearch Hooks Native/package.json +0 -30
  83. package/src/templates/React InstantSearch Native/.editorconfig +0 -9
  84. package/src/templates/React InstantSearch Native/.eslintrc.js +0 -3
  85. package/src/templates/React InstantSearch Native/.prettierrc +0 -5
  86. package/src/templates/React InstantSearch Native/.watchmanconfig +0 -1
  87. package/src/templates/React InstantSearch Native/App.js.hbs +0 -38
  88. package/src/templates/React InstantSearch Native/src/Highlight.js +0 -36
  89. package/src/templates/React InstantSearch Native/src/InfiniteHits.js.hbs +0 -56
  90. package/src/templates/React InstantSearch Native/src/SearchBox.js.hbs +0 -42
  91. package/src/templates/React InstantSearch widget/.eslintignore +0 -2
  92. package/src/templates/React InstantSearch widget/.eslintrc.cjs +0 -13
  93. package/src/templates/React InstantSearch widget/.prettierrc +0 -5
  94. package/src/templates/React InstantSearch widget/.template.js +0 -21
  95. package/src/templates/React InstantSearch widget/CONTRIBUTING.md +0 -49
  96. package/src/templates/React InstantSearch widget/LICENSE.md.hbs +0 -21
  97. package/src/templates/React InstantSearch widget/README.md +0 -85
  98. package/src/templates/React InstantSearch widget/babel.config.cjs +0 -8
  99. package/src/templates/React InstantSearch widget/example/index.html.hbs +0 -12
  100. package/src/templates/React InstantSearch widget/example/index.tsx.hbs +0 -22
  101. package/src/templates/React InstantSearch widget/package.json.hbs +0 -81
  102. package/src/templates/React InstantSearch widget/src/index.tsx.hbs +0 -3
  103. package/src/templates/React InstantSearch widget/src/lib/__tests__/dummy-test.tsx.hbs +0 -39
  104. package/src/templates/React InstantSearch widget/src/lib/component.tsx.hbs +0 -15
  105. package/src/templates/React InstantSearch widget/src/lib/connector.ts.hbs +0 -35
  106. package/src/templates/React InstantSearch widget/src/lib/widget.tsx.hbs +0 -14
  107. package/src/templates/React InstantSearch widget/src/types/connector.ts +0 -17
  108. package/src/templates/React InstantSearch widget/tsconfig.declaration.json +0 -10
  109. package/src/templates/React InstantSearch widget/tsconfig.json +0 -20
  110. package/src/templates/React InstantSearch widget/vite.config.ts +0 -34
  111. package/src/templates/Vue InstantSearch 1/.editorconfig +0 -9
  112. package/src/templates/Vue InstantSearch 1/.eslintrc.js +0 -9
  113. package/src/templates/Vue InstantSearch 1/.gitignore.template +0 -21
  114. package/src/templates/Vue InstantSearch 1/.prettierrc +0 -5
  115. package/src/templates/Vue InstantSearch 1/.template.js +0 -14
  116. package/src/templates/Vue InstantSearch 1/README.md +0 -21
  117. package/src/templates/Vue InstantSearch 1/babel.config.js +0 -3
  118. package/src/templates/Vue InstantSearch 1/package.json +0 -35
  119. package/src/templates/Vue InstantSearch 1/public/favicon.png +0 -0
  120. package/src/templates/Vue InstantSearch 1/public/index.html +0 -22
  121. package/src/templates/Vue InstantSearch 1/src/App.vue +0 -167
  122. package/src/templates/Vue InstantSearch 1/src/main.js +0 -11
  123. package/src/templates/Vue InstantSearch 2/.editorconfig +0 -9
  124. package/src/templates/Vue InstantSearch 2/.eslintrc.js +0 -9
  125. package/src/templates/Vue InstantSearch 2/.gitignore.template +0 -21
  126. package/src/templates/Vue InstantSearch 2/.prettierrc +0 -5
  127. package/src/templates/Vue InstantSearch 2/.template.js +0 -15
  128. package/src/templates/Vue InstantSearch 2/README.md +0 -21
  129. package/src/templates/Vue InstantSearch 2/babel.config.js +0 -3
  130. package/src/templates/Vue InstantSearch 2/package.json +0 -37
  131. package/src/templates/Vue InstantSearch 2/public/favicon.png +0 -0
  132. package/src/templates/Vue InstantSearch 2/public/index.html +0 -22
  133. package/src/templates/Vue InstantSearch 2/src/App.vue +0 -147
  134. package/src/templates/Vue InstantSearch 2/src/main.js +0 -11
  135. package/src/utils/__tests__/__snapshots__/index.test.js.snap +0 -7
  136. /package/src/templates/{React InstantSearch Hooks → React InstantSearch}/favicon.png +0 -0
  137. /package/src/templates/{React InstantSearch Hooks → React InstantSearch}/index.html +0 -0
  138. /package/src/templates/{React InstantSearch Hooks → React InstantSearch}/src/Panel.tsx +0 -0
  139. /package/src/templates/{React InstantSearch Hooks → React InstantSearch}/src/index.tsx +0 -0
  140. /package/src/templates/{React InstantSearch Hooks Native → React InstantSearch Native}/.expo-shared/assets.json +0 -0
  141. /package/src/templates/{React InstantSearch Hooks Native → React InstantSearch Native}/assets/adaptive-icon.png +0 -0
  142. /package/src/templates/{React InstantSearch Hooks Native → React InstantSearch Native}/assets/favicon.png +0 -0
  143. /package/src/templates/{React InstantSearch Hooks Native → React InstantSearch Native}/assets/icon.png +0 -0
  144. /package/src/templates/{React InstantSearch Hooks Native → React InstantSearch Native}/assets/splash.png +0 -0
  145. /package/src/templates/{React InstantSearch Hooks Native → React InstantSearch Native}/src/Highlight.tsx +0 -0
  146. /package/src/templates/{React InstantSearch Hooks Native → React InstantSearch Native}/tsconfig.json +0 -0
  147. /package/src/templates/{React InstantSearch Hooks Native → React InstantSearch Native}/types/ProductHit.ts +0 -0
@@ -1,38 +0,0 @@
1
- import React from 'react';
2
- import { StyleSheet, View, SafeAreaView, StatusBar } from 'react-native';
3
- import algoliasearch from 'algoliasearch';
4
- import { InstantSearch } from 'react-instantsearch-native';
5
- import SearchBox from './src/SearchBox';
6
- import InfiniteHits from './src/InfiniteHits';
7
-
8
- const searchClient = algoliasearch(
9
- '{{appId}}',
10
- '{{apiKey}}'
11
- );
12
-
13
- const styles = StyleSheet.create({
14
- safe: {
15
- flex: 1,
16
- backgroundColor: '#252b33',
17
- },
18
- container: {
19
- flex: 1,
20
- backgroundColor: '#FFFFFF',
21
- },
22
- });
23
-
24
- const App = () => {
25
- return (
26
- <SafeAreaView style={styles.safe}>
27
- <StatusBar barStyle="light-content" />
28
- <View style={styles.container}>
29
- <InstantSearch searchClient={searchClient} indexName="{{indexName}}">
30
- <SearchBox />
31
- <InfiniteHits />
32
- </InstantSearch>
33
- </View>
34
- </SafeAreaView>
35
- );
36
- };
37
-
38
- export default App;
@@ -1,36 +0,0 @@
1
- import React from 'react';
2
- import { Text } from 'react-native';
3
- import PropTypes from 'prop-types';
4
- import { connectHighlight } from 'react-instantsearch-native';
5
-
6
- const Highlight = ({ attribute, hit, highlight }) => {
7
- const highlights = highlight({
8
- highlightProperty: '_highlightResult',
9
- attribute,
10
- hit,
11
- });
12
-
13
- return (
14
- <Text>
15
- {highlights.map(({ value, isHighlighted }, index) => {
16
- const style = {
17
- backgroundColor: isHighlighted ? 'yellow' : 'transparent',
18
- };
19
-
20
- return (
21
- <Text key={index} style={style}>
22
- {value}
23
- </Text>
24
- );
25
- })}
26
- </Text>
27
- );
28
- };
29
-
30
- Highlight.propTypes = {
31
- attribute: PropTypes.string.isRequired,
32
- hit: PropTypes.object.isRequired,
33
- highlight: PropTypes.func.isRequired,
34
- };
35
-
36
- export default connectHighlight(Highlight);
@@ -1,56 +0,0 @@
1
- import React from 'react';
2
- import { StyleSheet, Text, View, FlatList } from 'react-native';
3
- import PropTypes from 'prop-types';
4
- import { connectInfiniteHits } from 'react-instantsearch-native';
5
- {{#if attributesToDisplay}}
6
- import Highlight from './Highlight';
7
- {{/if}}
8
-
9
- const styles = StyleSheet.create({
10
- separator: {
11
- borderBottomWidth: 1,
12
- borderColor: '#ddd',
13
- },
14
- item: {
15
- padding: 10,
16
- flexDirection: 'column',
17
- },
18
- titleText: {
19
- fontWeight: 'bold',
20
- },
21
- });
22
-
23
- const InfiniteHits = ({ hits, hasMore, refineNext }) => (
24
- <FlatList
25
- data={hits}
26
- keyExtractor={item => item.objectID}
27
- ItemSeparatorComponent={() => <View style={styles.separator} />}
28
- onEndReached={() => hasMore && refineNext()}
29
- renderItem={({ item }) => (
30
- <View style={styles.item}>
31
- {{#if attributesToDisplay}}
32
- <Text style={styles.titleText}>
33
- <Highlight attribute="{{attributesToDisplay.[0]}}" hit={item} />
34
- </Text>
35
- {{#each attributesToDisplay}}
36
- {{#unless @first}}
37
- <Text>
38
- <Highlight attribute="{{this}}" hit={item} />
39
- </Text>
40
- {{/unless}}
41
- {{/each}}
42
- {{else}}
43
- <Text>{JSON.stringify(item).slice(0, 100)}</Text>
44
- {{/if}}
45
- </View>
46
- )}
47
- />
48
- );
49
-
50
- InfiniteHits.propTypes = {
51
- hits: PropTypes.arrayOf(PropTypes.object).isRequired,
52
- hasMore: PropTypes.bool.isRequired,
53
- refineNext: PropTypes.func.isRequired,
54
- };
55
-
56
- export default connectInfiniteHits(InfiniteHits);
@@ -1,42 +0,0 @@
1
- import React from 'react';
2
- import { StyleSheet, View, TextInput } from 'react-native';
3
- import PropTypes from 'prop-types';
4
- import { connectSearchBox } from 'react-instantsearch-native';
5
-
6
- const styles = StyleSheet.create({
7
- container: {
8
- padding: 16,
9
- backgroundColor: '#252b33',
10
- },
11
- input: {
12
- height: 48,
13
- padding: 12,
14
- fontSize: 16,
15
- backgroundColor: '#fff',
16
- borderRadius: 4,
17
- borderWidth: 1,
18
- borderColor: '#ddd',
19
- shadowColor: '#000',
20
- shadowOffset: { width: 0, height: 2 },
21
- shadowOpacity: 0.2,
22
- shadowRadius: 2,
23
- },
24
- });
25
-
26
- const SearchBox = ({ currentRefinement, refine }) => (
27
- <View style={styles.container}>
28
- <TextInput
29
- style={styles.input}
30
- onChangeText={value => refine(value)}
31
- value={currentRefinement}
32
- placeholder="{{searchPlaceholder}}"
33
- />
34
- </View>
35
- );
36
-
37
- SearchBox.propTypes = {
38
- currentRefinement: PropTypes.string.isRequired,
39
- refine: PropTypes.func.isRequired,
40
- };
41
-
42
- export default connectSearchBox(SearchBox);
@@ -1,2 +0,0 @@
1
- /dist
2
- node_modules/
@@ -1,13 +0,0 @@
1
- // eslint-disable-next-line import/no-commonjs
2
- module.exports = {
3
- extends: ['algolia', 'algolia/jest', 'algolia/react', 'algolia/typescript'],
4
- rules: {
5
- '@typescript-eslint/explicit-function-return-type': 'off',
6
- 'jest/expect-expect': 'off',
7
- },
8
- settings: {
9
- react: {
10
- version: 'detect',
11
- },
12
- },
13
- };
@@ -1,5 +0,0 @@
1
- {
2
- "singleQuote": true,
3
- "proseWrap": "never",
4
- "trailingComma": "es5"
5
- }
@@ -1,21 +0,0 @@
1
- const install = require('../../tasks/node/install');
2
- const teardown = require('../../tasks/node/teardown');
3
-
4
- module.exports = {
5
- category: 'Widget',
6
- libraryName: 'react-instantsearch',
7
- supportedVersion: '>= 6.0.0 < 7.0.0',
8
- templateName: 'react-instantsearch-widget',
9
- packageNamePrefix: 'react-instantsearch-widget-',
10
- keywords: [
11
- 'algolia',
12
- 'InstantSearch',
13
- 'React',
14
- 'react-instantsearch',
15
- 'widget',
16
- ],
17
- tasks: {
18
- install,
19
- teardown,
20
- },
21
- };
@@ -1,49 +0,0 @@
1
- # Contribution Guide
2
-
3
- ## Test
4
-
5
- ```bash
6
- npm test
7
- # or
8
- yarn test
9
- ```
10
-
11
- ## Build
12
-
13
- ```bash
14
- npm run build
15
- # or
16
- yarn build
17
- ```
18
-
19
- ## Run example
20
-
21
- ```bash
22
- npm start
23
- # or
24
- yarn start
25
- ```
26
-
27
- ## Release
28
-
29
- ```bash
30
- npm run release
31
- # or
32
- yarn release
33
- ```
34
-
35
- ### First Release
36
-
37
- ```bash
38
- npm run release -- --first-release
39
- # or
40
- yarn release --first-release
41
- ```
42
-
43
- This will tag a release without bumping the version.
44
-
45
- When you are ready, push the git tag and run `npm publish`.
46
-
47
- If you want to publish it as a public scoped package, run `npm publish --access public` the first time.
48
-
49
- [To know more about `standard-version`, read this →](https://github.com/conventional-changelog/standard-version#cli-usage)
@@ -1,21 +0,0 @@
1
- The MIT License (MIT)
2
-
3
- Copyright (c) {{ currentYear }}-present {{ organization }}.
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.
@@ -1,85 +0,0 @@
1
- # {{name}}
2
-
3
- {{ description }}
4
-
5
- ---
6
-
7
- [![MIT](https://img.shields.io/npm/l/{{ packageName }})](./LICENSE) [![NPM version](http://img.shields.io/npm/v/{{ packageName }}.svg)](https://npmjs.org/package/{{ packageName }})
8
-
9
- ## Install
10
-
11
- ```bash
12
- npm install {{ packageName }}
13
- # or
14
- yarn add {{ packageName }}
15
- ```
16
-
17
- ## Widget
18
-
19
- ### Usage
20
-
21
- ```jsx
22
- import algoliasearch from 'algoliasearch/lite';
23
- import { InstantSearch } from 'react-instantsearch-dom';
24
- import { {{ pascalCaseName }} } from '{{ packageName }}';
25
-
26
- const searchClient = algoliasearch('appId', 'apiKey');
27
-
28
- const App = () => (
29
- <InstantSearch searchClient={searchClient} indexName="indexName">
30
- <{{ pascalCaseName }} />
31
- </InstantSearch>
32
- );
33
- ```
34
-
35
- ### Options
36
-
37
- | Option | Type | Required | Default | Description |
38
- | :-- | :-- | :-- | :-- | --- |
39
- | [`option1`](#option1) | `string` | true | - | REPLACE WITH THE DESCRIPTION FOR THIS OPTION |
40
-
41
- #### option1
42
-
43
- > `string` | **required**
44
-
45
- REPLACE WITH THE DESCRIPTION FOR THIS OPTION
46
-
47
- ## Connector
48
-
49
- ### Usage
50
-
51
- ```jsx
52
- import { connect{{ pascalCaseName }} } from '{{ packageName }}';
53
-
54
- // 1. Create a render function
55
- const Render{{ pascalCaseName }} = (renderOptions, isFirstRender) => {
56
- // Rendering logic
57
- };
58
-
59
- // 2. Create the custom widget
60
- const Custom{{ pascalCaseName }} = connect{{ pascalCaseName }}(
61
- Render{{ pascalCaseName }}
62
- );
63
-
64
- // 3. Instantiate
65
- const App = () => (
66
- <InstantSearch searchClient={searchClient} indexName="indexName">
67
- <Custom{{ pascalCaseName }} />
68
- </InstantSearch>
69
- );
70
- ```
71
-
72
- ## Contributing
73
-
74
- To start contributing to code, you need to:
75
-
76
- 1. [Fork the project](https://docs.github.com/en/get-started/quickstart/fork-a-repo)
77
- 2. [Clone the repository](https://docs.github.com/en/github/creating-cloning-and-archiving-repositories/cloning-a-repository-from-github/cloning-a-repository)
78
- 3. Install the dependencies: `yarn`
79
- 4. Run the development mode: `yarn start`
80
-
81
- Please read [our contribution process](./CONTRIBUTING.md) to learn more.
82
-
83
- ---
84
-
85
- _This project was generated with [create-instantsearch-app](https://github.com/algolia/instantsearch/tree/master/packages/create-instantsearch-app) by [Algolia](https://algolia.com)._
@@ -1,8 +0,0 @@
1
- // eslint-disable-next-line import/no-commonjs
2
- module.exports = {
3
- presets: [
4
- ['@babel/preset-env', { targets: { node: 'current' } }],
5
- '@babel/preset-react',
6
- '@babel/preset-typescript',
7
- ],
8
- };
@@ -1,12 +0,0 @@
1
- <!DOCTYPE html>
2
- <html lang="en">
3
- <head>
4
- <meta charset="UTF-8" />
5
- <meta name="viewport" content="width=device-width, initial-scale=1.0" />
6
- <title>{{ packageName }} | example</title>
7
- </head>
8
- <body>
9
- <div id="root"></div>
10
- <script type="module" src="./index.tsx"></script>
11
- </body>
12
- </html>
@@ -1,22 +0,0 @@
1
- import algoliasearch from 'algoliasearch/lite';
2
- import React from 'react';
3
- import ReactDOM from 'react-dom';
4
- import { InstantSearch, SearchBox, Hits } from 'react-instantsearch-dom';
5
-
6
- import { {{ pascalCaseName }} } from '../src';
7
-
8
- const searchClient = algoliasearch(
9
- 'latency',
10
- '6be0576ff61c053d5f9a3225e2a90f76'
11
- );
12
-
13
- ReactDOM.render(
14
- <React.StrictMode>
15
- <InstantSearch indexName="instant_search" searchClient={searchClient}>
16
- <{{ pascalCaseName }} />
17
- <SearchBox />
18
- <Hits />
19
- </InstantSearch>
20
- </React.StrictMode>,
21
- document.getElementById('root')
22
- );
@@ -1,81 +0,0 @@
1
- {
2
- "name": "{{ packageName }}",
3
- "version": "1.0.0",
4
- "description": "{{ description }}",
5
- "keywords": [
6
- "instantsearch-widget",
7
- "instantsearch",
8
- "react-instantsearch",
9
- "react-instantsearch-widget-{{ name }}",
10
- "widget",
11
- "connector",
12
- "algolia"
13
- ],
14
- "license": "MIT",
15
- "main": "./dist/index.cjs.js",
16
- "module": "./dist/index.es.js",
17
- "exports": {
18
- "import": "./dist/index.es.js",
19
- "require": "./dist/index.cjs.js"
20
- },
21
- "jsdelivr": "./dist/index.umd.js",
22
- "unpkg": "./dist/index.umd.js",
23
- "types": "./dist/index.d.ts",
24
- "type": "module",
25
- "files": [
26
- "dist"
27
- ],
28
- "scripts": {
29
- "start": "vite example",
30
- "prebuild": "rm -rf dist",
31
- "build": "vite build && npm run build:types",
32
- "build:types": "tsc -p tsconfig.declaration.json",
33
- "lint": "eslint --ext .js,.ts,.tsx .",
34
- "lint:fix": "npm run lint --fix",
35
- "test": "NODE_OPTIONS=--experimental-vm-modules jest",
36
- "test:watch": "npm test -- --watch",
37
- "test:types": "tsc",
38
- "prerelease": "npm run build",
39
- "release": "standard-version"
40
- },
41
- "dependencies": {
42
- "algoliasearch": "4",
43
- "react": "^16.8.0",
44
- "react-dom": "^16.8.0",
45
- "react-instantsearch-dom": "^6.26.0"
46
- },
47
- "devDependencies": {
48
- "@babel/core": "7.14.3",
49
- "@babel/preset-env": "7.14.2",
50
- "@babel/preset-react": "7.13.13",
51
- "@babel/preset-typescript": "7.13.0",
52
- "@testing-library/react": "11.2.7",
53
- "@types/jest": "26.0.23",
54
- "@types/node": "15.3.0",
55
- "@types/react": "17.0.0",
56
- "@types/react-dom": "17.0.0",
57
- "@types/react-instantsearch-core": "6.26.0",
58
- "@types/react-instantsearch-dom": "6.10.0",
59
- "@typescript-eslint/eslint-plugin": "4.24.0",
60
- "@typescript-eslint/parser": "4.24.0",
61
- "@vitejs/plugin-react-refresh": "1.3.1",
62
- "babel-eslint": "10.1.0",
63
- "babel-jest": "26.6.3",
64
- "eslint": "7.26.0",
65
- "eslint-config-algolia": "18.0.0",
66
- "eslint-config-prettier": "8.3.0",
67
- "eslint-plugin-eslint-comments": "3.2.0",
68
- "eslint-plugin-import": "2.23.2",
69
- "eslint-plugin-jest": "24.3.6",
70
- "eslint-plugin-jsdoc": "34.8.1",
71
- "eslint-plugin-jsx-a11y": "6.4.1",
72
- "eslint-plugin-prettier": "3.4.0",
73
- "eslint-plugin-react": "7.23.2",
74
- "eslint-plugin-react-hooks": "4.2.0",
75
- "jest": "26.6.3",
76
- "prettier": "2.3.0",
77
- "standard-version": "9.3.0",
78
- "typescript": "4.2.4",
79
- "vite": "2.3.3"
80
- }
81
- }
@@ -1,3 +0,0 @@
1
- export { connect{{ pascalCaseName }} } from './lib/connector';
2
- export { {{ pascalCaseName }}Component } from './lib/component';
3
- export { {{ pascalCaseName }} } from './lib/widget';
@@ -1,39 +0,0 @@
1
- import { render } from '@testing-library/react';
2
- import React from 'react';
3
- import { InstantSearch, Hits } from 'react-instantsearch-dom';
4
-
5
- import { {{ pascalCaseName }} } from '../widget';
6
-
7
- const runAllMicroTasks = (): Promise<void> => new Promise(setImmediate);
8
-
9
- describe('nothing', () => {
10
- it('tests nothing', async () => {
11
- const searchClient = {
12
- search(_requests: any[]) {
13
- return Promise.resolve({
14
- results: [
15
- {
16
- hits:
17
- [
18
- {
19
- objectID: 'a',
20
- name: 'test',
21
- },
22
- ],
23
- },
24
- ],
25
- });
26
- },
27
- };
28
-
29
- const { debug } = render(
30
- <InstantSearch indexName="test_index" searchClient={searchClient}>
31
- <{{ pascalCaseName }} />
32
- <Hits hitComponent={({ hit }: { hit: any }) => hit.name} />
33
- </InstantSearch>
34
- );
35
-
36
- await runAllMicroTasks();
37
- debug();
38
- });
39
- });
@@ -1,15 +0,0 @@
1
- import React from 'react';
2
-
3
- import type { ProvidedProps } from './connector'
4
-
5
- type Props = ProvidedProps & {
6
- refine: () => void;
7
- };
8
-
9
- export const {{ pascalCaseName }}Component = ({}: Props) => {
10
- return (
11
- <div>
12
- {/* TODO: render something */}
13
- </div>
14
- );
15
- };
@@ -1,35 +0,0 @@
1
- import type { Connector } from '../types/connector';
2
-
3
- import { createConnector } from 'react-instantsearch-dom';
4
-
5
- export type ProvidedProps = {
6
- // TODO: fill props that are returned by `getProvidedProps`
7
- }
8
-
9
- export const connect{{ pascalCaseName }}: Connector<ProvidedProps> = createConnector<ProvidedProps>({
10
- displayName: '{{ pascalCaseName }}',
11
- $$type: '{{ widgetType }}',
12
-
13
- getProvidedProps(props, searchState, searchResults) {
14
- return {
15
- // TODO: return a props for the component
16
- };
17
- },
18
-
19
- refine(props, searchState, nextRefinement) {
20
- return {
21
- // TODO: return a next searchState
22
- };
23
- },
24
-
25
- cleanUp(props, searchState) {
26
- return {
27
- // TODO: return a searchState where this widget is removed from the widget tree
28
- };
29
- },
30
-
31
- getSearchParameters(searchParameters, props, searchState) {
32
- // TODO: update and return the searchParameters
33
- return searchParameters;
34
- },
35
- });
@@ -1,14 +0,0 @@
1
- import { {{ pascalCaseName }}Component } from './component';
2
- import { connect{{ pascalCaseName }} } from './connector';
3
-
4
- type WidgetParams = {
5
- /**
6
- * Placeholder text for input element.
7
- */
8
- placeholder?: string;
9
- };
10
-
11
- export const {{ pascalCaseName }}: React.ElementType<WidgetParams> = connect{{ pascalCaseName }}(
12
- {{ pascalCaseName }}Component,
13
- { $$widgetType: '{{ widgetType }}' }
14
- );
@@ -1,17 +0,0 @@
1
- import type {
2
- ConnectedComponentClass,
3
- ConnectorProvided,
4
- } from 'react-instantsearch-core';
5
-
6
- type AdditionalWidgetProperties = {
7
- $$widgetType?: string;
8
- };
9
-
10
- export type Connector<TProvided = {}, TExposed = {}> = ((
11
- stateless: React.FunctionComponent<ConnectorProvided<TProvided>>,
12
- additionalWidgetProperties: AdditionalWidgetProperties
13
- ) => React.ComponentClass<TExposed>) &
14
- (<TProps extends Partial<ConnectorProvided<TProvided>>>(
15
- Composed: React.ComponentType<TProps>,
16
- additionalWidgetProperties: AdditionalWidgetProperties
17
- ) => ConnectedComponentClass<TProps, ConnectorProvided<TProvided>, TExposed>);
@@ -1,10 +0,0 @@
1
- {
2
- "extends": "./tsconfig",
3
- "compilerOptions": {
4
- "outDir": "dist",
5
- "noEmit": false,
6
- "declaration": true,
7
- "emitDeclarationOnly": true
8
- },
9
- "exclude": ["example/index.tsx", "**/__tests__"]
10
- }
@@ -1,20 +0,0 @@
1
- {
2
- "compilerOptions": {
3
- "target": "ESNext",
4
- "lib": ["DOM", "DOM.Iterable", "ESNext"],
5
- "types": ["vite/client", "node", "jest"],
6
- "allowJs": false,
7
- "skipLibCheck": true,
8
- "esModuleInterop": false,
9
- "allowSyntheticDefaultImports": true,
10
- "strict": true,
11
- "forceConsistentCasingInFileNames": true,
12
- "module": "ESNext",
13
- "moduleResolution": "Node",
14
- "resolveJsonModule": true,
15
- "isolatedModules": true,
16
- "noEmit": true,
17
- "jsx": "react"
18
- },
19
- "include": ["./src", "example/index.tsx"]
20
- }