Skip to content
This repository was archived by the owner on Dec 16, 2022. It is now read-only.
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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
308 changes: 308 additions & 0 deletions scripts/__snapshots__/e2e-templates.test.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -945,6 +945,314 @@ Array [
]
`;

exports[`Templates Autocomplete.js File content: .editorconfig 1`] = `
"root = true

[*]
charset = utf-8
indent_style = space
indent_size = 2
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true"
`;

exports[`Templates Autocomplete.js File content: .eslintignore 1`] = `
"/node_modules
/dist
/.cache"
`;

exports[`Templates Autocomplete.js File content: .eslintrc.js 1`] = `
"module.exports = {
extends: 'algolia',
};"
`;

exports[`Templates Autocomplete.js File content: .gitignore 1`] = `
"# See https://help.github.com/ignore-files/ for more about ignoring files.

# dependencies
/node_modules

# testing
/coverage

# production
/dist
/.cache

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

npm-debug.log*
yarn-debug.log*
yarn-error.log*"
`;

exports[`Templates Autocomplete.js File content: .prettierrc 1`] = `
"{
\\"singleQuote\\": true,
\\"proseWrap\\": \\"never\\",
\\"trailingComma\\": \\"es5\\"
}"
`;

exports[`Templates Autocomplete.js File content: README.md 1`] = `
"# autocomplete.js-app

