stable
Clone or download
This contribution changes the way Typescript apps are built in Tuleap. Until now, the typechecking and the transpilation was entirely managed through ts-loader, we now split that into two distincts operations. This is needed because otherwise we end up doing the typechecking on a content that is already partilly processed. For example, that means that an like VueConstructor<V extends Vue> is resolved as VueConstructor<import('plugins/smthing/vue')> and the code we import from outside our app will be resolved in its own context so for example VueConstructor<import('core/smthing/vue')>. The type variable being different, the two interfaces become two distinct types and the usage of the code imported from outside our app becomes impossible. By splitting the transpilation and the typechecking we can use the best of both world. The transpilation can take advantages of the full Webpack pipeline and the typechecking is not bothered by half-processed source code (it's also closer to what IDEs display to developers). This approach is also interesting and we probably would have ended up using it anyway because it helps improving build performance: the typechecking and the transpilation can be done in parallel. The typechecking is limited to the context of the app we are building for two reasons (signatures of imported functions/methods are of course still used): * type conflicts in external dependencies: typechecking imported code means we need to have the two contexts (the one of the actual app and the one from where the code is imported) working together which can be tricky. For example, the type definitions of Node and RequireJS conflict. * performances: if a composant is used n times in different apps we would typecheck it n times. It is a waste of resources. In the present case, the code of vue-gettext-init is still typechecked when the tests are executed but this choice in a situation where we have untested code would result in a not typechecked and not tested code. With our current standards it is probably fine, code should not be written without tests. Also it is likely that in a close future we are going to be forced to transpile (and consequently we could typecheck it as well) our Typescript code so it can be used in our existing JS apps. vue-gettext has been updated in src/www/scripts/ so the type definition matches the one used by the taskboard and release widget applications. Part of story #13640 See minimal card display Change-Id: I54aad806ff093432521e828c43d585f6b46f063e
Modified Files
Name | ||||
---|---|---|---|---|
M | package-lock.json | +68 | −0 | Go to diff View file |
M | package.json | +1 | −0 | Go to diff View file |
M | plugins/release_widget/scripts/package-lock.json | +0 | −5 | Go to diff View file |
M | plugins/release_widget/scripts/package.json | +0 | −1 | Go to diff View file |
M | plugins/release_widget/scripts/releasewidget/index.ts | +6 | −13 | Go to diff View file |
R | plugins/release_widget/scripts/releasewidget/po/fr.po | Go to diff View file | ||
M | plugins/release_widget/scripts/releasewidget/src/components/App.test.ts | +12 | −15 | Go to diff View file |
M | plugins/release_widget/scripts/releasewidget/src/components/RoadmapSection/RoadmapSection.test.ts | +8 | −9 | Go to diff View file |
M | plugins/release_widget/scripts/releasewidget/src/components/WhatsHotSection/ReleaseBadges.test.ts | +20 | −21 | Go to diff View file |
M | plugins/release_widget/scripts/releasewidget/src/components/WhatsHotSection/ReleaseDescription/ReleaseDescription.test.ts | +8 | −10 | Go to diff View file |
M | plugins/release_widget/scripts/releasewidget/src/components/WhatsHotSection/ReleaseDescription/ReleaseDescriptionBadgesTracker.test.ts | +7 | −11 | Go to diff View file |
M | plugins/release_widget/scripts/releasewidget/src/components/WhatsHotSection/ReleaseDisplayer.test.ts | +8 | −10 | Go to diff View file |
M | plugins/release_widget/scripts/releasewidget/src/components/WhatsHotSection/ReleaseHeader/ReleaseHeader.test.ts | +12 | −13 | Go to diff View file |
M | plugins/release_widget/scripts/releasewidget/src/components/WhatsHotSection/ReleaseHeader/ReleaseHeaderRemainingDays.test.ts | +21 | −24 | Go to diff View file |
M | plugins/release_widget/scripts/releasewidget/src/components/WhatsHotSection/ReleaseHeader/ReleaseHeaderRemainingPoints.test.ts | +23 | −26 | Go to diff View file |
M | plugins/release_widget/scripts/releasewidget/src/components/WhatsHotSection/WhatsHotSection.test.ts | +10 | −11 | Go to diff View file |
M | plugins/release_widget/scripts/tsconfig.json | +1 | −1 | Go to diff View file |
M | plugins/release_widget/scripts/webpack.config.js | +5 | −1 | Go to diff View file |
M | plugins/taskboard/scripts/package-lock.json | +0 | −5 | Go to diff View file |
M | plugins/taskboard/scripts/package.json | +0 | −1 | Go to diff View file |
M | plugins/taskboard/scripts/taskboard/index.ts | +2 | −2 | Go to diff View file |
M | plugins/taskboard/scripts/taskboard/src/components/EmptyState/NoContentEmptyState.test.ts | +2 | −2 | Go to diff View file |
M | plugins/taskboard/scripts/taskboard/src/components/GlobalError/BoardWithoutAnyColumnsErrorForAdmin.test.ts | +2 | −2 | Go to diff View file |
M | plugins/taskboard/scripts/taskboard/src/components/GlobalError/BoardWithoutAnyColumnsErrorForUsers.test.ts | +2 | −2 | Go to diff View file |
M | plugins/taskboard/scripts/taskboard/src/components/TaskBoard/WrongColorPopover.test.ts | +2 | −2 | Go to diff View file |
M | plugins/taskboard/scripts/taskboard/src/components/UnderConstruction/UnderConstructionModal.test.ts | +14 | −12 | Go to diff View file |
M | plugins/taskboard/scripts/taskboard/src/helpers/local-vue-for-test.ts | +4 | −5 | Go to diff View file |
M | plugins/taskboard/scripts/webpack.common.js | +2 | −1 | Go to diff View file |
M | src/www/scripts/package-lock.json | +3 | −3 | Go to diff View file |
M | src/www/scripts/package.json | +1 | −1 | Go to diff View file |
R | plugins/taskboard/scripts/taskboard/src/helpers/vue-gettext-init.test.ts | Go to diff View file | ||
R | plugins/taskboard/scripts/taskboard/src/helpers/vue-gettext-init.ts | Go to diff View file | ||
M | tools/utils/scripts/webpack-configurator.js | +9 | −0 | Go to diff View file |
M | tools/utils/scripts/webpack-rule-configs.js | +2 | −1 | Go to diff View file |