Skip to content

Run prettier on the repository #25

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
113 changes: 66 additions & 47 deletions .code-generation/config.js
Original file line number Diff line number Diff line change
@@ -1,96 +1,115 @@
module.exports = {
"SDKSpecVersion": "master",
"langConfig": {
newInstanceSyntax: 'new #name(#req)#optional',
lang: 'Javascript',
methodDelimiter: '.',
groupDelimiter: '.',
openQualifiersChar: '',
closeQualifiersChar: '',
closeTransformationChar: '',
SDKSpecVersion: "master",
langConfig: {
newInstanceSyntax: "new #name(#req)#optional",
lang: "Javascript",
methodDelimiter: ".",
groupDelimiter: ".",
openQualifiersChar: "",
closeQualifiersChar: "",
closeTransformationChar: "",
hideActionGroups: true,
useSimpleQualifierValuesForGroups: ['Compass','AudioCodec','AnimatedFormat','ArtisticFilter','blendMode','Flag','FontStyle','FontAntialias','FontWeight','FontHinting','textAlignment','textDecoration', 'GradientDirection','ImproveMode','OutlineMode','Progressive','SimulateColorBlind','StreamingProfile'],
useSimpleQualifierValuesForGroups: [
"Compass",
"AudioCodec",
"AnimatedFormat",
"ArtisticFilter",
"blendMode",
"Flag",
"FontStyle",
"FontAntialias",
"FontWeight",
"FontHinting",
"textAlignment",
"textDecoration",
"GradientDirection",
"ImproveMode",
"OutlineMode",
"Progressive",
"SimulateColorBlind",
"StreamingProfile",
],
mainTransformationString: {
openSyntaxString: {
image: 'new CloudinaryImage(\'#publicID\')',
video: 'new CloudinaryVideo(\'#publicID\')',
media: 'new CloudinaryMedia(\'#publicID\')'
image: "new CloudinaryImage('#publicID')",
video: "new CloudinaryVideo('#publicID')",
media: "new CloudinaryMedia('#publicID')",
},
closeSyntaxString: ';'
closeSyntaxString: ";",
},
openActionChar: '(',
closeActionChar: ')',
overwritePreset: 'javascript',
arraySeparator: ', ',
arrayOpen: '[',
arrayClose: ']',
openActionChar: "(",
closeActionChar: ")",
overwritePreset: "javascript",
arraySeparator: ", ",
arrayOpen: "[",
arrayClose: "]",
prettier: {
parser: 'babel'
parser: "babel",
},
formats: {
formatClassOrEnum: 'PascalCase',
formatMethod: 'camelCase',
formatClassOrEnum: "PascalCase",
formatMethod: "camelCase",
formatFloat: (f) => {
if (!f.toString().includes('.')) {
return `'${f}.0'` // In JS world, 1.0 is 1, so we make sure 1.0 stays 1.0
if (!f.toString().includes(".")) {
return `'${f}.0'`; // In JS world, 1.0 is 1, so we make sure 1.0 stays 1.0
} else {
return f;
}
}
},
},
methodNameMap: {
'delivery_type': 'set_delivery_type',
'asset_type': 'set_asset_type',
'deliveryType': 'set_delivery_type',
'assetType': 'set_asset_type',
'signature': 'setSignature',
delivery_type: "set_delivery_type",
asset_type: "set_asset_type",
deliveryType: "set_delivery_type",
assetType: "set_asset_type",
signature: "setSignature",
},
canGenerateSignature:false,
canGenerateSignature: false,
classNameMap: {},
childTransformations: {
image: {
open: "new ImageTransformation()",
close: '',
close: "",
},
video: {
open: "new VideoTransformation()",
close: '',
close: "",
},
media: {
open: "new Transformation()",
close: '',
}
close: "",
},
},
unsupportedTxParams: ['fl_waveform', 'fl_animated', 'e_tint', 'e_theme', 'af_'],
unsupportedSyntaxList: ['.stroke(', '.textFit(', 'Animated.edit', '.RoundCorners(', 'getVideoFrame', '.transcode(']
unsupportedTxParams: ["fl_waveform", "fl_animated", "e_tint", "e_theme", "af_"],
unsupportedSyntaxList: [".stroke(", ".textFit(", "Animated.edit", ".RoundCorners(", "getVideoFrame", ".transcode("],
},
"overwrites": {
overwrites: {
qualifiers: {
// colorOverride is a qualifier of Reshape.trim action.
color_override: (payload) => {
const {qualifierDTO} = payload;
const { qualifierDTO } = payload;
const colorName = qualifierDTO.qualifiers[0].name;

// TODO this should be streamlined with how we deal with color.
return `.colorOverride("${colorName}")`
return `.colorOverride("${colorName}")`;
},
color: (payload) => {
const {qualifierDTO} = payload;
const { qualifierDTO } = payload;
// This case supports three types of qualifiers
// TODO this DTO structure needs to be aligned
// {name:color, is_required:true qualifiers: [{group:'color', name: 'red', is_required:true}]}
// {group:'color', name: 'red', is_required:true}
// {group:'color', name: 'rgb', qualifiers: [{ "name": "color", "value": "#d5d2ca", "is_required": true, "value_type": "string" }]}

let colorName;
if (qualifierDTO.qualifiers && qualifierDTO.name === 'rgb') {
if (qualifierDTO.qualifiers && qualifierDTO.name === "rgb") {
colorName = qualifierDTO.qualifiers[0].value;
} else {
colorName = qualifierDTO.qualifiers ? qualifierDTO.qualifiers[0].name : qualifierDTO.name;
}

return `'${colorName}'`;
}
}
}
}
},
},
},
};
41 changes: 19 additions & 22 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -1,14 +1,8 @@
{
"root": true,
"parser": "@typescript-eslint/parser",
"plugins": [
"@typescript-eslint",
"import"
],
"extends": [
"eslint:recommended",
"plugin:@typescript-eslint/recommended"
],
"plugins": ["@typescript-eslint", "import"],
"extends": ["eslint:recommended", "plugin:@typescript-eslint/recommended"],
"parserOptions": {
"ecmaVersion": 2018,
"sourceType": "module"
Expand All @@ -21,25 +15,28 @@
"rules": {
"require-jsdoc": "error",
"no-unused-vars": "warn",
"indent" : ["error", 2, { "SwitchCase": 1 }],
"dot-notation" : "error",
"no-param-reassign" : "error",
"no-unreachable" : "error",
"arrow-parens" : "error",
"one-var-declaration-per-line" : "error",
"indent": ["error", 2, { "SwitchCase": 1 }],
"dot-notation": "error",
"no-param-reassign": "error",
"no-unreachable": "error",
"arrow-parens": "error",
"one-var-declaration-per-line": "error",
"curly": "error",
"semi": "error",
"prefer-const": "error",
"vars-on-top" : "error",
"vars-on-top": "error",
"no-cond-assign": "error",
"@typescript-eslint/ban-ts-comment" : "warn",
"comma-spacing" : "error",
"no-multi-spaces" : "error",
"prefer-template" : "error",
"@typescript-eslint/ban-ts-comment": "warn",
"comma-spacing": "error",
"no-multi-spaces": "error",
"prefer-template": "error",
"import/extensions": [2, "ignorePackages"],
"max-nested-callbacks" : ["error",{
"max": 3
}],
"max-nested-callbacks": [
"error",
{
"max": 3
}
],
"@typescript-eslint/no-empty-interface": 0,
"@typescript-eslint/no-empty-function": 0
}
Expand Down
4 changes: 2 additions & 2 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
### Pull request for @cloudinary/transformation-builder-sdk


#### What does this PR solve?
... A few words

... A few words

#### Final checklist

- [ ] Implementation is aligned to Spec.
- [ ] Tests - Add proper tests to the added code.
4 changes: 4 additions & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"

npx lint-staged
3 changes: 3 additions & 0 deletions .prettierrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"printWidth": 120
}
4 changes: 2 additions & 2 deletions .release-it.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"out": ["package.json", "../package.json"]
}
},
"hooks" :{
"after:bump" : "git add .. -u"
"hooks": {
"after:bump": "git add .. -u"
}
}
55 changes: 20 additions & 35 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,73 +1,58 @@
1.2.10 / 2023-07-11
==================
# 1.2.10 / 2023-07-11