_This project was generated with [create-instantsearch-app](https://github.com/algolia/create-instantsearch-app) by [Algolia](https://algolia.com)._

## Get started

To run this project locally, install the dependencies and run the local server:

\`\`\`sh
npm install
npm start
\`\`\`

Alternatively, you may use [Yarn](https://http://yarnpkg.com/):

\`\`\`sh
yarn
yarn start
\`\`\`"
`;

exports[`Templates Autocomplete.js File content: index.html 1`] = `
"<!DOCTYPE html>
<html lang=\\"en\\">

<head>
<meta charset=\\"utf-8\\">
<meta name=\\"viewport\\" content=\\"width=device-width, initial-scale=1, shrink-to-fit=no\\">
<meta name=\\"theme-color\\" content=\\"#000000\\">

<link rel=\\"manifest\\" href=\\"./manifest.webmanifest\\">
<link rel=\\"shortcut icon\\" href=\\"./favicon.png\\">

<link rel=\\"stylesheet\\" href=\\"./src/index.css\\">
<link rel=\\"stylesheet\\" href=\\"./src/app.css\\">

<title>autocomplete.js-app</title>
</head>

<body>
<header class=\\"header\\">
<h1 class=\\"header-title\\">
<a href=\\"/\\">autocomplete.js-app</a>
</h1>
<p class=\\"header-subtitle\\">using
<a href=\\"https://github.com/algolia/autocomplete.js\\">Autocomplete.js</a>
</p>
</header>

<div class=\\"container\\">
<div class=\\"container-app\\">
<div id=\\"searchBox\\">
<form role=\\"search\\">
<input type=\\"search\\" placeholder=\\"Search placeholder\\" />
</form>
</div>
</div>
</div>

<script src=\\"./src/app.js\\"></script>
</body>

</html>"
`;

exports[`Templates Autocomplete.js File content: manifest.webmanifest 1`] = `
"{
\\"short_name\\": \\"autocomplete.js-app\\",
\\"name\\": \\"autocomplete.js-app Sample\\",
\\"icons\\": [
{
\\"src\\": \\"favicon.png\\",
\\"sizes\\": \\"64x64 32x32 24x24 16x16\\",
\\"type\\": \\"image/x-icon\\"
}
],
\\"start_url\\": \\"./index.html\\",
\\"display\\": \\"standalone\\",
\\"theme_color\\": \\"#000000\\",
\\"background_color\\": \\"#ffffff\\"
}"
`;

exports[`Templates Autocomplete.js File content: package.json 1`] = `
"{
\\"name\\": \\"autocomplete.js-app\\",
\\"version\\": \\"1.0.0\\",
\\"private\\": true,
\\"scripts\\": {
\\"start\\": \\"parcel index.html --port 3000\\",
\\"build\\": \\"parcel build index.html\\",
\\"lint\\": \\"eslint .\\",
\\"lint:fix\\": \\"npm run lint -- --fix\\"
},
\\"dependencies\\": {
\\"algoliasearch\\": \\"3.29.0\\",
\\"autocomplete.js\\": \\"1.0.0\\"
},
\\"devDependencies\\": {
\\"babel-eslint\\": \\"8.2.5\\",
\\"eslint\\": \\"4.19.1\\",
\\"eslint-config-algolia\\": \\"13.1.0\\",
\\"eslint-config-prettier\\": \\"2.9.0\\",
\\"eslint-plugin-import\\": \\"2.13.0\\",
\\"eslint-plugin-prettier\\": \\"2.6.1\\",
\\"parcel-bundler\\": \\"1.9.4\\",
\\"prettier\\": \\"1.13.7\\"
}
}"
`;

exports[`Templates Autocomplete.js File content: src/app.css 1`] = `
".header {
display: flex;
align-items: center;
min-height: 50px;
padding: 0.5rem 1rem;
background-image: linear-gradient(73deg, #3369e7, #1cc7d0);
color: #fff;
margin-bottom: 1rem;
}

.header a {
color: #fff;
text-decoration: none;
}

.header-title {
font-size: 1.2rem;
font-weight: normal;
}

.header-title::after {
content: ' ▸ ';
padding: 0 0.5rem;
}

.header-subtitle {
font-size: 1.2rem;
}

.container {
max-width: 1200px;
margin: 0 auto;
padding: 1rem;
}

#searchBox {
margin-bottom: 2rem;
}

.algolia-autocomplete {
width: 100%;
}

.algolia-autocomplete .aa-input,
.algolia-autocomplete .aa-hint {
width: 100%;
}

.algolia-autocomplete .aa-input {
padding: 12px;
font: inherit;
border-radius: 2px;
border: 1px solid rgba(150, 150, 150, 0.16);
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.16);
}

.algolia-autocomplete .aa-hint {
color: #999;
}

.algolia-autocomplete .aa-dropdown-menu {
width: 100%;
background-color: #fff;
border: 1px solid rgba(150, 150, 150, 0.16);
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.16);
}

.algolia-autocomplete .aa-dropdown-menu .aa-suggestion {
font-weight: bold;
cursor: pointer;
padding: 12px;
}

.algolia-autocomplete .aa-dropdown-menu .aa-suggestion em {
font-weight: normal;
font-style: normal;
}

.algolia-autocomplete .aa-dropdown-menu .aa-suggestion.aa-cursor {
background-color: rgba(150, 150, 150, 0.16);
}"
`;

exports[`Templates Autocomplete.js File content: src/app.js 1`] = `
"import algoliasearch from 'algoliasearch';
import autocomplete from 'autocomplete.js';

const client = algoliasearch('appId', 'apiKey');
const index = client.initIndex('indexName');

const $hits = document.querySelector('#hits');

autocomplete('#searchBox input[type=search]', { hint: false }, [
{
source: autocomplete.sources.hits(index, { hitsPerPage: 5 }),
displayKey: 'mainAttribute',
templates: {
suggestion(suggestion) {
return suggestion._highlightResult.mainAttribute.value;
},
},
},
]).on('autocomplete:selected', (event, suggestion, dataset) => {
console.log({ suggestion, dataset });
});"
`;

exports[`Templates Autocomplete.js File content: src/index.css 1`] = `
"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';
}"
`;

exports[`Templates Autocomplete.js Folder structure: contains the right files 1`] = `
Array [
".editorconfig",
".eslintignore",
".eslintrc.js",
".gitignore",
".prettierrc",
"README.md",
"favicon.png",
"index.html",
"manifest.webmanifest",
"package.json",
"src/app.css",
"src/app.js",
"src/index.css",
]
`;

exports[`Templates InstantSearch Android File content: .gitignore 1`] = `
"# IDE Files
*.iml
Expand Down
6 changes: 3 additions & 3 deletions src/api/__tests__/__snapshots__/index.test.js.snap
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`Options with unknown template throws 1`] = `"The template directory must contain a configuration file \`.template.js\` or must be one of those: Angular InstantSearch, InstantSearch Android, InstantSearch iOS, InstantSearch.js, React InstantSearch, React InstantSearch Native, Vue InstantSearch"`;
exports[`Options with unknown template throws 1`] = `"The template directory must contain a configuration file \`.template.js\` or must be one of those: Angular InstantSearch, Autocomplete.js, InstantSearch Android, InstantSearch iOS, InstantSearch.js, React InstantSearch, React InstantSearch Native, Vue InstantSearch"`;

exports[`Options with unvalid name throws 1`] = `
"Could not create a project called \\"./WrongNpmName\\" because of npm naming restrictions.
- name cannot start with a period
- name can only contain URL-friendly characters"
`;

exports[`Options with wrong template path throws 1`] = `"The template directory must contain a configuration file \`.template.js\` or must be one of those: Angular InstantSearch, InstantSearch Android, InstantSearch iOS, InstantSearch.js, React InstantSearch, React InstantSearch Native, Vue InstantSearch"`;
exports[`Options with wrong template path throws 1`] = `"The template directory must contain a configuration file \`.template.js\` or must be one of those: Angular InstantSearch, Autocomplete.js, InstantSearch Android, InstantSearch iOS, InstantSearch.js, React InstantSearch, React InstantSearch Native, Vue InstantSearch"`;

exports[`Options without path throws 1`] = `"The option \`path\` is required."`;

exports[`Options without template throws 1`] = `"The template directory must contain a configuration file \`.template.js\` or must be one of those: Angular InstantSearch, InstantSearch Android, InstantSearch iOS, InstantSearch.js, React InstantSearch, React InstantSearch Native, Vue InstantSearch"`;
exports[`Options without template throws 1`] = `"The template directory must contain a configuration file \`.template.js\` or must be one of those: Angular InstantSearch, Autocomplete.js, InstantSearch Android, InstantSearch iOS, InstantSearch.js, React InstantSearch, React InstantSearch Native, Vue InstantSearch"`;
9 changes: 9 additions & 0 deletions src/templates/Autocomplete.js/.editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
root = true

[*]
charset = utf-8
indent_style = space
indent_size = 2
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true
3 changes: 3 additions & 0 deletions src/templates/Autocomplete.js/.eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
/node_modules
/dist
/.cache
3 changes: 3 additions & 0 deletions src/templates/Autocomplete.js/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module.exports = {
extends: 'algolia',
};
22 changes: 22 additions & 0 deletions src/templates/Autocomplete.js/.gitignore.template
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# See https://help.github.com/ignore-files/ for more about ignoring files.

# dependencies
/node_modules

# testing
/coverage

# production
/dist
/.cache

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

npm-debug.log*
yarn-debug.log*
yarn-error.log*
5 changes: 5 additions & 0 deletions src/templates/Autocomplete.js/.prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"singleQuote": true,
"proseWrap": "never",
"trailingComma": "es5"
}
13 changes: 13 additions & 0 deletions src/templates/Autocomplete.js/.template.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
const install = require('../../tasks/node/install');
const teardown = require('../../tasks/node/teardown');

module.exports = {
libraryName: 'autocomplete.js',
templateName: 'autocomplete.js',
appName: 'autocomplete.js-app',
keywords: ['algolia', 'Autocomplete', 'autocomplete.js'],
tasks: {
install,
teardown,
},
};
Loading