generate-react-cli 8.4.4 → 8.4.5
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.
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "generate-react-cli",
|
|
3
|
-
"version": "8.4.
|
|
3
|
+
"version": "8.4.5",
|
|
4
4
|
"description": "A simple React CLI to generate components instantly and more.",
|
|
5
5
|
"repository": "https://github.com/arminbro/generate-react-cli",
|
|
6
6
|
"bugs": "https://github.com/arminbro/generate-react-cli/issues",
|
|
@@ -154,7 +154,7 @@ function componentTemplateGenerator({ cmd, componentName, cliConfigFile, convert
|
|
|
154
154
|
// --- If test library is not Testing Library or if withTest is false. Remove data-testid from template
|
|
155
155
|
|
|
156
156
|
if (testLibrary !== 'Testing Library' || !cmd.withTest) {
|
|
157
|
-
template = template.replace(` data-testid="
|
|
157
|
+
template = template.replace(` data-testid="templatename"`, '');
|
|
158
158
|
}
|
|
159
159
|
|
|
160
160
|
// --- If it has a corresponding stylesheet
|
|
@@ -163,12 +163,12 @@ function componentTemplateGenerator({ cmd, componentName, cliConfigFile, convert
|
|
|
163
163
|
if (cliConfigFile.usesStyledComponents) {
|
|
164
164
|
const cssPath = `${componentName}.styled`;
|
|
165
165
|
template = template.replace(
|
|
166
|
-
`import styles from './
|
|
167
|
-
`import {
|
|
166
|
+
`import styles from './templatename.module.css'`,
|
|
167
|
+
`import { templatenameWrapper } from './${cssPath}'`
|
|
168
168
|
);
|
|
169
|
-
template = template.replace(` className={styles.
|
|
170
|
-
template = template.replace(` <div`, '<
|
|
171
|
-
template = template.replace(` </div>`, '</
|
|
169
|
+
template = template.replace(` className={styles.templatename}`, '');
|
|
170
|
+
template = template.replace(` <div`, '<templatenameWrapper');
|
|
171
|
+
template = template.replace(` </div>`, '</templatenameWrapper>');
|
|
172
172
|
} else {
|
|
173
173
|
const module = usesCssModule ? '.module' : '';
|
|
174
174
|
const cssPath = `${componentName}${module}.${cssPreprocessor}`;
|
|
@@ -176,17 +176,17 @@ function componentTemplateGenerator({ cmd, componentName, cliConfigFile, convert
|
|
|
176
176
|
// --- If the css module is true make sure to update the template accordingly
|
|
177
177
|
|
|
178
178
|
if (module.length) {
|
|
179
|
-
template = template.replace(`'./
|
|
179
|
+
template = template.replace(`'./templatename.module.css'`, `'./${cssPath}'`);
|
|
180
180
|
} else {
|
|
181
|
-
template = template.replace(`{styles.
|
|
182
|
-
template = template.replace(`styles from './
|
|
181
|
+
template = template.replace(`{styles.templatename}`, `"${componentName}"`);
|
|
182
|
+
template = template.replace(`styles from './templatename.module.css'`, `'./${cssPath}'`);
|
|
183
183
|
}
|
|
184
184
|
}
|
|
185
185
|
} else {
|
|
186
186
|
// --- If no stylesheet, remove className attribute and style import from jsTemplate
|
|
187
187
|
|
|
188
|
-
template = template.replace(` className={styles.
|
|
189
|
-
template = template.replace(`import styles from './
|
|
188
|
+
template = template.replace(` className={styles.templatename}`, '');
|
|
189
|
+
template = template.replace(`import styles from './templatename.module.css';`, '');
|
|
190
190
|
}
|
|
191
191
|
}
|
|
192
192
|
|