-
Notifications
You must be signed in to change notification settings - Fork 36
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add some type packages #2347
base: master
Are you sure you want to change the base?
Add some type packages #2347
Conversation
BundleMonUnchanged files (2)
No change in files bundle size Groups updated (1)
Final result: ✅ View report in BundleMon website ➡️ |
This seems to increase to size of the build significantly. Perhaps every type packages should be in |
package.json
Outdated
@@ -175,7 +175,7 @@ | |||
"react-pdf": "^4.0.5", | |||
"react-popper": "^2.2.3", | |||
"react-remove-scroll": "^2.4.0", | |||
"react-select": "^4.3.0", | |||
"react-select": "^5.4.0", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To be checked because there is a few BC in the lib, no? https://react-select.com/upgrade
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We may be impacted by the changes on ref
s since we indeed use one on ReactSelect
in SelectBox
to measure some height. Further investigation is needed for it. The remaining BCs look ok for us.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Quel besoin d'upgrade cette lib ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This brings types without needing to install a @types
package:
Convert to TypeScript - TypeScript types now come packaged with react-select so you no longer need to have @types/react-select installed; we no longer include Flow types
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
J'ai finalement retiré la montée de version de ce paquet et installé @types/react-select
, ça évite d'avoir à gérer le breaking change dans cette PR, et ça évite d'avoir à mettre à jour les snapshots.
@@ -7,14 +7,16 @@ import { isIOSApp } from 'cozy-device-helper' | |||
|
|||
import Icon from '../Icon' | |||
import CheckIcon from '../Icons/Check' | |||
import { dodgerBlue, silver, coolGrey, paleGrey } from '../palette' | |||
import palette from '../palette' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@PolariTOON are you sure that this is not this line that create this big impact on the bundle size?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We are already importing the palette in this way at other places and the file doesn't weight so much, thus i don't think so.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Est-ce que tu peux ajouter un peu de descriptif dans la PR pour resituer un peu le contexte de pourquoi cette PR stp ?
@@ -7,14 +7,16 @@ import { isIOSApp } from 'cozy-device-helper' | |||
|
|||
import Icon from '../Icon' | |||
import CheckIcon from '../Icons/Check' | |||
import { dodgerBlue, silver, coolGrey, paleGrey } from '../palette' | |||
import palette from '../palette' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
pourquoi ce changement ici ? Quel intérêt ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cf. #2347 (comment)
@@ -10,4 +10,4 @@ echo "Making icon sprite, output file : ${outfile}..." | |||
echo $icons | xargs yarn svgstore --inline -o /tmp/icons-sprite.svg | |||
echo "// GENERATED FILE, DO NOT EDIT THIS FILE BY HAND" > $outfile | |||
echo "// Use yarn sprite to regenerate" >> $outfile | |||
echo "module.exports = \``cat /tmp/icons-sprite.svg`\`" >> $outfile | |||
echo "export default \``cat /tmp/icons-sprite.svg`\`" >> $outfile |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
on s'est dit y'a quelques jours qu'on n'était pas chaud pour ces modifs, pourquoi le faire à nouveau maintenant ? 🤔
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pourquoi on n'est pas chaud de faire ce changement ? Ça va dans le bon sens, non ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@PolariTOON peux-tu retrouver la PR de référence stp ?
Cela posait des soucis il me semble au niveau des tests.
A part une écriture plus moderne, que cela apporte t-il de "mieux" ? 🤔 Y'a t-il un intérêt autre qu’esthétique ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
J'avais initialement proposé les changements ici : #2342 et on avait décidé de ne pas inclure ce commit (les commentaires ont disparu apparemment, sans doute dû au retrait du commit ?).
Effectivement ça posait un problème de test, parce que je n'avais pas fait attention que le fichier généré par make-palette.sh
exporte un type de valeur bien précis : un objet, qu'on importait soit directement (import palette from '../palette'
) soit en destructurant (import {...} from '../palette'
) selon l'endroit.
Quand on utilise la syntaxe ESM pour exporter quelque chose, on doit l'importer de la même manière. Donc si on utilise un export par défaut on doit faire un import par défaut, d'où le changement dans SelectBox
qui était le seul fichier à faire un import nommé jusque là.
Par rapport à l'intérêt, l'idée était juste d'avoir une base de code plus cohérente en terme de syntaxe et qu'ensuite TS puisse bien identifier les imports erronés.
docs/styleguide.config.js
Outdated
'../react/SwipeableDrawer', | ||
'../react/TextareaAutosize', | ||
'../react/Toolbar', | ||
'../react/Zoom' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
attention il me semble que certains fichier nécessitent l’extension car plusieurs fichiers index dans le dossier
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tu as des exemples ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Effectivement j'ai eu des soucis avec ça, mais le message d'erreur du styleguide n'est pas bien clair dont je n'ai pas identifié précisément où était le problème.
J'ai adapté ce commit pour conserver le /index
partout et juste retirer l'extension, car c'était plutôt ça l'objectif à la base.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
J'ai parlé trop vite. Je pensais que c'était réglé parce que je n'avais plus d'erreur, mais une fois une démo de la documentation déployée, je me suis rendu compte qu'elle était complètement cassée. Je retire le commit de cette PR, ça a l'air bien plus complexe que je ne le croyais.
package.json
Outdated
@@ -175,7 +175,7 @@ | |||
"react-pdf": "^4.0.5", | |||
"react-popper": "^2.2.3", | |||
"react-remove-scroll": "^2.4.0", | |||
"react-select": "^4.3.0", | |||
"react-select": "^5.4.0", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Quel besoin d'upgrade cette lib ?
8ea2d99
to
1684799
Compare
b54b9f7
to
691f24d
Compare
This mainly moves each hook, `Figure` and `FigureBlock` to a dedicated folder.
691f24d
to
937419f
Compare
This should be ready for a review (here's the demo link https://polaritoon.github.io/cozy-ui/react/ to show it builds the doc fine). |
This is kept as a draft, as this is not meant to be merged as is.
The changes are not needed to migrate to TypeScript, but should ease gradually renaming files from
*.js{x}
to*.ts{x}
.This also updates and adds some packages to get types on which to build upon to declare ours.
On another note, while exploring what could be done to migrate, I also faced another issue that is we are not able to import
*.styl
files from*.ts{x}
files apparently.This is not handled in this PR.
Demo link : https://polaritoon.github.io/cozy-ui/react/ (just to show it builds)