-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix(codemods): FileuploaderAttachment codemods
- Renamed button-text codemods to fileuploader-prop-names - Updated test fixtures and tests - Updated README and CONTRIBUTING Fixing DS-1142
- Loading branch information
1 parent
9920fbf
commit 3568293
Showing
8 changed files
with
83 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
# Contributing | ||
|
||
## Table of Contents | ||
|
||
1. [Naming](#naming) | ||
2. [File Structure](#file-structure) | ||
3. [Testing](#testing) | ||
|
||
## Naming | ||
|
||
Codemods adhere to a clear and organized naming convention, following the kebab case format. The naming structure consists of two parts: | ||
|
||
<component-name>: Represents the specific component or root component. | ||
<purpose-of-codemod>: Describes the purpose or objective of the codemod. | ||
|
||
This naming convention ensures consistency and ease of understanding, facilitating seamless integration and maintenance of codemods within the project. | ||
|
||
### Example naming | ||
|
||
``` | ||
<component-name>-<purpose-of-codemod>.ts | ||
| | | ||
| └─⫸ Codemod purpose | ||
| | ||
└─⫸ Component name | ||
``` | ||
|
||
## File Structure | ||
|
||
The file structure below outlines a standard organization for codemods within the project: | ||
|
||
``` | ||
─── src | ||
└── transforms | ||
└── v2 | ||
└── web-react | ||
└── __testfixtures__ | ||
│ ├── <CodemodName>.input.tsx | ||
│ └── <CodemodName>.output.tsx | ||
└── __tests__ | ||
│ └── <CodemodName>.test.ts | ||
└── <CodemodName>.ts | ||
``` | ||
|
||
This structure enhances clarity and organization, making it easier to navigate and comprehend the components associated with each codemod. The separation of fixtures, tests, and the main codemod file contributes to a streamlined development and testing process. | ||
|
||
## Testing | ||
|
||
- `% cd <your-local-path>/spirit-design-system/packages/codemods` | ||
- `% yarn test` for test package (lint, format, unit testing, types) | ||
- `% yarn test:unit` for unit tests |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5 changes: 0 additions & 5 deletions
5
packages/codemods/src/transforms/v2/web-react/__testfixtures__/button-text.input.tsx
This file was deleted.
Oops, something went wrong.
5 changes: 0 additions & 5 deletions
5
packages/codemods/src/transforms/v2/web-react/__testfixtures__/button-text.output.tsx
This file was deleted.
Oops, something went wrong.
5 changes: 5 additions & 0 deletions
5
...s/codemods/src/transforms/v2/web-react/__testfixtures__/fileuploader-prop-names.input.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
import React from 'react'; | ||
// @ts-ignore: No declaration -- The library is not installed; we don't need to install it for fixtures. | ||
import { FileUploaderAttachment } from '@lmc-eu/spirit-web-react'; | ||
|
||
export const MyComponent = () => <FileUploaderAttachment buttonLabel="Remove me" editButtonLabel="Edit me" />; |
5 changes: 5 additions & 0 deletions
5
.../codemods/src/transforms/v2/web-react/__testfixtures__/fileuploader-prop-names.output.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
import React from 'react'; | ||
// @ts-ignore: No declaration -- The library is not installed; we don't need to install it for fixtures. | ||
import { FileUploaderAttachment } from '@lmc-eu/spirit-web-react'; | ||
|
||
export const MyComponent = () => <FileUploaderAttachment removeText="Remove me" editText="Edit me" />; |
2 changes: 1 addition & 1 deletion
2
...2/web-react/__tests__/button-text.test.ts → ...__tests__/fileuploader-prop-names.test.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters