[feedback] Add script to build packages for testapp
In order to make changes to the testapp's dependencies, we need to update the lockfile which means modules need to actually exist. This adds a new script to just run a build of the packages we sync so that module resolution in the testapp will work
Lauren Tan committed
Nov 9, 2023 at 11:31 UTC
a6e492d8d0132ddf4c15b0844af355ac775bd33a
1 file changed
+38
compiler/scripts/build-packages-forget-feedback.sh
new
+38
@@ -0,0 +1,38 @@
1
+#!/bin/sh
2
+# Copyright (c) Facebook, Inc. and its affiliates.
3
+#
4
+# This source code is licensed under the MIT license found in the
5
+# LICENSE file in the root directory of this source tree.
6
+
7
+# Script to build packages for Forget Feedback (eg when you need to add a new package to the
8
+# testapp)
9
+
10
+set -eo pipefail
11
+
12
+cwd=`basename $(pwd)`
13
+
14
+if [ $cwd != "react-forget" ]; then
15
+ echo "Error: This script must be run from the top level react-forget directory. Exiting"
16
+ exit 1
17
+fi
18
+
19
+# ----------------------- Build packages
20
+yarn install --silent
21
+rm -rf forget-feedback/dist
22
+mkdir forget-feedback/dist
23
+
24
+packages=("babel-plugin-react-forget" "eslint-plugin-react-forget" "react-forget-runtime")
25
+for package in ${packages[@]}; do
26
+ echo "Building" $package
27
+ yarn workspace $package run build
28
+done
29
+
30
+echo "Copying artifacts to local forget-feedback directory..."
31
+for package in ${packages[@]}; do
32
+ for dir in packages/$package/; do
33
+ if [ -d $dir/dist ]; then
34
+ package_name=$(basename $dir)
35
+ cp -R $dir/dist/. ./forget-feedback/dist/$package_name
36
+ fi
37
+ done
38
+done