Skip to content
This repository has been archived by the owner on Feb 8, 2024. It is now read-only.

Commit

Permalink
Rename 'build' and 'html' to 'scripts' and 'gui'
Browse files Browse the repository at this point in the history
  • Loading branch information
maakbaas committed Nov 12, 2020
1 parent f391b5a commit 9d36648
Show file tree
Hide file tree
Showing 21 changed files with 48 additions and 48 deletions.
2 changes: 1 addition & 1 deletion docs/config-manager.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ On the low level then the full block will be rewritten. The reason for this impl

## Code Generation

The configuration data is defined in the JSON file `html/js/configuration.json`.
The configuration data is defined in the JSON file `gui/js/configuration.json`.

However, if you use the framework as a PlatformIO library, you need to define the filename that points to your configuration JSON file. This can be done in your `platformio.ini` file by adding a custom build flag:

Expand Down
4 changes: 2 additions & 2 deletions docs/getting-started.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,12 +47,12 @@ void loop()

## Editing the Web Interface

The web interface is contained in the `HTML` folder, and is developed using React and Webpack. To modify the provided interface you need to be familiar with these tools and have [NPM](https://www.npmjs.com/get-npm) installed. Of course you can also start your own GUI completely from scratch. To get started:
The web interface is contained in the `gui` folder, and is developed using React and Webpack. To modify the provided interface you need to be familiar with these tools and have [NPM](https://www.npmjs.com/get-npm) installed. Of course you can also start your own GUI completely from scratch. To get started:

1. Install NPM from the link above
2. Go to the command line in your project folder, and run the command `npm ci` to install all required JS packages for the web GUI. In case you use the framework through lib_deps the command should be run from the ESP8266 IoT Framework folder that is located within you .pio folder instead of the project root folder.

To start manually developing the web interface, you can run `npm run dev` to start a Webpack Dev Server. The API urls will be adjusted automatically when developing off the device. To get this working you will need to edit the IP address at the top of `html/js/index.js`.
To start manually developing the web interface, you can run `npm run dev` to start a Webpack Dev Server. The API urls will be adjusted automatically when developing off the device. To get this working you will need to edit the IP address at the top of `gui/js/index.js`.

```javascript
if (process.env.NODE_ENV === 'production')
Expand Down
2 changes: 1 addition & 1 deletion docs/installation-guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ The build flags are optional, since all default generated artefacts are already

**-DREBUILD_HTML:** This pre-build step will re-generate the web interface to `html.h` by simply calling `npm run build`. This is only needed if you make modifications to the GUI. Read more details [here](https://github.com/maakbaas/esp8266-iot-framework/blob/master/docs/getting-started.md#editing-the-web-interface).

**-DREBUILD_CONFIG:** Enabled by default. This build step generates the `config.c` and `config.h` files for the configuration manager based on `html/js/configuration.js` as described in more detail [here](https://github.com/maakbaas/esp8266-iot-framework/blob/master/docs/config-manager.md).
**-DREBUILD_CONFIG:** Enabled by default. This build step generates the `config.c` and `config.h` files for the configuration manager based on `gui/js/configuration.js` as described in more detail [here](https://github.com/maakbaas/esp8266-iot-framework/blob/master/docs/config-manager.md).

**-DREBUILD_CERTS:** This build step generates `certificates.h` containing a full root certificate store to enable arbitrary HTTPS requests with the ESP8266. More info on this process can be found [here](https://github.com/maakbaas/esp8266-iot-framework/blob/master/docs/fetch.md).

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion library.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
}
],
"build": {
"extraScript": "build/preBuild.py",
"extraScript": "scripts/preBuild.py",
"libArchive": false
},
"examples": [
Expand Down
2 changes: 1 addition & 1 deletion platformio.ini
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ lib_deps = ESP Async WebServer, ArduinoJson
#the HTML page using webpack
#the config objects
#the certificate store
extra_scripts = build/preBuild.py
extra_scripts = scripts/preBuild.py

#available build flags:
#-DREBUILD_HTML forces a rebuild of the html.h, this is only needed if you make modifications to the GUI
Expand Down
2 changes: 1 addition & 1 deletion build/preBuild.py → scripts/preBuild.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
elif item == "REBUILD_CERTS":
certs = True
elif isinstance(item, tuple) and item[0] == "CONFIG_PATH":
copyfile(env.get("PROJECT_DIR") + '/' + item[1], '../html/js/configuration.json')
copyfile(env.get("PROJECT_DIR") + '/' + item[1], '../gui/js/configuration.json')
elif isinstance(item, tuple) and item[0] == "DOMAIN_LIST":
domains = item[1]

Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion build/preBuildConfig.py → scripts/preBuildConfig.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ def preBuildConfigFun():
h = open(dir_path + "/../src/generated/" + filename + ".h", "w", encoding="utf8")
cpp = open(dir_path + "/../src/generated/" + filename + ".cpp", "w", encoding="utf8")

with open(dir_path + '/../html/js/configuration.json') as f:
with open(dir_path + '/../gui/js/configuration.json') as f:
data = json.load(f)

# binascii.crc32(mes.encode('utf8'))
Expand Down
File renamed without changes.
76 changes: 38 additions & 38 deletions src/generated/html.h

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ module.exports = (env, argv) => ({

context: path.resolve(__dirname),

entry: "./html/js/index.js",
entry: "./gui/js/index.js",

output: {
filename: "bundle.js",
Expand Down Expand Up @@ -80,7 +80,7 @@ module.exports = (env, argv) => ({
plugins: [
new MiniCssExtractPlugin(),
new HtmlWebPackPlugin({
template: "./html/index.html",
template: "./gui/index.html",
filename: "./index.html",
inlineSource: ".(js|css)$", // embed all javascript and css inline
}),
Expand Down

0 comments on commit 9d36648

Please sign in to comment.