Skip to content

Commit 08a904b

Browse files
Add github actions and fix format
Signed-off-by: Kristina Fefelova <[email protected]>
1 parent 451edcc commit 08a904b

File tree

31 files changed

+453
-350
lines changed

31 files changed

+453
-350
lines changed

.github/workflows/main.yaml

+64
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
#
2+
# Copyright © 2025 Hardcore Engineering Inc.
3+
#
4+
# Licensed under the Eclipse Public License, Version 2.0 (the "License");
5+
# you may not use this file except in compliance with the License. You may
6+
# obtain a copy of the License at https://www.eclipse.org/legal/epl-2.0
7+
#
8+
# Unless required by applicable law or agreed to in writing, software
9+
# distributed under the License is distributed on an "AS IS" BASIS,
10+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11+
#
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
#
15+
16+
name: CI
17+
18+
concurrency:
19+
group: ${{ github.workflow }}-${{ github.ref }}
20+
cancel-in-progress: true
21+
22+
on:
23+
pull_request:
24+
push:
25+
branches:
26+
- main
27+
jobs:
28+
build:
29+
runs-on: ubuntu-latest
30+
permissions:
31+
contents: read
32+
packages: read
33+
steps:
34+
- name: Checkout
35+
uses: actions/checkout@v4
36+
37+
- name: Set up bun
38+
uses: oven-sh/setup-bun@v2
39+
with:
40+
bun-version: 1.2.9
41+
42+
- name: Set up Node.js
43+
uses: actions/setup-node@v4
44+
with:
45+
node-version: 20
46+
registry-url: 'https://npm.pkg.github.com'
47+
scope: '@hcengineering'
48+
49+
- name: Prepare deps
50+
run: |
51+
echo "//npm.pkg.github.com/:_authToken=${{ secrets.GITHUB_TOKEN }}" > .npmrc
52+
53+
- name: Install dependencies
54+
run: bun install
55+
56+
- name: Build
57+
run: bun run build
58+
59+
- name: Check format
60+
run: bun run format:check
61+
62+
- name: Lint
63+
run: bun run lint
64+

