From 2605bf0652e4c2339cd6c9265a89ff429351cedf Mon Sep 17 00:00:00 2001 From: Travis Vachon Date: Mon, 19 Dec 2022 20:48:44 -0800 Subject: [PATCH 1/2] fix: get solid examples working again vite is more particular about type imports and peer vs dev vs regular dependencies - these fixes all help make the solid examples work properly --- examples/solid/uploads-list/src/ContentPage.jsx | 12 ++++-------- packages/solid-keyring/package.json | 8 ++++---- packages/solid-keyring/src/providers/Keyring.ts | 9 ++++++--- packages/solid-uploader/package.json | 2 +- packages/solid-uploader/src/index.ts | 3 ++- .../solid-uploads-list/src/resources/UploadsList.ts | 7 +++++-- 6 files changed, 22 insertions(+), 19 deletions(-) diff --git a/examples/solid/uploads-list/src/ContentPage.jsx b/examples/solid/uploads-list/src/ContentPage.jsx index 52a09d96..5f4f57de 100644 --- a/examples/solid/uploads-list/src/ContentPage.jsx +++ b/examples/solid/uploads-list/src/ContentPage.jsx @@ -15,23 +15,19 @@ export function ContentPage () { - {data().results.length + { data().results.length ? (
- - - {data().results.map(({ dataCid, carCids, uploadedAt }) => ( - - - - + {data().results.map(({ root }) => ( + + ))} diff --git a/packages/solid-keyring/package.json b/packages/solid-keyring/package.json index 6831fc3b..07bb27e0 100644 --- a/packages/solid-keyring/package.json +++ b/packages/solid-keyring/package.json @@ -24,14 +24,14 @@ }, "homepage": "https://github.com/web3-storage/w3ui/tree/main/packages/solid-keyring", "dependencies": { - "@w3ui/keyring-core": "^2.0.1" + "@w3ui/keyring-core": "^2.0.1", + "@ucanto/interface": "^4.0.3", + "@ucanto/principal": "^4.0.3", + "@web3-storage/access": "^9.2.0" }, "peerDependencies": { "solid-js": "^1.5.0" }, "devDependencies": { - "@ucanto/interface": "^4.0.3", - "@ucanto/principal": "^4.0.3", - "@web3-storage/access": "^9.2.0" } } diff --git a/packages/solid-keyring/src/providers/Keyring.ts b/packages/solid-keyring/src/providers/Keyring.ts index 649fade6..3a605b2e 100644 --- a/packages/solid-keyring/src/providers/Keyring.ts +++ b/packages/solid-keyring/src/providers/Keyring.ts @@ -1,9 +1,12 @@ -import { createContext, useContext, createSignal, createComponent, ParentComponent } from 'solid-js' -import { createStore } from 'solid-js/store' -import { createAgent, getCurrentSpace, getSpaces, KeyringContextState, KeyringContextActions, ServiceConfig } from '@w3ui/keyring-core' +import type { ParentComponent }from 'solid-js' +import type { KeyringContextState, KeyringContextActions, ServiceConfig } from '@w3ui/keyring-core' import type { Agent } from '@web3-storage/access' import type { Delegation, Capability, DID } from '@ucanto/interface' +import { createContext, useContext, createSignal, createComponent } from 'solid-js' +import { createStore } from 'solid-js/store' +import { createAgent, getCurrentSpace, getSpaces, } from '@w3ui/keyring-core' + export { KeyringContextState, KeyringContextActions } export type KeyringContextValue = [ diff --git a/packages/solid-uploader/package.json b/packages/solid-uploader/package.json index 6ca5b8e0..36203729 100644 --- a/packages/solid-uploader/package.json +++ b/packages/solid-uploader/package.json @@ -24,12 +24,12 @@ }, "homepage": "https://github.com/web3-storage/w3ui/tree/main/packages/solid-uploader", "dependencies": { + "@w3ui/solid-keyring": "^2.0.0", "@w3ui/uploader-core": "^3.0.1", "@web3-storage/capabilities": "^2.0.0", "multiformats": "^10.0.2" }, "peerDependencies": { - "@w3ui/solid-keyring": "^2.0.0", "solid-js": "^1.5.0" } } diff --git a/packages/solid-uploader/src/index.ts b/packages/solid-uploader/src/index.ts index 4a5053a5..501a9cdc 100644 --- a/packages/solid-uploader/src/index.ts +++ b/packages/solid-uploader/src/index.ts @@ -1,2 +1,3 @@ -export { uploadFile, uploadDirectory, Service, CARMetadata } from '@w3ui/uploader-core' +export { uploadFile, uploadDirectory } from '@w3ui/uploader-core' +export type { Service, CARMetadata } from '@w3ui/uploader-core' export * from './providers/Uploader' diff --git a/packages/solid-uploads-list/src/resources/UploadsList.ts b/packages/solid-uploads-list/src/resources/UploadsList.ts index 032d90fe..696be025 100644 --- a/packages/solid-uploads-list/src/resources/UploadsList.ts +++ b/packages/solid-uploads-list/src/resources/UploadsList.ts @@ -1,7 +1,10 @@ -import { createResource, InitializedResourceReturn, ResourceOptions, ResourceReturn, ResourceSource } from 'solid-js' +import type { InitializedResourceReturn, ResourceOptions, ResourceReturn, ResourceSource } from 'solid-js' import type { Space } from '@w3ui/keyring-core' -import { list, ServiceConfig, ListResponse, UploadListResult } from '@w3ui/uploads-list-core' +import type { ServiceConfig, ListResponse, UploadListResult } from '@w3ui/uploads-list-core' import type { Capability, Proof, Signer } from '@ucanto/interface' + +import { createResource } from 'solid-js' +import { list } from '@w3ui/uploads-list-core' import { list as uploadList } from '@web3-storage/capabilities/upload' interface UploadsListSource extends ServiceConfig { From cfcbca2db0785b094b84ff44b063c60a52231199 Mon Sep 17 00:00:00 2001 From: Travis Vachon Date: Mon, 19 Dec 2022 21:02:45 -0800 Subject: [PATCH 2/2] chore: delint --- examples/solid/uploads-list/src/ContentPage.jsx | 2 +- packages/solid-keyring/src/providers/Keyring.ts | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/examples/solid/uploads-list/src/ContentPage.jsx b/examples/solid/uploads-list/src/ContentPage.jsx index 5f4f57de..22122842 100644 --- a/examples/solid/uploads-list/src/ContentPage.jsx +++ b/examples/solid/uploads-list/src/ContentPage.jsx @@ -15,7 +15,7 @@ export function ContentPage () { - { data().results.length + {data().results.length ? (
Data CIDCAR CIDDate
{dataCid}{carCids[0]}{uploadedAt.toLocaleString()}
{root.toString()}
diff --git a/packages/solid-keyring/src/providers/Keyring.ts b/packages/solid-keyring/src/providers/Keyring.ts index 3a605b2e..015f83d3 100644 --- a/packages/solid-keyring/src/providers/Keyring.ts +++ b/packages/solid-keyring/src/providers/Keyring.ts @@ -1,11 +1,11 @@ -import type { ParentComponent }from 'solid-js' +import type { ParentComponent } from 'solid-js' import type { KeyringContextState, KeyringContextActions, ServiceConfig } from '@w3ui/keyring-core' import type { Agent } from '@web3-storage/access' import type { Delegation, Capability, DID } from '@ucanto/interface' import { createContext, useContext, createSignal, createComponent } from 'solid-js' import { createStore } from 'solid-js/store' -import { createAgent, getCurrentSpace, getSpaces, } from '@w3ui/keyring-core' +import { createAgent, getCurrentSpace, getSpaces } from '@w3ui/keyring-core' export { KeyringContextState, KeyringContextActions }