Skip to content

Commit

Permalink
add docs to gh pages fix lint
Browse files Browse the repository at this point in the history
  • Loading branch information
brianignacio5 committed Aug 2, 2023
1 parent b4be40b commit 6e671e0
Show file tree
Hide file tree
Showing 8 changed files with 169 additions and 44 deletions.
4 changes: 3 additions & 1 deletion .github/workflows/pages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,14 @@ jobs:
- name: Install Node modules
run: |
npm install
- name: Build project
- name: Build example project and copy docs
run: |
npm run build
npm run genDocs
cd examples/typescript
npm install
npm run build
cp -r ../../docs dist
- name: Setup Pages
uses: actions/configure-pages@v2
- name: Upload artifact
Expand Down
3 changes: 3 additions & 0 deletions examples/typescript/src/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@ <h1 align="center"><p><img src="../assets/esp-logo.png" width="42" height="42" s
<h4 align="center">A Serial Flasher utility for Espressif chips</h4>
<div id="safariErr" style="display:none"><p align="center" style="color:red">This tool is not supported on Safari browser!</p>
</div>
<div align="center">
<a class="btn btn-info" href="./docs/index.html">View the API Documentation</a>
</div>
<div class="container" id="main">
<hr/>
<div id="program">
Expand Down
40 changes: 33 additions & 7 deletions examples/typescript/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,16 @@ eraseButton.style.display = "none";
consoleStopButton.style.display = "none";
filesDiv.style.display = "none";

/**
* The built in Event object.
* @external Event
* @see {@link https://developer.mozilla.org/en-US/docs/Web/API/Event}
*/

/**
* File reader handler to read given local file.
* @param {Event} evt File Select event
*/
function handleFileSelect(evt) {
const file = evt.target.files[0];

Expand Down Expand Up @@ -78,7 +88,7 @@ connectButton.onclick = async () => {
} as LoaderOptions;
esploader = new ESPLoader(flashOptions);

chip = await esploader.main_fn();
chip = await esploader.main();

// Temporarily broken
// await esploader.flash_id();
Expand Down Expand Up @@ -113,7 +123,7 @@ resetButton.onclick = async () => {
eraseButton.onclick = async () => {
eraseButton.disabled = true;
try {
await esploader.erase_flash();
await esploader.eraseFlash();
} catch (e) {
console.error(e);

Check warning on line 128 in examples/typescript/src/index.ts

View workflow job for this annotation

GitHub Actions / ci

Unexpected console statement
term.writeln(`Error: ${e.message}`);
Expand Down Expand Up @@ -166,12 +176,24 @@ addFileButton.onclick = () => {
}
};

function removeRow(row) {
/**
* The built in HTMLTableRowElement object.
* @external HTMLTableRowElement
* @see {@link https://developer.mozilla.org/en-US/docs/Web/API/HTMLTableRowElement}
*/

/**
* Remove file row from HTML Table
* @param {HTMLTableRowElement} row Table row element to remove
*/
function removeRow(row: HTMLTableRowElement) {
const rowIndex = Array.from(table.rows).indexOf(row);
table.deleteRow(rowIndex);
}

// to be called on disconnect - remove any stale references of older connections if any
/**
* Clean devices variables on chip disconnect. Remove stale references if any.
*/
function cleanUp() {
device = null;
transport = null;
Expand Down Expand Up @@ -228,7 +250,11 @@ consoleStopButton.onclick = async () => {
programDiv.style.display = "initial";
};

function validate_program_inputs() {
/**
* Validate the provided files images and offset to see if they're valid.
* @returns {string} Program input validation result
*/
function validateProgramInputs() {
const offsetArr = [];
const rowCount = table.rows.length;
let row;
Expand Down Expand Up @@ -258,7 +284,7 @@ function validate_program_inputs() {

programButton.onclick = async () => {
const alertMsg = document.getElementById("alertmsg");
const err = validate_program_inputs();
const err = validateProgramInputs();

if (err != "success") {
alertMsg.innerHTML = "<strong>" + err + "</strong>";
Expand Down Expand Up @@ -301,7 +327,7 @@ programButton.onclick = async () => {
},
calculateMD5Hash: (image) => CryptoJS.MD5(CryptoJS.enc.Latin1.parse(image)),
} as FlashOptions;
await esploader.write_flash(flashOptions);
await esploader.writeFlash(flashOptions);
} catch (e) {
console.error(e);

Check warning on line 332 in examples/typescript/src/index.ts

View workflow job for this annotation

GitHub Actions / ci

Unexpected console statement
term.writeln(`Error: ${e.message}`);
Expand Down
87 changes: 87 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"build": "npm run clean && tsc && rollup --config",
"clean": "rimraf docs lib bundle.js",
"format": "prettier --write \"src/**/*.ts\"",
"genDocs": "npm run clean && typedoc",
"genDocs": "rimraf docs && typedoc",
"lint": "eslint . --ext .ts",
"lintAndFix": "eslint . --ext .ts --fix",
"prepare": "npm run build",
Expand Down Expand Up @@ -42,6 +42,7 @@
"@typescript-eslint/eslint-plugin": "^5.43.0",
"@typescript-eslint/parser": "^5.43.0",
"babel-loader": "^9.1.0",
"buffer": "^5.7.1",
"eslint": "^8.28.0",
"eslint-config-prettier": "^8.5.0",
"eslint-plugin-jsdoc": "^46.4.5",
Expand Down
Loading

0 comments on commit 6e671e0

Please sign in to comment.