Skip to content

Commit

Permalink
Implement JS part
Browse files Browse the repository at this point in the history
  • Loading branch information
akadlec committed Jun 5, 2021
1 parent b57c7b8 commit f776cb8
Show file tree
Hide file tree
Showing 27 changed files with 3,887 additions and 93 deletions.
3 changes: 3 additions & 0 deletions .browserslistrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
current node
last 2 versions and > 2%
ie > 10
36 changes: 36 additions & 0 deletions .docs/en/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ This module adds support for managing [FastyBird](https://www.fastybird.com) IoT

## Installation

### Backend

The best way to install **fastybird/accounts-module** is using [Composer](https://getcomposer.org/).

> If you don't have Composer yet, [download it](https://getcomposer.org/download/) following the instructions.
Expand Down Expand Up @@ -32,6 +34,20 @@ Module could be added to your project with composer command:
composer require fastybird/accounts-module
```

### Frontend

The best way to install **@fastybird/accounts-module** is using [Yarn](https://yarnpkg.com/):

```sh
yarn add @fastybird/accounts-module
```

or if you prefer npm:

```sh
npm install @fastybird/accounts-module
```

## Configuration

This module is dependent on other Nette extensions. All this extensions have to enabled and configured in NEON configuration file.
Expand Down Expand Up @@ -62,3 +78,23 @@ your-console-entrypoint fb:web-server:start
```

After successful start, server is listening for incoming http api request messages from clients.

## Register Vuex ORM models

This module could be registered in your Vuex ORM instance

```js
import VuexORM, { Database } from '@vuex-orm/core'
import AccountsModule from '@fastybird/accounts-module'

// Create new instance of Database
const database = new Database()

VuexORM.use(AccountsModule, { database })

export default {
plugins: [
VuexORM.install(database),
],
}
```
202 changes: 114 additions & 88 deletions .editorconfig

Large diffs are not rendered by default.

92 changes: 92 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ on:
push:
branches:
- "master"
tags:
- v*
schedule:
- cron: "0 8 * * 1" # At 08:00 on Monday

Expand Down Expand Up @@ -280,3 +282,93 @@ jobs:
run: |
wget https://github.com/php-coveralls/php-coveralls/releases/download/v2.1.0/php-coveralls.phar
php php-coveralls.phar --verbose --config tests/.coveralls.yml
publish-npmjs:
name: "Build library and publish it to NPM"
runs-on: "${{ matrix.operating-system }}"
needs: ["qa", "tests"]

strategy:
matrix:
operating-system: ["ubuntu-latest"]

if: github.event_name == 'push' && contains(github.ref, 'refs/tags/')

steps:
- name: "Checkout"
uses: "actions/checkout@v2"

- name: "Install node"
uses: "actions/setup-node@v1"
with:
node-version: "12"
registry-url: "https://registry.npmjs.org"

- name: "Extract version"
uses: "battila7/get-version-action@v2"
id: "get_version"

- name: "Install package dependencies"
run: yarn install

- name: "Set up git since we will later push to the repo"
run: |
git config --global user.name "GitHub CD bot"
git config --global user.email "code@fastybird.com"
- name: "Upgrade npm version in package.json to the tag used in the release"
run: npm version ${{ steps.get_version.outputs.version-without-v }} --allow-same-version

- name: "Build the project"
run: yarn build

- name: "Publish to NPM"
env:
NODE_AUTH_TOKEN: ${{ secrets.NPMJS_TOKEN }}
run: npm publish --access public

publish-github:
name: "Build library and publish it to Github packages"
runs-on: "${{ matrix.operating-system }}"
needs: ["publish-npmjs"]

strategy:
matrix:
operating-system: ["ubuntu-latest"]

if: github.event_name == 'push' && contains(github.ref, 'refs/tags/')

steps:
- name: "Checkout"
uses: "actions/checkout@v2"

- name: "Install node"
uses: "actions/setup-node@v1"
with:
node-version: "12"
registry-url: "https://npm.pkg.github.com"

- name: "Extract version"
uses: "battila7/get-version-action@v2"
id: "get_version"

- name: "Install package dependencies"
env:
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: yarn install

- name: "Set up git since we will later push to the repo"
run: |
git config --global user.name "GitHub CD bot"
git config --global user.email "code@fastybird.com"
- name: "Upgrade npm version in package.json to the tag used in the release"
run: npm version ${{ steps.get_version.outputs.version-without-v }} --allow-same-version

- name: "Build the project"
run: yarn build

- name: "Publish to NPM"
env:
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: npm publish --access public
7 changes: 5 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
.idea
vendor
composer.lock
/vendor
/composer.lock
/dist
/node_modules
/yarn.lock
tests/*/output
tests/tmp
17 changes: 17 additions & 0 deletions .npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
.github
build
config
node_modules
patches
public
src
tests
vendor
.editorconfig
composer.json
composer.lock
editorconfig.xml
Makefile
phpstan.neon
ruleset.xml
yarn.lock
29 changes: 26 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,15 @@
[![Latest stable](https://badgen.net/packagist/v/FastyBird/accounts-module/latest?cache=300&style=flast-square)](https://packagist.org/packages/FastyBird/accounts-module)
[![PHPStan](https://img.shields.io/badge/PHPStan-enabled-brightgreen.svg?style=flat-square)](https://github.com/phpstan/phpstan)

[![Latest stable](https://badgen.net/npm/v/@fastybird/accounts-module?cache=300&style=flast-square)](https://www.npmjs.com/package/@fastybird/accounts-module)
[![Downloads total](https://badgen.net/npm/dt/@fastybird/accounts-module?cache=300&style=flast-square)](https://www.npmjs.com/package/@fastybird/accounts-module)
![Types](https://badgen.net/npm/types/@fastybird/accounts-module?cache=300&style=flast-square)

## What is FastyBird IoT accounts module?

Accounts module is a [Nette framework](https://nette.org) extension for managing application accounts and sessions.
Accounts module is a combined [Nette framework](https://nette.org) extension and [Vex ORM](https://vuex-orm.org) plugin for managing application accounts and sessions.

[FastyBird](https://www.fastybird.com) [IoT](https://en.wikipedia.org/wiki/Internet_of_things) accounts module is an [Apache2 licensed](http://www.apache.org/licenses/LICENSE-2.0) distributed extension, developed in [PHP](https://www.php.net) with [Nette framework](https://nette.org).
[FastyBird](https://www.fastybird.com) [IoT](https://en.wikipedia.org/wiki/Internet_of_things) accounts module is an [Apache2 licensed](http://www.apache.org/licenses/LICENSE-2.0) distributed extension, developed in [PHP](https://www.php.net) with [Nette framework](https://nette.org) and in [Typescript](https://www.typescriptlang.org).

### Features:

Expand All @@ -21,19 +25,38 @@ Accounts module is a [Nette framework](https://nette.org) extension for managing
- [{JSON:API}](https://jsonapi.org/) schemas for full api access
- User access check & validation
- Multilingual
- JS integration via [Vex ORM](https://vuex-orm.org) plugin

## Requirements

[FastyBird](https://www.fastybird.com) accounts module is tested against PHP 7.4 and [ReactPHP http](https://github.com/reactphp/http) 0.8 event-driven, streaming plaintext HTTP server and [Nette framework](https://nette.org/en/) 3.0 PHP framework for real programmers
Backend part of [FastyBird](https://www.fastybird.com) accounts module is tested against PHP 7.4 and [ReactPHP http](https://github.com/reactphp/http) 0.8 event-driven, streaming plaintext HTTP server and [Nette framework](https://nette.org/en/) 3.0 PHP framework for real programmers

Frontend part of [FastyBird](https://www.fastybird.com) accounts module is tested against [ECMAScript 6](https://www.w3schools.com/JS/js_es6.asp)

## Installation

#### Backend

The best way to install **fastybird/accounts-module** is using [Composer](http://getcomposer.org/):

```sh
composer require fastybird/accounts-module
```

#### Frontend

The best way to install **@fastybird/accounts-module** is using [Yarn](https://yarnpkg.com/):

```sh
yarn add @fastybird/accounts-module
```

or if you prefer npm:

```sh
npm install @fastybird/accounts-module
```

## Documentation

Learn how to use accounts module and manage your accounts in [documentation](https://github.com/FastyBird/accounts-module/blob/master/.docs/en/index.md).
Expand Down
5 changes: 5 additions & 0 deletions babel.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
const devPresets = ['@vue/babel-preset-app'];
const buildPresets = ['@babel/preset-env', '@babel/preset-typescript'];
module.exports = {
presets: (process.env.NODE_ENV === 'development' ? devPresets : buildPresets),
};

0 comments on commit f776cb8

Please sign in to comment.