Skip to content

Commit

Permalink
Rename components folder to packages
Browse files Browse the repository at this point in the history
  • Loading branch information
kevin-dp committed Jun 28, 2024
1 parent ab3e89a commit 71fbe60
Show file tree
Hide file tree
Showing 551 changed files with 264 additions and 252 deletions.
4 changes: 2 additions & 2 deletions .buildkite/docker-image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ steps:
command:
- git fetch --tags
- export ELECTRIC_IMAGE_NAME="${DOCKER_REPO}/${IMAGE_NAME}"
- cd ./components/electric
- cd ./packages/electric
- export ELECTRIC_VERSION=$(make --silent print_version_from_git)
- export ELECTRIC_CANARY_IMAGE="${DOCKERHUB_REPO}/${IMAGE_NAME}:canary"
- make docker-build-ci
Expand All @@ -23,6 +23,6 @@ steps:
if: build.tag =~ /@core\/electric@/
command:
- export ELECTRIC_IMAGE_NAME="${DOCKERHUB_REPO}/${IMAGE_NAME}"
- cd ./components/electric
- cd ./packages/electric
- export ELECTRIC_VERSION=$(make --silent print_version_from_git)
- make docker-build-ci-crossplatform
6 changes: 3 additions & 3 deletions .github/workflows/cli_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@ on:
pull_request:
paths:
- "pnpm-lock.yaml"
- "components/cli/**"
- "!components/cli/**.md"
- "packages/cli/**"
- "!packages/cli/**.md"

defaults:
run:
working-directory: components/cli
working-directory: packages/cli

concurrency:
group: cli-${{ github.ref }}
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/drivers_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@ on:
pull_request:
paths:
- "pnpm-lock.yaml"
- "components/drivers/**"
- "!components/drivers/**.md"
- "packages/drivers/**"
- "!packages/drivers/**.md"

defaults:
run:
working-directory: components/drivers
working-directory: packages/drivers

concurrency:
group: drivers-${{ github.ref }}
Expand Down
12 changes: 6 additions & 6 deletions .github/workflows/e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,15 +61,15 @@ jobs:

- run: |
echo "ELECTRIC_VERSION=$(make --silent print_version_from_git)" >> $GITHUB_ENV
working-directory: components/electric
working-directory: packages/electric
- run: make docker-build-ci
env:
ELECTRIC_IMAGE_NAME: electric-sql-ci/electric
working-directory: components/electric
working-directory: packages/electric
- run: make docker-build-ws-client
env:
ELECTRIC_CLIENT_IMAGE_NAME: electric-sql-ci/electric-ws-client
working-directory: components/electric
working-directory: packages/electric

- name: Cache built lux
uses: actions/cache@v4
Expand Down Expand Up @@ -152,15 +152,15 @@ jobs:

- run: |
echo "ELECTRIC_VERSION=$(make --silent print_version_from_git)" >> $GITHUB_ENV
working-directory: components/electric
working-directory: packages/electric
- run: make docker-build-ci
env:
ELECTRIC_IMAGE_NAME: electric-sql-ci/electric
working-directory: components/electric
working-directory: packages/electric
- run: make docker-build-ws-client
env:
ELECTRIC_CLIENT_IMAGE_NAME: electric-sql-ci/electric-ws-client
working-directory: components/electric
working-directory: packages/electric

- name: Cache built lux
uses: actions/cache@v4
Expand Down
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
name: Components / Electric / Tests
name: Packages / Electric / Tests

on:
push:
branches:
- main
pull_request:
paths:
- "components/electric/**"
- "!components/electric/**README.md"
- "packages/electric/**"
- "!packages/electric/**README.md"

env:
OTP_VERSION: "27.0"
ELIXIR_VERSION: "1.17.0-otp-27"

concurrency:
group: components-electric-${{ github.ref }}
group: packages-electric-${{ github.ref }}
cancel-in-progress: true

