From 0527688ab67a16b5eab7f935f634b6a86f549652 Mon Sep 17 00:00:00 2001 From: vvo Date: Mon, 14 Dec 2015 19:17:21 +0100 Subject: [PATCH] chore(dev workflow, readme): consistency commit add npm run dev:docs consistent readme with instantsearch.js move to docsearch.js What do you think? --- .gitignore | 1 + README.md | 51 ++++++++++++++++++++++++++++++++++------------- docs/_config.yml | 2 +- docs/index.haml | 2 +- package.json | 11 ++++++---- scripts/build-css | 4 ++-- scripts/build-js | 4 ++-- scripts/dev | 2 -- scripts/dev-docs | 9 +++++++++ 9 files changed, 60 insertions(+), 26 deletions(-) create mode 100755 scripts/dev-docs diff --git a/.gitignore b/.gitignore index 4b9d24a8..511267e7 100644 --- a/.gitignore +++ b/.gitignore @@ -3,3 +3,4 @@ dist/ dist-es5-module/ npm-debug.log* docs/_site +docs/.sass-cache/ diff --git a/README.md b/README.md index 21e5797e..cf574d09 100644 --- a/README.md +++ b/README.md @@ -1,15 +1,18 @@ -# Documentation Search +# docsearch.js -Add a search autocomplete to your documentation. +Add a search autocomplete to any documentation. + +Currently on-demand, send an email to [docsearch@algolia.com](mailto:docsearch@algolia.com) +if you want documentation search on your website. # Usage ```html - - + + ``` -```javascript +```js documentationSearch({ apiKey: apiKey, // Mandatory indexName: indexName, // Mandatory @@ -24,10 +27,10 @@ documentationSearch({ - https://reactjs.algolia.com/ - https://babeljs.algolia.com/ -# How do I get my `apiKey` and `indexName`? +# How do I get an `apiKey` and `indexName`? -Just send us [an email](mailto:documentationsearch@algolia.com) with the url of -the documentation you would like to search, and we'll this info back to you. +Send us [an email](mailto:docsearch@algolia.com) with the url of +the documentation website you would like to add search to. # How does it work? @@ -35,16 +38,36 @@ The JavaScript library is a wrapper on top of our [autocomplete.js](https://github.com/algolia/autocomplete.js) library, along with default CSS styling of the dropdown. -The indexing of the data itself is currently done by an internal tool (we will -release it later), that runs every hour. +The indexing of the website data itself is currently done by an internal tool (to be released). -# Development +Indexing of docsearch.js linked websites takes places every day. -You need [ruby](https://www.ruby-lang.org/en/), [bundler](http://bundler.io/). +# Development workflow + +## Local example + +We use a simple documentation example website as a way to develop the docsearch.js library. + +Requirements: +- [Node.js](https://nodejs.org/en/) +- npm@2 + +```sh +npm run dev +# open http://localhost:8080 +``` + +## Documentation website + +This is the [Jekyll](https://jekyllrb.com/) instance running at https://community.algolia.com/docsearch.js. + +Requirements: +- [Ruby](https://www.ruby-lang.org/en/) +- [Bundler](http://bundler.io/) ```sh -bundle install -bundle exec guard +npm run dev:docs +# open http://localhost:4000/docsearch.js/ ``` ## MacOS diff --git a/docs/_config.yml b/docs/_config.yml index 9fc246f0..4555c823 100644 --- a/docs/_config.yml +++ b/docs/_config.yml @@ -1,7 +1,7 @@ # Site settings title: Documentation Search description: Lorem ipsum dolor sit amet, consectetur adipisicing elit. Eum quod hic qui, possimus ab ratione illo reiciendis nostrum sit aperiam debitis enim illum sequi reprehenderit porro error, sint earum rem! -baseurl: "/documentation-search" # the subpath of your site, e.g. /blog/ +baseurl: "/docsearch.js" # the subpath of your site, e.g. /blog/ twitter_username: algolia github_username: algolia host: 0.0.0.0 diff --git a/docs/index.haml b/docs/index.haml index 210cc357..4721f14a 100644 --- a/docs/index.haml +++ b/docs/index.haml @@ -40,4 +40,4 @@ layout: default %p Lorem ipsum dolor sit amet, consectetur adipisicing elit. In, sit, veritatis tempora ipsum, provident fugiat quas, eum dicta architecto - %p Here are some examples of what you could build with documentationsearch.js. + %p Here are some examples of what you could build with docsearch.js. diff --git a/package.json b/package.json index 447855d0..9a5fca47 100644 --- a/package.json +++ b/package.json @@ -1,10 +1,11 @@ { - "name": "documentationsearch.js", + "name": "docsearch.js", "version": "0.0.1", "description": "Add an autocomplete dropdown to your documentation", "main": "dist-es5-module/index.js", "scripts": { "dev": "./scripts/dev", + "dev:docs": "./scripts/dev-docs", "shrinkwrap": "npm-shrinkwrap --dev", "prepublish": "NODE_ENV=production npm run build", "build": "./scripts/build", @@ -18,7 +19,7 @@ }, "author": "Algolia (https://github.com/algolia/)", "license": "MIT", - "repository": "algolia/documentationsearch.js", + "repository": "algolia/docsearch.js", "devDependencies": { "autoprefixer": "^6.1.2", "babel": "^5.8.29", @@ -31,9 +32,10 @@ "eslint": "^1.6.0", "eslint-config-airbnb": "^0.1.0", "eslint-config-algolia": "^4.2.0", + "eslint-plugin-algolia": "^1.5.0", "eslint-plugin-react": "^3.5.1", "expect": "^1.13.0", - "gh-pages": "^0.5.0", + "gh-pages": "^0.8.0", "jsdom": "^7.1.1", "json": "^9.0.3", "mocha": "^2.3.4", @@ -51,8 +53,9 @@ "peerDependencies": {}, "dependencies": { "algoliasearch": "^3.9.2", - "autocomplete.js": "^0.14.1", + "autocomplete.js": "^0.16.0", "hogan.js": "^3.0.2", + "npm-zepto": "^1.1.7", "to-factory": "^1.0.0" } } diff --git a/scripts/build-css b/scripts/build-css index 0f2c8ce7..913cdbee 100755 --- a/scripts/build-css +++ b/scripts/build-css @@ -3,8 +3,8 @@ set -e # exit when error VERSION=$(json version < package.json) -NAME='docsearch' -LICENSE="/*! ${NAME} ${VERSION:-UNRELEASED} | © Algolia | github.com/algolia/docsearch */" +NAME='docsearch.js' +LICENSE="/*! ${NAME} ${VERSION:-UNRELEASED} | © Algolia | github.com/algolia/docsearch.js */" DIST_DIR="dist/cdn" DIST_FILE="$DIST_DIR/${NAME}.css" DIST_FILE_MIN="$DIST_DIR/${NAME}.min.css" diff --git a/scripts/build-js b/scripts/build-js index 17f4f186..2280168a 100755 --- a/scripts/build-js +++ b/scripts/build-js @@ -3,8 +3,8 @@ set -e # exit when error VERSION=$(json version < package.json) -NAME='docsearch' -LICENSE="/*! ${NAME} ${VERSION:-UNRELEASED} | © Algolia | github.com/algolia/docsearch */" +NAME='docsearch.js' +LICENSE="/*! ${NAME} ${VERSION:-UNRELEASED} | © Algolia | github.com/algolia/docsearch.js */" DIST_DIR_CDN="dist/cdn" DIST_DIR_NPM="dist/npm" DIST_FILE="$DIST_DIR_CDN/${NAME}.js" diff --git a/scripts/dev b/scripts/dev index 0b38b0a4..2904dc2f 100755 --- a/scripts/dev +++ b/scripts/dev @@ -12,5 +12,3 @@ webpack-dev-server \ onchange './src/styles/*.scss' -- npm run build:css & \ wait - - diff --git a/scripts/dev-docs b/scripts/dev-docs new file mode 100755 index 00000000..af095f61 --- /dev/null +++ b/scripts/dev-docs @@ -0,0 +1,9 @@ +#!/usr/bin/env bash + +set -ev # exit when error + +cd docs && \ +bundle install && \ +bundle exec guard -i & \ +npm run dev & \ +wait