Skip to content

Commit

Permalink
Merge pull request #58 from xbrowsersync/v1.1.13
Browse files Browse the repository at this point in the history
Merge v1.1.13 branch
  • Loading branch information
nero120 committed Apr 1, 2021
2 parents cf486a8 + 95ea7a9 commit 766f1e8
Show file tree
Hide file tree
Showing 160 changed files with 9,719 additions and 14,127 deletions.
72 changes: 72 additions & 0 deletions .eslintrc.json
@@ -0,0 +1,72 @@
{
"env": {
"browser": true,
"jest": true,
"node": true
},
"extends": [
"airbnb-typescript/base",
"plugin:prettier/recommended"
],
"globals": {
"JSX": "readonly"
},
"parserOptions": {
"ecmaVersion": 2018,
"project": "./tsconfig.eslint.json",
"sourceType": "module"
},
"plugins": [
"simple-import-sort",
"unused-imports"
],
"rules": {
"@typescript-eslint/comma-dangle": "off",
"@typescript-eslint/indent": "off",
"@typescript-eslint/lines-between-class-members": "off",
"@typescript-eslint/no-unused-vars": "off",
"@typescript-eslint/no-use-before-define": "off",
"@typescript-eslint/semi": "warn",
"class-methods-use-this": "off",
"consistent-return": "off",
"func-style": "warn",
"global-require": "off",
"import/extensions": "off",
"import/no-dynamic-require": "off",
"import/no-extraneous-dependencies": [
"error",
{
"devDependencies": true
}
],
"import/order": "off",
"import/prefer-default-export": "off",
"no-bitwise": "off",
"no-empty": "off",
"no-nested-ternary": "off",
"no-param-reassign": "off",
"no-undef": "error",
"no-underscore-dangle": "off",
"no-unreachable": "warn",
"no-unused-vars": "warn",
"prefer-destructuring": "off",
"prettier/prettier": "warn",
"simple-import-sort/imports": [
"warn",
{
"groups": [
[
"^\\u0000",
"^@?\\w",
"^[^.]",
"^\\."
]
]
}
],
"simple-import-sort/exports": "warn",
"sort-imports": "off",
"spaced-comment": "off",
"unused-imports/no-unused-imports-ts": "warn"
}
}
20 changes: 20 additions & 0 deletions .prettierrc.json
@@ -0,0 +1,20 @@
{
"arrowParens": "always",
"bracketSpacing": true,
"endOfLine": "lf",
"overrides": [{
"files": [
"*.html"
],
"options": {
"htmlWhitespaceSensitivity": "ignore",
"jsxBracketSameLine": true
}
}],
"printWidth": 120,
"semi": true,
"singleQuote": true,
"tabWidth": 2,
"trailingComma": "es5",
"useTabs": false
}
20 changes: 20 additions & 0 deletions .stylelintrc.json
@@ -0,0 +1,20 @@
{
"extends": [
"stylelint-config-standard",
"stylelint-config-sass-guidelines",
"stylelint-prettier/recommended"
],
"rules": {
"declaration-block-no-duplicate-properties": null,
"declaration-property-value-blacklist": null,
"font-family-no-missing-generic-family-keyword": null,
"max-nesting-depth": 20,
"no-descending-specificity": null,
"scss/at-extend-no-missing-placeholder": null,
"scss/selector-no-redundant-nesting-selector": null,
"selector-max-compound-selectors": null,
"selector-max-id": null,
"selector-no-qualifying-type": null,
"selector-type-no-unknown": null
}
}
4 changes: 2 additions & 2 deletions .travis.yml
@@ -1,11 +1,11 @@
language: node_js
node_js:
- "lts/*"
- 'lts/*'
services:
- mongodb
install:
- npm install
script:
- npm run build
- npm run coverage
- npm run e2etests
- npm run test:e2e
9 changes: 9 additions & 0 deletions .vscode/extensions.json
@@ -0,0 +1,9 @@
{
"recommendations": [
"dbaeumer.vscode-eslint",
"esbenp.prettier-vscode",
"HookyQR.beautify",
"msjsdiag.debugger-for-chrome",
"stylelint.vscode-stylelint"
]
}
5 changes: 2 additions & 3 deletions .vscode/launch.json
Expand Up @@ -3,8 +3,7 @@
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"configurations": [{
"name": "Debug API",
"type": "node",
"request": "launch",
Expand Down Expand Up @@ -64,4 +63,4 @@
"smartStep": true
}
]
}
}
81 changes: 74 additions & 7 deletions .vscode/settings.json
@@ -1,14 +1,81 @@
{
"[markdown]": {
"editor.formatOnSave": false
},
"[html]": {
"editor.defaultFormatter": "HookyQR.beautify"
},
"[javascript]": {
"editor.defaultFormatter": "dbaeumer.vscode-eslint",
"editor.formatOnSave": false
},
"[json]": {
"editor.defaultFormatter": "HookyQR.beautify"
},
"[jsonc]": {
"editor.defaultFormatter": "HookyQR.beautify"
},
"[scss]": {
"editor.defaultFormatter": "esbenp.prettier-vscode",
"editor.formatOnSave": false
},
"[typescript]": {
"editor.defaultFormatter": "dbaeumer.vscode-eslint",
"editor.formatOnSave": false
},
"beautify.config": {
"end_with_newline": true,
"indent_size": 2,
"indent_with_tabs": false
},
"beautify.language": {
"js": {
"ext": [
"json"
]
},
"html": [
"html"
]
},
"css.validate": false,
"editor.codeActionsOnSave": {
"source.addMissingImports": true,
"source.fixAll": false,
"source.fixAll.eslint": true,
"source.fixAll.stylelint": true
},
"editor.detectIndentation": false,
"editor.formatOnSave": true,
"editor.insertSpaces": true,
"editor.tabSize": 2,
"eslint.alwaysShowStatus": true,
"eslint.enable": true,
"eslint.validate": [
"javascript",
"typescript"
],
"files.eol": "\n",
"git.ignoreLimitWarning": true,
"search.exclude": {
"dist": true,
"html.format.enable": false,
"html.format.endWithNewline": true,
"html.format.maxPreserveNewLines": 1,
"html.format.wrapAttributes": "aligned-multiple",
"html.format.wrapLineLength": 120,
"scss.validate": false,
"stylelint.enable": true,
"stylelint.validate": [
"css",
"html",
"markdown",
"sass",
"scss"
],
"typescript.tsdk": "./node_modules/typescript/lib",
"files.exclude": {
"**/node_modules": true
},
"terminal.integrated.shellArgs.windows": [],
"typescript.tsc.autoDetect": "off",
"typescript.tsdk": "node_modules\\typescript\\lib",
"jestTestExplorer.logpanel": true
}
"search.exclude": {
"**/dist": true
}
}
7 changes: 3 additions & 4 deletions .vscode/tasks.json
Expand Up @@ -2,11 +2,10 @@
// See https://go.microsoft.com/fwlink/?LinkId=733558
// for the documentation about the tasks.json format
"version": "2.0.0",
"tasks": [
{
"tasks": [{
"type": "npm",
"label": "build",
"script": "build",
"script": "api:build:dev",
"group": {
"kind": "build",
"isDefault": true
Expand Down Expand Up @@ -54,4 +53,4 @@
"command": "${command:workbench.action.tasks.terminate}"
}
]
}
}
7 changes: 3 additions & 4 deletions README.md
Expand Up @@ -113,6 +113,7 @@ Config Setting | Description | Default Value
`db.connTimeout` | The connection timeout period to use for MongoDB. Using a high value helps prevent dropped connections in a hosted environment. | `30000` (30 secs)
`db.host` | The MongoDB server address to connect to, either a hostname, IP address, or UNIX domain socket. | `127.0.0.1`
`db.name` | Name of the MongoDB database to use. | `xbrowsersync`
`db.ssl` | Connect to MongoDB over SSL. | `false`
`db.useSRV` | Use MongoDB's [DNS Seedlist Connection Format](https://docs.mongodb.com/manual/reference/connection-string/#dns-seedlist-connection-format) to connect to the database. If set to true, `db.host` should also be set to the relevant DNS hostname. | `false`
`db.username` | Username of the account used to access MongoDB. Set as empty string to use environment variable `XBROWSERSYNC_DB_USER`. | (Empty string, defers to environment variable)
`db.password` | Password of the account used to access MongoDB. Set as empty string to use environment variable `XBROWSERSYNC_DB_PWD`. | (Empty string, defers to environment variable)
Expand Down Expand Up @@ -158,9 +159,7 @@ If you've made code changes you can run a fresh build with the command:

## Testing

To run unit/integration tests, run the following command:

$ npm run test
The project includes unit, integration and end to end tests.

To run end to end tests, you will need to create the test database first. Run the following commands in the mongo shell:

Expand All @@ -173,7 +172,7 @@ To run end to end tests, you will need to create the test database first. Run th

You can then run the end to end tests by running the following command:

$ npm run e2etests
$ npm run test

## Upgrading from an earlier version

Expand Down
9 changes: 5 additions & 4 deletions config/settings.default.json
Expand Up @@ -6,10 +6,11 @@
"connTimeout": 30000,
"host": "127.0.0.1",
"name": "xbrowsersync",
"useSRV": false,
"username": "",
"password": "",
"port": 27017
"port": 27017,
"ssl": false,
"useSRV": false,
"username": ""
},
"location": "",
"log": {
Expand Down Expand Up @@ -51,4 +52,4 @@
"maxRequests": 1000,
"timeWindow": 300000
}
}
}
20 changes: 5 additions & 15 deletions dist/api.js
@@ -1,18 +1,8 @@
"use strict";
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
Object.defineProperty(exports, "__esModule", { value: true });
const Server = require("./server");
const server_1 = require("./server");
// Entry point into server
exports.default = (() => __awaiter(void 0, void 0, void 0, function* () {
const app = yield Server.createApplication();
yield Server.startService(app);
}))();
//# sourceMappingURL=api.js.map
exports.default = (async () => {
const app = await server_1.createApplication();
await server_1.startService(app);
})();
1 change: 0 additions & 1 deletion dist/api.js.map

This file was deleted.

23 changes: 23 additions & 0 deletions dist/common/enums.js
@@ -0,0 +1,23 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.Verb = exports.ServiceStatus = exports.LogLevel = void 0;
var LogLevel;
(function (LogLevel) {
LogLevel[LogLevel["Error"] = 0] = "Error";
LogLevel[LogLevel["Info"] = 1] = "Info";
})(LogLevel = exports.LogLevel || (exports.LogLevel = {}));
var ServiceStatus;
(function (ServiceStatus) {
ServiceStatus[ServiceStatus["online"] = 1] = "online";
ServiceStatus[ServiceStatus["offline"] = 2] = "offline";
ServiceStatus[ServiceStatus["noNewSyncs"] = 3] = "noNewSyncs";
})(ServiceStatus = exports.ServiceStatus || (exports.ServiceStatus = {}));
var Verb;
(function (Verb) {
Verb["delete"] = "delete";
Verb["get"] = "get";
Verb["options"] = "options";
Verb["patch"] = "patch";
Verb["post"] = "post";
Verb["put"] = "put";
})(Verb = exports.Verb || (exports.Verb = {}));

0 comments on commit 766f1e8

Please sign in to comment.