Skip to content
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

Fix widget build script #112

Merged
merged 1 commit into from
Feb 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading