Skip to content

Commit

Permalink
[ver] 4 (#12)
Browse files Browse the repository at this point in the history
* no Mix

* no Mixins

* no Presenters

* webpack has been updated

* no lodash

* no jest

* webpack-dev-middleware has been updated

* no brace-expansion

* no jest.config.js

* no eslint-config-airbnb-base

* no babel-plugin-transform-object-rest-spread

* part of dev-deps have been updated

* dev-deps have been updated

* package.json

* no Helpers

* lib size has been reduced

* Fix

* No UI

* webpack -> output -> library = Loco

* DRY

* Revert "webpack -> output -> library = Loco"

This reverts commit f50b032.

* connector

* Initialization has been updated

* locales: ui goes to loco-js-ui

* No utils/dom

* No utils/collection

* no ArrayUtils

* no StringUtils

* Spec has been fixed

* Line, Wire and Utils are not exported anymore (unit tests fail only)

* jest + config

* test +1, spec -1 and jest config has been updated

* test +1, spec -1

* Refactoring in tests

* test +1, spec -1

* +2 tests, -2 specs

* +1 test, -1 spec

* +1 test, -1 spec

* +1 test, -1 spec

* +1 test, -1 spec

* +1 test, -1 spec

* +1 test, -1 spec

* +1 test, -1 spec

* +1 test, -1 spec

* +1 test, -1 spec

* +1 test, -1 spec

* +1 test, -1 spec

* +1 test, -1 spec

* +1 test, -1 spec

* +1 test, -1 spec

* +1 test, -1 spec

* +1 test, -1 spec

* +1 test, -1 spec

* +1 test, -1 spec

* +1 test, -1 spec

* +1 test, -1 spec

* +1 test, -1 spec

* +1 test, -1 spec

* +1 test, -1 spec

* +1 test, -1 spec

* +1 test, -1 spec

* +1 test, -1 spec

* +1 test, -3 spec

* +4 tests, -4 specs

* +3 tests, -4 specs

* +3 tests, -4 specs

* +3 tests, -3 specs

* +2 tests, -2 specs

* +10 tests, -10 specs

* +10 tests, -10 specs

* +3 specs, -3 tests

* +1 spec, -1 test

* Tests' refactoring

* +1 test, -1 spec

* +1 spec, -1 test

* +1 test, -1 spec

* fix

* test file names were fixed

* +3 tests, -3 specs

* +2 tests, -2 specs

* +1 test, -1 spec

* +1 test, -1 spec

* +2 tests, -2 specs

* +1 test, -1 spec

* date.coffee => date.js

* no services

* no gulp

* model tests were moved to loco-js-model

* no turbolinks

* @ => this.

* Extraction

* changes in loco-js-core

* Views and Controllers have been extracted

* test was moved to loco-js-core

* [feature] Change lib's name to Loco (output -> library)

* [feature] exports: Loco is out, init is in

* [internal] Don't import Base from loco-js-model directly

* [feature] change behavior of init function

* [internal] fix eslint problems

* [feature] remove unneeded locale

* [internal] better webpack config

* [feature] no Object.assign

* [feature] export emit

* [feature] NotificationCenter is a function

* [feature] notifications related to collection go to notificationCenter

* [fix] + emitting signals to model is commented out

* [internal] comments were removed

* [internal] remove unused line

* [feature] subscribe

* [feature] no Connectivity

* [internal] cleaning

* [internal] refactoring

* [internal] refactoring

* [feature] export helpers but not Views

* [internal] clean-up

* [internal] remove disableNotifications

* [feature] remove accessor methods

* [feature] remove accessor methods

* [feature] remove accessor methods

* [feature] getWire

* [internal] refactoring

* [feature] no Channels

* [internal] refactoring

* [internal] log idempotency_key

* [feature] Idempotency key

* [doc] README

* [doc] README in progress

* [doc] README in progress

* [internal] update deps

* [feature] loco-js-model v1.0

* [doc] update README (What is Loco-JS?)

* [doc] update README (But how is Loco supposed to help?)

* [doc] update README (# 🔬 Tech stack of Loco-JS
)

* [doc] update README (Origins)

* [doc] update README (Dependencies)

* [doc] update README (Installation)

* [doc] update README (Initialization)

* [doc] update README (How does it work?)

* [doc] update README (Merging classes)

* [doc] update README (+Structure -Views)

* [doc] update README (Models)

* [doc] update README (Controllers)

* [doc] update README.md (The subscribe function)

* [doc] update README (Wire)

* [feature] {type, payload} to NotificationCenter instead of {signal, payload}

* [internal][doc] cleanup

* [doc] update README (Receiving messages)

* [doc] update README (Sending messages)

* [doc] update README (i18n)

* [doc] update README (Changelog)

* [ver] 4.0

Co-authored-by: Zbigniew Humeniuk <hello@artofcode.co>
  • Loading branch information
himn1 and zbigh committed Jul 23, 2020
1 parent 414f6d3 commit bb2d79e
Show file tree
Hide file tree
Showing 101 changed files with 33,398 additions and 15,647 deletions.
10 changes: 5 additions & 5 deletions .babelrc
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"presets": [
["env", {
"modules": false
}]
"plugins": [
"@babel/plugin-proposal-class-properties"
],
"plugins": ["transform-object-rest-spread"]
"presets": [
["@babel/preset-env", {}]
]
}
17 changes: 8 additions & 9 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -1,23 +1,22 @@
{
"env": {
"browser": true,
"jest/globals": true
},

"extends": [
"eslint:recommended",
"eslint-config-airbnb-base",
"prettier"
],

"parser": "babel-eslint",

"plugins": [
"prettier",
"jest"
],

"env": {
"browser": true,
"jest/globals": true
},

"rules": {
"prettier/prettier": "error"
},

"parser": "babel-eslint"
}
}
5 changes: 5 additions & 0 deletions .lintstagedrc
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@
"eslint",
"git add"
],
"__tests__/**/*.js": [
"prettier --write",
"eslint",
"git add"
],
"src/**/*.js": [
"prettier --write",
"eslint",
Expand Down
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
9
12
847 changes: 275 additions & 572 deletions README.md

Large diffs are not rendered by default.

9 changes: 9 additions & 0 deletions __tests__/index.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import { init } from "index";
import { Config } from "deps";

describe("init", () => {
it("sets protocol with host and removes a slash at the end", () => {
init({ protocolWithHost: "https://localhost:3000/" });
expect(Config.protocolWithHost).toEqual("https://localhost:3000");
});
});
59 changes: 59 additions & 0 deletions __tests__/wire.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
import Loco from "loco.coffee";
import Wire from "wire.coffee";
import { Models } from "index";

class Article extends Models.Base {
static identity = "Article";
}

Object.assign(Models, { Article });

test("setting token correctly", () => {
const wire = new Wire();
wire.token = "123qweasdzxc";
expect(wire._requestParams()).toEqual({
synced_at: null,
token: "123qweasdzxc"
});
});

describe("#_getURL", () => {
it("returns url with choosen protocol", () => {
const wire = getWire();
wire.ssl = true;
const [protocol] = wire._getURL().split("/");
expect(protocol).toEqual("https:");
});

it("return correct notifications's location", () => {
const wire = getWire();
wire.location = "nc";
const [, , , location] = wire._getURL().split("/");
expect(location).toEqual("nc");
});
});

describe("#setPollingTime", () => {
it("can change polling time", () => {
const wire = getWire();
expect(wire.pollingTime).toEqual(3000);
const pollingInterval = wire.pollingInterval;
wire.setPollingTime(10000);
expect(wire.pollingTime).toEqual(10000);
expect(wire.pollingInterval).not.toEqual(pollingInterval);
});
});

describe("@site setter", () => {
it("can set max size of notifications", () => {
const wire = getWire();
wire.size = 10;
expect(wire.size).toEqual(10);
});
});

const getWire = () => {
const loco = new Loco({ notifications: { enable: true } });
loco.init({ cable: null });
return loco.wire;
};
16 changes: 16 additions & 0 deletions __tests__/wire/processNotification.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import Loco from "loco.coffee";
import { Models } from "index";
import processNotification from "wire/processNotification";

class Article extends Models.Base {
static identity = "Article";
}

Object.assign(Models, { Article });

it("returns if imap is empty", () => {
const loco = new Loco({ notifications: { enable: true } });
loco.init({ cable: null });
const result = processNotification(["Article", 1, "created", { id: 1 }]);
expect(result).toBe(undefined);
});
3 changes: 3 additions & 0 deletions dev/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,10 @@ const webpackDevMiddleware = require('webpack-dev-middleware');
const rootPath = '..';

const app = express();

const config = require(`${rootPath}/webpack.config.js`);
config.mode = "development";

const compiler = webpack(config);

app.use(webpackDevMiddleware(compiler, {
Expand Down

0 comments on commit bb2d79e

Please sign in to comment.