Skip to content

Commit

Permalink
Added npm deployment and basic usage
Browse files Browse the repository at this point in the history
  • Loading branch information
leocabeza committed Nov 17, 2018
1 parent 8f25620 commit 3cf15bf
Show file tree
Hide file tree
Showing 4 changed files with 170 additions and 11 deletions.
14 changes: 12 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,18 @@ cache:
- node_modules
node_js:
- "10"
script:
- npm run check-coverage
- npm run build
after_success:
- npm run coverage
- npm run report-coverage
- npm run publish
branches:
only:
- master
- master
deploy:
provider: npm
api_key: $NPM_TOKEN
on:
branch: master
tags: true
35 changes: 32 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,50 @@
![Travis (.org)](https://img.shields.io/travis/leocabeza/the-movie-db.svg?style=popout)
![Codecov](https://img.shields.io/codecov/c/github/leocabeza/the-movie-db.svg?style=popout)

# the-movie-db
# @leonardocabeza/the-movie-db

Promised based Javascript API wrapper for [https://www.themoviedb.org/](https://www.themoviedb.org/) that works in the browser and node.js.

## Installation

This package is distributed via npm:

```
npm install @leonardocabeza/the-movie-db
```

## Usage

First, get an API key here: [https://www.themoviedb.org/faq/api](https://www.themoviedb.org/faq/api)

```javascript
var TheMovieDb = require('@leonardocabeza/the-movie-db');

var client = new TheMovieDb('HERE_GOES_YOUR_API_KEY');

client.movies.popular()
.then((data) => {
// handle data
})
.catch((error) => {
// handle error
});
```
## To use it in a web browser

`<script crossorigin src="https://unpkg.com/the-movie-db@latest/dist/the-movie-db.js"></script>`

## Disclaimer

This is a work in progress, DO NOT USE in production just yet.

## Promises

the-movie-db depends on a native ES6 Promise implementation to be [supported](http://caniuse.com/promises).
`@leonardocabeza/the-movie-db` depends on a native ES6 Promise implementation to be [supported](http://caniuse.com/promises).
If your environment doesn't support ES6 Promises, you can [polyfill](https://github.com/jakearchibald/es6-promise).

## About

This product uses the TMDb API but is not endorsed or certified by TMDb.

![TMDb](https://www.themoviedb.org/static_cache/v4/logos/powered-by-rectangle-blue-61ce76f69ce1e4f68a6031d975df16cc184d5f04fa7f9f58ae6412646f2481c1.svg)
![TMDb](https://www.themoviedb.org/assets/1/v4/logos/powered-by-rectangle-blue-61ce76f69ce1e4f68a6031d975df16cc184d5f04fa7f9f58ae6412646f2481c1.svg)
110 changes: 110 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

22 changes: 16 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "themoviedb",
"name": "@leonardocabeza/the-movie-db",
"version": "1.0.0",
"description": "",
"description": "Promised based Javascript API wrapper for https://www.themoviedb.org/ that works in the browser and nodejs",
"main": "dist/the-movie-db.js",
"dependencies": {
"axios": "^0.18.0"
Expand All @@ -18,6 +18,7 @@
"jest": "^23.6.0",
"lint-staged": "^7.3.0",
"nodemon-webpack-plugin": "^4.0.3",
"npm-run-all": "^4.1.3",
"prettier": "1.15.2",
"webpack": "^4.25.1",
"webpack-cli": "^3.1.2"
Expand All @@ -29,7 +30,12 @@
"dev": "webpack --mode development",
"dev:watch": "npm run build -- --watch",
"build": "webpack --mode production",
"coverage": "npm run test -- --coverage && codecov"
"codecov": "codecov",
"lint-staged": "lint-staged",
"check-coverage": "npm run test -- --coverage",
"report-coverage": "npm-run-all -s check-coverage codecov",
"pre-commit": "npm-run-all -s check-coverage lint-staged",
"publish": "npm publish --access=public"
},
"lint-staged": {
"src/**/*.js": [
Expand Down Expand Up @@ -60,15 +66,19 @@
},
"husky": {
"hooks": {
"pre-commit": "npm test && lint-staged",
"pre-push": "npm test"
"pre-commit": "npm run pre-commit",
"pre-push": "npm run test"
}
},
"prettier": {
"singleQuote": true,
"trailingComma": "es5"
},
"keywords": ["javascript api wrapper", "tmdb", "the-movie-db"],
"keywords": [
"javascript api wrapper",
"tmdb",
"the-movie-db"
],
"author": {
"name": "Leonardo Cabeza",
"email": "[email protected]",
Expand Down

0 comments on commit 3cf15bf

Please sign in to comment.