From 298d6909e14242dd859054a870f5ed79861fd977 Mon Sep 17 00:00:00 2001 From: Uraz Akgultan Date: Wed, 24 Jan 2024 23:16:03 +0100 Subject: [PATCH] fix: fix widget build script --- package.json | 2 +- scripts/widget/buildWidgets.js | 15 ++++++++------- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/package.json b/package.json index 769ffa032..670f89b5c 100644 --- a/package.json +++ b/package.json @@ -35,7 +35,7 @@ "setup-android": "node ./detox/scripts/setup-android.js", "setup-ios": "node ./detox/scripts/setup-ios.js", "patch-package": "./scripts/patch/patch-package.sh", - "build:widgets": "node ./scripts/buildWidgets.js" + "build:widgets": "node ./scripts/widget/buildWidgets.js" }, "workspaces": { "packages": [ diff --git a/scripts/widget/buildWidgets.js b/scripts/widget/buildWidgets.js index 188ef34b3..e4fab0a59 100644 --- a/scripts/widget/buildWidgets.js +++ b/scripts/widget/buildWidgets.js @@ -43,7 +43,7 @@ const deleteDistFolders = () => { } log.info("Deleting 'dist' folders in 'packages/pluggableWidgets/*'..."); - const distFolderPath = path.join(__dirname, "..", "packages", "pluggableWidgets"); + const distFolderPath = path.join(__dirname, "..", "..", "packages", "pluggableWidgets"); fs.readdir(distFolderPath, { withFileTypes: true }, (err, files) => { if (err) { log.error(`Error reading directories: ${err}`); @@ -101,8 +101,11 @@ const runYarnBuild = () => { const copyMPKFiles = () => { return new Promise((resolve, reject) => { log.info("Copying '.mpk' files to 'dist/pluggableWidgets'..."); - const widgetsFolderPath = path.join(__dirname, "..", "packages", "pluggableWidgets"); - const destinationFolderPath = path.join(__dirname, "..", "dist", "pluggableWidgets"); + const widgetsFolderPath = path.join(__dirname, "..", "..", "packages", "pluggableWidgets"); + const destinationFolderPath = path.join(__dirname, "..", "..", "dist", "pluggableWidgets"); + + console.log("widgetsFolderPath", widgetsFolderPath); + console.log("destinationFolderPath", destinationFolderPath); if (!fs.existsSync(destinationFolderPath)) { fs.mkdirSync(destinationFolderPath, { recursive: true }); @@ -138,10 +141,8 @@ const copyMPKFiles = () => { files.forEach(file => { if (path.extname(file) === ".mpk") { const sourceFile = path.join(mpkFolderPath, file); - const destinationFile = path.join( - destinationFolderPath, - widget.name + "_" + file - ); + const destinationFile = path.join(destinationFolderPath, file); + fs.copyFileSync(sourceFile, destinationFile); log.success( `Copied '${widget.name}/${file}' to 'dist/pluggableWidgets'`