Comparing version 0.1.2 to 0.1.3
{ | ||
"name": "cf-redis", | ||
"version": "0.1.2", | ||
"version": "0.1.3", | ||
"description": "A tiny library to map Contentful ☁️ space into Redis ⚡️", | ||
"main": "index.js", | ||
"main": "src/index.js", | ||
"scripts": { | ||
"test": "mocha --exit" | ||
"test": "mocha --exit", | ||
"precommit": "lint-staged" | ||
}, | ||
"lint-staged": { | ||
"*.js": ["eslint", "prettier --write", "git add"] | ||
}, | ||
"engines": { | ||
"node": ">=8.6.0" | ||
}, | ||
"dependencies": { | ||
@@ -15,3 +22,10 @@ "contentful": "^5.1.3", | ||
"chai": "^4.1.2", | ||
"mocha": "^5.0.4" | ||
"eslint": "^4.19.0", | ||
"eslint-config-airbnb-base": "^12.1.0", | ||
"eslint-config-prettier": "^2.9.0", | ||
"eslint-plugin-import": "^2.9.0", | ||
"husky": "^0.14.3", | ||
"lint-staged": "^7.0.0", | ||
"mocha": "^5.0.4", | ||
"prettier": "^1.11.1" | ||
}, | ||
@@ -18,0 +32,0 @@ "repository": { |
@@ -8,2 +8,3 @@ <div align="center"> | ||
A tiny library to map Contentful ☁️ space into Redis ⚡️ | ||
</div> | ||
@@ -18,2 +19,3 @@ | ||
## Usage | ||
--- | ||
@@ -24,7 +26,7 @@ | ||
```js | ||
import cfRedis from "cf-redis"; | ||
import cfRedis from 'cf-redis'; | ||
const client = new cfRedis({ | ||
space: "<Space ID>", | ||
accessToken: "<Access Token>" | ||
space: '<Space ID>', | ||
accessToken: '<Access Token>', | ||
}); | ||
@@ -34,5 +36,9 @@ ``` | ||
## API | ||
--- | ||
### sync | ||
Syncs the latest space content from Contentful and dumps it in your Redis server 🎉 | ||
```js | ||
@@ -43,3 +49,5 @@ await client.sync(); | ||
### get | ||
Gets all data directly from Redis 🚀 | ||
```js | ||
@@ -50,3 +58,10 @@ const response = await client.get(); | ||
You can also pass specific content type. | ||
```js | ||
const response = await client.get('about'); | ||
``` | ||
You'll get an object with your content type ID's as keys and their values as array of content objects. | ||
```js | ||
@@ -58,9 +73,13 @@ { | ||
``` | ||
--- | ||
## Redis Store | ||
> In Redis, the keys (content types) will be prefixed with cf-redis to uniquely identify keys created by cf-redis 🤓 | ||
--- | ||
## License | ||
MIT ❤ | ||
MIT ❤ |
@@ -1,22 +0,22 @@ | ||
const { expect } = require("chai"); | ||
const CFRedis = require("../index.js"); | ||
const { expect } = require('chai'); | ||
const CFRedis = require('../src/index.js'); | ||
describe("cf-redis", () => { | ||
describe('cf-redis', () => { | ||
const client = new CFRedis({ | ||
space: "space id", | ||
accessToken: "token" | ||
space: 'space id', | ||
accessToken: 'token', | ||
}); | ||
it("creats an instance", () => { | ||
it('creats an instance', () => { | ||
expect(client).to.be.an.instanceof(CFRedis); | ||
}); | ||
describe("api", () => { | ||
it("should have a sync method", () => { | ||
expect(client.sync).to.be.a("function"); | ||
describe('api', () => { | ||
it('should have a sync method', () => { | ||
expect(client.sync).to.be.a('function'); | ||
}); | ||
it("should have a get method", () => { | ||
expect(client.get).to.be.a("function"); | ||
it('should have a get method', () => { | ||
expect(client.get).to.be.a('function'); | ||
}); | ||
}); | ||
}); |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
6630
8
95
79
9