Skip to content

Commit

Permalink
Add Bryan as contributor. Add lerna config and scripts. Fix unnecessa…
Browse files Browse the repository at this point in the history
…ry trailing filetype for package resolution in server.ts. Update Husky script. Clean up lint issues.
  • Loading branch information
timothy-b committed Mar 24, 2022
1 parent 7846076 commit 1b888ba
Show file tree
Hide file tree
Showing 9 changed files with 103 additions and 84 deletions.
2 changes: 1 addition & 1 deletion .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

pushd .; cd client; npm run lint; popd; pushd .; cd service; npm run lint; popd;
pushd .; cd packages/client; npm run lint; popd; pushd .; cd packages/service; npm run lint; popd;
6 changes: 6 additions & 0 deletions lerna.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"packages": [
"packages/*"
],
"version": "0.0.0"
}
43 changes: 27 additions & 16 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,18 +1,29 @@
{
"name": "iotsec",
"version": "1.0.0",
"description": "An IOT security system using a Particle Photon and a Raspberry Pi",
"repository": {
"type": "git",
"url": "https://github.com/timothy-b/IOT-SEC"
},
"keywords": [
"IOT",
"security"
],
"author": "Timothy Baumgartner",
"license": "MIT",
"devDependencies": {
"lerna": "^4.0.0"
}
"name": "iotsec",
"version": "1.0.0",
"description": "An IOT security system using a Particle Photon and a Raspberry Pi",
"repository": {
"type": "git",
"url": "https://github.com/timothy-b/IOT-SEC"
},
"keywords": [
"IOT",
"security"
],
"author": {
"name": "Timothy Baumgartner"
},
"contributors": [
{
"name": "Bryan Kenote"
}
],
"license": "MIT",
"devDependencies": {
"lerna": "^4.0.0"
},
"scripts": {
"build": "lerna run build",
"install": "lerna exec --stream -- npm install"
}
}
4 changes: 2 additions & 2 deletions packages/client/src/components/Toaster/Toaster.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { h } from 'preact';
import { useCallback, useImperativeHandle, useRef, useState } from 'preact/hooks';
import { useCallback, useImperativeHandle, useState } from 'preact/hooks';
import { forwardRef } from 'preact/compat';
import style from './style.css';

Expand All @@ -21,7 +21,7 @@ const Toaster = forwardRef<IToasterRef, IToaster>(({ defaultTimeout = 5000 }, re
{message}
</output>
);
}, []);
}, [defaultTimeout]);

