jamespot-react-components 1.3.67 → 1.3.70
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/LICENSE +21 -0
- package/dist/jamespot-react-components.cjs +1132 -1008
- package/dist/jamespot-react-components.js +13773 -13130
- package/dist/src/components/Common/SkipToContent.d.ts +1 -1
- package/dist/src/components/Drives/MicrosoftGraph/MSGraphGroups.d.ts +1 -1
- package/dist/src/components/Drives/components/EntityItem.d.ts +2 -2
- package/dist/src/components/Drives/drive.style.d.ts +3 -3
- package/dist/src/components/Editors/components/Editor.style.d.ts +7 -7
- package/dist/src/components/Editors/components/EditorInput.d.ts +2 -1
- package/dist/src/components/Editors/components/EditorInputNumber.d.ts +3 -1
- package/dist/src/components/Form/Input/Common/JRCFormFieldRenderer.d.ts +1 -1
- package/dist/src/components/Form/Input/JRCInputCheckbox/JRCInputCheckbox.d.ts +2 -2
- package/dist/src/components/Form/Input/JRCInputCheckbox/components/CheckboxOrToggle.d.ts +2 -2
- package/dist/src/components/Form/Input/JRCInputColor/JRCInputColor.styles.d.ts +4 -4
- package/dist/src/components/Form/Input/JRCInputColor/JRCInputColorRaw.d.ts +5 -1
- package/dist/src/components/Form/Input/JRCInputDateTime/DayPickerStyle.d.ts +1 -1
- package/dist/src/components/Form/Input/JRCInputFileAdvanced/File.styles.d.ts +4 -4
- package/dist/src/components/Form/Input/JRCInputImage/JRCInputImage.styles.d.ts +8 -8
- package/dist/src/components/Form/Input/JRCInputImage/types.d.ts +1 -0
- package/dist/src/components/Form/Input/JRCInputText/JRCInputText.style.d.ts +5 -5
- package/dist/src/components/Form/Input/JRCInputTextRaw/JRCInputTextRaw.style.d.ts +4 -4
- package/dist/src/components/Form/Input/JRCSelect/JRCInputSelect.style.d.ts +23 -23
- package/dist/src/components/Form/Input/JRCStyledInput.d.ts +1 -1
- package/dist/src/components/JRCAlbum/styles.d.ts +11 -11
- package/dist/src/components/JRCAppHeader/JRCAppHeader.styles.d.ts +2 -2
- package/dist/src/components/JRCAppLeftColumn/JRCAppLeftColumn.styles.d.ts +14 -14
- package/dist/src/components/JRCButton/Button.d.ts +1 -1
- package/dist/src/components/JRCButtonDropdown/JRCButtonDropdown.d.ts +1 -1
- package/dist/src/components/JRCButtonDropdown/JRCButtonDropdown.styles.d.ts +3 -3
- package/dist/src/components/JRCCalendar/CalendarStyle.d.ts +1 -1
- package/dist/src/components/JRCCard/JRCCardImg.d.ts +1 -1
- package/dist/src/components/JRCCommentsBloc/AvatarWrapper.d.ts +1 -1
- package/dist/src/components/JRCDragNDrop/OneLevelMainDropzone.d.ts +3 -1
- package/dist/src/components/JRCDragNDrop/OneLevelStyles.d.ts +9 -9
- package/dist/src/components/JRCDragNDrop/styles.d.ts +25 -25
- package/dist/src/components/JRCFileViewer/JRCFileViewer.styles.d.ts +15 -15
- package/dist/src/components/JRCFlex/JRCFlexBox.d.ts +1 -1
- package/dist/src/components/JRCFolders/styles.d.ts +15 -15
- package/dist/src/components/JRCGifSelector/JRCGifSelector.d.ts +1 -1
- package/dist/src/components/JRCList/JRCList.styles.d.ts +7 -7
- package/dist/src/components/JRCModal/JRCModal.styles.d.ts +10 -10
- package/dist/src/components/JRCModalImg/JRCModalImg.styles.d.ts +7 -7
- package/dist/src/components/JRCModalUserList/CSSAvatarWrapper.d.ts +1 -1
- package/dist/src/components/JRCSidePanelModal/JRCSidePanelModal.styles.d.ts +5 -5
- package/dist/src/components/JRCSkeleton/JRCSkeletonSquare.d.ts +1 -1
- package/dist/src/components/JRCTabs/JRCTabs.d.ts +1 -1
- package/dist/src/components/JRCTypo/JRCTypo.d.ts +6 -6
- package/dist/src/components/JRCTypography/JRCTypography.styles.d.ts +1 -1
- package/dist/src/components/Stepper/JRCStepper.style.d.ts +2 -2
- package/dist/src/components/Templates/AppColumn.d.ts +1 -1
- package/dist/src/components/Templates/MainColumn.d.ts +1 -1
- package/dist/src/components/Templates/template.styles.d.ts +20 -20
- package/dist/src/components/Widgets/JRCWidgetAttachment/JRCWidgetAttachment.d.ts +1 -1
- package/dist/src/components/Widgets/JRCWidgetCalendarCalDav/styles.d.ts +5 -5
- package/dist/src/components/Widgets/JRCWidgetContactCardDav/styles.d.ts +4 -4
- package/dist/src/components/Widgets/JRCWidgetCover/JRCWidgetCover.d.ts +26 -0
- package/dist/src/components/Widgets/JRCWidgetCover/JRCWidgetCoverEditor.d.ts +11 -0
- package/dist/src/components/Widgets/JRCWidgetEmailsImap/styles.d.ts +6 -6
- package/dist/src/components/Widgets/JRCWidgetImage/styles.d.ts +1 -1
- package/dist/src/components/Widgets/JRCWidgetPresence/JRCWidgetPresence.styles.d.ts +5 -5
- package/dist/src/components/Widgets/JRCWidgetQuickSurvey/JRCWidgetQuickSurveyEditor.styles.d.ts +5 -5
- package/dist/src/components/Widgets/JRCWidgetTable/JRCWidgetDatasourceTableEditor.styles.d.ts +9 -9
- package/dist/src/components/Widgets/JRCWidgetTable/JRCWidgetTable.styles.d.ts +13 -13
- package/dist/src/components/Widgets/WidgetPanelTplWarning.d.ts +1 -1
- package/dist/src/components/Widgets/const.d.ts +20 -9
- package/dist/src/components/Widgets/styles.d.ts +9 -9
- package/dist/src/components/index.d.ts +2 -0
- package/dist/src/translation/lang.json.d.ts +23 -12
- package/jamespot-react-components@1.3.14 +0 -0
- package/package.json +3 -4
- package/vite +0 -0
- package/eslint.config.js +0 -102
- package/scripts/generate.ts +0 -121
|
@@ -279,6 +279,7 @@ declare const _default: {
|
|
|
279
279
|
"Office_No_Providers": "Aucun fournisseur disponible, contactez un administrateur",
|
|
280
280
|
"Office_Set_Configuration": "Connectez-vous",
|
|
281
281
|
"PANEL_Background_Color": "Couleur du fond",
|
|
282
|
+
"PANEL_Description": "Description",
|
|
282
283
|
"PANEL_Edit_Slide_Background_Color": "Background color",
|
|
283
284
|
"PANEL_Edit_Slide_Background_Opacity_Filter": "Background opacity filter",
|
|
284
285
|
"PANEL_Image_Size": "Taille de l'image",
|
|
@@ -289,6 +290,7 @@ declare const _default: {
|
|
|
289
290
|
"PANEL_Text_Color": "Couleur du texte",
|
|
290
291
|
"PANEL_Text_Size": "Taille du texte",
|
|
291
292
|
"PANEL_Widget_Empty_Setting": "Il n'y a rien à configurer",
|
|
293
|
+
"PANEL_Widget_Extension_Name": "Nom de l'extension",
|
|
292
294
|
"PANEL_Widget_Level": "Niveau d'affichage",
|
|
293
295
|
"PANEL_Widget_Synchronize": "Synchronisation",
|
|
294
296
|
"PANEL_Widget_Url": "Copier l'url du widget",
|
|
@@ -358,6 +360,16 @@ declare const _default: {
|
|
|
358
360
|
"WIDGET_Collaboration": "Collaboration",
|
|
359
361
|
"WIDGET_Contact_CardDav": "Office Contacts",
|
|
360
362
|
"WIDGET_Contacts": "Contacts",
|
|
363
|
+
"WIDGET_Cover_Add_Image_Button_Label": "Ajouter une image",
|
|
364
|
+
"WIDGET_Cover_Add_Button_Label": "Ajouter un bouton",
|
|
365
|
+
"WIDGET_Cover_Button_Background_Color_Label": "Couleur du bouton",
|
|
366
|
+
"WIDGET_Cover_Button_Default_Label": "Bouton",
|
|
367
|
+
"WIDGET_Cover_Button_Size_Label": "Taille",
|
|
368
|
+
"WIDGET_Cover_Button_Target_Label": "Ouverture",
|
|
369
|
+
"WIDGET_Cover_Filter_Color_Label": "Couleur du filtre",
|
|
370
|
+
"WIDGET_Cover_Filter_Opacity_Label": "Opacité du filtre",
|
|
371
|
+
"WIDGET_Cover_Link_Url_Label": "Url",
|
|
372
|
+
"WIDGET_Cover_Update_Image_Button_Label": "Modifier l'image",
|
|
361
373
|
"WIDGET_Datasource_Cancel": "Annuler",
|
|
362
374
|
"WIDGET_Datasource_Excel_Broken_Model": "Les premières cellules de vos colonnes ne peuvent pas être vide. Corrigez votre fichier pour mettre à jour votre widget. ",
|
|
363
375
|
"WIDGET_Datasource_Object": "Source de donnée",
|
|
@@ -400,6 +412,16 @@ declare const _default: {
|
|
|
400
412
|
"WIDGET_Survey_Close_Survey_Description": "do you really want to finish this survey?",
|
|
401
413
|
"WIDGET_Survey_Closing": "Enable closing",
|
|
402
414
|
"WIDGET_Survey_Closing_Help": "Display closing button",
|
|
415
|
+
"WIDGET_Survey_Date_Add_Event": "Ajouter",
|
|
416
|
+
"WIDGET_Survey_Date_Label": "{label} {day} à {time}",
|
|
417
|
+
"WIDGET_Survey_Date_Participant_At": "Participants le {date}",
|
|
418
|
+
"WIDGET_Survey_Date_Revive": "Relancer les participants",
|
|
419
|
+
"WIDGET_Survey_Date_Revive_All": "Tous les participants",
|
|
420
|
+
"WIDGET_Survey_Date_Revive_Message": "Message de relance",
|
|
421
|
+
"WIDGET_Survey_Date_Revive_Confirm": "Relancer",
|
|
422
|
+
"WIDGET_Survey_Date_Revive_User_With_No_Response": "Les participants sans réponse",
|
|
423
|
+
"WIDGET_Survey_Date_Stats": "{totalResponse}/{totalRespondents} personnes ont répondu ({percent}%)",
|
|
424
|
+
"WIDGET_Survey_Date_End_At": "Fin le {dateEnd}",
|
|
403
425
|
"WIDGET_Survey_Multiple": "Multiple response",
|
|
404
426
|
"WIDGET_Survey_Multiple_Help": "Allow multiple responses",
|
|
405
427
|
"WIDGET_Survey_Open": "Open survey",
|
|
@@ -418,18 +440,7 @@ declare const _default: {
|
|
|
418
440
|
"WIDGET_Welcome": "Message d'accueil",
|
|
419
441
|
"WIDGET_Welcome_Text": "Rendez vos pages plus personnelles en accueillant chaleureusement vos utilisateurs.",
|
|
420
442
|
"WIDGET_Welcome_Default_Message": "Bienvenue",
|
|
421
|
-
"WIDGET_Welcome_Linebreak_Label": "Saut de ligne (après le message)"
|
|
422
|
-
"WIDGET_Survey_Date_Add_Event": "Ajouter",
|
|
423
|
-
"WIDGET_Survey_Date_Label": "{label} {day} à {time}",
|
|
424
|
-
"WIDGET_Survey_Date_Participant_At": "Participants le {date}",
|
|
425
|
-
"WIDGET_Survey_Date_Revive": "Relancer les participants",
|
|
426
|
-
"WIDGET_Survey_Date_Revive_All": "Tous les participants",
|
|
427
|
-
"WIDGET_Survey_Date_Revive_Message": "Message de relance",
|
|
428
|
-
"WIDGET_Survey_Date_Revive_Confirm": "Relancer",
|
|
429
|
-
"WIDGET_Survey_Date_Revive_User_With_No_Response": "Les participants sans réponse",
|
|
430
|
-
"WIDGET_Survey_Date_Stats": "{totalResponse}/{totalRespondents} personnes ont répondu ({percent}%)",
|
|
431
|
-
"WIDGET_Survey_Date_End_At": "Fin le {dateEnd}",
|
|
432
|
-
"PANEL_Widget_Extension_Name": "Nom de l'extension"
|
|
443
|
+
"WIDGET_Welcome_Linebreak_Label": "Saut de ligne (après le message)"
|
|
433
444
|
}
|
|
434
445
|
}
|
|
435
446
|
;
|
|
File without changes
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "jamespot-react-components",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.70",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "dist/jamespot-react-components.cjs",
|
|
6
6
|
"module": "dist/jamespot-react-components.js",
|
|
@@ -78,9 +78,8 @@
|
|
|
78
78
|
"fork-ts-checker-webpack-plugin": "^9.1.0",
|
|
79
79
|
"globals": "^16.5.0",
|
|
80
80
|
"html2canvas": "^1.4.1",
|
|
81
|
-
"
|
|
82
|
-
"jamespot-
|
|
83
|
-
"jamespot-user-api": "^1.3.68",
|
|
81
|
+
"jamespot-front-business": "^1.3.70",
|
|
82
|
+
"jamespot-user-api": "^1.3.70",
|
|
84
83
|
"jest": "^30.2.0",
|
|
85
84
|
"jest-environment-jsdom": "^30.2.0",
|
|
86
85
|
"knip": "^5.82.1",
|
package/vite
ADDED
|
File without changes
|
package/eslint.config.js
DELETED
|
@@ -1,102 +0,0 @@
|
|
|
1
|
-
import js from '@eslint/js';
|
|
2
|
-
import prettierConfig from 'eslint-config-prettier';
|
|
3
|
-
import importPlugin from 'eslint-plugin-import';
|
|
4
|
-
import reactPlugin from 'eslint-plugin-react';
|
|
5
|
-
import reactHooksPlugin from 'eslint-plugin-react-hooks';
|
|
6
|
-
import storybookPlugin from 'eslint-plugin-storybook';
|
|
7
|
-
import globals from 'globals';
|
|
8
|
-
import ts from 'typescript-eslint';
|
|
9
|
-
import * as customPlugin from './eslint-plugin-custom/index.js';
|
|
10
|
-
|
|
11
|
-
export default [
|
|
12
|
-
{
|
|
13
|
-
ignores: ['coverage/**', 'dist/**', 'eslint-plugin-custom/**', 'eslint.config.js', 'node_modules/**'],
|
|
14
|
-
},
|
|
15
|
-
js.configs.recommended,
|
|
16
|
-
...ts.configs.recommended,
|
|
17
|
-
{
|
|
18
|
-
files: ['**/*.{ts,tsx}'],
|
|
19
|
-
languageOptions: {
|
|
20
|
-
parser: ts.parser,
|
|
21
|
-
globals: {
|
|
22
|
-
...globals.browser,
|
|
23
|
-
...globals.node,
|
|
24
|
-
...globals.jest,
|
|
25
|
-
},
|
|
26
|
-
parserOptions: {
|
|
27
|
-
project: ['./tsconfig.json', './.storybook/tsconfig.json'],
|
|
28
|
-
ecmaVersion: 2024,
|
|
29
|
-
sourceType: 'module',
|
|
30
|
-
},
|
|
31
|
-
},
|
|
32
|
-
plugins: {
|
|
33
|
-
'@typescript-eslint': ts.plugin,
|
|
34
|
-
react: reactPlugin,
|
|
35
|
-
'react-hooks': reactHooksPlugin,
|
|
36
|
-
storybook: storybookPlugin,
|
|
37
|
-
import: importPlugin,
|
|
38
|
-
custom: customPlugin,
|
|
39
|
-
},
|
|
40
|
-
rules: {
|
|
41
|
-
...ts.configs.recommended.rules,
|
|
42
|
-
...reactPlugin.configs.recommended.rules,
|
|
43
|
-
...reactHooksPlugin.configs.recommended.rules,
|
|
44
|
-
...storybookPlugin.configs.recommended.rules,
|
|
45
|
-
'custom/no-barrel-imports': 'error',
|
|
46
|
-
'import/no-duplicates': 'error',
|
|
47
|
-
'import/no-cycle': 'error',
|
|
48
|
-
'import/no-unresolved': 'error',
|
|
49
|
-
'no-console': ['error', { allow: ['warn', 'error'] }],
|
|
50
|
-
'no-restricted-imports': [
|
|
51
|
-
'error',
|
|
52
|
-
{
|
|
53
|
-
patterns: [
|
|
54
|
-
{
|
|
55
|
-
group: ['src/*'],
|
|
56
|
-
message: 'Use relative import (./ ou ../)',
|
|
57
|
-
},
|
|
58
|
-
],
|
|
59
|
-
},
|
|
60
|
-
],
|
|
61
|
-
'react/react-in-jsx-scope': 'off',
|
|
62
|
-
'react-hooks/refs': 'warn',
|
|
63
|
-
'react-hooks/set-state-in-effect': 'warn',
|
|
64
|
-
'@typescript-eslint/ban-ts-comment': [
|
|
65
|
-
'error',
|
|
66
|
-
{
|
|
67
|
-
'ts-ignore': 'allow-with-description',
|
|
68
|
-
},
|
|
69
|
-
],
|
|
70
|
-
'@typescript-eslint/ban-types': 'off',
|
|
71
|
-
'@typescript-eslint/no-empty-interface': 'off',
|
|
72
|
-
'@typescript-eslint/no-explicit-any': 'warn',
|
|
73
|
-
'@typescript-eslint/no-empty-object-type': 'warn',
|
|
74
|
-
'@typescript-eslint/no-namespace': 'off',
|
|
75
|
-
'@typescript-eslint/no-unused-expressions': 'error',
|
|
76
|
-
'@typescript-eslint/no-unused-vars': [
|
|
77
|
-
'error',
|
|
78
|
-
{
|
|
79
|
-
argsIgnorePattern: '^_',
|
|
80
|
-
varsIgnorePattern: '^_',
|
|
81
|
-
caughtErrorsIgnorePattern: '^_',
|
|
82
|
-
},
|
|
83
|
-
],
|
|
84
|
-
'@typescript-eslint/prefer-nullish-coalescing': 'error',
|
|
85
|
-
'@typescript-eslint/prefer-optional-chain': 'error',
|
|
86
|
-
'@typescript-eslint/prefer-as-const': 'error',
|
|
87
|
-
},
|
|
88
|
-
settings: {
|
|
89
|
-
react: {
|
|
90
|
-
version: 'detect',
|
|
91
|
-
jsxRuntime: 'automatic',
|
|
92
|
-
},
|
|
93
|
-
'import/resolver': {
|
|
94
|
-
typescript: {
|
|
95
|
-
alwaysTryTypes: true,
|
|
96
|
-
project: './tsconfig.json',
|
|
97
|
-
},
|
|
98
|
-
},
|
|
99
|
-
},
|
|
100
|
-
},
|
|
101
|
-
prettierConfig,
|
|
102
|
-
];
|
package/scripts/generate.ts
DELETED
|
@@ -1,121 +0,0 @@
|
|
|
1
|
-
/* eslint-disable no-console */
|
|
2
|
-
import fs from 'fs';
|
|
3
|
-
import path from 'path';
|
|
4
|
-
|
|
5
|
-
// Lightweight arg parsing
|
|
6
|
-
const args = process.argv.slice(2);
|
|
7
|
-
if (args.length < 2) {
|
|
8
|
-
console.error('Usage: npx tsx generate.ts <stories> <path-to-component>');
|
|
9
|
-
process.exit(1);
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
const mode = args[0];
|
|
13
|
-
const targetPath = args[1];
|
|
14
|
-
|
|
15
|
-
const OPENAI_API_KEY = process.env.OPENAI_API_KEY;
|
|
16
|
-
if (!OPENAI_API_KEY) {
|
|
17
|
-
console.error('Please set OPENAI_API_KEY in environment.');
|
|
18
|
-
process.exit(1);
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
const MODEL = process.env.OPENAI_MODEL ?? 'gpt-4o-mini';
|
|
22
|
-
|
|
23
|
-
function readFileOrThrow(p: string) {
|
|
24
|
-
try {
|
|
25
|
-
return fs.readFileSync(p, 'utf8');
|
|
26
|
-
} catch (err) {
|
|
27
|
-
console.error(`Cannot read file ${p}`, err);
|
|
28
|
-
process.exit(1);
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
async function callOpenAI(prompt: string) {
|
|
33
|
-
const body = {
|
|
34
|
-
model: MODEL,
|
|
35
|
-
messages: [{ role: 'user', content: prompt }],
|
|
36
|
-
temperature: 0.0,
|
|
37
|
-
max_tokens: 2000,
|
|
38
|
-
};
|
|
39
|
-
|
|
40
|
-
const res = await fetch('https://api.openai.com/v1/chat/completions', {
|
|
41
|
-
method: 'POST',
|
|
42
|
-
headers: {
|
|
43
|
-
'Content-Type': 'application/json',
|
|
44
|
-
Authorization: `Bearer ${OPENAI_API_KEY}`,
|
|
45
|
-
},
|
|
46
|
-
body: JSON.stringify(body),
|
|
47
|
-
});
|
|
48
|
-
|
|
49
|
-
if (!res.ok) {
|
|
50
|
-
const text = await res.text();
|
|
51
|
-
throw new Error(`OpenAI API error: ${res.status} ${text}`);
|
|
52
|
-
}
|
|
53
|
-
const json = await res.json();
|
|
54
|
-
return json.choices[0].message.content as string;
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
async function generateStoriesForComponent(componentFilePath: string, storiesFilePath?: string) {
|
|
58
|
-
const compText = readFileOrThrow(componentFilePath);
|
|
59
|
-
let prompt;
|
|
60
|
-
if (storiesFilePath && fs.existsSync(storiesFilePath)) {
|
|
61
|
-
const storiesText = readFileOrThrow(storiesFilePath);
|
|
62
|
-
prompt = `Tu es un assistant qui transforme des fichiers Storybook (.stories.tsx) et qui y ajoute des tests (play) pour un composant React.\n\n
|
|
63
|
-
Composant:\n\n
|
|
64
|
-
${compText}\n\n
|
|
65
|
-
Storybook Stories:\n\n
|
|
66
|
-
${storiesText}\n\n
|
|
67
|
-
Part du fichier de stories :\n
|
|
68
|
-
- Change les meta (pour rajouter le tags: ['testing'] et aussi changer le title basé sur le chemin avec comme prefix generate/),\n
|
|
69
|
-
- complete les stories s'il manque de la couverture de props clés,\n
|
|
70
|
-
- pour chaque story une fonction 'play' qui teste le comportement (getByRole/getByText, userEvent, expect),\n
|
|
71
|
-
- imports nécessaires (storybook/test, action, etc.),\n
|
|
72
|
-
- parameters: { mode: 'test' } pour les stories de test.\n\n
|
|
73
|
-
- le code/commentaire doivent être en anglais.\n\n
|
|
74
|
-
Fournis uniquement le contenu du fichier .stories.tsx sans explications sans zone de code "\`\`\`tsx" ton résultat doit pouvoir être sauvegarder dans le fichier directement sans transformation.`;
|
|
75
|
-
} else {
|
|
76
|
-
prompt = `Tu es un assistant qui génère des fichiers Storybook (.stories.tsx) avec tests (play) pour un composant React.\n\n
|
|
77
|
-
Composant:\n\n
|
|
78
|
-
${compText}\n\n
|
|
79
|
-
Génère un fichier .stories.tsx complet qui expose :\n
|
|
80
|
-
- un export default meta (title basé sur le chemin),\n
|
|
81
|
-
- au moins 2-4 stories pertinentes couvrant props clés (args),\n
|
|
82
|
-
- pour chaque story une fonction 'play' qui teste le comportement (getByRole/getByText, userEvent, expect),\n
|
|
83
|
-
- imports nécessaires (storybook/test, action, etc.),\n
|
|
84
|
-
- parameters: { mode: 'test' } pour les stories de test.\n\n
|
|
85
|
-
- le code/commentaire doivent être en anglais.\n\n
|
|
86
|
-
Fournis uniquement le contenu du fichier .stories.tsx sans explications sans zone de code "\`\`\`tsx" ton résultat doit pouvoir être sauvegarder dans le fichier directement sans transformation.`;
|
|
87
|
-
}
|
|
88
|
-
const storiesSampleText = readFileOrThrow('../src/components/JRCButton/JRCButton.stories.tsx');
|
|
89
|
-
prompt += `\n\n
|
|
90
|
-
Le fichier de stories doit être compatible avec Storybook 7.0 et React 18\n\n
|
|
91
|
-
Voici un exemple de fichier de stories qu'on souhaite:\n\n
|
|
92
|
-
${storiesSampleText}
|
|
93
|
-
`;
|
|
94
|
-
return await callOpenAI(prompt);
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
async function modeStories(componentFilePath: string) {
|
|
98
|
-
const abs = path.resolve(componentFilePath);
|
|
99
|
-
const dir = path.dirname(abs);
|
|
100
|
-
const base = path.basename(abs).replace(/\.tsx?$/, '');
|
|
101
|
-
const storiesFilePath = path.join(dir, `${base}.stories.tsx`);
|
|
102
|
-
|
|
103
|
-
console.log('Generating .stories.tsx for', abs);
|
|
104
|
-
const storiesText = await generateStoriesForComponent(componentFilePath, storiesFilePath);
|
|
105
|
-
|
|
106
|
-
fs.writeFileSync(storiesFilePath, storiesText, 'utf8');
|
|
107
|
-
console.log(`Wrote story file to ${storiesFilePath}`);
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
(async () => {
|
|
111
|
-
try {
|
|
112
|
-
if (mode === 'stories') await modeStories(targetPath);
|
|
113
|
-
else {
|
|
114
|
-
console.error('Unknown mode. Use `stories`');
|
|
115
|
-
process.exit(1);
|
|
116
|
-
}
|
|
117
|
-
} catch (err: any) {
|
|
118
|
-
console.error('Error:', err.message ?? err);
|
|
119
|
-
process.exit(1);
|
|
120
|
-
}
|
|
121
|
-
})();
|