Skip to content

Commit

Permalink
refactor: Restructure under lib folder
Browse files Browse the repository at this point in the history
  • Loading branch information
AlejandroHerr committed Dec 15, 2018
1 parent 33ec1f5 commit ddc7b04
Show file tree
Hide file tree
Showing 13 changed files with 16 additions and 25 deletions.
5 changes: 0 additions & 5 deletions src/Bus/index.ts

This file was deleted.

5 changes: 0 additions & 5 deletions src/Device/index.ts

This file was deleted.

13 changes: 8 additions & 5 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
import { Bus, BusError, BusInterface } from './Bus';
import { Device, DeviceError, DeviceInterface } from './Device';
import Bus from './lib/Bus';
import BusError from './lib/BusError';
import BusInterface from './lib/BusInterface';
import createI2cBusMock from './lib/createI2cBusMock';
import Device from './lib/Device';
import DeviceError from './lib/DeviceError';
import DeviceInterface from './lib/DeviceInterface';

import createI2cBusMock from './createI2cBusMock';

export { Bus, BusError, BusInterface, Device, DeviceError, DeviceInterface, createI2cBusMock };
export { Bus, BusError, BusInterface, createI2cBusMock, Device, DeviceError, DeviceInterface };
4 changes: 2 additions & 2 deletions src/Bus/Bus.spec.ts → src/lib/Bus.spec.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { I2cBusPromised } from '../types';
import Bus from './Bus';
import BusError from './BusError';
import { I2cBusPromised } from './types';

jest.mock('i2c-bus', () => {
const createI2cBusMock = require('../createI2cBusMock').default; // eslint-disable-line global-require
const createI2cBusMock = require('./createI2cBusMock').default; // eslint-disable-line global-require

return {
open: createI2cBusMock({
Expand Down
3 changes: 1 addition & 2 deletions src/Bus/Bus.ts → src/lib/Bus.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
import { promisifyAll } from 'bluebird';
import { open as openI2cBus } from 'i2c-bus';

import { I2cBusPromised } from '../types';

import BusError from './BusError';
import BusInterface from './BusInterface';
import { I2cBusPromised } from './types';

const Bus = ({ busNumber = 1, openBus = openI2cBus } = {}): BusInterface => {
let i2cBus: I2cBusPromised | null = null;
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion src/Bus/BusInterface.ts → src/lib/BusInterface.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { I2cBusFuncs } from 'i2c-bus';

import { I2cBusPromised } from '../types';
import { I2cBusPromised } from './types';

export default interface BusInterface {
readonly busNumber: number;
Expand Down
4 changes: 2 additions & 2 deletions src/Device/Device.spec.ts → src/lib/Device.spec.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { Bus } from '../Bus';
import Bus from './Bus';
import Device from './Device';

jest.mock('i2c-bus', () => {
const createI2cBusMock = require('../createI2cBusMock').default; // eslint-disable-line global-require
const createI2cBusMock = require('./createI2cBusMock').default; // eslint-disable-line global-require

return {
open: createI2cBusMock({
Expand Down
3 changes: 1 addition & 2 deletions src/Device/Device.ts → src/lib/Device.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import BusInterface from '../Bus/BusInterface';

import BusInterface from './BusInterface';
import DeviceInterface from './DeviceInterface';

const Device = ({ address, bus }: { address: number; bus: BusInterface }): DeviceInterface => ({
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import BusInterface from '../Bus/BusInterface';
import BusInterface from './BusInterface';

export default interface DeviceInterface {
readonly address: number;
Expand Down
File renamed without changes.
File renamed without changes.

0 comments on commit ddc7b04

Please sign in to comment.