Compare commits
No commits in common. "da846cd2196e46c629d07dc497cecf58b27d8555" and "4089db70f90cb661b78466224335e9bc07d06044" have entirely different histories.
da846cd219
...
4089db70f9
|
@ -1,5 +1 @@
|
||||||
.idea
|
.idea
|
||||||
scratch-blocks
|
|
||||||
scratch-gui
|
|
||||||
pyblocks-gui/node_modules
|
|
||||||
pyblocks-gui/out
|
|
||||||
|
|
78
BUILDING.md
|
@ -1,78 +0,0 @@
|
||||||
# Building PyBlocks
|
|
||||||
|
|
||||||
Compiling pyblocks is a multi-step process. There are generally two options for building any component of PyBlocks.
|
|
||||||
|
|
||||||
Because of the nature of how PyBlocks is compiled (via patching source code of various other projects), it is very easy to leave yourself in a broken state, unable to finish compilation. **If you don't know what you're doing, use PBT.**
|
|
||||||
|
|
||||||
You will need git, nodejs, npm, and python2 (under the command `python2`) installed.
|
|
||||||
|
|
||||||
Python 2 **must** be reachable at `python2` - any other command will *not* work without further patching of the source tree.
|
|
||||||
|
|
||||||
## Option 1: PBT (PyBlocks Build Tool) (Highly Recommended)
|
|
||||||
|
|
||||||
`pbt.sh` is a shell script designed to automate the process of developing PyBlocks. To use PBT, you need to be on a **Unix** (`/`-style paths, rougly POSIX compliant) system, with git, node, npm, and general baseutils available.
|
|
||||||
|
|
||||||
We highly recommend using PBT, as it makes it impossible to mess up the build process and leave you with a broken source tree.
|
|
||||||
|
|
||||||
## Option 2: Manual (For experts only)
|
|
||||||
|
|
||||||
While `pbt.sh` is incredibly useful if you are on a Unix platform, it is still possible to compile PyBlocks on other platforms, you will simply need to follow the compilation instructions manually. Expect things to break permanently if you mess up, requiring you to delete your copy of PyBlocks and start over.
|
|
||||||
|
|
||||||
# Step 1: Downloading sources
|
|
||||||
|
|
||||||
PyBlocks works by applying a set of patches (see `patches/`) to other projects' sourcecode. To do this, you'll need a local copy of their source trees. You have two options:
|
|
||||||
|
|
||||||
## Option 1: PBT (Recommended)
|
|
||||||
|
|
||||||
Run `./pbt.sh clone`. This will download a local copy of the required source code and place it where PBT expects them to be.
|
|
||||||
|
|
||||||
This may take a while, as the files being downloaded are fairly large. A relatively fast internet connection is required for this step.
|
|
||||||
|
|
||||||
## Option 2: Manual
|
|
||||||
|
|
||||||
### Step 1.1: Downloading scratch-blocks
|
|
||||||
|
|
||||||
Clone the scratch-blocks repository into `scratch-blocks`:
|
|
||||||
|
|
||||||
```shell
|
|
||||||
git clone https://github.com/scratchfoundation/scratch-blocks scratch-blocks
|
|
||||||
```
|
|
||||||
|
|
||||||
This may take a while, as the files being downloaded are fairly large. A relatively fast internet connection is required for this step.
|
|
||||||
|
|
||||||
Copy the patchbase for scratch-blocks from the file `patches/blocks/PATCHBASE`, then check it out with the following command:
|
|
||||||
|
|
||||||
```shell
|
|
||||||
cd scratch-blocks
|
|
||||||
git checkout [PATCHBASE GOES HERE]
|
|
||||||
```
|
|
||||||
|
|
||||||
# Patching the source code
|
|
||||||
|
|
||||||
To compile PyBlocks, you need to apply a set of *patches* to the source code you just downloaded. This will convert that code into PyBlocks.
|
|
||||||
|
|
||||||
## Option 1: PBT (Recommended)
|
|
||||||
|
|
||||||
Run `./pbt.sh patch` to apply the patches. This can take a little while, as some of the patches are very large. If you interrupt this command, it is safe to run again.
|
|
||||||
|
|
||||||
## Option 2: Manual
|
|
||||||
|
|
||||||
Apply all of the git patches in `patches/` to their relative repositories:
|
|
||||||
|
|
||||||
- `blocks` goes to `scratch-blocks`
|
|
||||||
|
|
||||||
The way you do this depends on how your system is set up, but patches should be only applied with `git apply`.
|
|
||||||
|
|
||||||
# Compiling scratch-blocks
|
|
||||||
|
|
||||||
**Warning:** This step can take a very long time (up to 10 minutes). **Do not interrupt the build process.** The scratch-blocks compiler has a bug in it that will lock up your computer if you interrupt this build process.
|
|
||||||
|
|
||||||
You only need to run this process once, when you compile scratch-blocks for the first time. Further edits to the source trees do not require this step to be repeated - you generally only need to run it the first time you build PyBlocks.
|
|
||||||
|
|
||||||
## Option 1: PBT (Recommended)
|
|
||||||
|
|
||||||
Run `./pbt.sh compile` to compile scratch-blocks. This will take a very long time. **Do not** interrupt this process.
|
|
||||||
|
|
||||||
## Option 2: Manual
|
|
||||||
|
|
||||||
Run `npm i` in `scratch-blocks/` to install dependencies and compile scratch-blocks. This will take a very long time. **Do not interrupt this process.**
|
|
|
@ -1,3 +0,0 @@
|
||||||
# PyBlocks - SPIKE Prime, but better
|
|
||||||
|
|
||||||
PyBlocks is a patched version of `scratch-blocks` to add support for SPIKE Prime hardware. Block projects are transpiled into python and sent to PyBricks firmware on the hub, allowing for increased motor control and a generally better robot.
|
|
|
@ -23,16 +23,16 @@ todo: light.animate
|
||||||
|
|
||||||
## Hub - Display
|
## Hub - Display
|
||||||
|
|
||||||
- DONE `set display orientation to (d! side)`
|
- `set display orientation to (d! side)`
|
||||||
- transpiled: `hub.display.orientation(side)`
|
- transpiled: `hub.display.orientation(side)`
|
||||||
|
|
||||||
- DONE `turn display off`
|
- DONE `turn display off`
|
||||||
- transpiled: `hub.display.off()`
|
- transpiled: `hub.display.off()`
|
||||||
|
|
||||||
- DONE `set (m! row, col) to (brightness %) brightness`
|
- `set (m! row, col) to (brightness %) brightness`
|
||||||
- transpiled: `hub.display.pixel(row, col, brightness)`
|
- transpiled: `hub.display.pixel(row, col, brightness)`
|
||||||
|
|
||||||
- DONE `show (m! picutre) on display`
|
- `show (m! picutre) on display`
|
||||||
- transpiled: `hub.display.icon(picture)`
|
- transpiled: `hub.display.icon(picture)`
|
||||||
|
|
||||||
todo: display.animate
|
todo: display.animate
|
||||||
|
@ -106,16 +106,16 @@ todo: imu.orientation
|
||||||
|
|
||||||
## Hub - Speaker
|
## Hub - Speaker
|
||||||
|
|
||||||
- DONE `(volume)`
|
- `(volume)`
|
||||||
- transpiled: `hub.speaker.volume()`
|
- transpiled: `hub.speaker.volume()`
|
||||||
|
|
||||||
- DONE `set speaker volume to (volume)`
|
- `set speaker volume to (volume)`
|
||||||
- transpiled: `hub.speaker.volume(volume)`
|
- transpiled: `hub.speaker.volume(volume)`
|
||||||
|
|
||||||
- DONE `play tone (frequency) for (ms) ms`
|
- `play tone (frequency) for (ms) ms`
|
||||||
- transpiled: `hub.speaker.beep(frequency, ms)`
|
- transpiled: `hub.speaker.beep(frequency, ms)`
|
||||||
|
|
||||||
- DONE `start playing tone (frequency)`
|
- `start playing tone (frequency)`
|
||||||
- transpiled: `hub.speaker.beep(frequency, -1)`
|
- transpiled: `hub.speaker.beep(frequency, -1)`
|
||||||
|
|
||||||
todo: speaker.play_notes
|
todo: speaker.play_notes
|
||||||
|
@ -126,25 +126,25 @@ Easy to design though, for late.r
|
||||||
|
|
||||||
## Hub - Battery
|
## Hub - Battery
|
||||||
|
|
||||||
- DONE `(battery voltage)`
|
- `(battery voltage)`
|
||||||
- transpiled: `hub.battery.voltage()`
|
- transpiled: `hub.battery.voltage()`
|
||||||
|
|
||||||
- DONE `(battery current)`
|
- `(battery current)`
|
||||||
- transpiled: `hub.battery.current()`
|
- transpiled: `hub.battery.current()`
|
||||||
|
|
||||||
- Done `<charger connected?>`
|
- `<charger connected?>`
|
||||||
- transpiled: `hub.charger.connected()`
|
- transpiled: `hub.charger.connected()`
|
||||||
|
|
||||||
- DONE `(charging current)`
|
- `(charging current)`
|
||||||
- transpiled: `hub.charger.current()`
|
- transpiled: `hub.charger.current()`
|
||||||
|
|
||||||
- DONE `<is charging?>`
|
- `<is charging?>`
|
||||||
- transpiled: `hub.charger.status() == 1`
|
- transpiled: `hub.charger.status() == 1`
|
||||||
|
|
||||||
- DONE `<is charging complete?>`
|
- `<is charging complete?>`
|
||||||
- transpiled: `hub.charger.status() == 2`
|
- transpiled: `hub.charger.status() == 2`
|
||||||
|
|
||||||
- DONE `<is charging stopped?>`
|
- `<is charging stopped?>`
|
||||||
- transpiled: `hub.charger.status() == 3`
|
- transpiled: `hub.charger.status() == 3`
|
||||||
|
|
||||||
## Hub - Control
|
## Hub - Control
|
||||||
|
@ -179,18 +179,18 @@ todo: system.storage
|
||||||
|
|
||||||
## Motors - DC
|
## Motors - DC
|
||||||
|
|
||||||
- DONE `turn on dc motor (port) at (power) power`
|
- `turn on dc motor (port) at (power) power`
|
||||||
- transpiled: `motor.dc(power)`
|
- transpiled: `motor.dc(power)`
|
||||||
|
|
||||||
- DONE `stop dc motor (port)`
|
- `stop dc motor (port)`
|
||||||
- transpiled: `motor.stop()`
|
- transpiled: `motor.stop()`
|
||||||
|
|
||||||
- DONE `set max voltage of dc motor (port) to (voltage)`
|
- `set max voltage of dc motor (port) to (voltage)`
|
||||||
- transpiled: `motor.settings(voltage)`
|
- transpiled: `motor.settings(voltage)`
|
||||||
- DONE `(max voltage of dc motor (port))`
|
- `(max voltage of dc motor (port))`
|
||||||
- transpiled: `motor.settings()[0]`
|
- transpiled: `motor.settings()[0]`
|
||||||
|
|
||||||
- DONE `set positive direction of dc motor (port) to (d! direction)`
|
- `set positive direction of dc motor (port) to (d! direction)`
|
||||||
- transpiled: RESET motor variable with the direction
|
- transpiled: RESET motor variable with the direction
|
||||||
|
|
||||||
## Motors
|
## Motors
|
||||||
|
|
|
@ -1,44 +0,0 @@
|
||||||
From 37f886f8bdd68cc14c637da6dfb1af338972a863 Mon Sep 17 00:00:00 2001
|
|
||||||
From: c0repwn3r <core@coredoes.dev>
|
|
||||||
Date: Wed, 24 May 2023 08:59:47 -0400
|
|
||||||
Subject: [PATCH] re-enable my blocks
|
|
||||||
|
|
||||||
---
|
|
||||||
blocks_vertical/{upstream => }/procedures.js | 0
|
|
||||||
tests/custom_procedure_playground.html | 2 +-
|
|
||||||
tests/vertical_playground.html | 1 +
|
|
||||||
3 files changed, 2 insertions(+), 1 deletion(-)
|
|
||||||
rename blocks_vertical/{upstream => }/procedures.js (100%)
|
|
||||||
|
|
||||||
diff --git a/blocks_vertical/upstream/procedures.js b/blocks_vertical/procedures.js
|
|
||||||
similarity index 100%
|
|
||||||
rename from blocks_vertical/upstream/procedures.js
|
|
||||||
rename to blocks_vertical/procedures.js
|
|
||||||
diff --git a/tests/custom_procedure_playground.html b/tests/custom_procedure_playground.html
|
|
||||||
index 8780a8af..e0e259eb 100644
|
|
||||||
--- a/tests/custom_procedure_playground.html
|
|
||||||
+++ b/tests/custom_procedure_playground.html
|
|
||||||
@@ -14,7 +14,7 @@
|
|
||||||
<script src="../blocks_vertical/upstream/event.js"></script>
|
|
||||||
<script src="../blocks_vertical/upstream/motion.js"></script>
|
|
||||||
<script src="../blocks_vertical/upstream/looks.js"></script>
|
|
||||||
- <script src="../blocks_vertical/upstream/procedures.js"></script>
|
|
||||||
+ <script src="../blocks_vertical/procedures.js"></script>
|
|
||||||
<script src="../blocks_vertical/operators.js"></script>
|
|
||||||
<script src="../blocks_vertical/pen.js"></script>
|
|
||||||
<script src="../blocks_vertical/upstream/sound.js"></script>
|
|
||||||
diff --git a/tests/vertical_playground.html b/tests/vertical_playground.html
|
|
||||||
index 7eab4fd9..146ff974 100644
|
|
||||||
--- a/tests/vertical_playground.html
|
|
||||||
+++ b/tests/vertical_playground.html
|
|
||||||
@@ -27,6 +27,7 @@
|
|
||||||
<script src="../blocks_vertical/operators.js"></script>
|
|
||||||
<script src="../blocks_vertical/control.js"></script>
|
|
||||||
<script src="../blocks_vertical/imu.js"></script>
|
|
||||||
+ <script src="../blocks_vertical/procedures.js"></script>
|
|
||||||
|
|
||||||
<!-- PyBlocks end -->
|
|
||||||
|
|
||||||
--
|
|
||||||
2.40.1
|
|
||||||
|
|
|
@ -1,707 +0,0 @@
|
||||||
From 96e9a57f0af460032f345cf0f4f5ca2ead4433e4 Mon Sep 17 00:00:00 2001
|
|
||||||
From: c0repwn3r <core@coredoes.dev>
|
|
||||||
Date: Wed, 24 May 2023 12:24:47 -0400
|
|
||||||
Subject: [PATCH] display - matrix - add FieldMatrixSingle
|
|
||||||
|
|
||||||
---
|
|
||||||
blocks_common/matrix.js | 23 +-
|
|
||||||
blocks_vertical/default_toolbox.js | 19 +
|
|
||||||
blocks_vertical/display.js | 42 +++
|
|
||||||
core/field_matrix.js | 548 ++++++++++++++++++++++++++++-
|
|
||||||
msg/messages.js | 2 +
|
|
||||||
5 files changed, 632 insertions(+), 2 deletions(-)
|
|
||||||
|
|
||||||
diff --git a/blocks_common/matrix.js b/blocks_common/matrix.js
|
|
||||||
index 8945f8b0..6af2f844 100644
|
|
||||||
--- a/blocks_common/matrix.js
|
|
||||||
+++ b/blocks_common/matrix.js
|
|
||||||
@@ -48,7 +48,28 @@ Blockly.Blocks['matrix'] = {
|
|
||||||
],
|
|
||||||
"outputShape": Blockly.OUTPUT_SHAPE_ROUND,
|
|
||||||
"output": "Number",
|
|
||||||
- "extensions": ["colours_pen"]
|
|
||||||
+ "extensions": ["colours_display"]
|
|
||||||
+ });
|
|
||||||
+ }
|
|
||||||
+};
|
|
||||||
+
|
|
||||||
+Blockly.Blocks['matrix_single'] = {
|
|
||||||
+ /**
|
|
||||||
+ * Block for matrix value.
|
|
||||||
+ * @this Blockly.Block
|
|
||||||
+ */
|
|
||||||
+ init: function() {
|
|
||||||
+ this.jsonInit({
|
|
||||||
+ "message0": "%1",
|
|
||||||
+ "args0": [
|
|
||||||
+ {
|
|
||||||
+ "type": "field_matrix_single",
|
|
||||||
+ "name": "MATRIX"
|
|
||||||
+ }
|
|
||||||
+ ],
|
|
||||||
+ "outputShape": Blockly.OUTPUT_SHAPE_ROUND,
|
|
||||||
+ "output": "Number",
|
|
||||||
+ "extensions": ["colours_display"]
|
|
||||||
});
|
|
||||||
}
|
|
||||||
};
|
|
||||||
diff --git a/blocks_vertical/default_toolbox.js b/blocks_vertical/default_toolbox.js
|
|
||||||
index 781a5f46..2807cfcd 100644
|
|
||||||
--- a/blocks_vertical/default_toolbox.js
|
|
||||||
+++ b/blocks_vertical/default_toolbox.js
|
|
||||||
@@ -51,6 +51,25 @@ Blockly.Blocks.defaultToolbox = '<xml id="toolbox-categories" style="display: no
|
|
||||||
'</value>' +
|
|
||||||
'</block>' +
|
|
||||||
'<block type="hub_display_string" id="hub_display_string"></block>' +
|
|
||||||
+ '<block type="hub_display_pixel" id="hub_display_pixel">' +
|
|
||||||
+ '<value name="PIXEL">' +
|
|
||||||
+ '<shadow type="matrix_single">' +
|
|
||||||
+ '<field name="MATRIX">0000000010000000</field>' +
|
|
||||||
+ '</shadow>' +
|
|
||||||
+ '</value>' +
|
|
||||||
+ '<value name="BRIGHTNESS">' +
|
|
||||||
+ '<shadow type="math_integer">' +
|
|
||||||
+ '<field name="NUM">100</field>' +
|
|
||||||
+ '</shadow>' +
|
|
||||||
+ '</value>' +
|
|
||||||
+ '</block>' +
|
|
||||||
+ '<block type="hub_display_icon" id="hub_display_icon">' +
|
|
||||||
+ '<value name="ICON">' +
|
|
||||||
+ '<shadow type="matrix">' +
|
|
||||||
+ '<field name="MATRIX">0101001010000001000101110</field>' +
|
|
||||||
+ '</shadow>' +
|
|
||||||
+ '</value>' +
|
|
||||||
+ '</block>' +
|
|
||||||
'</category>' +
|
|
||||||
'<category name="%{BKY_CATEGORY_INPUT}" id="input" colour="#CF63CF" secondaryColour="#3373CC">' +
|
|
||||||
'<block type="hub_input_isbuttonpressed" id="hub_input_isbuttonpressed">' +
|
|
||||||
diff --git a/blocks_vertical/display.js b/blocks_vertical/display.js
|
|
||||||
index 22338b5e..5977c46a 100644
|
|
||||||
--- a/blocks_vertical/display.js
|
|
||||||
+++ b/blocks_vertical/display.js
|
|
||||||
@@ -61,3 +61,45 @@ Blockly.Blocks['hub_display_string'] = {
|
|
||||||
});
|
|
||||||
}
|
|
||||||
};
|
|
||||||
+
|
|
||||||
+Blockly.Blocks['hub_display_pixel'] = {
|
|
||||||
+ /**
|
|
||||||
+ * @this Blockly.Block
|
|
||||||
+ */
|
|
||||||
+ init: function() {
|
|
||||||
+ this.jsonInit({
|
|
||||||
+ "message0": Blockly.Msg.HUB_DISPLAY_PIXEL,
|
|
||||||
+ "args0": [
|
|
||||||
+ {
|
|
||||||
+ "type": "input_value",
|
|
||||||
+ "name": "PIXEL"
|
|
||||||
+ },
|
|
||||||
+ {
|
|
||||||
+ "type": "input_value",
|
|
||||||
+ "name": "BRIGHTNESS"
|
|
||||||
+ }
|
|
||||||
+ ],
|
|
||||||
+ "category": Blockly.Categories.display,
|
|
||||||
+ "extensions": ["colours_display", "shape_statement"]
|
|
||||||
+ });
|
|
||||||
+ }
|
|
||||||
+};
|
|
||||||
+
|
|
||||||
+Blockly.Blocks['hub_display_icon'] = {
|
|
||||||
+ /**
|
|
||||||
+ * @this Blockly.Block
|
|
||||||
+ */
|
|
||||||
+ init: function() {
|
|
||||||
+ this.jsonInit({
|
|
||||||
+ "message0": Blockly.Msg.HUB_DISPLAY_ICON,
|
|
||||||
+ "args0": [
|
|
||||||
+ {
|
|
||||||
+ "type": "input_value",
|
|
||||||
+ "name": "ICON"
|
|
||||||
+ }
|
|
||||||
+ ],
|
|
||||||
+ "category": Blockly.Categories.display,
|
|
||||||
+ "extensions": ["colours_display", "shape_statement"]
|
|
||||||
+ });
|
|
||||||
+ }
|
|
||||||
+};
|
|
||||||
diff --git a/core/field_matrix.js b/core/field_matrix.js
|
|
||||||
index e8410e30..19c0be9c 100644
|
|
||||||
--- a/core/field_matrix.js
|
|
||||||
+++ b/core/field_matrix.js
|
|
||||||
@@ -25,7 +25,8 @@
|
|
||||||
*/
|
|
||||||
'use strict';
|
|
||||||
|
|
||||||
-goog.provide('Blockly.FieldMatrix');
|
|
||||||
+goog.provide('Blockly.FieldMatrix')
|
|
||||||
+goog.provide('Blockly.FieldMatrixSingle');
|
|
||||||
|
|
||||||
goog.require('Blockly.DropDownDiv');
|
|
||||||
|
|
||||||
@@ -563,4 +564,549 @@ Blockly.FieldMatrix.prototype.dispose_ = function() {
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
+/**
|
|
||||||
+ * Class for a matrix field with only one selected pixel at a time.
|
|
||||||
+ * @param {number} matrix The default matrix value represented by a 25-bit integer.
|
|
||||||
+ * @extends {Blockly.Field}
|
|
||||||
+ * @constructor
|
|
||||||
+ */
|
|
||||||
+Blockly.FieldMatrixSingle = function(matrix) {
|
|
||||||
+ Blockly.FieldMatrixSingle.superClass_.constructor.call(this, matrix);
|
|
||||||
+ this.addArgType('matrix');
|
|
||||||
+ /**
|
|
||||||
+ * Array of SVGElement<rect> for matrix thumbnail image on block field.
|
|
||||||
+ * @type {!Array<SVGElement>}
|
|
||||||
+ * @private
|
|
||||||
+ */
|
|
||||||
+ this.ledThumbNodes_ = [];
|
|
||||||
+ /**
|
|
||||||
+ * Array of SVGElement<rect> for matrix editor in dropdown menu.
|
|
||||||
+ * @type {!Array<SVGElement>}
|
|
||||||
+ * @private
|
|
||||||
+ */
|
|
||||||
+ this.ledButtons_ = [];
|
|
||||||
+ /**
|
|
||||||
+ * String for storing current matrix value.
|
|
||||||
+ * @type {!String]
|
|
||||||
+ * @private
|
|
||||||
+ */
|
|
||||||
+ this.matrix_ = '';
|
|
||||||
+ /**
|
|
||||||
+ * SVGElement for LED matrix in editor.
|
|
||||||
+ * @type {?SVGElement}
|
|
||||||
+ * @private
|
|
||||||
+ */
|
|
||||||
+ this.matrixStage_ = null;
|
|
||||||
+ /**
|
|
||||||
+ * SVG image for dropdown arrow.
|
|
||||||
+ * @type {?SVGElement}
|
|
||||||
+ * @private
|
|
||||||
+ */
|
|
||||||
+ this.arrow_ = null;
|
|
||||||
+ /**
|
|
||||||
+ * String indicating matrix paint style.
|
|
||||||
+ * value can be [null, 'fill', 'clear'].
|
|
||||||
+ * @type {?String}
|
|
||||||
+ * @private
|
|
||||||
+ */
|
|
||||||
+ this.paintStyle_ = null;
|
|
||||||
+ /**
|
|
||||||
+ * Touch event wrapper.
|
|
||||||
+ * Runs when the field is selected.
|
|
||||||
+ * @type {!Array}
|
|
||||||
+ * @private
|
|
||||||
+ */
|
|
||||||
+ this.mouseDownWrapper_ = null;
|
|
||||||
+ /**
|
|
||||||
+ * Touch event wrapper.
|
|
||||||
+ * Runs when the clear button editor button is selected.
|
|
||||||
+ * @type {!Array}
|
|
||||||
+ * @private
|
|
||||||
+ */
|
|
||||||
+ this.clearButtonWrapper_ = null;
|
|
||||||
+ /**
|
|
||||||
+ * Touch event wrapper.
|
|
||||||
+ * Runs when the fill button editor button is selected.
|
|
||||||
+ * @type {!Array}
|
|
||||||
+ * @private
|
|
||||||
+ */
|
|
||||||
+ this.fillButtonWrapper_ = null;
|
|
||||||
+ /**
|
|
||||||
+ * Touch event wrapper.
|
|
||||||
+ * Runs when the matrix editor is touched.
|
|
||||||
+ * @type {!Array}
|
|
||||||
+ * @private
|
|
||||||
+ */
|
|
||||||
+ this.matrixTouchWrapper_ = null;
|
|
||||||
+ /**
|
|
||||||
+ * Touch event wrapper.
|
|
||||||
+ * Runs when the matrix editor touch event moves.
|
|
||||||
+ * @type {!Array}
|
|
||||||
+ * @private
|
|
||||||
+ */
|
|
||||||
+ this.matrixMoveWrapper_ = null;
|
|
||||||
+ /**
|
|
||||||
+ * Touch event wrapper.
|
|
||||||
+ * Runs when the matrix editor is released.
|
|
||||||
+ * @type {!Array}
|
|
||||||
+ * @private
|
|
||||||
+ */
|
|
||||||
+ this.matrixReleaseWrapper_ = null;
|
|
||||||
+};
|
|
||||||
+goog.inherits(Blockly.FieldMatrixSingle, Blockly.Field);
|
|
||||||
+
|
|
||||||
+/**
|
|
||||||
+ * Construct a FieldMatrixSingle from a JSON arg object.
|
|
||||||
+ * @param {!Object} options A JSON object with options (matrix).
|
|
||||||
+ * @returns {!Blockly.FieldMatrixSingle} The new field instance.
|
|
||||||
+ * @package
|
|
||||||
+ * @nocollapse
|
|
||||||
+ */
|
|
||||||
+Blockly.FieldMatrixSingle.fromJson = function(options) {
|
|
||||||
+ return new Blockly.FieldMatrixSingle(options['matrix']);
|
|
||||||
+};
|
|
||||||
+
|
|
||||||
+/**
|
|
||||||
+ * Fixed size of the matrix thumbnail in the input field, in px.
|
|
||||||
+ * @type {number}
|
|
||||||
+ * @const
|
|
||||||
+ */
|
|
||||||
+Blockly.FieldMatrixSingle.THUMBNAIL_SIZE = 26;
|
|
||||||
+
|
|
||||||
+/**
|
|
||||||
+ * Fixed size of each matrix thumbnail node, in px.
|
|
||||||
+ * @type {number}
|
|
||||||
+ * @const
|
|
||||||
+ */
|
|
||||||
+Blockly.FieldMatrixSingle.THUMBNAIL_NODE_SIZE = 4;
|
|
||||||
+
|
|
||||||
+/**
|
|
||||||
+ * Fixed size of each matrix thumbnail node, in px.
|
|
||||||
+ * @type {number}
|
|
||||||
+ * @const
|
|
||||||
+ */
|
|
||||||
+Blockly.FieldMatrixSingle.THUMBNAIL_NODE_PAD = 1;
|
|
||||||
+
|
|
||||||
+/**
|
|
||||||
+ * Fixed size of arrow icon in drop down menu, in px.
|
|
||||||
+ * @type {number}
|
|
||||||
+ * @const
|
|
||||||
+ */
|
|
||||||
+Blockly.FieldMatrixSingle.ARROW_SIZE = 12;
|
|
||||||
+
|
|
||||||
+/**
|
|
||||||
+ * Fixed size of each button inside the 5x5 matrix, in px.
|
|
||||||
+ * @type {number}
|
|
||||||
+ * @const
|
|
||||||
+ */
|
|
||||||
+Blockly.FieldMatrixSingle.MATRIX_NODE_SIZE = 18;
|
|
||||||
+
|
|
||||||
+/**
|
|
||||||
+ * Fixed corner radius for 5x5 matrix buttons, in px.
|
|
||||||
+ * @type {number}
|
|
||||||
+ * @const
|
|
||||||
+ */
|
|
||||||
+Blockly.FieldMatrixSingle.MATRIX_NODE_RADIUS = 4;
|
|
||||||
+
|
|
||||||
+/**
|
|
||||||
+ * Fixed padding for 5x5 matrix buttons, in px.
|
|
||||||
+ * @type {number}
|
|
||||||
+ * @const
|
|
||||||
+ */
|
|
||||||
+Blockly.FieldMatrixSingle.MATRIX_NODE_PAD = 5;
|
|
||||||
+
|
|
||||||
+/**
|
|
||||||
+ * String with 25 '0' chars.
|
|
||||||
+ * Used for clearing a matrix or filling an LED node array.
|
|
||||||
+ * @type {string}
|
|
||||||
+ * @const
|
|
||||||
+ */
|
|
||||||
+Blockly.FieldMatrixSingle.ZEROS = '0000000000000000000000000';
|
|
||||||
+
|
|
||||||
+/**
|
|
||||||
+ * String with 25 '1' chars.
|
|
||||||
+ * Used for filling a matrix.
|
|
||||||
+ * @type {string}
|
|
||||||
+ * @const
|
|
||||||
+ */
|
|
||||||
+Blockly.FieldMatrixSingle.ONES = '1111111111111111111111111';
|
|
||||||
+
|
|
||||||
+/**
|
|
||||||
+ * Called when the field is placed on a block.
|
|
||||||
+ * @param {Block} block The owning block.
|
|
||||||
+ */
|
|
||||||
+Blockly.FieldMatrixSingle.prototype.init = function() {
|
|
||||||
+ if (this.fieldGroup_) {
|
|
||||||
+ // Matrix menu has already been initialized once.
|
|
||||||
+ return;
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ // Build the DOM.
|
|
||||||
+ this.fieldGroup_ = Blockly.utils.createSvgElement('g', {}, null);
|
|
||||||
+ this.size_.width = Blockly.FieldMatrixSingle.THUMBNAIL_SIZE +
|
|
||||||
+ Blockly.FieldMatrixSingle.ARROW_SIZE + (Blockly.BlockSvg.DROPDOWN_ARROW_PADDING * 1.5);
|
|
||||||
+
|
|
||||||
+ this.sourceBlock_.getSvgRoot().appendChild(this.fieldGroup_);
|
|
||||||
+
|
|
||||||
+ var thumbX = Blockly.BlockSvg.DROPDOWN_ARROW_PADDING / 2;
|
|
||||||
+ var thumbY = (this.size_.height - Blockly.FieldMatrixSingle.THUMBNAIL_SIZE) / 2;
|
|
||||||
+ var thumbnail = Blockly.utils.createSvgElement('g', {
|
|
||||||
+ 'transform': 'translate(' + thumbX + ', ' + thumbY + ')',
|
|
||||||
+ 'pointer-events': 'bounding-box', 'cursor': 'pointer'
|
|
||||||
+ }, this.fieldGroup_);
|
|
||||||
+ this.ledThumbNodes_ = [];
|
|
||||||
+ var nodeSize = Blockly.FieldMatrixSingle.THUMBNAIL_NODE_SIZE;
|
|
||||||
+ var nodePad = Blockly.FieldMatrixSingle.THUMBNAIL_NODE_PAD;
|
|
||||||
+ for (var i = 0; i < 5; i++) {
|
|
||||||
+ for (var n = 0; n < 5; n++) {
|
|
||||||
+ var attr = {
|
|
||||||
+ 'x': ((nodeSize + nodePad) * n) + nodePad,
|
|
||||||
+ 'y': ((nodeSize + nodePad) * i) + nodePad,
|
|
||||||
+ 'width': nodeSize, 'height': nodeSize,
|
|
||||||
+ 'rx': nodePad, 'ry': nodePad
|
|
||||||
+ };
|
|
||||||
+ this.ledThumbNodes_.push(
|
|
||||||
+ Blockly.utils.createSvgElement('rect', attr, thumbnail)
|
|
||||||
+ );
|
|
||||||
+ }
|
|
||||||
+ thumbnail.style.cursor = 'default';
|
|
||||||
+ this.updateMatrix_();
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ if (!this.arrow_) {
|
|
||||||
+ var arrowX = Blockly.FieldMatrixSingle.THUMBNAIL_SIZE +
|
|
||||||
+ Blockly.BlockSvg.DROPDOWN_ARROW_PADDING * 1.5;
|
|
||||||
+ var arrowY = (this.size_.height - Blockly.FieldMatrixSingle.ARROW_SIZE) / 2;
|
|
||||||
+ this.arrow_ = Blockly.utils.createSvgElement('image', {
|
|
||||||
+ 'height': Blockly.FieldMatrixSingle.ARROW_SIZE + 'px',
|
|
||||||
+ 'width': Blockly.FieldMatrixSingle.ARROW_SIZE + 'px',
|
|
||||||
+ 'transform': 'translate(' + arrowX + ', ' + arrowY + ')'
|
|
||||||
+ }, this.fieldGroup_);
|
|
||||||
+ this.arrow_.setAttributeNS('http://www.w3.org/1999/xlink',
|
|
||||||
+ 'xlink:href', Blockly.mainWorkspace.options.pathToMedia +
|
|
||||||
+ 'dropdown-arrow.svg');
|
|
||||||
+ this.arrow_.style.cursor = 'default';
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ this.mouseDownWrapper_ = Blockly.bindEventWithChecks_(
|
|
||||||
+ this.getClickTarget_(), 'mousedown', this, this.onMouseDown_);
|
|
||||||
+};
|
|
||||||
+
|
|
||||||
+/**
|
|
||||||
+ * Set the value for this matrix menu.
|
|
||||||
+ * @param {string} matrix The new matrix value represented by a 25-bit integer.
|
|
||||||
+ * @override
|
|
||||||
+ */
|
|
||||||
+Blockly.FieldMatrixSingle.prototype.setValue = function(matrix) {
|
|
||||||
+ if (!matrix || matrix === this.matrix_) {
|
|
||||||
+ return; // No change
|
|
||||||
+ }
|
|
||||||
+ if (this.sourceBlock_ && Blockly.Events.isEnabled()) {
|
|
||||||
+ Blockly.Events.fire(new Blockly.Events.Change(
|
|
||||||
+ this.sourceBlock_, 'field', this.name, this.matrix_, matrix));
|
|
||||||
+ }
|
|
||||||
+ matrix = matrix + Blockly.FieldMatrixSingle.ZEROS.substr(0, 25 - matrix.length);
|
|
||||||
+ this.matrix_ = matrix;
|
|
||||||
+ this.updateMatrix_();
|
|
||||||
+};
|
|
||||||
+
|
|
||||||
+/**
|
|
||||||
+ * Get the value from this matrix menu.
|
|
||||||
+ * @return {string} Current matrix value.
|
|
||||||
+ */
|
|
||||||
+Blockly.FieldMatrixSingle.prototype.getValue = function() {
|
|
||||||
+ return String(this.matrix_);
|
|
||||||
+};
|
|
||||||
+
|
|
||||||
+/**
|
|
||||||
+ * Show the drop-down menu for editing this field.
|
|
||||||
+ * @private
|
|
||||||
+ */
|
|
||||||
+Blockly.FieldMatrixSingle.prototype.showEditor_ = function() {
|
|
||||||
+ // If there is an existing drop-down someone else owns, hide it immediately and clear it.
|
|
||||||
+ Blockly.DropDownDiv.hideWithoutAnimation();
|
|
||||||
+ Blockly.DropDownDiv.clearContent();
|
|
||||||
+ var div = Blockly.DropDownDiv.getContentDiv();
|
|
||||||
+ // Build the SVG DOM.
|
|
||||||
+ var matrixSize = (Blockly.FieldMatrixSingle.MATRIX_NODE_SIZE * 5) +
|
|
||||||
+ (Blockly.FieldMatrixSingle.MATRIX_NODE_PAD * 6);
|
|
||||||
+ this.matrixStage_ = Blockly.utils.createSvgElement('svg', {
|
|
||||||
+ 'xmlns': 'http://www.w3.org/2000/svg',
|
|
||||||
+ 'xmlns:html': 'http://www.w3.org/1999/xhtml',
|
|
||||||
+ 'xmlns:xlink': 'http://www.w3.org/1999/xlink',
|
|
||||||
+ 'version': '1.1',
|
|
||||||
+ 'height': matrixSize + 'px',
|
|
||||||
+ 'width': matrixSize + 'px'
|
|
||||||
+ }, div);
|
|
||||||
+ // Create the 5x5 matrix
|
|
||||||
+ this.ledButtons_ = [];
|
|
||||||
+ for (var i = 0; i < 5; i++) {
|
|
||||||
+ for (var n = 0; n < 5; n++) {
|
|
||||||
+ var x = (Blockly.FieldMatrixSingle.MATRIX_NODE_SIZE * n) +
|
|
||||||
+ (Blockly.FieldMatrixSingle.MATRIX_NODE_PAD * (n + 1));
|
|
||||||
+ var y = (Blockly.FieldMatrixSingle.MATRIX_NODE_SIZE * i) +
|
|
||||||
+ (Blockly.FieldMatrixSingle.MATRIX_NODE_PAD * (i + 1));
|
|
||||||
+ var attr = {
|
|
||||||
+ 'x': x + 'px', 'y': y + 'px',
|
|
||||||
+ 'width': Blockly.FieldMatrixSingle.MATRIX_NODE_SIZE,
|
|
||||||
+ 'height': Blockly.FieldMatrixSingle.MATRIX_NODE_SIZE,
|
|
||||||
+ 'rx': Blockly.FieldMatrixSingle.MATRIX_NODE_RADIUS,
|
|
||||||
+ 'ry': Blockly.FieldMatrixSingle.MATRIX_NODE_RADIUS
|
|
||||||
+ };
|
|
||||||
+ var led = Blockly.utils.createSvgElement('rect', attr, this.matrixStage_);
|
|
||||||
+ this.matrixStage_.appendChild(led);
|
|
||||||
+ this.ledButtons_.push(led);
|
|
||||||
+ }
|
|
||||||
+ }
|
|
||||||
+ // Div for lower button menu
|
|
||||||
+ /*
|
|
||||||
+ var buttonDiv = document.createElement('div');
|
|
||||||
+ // Button to clear matrix
|
|
||||||
+ var clearButtonDiv = document.createElement('div');
|
|
||||||
+ clearButtonDiv.className = 'scratchMatrixButtonDiv';
|
|
||||||
+ var clearButton = this.createButton_(this.sourceBlock_.colourSecondary_);
|
|
||||||
+ clearButtonDiv.appendChild(clearButton);
|
|
||||||
+ // Button to fill matrix
|
|
||||||
+
|
|
||||||
+ var fillButtonDiv = document.createElement('div');
|
|
||||||
+ fillButtonDiv.className = 'scratchMatrixButtonDiv';
|
|
||||||
+ var fillButton = this.createButton_('#FFFFFF');
|
|
||||||
+ fillButtonDiv.appendChild(fillButton);
|
|
||||||
+
|
|
||||||
+
|
|
||||||
+
|
|
||||||
+ buttonDiv.appendChild(clearButtonDiv);
|
|
||||||
+ buttonDiv.appendChild(fillButtonDiv);
|
|
||||||
+ div.appendChild(buttonDiv);
|
|
||||||
+
|
|
||||||
+
|
|
||||||
+ */
|
|
||||||
+
|
|
||||||
+ Blockly.DropDownDiv.setColour(this.sourceBlock_.getColour(),
|
|
||||||
+ this.sourceBlock_.getColourTertiary());
|
|
||||||
+ Blockly.DropDownDiv.setCategory(this.sourceBlock_.getCategory());
|
|
||||||
+ Blockly.DropDownDiv.showPositionedByBlock(this, this.sourceBlock_);
|
|
||||||
+
|
|
||||||
+ this.matrixTouchWrapper_ =
|
|
||||||
+ Blockly.bindEvent_(this.matrixStage_, 'mousedown', this, this.onMouseDown);
|
|
||||||
+ //this.clearButtonWrapper_ =
|
|
||||||
+ // Blockly.bindEvent_(clearButton, 'click', this, this.clearMatrix_);
|
|
||||||
+ //this.fillButtonWrapper_ =
|
|
||||||
+ // Blockly.bindEvent_(fillButton, 'click', this, this.fillMatrix_);
|
|
||||||
+
|
|
||||||
+ // Update the matrix for the current value
|
|
||||||
+ this.updateMatrix_();
|
|
||||||
+
|
|
||||||
+};
|
|
||||||
+
|
|
||||||
+this.nodeCallback_ = function(e, num) {
|
|
||||||
+ console.log(num);
|
|
||||||
+};
|
|
||||||
+
|
|
||||||
+/**
|
|
||||||
+ * Make an svg object that resembles a 3x3 matrix to be used as a button.
|
|
||||||
+ * @param {string} fill The color to fill the matrix nodes.
|
|
||||||
+ * @return {SvgElement} The button svg element.
|
|
||||||
+ */
|
|
||||||
+Blockly.FieldMatrixSingle.prototype.createButton_ = function(fill) {
|
|
||||||
+ var button = Blockly.utils.createSvgElement('svg', {
|
|
||||||
+ 'xmlns': 'http://www.w3.org/2000/svg',
|
|
||||||
+ 'xmlns:html': 'http://www.w3.org/1999/xhtml',
|
|
||||||
+ 'xmlns:xlink': 'http://www.w3.org/1999/xlink',
|
|
||||||
+ 'version': '1.1',
|
|
||||||
+ 'height': Blockly.FieldMatrixSingle.MATRIX_NODE_SIZE + 'px',
|
|
||||||
+ 'width': Blockly.FieldMatrixSingle.MATRIX_NODE_SIZE + 'px'
|
|
||||||
+ });
|
|
||||||
+ var nodeSize = Blockly.FieldMatrixSingle.MATRIX_NODE_SIZE / 4;
|
|
||||||
+ var nodePad = Blockly.FieldMatrixSingle.MATRIX_NODE_SIZE / 16;
|
|
||||||
+ for (var i = 0; i < 3; i++) {
|
|
||||||
+ for (var n = 0; n < 3; n++) {
|
|
||||||
+ Blockly.utils.createSvgElement('rect', {
|
|
||||||
+ 'x': ((nodeSize + nodePad) * n) + nodePad,
|
|
||||||
+ 'y': ((nodeSize + nodePad) * i) + nodePad,
|
|
||||||
+ 'width': nodeSize, 'height': nodeSize,
|
|
||||||
+ 'rx': nodePad, 'ry': nodePad,
|
|
||||||
+ 'fill': fill
|
|
||||||
+ }, button);
|
|
||||||
+ }
|
|
||||||
+ }
|
|
||||||
+ return button;
|
|
||||||
+};
|
|
||||||
+
|
|
||||||
+/**
|
|
||||||
+ * Redraw the matrix with the current value.
|
|
||||||
+ * @private
|
|
||||||
+ */
|
|
||||||
+Blockly.FieldMatrixSingle.prototype.updateMatrix_ = function() {
|
|
||||||
+ for (var i = 0; i < this.matrix_.length; i++) {
|
|
||||||
+ if (this.matrix_[i] === '0') {
|
|
||||||
+ this.fillMatrixNode_(this.ledButtons_, i, this.sourceBlock_.colourSecondary_);
|
|
||||||
+ this.fillMatrixNode_(this.ledThumbNodes_, i, this.sourceBlock_.colour_);
|
|
||||||
+ } else {
|
|
||||||
+ this.fillMatrixNode_(this.ledButtons_, i, '#FFFFFF');
|
|
||||||
+ this.fillMatrixNode_(this.ledThumbNodes_, i, '#FFFFFF');
|
|
||||||
+ }
|
|
||||||
+ }
|
|
||||||
+};
|
|
||||||
+
|
|
||||||
+/**
|
|
||||||
+ * Clear the matrix.
|
|
||||||
+ * @param {!Event} e Mouse event.
|
|
||||||
+ */
|
|
||||||
+Blockly.FieldMatrixSingle.prototype.clearMatrix_ = function(e) {
|
|
||||||
+ if (e.button != 0) return;
|
|
||||||
+ this.setValue(Blockly.FieldMatrixSingle.ZEROS);
|
|
||||||
+};
|
|
||||||
+
|
|
||||||
+/**
|
|
||||||
+ * Fill the matrix.
|
|
||||||
+ * @param {!Event} e Mouse event.
|
|
||||||
+ */
|
|
||||||
+Blockly.FieldMatrixSingle.prototype.fillMatrix_ = function(e) {
|
|
||||||
+ if (e.button != 0) return;
|
|
||||||
+ this.setValue(Blockly.FieldMatrixSingle.ONES);
|
|
||||||
+};
|
|
||||||
+
|
|
||||||
+/**
|
|
||||||
+ * Fill matrix node with specified colour.
|
|
||||||
+ * @param {!Array<SVGElement>} node The array of matrix nodes.
|
|
||||||
+ * @param {!number} index The index of the matrix node.
|
|
||||||
+ * @param {!string} fill The fill colour in '#rrggbb' format.
|
|
||||||
+ */
|
|
||||||
+Blockly.FieldMatrixSingle.prototype.fillMatrixNode_ = function(node, index, fill) {
|
|
||||||
+ if (!node || !node[index] || !fill) return;
|
|
||||||
+ node[index].setAttribute('fill', fill);
|
|
||||||
+};
|
|
||||||
+
|
|
||||||
+Blockly.FieldMatrixSingle.prototype.setLEDNode_ = function(led, state) {
|
|
||||||
+ if (led < 0 || led > 24) return;
|
|
||||||
+ var matrix = this.matrix_.substr(0, led) + state + this.matrix_.substr(led + 1);
|
|
||||||
+ this.setValue(matrix);
|
|
||||||
+};
|
|
||||||
+
|
|
||||||
+Blockly.FieldMatrixSingle.prototype.fillLEDNode_ = function(led) {
|
|
||||||
+ if (led < 0 || led > 24) return;
|
|
||||||
+ this.setLEDNode_(led, '1');
|
|
||||||
+};
|
|
||||||
+
|
|
||||||
+Blockly.FieldMatrixSingle.prototype.clearLEDNode_ = function(led) {
|
|
||||||
+ if (led < 0 || led > 24) return;
|
|
||||||
+ this.setLEDNode_(led, '0');
|
|
||||||
+};
|
|
||||||
+
|
|
||||||
+Blockly.FieldMatrixSingle.prototype.toggleLEDNode_ = function(led, e) {
|
|
||||||
+ this.clearMatrix_(e);
|
|
||||||
+ if (led < 0 || led > 24) return;
|
|
||||||
+ if (this.matrix_.charAt(led) === '0') {
|
|
||||||
+ this.setLEDNode_(led, '1');
|
|
||||||
+ } else {
|
|
||||||
+ this.setLEDNode_(led, '0');
|
|
||||||
+ }
|
|
||||||
+};
|
|
||||||
+
|
|
||||||
+/**
|
|
||||||
+ * Toggle matrix nodes on and off.
|
|
||||||
+ * @param {!Event} e Mouse event.
|
|
||||||
+ */
|
|
||||||
+Blockly.FieldMatrixSingle.prototype.onMouseDown = function(e) {
|
|
||||||
+ this.matrixMoveWrapper_ =
|
|
||||||
+ Blockly.bindEvent_(document.body, 'mousemove', this, this.onMouseMove);
|
|
||||||
+ this.matrixReleaseWrapper_ =
|
|
||||||
+ Blockly.bindEvent_(document.body, 'mouseup', this, this.onMouseUp);
|
|
||||||
+ var ledHit = this.checkForLED_(e);
|
|
||||||
+ if (ledHit > -1) {
|
|
||||||
+ if (this.matrix_.charAt(ledHit) === '0') {
|
|
||||||
+ this.paintStyle_ = 'fill';
|
|
||||||
+ } else {
|
|
||||||
+ this.paintStyle_ = 'clear';
|
|
||||||
+ }
|
|
||||||
+ this.toggleLEDNode_(ledHit, e);
|
|
||||||
+ this.updateMatrix_();
|
|
||||||
+ } else {
|
|
||||||
+ this.paintStyle_ = null;
|
|
||||||
+ }
|
|
||||||
+};
|
|
||||||
+
|
|
||||||
+/**
|
|
||||||
+ * Unbind mouse move event and clear the paint style.
|
|
||||||
+ * @param {!Event} e Mouse move event.
|
|
||||||
+ */
|
|
||||||
+Blockly.FieldMatrixSingle.prototype.onMouseUp = function(e) {
|
|
||||||
+ Blockly.unbindEvent_(this.matrixMoveWrapper_);
|
|
||||||
+ Blockly.unbindEvent_(this.matrixReleaseWrapper_);
|
|
||||||
+ this.paintStyle_ = null;
|
|
||||||
+};
|
|
||||||
+
|
|
||||||
+/**
|
|
||||||
+ * Toggle matrix nodes on and off by dragging mouse.
|
|
||||||
+ * @param {!Event} e Mouse move event.
|
|
||||||
+ */
|
|
||||||
+Blockly.FieldMatrixSingle.prototype.onMouseMove = function(e) {
|
|
||||||
+ e.preventDefault();
|
|
||||||
+ if (this.paintStyle_) {
|
|
||||||
+ var led = this.checkForLED_(e);
|
|
||||||
+ if (led < 0) return;
|
|
||||||
+ if (this.paintStyle_ === 'clear') {
|
|
||||||
+ this.clearLEDNode_(led);
|
|
||||||
+ } else if (this.paintStyle_ === 'fill') {
|
|
||||||
+ this.clearMatrix_(e);
|
|
||||||
+ this.fillLEDNode_(led);
|
|
||||||
+ }
|
|
||||||
+ }
|
|
||||||
+};
|
|
||||||
+
|
|
||||||
+/**
|
|
||||||
+ * Check if mouse coordinates collide with a matrix node.
|
|
||||||
+ * @param {!Event} e Mouse move event.
|
|
||||||
+ * @return {number} The matching matrix node or -1 for none.
|
|
||||||
+ */
|
|
||||||
+Blockly.FieldMatrixSingle.prototype.checkForLED_ = function(e) {
|
|
||||||
+ var bBox = this.matrixStage_.getBoundingClientRect();
|
|
||||||
+ var nodeSize = Blockly.FieldMatrixSingle.MATRIX_NODE_SIZE;
|
|
||||||
+ var nodePad = Blockly.FieldMatrixSingle.MATRIX_NODE_PAD;
|
|
||||||
+ var dx = e.clientX - bBox.left;
|
|
||||||
+ var dy = e.clientY - bBox.top;
|
|
||||||
+ var min = nodePad / 2;
|
|
||||||
+ var max = bBox.width - (nodePad / 2);
|
|
||||||
+ if (dx < min || dx > max || dy < min || dy > max) {
|
|
||||||
+ return -1;
|
|
||||||
+ }
|
|
||||||
+ var xDiv = Math.trunc((dx - nodePad / 2) / (nodeSize + nodePad));
|
|
||||||
+ var yDiv = Math.trunc((dy - nodePad / 2) / (nodeSize + nodePad));
|
|
||||||
+ return xDiv + (yDiv * nodePad);
|
|
||||||
+};
|
|
||||||
+
|
|
||||||
+/**
|
|
||||||
+ * Clean up this FieldMatrixSingle, as well as the inherited Field.
|
|
||||||
+ * @return {!Function} Closure to call on destruction of the WidgetDiv.
|
|
||||||
+ * @private
|
|
||||||
+ */
|
|
||||||
+Blockly.FieldMatrixSingle.prototype.dispose_ = function() {
|
|
||||||
+ var thisField = this;
|
|
||||||
+ return function() {
|
|
||||||
+ Blockly.FieldMatrixSingle.superClass_.dispose_.call(thisField)();
|
|
||||||
+ thisField.matrixStage_ = null;
|
|
||||||
+ if (thisField.mouseDownWrapper_) {
|
|
||||||
+ Blockly.unbindEvent_(thisField.mouseDownWrapper_);
|
|
||||||
+ }
|
|
||||||
+ if (thisField.matrixTouchWrapper_) {
|
|
||||||
+ Blockly.unbindEvent_(thisField.matrixTouchWrapper_);
|
|
||||||
+ }
|
|
||||||
+ if (thisField.matrixReleaseWrapper_) {
|
|
||||||
+ Blockly.unbindEvent_(thisField.matrixReleaseWrapper_);
|
|
||||||
+ }
|
|
||||||
+ if (thisField.matrixMoveWrapper_) {
|
|
||||||
+ Blockly.unbindEvent_(thisField.matrixMoveWrapper_);
|
|
||||||
+ }
|
|
||||||
+ if (thisField.clearButtonWrapper_) {
|
|
||||||
+ Blockly.unbindEvent_(thisField.clearButtonWrapper_);
|
|
||||||
+ }
|
|
||||||
+ if (thisField.fillButtonWrapper_) {
|
|
||||||
+ Blockly.unbindEvent_(thisField.fillButtonWrapper_);
|
|
||||||
+ }
|
|
||||||
+ };
|
|
||||||
+};
|
|
||||||
+
|
|
||||||
+
|
|
||||||
Blockly.Field.register('field_matrix', Blockly.FieldMatrix);
|
|
||||||
+Blockly.Field.register('field_matrix_single', Blockly.FieldMatrixSingle);
|
|
||||||
diff --git a/msg/messages.js b/msg/messages.js
|
|
||||||
index feb70bcd..b9cd5997 100644
|
|
||||||
--- a/msg/messages.js
|
|
||||||
+++ b/msg/messages.js
|
|
||||||
@@ -375,6 +375,8 @@ Blockly.Msg.HUB_DISPLAY_OFF = 'turn display off';
|
|
||||||
Blockly.Msg.HUB_DISPLAY_NUM = 'show digits %1 on display';
|
|
||||||
Blockly.Msg.HUB_DISPLAY_CHAR = 'show char %1 on display';
|
|
||||||
Blockly.Msg.HUB_DISPLAY_STRING = 'scroll %1 across display';
|
|
||||||
+Blockly.Msg.HUB_DISPLAY_PIXEL = 'set %1 to %2 brightness';
|
|
||||||
+Blockly.Msg.HUB_DISPLAY_ICON = 'show %1 on display';
|
|
||||||
|
|
||||||
Blockly.Msg.HUB_INPUT_ISBUTTONPRESSED = 'is %1 button pressed?';
|
|
||||||
|
|
||||||
--
|
|
||||||
2.40.1
|
|
||||||
|
|
|
@ -1 +0,0 @@
|
||||||
7807d68b593f5e482a4450581ba27d4d6d939003
|
|
|
@ -1,21 +0,0 @@
|
||||||
From ffe17da4d9c7319672e67bee9ee0ec4b3ccf11ee Mon Sep 17 00:00:00 2001
|
|
||||||
From: c0repwn3r <core@coredoes.dev>
|
|
||||||
Date: Wed, 24 May 2023 14:21:32 -0400
|
|
||||||
Subject: [PATCH] a patch to make patcher work
|
|
||||||
|
|
||||||
---
|
|
||||||
src/components/telemetry-modal/telemetry-modal.jsx | 1 +
|
|
||||||
1 file changed, 1 insertion(+)
|
|
||||||
|
|
||||||
diff --git a/src/components/telemetry-modal/telemetry-modal.jsx b/src/components/telemetry-modal/telemetry-modal.jsx
|
|
||||||
index 3f5c76b32..d202e6a17 100644
|
|
||||||
--- a/src/components/telemetry-modal/telemetry-modal.jsx
|
|
||||||
+++ b/src/components/telemetry-modal/telemetry-modal.jsx
|
|
||||||
@@ -1,3 +1,4 @@
|
|
||||||
+// TODO: Remove
|
|
||||||
import bindAll from 'lodash.bindall';
|
|
||||||
import PropTypes from 'prop-types';
|
|
||||||
import React from 'react';
|
|
||||||
--
|
|
||||||
2.40.1
|
|
||||||
|
|
|
@ -1 +0,0 @@
|
||||||
3bb1944a1a6eda77006c77a2bf539fb87b7be55f
|
|
174
pbt.sh
|
@ -6,75 +6,37 @@ job_start() {
|
||||||
# [*] job start - [target]:[job]
|
# [*] job start - [target]:[job]
|
||||||
# bold
|
# bold
|
||||||
echo -e "\e[1m[*] job start - $1:$2\e[0m"
|
echo -e "\e[1m[*] job start - $1:$2\e[0m"
|
||||||
job_start=$(date +%s.%N)
|
job_start=$(date +%s)
|
||||||
}
|
}
|
||||||
job_success() {
|
job_success() {
|
||||||
# [*] success! [target]:[job] finished in 241.2s :)
|
# [*] success! [target]:[job] finished in 241.2s :)
|
||||||
end=$(date +%s.%N)
|
end=$(date +%s)
|
||||||
time=$( echo "$end - $job_start" | bc -l )
|
time=$(( end - job_start ))
|
||||||
echo -e "\e[1m\e[32m[*] success! $1:$2 finished in $time seconds :)\e[0m"
|
echo -e "\e[1m\e[32m[*] success! $1:$2 finished in $time seconds :)\e[0m"
|
||||||
}
|
}
|
||||||
job_fail() {
|
job_fail() {
|
||||||
# [x] FAIL! [target]:[job] failed in 241.2s :(
|
# [x] FAIL! [target]:[job] failed in 241.2s :(
|
||||||
end=$(date +%s.%N)
|
end=$(date +%s)
|
||||||
time=$( echo "$end - $job_start" | bc -l )
|
time=$(( end - job_start ))
|
||||||
echo -e "\e[1m\e[31m[*] FAIL! $1:$2 failed in $time seconds :(\e[0m"
|
echo -e "\e[1m\e[31m[*] FAIL! $1:$2 failed in $time seconds :(\e[0m"
|
||||||
}
|
}
|
||||||
job_skip() {
|
|
||||||
# [-] skipped - [target]:[job] skipped in 241.2s
|
|
||||||
end=$(date +%s.%N)
|
|
||||||
time=$( echo "$end - $job_start" | bc -l )
|
|
||||||
echo -e "\e[1m\e[34m[-] skipped - $1:$2 skipped after $time seconds\e[0m"
|
|
||||||
}
|
|
||||||
|
|
||||||
sub_clone() {
|
sub_clone() {
|
||||||
job_start "scratch-blocks" "clone"
|
job_start "scratch-blocks" "clone"
|
||||||
if [ -d "$(pwd)/scratch-blocks" ]; then
|
|
||||||
echo "Clone dir already exists"
|
git submodule init
|
||||||
job_skip "scratch-blocks" "clone"
|
|
||||||
else
|
|
||||||
git clone https://github.com/scratchfoundation/scratch-blocks scratch-blocks
|
|
||||||
if [ "$?" != "0" ]; then
|
if [ "$?" != "0" ]; then
|
||||||
job_fail "scratch-blocks" "clone"
|
job_fail "scratch-blocks" "clone"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
job_success "scratch-blocks" "clone"
|
|
||||||
fi
|
|
||||||
job_start "scratch-blocks" "checkout"
|
|
||||||
pbase=$(cat patches/blocks/PATCHBASE | tr -d '\n')
|
|
||||||
echo "Checking out scratch-blocks patchbase $pbase"
|
|
||||||
cd scratch-blocks || exit
|
|
||||||
git checkout "$pbase"
|
|
||||||
if [ "$?" != "0" ]; then
|
|
||||||
job_fail "scratch-blocks" "checkout"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
cd .. || exit
|
|
||||||
job_success "scratch-blocks" "checkout"
|
|
||||||
|
|
||||||
job_start "scratch-gui" "clone"
|
git submodule update
|
||||||
if [ -d "$(pwd)/scratch-gui" ]; then
|
|
||||||
echo "Clone dir already exists"
|
|
||||||
job_skip "scratch-gui" "clone"
|
|
||||||
else
|
|
||||||
git clone https://github.com/scratchfoundation/scratch-gui scratch-gui
|
|
||||||
if [ "$?" != "0" ]; then
|
if [ "$?" != "0" ]; then
|
||||||
job_fail "scratch-gui" "clone"
|
job_fail "scratch-blocks" "clone"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
job_success "scratch-gui" "clone"
|
|
||||||
fi
|
job_success "scratch-blocks" "clone"
|
||||||
job_start "scratch-gui" "checkout"
|
|
||||||
pbase=$(cat patches/gui/PATCHBASE | tr -d '\n')
|
|
||||||
echo "Checking out scratch-gui patchbase $pbase"
|
|
||||||
cd scratch-gui || exit
|
|
||||||
git checkout "$pbase"
|
|
||||||
if [ "$?" != "0" ]; then
|
|
||||||
job_fail "scratch-gui" "checkout"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
cd .. || exit
|
|
||||||
job_success "scratch-gui" "checkout"
|
|
||||||
}
|
}
|
||||||
|
|
||||||
sub_patch() {
|
sub_patch() {
|
||||||
|
@ -86,7 +48,7 @@ sub_patch() {
|
||||||
|
|
||||||
git am --abort >/dev/null 2>&1
|
git am --abort >/dev/null 2>&1
|
||||||
|
|
||||||
git am --3way "../patches/blocks/"*.patch
|
git am --3way "../patches/scratch-blocks/"*.patch
|
||||||
if [ "$?" != "0" ]; then
|
if [ "$?" != "0" ]; then
|
||||||
echo "One or more patches did not apply cleanly to scratch-blocks. Check above message and try again".
|
echo "One or more patches did not apply cleanly to scratch-blocks. Check above message and try again".
|
||||||
job_fail "scratch-blocks" "patch"
|
job_fail "scratch-blocks" "patch"
|
||||||
|
@ -95,28 +57,7 @@ sub_patch() {
|
||||||
|
|
||||||
echo "[*] Patches applied cleanly to scratch-blocks"
|
echo "[*] Patches applied cleanly to scratch-blocks"
|
||||||
|
|
||||||
cd .. || exit
|
|
||||||
|
|
||||||
job_success "scratch-blocks" "patch"
|
job_success "scratch-blocks" "patch"
|
||||||
|
|
||||||
job_start "scratch-gui" "patch"
|
|
||||||
|
|
||||||
cd scratch-gui || exit
|
|
||||||
|
|
||||||
git am --abort >/dev/null 2>&1
|
|
||||||
|
|
||||||
git am --3way "../patches/gui/"*.patch
|
|
||||||
if [ "$?" != "0" ]; then
|
|
||||||
echo "One or more patches did not apply cleanly to scratch-gui. Check above message and try again".
|
|
||||||
job_fail "scratch-gui" "patch"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo "[*] Patches applied cleanly to scratch-gui"
|
|
||||||
|
|
||||||
cd .. || exit
|
|
||||||
|
|
||||||
job_success "scratch-gui" "patch"
|
|
||||||
}
|
}
|
||||||
|
|
||||||
sub_compile() {
|
sub_compile() {
|
||||||
|
@ -124,8 +65,6 @@ sub_compile() {
|
||||||
|
|
||||||
job_start "scratch-blocks" "compile"
|
job_start "scratch-blocks" "compile"
|
||||||
|
|
||||||
cd scratch-blocks || exit
|
|
||||||
|
|
||||||
NODE_OPTIONS=--openssl-legacy-provider npm i
|
NODE_OPTIONS=--openssl-legacy-provider npm i
|
||||||
|
|
||||||
if [ "$?" != "0" ]; then
|
if [ "$?" != "0" ]; then
|
||||||
|
@ -133,99 +72,14 @@ sub_compile() {
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
npm link
|
|
||||||
|
|
||||||
if [ "$?" != "0" ]; then
|
|
||||||
echo "Unable to configure scratch-gui to use scratch-blocks. Check above message and try again".
|
|
||||||
job_fail "scratch-blocks" "compile"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
cd .. || exit
|
|
||||||
|
|
||||||
job_success "scratch-blocks" "compile"
|
job_success "scratch-blocks" "compile"
|
||||||
|
|
||||||
job_start "scratch-gui" "compile"
|
|
||||||
|
|
||||||
cd scratch-gui || exit
|
|
||||||
|
|
||||||
npm link scratch-blocks
|
|
||||||
if [ "$?" != "0" ]; then
|
|
||||||
echo "Unable to configure scratch-gui to use scratch-blocks. Check above message and try again".
|
|
||||||
job_fail "scratch-gui" "compile"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
npm i
|
|
||||||
if [ "$?" != "0" ]; then
|
|
||||||
job_fail "scratch-gui" "compile"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
cd .. || exit
|
|
||||||
|
|
||||||
job_success "scratch-gui" "compile"
|
|
||||||
}
|
|
||||||
|
|
||||||
sub_patchc() {
|
|
||||||
job_start "generic" "patch-create:collect-info"
|
|
||||||
read -rp "Enter the current project name: " project
|
|
||||||
read -rp "Enter the patchlist ID (blocks for scratch-blocks): " plist
|
|
||||||
job_success "generic" "patch-create:collect-info"
|
|
||||||
job_start "$project" "patch-create"
|
|
||||||
cd "$project" || exit
|
|
||||||
fname=$(git format-patch -1 HEAD -o ../patches/"$plist"/)
|
|
||||||
base=$(basename "$fname")
|
|
||||||
patchnumnp=$(find ../patches/"$plist" -type f -name "*.patch" | wc -l)
|
|
||||||
patchnum=$(printf "%04d" "$patchnumnp")
|
|
||||||
nonumfname="$(echo "$base" | cut -c 5-)"
|
|
||||||
newfname="$patchnum$nonumfname"
|
|
||||||
newpath=$(echo "$fname" | sed "s/$base/$newfname/" -)
|
|
||||||
mv "$fname" "$newpath"
|
|
||||||
echo "Wrote out patch file to $newfname"
|
|
||||||
job_success "$project" "patch-create"
|
|
||||||
echo "Checking that patch file applies cleanly"
|
|
||||||
job_start "$project" "patch-check"
|
|
||||||
cd .. || exit
|
|
||||||
sub_patch
|
|
||||||
job_success "$project" "patch-check"
|
|
||||||
}
|
|
||||||
|
|
||||||
sub_reset() {
|
|
||||||
sub_clone
|
|
||||||
}
|
|
||||||
|
|
||||||
sub_pkg() {
|
|
||||||
cd pyblocks-gui || exit
|
|
||||||
|
|
||||||
job_start "pyblocks-gui" "build:win"
|
|
||||||
yarn run package --x64 --ia32 --arm64 --win nsis portable
|
|
||||||
if [ "$?" != "0" ]; then
|
|
||||||
job_fail "pyblocks-gui" "build:win"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
job_success "pyblocks-gui" "build:win"
|
|
||||||
|
|
||||||
job_start "pyblocks-gui" "build:lin"
|
|
||||||
yarn run package --x64 --ia32 --armv7l --arm64 --linux AppImage flatpak snap deb rpm freebsd pacman p5p apk 7z zip tar.xz tar.lz tar.gz tar.bz2
|
|
||||||
if [ "$?" != "0" ]; then
|
|
||||||
job_fail "pyblocks-gui" "build:lin"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
job_success "pyblocks-gui" "build:lin"
|
|
||||||
|
|
||||||
cd .. || exit
|
|
||||||
}
|
}
|
||||||
|
|
||||||
sub_help() {
|
sub_help() {
|
||||||
echo "--- PyBlocks Build Tool ---"
|
|
||||||
echo "usage: ./pbt.sh [command]"
|
|
||||||
echo "clone - clone upstream source code"
|
echo "clone - clone upstream source code"
|
||||||
echo " patch - (re)apply patches"
|
echo "patch - apply patches"
|
||||||
echo "compile - compile bundles"
|
echo "compile - compile bundles"
|
||||||
echo "bundle - create prod bundles"
|
echo "bundle - create prod bundles"
|
||||||
echo " patchc - create a patch for the current project"
|
|
||||||
echo " reset - reset to upstream patch base (equivalent to clone)"
|
|
||||||
echo " pkg - Create packages for every platform for gui"
|
|
||||||
}
|
}
|
||||||
|
|
||||||
subcommand=$1
|
subcommand=$1
|
||||||
|
@ -236,7 +90,7 @@ case $subcommand in
|
||||||
*)
|
*)
|
||||||
echo "[*] Running build command $subcommand"
|
echo "[*] Running build command $subcommand"
|
||||||
shift
|
shift
|
||||||
sub_"${subcommand}" "$@"
|
sub_${subcommand} $@
|
||||||
if [ $? = 127 ]; then
|
if [ $? = 127 ]; then
|
||||||
echo "Error: '$subcommand' is not a known subcommand." >&2
|
echo "Error: '$subcommand' is not a known subcommand." >&2
|
||||||
echo " Run 'pbt.sh --help' for a list of known subcommands." >&2
|
echo " Run 'pbt.sh --help' for a list of known subcommands." >&2
|
||||||
|
|
|
@ -1,12 +0,0 @@
|
||||||
root = true
|
|
||||||
|
|
||||||
[*]
|
|
||||||
indent_style = space
|
|
||||||
indent_size = 2
|
|
||||||
end_of_line = lf
|
|
||||||
charset = utf-8
|
|
||||||
trim_trailing_whitespace = true
|
|
||||||
insert_final_newline = true
|
|
||||||
|
|
||||||
[*.md]
|
|
||||||
trim_trailing_whitespace = false
|
|
|
@ -1,7 +0,0 @@
|
||||||
{
|
|
||||||
"rules": {
|
|
||||||
"no-console": "off",
|
|
||||||
"global-require": "off",
|
|
||||||
"import/no-dynamic-require": "off"
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,59 +0,0 @@
|
||||||
/**
|
|
||||||
* Base webpack config used across other specific configs
|
|
||||||
*/
|
|
||||||
|
|
||||||
import webpack from 'webpack';
|
|
||||||
import TsconfigPathsPlugins from 'tsconfig-paths-webpack-plugin';
|
|
||||||
import webpackPaths from './webpack.paths';
|
|
||||||
import { dependencies as externals } from '../../release/app/package.json';
|
|
||||||
|
|
||||||
const configuration: webpack.Configuration = {
|
|
||||||
externals: [...Object.keys(externals || {})],
|
|
||||||
|
|
||||||
stats: 'errors-only',
|
|
||||||
|
|
||||||
module: {
|
|
||||||
rules: [
|
|
||||||
{
|
|
||||||
test: /\.[jt]sx?$/,
|
|
||||||
exclude: /node_modules/,
|
|
||||||
use: {
|
|
||||||
loader: 'ts-loader',
|
|
||||||
options: {
|
|
||||||
// Remove this line to enable type checking in webpack builds
|
|
||||||
transpileOnly: true,
|
|
||||||
compilerOptions: {
|
|
||||||
module: 'esnext',
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
],
|
|
||||||
},
|
|
||||||
|
|
||||||
output: {
|
|
||||||
path: webpackPaths.srcPath,
|
|
||||||
// https://github.com/webpack/webpack/issues/1114
|
|
||||||
library: {
|
|
||||||
type: 'commonjs2',
|
|
||||||
},
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Determine the array of extensions that should be used to resolve modules.
|
|
||||||
*/
|
|
||||||
resolve: {
|
|
||||||
extensions: ['.js', '.jsx', '.json', '.ts', '.tsx'],
|
|
||||||
modules: [webpackPaths.srcPath, 'node_modules'],
|
|
||||||
// There is no need to add aliases here, the paths in tsconfig get mirrored
|
|
||||||
plugins: [new TsconfigPathsPlugins()],
|
|
||||||
},
|
|
||||||
|
|
||||||
plugins: [
|
|
||||||
new webpack.EnvironmentPlugin({
|
|
||||||
NODE_ENV: 'production',
|
|
||||||
}),
|
|
||||||
],
|
|
||||||
};
|
|
||||||
|
|
||||||
export default configuration;
|
|
|
@ -1,3 +0,0 @@
|
||||||
/* eslint import/no-unresolved: off, import/no-self-import: off */
|
|
||||||
|
|
||||||
module.exports = require('./webpack.config.renderer.dev').default;
|
|
|
@ -1,83 +0,0 @@
|
||||||
/**
|
|
||||||
* Webpack config for production electron main process
|
|
||||||
*/
|
|
||||||
|
|
||||||
import path from 'path';
|
|
||||||
import webpack from 'webpack';
|
|
||||||
import { merge } from 'webpack-merge';
|
|
||||||
import TerserPlugin from 'terser-webpack-plugin';
|
|
||||||
import { BundleAnalyzerPlugin } from 'webpack-bundle-analyzer';
|
|
||||||
import baseConfig from './webpack.config.base';
|
|
||||||
import webpackPaths from './webpack.paths';
|
|
||||||
import checkNodeEnv from '../scripts/check-node-env';
|
|
||||||
import deleteSourceMaps from '../scripts/delete-source-maps';
|
|
||||||
|
|
||||||
checkNodeEnv('production');
|
|
||||||
deleteSourceMaps();
|
|
||||||
|
|
||||||
const configuration: webpack.Configuration = {
|
|
||||||
devtool: 'source-map',
|
|
||||||
|
|
||||||
mode: 'production',
|
|
||||||
|
|
||||||
target: 'electron-main',
|
|
||||||
|
|
||||||
entry: {
|
|
||||||
main: path.join(webpackPaths.srcMainPath, 'main.ts'),
|
|
||||||
preload: path.join(webpackPaths.srcMainPath, 'preload.ts'),
|
|
||||||
},
|
|
||||||
|
|
||||||
output: {
|
|
||||||
path: webpackPaths.distMainPath,
|
|
||||||
filename: '[name].js',
|
|
||||||
library: {
|
|
||||||
type: 'umd',
|
|
||||||
},
|
|
||||||
},
|
|
||||||
|
|
||||||
optimization: {
|
|
||||||
minimizer: [
|
|
||||||
new TerserPlugin({
|
|
||||||
parallel: true,
|
|
||||||
}),
|
|
||||||
],
|
|
||||||
},
|
|
||||||
|
|
||||||
plugins: [
|
|
||||||
new BundleAnalyzerPlugin({
|
|
||||||
analyzerMode: process.env.ANALYZE === 'true' ? 'server' : 'disabled',
|
|
||||||
analyzerPort: 8888,
|
|
||||||
}),
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Create global constants which can be configured at compile time.
|
|
||||||
*
|
|
||||||
* Useful for allowing different behaviour between development builds and
|
|
||||||
* release builds
|
|
||||||
*
|
|
||||||
* NODE_ENV should be production so that modules do not perform certain
|
|
||||||
* development checks
|
|
||||||
*/
|
|
||||||
new webpack.EnvironmentPlugin({
|
|
||||||
NODE_ENV: 'production',
|
|
||||||
DEBUG_PROD: false,
|
|
||||||
START_MINIMIZED: false,
|
|
||||||
}),
|
|
||||||
|
|
||||||
new webpack.DefinePlugin({
|
|
||||||
'process.type': '"browser"',
|
|
||||||
}),
|
|
||||||
],
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Disables webpack processing of __dirname and __filename.
|
|
||||||
* If you run the bundle in node.js it falls back to these values of node.js.
|
|
||||||
* https://github.com/webpack/webpack/issues/2010
|
|
||||||
*/
|
|
||||||
node: {
|
|
||||||
__dirname: false,
|
|
||||||
__filename: false,
|
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
||||||
export default merge(baseConfig, configuration);
|
|
|
@ -1,71 +0,0 @@
|
||||||
import path from 'path';
|
|
||||||
import webpack from 'webpack';
|
|
||||||
import { merge } from 'webpack-merge';
|
|
||||||
import { BundleAnalyzerPlugin } from 'webpack-bundle-analyzer';
|
|
||||||
import baseConfig from './webpack.config.base';
|
|
||||||
import webpackPaths from './webpack.paths';
|
|
||||||
import checkNodeEnv from '../scripts/check-node-env';
|
|
||||||
|
|
||||||
// When an ESLint server is running, we can't set the NODE_ENV so we'll check if it's
|
|
||||||
// at the dev webpack config is not accidentally run in a production environment
|
|
||||||
if (process.env.NODE_ENV === 'production') {
|
|
||||||
checkNodeEnv('development');
|
|
||||||
}
|
|
||||||
|
|
||||||
const configuration: webpack.Configuration = {
|
|
||||||
devtool: 'inline-source-map',
|
|
||||||
|
|
||||||
mode: 'development',
|
|
||||||
|
|
||||||
target: 'electron-preload',
|
|
||||||
|
|
||||||
entry: path.join(webpackPaths.srcMainPath, 'preload.ts'),
|
|
||||||
|
|
||||||
output: {
|
|
||||||
path: webpackPaths.dllPath,
|
|
||||||
filename: 'preload.js',
|
|
||||||
library: {
|
|
||||||
type: 'umd',
|
|
||||||
},
|
|
||||||
},
|
|
||||||
|
|
||||||
plugins: [
|
|
||||||
new BundleAnalyzerPlugin({
|
|
||||||
analyzerMode: process.env.ANALYZE === 'true' ? 'server' : 'disabled',
|
|
||||||
}),
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Create global constants which can be configured at compile time.
|
|
||||||
*
|
|
||||||
* Useful for allowing different behaviour between development builds and
|
|
||||||
* release builds
|
|
||||||
*
|
|
||||||
* NODE_ENV should be production so that modules do not perform certain
|
|
||||||
* development checks
|
|
||||||
*
|
|
||||||
* By default, use 'development' as NODE_ENV. This can be overriden with
|
|
||||||
* 'staging', for example, by changing the ENV variables in the npm scripts
|
|
||||||
*/
|
|
||||||
new webpack.EnvironmentPlugin({
|
|
||||||
NODE_ENV: 'development',
|
|
||||||
}),
|
|
||||||
|
|
||||||
new webpack.LoaderOptionsPlugin({
|
|
||||||
debug: true,
|
|
||||||
}),
|
|
||||||
],
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Disables webpack processing of __dirname and __filename.
|
|
||||||
* If you run the bundle in node.js it falls back to these values of node.js.
|
|
||||||
* https://github.com/webpack/webpack/issues/2010
|
|
||||||
*/
|
|
||||||
node: {
|
|
||||||
__dirname: false,
|
|
||||||
__filename: false,
|
|
||||||
},
|
|
||||||
|
|
||||||
watch: true,
|
|
||||||
};
|
|
||||||
|
|
||||||
export default merge(baseConfig, configuration);
|
|
|
@ -1,77 +0,0 @@
|
||||||
/**
|
|
||||||
* Builds the DLL for development electron renderer process
|
|
||||||
*/
|
|
||||||
|
|
||||||
import webpack from 'webpack';
|
|
||||||
import path from 'path';
|
|
||||||
import { merge } from 'webpack-merge';
|
|
||||||
import baseConfig from './webpack.config.base';
|
|
||||||
import webpackPaths from './webpack.paths';
|
|
||||||
import { dependencies } from '../../package.json';
|
|
||||||
import checkNodeEnv from '../scripts/check-node-env';
|
|
||||||
|
|
||||||
checkNodeEnv('development');
|
|
||||||
|
|
||||||
const dist = webpackPaths.dllPath;
|
|
||||||
|
|
||||||
const configuration: webpack.Configuration = {
|
|
||||||
context: webpackPaths.rootPath,
|
|
||||||
|
|
||||||
devtool: 'eval',
|
|
||||||
|
|
||||||
mode: 'development',
|
|
||||||
|
|
||||||
target: 'electron-renderer',
|
|
||||||
|
|
||||||
externals: ['fsevents', 'crypto-browserify'],
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Use `module` from `webpack.config.renderer.dev.js`
|
|
||||||
*/
|
|
||||||
module: require('./webpack.config.renderer.dev').default.module,
|
|
||||||
|
|
||||||
entry: {
|
|
||||||
renderer: Object.keys(dependencies || {}),
|
|
||||||
},
|
|
||||||
|
|
||||||
output: {
|
|
||||||
path: dist,
|
|
||||||
filename: '[name].dev.dll.js',
|
|
||||||
library: {
|
|
||||||
name: 'renderer',
|
|
||||||
type: 'var',
|
|
||||||
},
|
|
||||||
},
|
|
||||||
|
|
||||||
plugins: [
|
|
||||||
new webpack.DllPlugin({
|
|
||||||
path: path.join(dist, '[name].json'),
|
|
||||||
name: '[name]',
|
|
||||||
}),
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Create global constants which can be configured at compile time.
|
|
||||||
*
|
|
||||||
* Useful for allowing different behaviour between development builds and
|
|
||||||
* release builds
|
|
||||||
*
|
|
||||||
* NODE_ENV should be production so that modules do not perform certain
|
|
||||||
* development checks
|
|
||||||
*/
|
|
||||||
new webpack.EnvironmentPlugin({
|
|
||||||
NODE_ENV: 'development',
|
|
||||||
}),
|
|
||||||
|
|
||||||
new webpack.LoaderOptionsPlugin({
|
|
||||||
debug: true,
|
|
||||||
options: {
|
|
||||||
context: webpackPaths.srcPath,
|
|
||||||
output: {
|
|
||||||
path: webpackPaths.dllPath,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
}),
|
|
||||||
],
|
|
||||||
};
|
|
||||||
|
|
||||||
export default merge(baseConfig, configuration);
|
|
|
@ -1,213 +0,0 @@
|
||||||
import 'webpack-dev-server';
|
|
||||||
import path from 'path';
|
|
||||||
import fs from 'fs';
|
|
||||||
import webpack from 'webpack';
|
|
||||||
import HtmlWebpackPlugin from 'html-webpack-plugin';
|
|
||||||
import chalk from 'chalk';
|
|
||||||
import { merge } from 'webpack-merge';
|
|
||||||
import { execSync, spawn } from 'child_process';
|
|
||||||
import ReactRefreshWebpackPlugin from '@pmmmwh/react-refresh-webpack-plugin';
|
|
||||||
import baseConfig from './webpack.config.base';
|
|
||||||
import webpackPaths from './webpack.paths';
|
|
||||||
import checkNodeEnv from '../scripts/check-node-env';
|
|
||||||
|
|
||||||
// When an ESLint server is running, we can't set the NODE_ENV so we'll check if it's
|
|
||||||
// at the dev webpack config is not accidentally run in a production environment
|
|
||||||
if (process.env.NODE_ENV === 'production') {
|
|
||||||
checkNodeEnv('development');
|
|
||||||
}
|
|
||||||
|
|
||||||
const port = process.env.PORT || 1212;
|
|
||||||
const manifest = path.resolve(webpackPaths.dllPath, 'renderer.json');
|
|
||||||
const skipDLLs =
|
|
||||||
module.parent?.filename.includes('webpack.config.renderer.dev.dll') ||
|
|
||||||
module.parent?.filename.includes('webpack.config.eslint');
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Warn if the DLL is not built
|
|
||||||
*/
|
|
||||||
if (
|
|
||||||
!skipDLLs &&
|
|
||||||
!(fs.existsSync(webpackPaths.dllPath) && fs.existsSync(manifest))
|
|
||||||
) {
|
|
||||||
console.log(
|
|
||||||
chalk.black.bgYellow.bold(
|
|
||||||
'The DLL files are missing. Sit back while we build them for you with "npm run build-dll"'
|
|
||||||
)
|
|
||||||
);
|
|
||||||
execSync('npm run postinstall');
|
|
||||||
}
|
|
||||||
|
|
||||||
const configuration: webpack.Configuration = {
|
|
||||||
devtool: 'inline-source-map',
|
|
||||||
|
|
||||||
mode: 'development',
|
|
||||||
|
|
||||||
target: ['web', 'electron-renderer'],
|
|
||||||
|
|
||||||
entry: [
|
|
||||||
`webpack-dev-server/client?http://localhost:${port}/dist`,
|
|
||||||
'webpack/hot/only-dev-server',
|
|
||||||
path.join(webpackPaths.srcRendererPath, 'index.tsx'),
|
|
||||||
],
|
|
||||||
|
|
||||||
output: {
|
|
||||||
path: webpackPaths.distRendererPath,
|
|
||||||
publicPath: '/',
|
|
||||||
filename: 'renderer.dev.js',
|
|
||||||
library: {
|
|
||||||
type: 'umd',
|
|
||||||
},
|
|
||||||
},
|
|
||||||
|
|
||||||
module: {
|
|
||||||
rules: [
|
|
||||||
{
|
|
||||||
test: /\.s?(c|a)ss$/,
|
|
||||||
use: [
|
|
||||||
'style-loader',
|
|
||||||
{
|
|
||||||
loader: 'css-loader',
|
|
||||||
options: {
|
|
||||||
modules: true,
|
|
||||||
sourceMap: true,
|
|
||||||
importLoaders: 1,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
'sass-loader',
|
|
||||||
],
|
|
||||||
include: /\.module\.s?(c|a)ss$/,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
test: /\.s?css$/,
|
|
||||||
use: ['style-loader', 'css-loader', 'sass-loader'],
|
|
||||||
exclude: /\.module\.s?(c|a)ss$/,
|
|
||||||
},
|
|
||||||
// Fonts
|
|
||||||
{
|
|
||||||
test: /\.(woff|woff2|eot|ttf|otf)$/i,
|
|
||||||
type: 'asset/resource',
|
|
||||||
},
|
|
||||||
// Images
|
|
||||||
{
|
|
||||||
test: /\.(png|jpg|jpeg|gif)$/i,
|
|
||||||
type: 'asset/resource',
|
|
||||||
},
|
|
||||||
// SVG
|
|
||||||
{
|
|
||||||
test: /\.svg$/,
|
|
||||||
use: [
|
|
||||||
{
|
|
||||||
loader: '@svgr/webpack',
|
|
||||||
options: {
|
|
||||||
prettier: false,
|
|
||||||
svgo: false,
|
|
||||||
svgoConfig: {
|
|
||||||
plugins: [{ removeViewBox: false }],
|
|
||||||
},
|
|
||||||
titleProp: true,
|
|
||||||
ref: true,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
'file-loader',
|
|
||||||
],
|
|
||||||
},
|
|
||||||
],
|
|
||||||
},
|
|
||||||
plugins: [
|
|
||||||
...(skipDLLs
|
|
||||||
? []
|
|
||||||
: [
|
|
||||||
new webpack.DllReferencePlugin({
|
|
||||||
context: webpackPaths.dllPath,
|
|
||||||
manifest: require(manifest),
|
|
||||||
sourceType: 'var',
|
|
||||||
}),
|
|
||||||
]),
|
|
||||||
|
|
||||||
new webpack.NoEmitOnErrorsPlugin(),
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Create global constants which can be configured at compile time.
|
|
||||||
*
|
|
||||||
* Useful for allowing different behaviour between development builds and
|
|
||||||
* release builds
|
|
||||||
*
|
|
||||||
* NODE_ENV should be production so that modules do not perform certain
|
|
||||||
* development checks
|
|
||||||
*
|
|
||||||
* By default, use 'development' as NODE_ENV. This can be overriden with
|
|
||||||
* 'staging', for example, by changing the ENV variables in the npm scripts
|
|
||||||
*/
|
|
||||||
new webpack.EnvironmentPlugin({
|
|
||||||
NODE_ENV: 'development',
|
|
||||||
}),
|
|
||||||
|
|
||||||
new webpack.LoaderOptionsPlugin({
|
|
||||||
debug: true,
|
|
||||||
}),
|
|
||||||
|
|
||||||
new ReactRefreshWebpackPlugin(),
|
|
||||||
|
|
||||||
new HtmlWebpackPlugin({
|
|
||||||
filename: path.join('index.html'),
|
|
||||||
template: path.join(webpackPaths.srcRendererPath, 'index.ejs'),
|
|
||||||
minify: {
|
|
||||||
collapseWhitespace: true,
|
|
||||||
removeAttributeQuotes: true,
|
|
||||||
removeComments: true,
|
|
||||||
},
|
|
||||||
isBrowser: false,
|
|
||||||
env: process.env.NODE_ENV,
|
|
||||||
isDevelopment: process.env.NODE_ENV !== 'production',
|
|
||||||
nodeModules: webpackPaths.appNodeModulesPath,
|
|
||||||
}),
|
|
||||||
],
|
|
||||||
|
|
||||||
node: {
|
|
||||||
__dirname: false,
|
|
||||||
__filename: false,
|
|
||||||
},
|
|
||||||
|
|
||||||
devServer: {
|
|
||||||
port,
|
|
||||||
compress: true,
|
|
||||||
hot: true,
|
|
||||||
headers: { 'Access-Control-Allow-Origin': '*' },
|
|
||||||
static: {
|
|
||||||
publicPath: '/',
|
|
||||||
},
|
|
||||||
historyApiFallback: {
|
|
||||||
verbose: true,
|
|
||||||
},
|
|
||||||
setupMiddlewares(middlewares) {
|
|
||||||
console.log('Starting preload.js builder...');
|
|
||||||
const preloadProcess = spawn('npm', ['run', 'start:preload'], {
|
|
||||||
shell: true,
|
|
||||||
stdio: 'inherit',
|
|
||||||
})
|
|
||||||
.on('close', (code: number) => process.exit(code!))
|
|
||||||
.on('error', (spawnError) => console.error(spawnError));
|
|
||||||
|
|
||||||
console.log('Starting Main Process...');
|
|
||||||
let args = ['run', 'start:main'];
|
|
||||||
if (process.env.MAIN_ARGS) {
|
|
||||||
args = args.concat(
|
|
||||||
['--', ...process.env.MAIN_ARGS.matchAll(/"[^"]+"|[^\s"]+/g)].flat()
|
|
||||||
);
|
|
||||||
}
|
|
||||||
spawn('npm', args, {
|
|
||||||
shell: true,
|
|
||||||
stdio: 'inherit',
|
|
||||||
})
|
|
||||||
.on('close', (code: number) => {
|
|
||||||
preloadProcess.kill();
|
|
||||||
process.exit(code!);
|
|
||||||
})
|
|
||||||
.on('error', (spawnError) => console.error(spawnError));
|
|
||||||
return middlewares;
|
|
||||||
},
|
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
||||||
export default merge(baseConfig, configuration);
|
|
|
@ -1,141 +0,0 @@
|
||||||
/**
|
|
||||||
* Build config for electron renderer process
|
|
||||||
*/
|
|
||||||
|
|
||||||
import path from 'path';
|
|
||||||
import webpack from 'webpack';
|
|
||||||
import HtmlWebpackPlugin from 'html-webpack-plugin';
|
|
||||||
import MiniCssExtractPlugin from 'mini-css-extract-plugin';
|
|
||||||
import { BundleAnalyzerPlugin } from 'webpack-bundle-analyzer';
|
|
||||||
import CssMinimizerPlugin from 'css-minimizer-webpack-plugin';
|
|
||||||
import { merge } from 'webpack-merge';
|
|
||||||
import TerserPlugin from 'terser-webpack-plugin';
|
|
||||||
import baseConfig from './webpack.config.base';
|
|
||||||
import webpackPaths from './webpack.paths';
|
|
||||||
import checkNodeEnv from '../scripts/check-node-env';
|
|
||||||
import deleteSourceMaps from '../scripts/delete-source-maps';
|
|
||||||
|
|
||||||
checkNodeEnv('production');
|
|
||||||
deleteSourceMaps();
|
|
||||||
|
|
||||||
const configuration: webpack.Configuration = {
|
|
||||||
devtool: 'source-map',
|
|
||||||
|
|
||||||
mode: 'production',
|
|
||||||
|
|
||||||
target: ['web', 'electron-renderer'],
|
|
||||||
|
|
||||||
entry: [path.join(webpackPaths.srcRendererPath, 'index.tsx')],
|
|
||||||
|
|
||||||
output: {
|
|
||||||
path: webpackPaths.distRendererPath,
|
|
||||||
publicPath: './',
|
|
||||||
filename: 'renderer.js',
|
|
||||||
library: {
|
|
||||||
type: 'umd',
|
|
||||||
},
|
|
||||||
},
|
|
||||||
|
|
||||||
module: {
|
|
||||||
rules: [
|
|
||||||
{
|
|
||||||
test: /\.s?(a|c)ss$/,
|
|
||||||
use: [
|
|
||||||
MiniCssExtractPlugin.loader,
|
|
||||||
{
|
|
||||||
loader: 'css-loader',
|
|
||||||
options: {
|
|
||||||
modules: true,
|
|
||||||
sourceMap: true,
|
|
||||||
importLoaders: 1,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
'sass-loader',
|
|
||||||
],
|
|
||||||
include: /\.module\.s?(c|a)ss$/,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
test: /\.s?(a|c)ss$/,
|
|
||||||
use: [MiniCssExtractPlugin.loader, 'css-loader', 'sass-loader'],
|
|
||||||
exclude: /\.module\.s?(c|a)ss$/,
|
|
||||||
},
|
|
||||||
// Fonts
|
|
||||||
{
|
|
||||||
test: /\.(woff|woff2|eot|ttf|otf)$/i,
|
|
||||||
type: 'asset/resource',
|
|
||||||
},
|
|
||||||
// Images
|
|
||||||
{
|
|
||||||
test: /\.(png|jpg|jpeg|gif)$/i,
|
|
||||||
type: 'asset/resource',
|
|
||||||
},
|
|
||||||
// SVG
|
|
||||||
{
|
|
||||||
test: /\.svg$/,
|
|
||||||
use: [
|
|
||||||
{
|
|
||||||
loader: '@svgr/webpack',
|
|
||||||
options: {
|
|
||||||
prettier: false,
|
|
||||||
svgo: false,
|
|
||||||
svgoConfig: {
|
|
||||||
plugins: [{ removeViewBox: false }],
|
|
||||||
},
|
|
||||||
titleProp: true,
|
|
||||||
ref: true,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
'file-loader',
|
|
||||||
],
|
|
||||||
},
|
|
||||||
],
|
|
||||||
},
|
|
||||||
|
|
||||||
optimization: {
|
|
||||||
minimize: true,
|
|
||||||
minimizer: [new TerserPlugin(), new CssMinimizerPlugin()],
|
|
||||||
},
|
|
||||||
|
|
||||||
plugins: [
|
|
||||||
/**
|
|
||||||
* Create global constants which can be configured at compile time.
|
|
||||||
*
|
|
||||||
* Useful for allowing different behaviour between development builds and
|
|
||||||
* release builds
|
|
||||||
*
|
|
||||||
* NODE_ENV should be production so that modules do not perform certain
|
|
||||||
* development checks
|
|
||||||
*/
|
|
||||||
new webpack.EnvironmentPlugin({
|
|
||||||
NODE_ENV: 'production',
|
|
||||||
DEBUG_PROD: false,
|
|
||||||
}),
|
|
||||||
|
|
||||||
new MiniCssExtractPlugin({
|
|
||||||
filename: 'style.css',
|
|
||||||
}),
|
|
||||||
|
|
||||||
new BundleAnalyzerPlugin({
|
|
||||||
analyzerMode: process.env.ANALYZE === 'true' ? 'server' : 'disabled',
|
|
||||||
analyzerPort: 8889,
|
|
||||||
}),
|
|
||||||
|
|
||||||
new HtmlWebpackPlugin({
|
|
||||||
filename: 'index.html',
|
|
||||||
template: path.join(webpackPaths.srcRendererPath, 'index.ejs'),
|
|
||||||
minify: {
|
|
||||||
collapseWhitespace: true,
|
|
||||||
removeAttributeQuotes: true,
|
|
||||||
removeComments: true,
|
|
||||||
},
|
|
||||||
isBrowser: false,
|
|
||||||
isDevelopment: false,
|
|
||||||
}),
|
|
||||||
|
|
||||||
new webpack.DefinePlugin({
|
|
||||||
'process.type': '"renderer"',
|
|
||||||
}),
|
|
||||||
],
|
|
||||||
};
|
|
||||||
|
|
||||||
export default merge(baseConfig, configuration);
|
|
|
@ -1,38 +0,0 @@
|
||||||
const path = require('path');
|
|
||||||
|
|
||||||
const rootPath = path.join(__dirname, '../..');
|
|
||||||
|
|
||||||
const dllPath = path.join(__dirname, '../dll');
|
|
||||||
|
|
||||||
const srcPath = path.join(rootPath, 'src');
|
|
||||||
const srcMainPath = path.join(srcPath, 'main');
|
|
||||||
const srcRendererPath = path.join(srcPath, 'renderer');
|
|
||||||
|
|
||||||
const releasePath = path.join(rootPath, 'release');
|
|
||||||
const appPath = path.join(releasePath, 'app');
|
|
||||||
const appPackagePath = path.join(appPath, 'package.json');
|
|
||||||
const appNodeModulesPath = path.join(appPath, 'node_modules');
|
|
||||||
const srcNodeModulesPath = path.join(srcPath, 'node_modules');
|
|
||||||
|
|
||||||
const distPath = path.join(appPath, 'dist');
|
|
||||||
const distMainPath = path.join(distPath, 'main');
|
|
||||||
const distRendererPath = path.join(distPath, 'renderer');
|
|
||||||
|
|
||||||
const buildPath = path.join(releasePath, 'build');
|
|
||||||
|
|
||||||
export default {
|
|
||||||
rootPath,
|
|
||||||
dllPath,
|
|
||||||
srcPath,
|
|
||||||
srcMainPath,
|
|
||||||
srcRendererPath,
|
|
||||||
releasePath,
|
|
||||||
appPath,
|
|
||||||
appPackagePath,
|
|
||||||
appNodeModulesPath,
|
|
||||||
srcNodeModulesPath,
|
|
||||||
distPath,
|
|
||||||
distMainPath,
|
|
||||||
distRendererPath,
|
|
||||||
buildPath,
|
|
||||||
};
|
|
Before Width: | Height: | Size: 24 KiB |
Before Width: | Height: | Size: 28 KiB |
Before Width: | Height: | Size: 33 KiB |
|
@ -1 +0,0 @@
|
||||||
export default 'test-file-stub';
|
|
|
@ -1,8 +0,0 @@
|
||||||
{
|
|
||||||
"rules": {
|
|
||||||
"no-console": "off",
|
|
||||||
"global-require": "off",
|
|
||||||
"import/no-dynamic-require": "off",
|
|
||||||
"import/no-extraneous-dependencies": "off"
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,24 +0,0 @@
|
||||||
// Check if the renderer and main bundles are built
|
|
||||||
import path from 'path';
|
|
||||||
import chalk from 'chalk';
|
|
||||||
import fs from 'fs';
|
|
||||||
import webpackPaths from '../configs/webpack.paths';
|
|
||||||
|
|
||||||
const mainPath = path.join(webpackPaths.distMainPath, 'main.js');
|
|
||||||
const rendererPath = path.join(webpackPaths.distRendererPath, 'renderer.js');
|
|
||||||
|
|
||||||
if (!fs.existsSync(mainPath)) {
|
|
||||||
throw new Error(
|
|
||||||
chalk.whiteBright.bgRed.bold(
|
|
||||||
'The main process is not built yet. Build it by running "npm run build:main"'
|
|
||||||
)
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!fs.existsSync(rendererPath)) {
|
|
||||||
throw new Error(
|
|
||||||
chalk.whiteBright.bgRed.bold(
|
|
||||||
'The renderer process is not built yet. Build it by running "npm run build:renderer"'
|
|
||||||
)
|
|
||||||
);
|
|
||||||
}
|
|
|
@ -1,54 +0,0 @@
|
||||||
import fs from 'fs';
|
|
||||||
import chalk from 'chalk';
|
|
||||||
import { execSync } from 'child_process';
|
|
||||||
import { dependencies } from '../../package.json';
|
|
||||||
|
|
||||||
if (dependencies) {
|
|
||||||
const dependenciesKeys = Object.keys(dependencies);
|
|
||||||
const nativeDeps = fs
|
|
||||||
.readdirSync('node_modules')
|
|
||||||
.filter((folder) => fs.existsSync(`node_modules/${folder}/binding.gyp`));
|
|
||||||
if (nativeDeps.length === 0) {
|
|
||||||
process.exit(0);
|
|
||||||
}
|
|
||||||
try {
|
|
||||||
// Find the reason for why the dependency is installed. If it is installed
|
|
||||||
// because of a devDependency then that is okay. Warn when it is installed
|
|
||||||
// because of a dependency
|
|
||||||
const { dependencies: dependenciesObject } = JSON.parse(
|
|
||||||
execSync(`npm ls ${nativeDeps.join(' ')} --json`).toString()
|
|
||||||
);
|
|
||||||
const rootDependencies = Object.keys(dependenciesObject);
|
|
||||||
const filteredRootDependencies = rootDependencies.filter((rootDependency) =>
|
|
||||||
dependenciesKeys.includes(rootDependency)
|
|
||||||
);
|
|
||||||
if (filteredRootDependencies.length > 0) {
|
|
||||||
const plural = filteredRootDependencies.length > 1;
|
|
||||||
console.log(`
|
|
||||||
${chalk.whiteBright.bgYellow.bold(
|
|
||||||
'Webpack does not work with native dependencies.'
|
|
||||||
)}
|
|
||||||
${chalk.bold(filteredRootDependencies.join(', '))} ${
|
|
||||||
plural ? 'are native dependencies' : 'is a native dependency'
|
|
||||||
} and should be installed inside of the "./release/app" folder.
|
|
||||||
First, uninstall the packages from "./package.json":
|
|
||||||
${chalk.whiteBright.bgGreen.bold('npm uninstall your-package')}
|
|
||||||
${chalk.bold(
|
|
||||||
'Then, instead of installing the package to the root "./package.json":'
|
|
||||||
)}
|
|
||||||
${chalk.whiteBright.bgRed.bold('npm install your-package')}
|
|
||||||
${chalk.bold('Install the package to "./release/app/package.json"')}
|
|
||||||
${chalk.whiteBright.bgGreen.bold(
|
|
||||||
'cd ./release/app && npm install your-package'
|
|
||||||
)}
|
|
||||||
Read more about native dependencies at:
|
|
||||||
${chalk.bold(
|
|
||||||
'https://electron-react-boilerplate.js.org/docs/adding-dependencies/#module-structure'
|
|
||||||
)}
|
|
||||||
`);
|
|
||||||
process.exit(1);
|
|
||||||
}
|
|
||||||
} catch (e) {
|
|
||||||
console.log('Native dependencies could not be checked');
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,16 +0,0 @@
|
||||||
import chalk from 'chalk';
|
|
||||||
|
|
||||||
export default function checkNodeEnv(expectedEnv) {
|
|
||||||
if (!expectedEnv) {
|
|
||||||
throw new Error('"expectedEnv" not set');
|
|
||||||
}
|
|
||||||
|
|
||||||
if (process.env.NODE_ENV !== expectedEnv) {
|
|
||||||
console.log(
|
|
||||||
chalk.whiteBright.bgRed.bold(
|
|
||||||
`"process.env.NODE_ENV" must be "${expectedEnv}" to use this webpack config`
|
|
||||||
)
|
|
||||||
);
|
|
||||||
process.exit(2);
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,16 +0,0 @@
|
||||||
import chalk from 'chalk';
|
|
||||||
import detectPort from 'detect-port';
|
|
||||||
|
|
||||||
const port = process.env.PORT || '1212';
|
|
||||||
|
|
||||||
detectPort(port, (err, availablePort) => {
|
|
||||||
if (port !== String(availablePort)) {
|
|
||||||
throw new Error(
|
|
||||||
chalk.whiteBright.bgRed.bold(
|
|
||||||
`Port "${port}" on "localhost" is already in use. Please use another port. ex: PORT=4343 npm start`
|
|
||||||
)
|
|
||||||
);
|
|
||||||
} else {
|
|
||||||
process.exit(0);
|
|
||||||
}
|
|
||||||
});
|
|
|
@ -1,13 +0,0 @@
|
||||||
import rimraf from 'rimraf';
|
|
||||||
import fs from 'fs';
|
|
||||||
import webpackPaths from '../configs/webpack.paths';
|
|
||||||
|
|
||||||
const foldersToRemove = [
|
|
||||||
webpackPaths.distPath,
|
|
||||||
webpackPaths.buildPath,
|
|
||||||
webpackPaths.dllPath,
|
|
||||||
];
|
|
||||||
|
|
||||||
foldersToRemove.forEach((folder) => {
|
|
||||||
if (fs.existsSync(folder)) rimraf.sync(folder);
|
|
||||||
});
|
|
|
@ -1,15 +0,0 @@
|
||||||
import fs from 'fs';
|
|
||||||
import path from 'path';
|
|
||||||
import rimraf from 'rimraf';
|
|
||||||
import webpackPaths from '../configs/webpack.paths';
|
|
||||||
|
|
||||||
export default function deleteSourceMaps() {
|
|
||||||
if (fs.existsSync(webpackPaths.distMainPath))
|
|
||||||
rimraf.sync(path.join(webpackPaths.distMainPath, '*.js.map'), {
|
|
||||||
glob: true,
|
|
||||||
});
|
|
||||||
if (fs.existsSync(webpackPaths.distRendererPath))
|
|
||||||
rimraf.sync(path.join(webpackPaths.distRendererPath, '*.js.map'), {
|
|
||||||
glob: true,
|
|
||||||
});
|
|
||||||
}
|
|
|
@ -1,20 +0,0 @@
|
||||||
import { execSync } from 'child_process';
|
|
||||||
import fs from 'fs';
|
|
||||||
import { dependencies } from '../../release/app/package.json';
|
|
||||||
import webpackPaths from '../configs/webpack.paths';
|
|
||||||
|
|
||||||
if (
|
|
||||||
Object.keys(dependencies || {}).length > 0 &&
|
|
||||||
fs.existsSync(webpackPaths.appNodeModulesPath)
|
|
||||||
) {
|
|
||||||
const electronRebuildCmd =
|
|
||||||
'../../node_modules/.bin/electron-rebuild --force --types prod,dev,optional --module-dir .';
|
|
||||||
const cmd =
|
|
||||||
process.platform === 'win32'
|
|
||||||
? electronRebuildCmd.replace(/\//g, '\\')
|
|
||||||
: electronRebuildCmd;
|
|
||||||
execSync(cmd, {
|
|
||||||
cwd: webpackPaths.appPath,
|
|
||||||
stdio: 'inherit',
|
|
||||||
});
|
|
||||||
}
|
|
|
@ -1,9 +0,0 @@
|
||||||
import fs from 'fs';
|
|
||||||
import webpackPaths from '../configs/webpack.paths';
|
|
||||||
|
|
||||||
const { srcNodeModulesPath } = webpackPaths;
|
|
||||||
const { appNodeModulesPath } = webpackPaths;
|
|
||||||
|
|
||||||
if (!fs.existsSync(srcNodeModulesPath) && fs.existsSync(appNodeModulesPath)) {
|
|
||||||
fs.symlinkSync(appNodeModulesPath, srcNodeModulesPath, 'junction');
|
|
||||||
}
|
|
|
@ -1,30 +0,0 @@
|
||||||
const { notarize } = require('@electron/notarize');
|
|
||||||
const { build } = require('../../package.json');
|
|
||||||
|
|
||||||
exports.default = async function notarizeMacos(context) {
|
|
||||||
const { electronPlatformName, appOutDir } = context;
|
|
||||||
if (electronPlatformName !== 'darwin') {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (process.env.CI !== 'true') {
|
|
||||||
console.warn('Skipping notarizing step. Packaging is not running in CI');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!('APPLE_ID' in process.env && 'APPLE_ID_PASS' in process.env)) {
|
|
||||||
console.warn(
|
|
||||||
'Skipping notarizing step. APPLE_ID and APPLE_ID_PASS env variables must be set'
|
|
||||||
);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
const appName = context.packager.appInfo.productFilename;
|
|
||||||
|
|
||||||
await notarize({
|
|
||||||
appBundleId: build.appId,
|
|
||||||
appPath: `${appOutDir}/${appName}.app`,
|
|
||||||
appleId: process.env.APPLE_ID,
|
|
||||||
appleIdPassword: process.env.APPLE_ID_PASS,
|
|
||||||
});
|
|
||||||
};
|
|
|
@ -1,33 +0,0 @@
|
||||||
# Logs
|
|
||||||
logs
|
|
||||||
*.log
|
|
||||||
|
|
||||||
# Runtime data
|
|
||||||
pids
|
|
||||||
*.pid
|
|
||||||
*.seed
|
|
||||||
|
|
||||||
# Coverage directory used by tools like istanbul
|
|
||||||
coverage
|
|
||||||
.eslintcache
|
|
||||||
|
|
||||||
# Dependency directory
|
|
||||||
# https://www.npmjs.org/doc/misc/npm-faq.html#should-i-check-my-node_modules-folder-into-git
|
|
||||||
node_modules
|
|
||||||
|
|
||||||
# OSX
|
|
||||||
.DS_Store
|
|
||||||
|
|
||||||
release/app/dist
|
|
||||||
release/build
|
|
||||||
.erb/dll
|
|
||||||
|
|
||||||
.idea
|
|
||||||
npm-debug.log.*
|
|
||||||
*.css.d.ts
|
|
||||||
*.sass.d.ts
|
|
||||||
*.scss.d.ts
|
|
||||||
|
|
||||||
# eslint ignores hidden directories by default:
|
|
||||||
# https://github.com/eslint/eslint/issues/8429
|
|
||||||
!.erb
|
|
|
@ -1,37 +0,0 @@
|
||||||
module.exports = {
|
|
||||||
extends: 'erb',
|
|
||||||
plugins: ['@typescript-eslint'],
|
|
||||||
rules: {
|
|
||||||
// A temporary hack related to IDE not resolving correct package.json
|
|
||||||
'import/no-extraneous-dependencies': 'off',
|
|
||||||
'react/react-in-jsx-scope': 'off',
|
|
||||||
'react/jsx-filename-extension': 'off',
|
|
||||||
'import/extensions': 'off',
|
|
||||||
'import/no-unresolved': 'off',
|
|
||||||
'import/no-import-module-exports': 'off',
|
|
||||||
'no-shadow': 'off',
|
|
||||||
'@typescript-eslint/no-shadow': 'error',
|
|
||||||
'no-unused-vars': 'off',
|
|
||||||
'@typescript-eslint/no-unused-vars': 'error',
|
|
||||||
},
|
|
||||||
parserOptions: {
|
|
||||||
ecmaVersion: 2020,
|
|
||||||
sourceType: 'module',
|
|
||||||
project: './tsconfig.json',
|
|
||||||
tsconfigRootDir: __dirname,
|
|
||||||
createDefaultProgram: true,
|
|
||||||
},
|
|
||||||
settings: {
|
|
||||||
'import/resolver': {
|
|
||||||
// See https://github.com/benmosher/eslint-plugin-import/issues/1396#issuecomment-575727774 for line below
|
|
||||||
node: {},
|
|
||||||
webpack: {
|
|
||||||
config: require.resolve('./.erb/configs/webpack.config.eslint.ts'),
|
|
||||||
},
|
|
||||||
typescript: {},
|
|
||||||
},
|
|
||||||
'import/parsers': {
|
|
||||||
'@typescript-eslint/parser': ['.ts', '.tsx'],
|
|
||||||
},
|
|
||||||
},
|
|
||||||
};
|
|
|
@ -1,12 +0,0 @@
|
||||||
* text eol=lf
|
|
||||||
*.exe binary
|
|
||||||
*.png binary
|
|
||||||
*.jpg binary
|
|
||||||
*.jpeg binary
|
|
||||||
*.ico binary
|
|
||||||
*.icns binary
|
|
||||||
*.eot binary
|
|
||||||
*.otf binary
|
|
||||||
*.ttf binary
|
|
||||||
*.woff binary
|
|
||||||
*.woff2 binary
|
|
|
@ -1,29 +0,0 @@
|
||||||
# Logs
|
|
||||||
logs
|
|
||||||
*.log
|
|
||||||
|
|
||||||
# Runtime data
|
|
||||||
pids
|
|
||||||
*.pid
|
|
||||||
*.seed
|
|
||||||
|
|
||||||
# Coverage directory used by tools like istanbul
|
|
||||||
coverage
|
|
||||||
.eslintcache
|
|
||||||
|
|
||||||
# Dependency directory
|
|
||||||
# https://www.npmjs.org/doc/misc/npm-faq.html#should-i-check-my-node_modules-folder-into-git
|
|
||||||
node_modules
|
|
||||||
|
|
||||||
# OSX
|
|
||||||
.DS_Store
|
|
||||||
|
|
||||||
release/app/dist
|
|
||||||
release/build
|
|
||||||
.erb/dll
|
|
||||||
|
|
||||||
.idea
|
|
||||||
npm-debug.log.*
|
|
||||||
*.css.d.ts
|
|
||||||
*.sass.d.ts
|
|
||||||
*.scss.d.ts
|
|
|
@ -1,533 +0,0 @@
|
||||||
# 2.1.0
|
|
||||||
|
|
||||||
- Migrate to `css-minifier-webpack-plugin`
|
|
||||||
|
|
||||||
# 2.0.1
|
|
||||||
|
|
||||||
## Fixes
|
|
||||||
|
|
||||||
- Fix broken css linking in production build
|
|
||||||
|
|
||||||
# 2.0.0
|
|
||||||
|
|
||||||
## Breaking Changes
|
|
||||||
|
|
||||||
- drop redux
|
|
||||||
- remove counter example app
|
|
||||||
- simplify directory structure
|
|
||||||
- move `dll` dir to `.erb` dir
|
|
||||||
- fix icon/font import paths
|
|
||||||
- migrate to `react-refresh` from `react-hot-loader`
|
|
||||||
- migrate to webpack@5
|
|
||||||
- migrate to electron@11
|
|
||||||
- remove e2e tests and testcafe integration
|
|
||||||
- rename `app` dir to more conventional `src` dir
|
|
||||||
- rename `resources` dir to `assets`
|
|
||||||
- simplify npm scripts
|
|
||||||
- drop stylelint
|
|
||||||
- simplify styling of boilerplate app
|
|
||||||
- remove `START_HOT` env variable
|
|
||||||
- notarize support
|
|
||||||
- landing page boilerplate
|
|
||||||
- docs updates
|
|
||||||
- restore removed debugging support
|
|
||||||
|
|
||||||
# 1.4.0
|
|
||||||
|
|
||||||
- Migrate to `eslint-config-erb@2`
|
|
||||||
- Rename `dev` npm script to `start`
|
|
||||||
- GitHub Actions: only publish GitHub releases when on master branch
|
|
||||||
|
|
||||||
# 1.3.1
|
|
||||||
|
|
||||||
- Fix sass building bug ([#2540](https://github.com/electron-react-boilerplate/electron-react-boilerplate/pull/2540))
|
|
||||||
- Fix CI bug related to E2E tests and network timeouts
|
|
||||||
- Move automated dependency PRs to `next` ([#2554](https://github.com/electron-react-boilerplate/electron-react-boilerplate/pull/2554))
|
|
||||||
- Bump dependencies to patch semver
|
|
||||||
|
|
||||||
# 1.3.0
|
|
||||||
|
|
||||||
- Fixes E2E tests ([#2516](https://github.com/electron-react-boilerplate/electron-react-boilerplate/pull/2516))
|
|
||||||
- Fixes preload entrypoint ([#2503](https://github.com/electron-react-boilerplate/electron-react-boilerplate/pull/2503))
|
|
||||||
- Downgrade to `electron@8`
|
|
||||||
- Bump dependencies to latest semver
|
|
||||||
|
|
||||||
# 1.2.0
|
|
||||||
|
|
||||||
- Migrate to redux toolkit
|
|
||||||
- Lazy load routes with react suspense
|
|
||||||
- Drop support for azure-pipelines and use only github actions
|
|
||||||
- Bump all deps to latest semver
|
|
||||||
- Remove `test-e2e` script from tests (blocked on release of https://github.com/DevExpress/testcafe-browser-provider-electron/pull/65)
|
|
||||||
- Swap `typed-css-modules-webpack-plugin` for `typings-for-css-modules-loader`
|
|
||||||
- Use latest version of `eslint-config-erb`
|
|
||||||
- Remove unnecessary file extensions from ts exclude
|
|
||||||
- Add experimental support for vscode debugging
|
|
||||||
- Revert https://github.com/electron-react-boilerplate/electron-react-boilerplate/pull/2365 as default for users, provide as opt in option
|
|
||||||
|
|
||||||
# 1.1.0
|
|
||||||
|
|
||||||
- Fix #2402
|
|
||||||
- Simplify configs (https://github.com/electron-react-boilerplate/electron-react-boilerplate/pull/2406)
|
|
||||||
|
|
||||||
# 1.0.0
|
|
||||||
|
|
||||||
- Migrate to TypeScript from Flow ([#2363](https://github.com/electron-react-boilerplate/electron-react-boilerplate/pull/2363))
|
|
||||||
- Use browserslist for `@babel/preset-env` targets ([#2368](https://github.com/electron-react-boilerplate/electron-react-boilerplate/pull/2368))
|
|
||||||
- Use preload script, disable `nodeIntegration` in renderer process for [improved security](https://www.electronjs.org/docs/tutorial/security#2-do-not-enable-nodejs-integration-for-remote-content) ([#2365](https://github.com/electron-react-boilerplate/electron-react-boilerplate/pull/2365))
|
|
||||||
- Add support for azure pipelines ([#2369](https://github.com/electron-react-boilerplate/electron-react-boilerplate/pull/2369))
|
|
||||||
- Disable sourcemaps in production
|
|
||||||
|
|
||||||
# 0.18.1 (2019.12.12)
|
|
||||||
|
|
||||||
- Fix HMR env bug ([#2343](https://github.com/electron-react-boilerplate/electron-react-boilerplate/pull/2343))
|
|
||||||
- Bump all deps to latest semver
|
|
||||||
- Bump to `electron@7`
|
|
||||||
|
|
||||||
# 0.18.0 (2019.11.19)
|
|
||||||
|
|
||||||
- Bump electron to `electron@6` (`electron@7` introduces breaking changes to testcafe end to end tests)
|
|
||||||
- Revert back to [two `package.json` structure](https://www.electron.build/tutorials/two-package-structure)
|
|
||||||
- Bump all deps to latest semver
|
|
||||||
|
|
||||||
# 0.17.1 (2018.11.20)
|
|
||||||
|
|
||||||
- Fix `yarn test-e2e` and testcafe for single package.json structure
|
|
||||||
- Fixes incorrect path in `yarn start` script
|
|
||||||
- Bumped deps
|
|
||||||
- Bump g++ in travis
|
|
||||||
- Change clone arguments to clone only master
|
|
||||||
- Change babel config to target current electron version
|
|
||||||
|
|
||||||
For full change list, see https://github.com/electron-react-boilerplate/electron-react-boilerplate/pull/2021
|
|
||||||
|
|
||||||
# 0.17.0 (2018.10.30)
|
|
||||||
|
|
||||||
- upgraded to `babel@7` (thanks to @vikr01 🎉🎉🎉)
|
|
||||||
- migrated from [two `package.json` structure](https://www.electron.build/tutorials/two-package-structure) (thanks to @HyperSprite!)
|
|
||||||
- initial auto update support (experimental)
|
|
||||||
- migrate from greenkeeper to [renovate](https://renovatebot.com)
|
|
||||||
- added issue template
|
|
||||||
- use `babel-preset-env` to target current electron version
|
|
||||||
- add [opencollective](https://opencollective.com/electron-react-boilerplate-594) banner message display in postinstall script (help support ERB 🙏)
|
|
||||||
- fix failing ci issues
|
|
||||||
|
|
||||||
# 0.16.0 (2018.10.3)
|
|
||||||
|
|
||||||
- removed unused dependencies
|
|
||||||
- migrate from `react-redux-router` to `connect-react-router`
|
|
||||||
- move webpack configs to `./webpack` dir
|
|
||||||
- use `g++` on travis when testing linux
|
|
||||||
- migrate from `spectron` to `testcafe` for e2e tests
|
|
||||||
- add linting support for config styles
|
|
||||||
- changed stylelint config
|
|
||||||
- temporarily disabled flow in appveyor to make ci pass
|
|
||||||
- added necessary infra to publish releases from ci
|
|
||||||
|
|
||||||
# 0.15.0 (2018.8.25)
|
|
||||||
|
|
||||||
- Performance: cache webpack uglify results
|
|
||||||
- Feature: add start minimized feature
|
|
||||||
- Feature: lint and fix styles with prettier and stylelint
|
|
||||||
- Feature: add greenkeeper support
|
|
||||||
|
|
||||||
# 0.14.0 (2018.5.24)
|
|
||||||
|
|
||||||
- Improved CI timings
|
|
||||||
- Migrated README commands to yarn from npm
|
|
||||||
- Improved vscode config
|
|
||||||
- Updated all dependencies to latest semver
|
|
||||||
- Fix `electron-rebuild` script bug
|
|
||||||
- Migrated to `mini-css-extract-plugin` from `extract-text-plugin`
|
|
||||||
- Added `optimize-css-assets-webpack-plugin`
|
|
||||||
- Run `prettier` on json, css, scss, and more filetypes
|
|
||||||
|
|
||||||
# 0.13.3 (2018.5.24)
|
|
||||||
|
|
||||||
- Add git precommit hook, when git commit will use `prettier` to format git add code
|
|
||||||
- Add format code function in `lint-fix` npm script which can use `prettier` to format project js code
|
|
||||||
|
|
||||||
# 0.13.2 (2018.1.31)
|
|
||||||
|
|
||||||
- Hot Module Reload (HMR) fixes
|
|
||||||
- Bumped all dependencies to latest semver
|
|
||||||
- Prevent error propagation of `CheckNativeDeps` script
|
|
||||||
|
|
||||||
# 0.13.1 (2018.1.13)
|
|
||||||
|
|
||||||
- Hot Module Reload (HMR) fixes
|
|
||||||
- Bumped all dependencies to latest semver
|
|
||||||
- Fixed electron-rebuild script
|
|
||||||
- Fixed tests scripts to run on all platforms
|
|
||||||
- Skip redux logs in console in test ENV
|
|
||||||
|
|
||||||
# 0.13.0 (2018.1.6)
|
|
||||||
|
|
||||||
#### Additions
|
|
||||||
|
|
||||||
- Add native dependencies check on postinstall
|
|
||||||
- Updated all dependencies to latest semver
|
|
||||||
|
|
||||||
# 0.12.0 (2017.7.8)
|
|
||||||
|
|
||||||
#### Misc
|
|
||||||
|
|
||||||
- Removed `babel-polyfill`
|
|
||||||
- Renamed and alphabetized npm scripts
|
|
||||||
|
|
||||||
#### Breaking
|
|
||||||
|
|
||||||
- Changed node dev `__dirname` and `__filename` to node built in fn's (https://github.com/electron-react-boilerplate/electron-react-boilerplate/pull/1035)
|
|
||||||
- Renamed `src/bundle.js` to `src/renderer.prod.js` for consistency
|
|
||||||
- Renamed `dll/vendor.js` to `dll/renderer.dev.dll.js` for consistency
|
|
||||||
|
|
||||||
#### Additions
|
|
||||||
|
|
||||||
- Enable node_modules cache on CI
|
|
||||||
|
|
||||||
# 0.11.2 (2017.5.1)
|
|
||||||
|
|
||||||
Yay! Another patch release. This release mostly includes refactorings and router bug fixes. Huge thanks to @anthonyraymond!
|
|
||||||
|
|
||||||
⚠️ Windows electron builds are failing because of [this issue](https://github.com/electron/electron/issues/9321). This is not an issue with the boilerplate ⚠️
|
|
||||||
|
|
||||||
#### Breaking
|
|
||||||
|
|
||||||
- **Renamed `./src/main.development.js` => `./src/main.{dev,prod}.js`:** [#963](https://github.com/electron-react-boilerplate/electron-react-boilerplate/pull/963)
|
|
||||||
|
|
||||||
#### Fixes
|
|
||||||
|
|
||||||
- **Fixed reloading when not on `/` path:** [#958](https://github.com/electron-react-boilerplate/electron-react-boilerplate/pull/958) [#949](https://github.com/electron-react-boilerplate/electron-react-boilerplate/pull/949)
|
|
||||||
|
|
||||||
#### Additions
|
|
||||||
|
|
||||||
- **Added support for stylefmt:** [#960](https://github.com/electron-react-boilerplate/electron-react-boilerplate/pull/960)
|
|
||||||
|
|
||||||
# 0.11.1 (2017.4.23)
|
|
||||||
|
|
||||||
You can now debug the production build with devtools like so:
|
|
||||||
|
|
||||||
```
|
|
||||||
DEBUG_PROD=true npm run package
|
|
||||||
```
|
|
||||||
|
|
||||||
🎉🎉🎉
|
|
||||||
|
|
||||||
#### Additions
|
|
||||||
|
|
||||||
- **Added support for debugging production build:** [#fab245a](https://github.com/electron-react-boilerplate/electron-react-boilerplate/pull/941/commits/fab245a077d02a09630f74270806c0c534a4ff95)
|
|
||||||
|
|
||||||
#### Bug Fixes
|
|
||||||
|
|
||||||
- **Fixed bug related to importing native dependencies:** [#933](https://github.com/electron-react-boilerplate/electron-react-boilerplate/pull/933)
|
|
||||||
|
|
||||||
#### Improvements
|
|
||||||
|
|
||||||
- **Updated all deps to latest semver**
|
|
||||||
|
|
||||||
# 0.11.0 (2017.4.19)
|
|
||||||
|
|
||||||
Here's the most notable changes since `v0.10.0`. Its been about a year since a release has been pushed. Expect a new release to be published every 3-4 weeks.
|
|
||||||
|
|
||||||
#### Breaking Changes
|
|
||||||
|
|
||||||
- **Dropped support for node < 6**
|
|
||||||
- **Refactored webpack config files**
|
|
||||||
- **Migrate to two-package.json project structure**
|
|
||||||
- **Updated all devDeps to latest semver**
|
|
||||||
- **Migrated to Jest:** [#768](https://github.com/electron-react-boilerplate/electron-react-boilerplate/pull/768)
|
|
||||||
- **Migrated to `react-router@4`**
|
|
||||||
- **Migrated to `electron-builder@4`**
|
|
||||||
- **Migrated to `webpack@2`**
|
|
||||||
- **Migrated to `react-hot-loader@3`**
|
|
||||||
- **Changed default live reload server PORT to `1212` from `3000`**
|
|
||||||
|
|
||||||
#### Additions
|
|
||||||
|
|
||||||
- **Added support for Yarn:** [#451](https://github.com/electron-react-boilerplate/electron-react-boilerplate/pull/451)
|
|
||||||
- **Added support for Flow:** [#425](https://github.com/electron-react-boilerplate/electron-react-boilerplate/pull/425)
|
|
||||||
- **Added support for stylelint:** [#911](https://github.com/electron-react-boilerplate/electron-react-boilerplate/pull/911)
|
|
||||||
- **Added support for electron-builder:** [#876](https://github.com/electron-react-boilerplate/electron-react-boilerplate/pull/876)
|
|
||||||
- **Added optional support for SASS:** [#880](https://github.com/electron-react-boilerplate/electron-react-boilerplate/pull/880)
|
|
||||||
- **Added support for eslint-plugin-flowtype:** [#911](https://github.com/electron-react-boilerplate/electron-react-boilerplate/pull/911)
|
|
||||||
- **Added support for appveyor:** [#280](https://github.com/electron-react-boilerplate/electron-react-boilerplate/pull/280)
|
|
||||||
- **Added support for webpack dlls:** [#860](https://github.com/electron-react-boilerplate/electron-react-boilerplate/pull/860)
|
|
||||||
- **Route based code splitting:** [#884](https://github.com/electron-react-boilerplate/electron-react-boilerplate/pull/884)
|
|
||||||
- **Added support for Webpack Bundle Analyzer:** [#922](https://github.com/electron-react-boilerplate/electron-react-boilerplate/pull/922)
|
|
||||||
|
|
||||||
#### Improvements
|
|
||||||
|
|
||||||
- **Parallelize renderer and main build processes when running `npm run build`**
|
|
||||||
- **Dynamically generate electron app menu**
|
|
||||||
- **Improved vscode integration:** [#856](https://github.com/electron-react-boilerplate/electron-react-boilerplate/pull/856)
|
|
||||||
|
|
||||||
#### Bug Fixes
|
|
||||||
|
|
||||||
- **Fixed hot module replacement race condition bug:** [#917](https://github.com/electron-react-boilerplate/electron-react-boilerplate/pull/917) [#920](https://github.com/electron-react-boilerplate/electron-react-boilerplate/pull/920)
|
|
||||||
|
|
||||||
# 0.10.0 (2016.4.18)
|
|
||||||
|
|
||||||
#### Improvements
|
|
||||||
|
|
||||||
- **Use Babel in main process with Webpack build:** [#201](https://github.com/electron-react-boilerplate/electron-react-boilerplate/pull/201)
|
|
||||||
- **Change targets to built-in support by webpack:** [#197](https://github.com/electron-react-boilerplate/electron-react-boilerplate/pull/197)
|
|
||||||
- **use es2015 syntax for webpack configs:** [#195](https://github.com/electron-react-boilerplate/electron-react-boilerplate/pull/195)
|
|
||||||
- **Open application when webcontent is loaded:** [#192](https://github.com/electron-react-boilerplate/electron-react-boilerplate/pull/192)
|
|
||||||
- **Upgraded dependencies**
|
|
||||||
|
|
||||||
#### Bug fixed
|
|
||||||
|
|
||||||
- **Fix `npm list electron-prebuilt` in package.js:** [#188](https://github.com/electron-react-boilerplate/electron-react-boilerplate/pull/188)
|
|
||||||
|
|
||||||
# 0.9.0 (2016.3.23)
|
|
||||||
|
|
||||||
#### Improvements
|
|
||||||
|
|
||||||
- **Added [redux-logger](https://github.com/fcomb/redux-logger)**
|
|
||||||
- **Upgraded [react-router-redux](https://github.com/reactjs/react-router-redux) to v4**
|
|
||||||
- **Upgraded dependencies**
|
|
||||||
- **Added `npm run dev` command:** [#162](https://github.com/electron-react-boilerplate/electron-react-boilerplate/pull/162)
|
|
||||||
- **electron to v0.37.2**
|
|
||||||
|
|
||||||
#### Breaking Changes
|
|
||||||
|
|
||||||
- **css module as default:** [#154](https://github.com/electron-react-boilerplate/electron-react-boilerplate/pull/154).
|
|
||||||
- **set default NODE_ENV to production:** [#140](https://github.com/electron-react-boilerplate/electron-react-boilerplate/issues/140)
|
|
||||||
|
|
||||||
# 0.8.0 (2016.2.17)
|
|
||||||
|
|
||||||
#### Bug fixed
|
|
||||||
|
|
||||||
- **Fix lint errors**
|
|
||||||
- **Fix Webpack publicPath for production builds**: [#119](https://github.com/electron-react-boilerplate/electron-react-boilerplate/issues/119).
|
|
||||||
- **package script now chooses correct OS icon extension**
|
|
||||||
|
|
||||||
#### Improvements
|
|
||||||
|
|
||||||
- **babel 6**
|
|
||||||
- **Upgrade Dependencies**
|
|
||||||
- **Enable CSS source maps**
|
|
||||||
- **Add json-loader**: [#128](https://github.com/electron-react-boilerplate/electron-react-boilerplate/issues/128).
|
|
||||||
- **react-router 2.0 and react-router-redux 3.0**
|
|
||||||
|
|
||||||
# 0.7.1 (2015.12.27)
|
|
||||||
|
|
||||||
#### Bug fixed
|
|
||||||
|
|
||||||
- **Fixed npm script on windows 10:** [#103](https://github.com/electron-react-boilerplate/electron-react-boilerplate/issues/103).
|
|
||||||
- **history and react-router version bump**: [#109](https://github.com/electron-react-boilerplate/electron-react-boilerplate/issues/109), [#110](https://github.com/electron-react-boilerplate/electron-react-boilerplate/pull/110).
|
|
||||||
|
|
||||||
#### Improvements
|
|
||||||
|
|
||||||
- **electron 0.36**
|
|
||||||
|
|
||||||
# 0.7.0 (2015.12.16)
|
|
||||||
|
|
||||||
#### Bug fixed
|
|
||||||
|
|
||||||
- **Fixed process.env.NODE_ENV variable in webpack:** [#74](https://github.com/electron-react-boilerplate/electron-react-boilerplate/pull/74).
|
|
||||||
- **add missing object-assign**: [#76](https://github.com/electron-react-boilerplate/electron-react-boilerplate/pull/76).
|
|
||||||
- **packaging in npm@3:** [#77](https://github.com/electron-react-boilerplate/electron-react-boilerplate/pull/77).
|
|
||||||
- **compatibility in windows:** [#100](https://github.com/electron-react-boilerplate/electron-react-boilerplate/pull/100).
|
|
||||||
- **disable chrome debugger in production env:** [#102](https://github.com/electron-react-boilerplate/electron-react-boilerplate/pull/102).
|
|
||||||
|
|
||||||
#### Improvements
|
|
||||||
|
|
||||||
- **redux**
|
|
||||||
- **css-modules**
|
|
||||||
- **upgrade to react-router 1.x**
|
|
||||||
- **unit tests**
|
|
||||||
- **e2e tests**
|
|
||||||
- **travis-ci**
|
|
||||||
- **upgrade to electron 0.35.x**
|
|
||||||
- **use es2015**
|
|
||||||
- **check dev engine for node and npm**
|
|
||||||
|
|
||||||
# 0.6.5 (2015.11.7)
|
|
||||||
|
|
||||||
#### Improvements
|
|
||||||
|
|
||||||
- **Bump style-loader to 0.13**
|
|
||||||
- **Bump css-loader to 0.22**
|
|
||||||
|
|
||||||
# 0.6.4 (2015.10.27)
|
|
||||||
|
|
||||||
#### Improvements
|
|
||||||
|
|
||||||
- **Bump electron-debug to 0.3**
|
|
||||||
|
|
||||||
# 0.6.3 (2015.10.26)
|
|
||||||
|
|
||||||
#### Improvements
|
|
||||||
|
|
||||||
- **Initialize ExtractTextPlugin once:** [#64](https://github.com/electron-react-boilerplate/electron-react-boilerplate/issues/64).
|
|
||||||
|
|
||||||
# 0.6.2 (2015.10.18)
|
|
||||||
|
|
||||||
#### Bug fixed
|
|
||||||
|
|
||||||
- **Babel plugins production env not be set properly:** [#57](https://github.com/electron-react-boilerplate/electron-react-boilerplate/issues/57).
|
|
||||||
|
|
||||||
# 0.6.1 (2015.10.17)
|
|
||||||
|
|
||||||
#### Improvements
|
|
||||||
|
|
||||||
- **Bump electron to v0.34.0**
|
|
||||||
|
|
||||||
# 0.6.0 (2015.10.16)
|
|
||||||
|
|
||||||
#### Breaking Changes
|
|
||||||
|
|
||||||
- **From react-hot-loader to react-transform**
|
|
||||||
|
|
||||||
# 0.5.2 (2015.10.15)
|
|
||||||
|
|
||||||
#### Improvements
|
|
||||||
|
|
||||||
- **Run tests with babel-register:** [#29](https://github.com/electron-react-boilerplate/electron-react-boilerplate/issues/29).
|
|
||||||
|
|
||||||
# 0.5.1 (2015.10.12)
|
|
||||||
|
|
||||||
#### Bug fixed
|
|
||||||
|
|
||||||
- **Fix #51:** use `path.join(__dirname` instead of `./`.
|
|
||||||
|
|
||||||
# 0.5.0 (2015.10.11)
|
|
||||||
|
|
||||||
#### Improvements
|
|
||||||
|
|
||||||
- **Simplify webpack config** see [#50](https://github.com/electron-react-boilerplate/electron-react-boilerplate/pull/50).
|
|
||||||
|
|
||||||
#### Breaking Changes
|
|
||||||
|
|
||||||
- **webpack configs**
|
|
||||||
- **port changed:** changed default port from 2992 to 3000.
|
|
||||||
- **npm scripts:** remove `start-dev` and `dev-server`. rename `hot-dev-server` to `hot-server`.
|
|
||||||
|
|
||||||
# 0.4.3 (2015.9.22)
|
|
||||||
|
|
||||||
#### Bug fixed
|
|
||||||
|
|
||||||
- **Fix #45 zeromq crash:** bump version of `electron-prebuilt`.
|
|
||||||
|
|
||||||
# 0.4.2 (2015.9.15)
|
|
||||||
|
|
||||||
#### Bug fixed
|
|
||||||
|
|
||||||
- **run start-hot breaks chrome refresh(CTRL+R) (#42)**: bump `electron-debug` to `0.2.1`
|
|
||||||
|
|
||||||
# 0.4.1 (2015.9.11)
|
|
||||||
|
|
||||||
#### Improvements
|
|
||||||
|
|
||||||
- **use electron-prebuilt version for packaging (#33)**
|
|
||||||
|
|
||||||
# 0.4.0 (2015.9.5)
|
|
||||||
|
|
||||||
#### Improvements
|
|
||||||
|
|
||||||
- **update dependencies**
|
|
||||||
|
|
||||||
# 0.3.0 (2015.8.31)
|
|
||||||
|
|
||||||
#### Improvements
|
|
||||||
|
|
||||||
- **eslint-config-airbnb**
|
|
||||||
|
|
||||||
# 0.2.10 (2015.8.27)
|
|
||||||
|
|
||||||
#### Features
|
|
||||||
|
|
||||||
- **custom placeholder icon**
|
|
||||||
|
|
||||||
#### Improvements
|
|
||||||
|
|
||||||
- **electron-renderer as target:** via [webpack-target-electron-renderer](https://github.com/chentsulin/webpack-target-electron-renderer)
|
|
||||||
|
|
||||||
# 0.2.9 (2015.8.18)
|
|
||||||
|
|
||||||
#### Bug fixed
|
|
||||||
|
|
||||||
- **Fix hot-reload**
|
|
||||||
|
|
||||||
# 0.2.8 (2015.8.13)
|
|
||||||
|
|
||||||
#### Improvements
|
|
||||||
|
|
||||||
- **bump electron-debug**
|
|
||||||
- **babelrc**
|
|
||||||
- **organize webpack scripts**
|
|
||||||
|
|
||||||
# 0.2.7 (2015.7.9)
|
|
||||||
|
|
||||||
#### Bug fixed
|
|
||||||
|
|
||||||
- **defaultProps:** fix typos.
|
|
||||||
|
|
||||||
# 0.2.6 (2015.7.3)
|
|
||||||
|
|
||||||
#### Features
|
|
||||||
|
|
||||||
- **menu**
|
|
||||||
|
|
||||||
#### Bug fixed
|
|
||||||
|
|
||||||
- **package.js:** include webpack build.
|
|
||||||
|
|
||||||
# 0.2.5 (2015.7.1)
|
|
||||||
|
|
||||||
#### Features
|
|
||||||
|
|
||||||
- **NPM Script:** support multi-platform
|
|
||||||
- **package:** `--all` option
|
|
||||||
|
|
||||||
# 0.2.4 (2015.6.9)
|
|
||||||
|
|
||||||
#### Bug fixed
|
|
||||||
|
|
||||||
- **Eslint:** typo, [#17](https://github.com/electron-react-boilerplate/electron-react-boilerplate/issues/17) and improve `.eslintrc`
|
|
||||||
|
|
||||||
# 0.2.3 (2015.6.3)
|
|
||||||
|
|
||||||
#### Features
|
|
||||||
|
|
||||||
- **Package Version:** use latest release electron version as default
|
|
||||||
- **Ignore Large peerDependencies**
|
|
||||||
|
|
||||||
#### Bug fixed
|
|
||||||
|
|
||||||
- **Npm Script:** typo, [#6](https://github.com/electron-react-boilerplate/electron-react-boilerplate/pull/6)
|
|
||||||
- **Missing css:** [#7](https://github.com/electron-react-boilerplate/electron-react-boilerplate/pull/7)
|
|
||||||
|
|
||||||
# 0.2.2 (2015.6.2)
|
|
||||||
|
|
||||||
#### Features
|
|
||||||
|
|
||||||
- **electron-debug**
|
|
||||||
|
|
||||||
#### Bug fixed
|
|
||||||
|
|
||||||
- **Webpack:** add `.json` and `.node` to extensions for imitating node require.
|
|
||||||
- **Webpack:** set `node_modules` to externals for native module support.
|
|
||||||
|
|
||||||
# 0.2.1 (2015.5.30)
|
|
||||||
|
|
||||||
#### Bug fixed
|
|
||||||
|
|
||||||
- **Webpack:** #1, change build target to `atom`.
|
|
||||||
|
|
||||||
# 0.2.0 (2015.5.30)
|
|
||||||
|
|
||||||
#### Features
|
|
||||||
|
|
||||||
- **Ignore:** `test`, `tools`, `release` folder and devDependencies in `package.json`.
|
|
||||||
- **Support asar**
|
|
||||||
- **Support icon**
|
|
||||||
|
|
||||||
# 0.1.0 (2015.5.27)
|
|
||||||
|
|
||||||
#### Features
|
|
||||||
|
|
||||||
- **Webpack:** babel, react-hot, ...
|
|
||||||
- **Flux:** actions, api, components, containers, stores..
|
|
||||||
- **Package:** darwin (osx), linux and win32 (windows) platform.
|
|
|
@ -1,76 +0,0 @@
|
||||||
# Contributor Covenant Code of Conduct
|
|
||||||
|
|
||||||
## Our Pledge
|
|
||||||
|
|
||||||
In the interest of fostering an open and welcoming environment, we as
|
|
||||||
contributors and maintainers pledge to making participation in our project and
|
|
||||||
our community a harassment-free experience for everyone, regardless of age, body
|
|
||||||
size, disability, ethnicity, sex characteristics, gender identity and expression,
|
|
||||||
level of experience, education, socio-economic status, nationality, personal
|
|
||||||
appearance, race, religion, or sexual identity and orientation.
|
|
||||||
|
|
||||||
## Our Standards
|
|
||||||
|
|
||||||
Examples of behavior that contributes to creating a positive environment
|
|
||||||
include:
|
|
||||||
|
|
||||||
* Using welcoming and inclusive language
|
|
||||||
* Being respectful of differing viewpoints and experiences
|
|
||||||
* Gracefully accepting constructive criticism
|
|
||||||
* Focusing on what is best for the community
|
|
||||||
* Showing empathy towards other community members
|
|
||||||
|
|
||||||
Examples of unacceptable behavior by participants include:
|
|
||||||
|
|
||||||
* The use of sexualized language or imagery and unwelcome sexual attention or
|
|
||||||
advances
|
|
||||||
* Trolling, insulting/derogatory comments, and personal or political attacks
|
|
||||||
* Public or private harassment
|
|
||||||
* Publishing others' private information, such as a physical or electronic
|
|
||||||
address, without explicit permission
|
|
||||||
* Other conduct which could reasonably be considered inappropriate in a
|
|
||||||
professional setting
|
|
||||||
|
|
||||||
## Our Responsibilities
|
|
||||||
|
|
||||||
Project maintainers are responsible for clarifying the standards of acceptable
|
|
||||||
behavior and are expected to take appropriate and fair corrective action in
|
|
||||||
response to any instances of unacceptable behavior.
|
|
||||||
|
|
||||||
Project maintainers have the right and responsibility to remove, edit, or
|
|
||||||
reject comments, commits, code, wiki edits, issues, and other contributions
|
|
||||||
that are not aligned to this Code of Conduct, or to ban temporarily or
|
|
||||||
permanently any contributor for other behaviors that they deem inappropriate,
|
|
||||||
threatening, offensive, or harmful.
|
|
||||||
|
|
||||||
## Scope
|
|
||||||
|
|
||||||
This Code of Conduct applies both within project spaces and in public spaces
|
|
||||||
when an individual is representing the project or its community. Examples of
|
|
||||||
representing a project or community include using an official project e-mail
|
|
||||||
address, posting via an official social media account, or acting as an appointed
|
|
||||||
representative at an online or offline event. Representation of a project may be
|
|
||||||
further defined and clarified by project maintainers.
|
|
||||||
|
|
||||||
## Enforcement
|
|
||||||
|
|
||||||
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
|
||||||
reported by contacting the project team at electronreactboilerplate@gmail.com. All
|
|
||||||
complaints will be reviewed and investigated and will result in a response that
|
|
||||||
is deemed necessary and appropriate to the circumstances. The project team is
|
|
||||||
obligated to maintain confidentiality with regard to the reporter of an incident.
|
|
||||||
Further details of specific enforcement policies may be posted separately.
|
|
||||||
|
|
||||||
Project maintainers who do not follow or enforce the Code of Conduct in good
|
|
||||||
faith may face temporary or permanent repercussions as determined by other
|
|
||||||
members of the project's leadership.
|
|
||||||
|
|
||||||
## Attribution
|
|
||||||
|
|
||||||
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
|
|
||||||
available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html
|
|
||||||
|
|
||||||
[homepage]: https://www.contributor-covenant.org
|
|
||||||
|
|
||||||
For answers to common questions about this code of conduct, see
|
|
||||||
https://www.contributor-covenant.org/faq
|
|
|
@ -1,21 +0,0 @@
|
||||||
The MIT License (MIT)
|
|
||||||
|
|
||||||
Copyright (c) 2015-present Electron React Boilerplate
|
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
||||||
of this software and associated documentation files (the "Software"), to deal
|
|
||||||
in the Software without restriction, including without limitation the rights
|
|
||||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
||||||
copies of the Software, and to permit persons to whom the Software is
|
|
||||||
furnished to do so, subject to the following conditions:
|
|
||||||
|
|
||||||
The above copyright notice and this permission notice shall be included in all
|
|
||||||
copies or substantial portions of the Software.
|
|
||||||
|
|
||||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
||||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
||||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
||||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
||||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
||||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
||||||
SOFTWARE.
|
|
|
@ -1,159 +0,0 @@
|
||||||
<img src=".erb/img/erb-banner.svg" width="100%" />
|
|
||||||
|
|
||||||
<br>
|
|
||||||
|
|
||||||
<p>
|
|
||||||
Electron React Boilerplate uses <a href="https://electron.atom.io/">Electron</a>, <a href="https://facebook.github.io/react/">React</a>, <a href="https://github.com/reactjs/react-router">React Router</a>, <a href="https://webpack.js.org/">Webpack</a> and <a href="https://www.npmjs.com/package/react-refresh">React Fast Refresh</a>.
|
|
||||||
</p>
|
|
||||||
|
|
||||||
<br>
|
|
||||||
|
|
||||||
<div align="center">
|
|
||||||
|
|
||||||
[![Build Status][github-actions-status]][github-actions-url]
|
|
||||||
[![Github Tag][github-tag-image]][github-tag-url]
|
|
||||||
[![Discord](https://badgen.net/badge/icon/discord?icon=discord&label)](https://discord.gg/Fjy3vfgy5q)
|
|
||||||
|
|
||||||
[![OpenCollective](https://opencollective.com/electron-react-boilerplate-594/backers/badge.svg)](#backers)
|
|
||||||
[![OpenCollective](https://opencollective.com/electron-react-boilerplate-594/sponsors/badge.svg)](#sponsors)
|
|
||||||
[![StackOverflow][stackoverflow-img]][stackoverflow-url]
|
|
||||||
|
|
||||||
</div>
|
|
||||||
|
|
||||||
## Install
|
|
||||||
|
|
||||||
Clone the repo and install dependencies:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
git clone --depth 1 --branch main https://github.com/electron-react-boilerplate/electron-react-boilerplate.git your-project-name
|
|
||||||
cd your-project-name
|
|
||||||
npm install
|
|
||||||
```
|
|
||||||
|
|
||||||
**Having issues installing? See our [debugging guide](https://github.com/electron-react-boilerplate/electron-react-boilerplate/issues/400)**
|
|
||||||
|
|
||||||
## Starting Development
|
|
||||||
|
|
||||||
Start the app in the `dev` environment:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
npm start
|
|
||||||
```
|
|
||||||
|
|
||||||
## Packaging for Production
|
|
||||||
|
|
||||||
To package apps for the local platform:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
npm run package
|
|
||||||
```
|
|
||||||
|
|
||||||
## Docs
|
|
||||||
|
|
||||||
See our [docs and guides here](https://electron-react-boilerplate.js.org/docs/installation)
|
|
||||||
|
|
||||||
## Community
|
|
||||||
|
|
||||||
Join our Discord: https://discord.gg/Fjy3vfgy5q
|
|
||||||
|
|
||||||
## Sponsors
|
|
||||||
|
|
||||||
<a href="https://palette.dev">
|
|
||||||
<img src=".erb/img/palette-sponsor-banner.svg" width="100%" />
|
|
||||||
</a>
|
|
||||||
|
|
||||||
## Donations
|
|
||||||
|
|
||||||
**Donations will ensure the following:**
|
|
||||||
|
|
||||||
- 🔨 Long term maintenance of the project
|
|
||||||
- 🛣 Progress on the [roadmap](https://electron-react-boilerplate.js.org/docs/roadmap)
|
|
||||||
- 🐛 Quick responses to bug reports and help requests
|
|
||||||
|
|
||||||
## Backers
|
|
||||||
|
|
||||||
Support us with a monthly donation and help us continue our activities. [[Become a backer](https://opencollective.com/electron-react-boilerplate-594#backer)]
|
|
||||||
|
|
||||||
<a href="https://opencollective.com/electron-react-boilerplate-594/backer/0/website" target="_blank"><img src="https://opencollective.com/electron-react-boilerplate-594/backer/0/avatar.svg"></a>
|
|
||||||
<a href="https://opencollective.com/electron-react-boilerplate-594/backer/1/website" target="_blank"><img src="https://opencollective.com/electron-react-boilerplate-594/backer/1/avatar.svg"></a>
|
|
||||||
<a href="https://opencollective.com/electron-react-boilerplate-594/backer/2/website" target="_blank"><img src="https://opencollective.com/electron-react-boilerplate-594/backer/2/avatar.svg"></a>
|
|
||||||
<a href="https://opencollective.com/electron-react-boilerplate-594/backer/3/website" target="_blank"><img src="https://opencollective.com/electron-react-boilerplate-594/backer/3/avatar.svg"></a>
|
|
||||||
<a href="https://opencollective.com/electron-react-boilerplate-594/backer/4/website" target="_blank"><img src="https://opencollective.com/electron-react-boilerplate-594/backer/4/avatar.svg"></a>
|
|
||||||
<a href="https://opencollective.com/electron-react-boilerplate-594/backer/5/website" target="_blank"><img src="https://opencollective.com/electron-react-boilerplate-594/backer/5/avatar.svg"></a>
|
|
||||||
<a href="https://opencollective.com/electron-react-boilerplate-594/backer/6/website" target="_blank"><img src="https://opencollective.com/electron-react-boilerplate-594/backer/6/avatar.svg"></a>
|
|
||||||
<a href="https://opencollective.com/electron-react-boilerplate-594/backer/7/website" target="_blank"><img src="https://opencollective.com/electron-react-boilerplate-594/backer/7/avatar.svg"></a>
|
|
||||||
<a href="https://opencollective.com/electron-react-boilerplate-594/backer/8/website" target="_blank"><img src="https://opencollective.com/electron-react-boilerplate-594/backer/8/avatar.svg"></a>
|
|
||||||
<a href="https://opencollective.com/electron-react-boilerplate-594/backer/9/website" target="_blank"><img src="https://opencollective.com/electron-react-boilerplate-594/backer/9/avatar.svg"></a>
|
|
||||||
<a href="https://opencollective.com/electron-react-boilerplate-594/backer/10/website" target="_blank"><img src="https://opencollective.com/electron-react-boilerplate-594/backer/10/avatar.svg"></a>
|
|
||||||
<a href="https://opencollective.com/electron-react-boilerplate-594/backer/11/website" target="_blank"><img src="https://opencollective.com/electron-react-boilerplate-594/backer/11/avatar.svg"></a>
|
|
||||||
<a href="https://opencollective.com/electron-react-boilerplate-594/backer/12/website" target="_blank"><img src="https://opencollective.com/electron-react-boilerplate-594/backer/12/avatar.svg"></a>
|
|
||||||
<a href="https://opencollective.com/electron-react-boilerplate-594/backer/13/website" target="_blank"><img src="https://opencollective.com/electron-react-boilerplate-594/backer/13/avatar.svg"></a>
|
|
||||||
<a href="https://opencollective.com/electron-react-boilerplate-594/backer/14/website" target="_blank"><img src="https://opencollective.com/electron-react-boilerplate-594/backer/14/avatar.svg"></a>
|
|
||||||
<a href="https://opencollective.com/electron-react-boilerplate-594/backer/15/website" target="_blank"><img src="https://opencollective.com/electron-react-boilerplate-594/backer/15/avatar.svg"></a>
|
|
||||||
<a href="https://opencollective.com/electron-react-boilerplate-594/backer/16/website" target="_blank"><img src="https://opencollective.com/electron-react-boilerplate-594/backer/16/avatar.svg"></a>
|
|
||||||
<a href="https://opencollective.com/electron-react-boilerplate-594/backer/17/website" target="_blank"><img src="https://opencollective.com/electron-react-boilerplate-594/backer/17/avatar.svg"></a>
|
|
||||||
<a href="https://opencollective.com/electron-react-boilerplate-594/backer/18/website" target="_blank"><img src="https://opencollective.com/electron-react-boilerplate-594/backer/18/avatar.svg"></a>
|
|
||||||
<a href="https://opencollective.com/electron-react-boilerplate-594/backer/19/website" target="_blank"><img src="https://opencollective.com/electron-react-boilerplate-594/backer/19/avatar.svg"></a>
|
|
||||||
<a href="https://opencollective.com/electron-react-boilerplate-594/backer/20/website" target="_blank"><img src="https://opencollective.com/electron-react-boilerplate-594/backer/20/avatar.svg"></a>
|
|
||||||
<a href="https://opencollective.com/electron-react-boilerplate-594/backer/21/website" target="_blank"><img src="https://opencollective.com/electron-react-boilerplate-594/backer/21/avatar.svg"></a>
|
|
||||||
<a href="https://opencollective.com/electron-react-boilerplate-594/backer/22/website" target="_blank"><img src="https://opencollective.com/electron-react-boilerplate-594/backer/22/avatar.svg"></a>
|
|
||||||
<a href="https://opencollective.com/electron-react-boilerplate-594/backer/23/website" target="_blank"><img src="https://opencollective.com/electron-react-boilerplate-594/backer/23/avatar.svg"></a>
|
|
||||||
<a href="https://opencollective.com/electron-react-boilerplate-594/backer/24/website" target="_blank"><img src="https://opencollective.com/electron-react-boilerplate-594/backer/24/avatar.svg"></a>
|
|
||||||
<a href="https://opencollective.com/electron-react-boilerplate-594/backer/25/website" target="_blank"><img src="https://opencollective.com/electron-react-boilerplate-594/backer/25/avatar.svg"></a>
|
|
||||||
<a href="https://opencollective.com/electron-react-boilerplate-594/backer/26/website" target="_blank"><img src="https://opencollective.com/electron-react-boilerplate-594/backer/26/avatar.svg"></a>
|
|
||||||
<a href="https://opencollective.com/electron-react-boilerplate-594/backer/27/website" target="_blank"><img src="https://opencollective.com/electron-react-boilerplate-594/backer/27/avatar.svg"></a>
|
|
||||||
<a href="https://opencollective.com/electron-react-boilerplate-594/backer/28/website" target="_blank"><img src="https://opencollective.com/electron-react-boilerplate-594/backer/28/avatar.svg"></a>
|
|
||||||
<a href="https://opencollective.com/electron-react-boilerplate-594/backer/29/website" target="_blank"><img src="https://opencollective.com/electron-react-boilerplate-594/backer/29/avatar.svg"></a>
|
|
||||||
|
|
||||||
## Sponsors
|
|
||||||
|
|
||||||
Become a sponsor and get your logo on our README on Github with a link to your site. [[Become a sponsor](https://opencollective.com/electron-react-boilerplate-594-594#sponsor)]
|
|
||||||
|
|
||||||
<a href="https://opencollective.com/electron-react-boilerplate-594/sponsor/0/website" target="_blank"><img src="https://opencollective.com/electron-react-boilerplate-594/sponsor/0/avatar.svg"></a>
|
|
||||||
<a href="https://opencollective.com/electron-react-boilerplate-594/sponsor/1/website" target="_blank"><img src="https://opencollective.com/electron-react-boilerplate-594/sponsor/1/avatar.svg"></a>
|
|
||||||
<a href="https://opencollective.com/electron-react-boilerplate-594/sponsor/2/website" target="_blank"><img src="https://opencollective.com/electron-react-boilerplate-594/sponsor/2/avatar.svg"></a>
|
|
||||||
<a href="https://opencollective.com/electron-react-boilerplate-594/sponsor/3/website" target="_blank"><img src="https://opencollective.com/electron-react-boilerplate-594/sponsor/3/avatar.svg"></a>
|
|
||||||
<a href="https://opencollective.com/electron-react-boilerplate-594/sponsor/4/website" target="_blank"><img src="https://opencollective.com/electron-react-boilerplate-594/sponsor/4/avatar.svg"></a>
|
|
||||||
<a href="https://opencollective.com/electron-react-boilerplate-594/sponsor/5/website" target="_blank"><img src="https://opencollective.com/electron-react-boilerplate-594/sponsor/5/avatar.svg"></a>
|
|
||||||
<a href="https://opencollective.com/electron-react-boilerplate-594/sponsor/6/website" target="_blank"><img src="https://opencollective.com/electron-react-boilerplate-594/sponsor/6/avatar.svg"></a>
|
|
||||||
<a href="https://opencollective.com/electron-react-boilerplate-594/sponsor/7/website" target="_blank"><img src="https://opencollective.com/electron-react-boilerplate-594/sponsor/7/avatar.svg"></a>
|
|
||||||
<a href="https://opencollective.com/electron-react-boilerplate-594/sponsor/8/website" target="_blank"><img src="https://opencollective.com/electron-react-boilerplate-594/sponsor/8/avatar.svg"></a>
|
|
||||||
<a href="https://opencollective.com/electron-react-boilerplate-594/sponsor/9/website" target="_blank"><img src="https://opencollective.com/electron-react-boilerplate-594/sponsor/9/avatar.svg"></a>
|
|
||||||
<a href="https://opencollective.com/electron-react-boilerplate-594/sponsor/10/website" target="_blank"><img src="https://opencollective.com/electron-react-boilerplate-594/sponsor/10/avatar.svg"></a>
|
|
||||||
<a href="https://opencollective.com/electron-react-boilerplate-594/sponsor/11/website" target="_blank"><img src="https://opencollective.com/electron-react-boilerplate-594/sponsor/11/avatar.svg"></a>
|
|
||||||
<a href="https://opencollective.com/electron-react-boilerplate-594/sponsor/12/website" target="_blank"><img src="https://opencollective.com/electron-react-boilerplate-594/sponsor/12/avatar.svg"></a>
|
|
||||||
<a href="https://opencollective.com/electron-react-boilerplate-594/sponsor/13/website" target="_blank"><img src="https://opencollective.com/electron-react-boilerplate-594/sponsor/13/avatar.svg"></a>
|
|
||||||
<a href="https://opencollective.com/electron-react-boilerplate-594/sponsor/14/website" target="_blank"><img src="https://opencollective.com/electron-react-boilerplate-594/sponsor/14/avatar.svg"></a>
|
|
||||||
<a href="https://opencollective.com/electron-react-boilerplate-594/sponsor/15/website" target="_blank"><img src="https://opencollective.com/electron-react-boilerplate-594/sponsor/15/avatar.svg"></a>
|
|
||||||
<a href="https://opencollective.com/electron-react-boilerplate-594/sponsor/16/website" target="_blank"><img src="https://opencollective.com/electron-react-boilerplate-594/sponsor/16/avatar.svg"></a>
|
|
||||||
<a href="https://opencollective.com/electron-react-boilerplate-594/sponsor/17/website" target="_blank"><img src="https://opencollective.com/electron-react-boilerplate-594/sponsor/17/avatar.svg"></a>
|
|
||||||
<a href="https://opencollective.com/electron-react-boilerplate-594/sponsor/18/website" target="_blank"><img src="https://opencollective.com/electron-react-boilerplate-594/sponsor/18/avatar.svg"></a>
|
|
||||||
<a href="https://opencollective.com/electron-react-boilerplate-594/sponsor/19/website" target="_blank"><img src="https://opencollective.com/electron-react-boilerplate-594/sponsor/19/avatar.svg"></a>
|
|
||||||
<a href="https://opencollective.com/electron-react-boilerplate-594/sponsor/20/website" target="_blank"><img src="https://opencollective.com/electron-react-boilerplate-594/sponsor/20/avatar.svg"></a>
|
|
||||||
<a href="https://opencollective.com/electron-react-boilerplate-594/sponsor/21/website" target="_blank"><img src="https://opencollective.com/electron-react-boilerplate-594/sponsor/21/avatar.svg"></a>
|
|
||||||
<a href="https://opencollective.com/electron-react-boilerplate-594/sponsor/22/website" target="_blank"><img src="https://opencollective.com/electron-react-boilerplate-594/sponsor/22/avatar.svg"></a>
|
|
||||||
<a href="https://opencollective.com/electron-react-boilerplate-594/sponsor/23/website" target="_blank"><img src="https://opencollective.com/electron-react-boilerplate-594/sponsor/23/avatar.svg"></a>
|
|
||||||
<a href="https://opencollective.com/electron-react-boilerplate-594/sponsor/24/website" target="_blank"><img src="https://opencollective.com/electron-react-boilerplate-594/sponsor/24/avatar.svg"></a>
|
|
||||||
<a href="https://opencollective.com/electron-react-boilerplate-594/sponsor/25/website" target="_blank"><img src="https://opencollective.com/electron-react-boilerplate-594/sponsor/25/avatar.svg"></a>
|
|
||||||
<a href="https://opencollective.com/electron-react-boilerplate-594/sponsor/26/website" target="_blank"><img src="https://opencollective.com/electron-react-boilerplate-594/sponsor/26/avatar.svg"></a>
|
|
||||||
<a href="https://opencollective.com/electron-react-boilerplate-594/sponsor/27/website" target="_blank"><img src="https://opencollective.com/electron-react-boilerplate-594/sponsor/27/avatar.svg"></a>
|
|
||||||
<a href="https://opencollective.com/electron-react-boilerplate-594/sponsor/28/website" target="_blank"><img src="https://opencollective.com/electron-react-boilerplate-594/sponsor/28/avatar.svg"></a>
|
|
||||||
<a href="https://opencollective.com/electron-react-boilerplate-594/sponsor/29/website" target="_blank"><img src="https://opencollective.com/electron-react-boilerplate-594/sponsor/29/avatar.svg"></a>
|
|
||||||
|
|
||||||
## Maintainers
|
|
||||||
|
|
||||||
- [Amila Welihinda](https://github.com/amilajack)
|
|
||||||
- [John Tran](https://github.com/jooohhn)
|
|
||||||
- [C. T. Lin](https://github.com/chentsulin)
|
|
||||||
- [Jhen-Jie Hong](https://github.com/jhen0409)
|
|
||||||
|
|
||||||
## License
|
|
||||||
|
|
||||||
MIT © [Electron React Boilerplate](https://github.com/electron-react-boilerplate)
|
|
||||||
|
|
||||||
[github-actions-status]: https://github.com/electron-react-boilerplate/electron-react-boilerplate/workflows/Test/badge.svg
|
|
||||||
[github-actions-url]: https://github.com/electron-react-boilerplate/electron-react-boilerplate/actions
|
|
||||||
[github-tag-image]: https://img.shields.io/github/tag/electron-react-boilerplate/electron-react-boilerplate.svg?label=version
|
|
||||||
[github-tag-url]: https://github.com/electron-react-boilerplate/electron-react-boilerplate/releases/latest
|
|
||||||
[stackoverflow-img]: https://img.shields.io/badge/stackoverflow-electron_react_boilerplate-blue.svg
|
|
||||||
[stackoverflow-url]: https://stackoverflow.com/questions/tagged/electron-react-boilerplate
|
|
|
@ -1,35 +0,0 @@
|
||||||
type Styles = Record<string, string>;
|
|
||||||
|
|
||||||
declare module '*.svg' {
|
|
||||||
import React = require('react');
|
|
||||||
|
|
||||||
export const ReactComponent: React.FC<React.SVGProps<SVGSVGElement>>;
|
|
||||||
|
|
||||||
const content: string;
|
|
||||||
export default content;
|
|
||||||
}
|
|
||||||
|
|
||||||
declare module '*.png' {
|
|
||||||
const content: string;
|
|
||||||
export default content;
|
|
||||||
}
|
|
||||||
|
|
||||||
declare module '*.jpg' {
|
|
||||||
const content: string;
|
|
||||||
export default content;
|
|
||||||
}
|
|
||||||
|
|
||||||
declare module '*.scss' {
|
|
||||||
const content: Styles;
|
|
||||||
export default content;
|
|
||||||
}
|
|
||||||
|
|
||||||
declare module '*.sass' {
|
|
||||||
const content: Styles;
|
|
||||||
export default content;
|
|
||||||
}
|
|
||||||
|
|
||||||
declare module '*.css' {
|
|
||||||
const content: Styles;
|
|
||||||
export default content;
|
|
||||||
}
|
|
|
@ -1,10 +0,0 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
|
||||||
<plist version="1.0">
|
|
||||||
<dict>
|
|
||||||
<key>com.apple.security.cs.allow-unsigned-executable-memory</key>
|
|
||||||
<true/>
|
|
||||||
<key>com.apple.security.cs.allow-jit</key>
|
|
||||||
<true/>
|
|
||||||
</dict>
|
|
||||||
</plist>
|
|
Before Width: | Height: | Size: 361 KiB |
Before Width: | Height: | Size: 32 KiB |
|
@ -1,23 +0,0 @@
|
||||||
<svg width="232" height="232" viewBox="0 0 232 232" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
||||||
<g filter="url(#filter0_b)">
|
|
||||||
<path d="M231.5 1V0.5H231H1H0.5V1V231V231.5H1H231H231.5V231V1ZM40.5 25C40.5 33.0082 34.0082 39.5 26 39.5C17.9918 39.5 11.5 33.0082 11.5 25C11.5 16.9918 17.9918 10.5 26 10.5C34.0082 10.5 40.5 16.9918 40.5 25ZM220.5 25C220.5 33.0082 214.008 39.5 206 39.5C197.992 39.5 191.5 33.0082 191.5 25C191.5 16.9918 197.992 10.5 206 10.5C214.008 10.5 220.5 16.9918 220.5 25ZM40.5 205C40.5 213.008 34.0082 219.5 26 219.5C17.9918 219.5 11.5 213.008 11.5 205C11.5 196.992 17.9918 190.5 26 190.5C34.0082 190.5 40.5 196.992 40.5 205ZM220.5 205C220.5 213.008 214.008 219.5 206 219.5C197.992 219.5 191.5 213.008 191.5 205C191.5 196.992 197.992 190.5 206 190.5C214.008 190.5 220.5 196.992 220.5 205ZM209.5 111C209.5 162.639 167.639 204.5 116 204.5C64.3613 204.5 22.5 162.639 22.5 111C22.5 59.3613 64.3613 17.5 116 17.5C167.639 17.5 209.5 59.3613 209.5 111Z" fill="white" stroke="white"/>
|
|
||||||
<path d="M63.5 146.5C63.5 149.959 60.8969 152.5 58 152.5C55.1031 152.5 52.5 149.959 52.5 146.5C52.5 143.041 55.1031 140.5 58 140.5C60.8969 140.5 63.5 143.041 63.5 146.5Z" stroke="white" stroke-width="5"/>
|
|
||||||
<path d="M54.9856 139.466C54.9856 139.466 51.1973 116.315 83.1874 93.1647C115.178 70.014 133.698 69.5931 133.698 69.5931" stroke="white" stroke-width="5" stroke-linecap="round"/>
|
|
||||||
<path d="M178.902 142.686C177.27 139.853 173.652 138.88 170.819 140.512C167.987 142.144 167.014 145.762 168.646 148.595C170.277 151.427 173.896 152.4 176.728 150.768C179.561 149.137 180.534 145.518 178.902 142.686Z" stroke="white" stroke-width="5"/>
|
|
||||||
<path d="M169.409 151.555C169.409 151.555 151.24 166.394 115.211 150.232C79.182 134.07 69.5718 118.232 69.5718 118.232" stroke="white" stroke-width="5" stroke-linecap="round"/>
|
|
||||||
<path d="M109.577 41.9707C107.966 44.8143 108.964 48.4262 111.808 50.038C114.651 51.6498 118.263 50.6512 119.875 47.8075C121.487 44.9639 120.488 41.3521 117.645 39.7403C114.801 38.1285 111.189 39.1271 109.577 41.9707Z" stroke="white" stroke-width="5"/>
|
|
||||||
<path d="M122.038 45.6467C122.038 45.6467 144.047 53.7668 148.412 93.0129C152.778 132.259 144.012 148.579 144.012 148.579" stroke="white" stroke-width="5" stroke-linecap="round"/>
|
|
||||||
<path d="M59.6334 105C59.6334 105 50.4373 82.1038 61.3054 73.3616C72.1736 64.6194 96 69.1987 96 69.1987" stroke="white" stroke-width="5" stroke-linecap="round"/>
|
|
||||||
<path d="M149.532 66.9784C149.532 66.9784 174.391 68.9134 177.477 82.6384C180.564 96.3634 165.799 115.833 165.799 115.833" stroke="white" stroke-width="5" stroke-linecap="round"/>
|
|
||||||
<path d="M138.248 163.363C138.248 163.363 124.023 183.841 110.618 179.573C97.2129 175.305 87.8662 152.728 87.8662 152.728" stroke="white" stroke-width="5" stroke-linecap="round"/>
|
|
||||||
<path d="M116 119C120.418 119 124 115.642 124 111.5C124 107.358 120.418 104 116 104C111.582 104 108 107.358 108 111.5C108 115.642 111.582 119 116 119Z" fill="white"/>
|
|
||||||
</g>
|
|
||||||
<defs>
|
|
||||||
<filter id="filter0_b" x="-4" y="-4" width="240" height="240" filterUnits="userSpaceOnUse" color-interpolation-filters="sRGB">
|
|
||||||
<feFlood flood-opacity="0" result="BackgroundImageFix"/>
|
|
||||||
<feGaussianBlur in="BackgroundImage" stdDeviation="2"/>
|
|
||||||
<feComposite in2="SourceAlpha" operator="in" result="effect1_backgroundBlur"/>
|
|
||||||
<feBlend mode="normal" in="SourceGraphic" in2="effect1_backgroundBlur" result="shape"/>
|
|
||||||
</filter>
|
|
||||||
</defs>
|
|
||||||
</svg>
|
|
Before Width: | Height: | Size: 3.3 KiB |
Before Width: | Height: | Size: 156 KiB |
Before Width: | Height: | Size: 17 KiB |
Before Width: | Height: | Size: 954 B |
Before Width: | Height: | Size: 1.9 KiB |
Before Width: | Height: | Size: 32 KiB |
Before Width: | Height: | Size: 2.0 KiB |
Before Width: | Height: | Size: 5.0 KiB |
Before Width: | Height: | Size: 77 KiB |
Before Width: | Height: | Size: 7.3 KiB |
Before Width: | Height: | Size: 12 KiB |
|
@ -1,183 +0,0 @@
|
||||||
{
|
|
||||||
"name": "pyblocks-gui",
|
|
||||||
"description": "A GUI for pyblocks-blocks",
|
|
||||||
"license": "MIT",
|
|
||||||
"author": {
|
|
||||||
"name": "c0repwn3r"
|
|
||||||
},
|
|
||||||
"main": "./src/main/main.ts",
|
|
||||||
"scripts": {
|
|
||||||
"build": "concurrently \"npm run build:main\" \"npm run build:renderer\"",
|
|
||||||
"build:main": "cross-env NODE_ENV=production TS_NODE_TRANSPILE_ONLY=true webpack --config ./.erb/configs/webpack.config.main.prod.ts",
|
|
||||||
"build:renderer": "cross-env NODE_ENV=production TS_NODE_TRANSPILE_ONLY=true webpack --config ./.erb/configs/webpack.config.renderer.prod.ts",
|
|
||||||
"postinstall": "ts-node .erb/scripts/check-native-dep.js && electron-builder install-app-deps && cross-env NODE_ENV=development TS_NODE_TRANSPILE_ONLY=true webpack --config ./.erb/configs/webpack.config.renderer.dev.dll.ts",
|
|
||||||
"lint": "cross-env NODE_ENV=development eslint . --ext .js,.jsx,.ts,.tsx",
|
|
||||||
"package": "ts-node ./.erb/scripts/clean.js dist && npm run build && electron-builder build --publish never",
|
|
||||||
"rebuild": "electron-rebuild --parallel --types prod,dev,optional --module-dir release/app",
|
|
||||||
"start": "ts-node ./.erb/scripts/check-port-in-use.js && npm run start:renderer",
|
|
||||||
"start:main": "cross-env NODE_ENV=development electronmon -r ts-node/register/transpile-only .",
|
|
||||||
"start:preload": "cross-env NODE_ENV=development TS_NODE_TRANSPILE_ONLY=true webpack --config ./.erb/configs/webpack.config.preload.dev.ts",
|
|
||||||
"start:renderer": "cross-env NODE_ENV=development TS_NODE_TRANSPILE_ONLY=true webpack serve --config ./.erb/configs/webpack.config.renderer.dev.ts"
|
|
||||||
},
|
|
||||||
"browserslist": [],
|
|
||||||
"prettier": {
|
|
||||||
"singleQuote": true,
|
|
||||||
"overrides": [
|
|
||||||
{
|
|
||||||
"files": [
|
|
||||||
".prettierrc",
|
|
||||||
".eslintrc"
|
|
||||||
],
|
|
||||||
"options": {
|
|
||||||
"parser": "json"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"dependencies": {
|
|
||||||
"electron-debug": "^3.2.0",
|
|
||||||
"electron-log": "^4.4.8",
|
|
||||||
"electron-updater": "^5.3.0",
|
|
||||||
"react": "^18.2.0",
|
|
||||||
"react-dom": "^18.2.0",
|
|
||||||
"react-router-dom": "^6.8.1"
|
|
||||||
},
|
|
||||||
"devDependencies": {
|
|
||||||
"@electron/notarize": "^1.2.3",
|
|
||||||
"@electron/rebuild": "^3.2.10",
|
|
||||||
"@pmmmwh/react-refresh-webpack-plugin": "^0.5.10",
|
|
||||||
"@svgr/webpack": "^7.0.0",
|
|
||||||
"@teamsupercell/typings-for-css-modules-loader": "^2.5.2",
|
|
||||||
"@testing-library/jest-dom": "^5.16.5",
|
|
||||||
"@testing-library/react": "^14.0.0",
|
|
||||||
"@types/jest": "^29.5.1",
|
|
||||||
"@types/node": "18.16.2",
|
|
||||||
"@types/react": "^18.2.0",
|
|
||||||
"@types/react-dom": "^18.2.1",
|
|
||||||
"@types/react-test-renderer": "^18.0.0",
|
|
||||||
"@types/terser-webpack-plugin": "^5.0.4",
|
|
||||||
"@types/webpack-bundle-analyzer": "^4.6.0",
|
|
||||||
"@typescript-eslint/eslint-plugin": "^5.59.1",
|
|
||||||
"@typescript-eslint/parser": "^5.59.1",
|
|
||||||
"browserslist-config-erb": "^0.0.3",
|
|
||||||
"chalk": "^4.1.2",
|
|
||||||
"concurrently": "^7.6.0",
|
|
||||||
"core-js": "^3.27.2",
|
|
||||||
"cross-env": "^7.0.3",
|
|
||||||
"css-loader": "^6.7.3",
|
|
||||||
"css-minimizer-webpack-plugin": "^4.2.2",
|
|
||||||
"detect-port": "^1.5.1",
|
|
||||||
"electron": "^23.0.0",
|
|
||||||
"electron-builder": "^24.2.1",
|
|
||||||
"electron-devtools-installer": "^3.2.0",
|
|
||||||
"electronmon": "^2.0.2",
|
|
||||||
"eslint": "^8.33.0",
|
|
||||||
"eslint-config-airbnb-base": "^15.0.0",
|
|
||||||
"eslint-config-erb": "^4.0.6",
|
|
||||||
"eslint-import-resolver-typescript": "^3.5.3",
|
|
||||||
"eslint-import-resolver-webpack": "^0.13.2",
|
|
||||||
"eslint-plugin-compat": "^4.1.1",
|
|
||||||
"eslint-plugin-import": "^2.27.5",
|
|
||||||
"eslint-plugin-jest": "^27.2.1",
|
|
||||||
"eslint-plugin-jsx-a11y": "^6.7.1",
|
|
||||||
"eslint-plugin-promise": "^6.1.1",
|
|
||||||
"eslint-plugin-react": "^7.32.2",
|
|
||||||
"eslint-plugin-react-hooks": "^4.6.0",
|
|
||||||
"file-loader": "^6.2.0",
|
|
||||||
"html-webpack-plugin": "^5.5.0",
|
|
||||||
"identity-obj-proxy": "^3.0.0",
|
|
||||||
"jest": "^29.4.2",
|
|
||||||
"jest-environment-jsdom": "^29.4.2",
|
|
||||||
"mini-css-extract-plugin": "^2.7.2",
|
|
||||||
"prettier": "^2.8.4",
|
|
||||||
"react-refresh": "^0.14.0",
|
|
||||||
"react-test-renderer": "^18.2.0",
|
|
||||||
"rimraf": "^4.1.2",
|
|
||||||
"sass": "^1.58.0",
|
|
||||||
"sass-loader": "^13.2.0",
|
|
||||||
"style-loader": "^3.3.1",
|
|
||||||
"terser-webpack-plugin": "^5.3.6",
|
|
||||||
"ts-jest": "^29.0.5",
|
|
||||||
"ts-loader": "^9.4.2",
|
|
||||||
"ts-node": "^10.9.1",
|
|
||||||
"tsconfig-paths-webpack-plugin": "^4.0.0",
|
|
||||||
"typescript": "^4.9.5",
|
|
||||||
"url-loader": "^4.1.1",
|
|
||||||
"webpack": "^5.76.0",
|
|
||||||
"webpack-bundle-analyzer": "^4.7.0",
|
|
||||||
"webpack-cli": "^5.0.1",
|
|
||||||
"webpack-dev-server": "^4.11.1",
|
|
||||||
"webpack-merge": "^5.8.0",
|
|
||||||
"scratch-blocks": "^0.1.0"
|
|
||||||
},
|
|
||||||
"build": {
|
|
||||||
"productName": "PyBlocksGUI",
|
|
||||||
"appId": "dev.coredoes.pyblocksgui",
|
|
||||||
"asar": true,
|
|
||||||
"asarUnpack": "**\\*.{node,dll}",
|
|
||||||
"files": [
|
|
||||||
"dist",
|
|
||||||
"node_modules",
|
|
||||||
"package.json"
|
|
||||||
],
|
|
||||||
"afterSign": ".erb/scripts/notarize.js",
|
|
||||||
"mac": {
|
|
||||||
"target": {
|
|
||||||
"target": "default",
|
|
||||||
"arch": [
|
|
||||||
"arm64",
|
|
||||||
"x64"
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"type": "distribution",
|
|
||||||
"hardenedRuntime": true,
|
|
||||||
"entitlements": "assets/entitlements.mac.plist",
|
|
||||||
"entitlementsInherit": "assets/entitlements.mac.plist",
|
|
||||||
"gatekeeperAssess": false
|
|
||||||
},
|
|
||||||
"dmg": {
|
|
||||||
"contents": [
|
|
||||||
{
|
|
||||||
"x": 130,
|
|
||||||
"y": 220
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"x": 410,
|
|
||||||
"y": 220,
|
|
||||||
"type": "link",
|
|
||||||
"path": "/Applications"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"win": {
|
|
||||||
"target": [
|
|
||||||
"nsis"
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"linux": {
|
|
||||||
"target": [
|
|
||||||
"AppImage"
|
|
||||||
],
|
|
||||||
"category": "Development"
|
|
||||||
},
|
|
||||||
"directories": {
|
|
||||||
"app": "release/app",
|
|
||||||
"buildResources": "assets",
|
|
||||||
"output": "release/build"
|
|
||||||
},
|
|
||||||
"extraResources": [
|
|
||||||
"./assets/**"
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"devEngines": {
|
|
||||||
"node": ">=14.x",
|
|
||||||
"npm": ">=7.x"
|
|
||||||
},
|
|
||||||
"electronmon": {
|
|
||||||
"patterns": [
|
|
||||||
"!**/**",
|
|
||||||
"src/main/**"
|
|
||||||
],
|
|
||||||
"logLevel": "quiet"
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,14 +0,0 @@
|
||||||
{
|
|
||||||
"name": "pyblocksgui",
|
|
||||||
"version": "1.0.0",
|
|
||||||
"lockfileVersion": 2,
|
|
||||||
"requires": true,
|
|
||||||
"packages": {
|
|
||||||
"": {
|
|
||||||
"name": "pyblocksgui",
|
|
||||||
"version": "1.0.0",
|
|
||||||
"hasInstallScript": true,
|
|
||||||
"license": "GPL-3.0-or-later"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,18 +0,0 @@
|
||||||
{
|
|
||||||
"name": "pyblocksgui",
|
|
||||||
"version": "1.0.0",
|
|
||||||
"description": "A GUI for programming with pyblocks",
|
|
||||||
"license": "GPL-3.0-or-later",
|
|
||||||
"author": {
|
|
||||||
"name": "c0repwn3r",
|
|
||||||
"email": "core@coredoes.dev",
|
|
||||||
"url": "https://git.e3t.cc/~core/pyblocks"
|
|
||||||
},
|
|
||||||
"main": "./dist/main/main.js",
|
|
||||||
"scripts": {
|
|
||||||
"rebuild": "node -r ts-node/register ../../.erb/scripts/electron-rebuild.js",
|
|
||||||
"postinstall": "npm run rebuild && npm run link-modules",
|
|
||||||
"link-modules": "node -r ts-node/register ../../.erb/scripts/link-modules.ts"
|
|
||||||
},
|
|
||||||
"dependencies": {}
|
|
||||||
}
|
|
|
@ -1,4 +0,0 @@
|
||||||
# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
|
|
||||||
# yarn lockfile v1
|
|
||||||
|
|
||||||
|
|
|
@ -1,137 +0,0 @@
|
||||||
/* eslint global-require: off, no-console: off, promise/always-return: off */
|
|
||||||
|
|
||||||
/**
|
|
||||||
* This module executes inside of electron's main process. You can start
|
|
||||||
* electron renderer process from here and communicate with the other processes
|
|
||||||
* through IPC.
|
|
||||||
*
|
|
||||||
* When running `npm run build` or `npm run build:main`, this file is compiled to
|
|
||||||
* `./src/main.js` using webpack. This gives us some performance wins.
|
|
||||||
*/
|
|
||||||
import path from 'path';
|
|
||||||
import { app, BrowserWindow, shell, ipcMain } from 'electron';
|
|
||||||
import { autoUpdater } from 'electron-updater';
|
|
||||||
import log from 'electron-log';
|
|
||||||
import MenuBuilder from './menu';
|
|
||||||
import { resolveHtmlPath } from './util';
|
|
||||||
|
|
||||||
class AppUpdater {
|
|
||||||
constructor() {
|
|
||||||
log.transports.file.level = 'info';
|
|
||||||
autoUpdater.logger = log;
|
|
||||||
autoUpdater.checkForUpdatesAndNotify();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
let mainWindow: BrowserWindow | null = null;
|
|
||||||
|
|
||||||
ipcMain.on('ipc-example', async (event, arg) => {
|
|
||||||
const msgTemplate = (pingPong: string) => `IPC test: ${pingPong}`;
|
|
||||||
console.log(msgTemplate(arg));
|
|
||||||
event.reply('ipc-example', msgTemplate('pong'));
|
|
||||||
});
|
|
||||||
|
|
||||||
if (process.env.NODE_ENV === 'production') {
|
|
||||||
const sourceMapSupport = require('source-map-support');
|
|
||||||
sourceMapSupport.install();
|
|
||||||
}
|
|
||||||
|
|
||||||
const isDebug =
|
|
||||||
process.env.NODE_ENV === 'development' || process.env.DEBUG_PROD === 'true';
|
|
||||||
|
|
||||||
if (isDebug) {
|
|
||||||
require('electron-debug')();
|
|
||||||
}
|
|
||||||
|
|
||||||
const installExtensions = async () => {
|
|
||||||
const installer = require('electron-devtools-installer');
|
|
||||||
const forceDownload = !!process.env.UPGRADE_EXTENSIONS;
|
|
||||||
const extensions = ['REACT_DEVELOPER_TOOLS'];
|
|
||||||
|
|
||||||
return installer
|
|
||||||
.default(
|
|
||||||
extensions.map((name) => installer[name]),
|
|
||||||
forceDownload
|
|
||||||
)
|
|
||||||
.catch(console.log);
|
|
||||||
};
|
|
||||||
|
|
||||||
const createWindow = async () => {
|
|
||||||
if (isDebug) {
|
|
||||||
await installExtensions();
|
|
||||||
}
|
|
||||||
|
|
||||||
const RESOURCES_PATH = app.isPackaged
|
|
||||||
? path.join(process.resourcesPath, 'assets')
|
|
||||||
: path.join(__dirname, '../../assets');
|
|
||||||
|
|
||||||
const getAssetPath = (...paths: string[]): string => {
|
|
||||||
return path.join(RESOURCES_PATH, ...paths);
|
|
||||||
};
|
|
||||||
|
|
||||||
mainWindow = new BrowserWindow({
|
|
||||||
show: false,
|
|
||||||
width: 1024,
|
|
||||||
height: 728,
|
|
||||||
icon: getAssetPath('icon.png'),
|
|
||||||
webPreferences: {
|
|
||||||
preload: app.isPackaged
|
|
||||||
? path.join(__dirname, 'preload.js')
|
|
||||||
: path.join(__dirname, '../../.erb/dll/preload.js'),
|
|
||||||
},
|
|
||||||
});
|
|
||||||
|
|
||||||
mainWindow.loadURL(resolveHtmlPath('index.html'));
|
|
||||||
|
|
||||||
mainWindow.on('ready-to-show', () => {
|
|
||||||
if (!mainWindow) {
|
|
||||||
throw new Error('"mainWindow" is not defined');
|
|
||||||
}
|
|
||||||
if (process.env.START_MINIMIZED) {
|
|
||||||
mainWindow.minimize();
|
|
||||||
} else {
|
|
||||||
mainWindow.show();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
mainWindow.on('closed', () => {
|
|
||||||
mainWindow = null;
|
|
||||||
});
|
|
||||||
|
|
||||||
const menuBuilder = new MenuBuilder(mainWindow);
|
|
||||||
menuBuilder.buildMenu();
|
|
||||||
|
|
||||||
// Open urls in the user's browser
|
|
||||||
mainWindow.webContents.setWindowOpenHandler((edata) => {
|
|
||||||
shell.openExternal(edata.url);
|
|
||||||
return { action: 'deny' };
|
|
||||||
});
|
|
||||||
|
|
||||||
// Remove this if your app does not use auto updates
|
|
||||||
// eslint-disable-next-line
|
|
||||||
new AppUpdater();
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Add event listeners...
|
|
||||||
*/
|
|
||||||
|
|
||||||
app.on('window-all-closed', () => {
|
|
||||||
// Respect the OSX convention of having the application in memory even
|
|
||||||
// after all windows have been closed
|
|
||||||
if (process.platform !== 'darwin') {
|
|
||||||
app.quit();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
app
|
|
||||||
.whenReady()
|
|
||||||
.then(() => {
|
|
||||||
createWindow();
|
|
||||||
app.on('activate', () => {
|
|
||||||
// On macOS it's common to re-create a window in the app when the
|
|
||||||
// dock icon is clicked and there are no other windows open.
|
|
||||||
if (mainWindow === null) createWindow();
|
|
||||||
});
|
|
||||||
})
|
|
||||||
.catch(console.log);
|
|
|
@ -1,290 +0,0 @@
|
||||||
import {
|
|
||||||
app,
|
|
||||||
Menu,
|
|
||||||
shell,
|
|
||||||
BrowserWindow,
|
|
||||||
MenuItemConstructorOptions,
|
|
||||||
} from 'electron';
|
|
||||||
|
|
||||||
interface DarwinMenuItemConstructorOptions extends MenuItemConstructorOptions {
|
|
||||||
selector?: string;
|
|
||||||
submenu?: DarwinMenuItemConstructorOptions[] | Menu;
|
|
||||||
}
|
|
||||||
|
|
||||||
export default class MenuBuilder {
|
|
||||||
mainWindow: BrowserWindow;
|
|
||||||
|
|
||||||
constructor(mainWindow: BrowserWindow) {
|
|
||||||
this.mainWindow = mainWindow;
|
|
||||||
}
|
|
||||||
|
|
||||||
buildMenu(): Menu {
|
|
||||||
if (
|
|
||||||
process.env.NODE_ENV === 'development' ||
|
|
||||||
process.env.DEBUG_PROD === 'true'
|
|
||||||
) {
|
|
||||||
this.setupDevelopmentEnvironment();
|
|
||||||
}
|
|
||||||
|
|
||||||
const template =
|
|
||||||
process.platform === 'darwin'
|
|
||||||
? this.buildDarwinTemplate()
|
|
||||||
: this.buildDefaultTemplate();
|
|
||||||
|
|
||||||
const menu = Menu.buildFromTemplate(template);
|
|
||||||
Menu.setApplicationMenu(menu);
|
|
||||||
|
|
||||||
return menu;
|
|
||||||
}
|
|
||||||
|
|
||||||
setupDevelopmentEnvironment(): void {
|
|
||||||
this.mainWindow.webContents.on('context-menu', (_, props) => {
|
|
||||||
const { x, y } = props;
|
|
||||||
|
|
||||||
Menu.buildFromTemplate([
|
|
||||||
{
|
|
||||||
label: 'Inspect element',
|
|
||||||
click: () => {
|
|
||||||
this.mainWindow.webContents.inspectElement(x, y);
|
|
||||||
},
|
|
||||||
},
|
|
||||||
]).popup({ window: this.mainWindow });
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
buildDarwinTemplate(): MenuItemConstructorOptions[] {
|
|
||||||
const subMenuAbout: DarwinMenuItemConstructorOptions = {
|
|
||||||
label: 'Electron',
|
|
||||||
submenu: [
|
|
||||||
{
|
|
||||||
label: 'About ElectronReact',
|
|
||||||
selector: 'orderFrontStandardAboutPanel:',
|
|
||||||
},
|
|
||||||
{ type: 'separator' },
|
|
||||||
{ label: 'Services', submenu: [] },
|
|
||||||
{ type: 'separator' },
|
|
||||||
{
|
|
||||||
label: 'Hide ElectronReact',
|
|
||||||
accelerator: 'Command+H',
|
|
||||||
selector: 'hide:',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: 'Hide Others',
|
|
||||||
accelerator: 'Command+Shift+H',
|
|
||||||
selector: 'hideOtherApplications:',
|
|
||||||
},
|
|
||||||
{ label: 'Show All', selector: 'unhideAllApplications:' },
|
|
||||||
{ type: 'separator' },
|
|
||||||
{
|
|
||||||
label: 'Quit',
|
|
||||||
accelerator: 'Command+Q',
|
|
||||||
click: () => {
|
|
||||||
app.quit();
|
|
||||||
},
|
|
||||||
},
|
|
||||||
],
|
|
||||||
};
|
|
||||||
const subMenuEdit: DarwinMenuItemConstructorOptions = {
|
|
||||||
label: 'Edit',
|
|
||||||
submenu: [
|
|
||||||
{ label: 'Undo', accelerator: 'Command+Z', selector: 'undo:' },
|
|
||||||
{ label: 'Redo', accelerator: 'Shift+Command+Z', selector: 'redo:' },
|
|
||||||
{ type: 'separator' },
|
|
||||||
{ label: 'Cut', accelerator: 'Command+X', selector: 'cut:' },
|
|
||||||
{ label: 'Copy', accelerator: 'Command+C', selector: 'copy:' },
|
|
||||||
{ label: 'Paste', accelerator: 'Command+V', selector: 'paste:' },
|
|
||||||
{
|
|
||||||
label: 'Select All',
|
|
||||||
accelerator: 'Command+A',
|
|
||||||
selector: 'selectAll:',
|
|
||||||
},
|
|
||||||
],
|
|
||||||
};
|
|
||||||
const subMenuViewDev: MenuItemConstructorOptions = {
|
|
||||||
label: 'View',
|
|
||||||
submenu: [
|
|
||||||
{
|
|
||||||
label: 'Reload',
|
|
||||||
accelerator: 'Command+R',
|
|
||||||
click: () => {
|
|
||||||
this.mainWindow.webContents.reload();
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: 'Toggle Full Screen',
|
|
||||||
accelerator: 'Ctrl+Command+F',
|
|
||||||
click: () => {
|
|
||||||
this.mainWindow.setFullScreen(!this.mainWindow.isFullScreen());
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: 'Toggle Developer Tools',
|
|
||||||
accelerator: 'Alt+Command+I',
|
|
||||||
click: () => {
|
|
||||||
this.mainWindow.webContents.toggleDevTools();
|
|
||||||
},
|
|
||||||
},
|
|
||||||
],
|
|
||||||
};
|
|
||||||
const subMenuViewProd: MenuItemConstructorOptions = {
|
|
||||||
label: 'View',
|
|
||||||
submenu: [
|
|
||||||
{
|
|
||||||
label: 'Toggle Full Screen',
|
|
||||||
accelerator: 'Ctrl+Command+F',
|
|
||||||
click: () => {
|
|
||||||
this.mainWindow.setFullScreen(!this.mainWindow.isFullScreen());
|
|
||||||
},
|
|
||||||
},
|
|
||||||
],
|
|
||||||
};
|
|
||||||
const subMenuWindow: DarwinMenuItemConstructorOptions = {
|
|
||||||
label: 'Window',
|
|
||||||
submenu: [
|
|
||||||
{
|
|
||||||
label: 'Minimize',
|
|
||||||
accelerator: 'Command+M',
|
|
||||||
selector: 'performMiniaturize:',
|
|
||||||
},
|
|
||||||
{ label: 'Close', accelerator: 'Command+W', selector: 'performClose:' },
|
|
||||||
{ type: 'separator' },
|
|
||||||
{ label: 'Bring All to Front', selector: 'arrangeInFront:' },
|
|
||||||
],
|
|
||||||
};
|
|
||||||
const subMenuHelp: MenuItemConstructorOptions = {
|
|
||||||
label: 'Help',
|
|
||||||
submenu: [
|
|
||||||
{
|
|
||||||
label: 'Learn More',
|
|
||||||
click() {
|
|
||||||
shell.openExternal('https://electronjs.org');
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: 'Documentation',
|
|
||||||
click() {
|
|
||||||
shell.openExternal(
|
|
||||||
'https://github.com/electron/electron/tree/main/docs#readme'
|
|
||||||
);
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: 'Community Discussions',
|
|
||||||
click() {
|
|
||||||
shell.openExternal('https://www.electronjs.org/community');
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: 'Search Issues',
|
|
||||||
click() {
|
|
||||||
shell.openExternal('https://github.com/electron/electron/issues');
|
|
||||||
},
|
|
||||||
},
|
|
||||||
],
|
|
||||||
};
|
|
||||||
|
|
||||||
const subMenuView =
|
|
||||||
process.env.NODE_ENV === 'development' ||
|
|
||||||
process.env.DEBUG_PROD === 'true'
|
|
||||||
? subMenuViewDev
|
|
||||||
: subMenuViewProd;
|
|
||||||
|
|
||||||
return [subMenuAbout, subMenuEdit, subMenuView, subMenuWindow, subMenuHelp];
|
|
||||||
}
|
|
||||||
|
|
||||||
buildDefaultTemplate() {
|
|
||||||
const templateDefault = [
|
|
||||||
{
|
|
||||||
label: '&File',
|
|
||||||
submenu: [
|
|
||||||
{
|
|
||||||
label: '&Open',
|
|
||||||
accelerator: 'Ctrl+O',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: '&Close',
|
|
||||||
accelerator: 'Ctrl+W',
|
|
||||||
click: () => {
|
|
||||||
this.mainWindow.close();
|
|
||||||
},
|
|
||||||
},
|
|
||||||
],
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: '&View',
|
|
||||||
submenu:
|
|
||||||
process.env.NODE_ENV === 'development' ||
|
|
||||||
process.env.DEBUG_PROD === 'true'
|
|
||||||
? [
|
|
||||||
{
|
|
||||||
label: '&Reload',
|
|
||||||
accelerator: 'Ctrl+R',
|
|
||||||
click: () => {
|
|
||||||
this.mainWindow.webContents.reload();
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: 'Toggle &Full Screen',
|
|
||||||
accelerator: 'F11',
|
|
||||||
click: () => {
|
|
||||||
this.mainWindow.setFullScreen(
|
|
||||||
!this.mainWindow.isFullScreen()
|
|
||||||
);
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: 'Toggle &Developer Tools',
|
|
||||||
accelerator: 'Alt+Ctrl+I',
|
|
||||||
click: () => {
|
|
||||||
this.mainWindow.webContents.toggleDevTools();
|
|
||||||
},
|
|
||||||
},
|
|
||||||
]
|
|
||||||
: [
|
|
||||||
{
|
|
||||||
label: 'Toggle &Full Screen',
|
|
||||||
accelerator: 'F11',
|
|
||||||
click: () => {
|
|
||||||
this.mainWindow.setFullScreen(
|
|
||||||
!this.mainWindow.isFullScreen()
|
|
||||||
);
|
|
||||||
},
|
|
||||||
},
|
|
||||||
],
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: 'Help',
|
|
||||||
submenu: [
|
|
||||||
{
|
|
||||||
label: 'Learn More',
|
|
||||||
click() {
|
|
||||||
shell.openExternal('https://electronjs.org');
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: 'Documentation',
|
|
||||||
click() {
|
|
||||||
shell.openExternal(
|
|
||||||
'https://github.com/electron/electron/tree/main/docs#readme'
|
|
||||||
);
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: 'Community Discussions',
|
|
||||||
click() {
|
|
||||||
shell.openExternal('https://www.electronjs.org/community');
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: 'Search Issues',
|
|
||||||
click() {
|
|
||||||
shell.openExternal('https://github.com/electron/electron/issues');
|
|
||||||
},
|
|
||||||
},
|
|
||||||
],
|
|
||||||
},
|
|
||||||
];
|
|
||||||
|
|
||||||
return templateDefault;
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,29 +0,0 @@
|
||||||
// Disable no-unused-vars, broken for spread args
|
|
||||||
/* eslint no-unused-vars: off */
|
|
||||||
import { contextBridge, ipcRenderer, IpcRendererEvent } from 'electron';
|
|
||||||
|
|
||||||
export type Channels = 'ipc-example';
|
|
||||||
|
|
||||||
const electronHandler = {
|
|
||||||
ipcRenderer: {
|
|
||||||
sendMessage(channel: Channels, ...args: unknown[]) {
|
|
||||||
ipcRenderer.send(channel, ...args);
|
|
||||||
},
|
|
||||||
on(channel: Channels, func: (...args: unknown[]) => void) {
|
|
||||||
const subscription = (_event: IpcRendererEvent, ...args: unknown[]) =>
|
|
||||||
func(...args);
|
|
||||||
ipcRenderer.on(channel, subscription);
|
|
||||||
|
|
||||||
return () => {
|
|
||||||
ipcRenderer.removeListener(channel, subscription);
|
|
||||||
};
|
|
||||||
},
|
|
||||||
once(channel: Channels, func: (...args: unknown[]) => void) {
|
|
||||||
ipcRenderer.once(channel, (_event, ...args) => func(...args));
|
|
||||||
},
|
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
||||||
contextBridge.exposeInMainWorld('electron', electronHandler);
|
|
||||||
|
|
||||||
export type ElectronHandler = typeof electronHandler;
|
|
|
@ -1,13 +0,0 @@
|
||||||
/* eslint import/prefer-default-export: off */
|
|
||||||
import { URL } from 'url';
|
|
||||||
import path from 'path';
|
|
||||||
|
|
||||||
export function resolveHtmlPath(htmlFileName: string) {
|
|
||||||
if (process.env.NODE_ENV === 'development') {
|
|
||||||
const port = process.env.PORT || 1212;
|
|
||||||
const url = new URL(`http://localhost:${port}`);
|
|
||||||
url.pathname = htmlFileName;
|
|
||||||
return url.href;
|
|
||||||
}
|
|
||||||
return `file://${path.resolve(__dirname, '../renderer/', htmlFileName)}`;
|
|
||||||
}
|
|
|
@ -1,47 +0,0 @@
|
||||||
.brick-view {
|
|
||||||
border: 1px solid black;
|
|
||||||
float: left;
|
|
||||||
width: 50%;
|
|
||||||
}
|
|
||||||
|
|
||||||
.project-view {
|
|
||||||
border: 1px solid black;
|
|
||||||
width: 50%;
|
|
||||||
}
|
|
||||||
|
|
||||||
.blocks-view {
|
|
||||||
border: 1px solid black;
|
|
||||||
width: 100%;
|
|
||||||
height: 100%;
|
|
||||||
}
|
|
||||||
|
|
||||||
.view {
|
|
||||||
margin: 5px;
|
|
||||||
padding: 5px;
|
|
||||||
border-radius: 5px;
|
|
||||||
display: inline-block;
|
|
||||||
}
|
|
||||||
|
|
||||||
.topView {
|
|
||||||
position: fixed;
|
|
||||||
top: 0;
|
|
||||||
left: 0;
|
|
||||||
width: calc(100% - 22px);
|
|
||||||
height: calc(75% - 22px);
|
|
||||||
}
|
|
||||||
|
|
||||||
.bottomView {
|
|
||||||
position: fixed;
|
|
||||||
bottom: 0;
|
|
||||||
left: 0;
|
|
||||||
width: 100%;
|
|
||||||
display: flex;
|
|
||||||
height: 25%;
|
|
||||||
}
|
|
||||||
|
|
||||||
.appContainer {
|
|
||||||
width: 100%;
|
|
||||||
height: 100%;
|
|
||||||
margin: 0;
|
|
||||||
padding: 0;
|
|
||||||
}
|
|
|
@ -1,34 +0,0 @@
|
||||||
import { MemoryRouter as Router, Routes, Route } from 'react-router-dom';
|
|
||||||
import icon from '../../assets/icon.svg';
|
|
||||||
import './App.css';
|
|
||||||
import React from "react";
|
|
||||||
import { BrickView } from './BrickView';
|
|
||||||
import {ProjectView} from "./ProjectView";
|
|
||||||
|
|
||||||
function AppView() {
|
|
||||||
return (
|
|
||||||
<div className="appContainer">
|
|
||||||
<div className="topView">
|
|
||||||
<div className="blocks-view view" id="blocks-view"></div>
|
|
||||||
</div>
|
|
||||||
<div className="bottomView">
|
|
||||||
<div className="project-view view" id="project-view">
|
|
||||||
<ProjectView />
|
|
||||||
</div>
|
|
||||||
<div className="brick-view view" id="brick-view">
|
|
||||||
<BrickView />
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
export default function App() {
|
|
||||||
return (
|
|
||||||
<Router>
|
|
||||||
<Routes>
|
|
||||||
<Route path="/" element={<AppView />} />
|
|
||||||
</Routes>
|
|
||||||
</Router>
|
|
||||||
);
|
|
||||||
}
|
|
|
@ -1,9 +0,0 @@
|
||||||
.size-full {
|
|
||||||
width: 100%;
|
|
||||||
height: 100%;
|
|
||||||
}
|
|
||||||
|
|
||||||
.bc-button {
|
|
||||||
display: inline-block;
|
|
||||||
margin: 2px;
|
|
||||||
}
|
|
|
@ -1,17 +0,0 @@
|
||||||
import './BrickView.css';
|
|
||||||
|
|
||||||
export function BrickView() {
|
|
||||||
return (
|
|
||||||
<div className="size-full">
|
|
||||||
<h3>Brick Manager</h3>
|
|
||||||
<p>Connected to R2-Yak2 via USB! (PyBricks primehub-3.2.0b5, PyBlocks loader <b>not installed</b>, no project loaded)</p>
|
|
||||||
|
|
||||||
<div className="buttonContainer">
|
|
||||||
<button className="bc-button">Connect using Bluetooth</button>
|
|
||||||
<button className="bc-button">Connect via USB</button>
|
|
||||||
<button className="bc-button">Disconnect</button>
|
|
||||||
<button className="bc-button">Install PyBlocks Loader</button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
)
|
|
||||||
}
|
|
|
@ -1,8 +0,0 @@
|
||||||
export function ProjectView() {
|
|
||||||
return (
|
|
||||||
<div>
|
|
||||||
<h1>No open project</h1>
|
|
||||||
<button>Open project (^O)</button>
|
|
||||||
</div>
|
|
||||||
)
|
|
||||||
}
|
|
|
@ -1,14 +0,0 @@
|
||||||
<!DOCTYPE html>
|
|
||||||
<html>
|
|
||||||
<head>
|
|
||||||
<meta charset="utf-8" />
|
|
||||||
<meta
|
|
||||||
http-equiv="Content-Security-Policy"
|
|
||||||
content="script-src 'self' 'unsafe-inline'"
|
|
||||||
/>
|
|
||||||
<title>Hello Electron React!</title>
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
<div id="root"></div>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
|
@ -1,13 +0,0 @@
|
||||||
import { createRoot } from 'react-dom/client';
|
|
||||||
import App from './App';
|
|
||||||
|
|
||||||
const container = document.getElementById('root') as HTMLElement;
|
|
||||||
const root = createRoot(container);
|
|
||||||
root.render(<App />);
|
|
||||||
|
|
||||||
// calling IPC exposed from preload script
|
|
||||||
window.electron.ipcRenderer.once('ipc-example', (arg) => {
|
|
||||||
// eslint-disable-next-line no-console
|
|
||||||
console.log(arg);
|
|
||||||
});
|
|
||||||
window.electron.ipcRenderer.sendMessage('ipc-example', ['ping']);
|
|
|
@ -1,10 +0,0 @@
|
||||||
import { ElectronHandler } from 'main/preload';
|
|
||||||
|
|
||||||
declare global {
|
|
||||||
// eslint-disable-next-line no-unused-vars
|
|
||||||
interface Window {
|
|
||||||
electron: ElectronHandler;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
export {};
|
|
|
@ -1,19 +0,0 @@
|
||||||
{
|
|
||||||
"compilerOptions": {
|
|
||||||
"incremental": true,
|
|
||||||
"target": "es2021",
|
|
||||||
"module": "commonjs",
|
|
||||||
"lib": ["dom", "es2021"],
|
|
||||||
"jsx": "react-jsx",
|
|
||||||
"strict": true,
|
|
||||||
"sourceMap": true,
|
|
||||||
"baseUrl": "./src",
|
|
||||||
"moduleResolution": "node",
|
|
||||||
"esModuleInterop": true,
|
|
||||||
"allowSyntheticDefaultImports": true,
|
|
||||||
"resolveJsonModule": true,
|
|
||||||
"allowJs": true,
|
|
||||||
"outDir": ".erb/dll"
|
|
||||||
},
|
|
||||||
"exclude": ["test", "release/build", "release/app/dist", ".erb/dll"]
|
|
||||||
}
|
|
|
@ -1,27 +0,0 @@
|
||||||
# PyBricks Loader
|
|
||||||
# Helper program loaded onto the hub to handle multiple programs to present as much of a SPIKE interface as possible.
|
|
||||||
import content
|
|
||||||
import pybricks
|
|
||||||
|
|
||||||
LOADER_MAJOR=1
|
|
||||||
LOADER_MINOR=0
|
|
||||||
LOADER_PATCH=0
|
|
||||||
LOADER_VERSION='1.0.0'
|
|
||||||
|
|
||||||
COUNTER_TX=0
|
|
||||||
COUNTER_RX=0
|
|
||||||
|
|
||||||
def tx(cmd, data):
|
|
||||||
print(f'{COUNTER_TX}:{cmd}:{data}')
|
|
||||||
COUNTER_TX += 1
|
|
||||||
|
|
||||||
# Send message to the host machine, if present, to inform it that PyBricks Loader is present and booted.
|
|
||||||
# Example: message 0, pbl 1.0.0, on primehub, 3.2.0b5
|
|
||||||
# 0:pyblocks-loader-info:1.0.0|primehub|3.2.0b5
|
|
||||||
tx('pyblocks-loader-info', f'{LOADER_MAJOR}.{LOADER_MINOR}.{LOADER_PATCH}|{pybricks.version()[0]}|{pybricks.version()[1]}')
|
|
||||||
# Send message to the host machine, if present, to give it information about the current status of PyBlocks.
|
|
||||||
# Example: message 1, project loaded, project ID 0, project name Hello, world, 18 scripts loaded
|
|
||||||
# 1:pyblocks-project-info:True|0|Hello, world|18
|
|
||||||
# or, on first install:
|
|
||||||
# 1:pyblocks-project-info:False|None|None|0
|
|
||||||
tx('pybricks-project-info', f'{HAS_PROJECT}|{PROJECT_ID}|{PROJECT_NAME}|{SCRIPTS_LOADED}')
|
|
|
@ -1,13 +0,0 @@
|
||||||
# PyBricks Loader
|
|
||||||
# Content file
|
|
||||||
# Contains user programs, project IDs, etc, generally just the user data saved to the hub.
|
|
||||||
# This file is not human-writable, should not be edited, and is generated by pyblocks-codegen.
|
|
||||||
HAS_PROJECT = False
|
|
||||||
PROJECT_ID = None
|
|
||||||
PROJECT_NAME = None
|
|
||||||
SCRIPTS_LOADED = 0
|
|
||||||
SCRIPTS = [[None for i in range(200)]]
|
|
||||||
# SCRIPTS is either None, if no program is in that slot
|
|
||||||
# or an object:
|
|
||||||
# {'script_name':'somescripthere.pb3','codegen':'PYTHON_CODE_HERE'}
|
|
||||||
# 'codegen' is valid MP3 code to be `exec()`'d when the program is to be run.
|
|