Skip to content

Commit

Permalink
Switch to using typescript
Browse files Browse the repository at this point in the history
  • Loading branch information
Cyclonecode committed Nov 14, 2021
1 parent 24c108f commit 952ac35
Show file tree
Hide file tree
Showing 18 changed files with 4,570 additions and 575 deletions.
15 changes: 15 additions & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"root": true,
"parser": "@typescript-eslint/parser",
"plugins": [
"@typescript-eslint"
],
"extends": [
"eslint:recommended",
"plugin:@typescript-eslint/eslint-recommended",
"plugin:@typescript-eslint/recommended"
],
"rules": {
"@typescript-eslint/no-explicit-any": 0
}
}
297 changes: 0 additions & 297 deletions .eslintrc.js

This file was deleted.

2 changes: 1 addition & 1 deletion .prettierrc
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"singleQuote": true,
"trailingComma": "all"
"trailingComma": "es5"
}
14 changes: 11 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ Removes temporary files.
If you set the correct environment variables you can also compile and install the extension using npm:

npm run compile
npm run install
npm run setup
npm run clean

# Installation
Expand Down Expand Up @@ -109,14 +109,22 @@ will create a database called **mysql_note**, register the mysql plugin and crea

# Running

For production mode you first need to build:

npm run build

Start the server with the default settings:

npm run dev

To build and run the application in production using pm2:
To run the application in production using pm2:

npm run start

To run the application using typescript:

npm run start-ts

- Notice, that the `index.html` will be created if it does not yet exists.
- Go to address **http://localhost/<install_dir>/index.html** in your browser and start receiving notifications from your database.

Expand Down Expand Up @@ -174,7 +182,7 @@ The websocket port that will be used, default is 8080.

AUTO_ACCEPT_CONNECTION=1

Auto accept any connetions, default 0.
Auto accept any connections, default 0.

ALLOWED_ORIGINS=localhost

Expand Down
3 changes: 3 additions & 0 deletions bin/test.sql
Original file line number Diff line number Diff line change
Expand Up @@ -16,18 +16,21 @@ CREATE FUNCTION MySQLNotification RETURNS INTEGER SONAME 'mysql-notification.so'

DELIMITER @@

DROP TRIGGER IF EXISTS trigger1;
CREATE TRIGGER trigger1 AFTER INSERT ON post
FOR EACH ROW
BEGIN
SELECT MySQLNotification(NEW.id, 2) INTO @x;
END@@

DROP TRIGGER IF EXISTS trigger2;
CREATE TRIGGER trigger2 AFTER UPDATE ON post
FOR EACH ROW
BEGIN
SELECT MySQLNotification(NEW.id, 3) INTO @x;
END@@

DROP TRIGGER IF EXISTS trigger3;
CREATE TRIGGER trigger3 AFTER DELETE ON post
FOR EACH ROW
BEGIN
Expand Down
1 change: 1 addition & 0 deletions mysql-plugin/src/makefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ WEBSOCKET_PORT?=8080
mysql-notification : mysql-notification.c
${CC} -c -D SERVER_PORT=${SERVER_PORT} -D SERVER_ADDRESS='${SERVER_ADDRESS}' -D WEBSOCKET_PORT=${WEBSOCKET_PORT} -Wall -fpic ${CCFLAGS} -o $@.o -I${MYSQL_INCLUDE_DIR} $?
${CC} -shared -o $@.so $@.o
chmod 0644 $@.so

install : mysql-notification.so
cp $? ${MYSQL_PLUGIN_DIR}/${TARGET_FILE}.so
Expand Down
Loading

0 comments on commit 952ac35

Please sign in to comment.