package.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@
66
"build": "turbo run build",
77
"lint": "turbo run lint",
88
"format": "turbo run format",
9-
"check": "bun run format && bun run lint"
9+
"check": "bun run format && bun run lint",
10+
"format:check": "prettier --check \"**/*.ts\""
1011
},
1112
"devDependencies": {
1213
"@eslint/js": "^9.24.0",

packages/client-query/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
"build:types": "tsc --project ./tsconfig.json --emitDeclarationOnly --declarationDir ./types",
1515
"build:browser": "bun build src/index.ts --outdir dist --target browser",
1616
"lint": "eslint src/*.ts",
17-
"format": "prettier --write src/*.ts "
17+
"format": "prettier --write src/**/*.ts "
1818
},
1919
"devDependencies": {
2020
"@types/bun": "^1.1.14"

packages/cockroach/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
"build:types": "tsc --project ./tsconfig.json --emitDeclarationOnly --declarationDir ./types",
1515
"build:node": "bun build src/index.ts --target node --format cjs --outfile dist/index.js",
1616
"lint": "eslint src/*.ts",
17-
"format": "prettier --write src/*.ts "
17+
"format": "prettier --write src/**/*.ts"
1818
},
1919
"devDependencies": {
2020
"@types/bun": "^1.1.14"

packages/cockroach/src/db/base.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ import type { WorkspaceID } from '@hcengineering/communication-types'
1919
import { type Logger, type Options, type SqlClient } from '../types'
2020

2121
export class BaseDb {
22-
constructor (
22+
constructor(
2323
readonly client: SqlClient,
2424
readonly workspace: WorkspaceID,
2525
readonly logger?: Logger,

packages/cockroach/src/db/label.ts

+19-9
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
// limitations under the License.
1414
//
1515

16-
1716
import {
1817
SortingOrder,
1918
type AccountID,
@@ -22,26 +21,36 @@ import {
2221
type FindLabelsParams,
2322
type LabelID,
2423
type Label
25-
} from '@hcengineering/communication-types';
24+
} from '@hcengineering/communication-types'
2625

27-
import {BaseDb} from './base'
28-
import {type LabelDb, TableName} from "./schema.ts";
29-
import {toLabel} from './mapping.ts';
26+
import { BaseDb } from './base'
27+
import { type LabelDb, TableName } from './schema.ts'
28+
import { toLabel } from './mapping.ts'
3029

3130
export class LabelsDb extends BaseDb {
32-
async createLabel(label: LabelID, card: CardID, cardType: CardType, account: AccountID, created: Date): Promise<void> {
31+
async createLabel(
32+
label: LabelID,
33+
card: CardID,
34+
cardType: CardType,
35+
account: AccountID,
36+
created: Date
37+
): Promise<void> {
3338
const db: LabelDb = {
3439
workspace_id: this.workspace,
3540
label_id: label,
3641
card_id: card,
3742
card_type: cardType,
3843
account,
39-
created,
44+
created
4045
}
4146
const sql = `INSERT INTO ${TableName.Label} (workspace_id, label_id, card_id, card_type, account, created)
4247
VALUES ($1::uuid, $2::varchar, $3::varchar, $4::varchar, $5::uuid, $6::timestamptz)
4348
ON CONFLICT DO NOTHING`
44-
await this.execute(sql, [db.workspace_id, db.label_id, db.card_id, db.card_type, db.account, db.created], 'insert label')
49+
await this.execute(
50+
sql,
51+
[db.workspace_id, db.label_id, db.card_id, db.card_type, db.account, db.created],
52+
'insert label'
53+
)
4554
}
4655

4756
async removeLabel(label: LabelID, card: CardID, account: AccountID): Promise<void> {
@@ -90,7 +99,8 @@ export class LabelsDb extends BaseDb {
9099
}
91100

92101
const limit = params.limit != null ? `LIMIT ${params.limit}` : ''
93-
const orderBy = params.order != null ? `ORDER BY l.created ${params.order === SortingOrder.Ascending ? 'ASC' : 'DESC'}` : ''
102+
const orderBy =
103+
params.order != null ? `ORDER BY l.created ${params.order === SortingOrder.Ascending ? 'ASC' : 'DESC'}` : ''
94104

95105
const whereString = `WHERE ${where.join(' AND ')}`
96106
const sql = [select, whereString, orderBy, limit].join(' ')

packages/cockroach/src/db/mapping.ts

+12-12
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ type RawContext = ContextDb & { id: ContextID } & {
8282
notifications?: RawNotification[]
8383
}
8484

85-
export function toMessage (raw: RawMessage): Message {
85+
export function toMessage(raw: RawMessage): Message {
8686
const lastPatch = raw.patches?.[0]
8787

8888
return {
@@ -110,7 +110,7 @@ export function toMessage (raw: RawMessage): Message {
110110
}
111111
}
112112

113-
export function toReaction (raw: ReactionDb): Reaction {
113+
export function toReaction(raw: ReactionDb): Reaction {
114114
return {
115115
message: String(raw.message_id) as MessageID,
116116
reaction: raw.reaction,
@@ -119,7 +119,7 @@ export function toReaction (raw: ReactionDb): Reaction {
119119
}
120120
}
121121

122-
export function toFile (raw: FileDb): File {
122+
export function toFile(raw: FileDb): File {
123123
return {
124124
card: raw.card_id,
125125
message: String(raw.message_id) as MessageID,
@@ -132,7 +132,7 @@ export function toFile (raw: FileDb): File {
132132
}
133133
}
134134

135-
export function toMessagesGroup (raw: MessagesGroupDb): MessagesGroup {
135+
export function toMessagesGroup(raw: MessagesGroupDb): MessagesGroup {
136136
return {
137137
card: raw.card_id,
138138
blobId: raw.blob_id,
@@ -143,7 +143,7 @@ export function toMessagesGroup (raw: MessagesGroupDb): MessagesGroup {
143143
}
144144
}
145145

146-
export function toPatch (raw: PatchDb): Patch {
146+
export function toPatch(raw: PatchDb): Patch {
147147
return {
148148
type: raw.type,
149149
message: String(raw.message_id) as MessageID,
@@ -153,7 +153,7 @@ export function toPatch (raw: PatchDb): Patch {
153153
}
154154
}
155155

156-
export function toThread (raw: ThreadDb): Thread {
156+
export function toThread(raw: ThreadDb): Thread {
157157
return {
158158
card: raw.card_id,
159159
message: String(raw.message_id) as MessageID,
@@ -163,7 +163,7 @@ export function toThread (raw: ThreadDb): Thread {
163163
}
164164
}
165165

166-
export function toNotificationContext (raw: RawContext): NotificationContext {
166+
export function toNotificationContext(raw: RawContext): NotificationContext {
167167
const lastView = new Date(raw.last_view)
168168
return {
169169
id: String(raw.id) as ContextID,
@@ -177,7 +177,7 @@ export function toNotificationContext (raw: RawContext): NotificationContext {
177177
}
178178
}
179179

180-
function toNotificationRaw (
180+
function toNotificationRaw(
181181
id: ContextID,
182182
card: CardID,
183183
lastView: Date | undefined,
@@ -243,26 +243,26 @@ function toNotificationRaw (
243243
}
244244
}
245245

246-
export function toNotification (raw: RawNotification & { card_id: CardID, last_view?: Date }): Notification {
246+
export function toNotification(raw: RawNotification & { card_id: CardID; last_view?: Date }): Notification {
247247
const lastView = raw.last_view != null ? new Date(raw.last_view) : undefined
248248

249249
return toNotificationRaw(raw.context_id, raw.card_id, lastView, raw)
250250
}
251251

252-
export function toCollaborator (raw: CollaboratorDb): Collaborator {
252+
export function toCollaborator(raw: CollaboratorDb): Collaborator {
253253
return {
254254
account: raw.account,
255255
cardType: raw.card_type,
256256
card: raw.card_id
257257
}
258258
}
259259

260-
export function toLabel (raw: LabelDb): Label {
260+
export function toLabel(raw: LabelDb): Label {
261261
return {
262262
label: raw.label_id,
263263
card: raw.card_id,
264264
cardType: raw.card_type,
265265
account: raw.account,
266266
created: new Date(raw.created)
267267
}
268-
}
268+
}

0 commit comments

Comments
 (0)