Skip to content

Commit

Permalink
chore(connect): replace skypaack with npm. Fix broken storage test. fmt
Browse files Browse the repository at this point in the history
  • Loading branch information
TillaTheHun0 committed Nov 20, 2023
1 parent 3ddce43 commit 7a2ce78
Show file tree
Hide file tree
Showing 7 changed files with 78 additions and 328 deletions.
2 changes: 1 addition & 1 deletion packages/connect/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ import { createReadStream } from 'node:fs'
import { Readable } from 'node:stream'

// Convert the ReadableStream to a NodeJS.ReadableStream
await hyper.storage.download(name).then(res => Readble.fromWeb(res))
await hyper.storage.download(name).then((res) => Readble.fromWeb(res))
// Or convert to a ReadbleStream from a NodeJS.ReadableStream
await hyper.storage.upload('foo.png', Readable.toWeb(createReadStream('foo.png')))
```
Expand Down
22 changes: 10 additions & 12 deletions packages/connect/deno.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,17 +21,15 @@
"semiColons": false
},
"lint": {
"files": {
"exclude": [
"./CHANGELOG.md",
"./dist",
"./to-node",
"node_modules/",
"node/node_modules",
"node/harness/cjs/node_modules",
"node/harness/esm/node_modules",
"./yarn.lock"
]
}
"exclude": [
"./CHANGELOG.md",
"./dist",
"./to-node",
"node_modules/",
"node/node_modules",
"node/harness/cjs/node_modules",
"node/harness/esm/node_modules",
"./yarn.lock"
]
}
}
364 changes: 57 additions & 307 deletions packages/connect/deno.lock

Large diffs are not rendered by default.

8 changes: 5 additions & 3 deletions packages/connect/deno/deps.deno.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
import { create as signJWT } from 'https://deno.land/x/[email protected]/mod.ts'
import { contentType } from 'https://deno.land/[email protected]/media_types/mod.ts'
import { extname } from 'https://deno.land/[email protected]/path/mod.ts'

export * as R from 'https://cdn.skypack.dev/[email protected]'
export { default as crocks } from 'https://cdn.skypack.dev/[email protected]'
export { ms } from 'https://deno.land/x/[email protected]/ms.ts'

// @deno-types="npm:@types/ramda@^0.28.23"
export * as R from 'npm:[email protected]'

export { default as crocks } from 'npm:[email protected]'

/**
* See deps.node.ts for shims of below
*/
Expand Down
2 changes: 1 addition & 1 deletion packages/connect/deno/dev_deps.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ export {
assert,
assertEquals,
assertObjectMatch,
} from 'https://deno.land/std@0.190.0/testing/asserts.ts'
} from 'https://deno.land/std@0.207.0/assert/mod.ts'
2 changes: 1 addition & 1 deletion packages/connect/deno/services/storage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export const upload = (name: string, data: ReadableStream) => async (h: HyperReq
headers,
// deno-lint-ignore ban-ts-comment
// @ts-ignore
body: data
body: data,
})
}

Expand Down
6 changes: 3 additions & 3 deletions packages/connect/deno/tests/storage.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,9 @@ import { create, destroy, download, remove, signedUrl, upload } from '../service
const test = Deno.test

test('storage.upload', async () => {
const mockRequest = async (h: HyperRequest) => {
const mockRequest = (h: HyperRequest) => {
assertEquals(h.service, 'storage')
assertEquals(h.method, 'POST')
const body = await new Response(h.body as ReadableStream).text()
assertEquals(body, 'woop woop')
return Promise.resolve(
new Request(`http://localhost/${h.service}/bucket/${h.resource}`, {
method: 'POST',
Expand All @@ -21,6 +19,8 @@ test('storage.upload', async () => {
mockRequest,
)
assertEquals(req.url, 'http://localhost/storage/bucket/bar/foo.txt')
const body = await new Response(req.body as ReadableStream).text()
assertEquals(body, 'woop woop')
})

test('storage.download', async () => {
Expand Down

0 comments on commit 7a2ce78

Please sign in to comment.