@mariolazzari/rijks
Advanced tools
Comparing version 0.0.7 to 0.0.8
{ | ||
"version": "0.0.7", | ||
"version": "0.0.8", | ||
"license": "MIT", | ||
@@ -4,0 +4,0 @@ "main": "dist/index.js", |
193
README.md
@@ -1,104 +0,181 @@ | ||
# Rijks Museum REST APIs client | ||
[![npm version](https://badge.fury.io/js/angular2-expandable-list.svg)](https://badge.fury.io/js/angular2-expandable-list) | ||
[![code style: prettier](https://img.shields.io/badge/code_style-prettier-ff69b4.svg?style=flat-square)](https://github.com/prettier/prettier) | ||
Congrats! You just saved yourself hours of work by bootstrapping this project with TSDX. Let’s get you oriented with what’s here and how to use it. | ||
# Rijks | ||
> This TSDX setup is meant for developing libraries (not apps!) that can be published to NPM. If you’re looking to build a Node app, you could use `ts-node-dev`, plain `ts-node`, or simple `tsc`. | ||
> Rijks museum APIs client | ||
> If you’re new to TypeScript, checkout [this handy cheatsheet](https://devhints.io/typescript) | ||
## Prerequisites | ||
## Commands | ||
Before you can use this wrapper or the API, you need a api-key. You can read more on how to obtain the API key and the parameters you can use from this page: [Rijks museum APIs](http://nodejs.org/) | ||
TSDX scaffolds your new library inside `/src`. | ||
This project requires NodeJS (version 18 or later) and NPM. | ||
[Node](http://nodejs.org/) and [NPM](https://npmjs.org/) are really easy to install. | ||
To make sure you have them available on your machine, | ||
try running the following command. | ||
To run TSDX, use: | ||
```sh | ||
$ npm -v && node -v | ||
6.4.1 | ||
v8.16.0 | ||
``` | ||
```bash | ||
npm start # or yarn start | ||
## Table of contents | ||
- [Rijks](#rijks) | ||
- [Prerequisites](#prerequisites) | ||
- [Table of contents](#table-of-contents) | ||
- [Getting Started](#getting-started) | ||
- [Installation](#installation) | ||
- [Usage](#usage) | ||
- [Serving the app](#serving-the-app) | ||
- [Running the tests](#running-the-tests) | ||
- [Building a distribution version](#building-a-distribution-version) | ||
- [API](#api) | ||
- [Rijks](#rijks-1) | ||
- [Options](#options) | ||
- [getCollection](#getcollection) | ||
- [getCollectionDetails](#getcollectiondetails) | ||
- [getCollectionImage](#getcollectionimage) | ||
- [Contributing](#contributing) | ||
- [Credits](#credits) | ||
- [Built With](#built-with) | ||
- [Versioning](#versioning) | ||
- [Authors](#authors) | ||
- [License](#license) | ||
## Getting Started | ||
These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system. | ||
## Installation | ||
**BEFORE YOU INSTALL:** please read the [prerequisites](#prerequisites) | ||
Start with cloning this repo on your local machine: | ||
```sh | ||
$ git clone https://github.com/mariolazzari/rijks.git | ||
$ cd rijks | ||
``` | ||
This builds to `/dist` and runs the project in watch mode so any edits you save inside `src` causes a rebuild to `/dist`. | ||
To install and set up the library, run: | ||
To do a one-off build, use `npm run build` or `yarn build`. | ||
```sh | ||
$ npm install @mariolazzari/rijks | ||
``` | ||
To run tests, use `npm test` or `yarn test`. | ||
Or if you prefer using Yarn: | ||
## Configuration | ||
```sh | ||
$ yarn add @mariolazzari/rijks | ||
``` | ||
Code quality is set up for you with `prettier`, `husky`, and `lint-staged`. Adjust the respective fields in `package.json` accordingly. | ||
## Usage | ||
### Jest | ||
### Serving the app | ||
Jest tests are set up to run with `npm test` or `yarn test`. | ||
```sh | ||
$ npm start | ||
``` | ||
### Bundle Analysis | ||
### Running the tests | ||
[`size-limit`](https://github.com/ai/size-limit) is set up to calculate the real cost of your library with `npm run size` and visualize the bundle with `npm run analyze`. | ||
```sh | ||
$ npm test | ||
``` | ||
#### Setup Files | ||
### Building a distribution version | ||
This is the folder structure we set up for you: | ||
```sh | ||
$ npm run build | ||
``` | ||
```txt | ||
/src | ||
index.tsx # EDIT THIS | ||
/test | ||
blah.test.tsx # EDIT THIS | ||
.gitignore | ||
package.json | ||
README.md # EDIT THIS | ||
tsconfig.json | ||
This task will create a distribution version of the project | ||
inside your local `dist/` folder | ||
## API | ||
### Rijks | ||
```js | ||
const rijks = new Rijks(apiKey: string, culture: Culture = "en") | ||
``` | ||
### Rollup | ||
Supported options for the `Rijks` class are listed below. | ||
TSDX uses [Rollup](https://rollupjs.org) as a bundler and generates multiple rollup configs for various module formats and build settings. See [Optimizations](#optimizations) for details. | ||
#### Options | ||
### TypeScript | ||
`apiKey` | ||
`tsconfig.json` is set up to interpret `dom` and `esnext` types, as well as `react` for `jsx`. Adjust according to your needs. | ||
| Type | Default value | | ||
| --- | --- | | ||
| string | '' | | ||
## Continuous Integration | ||
`culture` | ||
### GitHub Actions | ||
| Type | Default value | | ||
| --- | --- | | ||
| string | 'en' | | ||
Two actions are added by default: | ||
- `main` which installs deps w/ cache, lints, tests, and builds on all pushes against a Node and OS matrix | ||
- `size` which comments cost comparison of your library on every pull request using [`size-limit`](https://github.com/ai/size-limit) | ||
### getCollection | ||
## Optimizations | ||
```js | ||
const collection: CollectionResponse = await rijks.getCollection(params: CollectionRequest) | ||
``` | ||
Please see the main `tsdx` [optimizations docs](https://github.com/palmerhq/tsdx#optimizations). In particular, know that you can take advantage of development-only optimizations: | ||
Perform an asynchronous http request against Rijks collection api. | ||
### getCollectionDetails | ||
```js | ||
// ./types/index.d.ts | ||
declare var __DEV__: boolean; | ||
const collectionDetails: CollectionDetailsResponse= await rijks.getCollectionDetails(params:CollectionDetailsRequest) | ||
``` | ||
// inside your code... | ||
if (__DEV__) { | ||
console.log('foo'); | ||
} | ||
Perform an asynchronous http request against Rijks collection details api. | ||
### getCollectionImage | ||
```js | ||
const collectionImage: CollectionImageResponse = await rijks.getCollectionImage(params: CollectionImageRequest) | ||
``` | ||
You can also choose to install and use [invariant](https://github.com/palmerhq/tsdx#invariant) and [warning](https://github.com/palmerhq/tsdx#warning) functions. | ||
Perform an asynchronous http request against Rijks collection image api. | ||
## Module Formats | ||
CJS, ESModules, and UMD module formats are supported. | ||
## Contributing | ||
The appropriate paths are configured in `package.json` and `dist/index.js` accordingly. Please report if any issues are found. | ||
Please read [CONTRIBUTING.md](CONTRIBUTING.md) for details on our code of conduct, and the process for submitting pull requests to us. | ||
## Named Exports | ||
1. Fork it! | ||
2. Create your feature branch: `git checkout -b my-new-feature` | ||
3. Add your changes: `git add .` | ||
4. Commit your changes: `git commit -am 'Add some feature'` | ||
5. Push to the branch: `git push origin my-new-feature` | ||
6. Submit a pull request :sunglasses: | ||
Per Palmer Group guidelines, [always use named exports.](https://github.com/palmerhq/typescript#exports) Code split inside your React app instead of your React library. | ||
## Credits | ||
## Including Styles | ||
TODO: Write credits | ||
There are many ways to ship styles, including with CSS-in-JS. TSDX has no opinion on this, configure how you like. | ||
## Built With | ||
For vanilla CSS, you can include it at the root directory and add it to the `files` section in your `package.json`, so that it can be imported separately by your users and run through their bundler's loader. | ||
* Typescript | ||
* Visual Studio Code | ||
* Vitest | ||
## Publishing to NPM | ||
## Versioning | ||
We recommend using [np](https://github.com/sindresorhus/np). | ||
# rijks | ||
We use [SemVer](http://semver.org/) for versioning. For the versions available, see the [tags on this repository](https://github.com/mariolazzari/tags). | ||
## Authors | ||
* **Mario Lazzari** - *Initial work* - [mariolazzari](https://github.com/mariolazzari) | ||
See also the list of [contributors](https://github.com/mariolazzari/rijks/contributors) who participated in this project. | ||
## License | ||
[MIT License](https://andreasonny.mit-license.org/2019) |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
83793
181