useImperativeHandle(ref, () => ({
makeToast(message: string) {
Expand Down
2 changes: 2 additions & 0 deletions packages/client/src/components/authContext.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
import { createContext } from 'preact';

// eslint-disable-next-line no-spaced-func
export default createContext<{
authHeader: string;
setAuthHeader: (authentication: string) => void;
Expand Down
2 changes: 1 addition & 1 deletion packages/client/src/routes/Login/Login.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ const Login: FunctionalComponent<ILogin> = ({ onFail }) => {
return onFail?.();
}
setAuthHeader(encoded);
}, [username, password]);
}, [username, password, onFail, setAuthHeader]);

return (
<div class={style.Login}>
Expand Down
116 changes: 58 additions & 58 deletions packages/service/package.json
Original file line number Diff line number Diff line change
@@ -1,63 +1,63 @@
{
"name": "iotsec-service",
"version": "1.0.0",
"description": "An IOT security system using a Particle Photon and a Raspberry Pi",
"name": "iotsec-service",
"version": "1.0.0",
"description": "An IOT security system using a Particle Photon and a Raspberry Pi",
"type": "module",
"exports": "./dist/program.js",
"exports": "./dist/program.js",
"engines": {
"node": "^12.20.0 || ^14.13.1 || >=16.0.0"
"node": "^>=16.0.0"
},
"dependencies": {
"arpscan": "^0.6.0",
"bunyan": "^1.8.12",
"emailjs": "^3.7.0",
"express": "^4.17.1",
"lowdb": "^3.0.0",
"uuid-random": "^1.3.2"
},
"devDependencies": {
"@types/async": "^3.0.2",
"@types/bunyan": "^1.8.6",
"@types/express": "^4.17.9",
"@types/jest": "^26.0.19",
"@types/node": "^12.7.12",
"@typescript-eslint/parser": "^3.10.1",
"eslint": "^5.16.0",
"eslint-config-faithlife": "^8.1.0",
"eslint-plugin-import": "^2.22.1",
"eslint-plugin-jest": "^24.1.3",
"husky": "^4.3.6",
"jest": "^26.6.3",
"prettier": "^1.19.1",
"ts-jest": "^26.4.4",
"ts-node": "^9.1.1",
"typescript": "^3.9.7"
},
"scripts": {
"build": "./node_modules/.bin/tsc",
"watch": "./node_modules/.bin/tsc --watch",
"depcheck": "npx depcheck",
"start": "node ./dist/program.js",
"stop": "ps aux | grep node | grep iot-sec | awk '{ print $2 }' | xargs sudo kill",
"lint": "eslint ./src/**/*.ts --ignore-pattern **/dist --ignore-pattern **/node_modules",
"lint:windows": ".\\node_modules\\.bin\\eslint ./src/**/*.{js,ts} --ignore-pattern **/dist --ignore-pattern **/node_modules",
"test": "node ./node_modules/jest/bin/jest.js"
},
"eslintConfig": {
"extends": [
"faithlife/base",
"plugin:import/typescript"
],
"plugins": [
"jest"
],
"env": {
"jest/globals": true
}
},
"husky": {
"hooks": {
"pre-commit": "npm run lint"
}
}
"dependencies": {
"arpscan": "^0.6.0",
"bunyan": "^1.8.12",
"emailjs": "^3.7.0",
"express": "^4.17.1",
"lowdb": "^3.0.0",
"uuid-random": "^1.3.2"
},
"devDependencies": {
"@types/async": "^3.0.2",
"@types/bunyan": "^1.8.6",
"@types/express": "^4.17.9",
"@types/jest": "^26.0.19",
"@types/node": "^12.7.12",
"@typescript-eslint/parser": "^3.10.1",
"eslint": "^5.16.0",
"eslint-config-faithlife": "^8.1.0",
"eslint-plugin-import": "^2.22.1",
"eslint-plugin-jest": "^24.1.3",
"husky": "^4.3.6",
"jest": "^26.6.3",
"prettier": "^1.19.1",
"ts-jest": "^26.4.4",
"ts-node": "^9.1.1",
"typescript": "^3.9.7"
},
"scripts": {
"build": "./node_modules/.bin/tsc",
"watch": "./node_modules/.bin/tsc --watch",
"depcheck": "npx depcheck",
"start": "node ./dist/program.js",
"stop": "ps aux | grep node | grep iot-sec | awk '{ print $2 }' | xargs sudo kill",
"lint": "eslint ./src/**/*.ts --ignore-pattern **/dist --ignore-pattern **/node_modules",
"lint:windows": ".\\node_modules\\.bin\\eslint ./src/**/*.{js,ts} --ignore-pattern **/dist --ignore-pattern **/node_modules",
"test": "node ./node_modules/jest/bin/jest.js"
},
"eslintConfig": {
"extends": [
"faithlife/base",
"plugin:import/typescript"
],
"plugins": [
"jest"
],
"env": {
"jest/globals": true
}
},
"husky": {
"hooks": {
"pre-commit": "npm run lint"
}
}
}
6 changes: 3 additions & 3 deletions packages/service/src/program.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { createLogger } from 'bunyan';
import Config from './config.js';
import { createServer } from './utilities/server.js';
import db from './utilities/db.js';
import Config from './config';
import { createServer } from './utilities/server';
import db from './utilities/db';

function main() {
const { bunyan, ...rest } = Config;
Expand Down
6 changes: 3 additions & 3 deletions packages/service/src/utilities/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ import express, { Application, Express, NextFunction, Response } from 'express';
import uuid from 'uuid-random';
import { CustomRequest } from '../types/CustomRequest';
import { IConfig } from '../types/IConfig';
import { createAlerter } from './alerter.js';
import { isAuthenticated } from './basicAuth.js';
import { delayAsync } from './delay.js';
import { createAlerter } from './alerter';
import { isAuthenticated } from './basicAuth';
import { delayAsync } from './delay';
import {
SimpleLeakyBucket,
SimpleLeakyBucketEventKinds,
Expand Down

0 comments on commit 1b888ba

Please sign in to comment.