Skip to content

Commit

Permalink
Merge branch 'main' into feat/full-text-search
Browse files Browse the repository at this point in the history
  • Loading branch information
mugikhan committed Apr 18, 2024
2 parents 243f8e9 + fec4c90 commit a7fd65f
Show file tree
Hide file tree
Showing 24 changed files with 101 additions and 44 deletions.
9 changes: 8 additions & 1 deletion demos/vue-supabase-todolist/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,15 @@
# vue-supabase-todolist

## 0.0.2

### Patch Changes

- Updated dependencies [2a7b83f]
- @powersync/vue@0.0.2

## 0.0.1

### Patch Changes

- @journeyapps/powersync-sdk-web@0.4.1
- @journeyapps/powersync-vue@0.0.1
- @powersync/vue@0.0.1
4 changes: 2 additions & 2 deletions demos/vue-supabase-todolist/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ This package is currently in an alpha release.

## Overview

Demo app demonstrating use of the [PowerSync Vue](https://www.npmjs.com/package/@journeyapps/powersync-vue) together with Supabase.
Demo app demonstrating use of the [PowerSync Vue](https://www.npmjs.com/package/@powersync/vue) together with Supabase.

A step-by-step guide through the Supabase<>PowerSync integration is available [here](https://docs.powersync.com/integration-guides/supabase).

Expand Down Expand Up @@ -59,6 +59,6 @@ pnpm build

## Learn More

Check out [PowerSync Vue on GitHub](https://github.com/powersync-ja/powersync-js/tree/main/packages/powersync-vue) - your feedback and contributions are welcome!
Check out [PowerSync Vue on GitHub](https://github.com/powersync-ja/powersync-js/tree/main/packages/vue) - your feedback and contributions are welcome!

To learn more about PowerSync, see the [PowerSync docs](https://docs.powersync.com).
6 changes: 4 additions & 2 deletions demos/vue-supabase-todolist/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "vue-supabase-todolist",
"private": true,
"version": "0.0.1",
"version": "0.0.2",
"type": "module",
"scripts": {
"dev": "vue-tsc --noEmit --watch & vite dev",
Expand All @@ -11,7 +11,7 @@
},
"dependencies": {
"@journeyapps/powersync-sdk-web": "workspace:*",
"@journeyapps/powersync-vue": "workspace:*",
"@powersync/vue": "workspace:*",
"@mdi/font": "7.4.47",
"@supabase/supabase-js": "^2.39.7",
"@vuelidate/core": "^2.0.3",
Expand All @@ -30,7 +30,9 @@
"unplugin-fonts": "^1.1.1",
"unplugin-vue-components": "^0.26.0",
"vite": "^5.2.0",
"vite-plugin-top-level-await": "^1.4.1",
"vite-plugin-vuetify": "^2.0.3",
"vite-plugin-wasm": "^3.3.0",
"vue-tsc": "^2.0.6"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
</template>

<script setup lang="ts">
import { usePowerSyncStatus } from '@journeyapps/powersync-vue';
import { usePowerSyncStatus } from '@powersync/vue';
import { ref } from 'vue';
import { watchEffect } from 'vue';
import { computed } from 'vue';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
<script setup lang="ts">
import { LISTS_TABLE, ListRecord, TODOS_TABLE } from '@/library/powersync/AppSchema';
import { TODO_LISTS_ROUTE } from '@/plugins/router'; // Adjust this import according to your project's structure
import { usePowerSync, usePowerSyncWatchedQuery } from '@journeyapps/powersync-vue'; // Adjust according to your actual implementation
import { usePowerSync, usePowerSyncWatchedQuery } from '@powersync/vue'; // Adjust according to your actual implementation
import { useRouter } from 'vue-router';
import ListItemWidget from './ListItemWidget.vue'; // Ensure this path is correct
import LoadingMessage from '../LoadingMessage.vue';
Expand Down
2 changes: 1 addition & 1 deletion demos/vue-supabase-todolist/src/plugins/powerSync.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { AppSchema } from '@/library/powersync/AppSchema';
import { WASQLitePowerSyncDatabaseOpenFactory } from '@journeyapps/powersync-sdk-web';
import { createPowerSyncPlugin } from '@journeyapps/powersync-vue';
import { createPowerSyncPlugin } from '@powersync/vue';

export const powerSync = new WASQLitePowerSyncDatabaseOpenFactory({
dbFilename: 'example-vue-todo.db',
Expand Down
2 changes: 1 addition & 1 deletion demos/vue-supabase-todolist/src/views/SqlConsole.vue
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

<script setup lang="ts">
import { ref, computed } from 'vue';
import { usePowerSyncWatchedQuery } from '@journeyapps/powersync-vue';
import { usePowerSyncWatchedQuery } from '@powersync/vue';
const query = ref('SELECT * FROM lists');
const inputText = ref(query.value);
const executeQuery = () => {
Expand Down
2 changes: 1 addition & 1 deletion demos/vue-supabase-todolist/src/views/TodoLists.vue
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
import TodoListsWidget from '@/components/widgets/TodoListsWidget.vue';
import { LISTS_TABLE } from '@/library/powersync/AppSchema';
import { supabase } from '@/plugins/supabase';
import { usePowerSync } from '@journeyapps/powersync-vue';
import { usePowerSync } from '@powersync/vue';
import { ref } from 'vue';
const powerSync = usePowerSync();
Expand Down
4 changes: 2 additions & 2 deletions demos/vue-supabase-todolist/src/views/TodoListsEdit.vue
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ import TodoItemWidget from '@/components/widgets/TodoItemWidget.vue';
import { LISTS_TABLE, TODOS_TABLE, TodoRecord } from '@/library/powersync/AppSchema';
import { pageSubtitle } from '@/main';
import { supabase } from '@/plugins/supabase';
import { usePowerSync, usePowerSyncWatchedQuery } from '@journeyapps/powersync-vue';
import { usePowerSync, usePowerSyncWatchedQuery } from '@powersync/vue';
import { watch } from 'vue';
import { onUnmounted } from 'vue';
import { ref } from 'vue';
Expand Down Expand Up @@ -124,7 +124,7 @@ const createNewTodo = async () => {
await powerSync.value.execute(
`INSERT INTO
${TODOS_TABLE}
(id, created_at, created_by, description, list_id)
(id, created_at, created_by, description, list_id)
VALUES
(uuid(), datetime(), ?, ?, ?)`,
[userID, todoDescription.value, listID!]
Expand Down
2 changes: 1 addition & 1 deletion demos/vue-supabase-todolist/src/views/layouts/Layout.vue
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ import { supabase } from '@/plugins/supabase';
import { computed, ref } from 'vue';
import { useRoute, useRouter } from 'vue-router';
import { pageSubtitle } from '@/main';
import { usePowerSyncStatus } from '@journeyapps/powersync-vue';
import { usePowerSyncStatus } from '@powersync/vue';
const openDrawer = ref(false);
const { status: syncStatus } = usePowerSyncStatus();
Expand Down
22 changes: 18 additions & 4 deletions demos/vue-supabase-todolist/vite.config.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,19 @@
// Plugins
import Components from 'unplugin-vue-components/vite';
import wasm from 'vite-plugin-wasm';
import topLevelAwait from 'vite-plugin-top-level-await';
import Vue from '@vitejs/plugin-vue';
import Vuetify, { transformAssetUrls } from 'vite-plugin-vuetify';
import ViteFonts from 'unplugin-fonts/vite';
import Components from 'unplugin-vue-components/vite';
import Vuetify, { transformAssetUrls } from 'vite-plugin-vuetify';

// Utilities
import { defineConfig } from 'vite';
import { fileURLToPath, URL } from 'node:url';
import { defineConfig } from 'vite';
// https://vitejs.dev/config/
export default defineConfig({
plugins: [
wasm(),
topLevelAwait(),
Vue({
template: { transformAssetUrls }
}),
Expand Down Expand Up @@ -38,6 +42,16 @@ export default defineConfig({
// Don't optimize these packages as they contain web workers and WASM files.
// https://github.com/vitejs/vite/issues/11672#issuecomment-1415820673
exclude: ['@journeyapps/wa-sqlite', '@journeyapps/powersync-sdk-web'],
include: ['object-hash', 'uuid', 'event-iterator', 'js-logger', 'lodash', 'can-ndjson-stream']
include: [
'@journeyapps/powersync-sdk-common > uuid',
'@journeyapps/powersync-sdk-web > event-iterator',
'@journeyapps/powersync-sdk-web > js-logger',
'@journeyapps/powersync-sdk-web > lodash/throttle',
'@journeyapps/powersync-sdk-web > can-ndjson-stream'
]
},
worker: {
format: 'es',
plugins: () => [wasm(), topLevelAwait()]
}
});
4 changes: 2 additions & 2 deletions docs/utils/packageMap.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ export const packageMap: PackageMap = {
[Packages.VueSdk]: {
name: 'Vue SDK',
dirName: Packages.VueSdk,
entryPoints: ['../packages/powersync-vue/src/index.ts'],
tsconfig: '../packages/powersync-vue/tsconfig.json',
entryPoints: ['../packages/vue/src/index.ts'],
tsconfig: '../packages/vue/tsconfig.json',
id: Packages.VueSdk
},
[Packages.CommonSdk]: {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
# @journeyapps/powersync-vue
# @powersync/vue

## 0.0.2

### Patch Changes

- 2a7b83f: rename package

## 0.0.1

Expand Down
File renamed without changes.
16 changes: 8 additions & 8 deletions packages/powersync-vue/README.md → packages/vue/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ To set up app-wide accessibility of PowerSync composables, create a PowerSync Vu
// main.js
import { createApp } from 'vue'
import App from './App.vue'
import { createPowerSyncPlugin } from '@journeyapps/powersync-vue'
import { createPowerSyncPlugin } from '@powersync/vue'

const db = // Setup PowerSync client

Expand All @@ -34,7 +34,7 @@ Both `createPowerSyncPlugin` and `providePowerSync` leverage Vue's [provide/inje
```Vue
// Container.vue
<script setup>
import { providePowerSync } from '@journeyapps/powersync-vue'
import { providePowerSync } from '@powersync/vue'
const db = // Setup PowerSync client
Expand All @@ -50,7 +50,7 @@ The provided PowerSync client is available with the `usePowerSync` composable.
```Vue
// TodoListDisplay.vue
<script setup>
import { usePowerSync } from '@journeyapps/powersync-vue';
import { usePowerSync } from '@powersync/vue';
import { ref } from 'vue';
const powersync = usePowerSync();
Expand All @@ -72,7 +72,7 @@ The `usePowerSyncQuery` composable provides a static view of a given query. You
```Vue
// TodoListDisplayQuery.vue
<script setup>
import { usePowerSyncQuery } from '@journeyapps/powersync-vue';
import { usePowerSyncQuery } from '@powersync/vue';
import { ref } from 'vue';
const query = ref('SELECT * from lists');
Expand All @@ -99,7 +99,7 @@ You can use refs as parameters to refresh the query when they change. The compos
```Vue
// TodoListDisplayWatchedQuery.vue
<script setup>
import { usePowerSync, usePowerSyncWatchedQuery } from '@journeyapps/powersync-vue';
import { usePowerSync, usePowerSyncWatchedQuery } from '@powersync/vue';
import { ref } from 'vue';
const query = ref('SELECT * from lists');
Expand Down Expand Up @@ -131,7 +131,7 @@ The `usePowerSyncStatus` composable provides general connectivity information su
```Vue
// ConnectionStatus.vue
<script setup>
import { usePowerSyncStatus } from '@journeyapps/powersync-vue';
import { usePowerSyncStatus } from '@powersync/vue';
const { status } = usePowerSyncStatus();
</script>
Expand All @@ -157,7 +157,7 @@ Using PowerSync composables in a nested function of a component.

```javascript
<script setup>
import { usePowerSync } from '@journeyapps/powersync-vue';
import { usePowerSync } from '@powersync/vue';

const exampleFunction = async () => {
// ❌ Incorrect: `usePowerSync()` called inside a nested function
Expand All @@ -172,7 +172,7 @@ It's important to initialize usePowerSync at the top level of your setup functio

```javascript
<script setup>
import { usePowerSync } from '@journeyapps/powersync-vue';
import { usePowerSync } from '@powersync/vue';

// ✅ Correct: usePowerSync initialized at the top level of setup function and used as a variable.
const powerSync = usePowerSync();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@journeyapps/powersync-vue",
"version": "0.0.1",
"name": "@powersync/vue",
"version": "0.0.2",
"publishConfig": {
"registry": "https://registry.npmjs.org/",
"access": "public"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Using powerSync composables in a nested function of a component.
\`\`\`typescript
<script setup lang="ts">
import { usePowerSync } from '@journeyapps/powersync-vue';
import { usePowerSync } from '@powersync/vue';
const exampleFunction = async () => {
// ❌ Incorrect: 'usePowerSync()' called inside a nested function
Expand All @@ -22,7 +22,7 @@ It's important to initialize usePowerSync at the top level of your setup functio
\`\`\`typescript
<script setup lang="ts">
import { usePowerSync } from '@journeyapps/powersync-vue';
import { usePowerSync } from '@powersync/vue';
// ✅ Correct: usePowerSync initialized at the top level of setup function and used as a variable.
const powerSync = usePowerSync();
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
Loading

0 comments on commit a7fd65f

Please sign in to comment.