- Add support for Generative Fill background
- Adjust allowed Background Removal hints syntax

1.2.9 / 2023-06-06
==================
# 1.2.9 / 2023-06-06

- Default value for background removal fine edges option

1.2.8 / 2023-05-04
==================
# 1.2.8 / 2023-05-04

- Return nested transformation errors at the layer action level

1.2.7 / 2023-03-08
==================
# 1.2.7 / 2023-03-08

- Add missing focusOn named export

1.2.6 / 2023-02-22
==================
# 1.2.6 / 2023-02-22

- Border actionModel params compliant with transformation-model
- Border actionModel params compliant with transformation-model

1.2.5 / 2023-02-21
==================
# 1.2.5 / 2023-02-21

- Adjust border radius in from/toJson model
- Adjust border radius in from/toJson model

1.2.4 / 2023-02-20
==================
# 1.2.4 / 2023-02-20

- Align RoundCorners action with the specs

1.2.3 / 2023-02-03
==================
# 1.2.3 / 2023-02-03

- Add fromJson support to Opacity action

1.2.2 / 2023-02-03
==================
# 1.2.2 / 2023-02-03

- Fix opacity action (missing actionModel)

1.2.1 / 2023-01-31
==================
# 1.2.1 / 2023-01-31

- Updated default values of Drop Shadow action

1.2.0 / 2023-01-11
==================
# 1.2.0 / 2023-01-11

- Add DropShadow effect

1.1.0 / 2022-10-20
==================
# 1.1.0 / 2022-10-20

* Add Background Removal effect
* Add from/toJson for rotateByAngle Action
- Add Background Removal effect
- Add from/toJson for rotateByAngle Action

1.0.1 / 2022-09-13
==================
# 1.0.1 / 2022-09-13

* Fix broken prettier version
* Default length for the fade action
- Fix broken prettier version
- Default length for the fade action

1.0.0 / 2022-05-12
==================
# 1.0.0 / 2022-05-12

Release package

Loading