initial commit - patcher, couple patches

This commit is contained in:
c0repwn3r 2023-05-23 14:50:30 -04:00
commit 3c5f2cf2c7
Signed by: core
GPG Key ID: FDBF740DADDCEECF
7 changed files with 1939 additions and 0 deletions

1
.gitignore vendored Normal file
View File

@ -0,0 +1 @@
.idea

3
.gitmodules vendored Normal file
View File

@ -0,0 +1,3 @@
[submodule "scratch-blocks"]
path = scratch-blocks
url = https://github.com/scratchfoundation/scratch-blocks

553
all_blocks.md Normal file
View File

@ -0,0 +1,553 @@
# Notation
- `(value)`
- `(d! dropdown)`
- `<boolean>`
- `(m! display matrix picker)`
# Hub
- DONE `initialize hub (d! top_side = Axis.Z) (d! front_size = Axis.X)`
- transpiled: `hub = PrimeHub(top_side, front_side)`
## Hub - Status Light
- DONE `set button color to (d! color)`
- transpiled: `hub.light.on(color)`
- DONE `turn off button light`
- transpiled: `hub.light.off()`
todo: light.blink
todo: light.animate
## Hub - Display
- `set display orientation to (d! side)`
- transpiled: `hub.display.orientation(side)`
- DONE `turn display off`
- transpiled: `hub.display.off()`
- `set (m! row, col) to (brightness %) brightness`
- transpiled: `hub.display.pixel(row, col, brightness)`
- `show (m! picutre) on display`
- transpiled: `hub.display.icon(picture)`
todo: display.animate
- DONE `show (number) on display`
- transpiled: `hub.display.number(number)`
- `show (char) on display`
- transpiled: `hub.display.char(char)`
- DONE `scroll (text) on display`
- transpiled: `hub.display.text(text)`
- `scroll (text) on display, on for (on) off for (off)`
- transpiled: `hub.display.text(text, on, off)`
## Hub - Buttons
!- `(buttons pressed)`
! - transpiled: `hub.buttons.pressed()`
- DONE `<is (d! button) button pressed?>`
- transpiled: `button in hub.buttons.pressed()`
## Hub - IMU
- DONE `<imu ready?>`
- transpiled: `hub.imu.ready()`
- DONE `<is moving?>`
- transpiled: `!hub.imu.stationary()`
- `(side facing up)`
- transpiled: `hub.imu.up()`
- DONE `(pitch)`
- transpiled: `hub.imu.tilt()[0]`
- DONE `(roll)`
- transpiled: `hub.imu.roll()[1]`
- DONE `(acceleration (d! axis))`
- transpiled: `hub.imu.acceleration(axis)`
- DONE `(angular velocity (d! axis))`
- transpiled: `hub.imu.angular_velocity(axis)`
- DONE `(yaw)`
- transpiled: `hub.imu.heading()`
- warning: must be reset if lifted from table
- reset in prelude?
- DONE `reset yaw angle`
- transpiled: `hub.imu.reset_heading(0)`
- DONE `reset yaw angle to (degrees)`
- transpiled: `hub.imu.reset_heading(degrees)`
todo: imu.rotation
todo: imu.orientation
- DONE `(angular velocity threshold)`
- transpiled: `hub.imu.settings()[0]`
- DONE `(acceleration threshold)`
- transpiled: `hub.imu.settings()[1]`
- DONE `set angular velocity threshold to (threshold)`
- transpiled: `hub.imu.settings(threshold, hub.imu.settings()[1])`
- DONE `set acceleration threshold to (threshold)`
- transpiled: `hub.imu.settings(hub.imu.settings()[0], threshold)`
## Hub - Speaker
- `(volume)`
- transpiled: `hub.speaker.volume()`
- `set speaker volume to (volume)`
- transpiled: `hub.speaker.volume(volume)`
- `play tone (frequency) for (ms) ms`
- transpiled: `hub.speaker.beep(frequency, ms)`
- `start playing tone (frequency)`
- transpiled: `hub.speaker.beep(frequency, -1)`
todo: speaker.play_notes
## TODO: Hub - Bluetooth
Not legal for competition, so I skipped it.
Easy to design though, for late.r
## Hub - Battery
- `(battery voltage)`
- transpiled: `hub.battery.voltage()`
- `(battery current)`
- transpiled: `hub.battery.current()`
- `<charger connected?>`
- transpiled: `hub.charger.connected()`
- `(charging current)`
- transpiled: `hub.charger.current()`
- `<is charging?>`
- transpiled: `hub.charger.status() == 1`
- `<is charging complete?>`
- transpiled: `hub.charger.status() == 2`
- `<is charging stopped?>`
- transpiled: `hub.charger.status() == 3`
## Hub - Control
- `set stop button to (button)`
- transpiled: `hub.system.set_stop_button(button)`
- `(hub name)`
- transpiled: `hub.system.name()`
todo: system.storage
- DONE `stop and exit program` - program terminator
- transpiled: prelude code, go back to selection screen
- DONE `stop and restart program` - program terminator
- transpiled: prelude code, exit, run again
- DONE `stop and shutdown system` - program terminator
- transpiled: `hub.system.shutdown()`
- `<last shut down normally?>`
- transpiled: `hub.system.reset_reason() == 0`
- `<last shut down automatically?>`
- transpiled: `hub.system.reset_reason() == 1`
- `<last shut down by crash?>`
- transpiled: `hub.system.reset_reason() == 2`
# Motors
## Motors - DC
- `turn on dc motor (port) at (power) power`
- transpiled: `motor.dc(power)`
- `stop dc motor (port)`
- transpiled: `motor.stop()`
- `set max voltage of dc motor (port) to (voltage)`
- transpiled: `motor.settings(voltage)`
- `(max voltage of dc motor (port))`
- transpiled: `motor.settings()[0]`
- `set positive direction of dc motor (port) to (d! direction)`
- transpiled: RESET motor variable with the direction
## Motors
- `set positive direction of motor (port) to (d! direction)`
- traspiled: RESET motor variable with the direction
todo: geartrain
todo: reset_angle
- `((port) rotation angle)`
- transpiled: `motor.angle()`
- `reset rotation angle of (port)`
- transpiled: `motor.reset_angle(0)`
- `reset rotation angle of (port) to (deg)`
- transpiled: `motor.reset_angle(deg)`
- `((port) current speed)`
- transpiled: `motor.speed()`
- `((port) current load)`
- transpiled: `motor.load()`
- `<(port) is stalled?>`
- transpiled: `motor.stalled()`
- `(port) stop moving`
- transpiled: `motor.stop()`
- `(port) brake`
- transpiled: `motor.brake()`
- `(port) stop and hold position`
- transpiled: `motor.hold()`
- `(port) start moving at (speed)`
- transpiled: `motor.run(speed)`
- `(port) start moving at (power) power`
- transpiled: `motor.dc(power)`
- `(port) run for (time) seconds at (speed) speed, then (d! stop action)`
- transpiled: `motor.run_time(speed, time, stop action, True)`
- `(port) start running for (time) seconds at (speed) speed, then (d! stop action)`
- transpiled: `motor.run_time(speed, time, stop action, False)`
- `(port) run for (deg) degrees at (speed), then (d! stop action)`
- transpiled: `motor.run_angle(speed, deg, stop action, True)`
- `(port) start running for (deg) degrees at (speed), then (d! stop action)`
- transpiled: `motor.run_angle(speed, deg, stop action, False)`
- `(port) go to relative position (deg) at (speed), then (d! stop action)`
- transpiled: `motor.run_target(speed, deg, stop action, True)`
- `(port) start moving to relative position (deg) at (speed), then (d! stop action)`
- transpiled: `motor.run_target(speed, deg, stop action, False)`
- `(port) go to relative position (deg) immediately`
- transpiled: `motor.track_target(deg)`
- `(port) run at (speed) speed until stalled, then (d! stop action)`
- transpiled: `motor.run_until_stalled(speed, stop action)`
- `(port) run at (speed) speed until stalled, then (d! stop action), with maximum power (power)`
- transpiled: `motor.run_until_stalled(speed, stop action, power)`
- `<(port) is done moving?>`
- transpiled: `motor.done()`
- `((port) max speed)`
- transpiled: `motor.limits()[0]`
- `((port) max acceleration)`
- transpiled: `motor.limits()[1]`
- `((port) max torque)`
- transpiled: `motor.limits()[2]`
- `set (port) max speed to (speed)`
- transpiled: `motor.limits(speed, motor.limits()[1], motor.limits()[2])`
- `set (port) max acceleration to (accel)`
- transpiled: `motor.limits(motor.limits()[0], accel, motor.limits()[2])`
- `set (port) max torque to (torq)`
- transpiled: `motor.limits(motor.limits()[0], motor.limits()[1], torq)`
TODO: pid
TODO: tolerances
TODO: stall tolerances
TODO: scale
TODO: state
TODO: settings
# Tilt Sensor
- `((port) pitch)`
- transpiled: `sensor.tilt()[0]`
- `((port) roll)`
- transpiled: `sensor.tilt()[1]`
# Infrared Sensor
- `((port) infrared distance)`
- transpiled: `sensor.distance()`
- `((port) infrared reflection)`
- transpiled: `sensor.reflection()`
- `((port) object count)`
- transpiled: `sensor.count()`
# Color and Distance Sensor
- `<(port) color is (d! color)?>`
- transpiled: `sensor.color() == color`
- `((port) reflection)`
- transpiled: `sensor.reflection()`
- `((port) intensity)`
- transpiled: `sensor.ambient()`
- `((port) infrared distance)`
- transpiled: `sensor.distance()`
TODO: detectable_colors
- `set (port) light to (d! color RGB)`
- transpiled: `sensor.light.on(color)`
- `turn off (port) light`
- transpiled: `sensor.light.off()`
# TODO - Power Functions Infrared Controls
# Color Sensor
- `<(port) color is (d! color)?>`
- transpiled: `sensor.color() == color`
- `((port) reflection)`
- transpiled: `sensor.reflection()`
- `((port) intensity)`
- transpiled: `sensor.ambient()`
- `((port) hue)`
- transpiled: `sensor.hsv().h`
- `((port) saturation)`
- transpiled: `sensor.hsv().s`
- `((port) brightness)`
- transpiled: `sensor.hsv().v`
TODO: detectable_colors
- `turn on (port) light at (power) brightness`
- transpiled: `sensor.lights.on(power)`
- `turn off (port) light`
- transpiled: `sensor.lights.off()`
# Ultrasonic Sensor
- `((port) distance)`
- transpiled: `sensor.distance()`
- `<(port) other ultrasonic sensors nearby?>`
- transpiled: `sensor.presence()`
- `turn on (port) light at (power) brightness`
- transpiled: `sensor.lights.on(power)`
- `turn off (port) light`
- transpiled: `sensor.lights.off()`
# Force Sensor
- `((port) force)`
- transpiled: `sensor.force()`
- `((port) distance travelled)`
- transpiled: `sensor.distance()`
- `<(port) pressed?>`
- transpiled: `sensor.pressed()`
- `<(port) touched?>`
- transpiled: `sensor.touched()`
# TODO - Color Light Matrix
# Light
- `turn on (port) at (power) brightness`
- transpiled: `sensor.on(power)`
- `turn off (port)`
- trnaspiled: `sensor.off()`
# TODO - Remote Control
# Constants
## Constants - Axis
- `(x axis)`
- transpiled: `Axis.X`
- `(y axis)`
- transpiled: `Axis.Y`
- `(z axis)`
- transpiled: `Axis.Z`
## Constants - Button
- `(left button)`
- transpiled: `Button.LEFT`
- `(center button)`
- transpiled: `Button.CENTER`
- `(right button)`
- transpiled: `Button.RIGHT`
- `(bluetooth button)`
- transpiled: `Button.BLUETOOTH`
## Constants - Stop Behavior
- `coast`
- transpiled: `Stop.COAST`
- `preplanned coast`
- transpiled: `Stop.COAST_SMART`
- `brake`
- transpiled: `Stop.BRAKE`
- `hold position`
- transpiled: `Stop.HOLD`
- `do not stop`
- transpiled: `Stop.NONE`
# Tools
- `wait (ms) ms`
- transpiled: `tools.wait(ms)`
## TODO - Tools - Stopwatch
# Movement (Robotics)
- `set movement motors to (left port) and (right port)`
- transpiled: `left_motor = left port; right_motor = right port; drive = DriveBase(left_motor, right_motor, wd, track)`
- `set wheel diameter to (mm) mm`
- transpiled: `wd = mm; drive = DriveBase(left_motor, right_motor, wd, track)`
- `set track width to (mm) mm`
- transpiled: `track = mm; drive = DriveBase(left_motor, right_motor, wd, track)`
- `move (mm) mm, then (d! stop)`
- transpiled: `drive.straight(mm, stop, True)`
- `start moving (mm) mm, then (d! stop)`
- transpiled: `drive.straight(mm, stop, False)`
- `turn in place (deg) degrees, then (d! stop)`
- transpiled: `drive.turn(deg, stop, True)`
- `start turning in place (deg) degrees, then (d! stop)`
- transpiled: `drive.turn(deg, stop, False)`
- `turn (deg) degrees across a (rad) mm arc, then (d! stop)`
- transpiled: `drive.curve(rad, deg, stop, True)`
- `start turning (deg) degrees across a (rad) mm arc, then (d! stop)`
- transpiled: `drive.curve(rad, deg, stop, False)`
- `(movement speed)`
- transpiled: `drive.settings()[0]`
- `(movement acceleration)`
- transpiled: `drive.settings()[1]`
- `(turn speed)`
- transpiled: `drive.settings()[2]`
- `(turn acceleration)`
- transpiled: `drive.settings()[3]`
- `set movement speed to (speed)`
- transpiled: `drive.settings(speed, drive.settings()[1], drive.settings()[2], drive.settings()[3])`
- `set movement acceleration to (speed)`
- transpiled: `drive.settings(drive.settings()[0], speed, drive.settings()[2], drive.settings()[3])`
- `set turn speed to (speed)`
- transpiled: `drive.settings(drive.settings()[0], drive.settings()[1], speed, drive.settings()[3])`
- `set turn acceleration to (speed)`
- transpiled: `drive.settings(drive.settings()[0], drive.settings()[1], drive.settings()[2], speed)`
- `<is done moving?>`
- transpiled: `drive.done()`
- `start moving at (spd) speed`
- transpiled: `drive.drive(spd, 0)`
- `start moving at (spd) speed with turn rate (tr)`
- transpiled: `drive.drive(spd, tr)`
- `stop moving`
- transpiled: `drive.stop()`
- `(relative distance)`
- transpiled: `drive.distance()`
- `(relative angle)`
- transpiled: `drive.angle()`
- `(current drive speed)`
- transpiled: `drive.state()[1]`
- `(current turn rate)`
- transpiled: `drive.state()[3]`
- `reset angle and distance`
- transpiled: `drive.reset()`
- `<is stalled?>`
- transpiled: `drive.stalled()`
- `use gyroscope for movement`
- transpiled: `drive = GyroDriveBase(left_motor, right_motor, wd, track)`
- `use math for movement`
- transpiled: `drive = DriveBase(left_motor, right_motor, wd, track)`
# Random
- `(random number from (a) to (b))`
- transpiled: `urandom.randint(a, b)`
- `(random decimal from 0 to 1)`
- transpiled: `urandom.random()`
# Control
- `repeat (n)`
- transpiled: `for i in range(n):`
- `forever`
- transpiled: `while True:`
- `if <cond> then`
- transpiled: `if cond:`
- `if <cond> then else`
- transpiled: `if cond: else:`
- `wait until <cond>`
- transpiled: `while !<cond>: pass`
- `repeat until <cond>`
- transpiled: `while !cond:`
- `stop`
- transpiled: `raise SystemExit("Exited by program")`
# Operators
- `((a) + (b))`
- transpiled: `a + b`
- `((a) - (b))`
- transpiled: `a - b`
- `((a) * (b))`
- transpiled: `a * b`
- `((a) / (b))`
- transpiled: `a / b`
- `<(a) > (b)>`
- transpiled: `a > b`
- `<(a) < (b)>`
- transpiled: `a < b`
- `<(a) = (b)>`
- transpiled: `a == b`
- `<<a> and <b>>`
- transpiled: `a and b`
- `<<a> or <b>>`
- transpiled: `a or b`
- `<not <a>>`
- transpiled: `not a`
- `(join (a) (b))`
- transpiled: `a + b`
- `(letter (n) of (a))`
- transpiled: `a[n]`
- `(length of (a))`
- transpiled: `len(a)`
- `<(a) contains (b)?>`
- transpiled: `a in b`
- `((a) mod (b))`
- transpiled: `a % b`
- `(round (a))`
- transpiled: `round(a)`
TODO: operators
# Variables
Variables are stored as python variables with the prefix `UVAR` - for example `UVAR_myvar`
# My blocks
re just functions

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,191 @@
From fe9c3c066fd2c7a19500209c1e552c5d64e96995 Mon Sep 17 00:00:00 2001
From: c0repwn3r <core@coredoes.dev>
Date: Tue, 23 May 2023 11:55:18 -0400
Subject: [PATCH] imu blocks
---
blocks_vertical/default_toolbox.js | 25 ++++++
blocks_vertical/imu.js | 124 ++++++++++++++++++++++++++++-
2 files changed, 147 insertions(+), 2 deletions(-)
diff --git a/blocks_vertical/default_toolbox.js b/blocks_vertical/default_toolbox.js
index 8516e0db..781a5f46 100644
--- a/blocks_vertical/default_toolbox.js
+++ b/blocks_vertical/default_toolbox.js
@@ -64,6 +64,31 @@ Blockly.Blocks.defaultToolbox = '<xml id="toolbox-categories" style="display: no
'<block type="hub_imu_roll" id="hub_imu_roll"></block>' +
'<block type="hub_imu_accel" id="hub_imu_accel"></block>' +
'<block type="hub_imu_avel" id="hub_imu_avel"></block>' +
+ '<block type="hub_imu_yaw" id="hub_imu_yaw"></block>' +
+ '<block type="hub_imu_reset_yaw" id="hub_imu_reset_yaw"></block>' +
+ '<block type="hub_imu_reset_yaw_to" id="hub_imu_reset_yaw_to">' +
+ '<value name="DEGREES">' +
+ '<shadow type="math_integer">' +
+ '<field name="NUM">90</field>' +
+ '</shadow>' +
+ '</value>' +
+ '</block>' +
+ '<block type="hub_imu_accel_t" id="hub_imu_accel_t"></block>' +
+ '<block type="hub_imu_avel_t" id="hub_imu_avel_t"></block>' +
+ '<block type="hub_imu_set_avel_t" id="hub_imu_set_avel_t">' +
+ '<value name="THRESHOLD">' +
+ '<shadow type="math_number">' +
+ '<field name="NUM">1.0</field>' +
+ '</shadow>' +
+ '</value>' +
+ '</block>' +
+ '<block type="hub_imu_set_accel_t" id="hub_imu_set_accel_t">' +
+ '<value name="THRESHOLD">' +
+ '<shadow type="math_number">' +
+ '<field name="NUM">1.0</field>' +
+ '</shadow>' +
+ '</value>' +
+ '</block>' +
'</category>' +
'<category name="%{BKY_CATEGORY_SOUND}" id="sound" colour="#FFBF00" secondaryColour="#3373CC">' +
'</category>' +
diff --git a/blocks_vertical/imu.js b/blocks_vertical/imu.js
index 0e09a248..9215efdd 100644
--- a/blocks_vertical/imu.js
+++ b/blocks_vertical/imu.js
@@ -87,7 +87,7 @@ Blockly.Blocks['hub_imu_accel'] = {
}
],
"category": Blockly.Categories.imu,
- "extensions": ["colours_imu", "output_boolean"]
+ "extensions": ["colours_imu", "output_number"]
});
}
};
@@ -112,7 +112,127 @@ Blockly.Blocks['hub_imu_avel'] = {
}
],
"category": Blockly.Categories.imu,
- "extensions": ["colours_imu", "output_boolean"]
+ "extensions": ["colours_imu", "output_number"]
+ });
+ }
+};
+
+Blockly.Blocks['hub_imu_yaw'] = {
+ /**
+ * Block to get the approximate yaw angle
+ * @this Blockly.Block
+ */
+ init: function() {
+ this.jsonInit({
+ "message0": Blockly.Msg.HUB_IMU_YAW,
+ "args0": [],
+ "category": Blockly.Categories.imu,
+ "extensions": ["colours_imu", "output_number"]
+ });
+ }
+};
+
+Blockly.Blocks['hub_imu_reset_yaw'] = {
+ /**
+ * Block to reset the yaw angle to 0
+ * @this Blockly.Block
+ */
+ init: function() {
+ this.jsonInit({
+ "message0": Blockly.Msg.HUB_IMU_RESET_YAW,
+ "args0": [],
+ "category": Blockly.Categories.imu,
+ "extensions": ["colours_imu", "shape_statement"]
+ });
+ }
+};
+
+Blockly.Blocks['hub_imu_reset_yaw_to'] = {
+ /**
+ * Block to reset the yaw angle to given degrees
+ * @this Blockly.Block
+ */
+ init: function() {
+ this.jsonInit({
+ "message0": Blockly.Msg.HUB_IMU_RESET_YAW_TO,
+ "args0": [
+ {
+ "name": "DEGREES",
+ "type": "input_value"
+ }
+ ],
+ "category": Blockly.Categories.imu,
+ "extensions": ["colours_imu", "shape_statement"]
+ });
+ }
+};
+
+Blockly.Blocks['hub_imu_accel_t'] = {
+ /**
+ * Block to get the acceleration stillness threshold
+ * @this Blockly.Block
+ */
+ init: function() {
+ this.jsonInit({
+ "message0": Blockly.Msg.HUB_IMU_ACCE_THRESHOLD,
+ "args0": [],
+ "category": Blockly.Categories.imu,
+ "extensions": ["colours_imu", "output_number"]
+ });
+ }
+};
+
+Blockly.Blocks['hub_imu_avel_t'] = {
+ /**
+ * Block to get the angular velocity stillness threshold
+ * @this Blockly.Block
+ */
+ init: function() {
+ this.jsonInit({
+ "message0": Blockly.Msg.HUB_IMU_AVEL_THRESHOLD,
+ "args0": [],
+ "category": Blockly.Categories.imu,
+ "extensions": ["colours_imu", "output_number"]
+ });
+ }
+};
+
+Blockly.Blocks['hub_imu_set_accel_t'] = {
+ /**
+ * Block to set the acceleration stillness threshold to a different value
+ * @this Blockly.Block
+ */
+ init: function() {
+ this.jsonInit({
+ "message0": Blockly.Msg.HUB_IMU_SET_ACCE_THRESHOLD,
+ "args0": [
+ {
+ "name": "THRESHOLD",
+ "type": "input_value"
+ }
+ ],
+ "category": Blockly.Categories.imu,
+ "extensions": ["colours_imu", "shape_statement"]
+ });
+ }
+};
+
+Blockly.Blocks['hub_imu_set_avel_t'] = {
+ /**
+ * Block to set the angular velocity stillness threshold to a different value
+ * @this Blockly.Block
+ */
+ init: function() {
+ this.jsonInit({
+ "message0": Blockly.Msg.HUB_IMU_SET_AVEL_THRESHOLD,
+ "args0": [
+ {
+ "name": "THRESHOLD",
+ "type": "input_value"
+ }
+ ],
+ "category": Blockly.Categories.imu,
+ "extensions": ["colours_imu", "shape_statement"]
});
}
};
--
2.40.1

