From 0694e6d9128127cc3e17845f7618b90eeb0cd189 Mon Sep 17 00:00:00 2001 From: Jason Kraft Date: Mon, 28 Feb 2022 14:43:20 -0800 Subject: [PATCH] Fix yarn workspace issue on Windows with node script --- packages/backend/bindings/capacitor/package.json | 6 ++++-- packages/backend/bindings/capacitor/scripts/build.js | 7 +++++++ 2 files changed, 11 insertions(+), 2 deletions(-) create mode 100644 packages/backend/bindings/capacitor/scripts/build.js diff --git a/packages/backend/bindings/capacitor/package.json b/packages/backend/bindings/capacitor/package.json index a5f267fec1e..ba642a835af 100644 --- a/packages/backend/bindings/capacitor/package.json +++ b/packages/backend/bindings/capacitor/package.json @@ -17,11 +17,13 @@ "verify:ios": "cd ios && pod install && xcodebuild -workspace Plugin.xcworkspace -scheme Plugin && cd ..", "verify:android": "cd android && ./gradlew clean build test && cd ..", "verify:web": "npm run build", - "build": "npm run clean && tsc && rollup -c rollup.config.js", + "build": "node ./scripts/build.js", + "build:clean" : "rimraf ./dist", + "build:bundle": "tsc && rollup -c rollup.config.js", "clean": "rimraf ./dist", "watch": "tsc --watch", "prepublishOnly": "npm run build", - "preinstall": "npm run clean && npm run build" + "preinstall": "npm run build" }, "private": true, "repository": { diff --git a/packages/backend/bindings/capacitor/scripts/build.js b/packages/backend/bindings/capacitor/scripts/build.js new file mode 100644 index 00000000000..adc755c9ba6 --- /dev/null +++ b/packages/backend/bindings/capacitor/scripts/build.js @@ -0,0 +1,7 @@ +const { resolve } = require('path'); +const { spawnSync } = require('child_process') + +spawnSync(process.platform === 'win32' ? 'yarn.cmd' : 'yarn', ['build:clean', 'build:bundle'], { + stdio: "inherit", + cwd: resolve(__dirname, '../'), +})