jobs:
Expand All @@ -23,7 +23,7 @@ jobs:
runs-on: ubuntu-latest
defaults:
run:
working-directory: components/electric
working-directory: packages/electric
env:
MIX_ENV: test
steps:
Expand All @@ -40,29 +40,29 @@ jobs:
- name: Restore dependencies
uses: actions/cache/restore@v4
with:
path: components/electric/deps
key: ${{ runner.os }}-mixdeps-${{ hashFiles('components/electric/**/mix.lock') }}
path: packages/electric/deps
key: ${{ runner.os }}-mixdeps-${{ hashFiles('packages/electric/**/mix.lock') }}
restore-keys: ${{ runner.os }}-mixdeps-
- name: Restore compiled code
uses: actions/cache/restore@v4
with:
path: |
components/electric/_build/*/lib
!components/electric/_build/*/lib/electric
key: ${{ runner.os }}-mixbuild-test-${{ env.OTP_VERSION }}-${{ env.ELIXIR_VERSION }}-${{ hashFiles('components/electric/**/mix.lock') }}
packages/electric/_build/*/lib
!packages/electric/_build/*/lib/electric
key: ${{ runner.os }}-mixbuild-test-${{ env.OTP_VERSION }}-${{ env.ELIXIR_VERSION }}-${{ hashFiles('packages/electric/**/mix.lock') }}
- run: mix deps.get && mix deps.compile
- name: Cache dependencies
uses: actions/cache/save@v4
with:
path: components/electric/deps
key: ${{ runner.os }}-mixdeps-${{ hashFiles('components/electric/**/mix.lock') }}
path: packages/electric/deps
key: ${{ runner.os }}-mixdeps-${{ hashFiles('packages/electric/**/mix.lock') }}
- name: Save compiled code
uses: actions/cache/save@v4
with:
path: |
components/electric/_build/*/lib
!components/electric/_build/*/lib/electric
key: ${{ runner.os }}-mixbuild-test-${{ env.OTP_VERSION }}-${{ env.ELIXIR_VERSION }}-${{ hashFiles('components/electric/**/mix.lock') }}
packages/electric/_build/*/lib
!packages/electric/_build/*/lib/electric
key: ${{ runner.os }}-mixbuild-test-${{ env.OTP_VERSION }}-${{ env.ELIXIR_VERSION }}-${{ hashFiles('packages/electric/**/mix.lock') }}

- run: mix compile --force --all-warnings --warnings-as-errors
- name: Prepare auxiliary services
Expand All @@ -74,7 +74,7 @@ jobs:
runs-on: ubuntu-latest
defaults:
run:
working-directory: components/electric
working-directory: packages/electric
steps:
- uses: actions/checkout@v4
with:
Expand All @@ -88,8 +88,8 @@ jobs:
id: cache-deps
uses: actions/cache@v4
with:
path: components/electric/deps
key: ${{ runner.os }}-mixdeps-${{ hashFiles('components/electric/**/mix.lock') }}
path: packages/electric/deps
key: ${{ runner.os }}-mixdeps-${{ hashFiles('packages/electric/**/mix.lock') }}
- run: mix deps.get
- run: make check-format

Expand All @@ -98,7 +98,7 @@ jobs:
runs-on: ubuntu-latest
defaults:
run:
working-directory: components/electric
working-directory: packages/electric
env:
MIX_ENV: dev
steps:
Expand All @@ -115,28 +115,28 @@ jobs:
id: cache-deps
uses: actions/cache@v4
with:
path: components/electric/deps
key: ${{ runner.os }}-mixdeps-${{ hashFiles('components/electric/**/mix.lock') }}
path: packages/electric/deps
key: ${{ runner.os }}-mixdeps-${{ hashFiles('packages/electric/**/mix.lock') }}
- name: Restore compiled code
uses: actions/cache/restore@v4
with:
path: |
components/electric/_build/*/lib
!components/electric/_build/*/lib/electric
key: ${{ runner.os }}-mixbuild-dev-${{ env.OTP_VERSION }}-${{ env.ELIXIR_VERSION }}-${{ hashFiles('components/electric/**/mix.lock') }}
packages/electric/_build/*/lib
!packages/electric/_build/*/lib/electric
key: ${{ runner.os }}-mixbuild-dev-${{ env.OTP_VERSION }}-${{ env.ELIXIR_VERSION }}-${{ hashFiles('packages/electric/**/mix.lock') }}
- run: mix deps.get && mix deps.compile
- name: Save compiled code
uses: actions/cache/save@v4
with:
path: |
components/electric/_build/*/lib
!components/electric/_build/*/lib/electric
key: ${{ runner.os }}-mixbuild-dev-${{ env.OTP_VERSION }}-${{ env.ELIXIR_VERSION }}-${{ hashFiles('components/electric/**/mix.lock') }}
packages/electric/_build/*/lib
!packages/electric/_build/*/lib/electric
key: ${{ runner.os }}-mixbuild-dev-${{ env.OTP_VERSION }}-${{ env.ELIXIR_VERSION }}-${{ hashFiles('packages/electric/**/mix.lock') }}
- run: mix compile --force --all-warnings --warnings-as-errors
- name: Cache PLT
uses: actions/cache/restore@v4
with:
path: components/electric/_build/*/*.plt
path: packages/electric/_build/*/*.plt
key: ${{ runner.os }}-plt-${{ env.OTP_VERSION }}-${{ env.ELIXIR_VERSION }}-${{ github.ref_name }}
restore-keys: ${{ runner.os }}-plt-${{ env.OTP_VERSION }}-${{ env.ELIXIR_VERSION }}-