100
pbt.sh Executable file
View File

@ -0,0 +1,100 @@
#!/bin/bash
job_start=0
job_start() {
# [*] job start - [target]:[job]
# bold
echo -e "\e[1m[*] job start - $1:$2\e[0m"
job_start=$(date +%s)
}
job_success() {
# [*] success! [target]:[job] finished in 241.2s :)
end=$(date +%s)
time=$(( end - job_start ))
echo -e "\e[1m\e[32m[*] success! $1:$2 finished in $time seconds :)\e[0m"
}
job_fail() {
# [x] FAIL! [target]:[job] failed in 241.2s :(
end=$(date +%s)
time=$(( end - job_start ))
echo -e "\e[1m\e[31m[*] FAIL! $1:$2 failed in $time seconds :(\e[0m"
}
sub_clone() {
job_start "scratch-blocks" "clone"
git submodule init
if [ "$?" != "0" ]; then
job_fail "scratch-blocks" "clone"
exit 1
fi
git submodule update
if [ "$?" != "0" ]; then
job_fail "scratch-blocks" "clone"
exit 1
fi
job_success "scratch-blocks" "clone"
}
sub_patch() {
sub_clone
job_start "scratch-blocks" "patch"
cd scratch-blocks || exit
git am --abort >/dev/null 2>&1
git am --3way "../patches/scratch-blocks/"*.patch
if [ "$?" != "0" ]; then
echo "One or more patches did not apply cleanly to scratch-blocks. Check above message and try again".
job_fail "scratch-blocks" "patch"
exit 1
fi
echo "[*] Patches applied cleanly to scratch-blocks"
job_success "scratch-blocks" "patch"
}
sub_compile() {
sub_patch
job_start "scratch-blocks" "compile"
NODE_OPTIONS=--openssl-legacy-provider npm i
if [ "$?" != "0" ]; then
job_fail "scratch-blocks" "compile"
exit 1
fi
job_success "scratch-blocks" "compile"
}
sub_help() {
echo "clone - clone upstream source code"
echo "patch - apply patches"
echo "compile - compile bundles"
echo "bundle - create prod bundles"
}
subcommand=$1
case $subcommand in
"" | "-h" | "--help" | "help")
sub_help
;;
*)
echo "[*] Running build command $subcommand"
shift
sub_${subcommand} $@
if [ $? = 127 ]; then
echo "Error: '$subcommand' is not a known subcommand." >&2
echo " Run 'pbt.sh --help' for a list of known subcommands." >&2
exit 1
fi
;;
esac

1
scratch-blocks Submodule

@ -0,0 +1 @@
Subproject commit c3b5e869c3fc9121f6fc9221fafb1a9e765e5b1e