I created an sftp server in aws for testing.
- Generate an ssh key pair
ssh-keygen -t ed25519
- Log in to AWS
- Go to s3 and create a bucket for the server
- Go to IAM and create a role
- Pick 'AWS Service'
- Select 'Transfer' as the use case
import { object, string } from 'yup'; | |
describe('yup', () => { | |
/** | |
* I've had some trouble getting yup to work as I want, and I think it's unintuitive. | |
* But I have to use it, so I'm writing down these tests so I can actually see what does what. | |
* | |
* A few key gotchas: | |
* * The default value of an object is `{}`, so `object({a: string()})` will allow `undefined`. | |
* The way to get around this is to add `default(undefined).required()` to all objects. |
const h:<FormEventHandler<HTMLFormElement>> = (e) => { | |
e.preventDefault(); | |
const fe = new FormData(e.currentTarget); | |
console.log(fe); | |
} |
import { | |
MouseEvent as ReactMouseEvent, | |
RefObject, | |
useCallback, | |
useEffect, | |
useRef, | |
} from "react"; | |
const rootFontSize = 13; |
/** | |
* This is a workaround to the fact that errors thrown in `useEffect` and similar cause the whole | |
* react tree to unmount. It takes the error and throws it inside the render tree instead. | |
* | |
* Taken from https://www.developerway.com/posts/how-to-handle-errors-in-react and | |
* https://github.com/facebook/react/issues/14981#issuecomment-468460187. | |
* | |
* Usage: | |
* ``` | |
* const Component = () => { |
import { ComponentType, lazy } from "react"; | |
/** | |
* A component to test suspense fallbacks. | |
* | |
* Wrap the children of your <Suspense> in <Delay>, and watch your beautiful fallback for 5 seconds. | |
* | |
* Don't use it in production. | |
*/ | |
export const Delay = lazy( |
import graphql from "babel-plugin-relay/macro"; | |
import { Suspense, useState } from "react"; | |
import { | |
PreloadedQuery, | |
usePaginationFragment, | |
usePreloadedQuery, | |
useQueryLoader, | |
} from "react-relay"; | |
import { SearchQuery } from "./__generated__/SearchQuery.graphql"; | |
import { Search_Results$key } from "./__generated__/Search_Results.graphql"; |
** | |
* A router needs to accept adding RouteDefinitions, which are routes with a name and | |
* path, and potentially a 'fromArgs' and 'fromUrl' constructor, however these might be | |
* possible to determine programmatically, so maybe not necessary. | |
* | |
* Uses: | |
* * Determine which route we are on, and get any arguments for that route. | |
* * Create a link to a route by supplying name and arguments. | |
* * Potentially extend the route definition to do more? Preload? Do we want that in by default? | |
*/ |