Skip to content

Commit

Permalink
fix: fix widget build script
Browse files Browse the repository at this point in the history
  • Loading branch information
UrazAkgultan committed Jan 24, 2024
1 parent 1c9fb11 commit 298d690
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": [
Expand Down
15 changes: 8 additions & 7 deletions scripts/widget/buildWidgets.js
Original file line number Diff line number Diff line change
Expand Up @@ -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}`);
Expand Down Expand Up @@ -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 });
Expand Down Expand Up @@ -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'`
Expand Down

0 comments on commit 298d690

Please sign in to comment.