@razorpay/blade 6.7.0 → 7.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,33 @@
1
+ import type { Transform } from 'jscodeshift';
2
+
3
+ const transformer: Transform = (file) => {
4
+ const map = {
5
+ s: 50,
6
+ m: 50,
7
+ l: 100,
8
+ xl: 200,
9
+ '2xl': 300,
10
+ '3xl': 400,
11
+ '4xl': 600,
12
+ '5xl': 700,
13
+ '6xl': 800,
14
+ };
15
+
16
+ const prefix = 'theme.typography.lineHeights';
17
+ const newSource = file.source.replace(
18
+ // gets both .s and ['2xl'] or ["2xl"]
19
+ /theme\.typography\.lineHeights\.?((\w+)|(\W.*\]))/g,
20
+ (originalString, match) => {
21
+ const token = match.replace(/\[|\]|'|"/g, '');
22
+ const replacement = map[token];
23
+ if (!replacement) {
24
+ return originalString;
25
+ }
26
+ return `${prefix}[${map[token]}]`;
27
+ },
28
+ );
29
+
30
+ return newSource;
31
+ };
32
+
33
+ export default transformer;
package/package.json CHANGED
@@ -1,17 +1,21 @@
1
1
  {
2
2
  "name": "@razorpay/blade",
3
3
  "description": "The Design System that powers Razorpay",
4
- "version": "6.7.0",
4
+ "version": "7.0.1",
5
5
  "license": "MIT",
6
6
  "engines": {
7
7
  "node": ">=14.18.0"
8
8
  },
9
+ "bin": {
10
+ "migrate-typography": "./codemods/migrate-typography/cli.js"
11
+ },
9
12
  "repository": {
10
13
  "type": "git",
11
14
  "url": "ssh://git@github.com/razorpay/blade.git"
12
15
  },
13
16
  "files": [
14
17
  "build",
18
+ "codemods",
15
19
  "components.d.ts",
16
20
  "components.js",
17
21
  "tokens.d.ts",
@@ -26,6 +30,7 @@
26
30
  "razorpay",
27
31
  "blade"
28
32
  ],
33
+ "main": "./build/components/index.web.js",
29
34
  "exports": {
30
35
  "./components": {
31
36
  "react-native": {
@@ -186,7 +191,10 @@
186
191
  "rollup-plugin-peer-deps-external": "2.2.4",
187
192
  "style-dictionary": "3.7.1",
188
193
  "styled-components": "5.3.5",
189
- "tsconfig-paths-webpack-plugin": "3.5.2"
194
+ "tsconfig-paths-webpack-plugin": "3.5.2",
195
+ "@types/jscodeshift": "0.11.6",
196
+ "args-parser": "1.3.0",
197
+ "jscodeshift": "0.13.1"
190
198
  },
191
199
  "peerDependencies": {
192
200
  "react": ">=17",