Skip to content

Commit

Permalink
[#1] Initial proof of concept.
Browse files Browse the repository at this point in the history
  • Loading branch information
Decipher committed Jul 13, 2020
1 parent 561cfd8 commit c494d7a
Show file tree
Hide file tree
Showing 15 changed files with 10,998 additions and 0 deletions.
12 changes: 12 additions & 0 deletions .babelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"presets": [
"@babel/preset-env"
],
"plugins": [
["@babel/plugin-transform-runtime",
{
"regenerator": true
}
]
]
}
71 changes: 71 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
version: 2

defaults: &defaults
working_directory: ~/repo
docker:
- image: circleci/node:8.9.1

jobs:
test:
<<: *defaults
steps:
- checkout

- run:
name: Install Codecov
command: npm install codecov

- restore_cache:
keys:
- v1-dependencies-{{ checksum "package.json" }}
# fallback to using the latest cache if no exact match is found.
- v1-dependencies-

- run: npm install
- run:
name: Build component
command: npm run build
- run:
name: Run tests
command: npm test

- run:
name: Upload coverage report
command: npx codecov

- save_cache:
paths:
- node_modules
key: v1-dependencies-{{ checksum "package.json" }}

- persist_to_workspace:
root: ~/repo
paths:
- .

deploy:
<<: *defaults
steps:
- attach_workspace:
at: ~/repo

- run:
name: Authenticate with registry
command: echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" > ~/repo/.npmrc

- run:
name: Publish package
command: npm publish

workflows:
version: 2

test_deploy:
jobs:
- test
- deploy:
requires:
- test
filters:
branches:
only: master
5 changes: 5 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
module.exports = {
extends: [
'plugin:vue/recommended'
]
}
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
coverage
dist
node_modules
.vscode
40 changes: 40 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# \<druxt-search />

[![CircleCI](https://circleci.com/gh/Realityloop/druxt-search.svg?style=svg)](https://circleci.com/gh/Realityloop/druxt-search)
[![Known Vulnerabilities](https://snyk.io/test/github/Realityloop/druxt-search/badge.svg?targetFile=package.json)](https://snyk.io/test/github/Realityloop/druxt-search?targetFile=package.json)
[![codecov](https://codecov.io/gh/Realityloop/druxt-search/branch/develop/graph/badge.svg)](https://codecov.io/gh/Realityloop/druxt-search)

Provides JSON API Search integration for a Druxt (DRUpal nuXT) project.

## Install

`$ npm install druxt-search`

## Usage

Add module to `nuxt.config.js`

```js
module.exports = {
modules: [
...
'druxt-router',
'druxt-search'
],

druxt: {
baseUrl: 'https://example.com'
}
}
```

## Options

### Base Druxt options

These options are available to all Druxt modules.

| Option | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| `axios` | `object` | No | `{}` | [Axios instance settings](https://github.com/axios/axios#axioscreateconfig). |
| `baseUrl` | `string` | Yes | `null` | Base URL for the Drupal installation. |
13 changes: 13 additions & 0 deletions nuxt/plugin.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import { DruxtSearch } from 'druxt-search'

export default (context, inject) => {
const baseUrl = '<%= options.baseUrl %>'
const options = {}

<% if (options.endpoint) { %>
options.endpoint = '<%= options.endpoint %>'
<% } %>

const druxtSearch = new DruxtSearch(baseUrl, options)
inject('druxtSearch', druxtSearch)
}
3 changes: 3 additions & 0 deletions nuxt/store.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import { DruxtSearchStore } from 'druxt-search'

export default DruxtSearchStore
Loading

0 comments on commit c494d7a

Please sign in to comment.