Skip to content
Merged
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
50 changes: 44 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,18 @@

This is a command-line util to upload Algolia sources. This idea comes from [atomic-algolia](https://github.com/chrisdmacrae/atomic-algolia).

## Install

```
npm install -D algolia-uploader
```

or

```
yarn add -D algolia-uploader
```

## Example

1. Make `.env` file and set params
Expand All @@ -13,8 +25,23 @@ This is a command-line util to upload Algolia sources. This idea comes from [ato
DATA_DIR=path/to/dir
```

| | Description |
| --------------------- | ------------------------------------------------------------------------------------- |
| ALGOLIA_APP_ID | ID of the app indexed in Algolia |
| ALGOLIA_ADMIN_API_KEY | API key that can update, delete and make indexes |
| ALGOLIA_INDEX_NAME | Name of index set inn Algolia |
| DATA_DIR | Relative path to the directory where the file you want to upload to Algolia is stored |

> [!IMPORTANT]
> Do not include the file name in `DATA_DIR`.

2. Make `example.json` to be uploaded to Algolia

> [!CAUTION]
>
> - Currently only json file is supported.
> - `objectID` key is necessary

```
[
{
Expand Down Expand Up @@ -50,21 +77,32 @@ This is a command-line util to upload Algolia sources. This idea comes from [ato
]
```

Cautions:
3. Execute command

- `objectID` is necessary
- For now, only one json file can be loaded, I will support multiple files(maybe)
For example,

3. Run `npx algolia-uploader` (WIP)
```
npx algolia-uploader
```

If this library is published, I will try to make it possible to do the following
```
npm run algolia-uploader
```

```
> npx algolia-uploader
yarn algolia-uploader
```

Then, the items will be uploaded.

```
> Added 3 items
> Updated 2 items
> Deleted 3 items

or

> No updates needed. All objects are up to date.
```

## Development
Expand Down