diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000000..d1d8a4176a --- /dev/null +++ b/.editorconfig @@ -0,0 +1,10 @@ +# http://editorconfig.org +root = true + +[*] +indent_style = space +indent_size = 2 +end_of_line = lf +charset = utf-8 +trim_trailing_whitespace = true +insert_final_newline = true diff --git a/.eslintignore b/.eslintignore new file mode 100644 index 0000000000..100bac21a8 --- /dev/null +++ b/.eslintignore @@ -0,0 +1,2 @@ +**/node_modules/** +/templates diff --git a/.eslintrc.js b/.eslintrc.js new file mode 100644 index 0000000000..bfd3a913d9 --- /dev/null +++ b/.eslintrc.js @@ -0,0 +1,8 @@ +module.exports = { + extends: ['algolia', 'algolia/jest'], + rules: { + 'import/no-commonjs': 'off', + 'no-console': 'off', + 'no-process-exit': 'off', + }, +}; diff --git a/.gitignore b/.gitignore index 3c3629e647..dc69cdf75b 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,16 @@ +# dependencies node_modules + +# misc +.DS_Store +.env.local +.env.development.local +.env.test.local +.env.production.local + +npm-debug.log* +yarn-debug.log* +yarn-error.log* + +# release +/build diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000000..650b1d2864 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,16 @@ +language: node_js +node_js: + - 8 + - 9 + - 10 +cache: + - yarn: true +before_install: + - curl -o- -L yarnpkg.com/install.sh | bash -s -- --version 1.7.0 + - export PATH=$HOME/.yarn/bin:$PATH +script: + - "${SCRIPT}" +env: + matrix: + - SCRIPT="yarn test && yarn lint" + - SCRIPT="yarn test:e2e" diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000000..78f811663b --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2015-present Algolia, Inc. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/README.md b/README.md index 2641db1d36..3a6f76c3f8 100644 --- a/README.md +++ b/README.md @@ -1,33 +1,216 @@ -# create-instantsearch-app +# Create InstantSearch App -Start your next instantsearch app in a ms ⚡️ +> Build InstantSearch apps at the speed of thoughts ⚡️ -`create-instantsearch-app` is a command line utility that helps you quick start your next search app using [Algolia InstantSearch.js](https://community.algolia.com/instantsearch.js/v2). +[![Build Status][travis-svg]][travis-url] [![Version][version-svg]][package-url] [![License][license-image]][license-url] + +`create-instantsearch-app` is a command line utility that helps you quick start your InstantSearch app using any [Algolia][algolia-website] InstantSearch flavor ([InstantSearch.js][instantsearchjs-github], [React InstantSearch][react-instantsearch-github], [Vue InstantSearch][vue-instantsearch-github] and [Angular InstantSearch][angular-instantsearch-github]). + +## Get started + +> The tool requires Node ≥ 8. + +``` +npm init instantsearch-app my-app +cd my-app +npm start +``` + +Open http://localhost:3000 to see you app. + +
+ I use an older npm version + +[`npm-init <@scope>` ](https://docs.npmjs.com/cli/init) is only available on recent `npm` versions. If it's not available, install `create-instantsearch-app` globally and run the binary. + +``` +npm install --global create-instantsearch-app +create-instantsearch-app my-app +cd my-app +npm start +``` + +
+ +--- + +Alternatively, you can use [Yarn](https://http://yarnpkg.com): + +``` +yarn create instantsearch-app my-app +cd my-app +yarn start +``` ## Usage -`create-instantsearch-app` is a node based tool, in order to use you need node and npm installed on your computer. Have a look at their documentation to [get started](https://docs.npmjs.com/getting-started/installing-node) or use [nvm](https://github.com/creationix/nvm) (advanced) +This package comes with the module `createInstantSearchApp(path, options?, tasks?)` and the command-line tool `create-instantsearch-app`. -We recommend to use Yarn as an alternative to NPM for handling dependencies in Node projects because it offers some nice integration with CLI tools like `create-instantsearch-app`. +``` +$ create-instantsearch-app --help -### Using NPM + Usage: create-instantsearch-app [options] -Installation: + Options: -```sh -npm install -g create-instantsearch-app + -v, --version output the version number + --name The name of the application + --app-id The application ID + --api-key The Algolia search API key + --index-name The main index of your search + --main-attribute The main searchable attribute of your index + --attributes-for-faceting The attributes for faceting + -t, --template