From cf0b682040ec09cdbea3ce55cf08ee76b721d8ca Mon Sep 17 00:00:00 2001 From: Lukasz Ostafin Date: Thu, 17 Oct 2024 13:48:16 +0200 Subject: [PATCH 1/4] IBX-9109: Enabling TypeScript (ts-loader) with Webpack Encore --- ibexa/commerce/5.0/encore/ibexa.tsconfig.custom.json | 3 +++ ibexa/commerce/5.0/encore/ibexa.webpack.config.js | 3 +++ ibexa/commerce/5.0/encore/package.json | 11 ++++++++--- .../experience/5.0/encore/ibexa.tsconfig.custom.json | 3 +++ ibexa/experience/5.0/encore/ibexa.webpack.config.js | 3 +++ ibexa/experience/5.0/encore/package.json | 11 ++++++++--- ibexa/headless/5.0/encore/ibexa.tsconfig.custom.json | 3 +++ ibexa/headless/5.0/encore/ibexa.webpack.config.js | 3 +++ ibexa/headless/5.0/encore/package.json | 11 ++++++++++- ibexa/oss/5.0/encore/ibexa.tsconfig.custom.json | 3 +++ ibexa/oss/5.0/encore/ibexa.webpack.config.js | 3 +++ ibexa/oss/5.0/encore/package.json | 11 ++++++++++- 12 files changed, 60 insertions(+), 8 deletions(-) create mode 100644 ibexa/commerce/5.0/encore/ibexa.tsconfig.custom.json create mode 100644 ibexa/experience/5.0/encore/ibexa.tsconfig.custom.json create mode 100644 ibexa/headless/5.0/encore/ibexa.tsconfig.custom.json create mode 100644 ibexa/oss/5.0/encore/ibexa.tsconfig.custom.json diff --git a/ibexa/commerce/5.0/encore/ibexa.tsconfig.custom.json b/ibexa/commerce/5.0/encore/ibexa.tsconfig.custom.json new file mode 100644 index 00000000..158a991f --- /dev/null +++ b/ibexa/commerce/5.0/encore/ibexa.tsconfig.custom.json @@ -0,0 +1,3 @@ +{ + "extends": "@ibexa/ts-config" +} diff --git a/ibexa/commerce/5.0/encore/ibexa.webpack.config.js b/ibexa/commerce/5.0/encore/ibexa.webpack.config.js index 563e4731..0012e239 100644 --- a/ibexa/commerce/5.0/encore/ibexa.webpack.config.js +++ b/ibexa/commerce/5.0/encore/ibexa.webpack.config.js @@ -16,6 +16,9 @@ module.exports = (Encore) => { 'prop-types': 'PropTypes', }) .enableSassLoader() + .enableTypeScriptLoader((tsConfig) => { + tsConfig.configFile = path.resolve(__dirname, 'ibexa.tsconfig.custom.json'); + }) .enableReactPreset() .enableSingleRuntimeChunk(); diff --git a/ibexa/commerce/5.0/encore/package.json b/ibexa/commerce/5.0/encore/package.json index 8848a124..9506bfbd 100644 --- a/ibexa/commerce/5.0/encore/package.json +++ b/ibexa/commerce/5.0/encore/package.json @@ -21,11 +21,16 @@ "@ckeditor/ckeditor5-widget": "^40.1.0", "@ckeditor/ckeditor5-theme-lark": "^40.1.0", "@ckeditor/ckeditor5-code-block": "^40.1.0", - "@svgr/webpack": "^8.1.0" + "@svgr/webpack": "^8.1.0", + "ts-loader": "^9.5.1", + "@types/react": "^18.3.11", + "@types/react-dom": "^18.3.1", + "typescript": "^5.6.3", + "@ibexa/ts-config": "https://github.com/ibexa/ts-config-ibexa#IBX-9109-enabling-typescript" }, "dependencies": { - "react": "^18.2.0", - "react-dom": "^18.2.0" + "react": "^18.3.1", + "react-dom": "^18.3.1" }, "license": "UNLICENSED", "private": true, diff --git a/ibexa/experience/5.0/encore/ibexa.tsconfig.custom.json b/ibexa/experience/5.0/encore/ibexa.tsconfig.custom.json new file mode 100644 index 00000000..158a991f --- /dev/null +++ b/ibexa/experience/5.0/encore/ibexa.tsconfig.custom.json @@ -0,0 +1,3 @@ +{ + "extends": "@ibexa/ts-config" +} diff --git a/ibexa/experience/5.0/encore/ibexa.webpack.config.js b/ibexa/experience/5.0/encore/ibexa.webpack.config.js index 563e4731..0012e239 100644 --- a/ibexa/experience/5.0/encore/ibexa.webpack.config.js +++ b/ibexa/experience/5.0/encore/ibexa.webpack.config.js @@ -16,6 +16,9 @@ module.exports = (Encore) => { 'prop-types': 'PropTypes', }) .enableSassLoader() + .enableTypeScriptLoader((tsConfig) => { + tsConfig.configFile = path.resolve(__dirname, 'ibexa.tsconfig.custom.json'); + }) .enableReactPreset() .enableSingleRuntimeChunk(); diff --git a/ibexa/experience/5.0/encore/package.json b/ibexa/experience/5.0/encore/package.json index 8848a124..9506bfbd 100644 --- a/ibexa/experience/5.0/encore/package.json +++ b/ibexa/experience/5.0/encore/package.json @@ -21,11 +21,16 @@ "@ckeditor/ckeditor5-widget": "^40.1.0", "@ckeditor/ckeditor5-theme-lark": "^40.1.0", "@ckeditor/ckeditor5-code-block": "^40.1.0", - "@svgr/webpack": "^8.1.0" + "@svgr/webpack": "^8.1.0", + "ts-loader": "^9.5.1", + "@types/react": "^18.3.11", + "@types/react-dom": "^18.3.1", + "typescript": "^5.6.3", + "@ibexa/ts-config": "https://github.com/ibexa/ts-config-ibexa#IBX-9109-enabling-typescript" }, "dependencies": { - "react": "^18.2.0", - "react-dom": "^18.2.0" + "react": "^18.3.1", + "react-dom": "^18.3.1" }, "license": "UNLICENSED", "private": true, diff --git a/ibexa/headless/5.0/encore/ibexa.tsconfig.custom.json b/ibexa/headless/5.0/encore/ibexa.tsconfig.custom.json new file mode 100644 index 00000000..158a991f --- /dev/null +++ b/ibexa/headless/5.0/encore/ibexa.tsconfig.custom.json @@ -0,0 +1,3 @@ +{ + "extends": "@ibexa/ts-config" +} diff --git a/ibexa/headless/5.0/encore/ibexa.webpack.config.js b/ibexa/headless/5.0/encore/ibexa.webpack.config.js index 563e4731..0012e239 100644 --- a/ibexa/headless/5.0/encore/ibexa.webpack.config.js +++ b/ibexa/headless/5.0/encore/ibexa.webpack.config.js @@ -16,6 +16,9 @@ module.exports = (Encore) => { 'prop-types': 'PropTypes', }) .enableSassLoader() + .enableTypeScriptLoader((tsConfig) => { + tsConfig.configFile = path.resolve(__dirname, 'ibexa.tsconfig.custom.json'); + }) .enableReactPreset() .enableSingleRuntimeChunk(); diff --git a/ibexa/headless/5.0/encore/package.json b/ibexa/headless/5.0/encore/package.json index 45ab3163..9506bfbd 100644 --- a/ibexa/headless/5.0/encore/package.json +++ b/ibexa/headless/5.0/encore/package.json @@ -21,7 +21,16 @@ "@ckeditor/ckeditor5-widget": "^40.1.0", "@ckeditor/ckeditor5-theme-lark": "^40.1.0", "@ckeditor/ckeditor5-code-block": "^40.1.0", - "@svgr/webpack": "^8.1.0" + "@svgr/webpack": "^8.1.0", + "ts-loader": "^9.5.1", + "@types/react": "^18.3.11", + "@types/react-dom": "^18.3.1", + "typescript": "^5.6.3", + "@ibexa/ts-config": "https://github.com/ibexa/ts-config-ibexa#IBX-9109-enabling-typescript" + }, + "dependencies": { + "react": "^18.3.1", + "react-dom": "^18.3.1" }, "license": "UNLICENSED", "private": true, diff --git a/ibexa/oss/5.0/encore/ibexa.tsconfig.custom.json b/ibexa/oss/5.0/encore/ibexa.tsconfig.custom.json new file mode 100644 index 00000000..158a991f --- /dev/null +++ b/ibexa/oss/5.0/encore/ibexa.tsconfig.custom.json @@ -0,0 +1,3 @@ +{ + "extends": "@ibexa/ts-config" +} diff --git a/ibexa/oss/5.0/encore/ibexa.webpack.config.js b/ibexa/oss/5.0/encore/ibexa.webpack.config.js index 563e4731..0012e239 100644 --- a/ibexa/oss/5.0/encore/ibexa.webpack.config.js +++ b/ibexa/oss/5.0/encore/ibexa.webpack.config.js @@ -16,6 +16,9 @@ module.exports = (Encore) => { 'prop-types': 'PropTypes', }) .enableSassLoader() + .enableTypeScriptLoader((tsConfig) => { + tsConfig.configFile = path.resolve(__dirname, 'ibexa.tsconfig.custom.json'); + }) .enableReactPreset() .enableSingleRuntimeChunk(); diff --git a/ibexa/oss/5.0/encore/package.json b/ibexa/oss/5.0/encore/package.json index 8f805b68..a319c6a3 100644 --- a/ibexa/oss/5.0/encore/package.json +++ b/ibexa/oss/5.0/encore/package.json @@ -20,7 +20,16 @@ "@ckeditor/ckeditor5-widget": "^40.1.0", "@ckeditor/ckeditor5-theme-lark": "^40.1.0", "@ckeditor/ckeditor5-code-block": "^40.1.0", - "@svgr/webpack": "^8.1.0" + "@svgr/webpack": "^8.1.0", + "ts-loader": "^9.5.1", + "@types/react": "^18.3.11", + "@types/react-dom": "^18.3.1", + "typescript": "^5.6.3", + "@ibexa/ts-config": "https://github.com/ibexa/ts-config-ibexa#IBX-9109-enabling-typescript" + }, + "dependencies": { + "react": "^18.3.1", + "react-dom": "^18.3.1" }, "license": "UNLICENSED", "private": true, From 3896a257b5939a3f57f4a84a33a6e668aa342266 Mon Sep 17 00:00:00 2001 From: Lukasz Ostafin Date: Wed, 20 Nov 2024 14:01:23 +0100 Subject: [PATCH 2/4] After code review --- ibexa/oss/5.0/encore/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ibexa/oss/5.0/encore/package.json b/ibexa/oss/5.0/encore/package.json index a319c6a3..efba3469 100644 --- a/ibexa/oss/5.0/encore/package.json +++ b/ibexa/oss/5.0/encore/package.json @@ -21,7 +21,7 @@ "@ckeditor/ckeditor5-theme-lark": "^40.1.0", "@ckeditor/ckeditor5-code-block": "^40.1.0", "@svgr/webpack": "^8.1.0", - "ts-loader": "^9.5.1", + "ts-loader": "^9.5.1", "@types/react": "^18.3.11", "@types/react-dom": "^18.3.1", "typescript": "^5.6.3", From 20922a84521b49f70791ab6f10f22d94217cb781 Mon Sep 17 00:00:00 2001 From: Lukasz Ostafin Date: Thu, 21 Nov 2024 09:04:08 +0100 Subject: [PATCH 3/4] After CR --- .../encore/{ibexa.tsconfig.custom.json => ibexa.tsconfig.json} | 0 ibexa/commerce/5.0/encore/ibexa.webpack.config.js | 2 +- .../encore/{ibexa.tsconfig.custom.json => ibexa.tsconfig.json} | 0 ibexa/experience/5.0/encore/ibexa.webpack.config.js | 2 +- .../encore/{ibexa.tsconfig.custom.json => ibexa.tsconfig.json} | 0 ibexa/headless/5.0/encore/ibexa.webpack.config.js | 2 +- .../encore/{ibexa.tsconfig.custom.json => ibexa.tsconfig.json} | 0 ibexa/oss/5.0/encore/ibexa.webpack.config.js | 2 +- 8 files changed, 4 insertions(+), 4 deletions(-) rename ibexa/commerce/5.0/encore/{ibexa.tsconfig.custom.json => ibexa.tsconfig.json} (100%) rename ibexa/experience/5.0/encore/{ibexa.tsconfig.custom.json => ibexa.tsconfig.json} (100%) rename ibexa/headless/5.0/encore/{ibexa.tsconfig.custom.json => ibexa.tsconfig.json} (100%) rename ibexa/oss/5.0/encore/{ibexa.tsconfig.custom.json => ibexa.tsconfig.json} (100%) diff --git a/ibexa/commerce/5.0/encore/ibexa.tsconfig.custom.json b/ibexa/commerce/5.0/encore/ibexa.tsconfig.json similarity index 100% rename from ibexa/commerce/5.0/encore/ibexa.tsconfig.custom.json rename to ibexa/commerce/5.0/encore/ibexa.tsconfig.json diff --git a/ibexa/commerce/5.0/encore/ibexa.webpack.config.js b/ibexa/commerce/5.0/encore/ibexa.webpack.config.js index 0012e239..93daaf8b 100644 --- a/ibexa/commerce/5.0/encore/ibexa.webpack.config.js +++ b/ibexa/commerce/5.0/encore/ibexa.webpack.config.js @@ -17,7 +17,7 @@ module.exports = (Encore) => { }) .enableSassLoader() .enableTypeScriptLoader((tsConfig) => { - tsConfig.configFile = path.resolve(__dirname, 'ibexa.tsconfig.custom.json'); + tsConfig.configFile = path.resolve(__dirname, 'ibexa.tsconfig.json'); }) .enableReactPreset() .enableSingleRuntimeChunk(); diff --git a/ibexa/experience/5.0/encore/ibexa.tsconfig.custom.json b/ibexa/experience/5.0/encore/ibexa.tsconfig.json similarity index 100% rename from ibexa/experience/5.0/encore/ibexa.tsconfig.custom.json rename to ibexa/experience/5.0/encore/ibexa.tsconfig.json diff --git a/ibexa/experience/5.0/encore/ibexa.webpack.config.js b/ibexa/experience/5.0/encore/ibexa.webpack.config.js index 0012e239..93daaf8b 100644 --- a/ibexa/experience/5.0/encore/ibexa.webpack.config.js +++ b/ibexa/experience/5.0/encore/ibexa.webpack.config.js @@ -17,7 +17,7 @@ module.exports = (Encore) => { }) .enableSassLoader() .enableTypeScriptLoader((tsConfig) => { - tsConfig.configFile = path.resolve(__dirname, 'ibexa.tsconfig.custom.json'); + tsConfig.configFile = path.resolve(__dirname, 'ibexa.tsconfig.json'); }) .enableReactPreset() .enableSingleRuntimeChunk(); diff --git a/ibexa/headless/5.0/encore/ibexa.tsconfig.custom.json b/ibexa/headless/5.0/encore/ibexa.tsconfig.json similarity index 100% rename from ibexa/headless/5.0/encore/ibexa.tsconfig.custom.json rename to ibexa/headless/5.0/encore/ibexa.tsconfig.json diff --git a/ibexa/headless/5.0/encore/ibexa.webpack.config.js b/ibexa/headless/5.0/encore/ibexa.webpack.config.js index 0012e239..93daaf8b 100644 --- a/ibexa/headless/5.0/encore/ibexa.webpack.config.js +++ b/ibexa/headless/5.0/encore/ibexa.webpack.config.js @@ -17,7 +17,7 @@ module.exports = (Encore) => { }) .enableSassLoader() .enableTypeScriptLoader((tsConfig) => { - tsConfig.configFile = path.resolve(__dirname, 'ibexa.tsconfig.custom.json'); + tsConfig.configFile = path.resolve(__dirname, 'ibexa.tsconfig.json'); }) .enableReactPreset() .enableSingleRuntimeChunk(); diff --git a/ibexa/oss/5.0/encore/ibexa.tsconfig.custom.json b/ibexa/oss/5.0/encore/ibexa.tsconfig.json similarity index 100% rename from ibexa/oss/5.0/encore/ibexa.tsconfig.custom.json rename to ibexa/oss/5.0/encore/ibexa.tsconfig.json diff --git a/ibexa/oss/5.0/encore/ibexa.webpack.config.js b/ibexa/oss/5.0/encore/ibexa.webpack.config.js index 0012e239..93daaf8b 100644 --- a/ibexa/oss/5.0/encore/ibexa.webpack.config.js +++ b/ibexa/oss/5.0/encore/ibexa.webpack.config.js @@ -17,7 +17,7 @@ module.exports = (Encore) => { }) .enableSassLoader() .enableTypeScriptLoader((tsConfig) => { - tsConfig.configFile = path.resolve(__dirname, 'ibexa.tsconfig.custom.json'); + tsConfig.configFile = path.resolve(__dirname, 'ibexa.tsconfig.json'); }) .enableReactPreset() .enableSingleRuntimeChunk(); From 1b4c6fbc52d8b665229708528d5ae35abb612a5a Mon Sep 17 00:00:00 2001 From: Lukasz Ostafin Date: Mon, 9 Dec 2024 10:41:10 +0100 Subject: [PATCH 4/4] Update ts-config url --- ibexa/commerce/5.0/encore/package.json | 2 +- ibexa/experience/5.0/encore/package.json | 2 +- ibexa/headless/5.0/encore/package.json | 2 +- ibexa/oss/5.0/encore/package.json | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/ibexa/commerce/5.0/encore/package.json b/ibexa/commerce/5.0/encore/package.json index 9506bfbd..680dd62d 100644 --- a/ibexa/commerce/5.0/encore/package.json +++ b/ibexa/commerce/5.0/encore/package.json @@ -26,7 +26,7 @@ "@types/react": "^18.3.11", "@types/react-dom": "^18.3.1", "typescript": "^5.6.3", - "@ibexa/ts-config": "https://github.com/ibexa/ts-config-ibexa#IBX-9109-enabling-typescript" + "@ibexa/ts-config": "https://github.com/ibexa/ts-config-ibexa#~v1.0.0" }, "dependencies": { "react": "^18.3.1", diff --git a/ibexa/experience/5.0/encore/package.json b/ibexa/experience/5.0/encore/package.json index 9506bfbd..680dd62d 100644 --- a/ibexa/experience/5.0/encore/package.json +++ b/ibexa/experience/5.0/encore/package.json @@ -26,7 +26,7 @@ "@types/react": "^18.3.11", "@types/react-dom": "^18.3.1", "typescript": "^5.6.3", - "@ibexa/ts-config": "https://github.com/ibexa/ts-config-ibexa#IBX-9109-enabling-typescript" + "@ibexa/ts-config": "https://github.com/ibexa/ts-config-ibexa#~v1.0.0" }, "dependencies": { "react": "^18.3.1", diff --git a/ibexa/headless/5.0/encore/package.json b/ibexa/headless/5.0/encore/package.json index 9506bfbd..680dd62d 100644 --- a/ibexa/headless/5.0/encore/package.json +++ b/ibexa/headless/5.0/encore/package.json @@ -26,7 +26,7 @@ "@types/react": "^18.3.11", "@types/react-dom": "^18.3.1", "typescript": "^5.6.3", - "@ibexa/ts-config": "https://github.com/ibexa/ts-config-ibexa#IBX-9109-enabling-typescript" + "@ibexa/ts-config": "https://github.com/ibexa/ts-config-ibexa#~v1.0.0" }, "dependencies": { "react": "^18.3.1", diff --git a/ibexa/oss/5.0/encore/package.json b/ibexa/oss/5.0/encore/package.json index efba3469..88c1d7d6 100644 --- a/ibexa/oss/5.0/encore/package.json +++ b/ibexa/oss/5.0/encore/package.json @@ -25,7 +25,7 @@ "@types/react": "^18.3.11", "@types/react-dom": "^18.3.1", "typescript": "^5.6.3", - "@ibexa/ts-config": "https://github.com/ibexa/ts-config-ibexa#IBX-9109-enabling-typescript" + "@ibexa/ts-config": "https://github.com/ibexa/ts-config-ibexa#~v1.0.0" }, "dependencies": { "react": "^18.3.1",