chore(packages/ui turbo gen config.ts): Preventing the format of pack… (#8033)

…age.json from being corrupted

### Description

Prevent the format of `package.json` from getting corrupted when
creating a component with `turbo gen`.

Here's what the exports section looks like before and after the fix:

before

```
  "exports": {
"./foo": "./src/foo.tsx",
    "./button": "./src/button.tsx",
    "./card": "./src/card.tsx",
    "./code": "./src/code.tsx"
  },
```

after

```
  "exports": {
    "./foo": "./src/foo.tsx",
    "./button": "./src/button.tsx",
    "./card": "./src/card.tsx",
    "./code": "./src/code.tsx"
  },
```

### Testing Instructions

1. Create a component with `turbo gen`.
2. Check package.json.

Co-authored-by: Anthony Shew <anthony.shew@vercel.com>
This commit is contained in:
Ren Adachi 2024-06-16 08:17:18 +09:00 committed by GitHub
parent 131cb0813b
commit 4eecd25f23
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -23,7 +23,7 @@ export default function generator(plop: PlopTypes.NodePlopAPI): void {
type: "append",
path: "package.json",
pattern: /"exports": {(?<insertion>)/g,
template: '"./{{kebabCase name}}": "./src/{{kebabCase name}}.tsx",',
template: ' "./{{kebabCase name}}": "./src/{{kebabCase name}}.tsx",',
},
],
});