Skip to content

Commit

Permalink
chore: add prettier (#47)
Browse files Browse the repository at this point in the history
  • Loading branch information
hugomrdias authored Jun 21, 2022
1 parent c2864e6 commit 6b2e9e0
Show file tree
Hide file tree
Showing 84 changed files with 1,254 additions and 1,258 deletions.
4 changes: 1 addition & 3 deletions .github/release-please-config.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
{
"plugins": [
"node-workspace"
],
"plugins": ["node-workspace"],
"bootstrap-sha": "1f995064ec6e5953118c2dd1065ee6be959f25b9",
"packages": {
"packages/authority": {},
Expand Down
10 changes: 9 additions & 1 deletion .github/release-please-manifest.json
Original file line number Diff line number Diff line change
@@ -1 +1,9 @@
{"packages/authority":"0.4.0","packages/client":"0.3.0","packages/core":"0.4.0","packages/interface":"0.4.0","packages/server":"0.4.0","packages/transport":"0.4.0","packages/validator":"0.4.0"}
{
"packages/authority": "0.4.0",
"packages/client": "0.3.0",
"packages/core": "0.4.0",
"packages/interface": "0.4.0",
"packages/server": "0.4.0",
"packages/transport": "0.4.0",
"packages/validator": "0.4.0"
}
8 changes: 4 additions & 4 deletions .github/workflows/authority.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@ on:
branches:
- main
paths:
- "packages/interface/**"
- "packages/authority/**"
- 'packages/interface/**'
- 'packages/authority/**'
pull_request:
branches:
- main
paths:
- "packages/interface/**"
- ".github/workflows/authority.yml"
- 'packages/interface/**'
- '.github/workflows/authority.yml'
jobs:
check:
name: Typecheck
Expand Down
18 changes: 9 additions & 9 deletions .github/workflows/client.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,19 @@ on:
branches:
- main
paths:
- "packages/interface/**"
- "packages/core/**"
- "packages/transport/**"
- "packages/client/**"
- 'packages/interface/**'
- 'packages/core/**'
- 'packages/transport/**'
- 'packages/client/**'
pull_request:
branches:
- main
paths:
- "packages/interface/**"
- "packages/core/**"
- "packages/transport/**"
- "packages/client/**"
- ".github/workflows/client.yml"
- 'packages/interface/**'
- 'packages/core/**'
- 'packages/transport/**'
- 'packages/client/**'
- '.github/workflows/client.yml'
jobs:
check:
name: Typecheck
Expand Down
10 changes: 5 additions & 5 deletions .github/workflows/core.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,15 @@ on:
branches:
- main
paths:
- "packages/core/**"
- "packages/interface/**"
- 'packages/core/**'
- 'packages/interface/**'
pull_request:
branches:
- main
paths:
- "packages/core/**"
- "packages/interface/**"
- ".github/workflows/core.yml"
- 'packages/core/**'
- 'packages/interface/**'
- '.github/workflows/core.yml'
jobs:
check:
name: Typecheck
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/interface.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@ on:
branches:
- main
paths:
- "packages/interface/**"
- 'packages/interface/**'
pull_request:
branches:
- main
paths:
- "packages/interface/**"
- ".github/workflows/interface.yml"
- 'packages/interface/**'
- '.github/workflows/interface.yml'
jobs:
check:
name: Typecheck
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -97,9 +97,9 @@ jobs:
command: pr
upstream_owner: ${{ github.repository_owner }}
upstream_repo: ${{ github.event.repository.name }}
description: "release master"
title: "chore: release master"
message: "chore: release master"
description: 'release master'
title: 'chore: release master'
message: 'chore: release master'
branch: release-please/branches/main
primary: main
force: true
Expand Down
26 changes: 13 additions & 13 deletions .github/workflows/server.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,23 +6,23 @@ on:
branches:
- main
paths:
- "packages/interface/**"
- "packages/core/**"
- "packages/transport/**"
- "packages/client/**"
- "packages/validator/**"
- "packages/server/**"
- 'packages/interface/**'
- 'packages/core/**'
- 'packages/transport/**'
- 'packages/client/**'
- 'packages/validator/**'
- 'packages/server/**'
pull_request:
branches:
- main
paths:
- "packages/interface/**"
- "packages/core/**"
- "packages/transport/**"
- "packages/client/**"
- "packages/validator/**"
- "packages/server/**"
- ".github/workflows/server.yml"
- 'packages/interface/**'
- 'packages/core/**'
- 'packages/transport/**'
- 'packages/client/**'
- 'packages/validator/**'
- 'packages/server/**'
- '.github/workflows/server.yml'
jobs:
check:
name: Typecheck
Expand Down
14 changes: 7 additions & 7 deletions .github/workflows/transport.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,17 @@ on:
branches:
- main
paths:
- "packages/core/**"
- "packages/interface/**"
- "packages/transport/**"
- 'packages/core/**'
- 'packages/interface/**'
- 'packages/transport/**'
pull_request:
branches:
- main
paths:
- "packages/core/**"
- "packages/interface/**"
- "packages/transport/**"
- ".github/workflows/transport.yml"
- 'packages/core/**'
- 'packages/interface/**'
- 'packages/transport/**'
- '.github/workflows/transport.yml'
jobs:
check:
name: Typecheck
Expand Down
22 changes: 11 additions & 11 deletions .github/workflows/validator.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,21 +6,21 @@ on:
branches:
- main
paths:
- "packages/interface/**"
- "packages/core/**"
- "packages/transport/**"
- "packages/client/**"
- "packages/validator/**"
- 'packages/interface/**'
- 'packages/core/**'
- 'packages/transport/**'
- 'packages/client/**'
- 'packages/validator/**'
pull_request:
branches:
- main
paths:
- "packages/interface/**"
- "packages/core/**"
- "packages/transport/**"
- "packages/client/**"
- "packages/validator/**"
- ".github/workflows/validator.yml"
- 'packages/interface/**'
- 'packages/core/**'
- 'packages/transport/**'
- 'packages/client/**'
- 'packages/validator/**'
- '.github/workflows/validator.yml'
jobs:
check:
name: Typecheck
Expand Down
11 changes: 10 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,22 @@
"packages/validator"
],
"scripts": {
"format": "prettier --write '**/*.{js,ts,yml,json}' --ignore-path .gitignore",
"format:check": "prettier --check '**/*.{js,ts,yml,json}' --ignore-path .gitignore",
"test": "pnpm run -r test",
"test:node": "pnpm run -r test:node",
"test:web": "pnpm run -r test:web",
"typecheck": "pnpm run -r typecheck"
},
"devDependencies": {
"typescript": "4.7.3",
"mocha": "^9.2.2"
"mocha": "^9.2.2",
"prettier": "2.7.1"
},
"prettier": {
"trailingComma": "es5",
"tabWidth": 2,
"semi": false,
"singleQuote": true
}
}
18 changes: 9 additions & 9 deletions packages/authority/src/authority.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import * as DID from "@ipld/dag-ucan/src/did.js"
import * as ED25519 from "@noble/ed25519"
import { varint } from "multiformats"
import * as API from "@ucanto/interface"
import * as DID from '@ipld/dag-ucan/src/did.js'
import * as ED25519 from '@noble/ed25519'
import { varint } from 'multiformats'
import * as API from '@ucanto/interface'
export const code = 0xed

export const name = "Ed25519"
export const name = 'Ed25519'
const PUBLIC_TAG_SIZE = varint.encodingLength(code)
const SIZE = 32 + PUBLIC_TAG_SIZE

Expand All @@ -13,7 +13,7 @@ const SIZE = 32 + PUBLIC_TAG_SIZE
* @param {API.DID} did
* @returns {API.Authority<typeof code>}
*/
export const parse = did => decode(DID.parse(did))
export const parse = (did) => decode(DID.parse(did))

/**
* Takes ed25519 public key tagged with `0xed` multiformat code and creates a
Expand All @@ -22,7 +22,7 @@ export const parse = did => decode(DID.parse(did))
* @param {Uint8Array} bytes
* @returns {API.Authority<typeof code>}
*/
export const decode = bytes => {
export const decode = (bytes) => {
const [algorithm] = varint.decode(bytes)
if (algorithm !== code) {
throw new RangeError(
Expand All @@ -42,15 +42,15 @@ export const decode = bytes => {
*
* @param {API.Authority<typeof code>} authority
*/
export const format = authority => DID.format(authority.bytes)
export const format = (authority) => DID.format(authority.bytes)

/**
* Encodes given authority by tagging it's ed25519 public key with `0xed`
* multiformat code.
*
* @param {API.Authority<typeof code>} authority
*/
export const encode = authority => authority.bytes
export const encode = (authority) => authority.bytes

/**
* @implements {API.Authority<typeof code>}
Expand Down
6 changes: 3 additions & 3 deletions packages/authority/src/lib.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
export * from "./signer.js"
export * as Authority from "./authority.js"
export * as SigningAuthority from "./signer.js"
export * from './signer.js'
export * as Authority from './authority.js'
export * as SigningAuthority from './signer.js'
14 changes: 7 additions & 7 deletions packages/authority/src/signer.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import * as ED25519 from "@noble/ed25519"
import { varint } from "multiformats"
import * as API from "@ucanto/interface"
import * as Authority from "./authority.js"
import { base64pad } from "multiformats/bases/base64"
import * as ED25519 from '@noble/ed25519'
import { varint } from 'multiformats'
import * as API from '@ucanto/interface'
import * as Authority from './authority.js'
import { base64pad } from 'multiformats/bases/base64'

export const code = 0x1300
export const name = Authority.name
Expand All @@ -23,7 +23,7 @@ export const generate = () => derive(ED25519.utils.randomPrivateKey())
* @param {Uint8Array} secret
* @returns {Promise<API.SigningAuthority<typeof Authority.code>>}
*/
export const derive = async secret => {
export const derive = async (secret) => {
if (secret.byteLength !== KEY_SIZE) {
throw new Error(
`Expected Uint8Array with byteLength of ${KEY_SIZE} instead not ${secret.byteLength}`
Expand All @@ -47,7 +47,7 @@ export const derive = async secret => {
* @param {Uint8Array} bytes
* @returns {SigningAuthority}
*/
export const decode = bytes => {
export const decode = (bytes) => {
if (bytes.byteLength !== SIZE) {
throw new Error(
`Expected Uint8Array with byteLength of ${SIZE} instead not ${bytes.byteLength}`
Expand Down
Loading

0 comments on commit 6b2e9e0

Please sign in to comment.