Skip to content

Commit

Permalink
style: ran prettier
Browse files Browse the repository at this point in the history
Signed-off-by: blu3beri <berend@animo.id>
  • Loading branch information
berendsliedrecht committed Nov 21, 2022
1 parent 484a7dd commit ac9ef39
Showing 14 changed files with 81 additions and 93 deletions.
2 changes: 2 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
{
"semi": false,
"printWidth": 120,
"trailingComma": "es5"
}
15 changes: 3 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
@@ -96,20 +96,11 @@ await PermissionsAndroid.requestMultiple([

```typescript
React.useEffect(() => {
const onDiscoverPeripheralListener = bleDidcommSdkEmitter.addListener(
"onDiscoverPeripheral",
console.log
)
const onDiscoverPeripheralListener = bleDidcommSdkEmitter.addListener("onDiscoverPeripheral", console.log)

const onConnectedPeripheralListener = bleDidcommSdkEmitter.addListener(
"onConnectedPeripheral",
console.log
)
const onConnectedPeripheralListener = bleDidcommSdkEmitter.addListener("onConnectedPeripheral", console.log)

const onReceivedNotificationListener = bleDidcommSdkEmitter.addListener(
"onReceivedNotification",
console.log
)
const onReceivedNotificationListener = bleDidcommSdkEmitter.addListener("onReceivedNotification", console.log)

const onReceivedWriteWithoutResponseListener = bleDidcommSdkEmitter.addListener(
"onReceivedWriteWithoutResponse",
2 changes: 1 addition & 1 deletion example/app.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"name": "example",
"displayName": "example"
}
}
14 changes: 7 additions & 7 deletions example/babel.config.js
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
const path = require('path');
const pak = require('../package.json');
const path = require("path")
const pak = require("../package.json")

module.exports = {
presets: ['module:metro-react-native-babel-preset'],
presets: ["module:metro-react-native-babel-preset"],
plugins: [
[
'module-resolver',
"module-resolver",
{
extensions: ['.tsx', '.ts', '.js', '.json'],
extensions: [".tsx", ".ts", ".js", ".json"],
alias: {
[pak.name]: path.join(__dirname, '..', pak.source),
[pak.name]: path.join(__dirname, "..", pak.source),
},
},
],
],
};
}
8 changes: 4 additions & 4 deletions example/index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import {AppRegistry} from 'react-native';
import App from './src/App';
import {name as appName} from './app.json';
import { AppRegistry } from "react-native"
import App from "./src/App"
import { name as appName } from "./app.json"

AppRegistry.registerComponent(appName, () => App);
AppRegistry.registerComponent(appName, () => App)
Original file line number Diff line number Diff line change
@@ -1,53 +1,53 @@
{
"images" : [
"images": [
{
"idiom" : "iphone",
"scale" : "2x",
"size" : "20x20"
"idiom": "iphone",
"scale": "2x",
"size": "20x20"
},
{
"idiom" : "iphone",
"scale" : "3x",
"size" : "20x20"
"idiom": "iphone",
"scale": "3x",
"size": "20x20"
},
{
"idiom" : "iphone",
"scale" : "2x",
"size" : "29x29"
"idiom": "iphone",
"scale": "2x",
"size": "29x29"
},
{
"idiom" : "iphone",
"scale" : "3x",
"size" : "29x29"
"idiom": "iphone",
"scale": "3x",
"size": "29x29"
},
{
"idiom" : "iphone",
"scale" : "2x",
"size" : "40x40"
"idiom": "iphone",
"scale": "2x",
"size": "40x40"
},
{
"idiom" : "iphone",
"scale" : "3x",
"size" : "40x40"
"idiom": "iphone",
"scale": "3x",
"size": "40x40"
},
{
"idiom" : "iphone",
"scale" : "2x",
"size" : "60x60"
"idiom": "iphone",
"scale": "2x",
"size": "60x60"
},
{
"idiom" : "iphone",
"scale" : "3x",
"size" : "60x60"
"idiom": "iphone",
"scale": "3x",
"size": "60x60"
},
{
"idiom" : "ios-marketing",
"scale" : "1x",
"size" : "1024x1024"
"idiom": "ios-marketing",
"scale": "1x",
"size": "1024x1024"
}
],
"info" : {
"author" : "xcode",
"version" : 1
"info": {
"author": "xcode",
"version": 1
}
}
6 changes: 3 additions & 3 deletions example/ios/example/Images.xcassets/Contents.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"info" : {
"version" : 1,
"author" : "xcode"
"info": {
"version": 1,
"author": "xcode"
}
}
24 changes: 10 additions & 14 deletions example/metro.config.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
const path = require('path');
const escape = require('escape-string-regexp');
const exclusionList = require('metro-config/src/defaults/exclusionList');
const pak = require('../package.json');
const path = require("path")
const escape = require("escape-string-regexp")
const exclusionList = require("metro-config/src/defaults/exclusionList")
const pak = require("../package.json")

const root = path.resolve(__dirname, '..');
const root = path.resolve(__dirname, "..")

const modules = Object.keys({
...pak.peerDependencies,
});
})

module.exports = {
projectRoot: __dirname,
@@ -16,15 +16,11 @@ module.exports = {
// We need to make sure that only one version is loaded for peerDependencies
// So we block them at the root, and alias them to the versions in example's node_modules
resolver: {
blacklistRE: exclusionList(
modules.map(
m => new RegExp(`^${escape(path.join(root, 'node_modules', m))}\\/.*$`),
),
),
blacklistRE: exclusionList(modules.map((m) => new RegExp(`^${escape(path.join(root, "node_modules", m))}\\/.*$`))),

extraNodeModules: modules.reduce((acc, name) => {
acc[name] = path.join(__dirname, 'node_modules', name);
return acc;
acc[name] = path.join(__dirname, "node_modules", name)
return acc
}, {}),
},

@@ -36,4 +32,4 @@ module.exports = {
},
}),
},
};
}
8 changes: 4 additions & 4 deletions example/react-native.config.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
const path = require('path');
const path = require("path")

module.exports = {
dependencies: {
'react-native-ble-didcomm': {
root: path.join(__dirname, '..'),
"react-native-ble-didcomm": {
root: path.join(__dirname, ".."),
},
},
};
}
13 changes: 11 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -4,9 +4,18 @@
"description": "test",
"main": "build/index",
"source": "src/index",
"files": ["src", "android", "ios", "*.podspec"],
"files": [
"src",
"android",
"ios",
"*.podspec"
],
"scripts": {
"example": "yarn --cwd example"
"example": "yarn --cwd example",
"check-types": "tsc -p tsconfig.json --noEmit",
"check-format": "yarn prettier --list-different",
"prettier": "prettier --ignore-path .gitignore '**/*.+(js|json|ts|md|yml|yaml)'",
"format": "yarn prettier --write"
},
"repository": "https://github.com/animo/react-native-ble-didcomm-sdk",
"author": "Animo <development@animo.id> (https://github.com/animo)",
3 changes: 1 addition & 2 deletions src/constants.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
export const DEFAULT_DIDCOMM_SERVICE_UUID = "d2f195b6-2e80-4ab0-be24-32ebe761352f"
export const DEFAULT_DIDCOMM_INDICATE_CHARACTERISTIC_UUID = "e6e97879-780a-4c9b-b4e6-dcae3793a3e8"
export const DEFAULT_DIDCOMM_MESSAGE_CHARACTERISTIC_UUID =
"c3103ded-afd7-477c-b279-2ad264e20e74"
export const DEFAULT_DIDCOMM_MESSAGE_CHARACTERISTIC_UUID = "c3103ded-afd7-477c-b279-2ad264e20e74"
12 changes: 2 additions & 10 deletions src/register.ts
Original file line number Diff line number Diff line change
@@ -18,16 +18,8 @@ const BleDidcommSdk = NativeModules.BleDidcommSdk
)

type Sdk = {
startPeripheral(
serviceUUID: string,
characteristicUUID: string,
notifyCharacteristicUUID: string
): Promise<void>
startCentral(
serviceUUID: string,
characteristicUUID: string,
notifyCharacteristicUUID: string
): Promise<void>
startPeripheral(serviceUUID: string, characteristicUUID: string, notifyCharacteristicUUID: string): Promise<void>
startCentral(serviceUUID: string, characteristicUUID: string, notifyCharacteristicUUID: string): Promise<void>
shutdownCentral({}: Record<never, never>): Promise<void>
shutdownPeripheral({}: Record<never, never>): Promise<void>
scan({}: Record<never, never>): Promise<void>
4 changes: 2 additions & 2 deletions src/utils.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Buffer } from 'buffer'
import { Buffer } from "buffer"

export const stringToBytes = (s: string) => Uint8Array.from(Buffer.from(s))

export const bytesToString = (b: Uint8Array) => Buffer.from(b).toString('utf-8')
export const bytesToString = (b: Uint8Array) => Buffer.from(b).toString("utf-8")
1 change: 0 additions & 1 deletion tsconfig.build.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

{
"extends": "./tsconfig",
"exclude": ["example"]

0 comments on commit ac9ef39

Please sign in to comment.