Expand All @@ -147,5 +147,5 @@ jobs:
if: ${{ always() && steps.dialyzer.outcome != 'cancelled' }}
uses: actions/cache/save@v4
with:
path: components/electric/_build/*/*.plt
path: packages/electric/_build/*/*.plt
key: ${{ runner.os }}-plt-${{ env.OTP_VERSION }}-${{ env.ELIXIR_VERSION }}-${{ github.ref_name }}
4 changes: 2 additions & 2 deletions .github/workflows/toolbar_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@ on:
pull_request:
paths:
- "pnpm-lock.yaml"
- "components/toolbar/**"
- "packages/toolbar/**"

defaults:
run:
working-directory: components/toolbar
working-directory: packages/toolbar

jobs:
verify_formatting:
Expand Down
6 changes: 3 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
build_all:
make -C components/electric docker-build
make -C packages/electric docker-build

test_all:
make -C components/electric deps tests
make -C packages/electric deps tests
make -C clients/typescript deps tests
make -C generator deps tests
make -C e2e test

update_protobuf:
make -C components/electric update_protobuf
make -C packages/electric update_protobuf
make -C clients/typescript update_protobuf
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ ElectricSQL then provides a whole developer experience for you to control what d
This is the main repository for the ElectricSQL source code. Key components include:

- [clients/typescript](https://github.com/electric-sql/electric/tree/main/clients/typescript) — TypeScript client that provides SQLite driver adapters, reactivity and a type-safe data access library
- [components/electric](https://github.com/electric-sql/electric/tree/main/components/electric) — Elixir sync service that manages active-active replication between Postgres and SQLite
- [packages/electric](https://github.com/electric-sql/electric/tree/main/packages/electric) — Elixir sync service that manages active-active replication between Postgres and SQLite
- [generator](https://github.com/electric-sql/electric/tree/main/generator) — Prisma generator that creates the type safe data access library
- [protocol/satellite.proto](https://github.com/electric-sql/electric/tree/main/protocol/satellite.proto) — Protocol Buffers definition of the Satellite replication protocol

Expand Down
2 changes: 1 addition & 1 deletion clients/typescript/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ build_generator:

deps:
pnpm install --frozen-lockfile
make -C ../../components/drivers build
make -C ../../packages/drivers build
# npm install tslint tslint-config-prettier

node_modules:
Expand Down
2 changes: 1 addition & 1 deletion clients/typescript/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@
"build": "shx rm -rf dist && concurrently \"tsup\" \"tsc -p tsconfig.build.json\" && node scripts/fix-imports.js",
"test": "ava",
"test-CI": "DISABLE_DIALECT=postgres npm run test",
"generate-test-client": "npx tsx ../../components/cli/src/client/generateTestClient.ts",
"generate-test-client": "npx tsx ../../packages/cli/src/client/generateTestClient.ts",
"typecheck": "tsc -p tsconfig.json",
"posttest": "npm run typecheck",
"prepublishOnly": "pnpm run build",
Expand Down
5 changes: 4 additions & 1 deletion clients/typescript/src/client/execution/executor.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
import { DatabaseAdapter, RunResult } from '@electric-sql/drivers'
import {
DatabaseAdapter,
RunResult,
} from '@electric-sql/drivers'
import { QueryBuilder } from 'squel'
import { DB } from './db'
import { TransactionalDB } from './transactionalDB'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
import { DatabaseAdapter, RunResult } from '@electric-sql/drivers'
import {
DatabaseAdapter,
RunResult,
} from '@electric-sql/drivers'
import { QueryBuilder } from 'squel'
import { DB } from './db'
import * as z from 'zod'
Expand Down
2 changes: 1 addition & 1 deletion clients/typescript/src/electric/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { ElectricConfigWithDialect, hydrateConfig } from '../config/index'
import { DatabaseAdapter } from '@electric-sql/drivers'
import { DatabaseAdapter } from '../../../../packages/drivers/dist'
import { Migrator } from '../migrators/index'
import { EventNotifier, Notifier } from '../notifiers/index'
import { globalRegistry, Registry } from '../satellite/index'
Expand Down
2 changes: 1 addition & 1 deletion clients/typescript/src/electric/namespace.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// This is the namespace that's patched onto the user's database client
// (technically via the proxy machinery) as the `.electric` property.
import { DatabaseAdapter } from '@electric-sql/drivers'
import { DatabaseAdapter } from '../../../../packages/drivers/dist'
import { Notifier, UnsubscribeFunction } from '../notifiers'
import { ConnectivityState } from '../util/types'
import { GlobalRegistry, Registry } from '../satellite'
Expand Down
2 changes: 1 addition & 1 deletion clients/typescript/src/migrators/bundle.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import {
Migrator,
StmtMigration,
} from './index'
import { DatabaseAdapter } from '@electric-sql/drivers'
import { DatabaseAdapter } from '../../../../packages/drivers/dist'
import { buildInitialMigration as makeBaseMigration } from './schema'
import Log from 'loglevel'
import { QualifiedTablename, SatelliteError, SatelliteErrorCode } from '../util'
Expand Down
2 changes: 1 addition & 1 deletion clients/typescript/src/satellite/index.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import Long from 'long'
import { AuthConfig, AuthState } from '../auth/index'
import { InternalElectricConfig } from '../config/index'
import { DatabaseAdapter } from '@electric-sql/drivers'
import { DatabaseAdapter } from '../../../../packages/drivers/dist'
import { Migrator } from '../migrators/index'
import { Notifier } from '../notifiers/index'
import { SocketFactory } from '../sockets'
Expand Down
2 changes: 1 addition & 1 deletion clients/typescript/src/satellite/mock.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { AuthState } from '../auth/index'
import { DatabaseAdapter } from '@electric-sql/drivers'
import { DatabaseAdapter } from '../../../../packages/drivers/dist'
import { Migrator } from '../migrators/index'
import { Notifier } from '../notifiers/index'
import { sleepAsync } from '../util/timer'
Expand Down
4 changes: 2 additions & 2 deletions clients/typescript/src/satellite/process.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import {
SatRelation_RelationType,
} from '../_generated/protocol/satellite'
import { AuthConfig, AuthState } from '../auth/index'
import { DatabaseAdapter } from '@electric-sql/drivers'
import { DatabaseAdapter, RunResult } from '@electric-sql/drivers'
import { Migrator } from '../migrators/index'
import {
AuthStateNotification,
Expand Down Expand Up @@ -710,7 +710,7 @@ export class SatelliteProcess implements Satellite {
* Runs the provided statements in a transaction and disables FK checks if `this.fkChecks` is set to `disabled`.
* `this.fkChecks` should only be set to true when using SQLite as we already disable FK checks for incoming TXs when using Postgres
*/
async runInTransaction(...stmts: Statement[]) {
async runInTransaction(...stmts: Statement[]): Promise<RunResult> {
return runInTransaction(this.adapter, this.fkChecks, ...stmts)
}

Expand Down
2 changes: 1 addition & 1 deletion clients/typescript/src/satellite/registry.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { InternalElectricConfig, HydratedConfig } from '../config/index'
import { DatabaseAdapter } from '@electric-sql/drivers'
import { DatabaseAdapter } from '../../../../packages/drivers/dist'
import { Migrator } from '../migrators/index'
import { Notifier } from '../notifiers/index'
import { DbName } from '../util/types'
Expand Down
2 changes: 1 addition & 1 deletion clients/typescript/src/util/relations.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { SatRelation_RelationType } from '../_generated/protocol/satellite'
import { DatabaseAdapter } from '@electric-sql/drivers'
import { DatabaseAdapter } from '../../../../packages/drivers/dist'
import { QueryBuilder } from '../migrators/query-builder'
import { SatelliteOpts } from '../satellite/config'
import { QualifiedTablename } from './tablename'
Expand Down
2 changes: 1 addition & 1 deletion clients/typescript/src/util/transactions.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Statement } from '.'
import { ForeignKeyChecks } from '../config'
import { DatabaseAdapter, RunResult } from '@electric-sql/drivers'
import { DatabaseAdapter, RunResult } from '../../../../packages/drivers/dist'

/**
* Runs the provided statements in a transaction and sets the `foreign_keys` pragma based on the `fkChecks` flag.
Expand Down
Loading

0 comments on commit 71fbe60

Please sign in to comment.