From 89ff22c4413992322ce63acd3643474660bd27e1 Mon Sep 17 00:00:00 2001 From: Michael Taylor Date: Thu, 27 Jan 2022 12:43:09 -0500 Subject: [PATCH] feat: setup for binary output --- .babelrc.js => .babelrc.cjs | 0 .gitignore | 1 + README.md | 15 ++- babel.config.json | 15 +++ jsconfig.json | 8 ++ package-lock.json | 116 +++++++++--------- package.json | 7 +- src/models/database.js | 6 +- .../organizations/organizations.mock.js | 2 +- src/models/projects/projects.model.js | 2 +- src/models/simulator/simulator.mock.js | 2 +- src/models/staging/staging.model.js | 2 +- src/models/units/units.model.js | 2 +- src/server.js | 2 + 14 files changed, 109 insertions(+), 71 deletions(-) rename .babelrc.js => .babelrc.cjs (100%) create mode 100644 babel.config.json create mode 100644 jsconfig.json diff --git a/.babelrc.js b/.babelrc.cjs similarity index 100% rename from .babelrc.js rename to .babelrc.cjs diff --git a/.gitignore b/.gitignore index 52d32deb..811a201b 100644 --- a/.gitignore +++ b/.gitignore @@ -13,6 +13,7 @@ testMirror.sqlite3 # production /build +/dist # misc .DS_Store diff --git a/README.md b/README.md index 2cb496e0..923c7655 100644 --- a/README.md +++ b/README.md @@ -11,10 +11,7 @@ git clone git@github.com:Chia-Network/climate-warehouse.git cd climate-warehouse nvm install 16.0.0 nvm use 16.0.0 -npm install -g husky -npm install -g prettier -npm install -g lint-staged -npm install -g cross-env +npm install -g @babel/cli husky prettier lint-staged cross-env npm set-script prepare "husky install" npm run prepare @@ -25,6 +22,16 @@ chmod ug+x .git/hooks/* npm run start ``` +### Build Binaries + +``` +// transcompile project to es5 +npm run build + +// Output binaries to dist folder +npm run output-binary +``` + ### Prerequisites You'll need: diff --git a/babel.config.json b/babel.config.json new file mode 100644 index 00000000..96d00860 --- /dev/null +++ b/babel.config.json @@ -0,0 +1,15 @@ +{ + "presets": [ + [ + "@babel/preset-env", + { + "targets": { + "esmodules": true + }, + "modules": false, + "useBuiltIns": "usage", + "corejs": "3.6.5" + } + ] + ] +} diff --git a/jsconfig.json b/jsconfig.json new file mode 100644 index 00000000..3c938ac7 --- /dev/null +++ b/jsconfig.json @@ -0,0 +1,8 @@ +{ + "compilerOptions": { + "module": "commonjs", + "target": "es6", + "baseUrl": "." + }, + "exclude": ["node_modules"] +} diff --git a/package-lock.json b/package-lock.json index f9e1b5a1..7ea14e01 100644 --- a/package-lock.json +++ b/package-lock.json @@ -21,6 +21,7 @@ "mysql2": "^2.3.3", "node-xlsx": "^0.21.0", "random-hash": "^4.0.1", + "regenerator-runtime": "^0.13.9", "request-promise": "^4.2.6", "rxjs": "^7.5.1", "sequelize": "^6.12.0-alpha.1", @@ -30,10 +31,13 @@ "sqlite3": "4.1.1", "uuidv4": "^6.2.12" }, + "bin": { + "climate-warehouse": "build/server.js" + }, "devDependencies": { - "@babel/cli": "^7.16.0", - "@babel/core": "^7.16.0", - "@babel/preset-env": "^7.16.4", + "@babel/cli": "^7.16.8", + "@babel/core": "^7.16.12", + "@babel/preset-env": "^7.16.11", "@commitlint/cli": "^14.1.0", "@commitlint/config-conventional": "^14.1.0", "babel-eslint": "^10.1.0", @@ -108,20 +112,20 @@ } }, "node_modules/@babel/core": { - "version": "7.16.7", - "resolved": "https://registry.npmjs.org/@babel/core/-/core-7.16.7.tgz", - "integrity": "sha512-aeLaqcqThRNZYmbMqtulsetOQZ/5gbR/dWruUCJcpas4Qoyy+QeagfDsPdMrqwsPRDNxJvBlRiZxxX7THO7qtA==", + "version": "7.16.12", + "resolved": "https://registry.npmjs.org/@babel/core/-/core-7.16.12.tgz", + "integrity": "sha512-dK5PtG1uiN2ikk++5OzSYsitZKny4wOCD0nrO4TqnW4BVBTQ2NGS3NgilvT/TEyxTST7LNyWV/T4tXDoD3fOgg==", "dev": true, "dependencies": { "@babel/code-frame": "^7.16.7", - "@babel/generator": "^7.16.7", + "@babel/generator": "^7.16.8", "@babel/helper-compilation-targets": "^7.16.7", "@babel/helper-module-transforms": "^7.16.7", "@babel/helpers": "^7.16.7", - "@babel/parser": "^7.16.7", + "@babel/parser": "^7.16.12", "@babel/template": "^7.16.7", - "@babel/traverse": "^7.16.7", - "@babel/types": "^7.16.7", + "@babel/traverse": "^7.16.10", + "@babel/types": "^7.16.8", "convert-source-map": "^1.7.0", "debug": "^4.1.0", "gensync": "^1.0.0-beta.2", @@ -236,9 +240,9 @@ } }, "node_modules/@babel/helper-create-class-features-plugin": { - "version": "7.16.7", - "resolved": "https://registry.npmjs.org/@babel/helper-create-class-features-plugin/-/helper-create-class-features-plugin-7.16.7.tgz", - "integrity": "sha512-kIFozAvVfK05DM4EVQYKK+zteWvY85BFdGBRQBytRyY3y+6PX0DkDOn/CZ3lEuczCfrCxEzwt0YtP/87YPTWSw==", + "version": "7.16.10", + "resolved": "https://registry.npmjs.org/@babel/helper-create-class-features-plugin/-/helper-create-class-features-plugin-7.16.10.tgz", + "integrity": "sha512-wDeej0pu3WN/ffTxMNCPW5UCiOav8IcLRxSIyp/9+IF2xJUM9h/OYjg0IJLHaL6F8oU8kqMz9nc1vryXhMsgXg==", "dev": true, "dependencies": { "@babel/helper-annotate-as-pure": "^7.16.7", @@ -577,9 +581,9 @@ } }, "node_modules/@babel/parser": { - "version": "7.16.8", - "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.16.8.tgz", - "integrity": "sha512-i7jDUfrVBWc+7OKcBzEe5n7fbv3i2fWtxKzzCvOjnzSxMfWMigAhtfJ7qzZNGFNMsCCd67+uz553dYKWXPvCKw==", + "version": "7.16.12", + "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.16.12.tgz", + "integrity": "sha512-VfaV15po8RiZssrkPweyvbGVSe4x2y+aciFCgn0n0/SJMR22cwofRV1mtnJQYcSB1wUTaA/X1LnA3es66MCO5A==", "dev": true, "bin": { "parser": "bin/babel-parser.js" @@ -819,12 +823,12 @@ } }, "node_modules/@babel/plugin-proposal-private-methods": { - "version": "7.16.7", - "resolved": "https://registry.npmjs.org/@babel/plugin-proposal-private-methods/-/plugin-proposal-private-methods-7.16.7.tgz", - "integrity": "sha512-7twV3pzhrRxSwHeIvFE6coPgvo+exNDOiGUMg39o2LiLo1Y+4aKpfkcLGcg1UHonzorCt7SNXnoMyCnnIOA8Sw==", + "version": "7.16.11", + "resolved": "https://registry.npmjs.org/@babel/plugin-proposal-private-methods/-/plugin-proposal-private-methods-7.16.11.tgz", + "integrity": "sha512-F/2uAkPlXDr8+BHpZvo19w3hLFKge+k75XUprE6jaqKxjGkSYcK+4c+bup5PdW/7W/Rpjwql7FTVEDW+fRAQsw==", "dev": true, "dependencies": { - "@babel/helper-create-class-features-plugin": "^7.16.7", + "@babel/helper-create-class-features-plugin": "^7.16.10", "@babel/helper-plugin-utils": "^7.16.7" }, "engines": { @@ -1591,9 +1595,9 @@ } }, "node_modules/@babel/preset-env": { - "version": "7.16.8", - "resolved": "https://registry.npmjs.org/@babel/preset-env/-/preset-env-7.16.8.tgz", - "integrity": "sha512-9rNKgVCdwHb3z1IlbMyft6yIXIeP3xz6vWvGaLHrJThuEIqWfHb0DNBH9VuTgnDfdbUDhkmkvMZS/YMCtP7Elg==", + "version": "7.16.11", + "resolved": "https://registry.npmjs.org/@babel/preset-env/-/preset-env-7.16.11.tgz", + "integrity": "sha512-qcmWG8R7ZW6WBRPZK//y+E3Cli151B20W1Rv7ln27vuPaXU/8TKms6jFdiJtF7UDTxcrb7mZd88tAeK9LjdT8g==", "dev": true, "dependencies": { "@babel/compat-data": "^7.16.8", @@ -1614,7 +1618,7 @@ "@babel/plugin-proposal-object-rest-spread": "^7.16.7", "@babel/plugin-proposal-optional-catch-binding": "^7.16.7", "@babel/plugin-proposal-optional-chaining": "^7.16.7", - "@babel/plugin-proposal-private-methods": "^7.16.7", + "@babel/plugin-proposal-private-methods": "^7.16.11", "@babel/plugin-proposal-private-property-in-object": "^7.16.7", "@babel/plugin-proposal-unicode-property-regex": "^7.16.7", "@babel/plugin-syntax-async-generators": "^7.8.4", @@ -1730,9 +1734,9 @@ } }, "node_modules/@babel/traverse": { - "version": "7.16.8", - "resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.16.8.tgz", - "integrity": "sha512-xe+H7JlvKsDQwXRsBhSnq1/+9c+LlQcCK3Tn/l5sbx02HYns/cn7ibp9+RV1sIUqu7hKg91NWsgHurO9dowITQ==", + "version": "7.16.10", + "resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.16.10.tgz", + "integrity": "sha512-yzuaYXoRJBGMlBhsMJoUW7G1UmSb/eXr/JHYM/MsOJgavJibLwASijW7oXBdw3NQ6T0bW7Ty5P/VarOs9cHmqw==", "dev": true, "dependencies": { "@babel/code-frame": "^7.16.7", @@ -1741,7 +1745,7 @@ "@babel/helper-function-name": "^7.16.7", "@babel/helper-hoist-variables": "^7.16.7", "@babel/helper-split-export-declaration": "^7.16.7", - "@babel/parser": "^7.16.8", + "@babel/parser": "^7.16.10", "@babel/types": "^7.16.8", "debug": "^4.1.0", "globals": "^11.1.0" @@ -13029,8 +13033,7 @@ "node_modules/regenerator-runtime": { "version": "0.13.9", "resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.13.9.tgz", - "integrity": "sha512-p3VT+cOEgxFsRRA9X4lkI1E+k2/CtnKtU4gcxyaCUreilL/vqI6CdZ3wxVUx3UOUg+gnUOQQcRI7BmSI656MYA==", - "dev": true + "integrity": "sha512-p3VT+cOEgxFsRRA9X4lkI1E+k2/CtnKtU4gcxyaCUreilL/vqI6CdZ3wxVUx3UOUg+gnUOQQcRI7BmSI656MYA==" }, "node_modules/regenerator-transform": { "version": "0.14.5", @@ -15801,20 +15804,20 @@ "dev": true }, "@babel/core": { - "version": "7.16.7", - "resolved": "https://registry.npmjs.org/@babel/core/-/core-7.16.7.tgz", - "integrity": "sha512-aeLaqcqThRNZYmbMqtulsetOQZ/5gbR/dWruUCJcpas4Qoyy+QeagfDsPdMrqwsPRDNxJvBlRiZxxX7THO7qtA==", + "version": "7.16.12", + "resolved": "https://registry.npmjs.org/@babel/core/-/core-7.16.12.tgz", + "integrity": "sha512-dK5PtG1uiN2ikk++5OzSYsitZKny4wOCD0nrO4TqnW4BVBTQ2NGS3NgilvT/TEyxTST7LNyWV/T4tXDoD3fOgg==", "dev": true, "requires": { "@babel/code-frame": "^7.16.7", - "@babel/generator": "^7.16.7", + "@babel/generator": "^7.16.8", "@babel/helper-compilation-targets": "^7.16.7", "@babel/helper-module-transforms": "^7.16.7", "@babel/helpers": "^7.16.7", - "@babel/parser": "^7.16.7", + "@babel/parser": "^7.16.12", "@babel/template": "^7.16.7", - "@babel/traverse": "^7.16.7", - "@babel/types": "^7.16.7", + "@babel/traverse": "^7.16.10", + "@babel/types": "^7.16.8", "convert-source-map": "^1.7.0", "debug": "^4.1.0", "gensync": "^1.0.0-beta.2", @@ -15897,9 +15900,9 @@ } }, "@babel/helper-create-class-features-plugin": { - "version": "7.16.7", - "resolved": "https://registry.npmjs.org/@babel/helper-create-class-features-plugin/-/helper-create-class-features-plugin-7.16.7.tgz", - "integrity": "sha512-kIFozAvVfK05DM4EVQYKK+zteWvY85BFdGBRQBytRyY3y+6PX0DkDOn/CZ3lEuczCfrCxEzwt0YtP/87YPTWSw==", + "version": "7.16.10", + "resolved": "https://registry.npmjs.org/@babel/helper-create-class-features-plugin/-/helper-create-class-features-plugin-7.16.10.tgz", + "integrity": "sha512-wDeej0pu3WN/ffTxMNCPW5UCiOav8IcLRxSIyp/9+IF2xJUM9h/OYjg0IJLHaL6F8oU8kqMz9nc1vryXhMsgXg==", "dev": true, "requires": { "@babel/helper-annotate-as-pure": "^7.16.7", @@ -16154,9 +16157,9 @@ } }, "@babel/parser": { - "version": "7.16.8", - "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.16.8.tgz", - "integrity": "sha512-i7jDUfrVBWc+7OKcBzEe5n7fbv3i2fWtxKzzCvOjnzSxMfWMigAhtfJ7qzZNGFNMsCCd67+uz553dYKWXPvCKw==", + "version": "7.16.12", + "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.16.12.tgz", + "integrity": "sha512-VfaV15po8RiZssrkPweyvbGVSe4x2y+aciFCgn0n0/SJMR22cwofRV1mtnJQYcSB1wUTaA/X1LnA3es66MCO5A==", "dev": true }, "@babel/plugin-bugfix-safari-id-destructuring-collision-in-function-expression": { @@ -16306,12 +16309,12 @@ } }, "@babel/plugin-proposal-private-methods": { - "version": "7.16.7", - "resolved": "https://registry.npmjs.org/@babel/plugin-proposal-private-methods/-/plugin-proposal-private-methods-7.16.7.tgz", - "integrity": "sha512-7twV3pzhrRxSwHeIvFE6coPgvo+exNDOiGUMg39o2LiLo1Y+4aKpfkcLGcg1UHonzorCt7SNXnoMyCnnIOA8Sw==", + "version": "7.16.11", + "resolved": "https://registry.npmjs.org/@babel/plugin-proposal-private-methods/-/plugin-proposal-private-methods-7.16.11.tgz", + "integrity": "sha512-F/2uAkPlXDr8+BHpZvo19w3hLFKge+k75XUprE6jaqKxjGkSYcK+4c+bup5PdW/7W/Rpjwql7FTVEDW+fRAQsw==", "dev": true, "requires": { - "@babel/helper-create-class-features-plugin": "^7.16.7", + "@babel/helper-create-class-features-plugin": "^7.16.10", "@babel/helper-plugin-utils": "^7.16.7" } }, @@ -16805,9 +16808,9 @@ } }, "@babel/preset-env": { - "version": "7.16.8", - "resolved": "https://registry.npmjs.org/@babel/preset-env/-/preset-env-7.16.8.tgz", - "integrity": "sha512-9rNKgVCdwHb3z1IlbMyft6yIXIeP3xz6vWvGaLHrJThuEIqWfHb0DNBH9VuTgnDfdbUDhkmkvMZS/YMCtP7Elg==", + "version": "7.16.11", + "resolved": "https://registry.npmjs.org/@babel/preset-env/-/preset-env-7.16.11.tgz", + "integrity": "sha512-qcmWG8R7ZW6WBRPZK//y+E3Cli151B20W1Rv7ln27vuPaXU/8TKms6jFdiJtF7UDTxcrb7mZd88tAeK9LjdT8g==", "dev": true, "requires": { "@babel/compat-data": "^7.16.8", @@ -16828,7 +16831,7 @@ "@babel/plugin-proposal-object-rest-spread": "^7.16.7", "@babel/plugin-proposal-optional-catch-binding": "^7.16.7", "@babel/plugin-proposal-optional-chaining": "^7.16.7", - "@babel/plugin-proposal-private-methods": "^7.16.7", + "@babel/plugin-proposal-private-methods": "^7.16.11", "@babel/plugin-proposal-private-property-in-object": "^7.16.7", "@babel/plugin-proposal-unicode-property-regex": "^7.16.7", "@babel/plugin-syntax-async-generators": "^7.8.4", @@ -16928,9 +16931,9 @@ } }, "@babel/traverse": { - "version": "7.16.8", - "resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.16.8.tgz", - "integrity": "sha512-xe+H7JlvKsDQwXRsBhSnq1/+9c+LlQcCK3Tn/l5sbx02HYns/cn7ibp9+RV1sIUqu7hKg91NWsgHurO9dowITQ==", + "version": "7.16.10", + "resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.16.10.tgz", + "integrity": "sha512-yzuaYXoRJBGMlBhsMJoUW7G1UmSb/eXr/JHYM/MsOJgavJibLwASijW7oXBdw3NQ6T0bW7Ty5P/VarOs9cHmqw==", "dev": true, "requires": { "@babel/code-frame": "^7.16.7", @@ -16939,7 +16942,7 @@ "@babel/helper-function-name": "^7.16.7", "@babel/helper-hoist-variables": "^7.16.7", "@babel/helper-split-export-declaration": "^7.16.7", - "@babel/parser": "^7.16.8", + "@babel/parser": "^7.16.10", "@babel/types": "^7.16.8", "debug": "^4.1.0", "globals": "^11.1.0" @@ -25547,8 +25550,7 @@ "regenerator-runtime": { "version": "0.13.9", "resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.13.9.tgz", - "integrity": "sha512-p3VT+cOEgxFsRRA9X4lkI1E+k2/CtnKtU4gcxyaCUreilL/vqI6CdZ3wxVUx3UOUg+gnUOQQcRI7BmSI656MYA==", - "dev": true + "integrity": "sha512-p3VT+cOEgxFsRRA9X4lkI1E+k2/CtnKtU4gcxyaCUreilL/vqI6CdZ3wxVUx3UOUg+gnUOQQcRI7BmSI656MYA==" }, "regenerator-transform": { "version": "0.14.5", diff --git a/package.json b/package.json index 8d3a4d0a..3689d2ea 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "climate-warehouse", "version": "0.0.5", "private": true, - "type": "module", + "bin": "build/server.js", "engines": { "node": ">=16.0.0" }, @@ -16,7 +16,9 @@ "cleandb": "rm -f ./data.sqlite3 && && npx sequelize-cli db:migrate --env local", "resetTestDb": "rm -f ./test.sqlite3 && npx sequelize-cli db:migrate --env test && npx sequelize-cli db:seed:all --debug --env test && rm -f ./testMirror.sqlite3 && npx sequelize-cli db:migrate --env mirrorTest", "resetMirrorDb": "npx sequelize-cli db:drop --env mirror && npx sequelize-cli db:create --env mirror && npx sequelize-cli db:migrate --env mirror --debug", - "prepare": "husky install" + "prepare": "husky install", + "build": "babel src --keep-file-extension --out-dir build --copy-files", + "output-binary": "pkg package.json --out-path dist" }, "dependencies": { "body-parser": "^1.19.0", @@ -32,6 +34,7 @@ "mysql2": "^2.3.3", "node-xlsx": "^0.21.0", "random-hash": "^4.0.1", + "regenerator-runtime": "^0.13.9", "request-promise": "^4.2.6", "rxjs": "^7.5.1", "sequelize": "^6.12.0-alpha.1", diff --git a/src/models/database.js b/src/models/database.js index 70fc4d73..c11d46ec 100644 --- a/src/models/database.js +++ b/src/models/database.js @@ -4,7 +4,7 @@ import dotenv from 'dotenv'; dotenv.config(); // possible values: local, test -export const sequelize = new Sequelize(config[process.env.NODE_ENV]); +export const sequelize = new Sequelize(config[process.env.NODE_ENV || 'local']); const mirrorConfig = process.env.NODE_ENV === 'local' ? 'mirror' : 'mirrorTest'; export const sequelizeMirror = new Sequelize(config[mirrorConfig]); @@ -21,8 +21,8 @@ export const safeMirrorDbHandler = (callback) => { }; export const sanitizeSqliteFtsQuery = (query) => { - query = query.replace(/[-](?=.*[-])/g, "+"); // Replace all but the final dash + query = query.replace(/[-](?=.*[-])/g, '+'); // Replace all but the final dash query = query.replace('-', ''); //Replace the final dash with nothing query += '*'; // Query should end with asterisk for partial matching return query; -} \ No newline at end of file +}; diff --git a/src/models/organizations/organizations.mock.js b/src/models/organizations/organizations.mock.js index 134af917..fbff4564 100644 --- a/src/models/organizations/organizations.mock.js +++ b/src/models/organizations/organizations.mock.js @@ -1,6 +1,6 @@ import stub from './organizations.stub.json'; -export const CoBenefitsMock = { +export const OrganizationMock = { findAll: () => stub, findOne: (id) => { return stub.find((record) => record.id == id); diff --git a/src/models/projects/projects.model.js b/src/models/projects/projects.model.js index 23d47f4e..6ea11e72 100644 --- a/src/models/projects/projects.model.js +++ b/src/models/projects/projects.model.js @@ -2,7 +2,7 @@ import _ from 'lodash'; import Sequelize from 'sequelize'; -import rxjs from 'rxjs'; +import * as rxjs from 'rxjs'; const { Model } = Sequelize; import { diff --git a/src/models/simulator/simulator.mock.js b/src/models/simulator/simulator.mock.js index fe199fcb..ee10f672 100644 --- a/src/models/simulator/simulator.mock.js +++ b/src/models/simulator/simulator.mock.js @@ -1,6 +1,6 @@ import stub from './simulator.stub.json'; -export const MetaMock = { +export const SimulatorMock = { findAll: () => stub, findOne: (id) => { return stub.find((record) => record.id == id); diff --git a/src/models/staging/staging.model.js b/src/models/staging/staging.model.js index b969db1b..5021212d 100644 --- a/src/models/staging/staging.model.js +++ b/src/models/staging/staging.model.js @@ -5,7 +5,7 @@ import Sequelize from 'sequelize'; const { Model } = Sequelize; import { Project, Unit, Organization } from '../../models'; -import rxjs from 'rxjs'; +import * as rxjs from 'rxjs'; import { sequelize } from '../database'; import { pushDataLayerChangeList } from '../../fullnode'; diff --git a/src/models/units/units.model.js b/src/models/units/units.model.js index 77bdedf9..682ae7ca 100644 --- a/src/models/units/units.model.js +++ b/src/models/units/units.model.js @@ -2,7 +2,7 @@ import _ from 'lodash'; import Sequelize from 'sequelize'; -import rxjs from 'rxjs'; +import * as rxjs from 'rxjs'; import { sequelize, safeMirrorDbHandler, diff --git a/src/server.js b/src/server.js index 4a515352..30299b9d 100644 --- a/src/server.js +++ b/src/server.js @@ -1,5 +1,7 @@ #!/usr/bin/env node +import 'regenerator-runtime/runtime.js'; + import rootRouter from './routes'; import http from 'http'; import { Server } from 'socket.io';