From 7589a51553d7c0b0b920e3a89ae2f81447666175 Mon Sep 17 00:00:00 2001 From: Raya Straus Date: Wed, 22 Sep 2021 10:35:20 +0300 Subject: [PATCH 1/2] update README --- README.md | 35 ++++------------------------------- 1 file changed, 4 insertions(+), 31 deletions(-) diff --git a/README.md b/README.md index afa0550f..2cee816c 100644 --- a/README.md +++ b/README.md @@ -8,9 +8,9 @@ Using this SDK, you can apply advanced transformations to your images and videos This SDK can also be used with [popular frontend frameworks](https://cloudinary.com/documentation/sdks/js/frontend-frameworks/index.html). ## Help & Examples -- {@tutorial gettingStarted} -- {@tutorial annotatedExamples} -- {@tutorial configuration} +- [Getting started](https://cloudinary.com/documentation/sdks/js/url-gen/tutorial-gettingStarted.html) +- [Annotated Code Examples](https://cloudinary.com/documentation/sdks/js/url-gen/tutorial-annotatedExamples.html) +- [Configuration](https://cloudinary.com/documentation/sdks/js/url-gen/tutorial-configuration_.html) ## Installation ```bash @@ -35,6 +35,7 @@ const cld = new Cloudinary({ // Let's create a new image const myImage = cld.image('sample'); + import {Resize} from '@cloudinary/url-gen/actions/resize'; myImage.resize(Resize.scale().width(100).height(100)); @@ -60,31 +61,3 @@ console.log(myURL); @cloudinary/url-gen is optimized around bundle size, as such we do not transpile our distributed modules, we leave the decision of what browsers to support, and what transpilations to apply, to you, the user. -### Testing with Jest - -As mentioned above, we're shipping @cloudinary/url-gen with ES6 code, as this provides great tree-shaking potential. -it also requires a few adjustments when testing. - -In jest.config, you'll need to add these lines to allow babel to transpile our code. -```json -{ - "transform": { - "node_modules/@cloudinary/url-gen": "babel-jest" - }, - "transformIgnorePatterns": ["/node_modules/(?!@cloudinary/url-gen)"] -} -``` -Make sure to install babel-jest: -`npm install babel-jest` - -You'll also need to ensure you have a babel.config.js file (and not a .babelrc), and that -it's configured properly to transpile code, - -*As an example*: -```js -module.exports = { - "presets": [ - "@babel/preset-env" - ] -}; -``` From 1257f26b79bd173c23f058a86c2eb715fa1115f2 Mon Sep 17 00:00:00 2001 From: Raya Straus Date: Wed, 22 Sep 2021 13:23:27 +0300 Subject: [PATCH 2/2] added hest testing instructions --- README.md | 30 +++++++++++++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 2cee816c..77f21732 100644 --- a/README.md +++ b/README.md @@ -35,8 +35,8 @@ const cld = new Cloudinary({ // Let's create a new image const myImage = cld.image('sample'); - import {Resize} from '@cloudinary/url-gen/actions/resize'; + myImage.resize(Resize.scale().width(100).height(100)); // When we're done, we can apply all our changes and create a URL. @@ -61,3 +61,31 @@ console.log(myURL); @cloudinary/url-gen is optimized around bundle size, as such we do not transpile our distributed modules, we leave the decision of what browsers to support, and what transpilations to apply, to you, the user. +### Testing with Jest + +As mentioned above, we're shipping @cloudinary/url-gen with ES6 code, as this provides great tree-shaking potential. +it also requires a few adjustments when testing. + +In jest.config, you'll need to add these lines to allow babel to transpile our code. +```json +{ + "transform": { + "node_modules/@cloudinary/url-gen": "babel-jest" + }, + "transformIgnorePatterns": ["/node_modules/(?!@cloudinary/url-gen)"] +} +``` +Make sure to install babel-jest: +`npm install babel-jest` + +You'll also need to ensure you have a babel.config.js file (and not a .babelrc), and that +it's configured properly to transpile code, + +*As an example*: +```js +module.exports = { + "presets": [ + "@babel/preset-env" + ] +}; +```