Skip to content

Commit

Permalink
convert to monorepo
Browse files Browse the repository at this point in the history
  • Loading branch information
dholms committed Jan 6, 2022
1 parent 2095945 commit b87a62f
Show file tree
Hide file tree
Showing 37 changed files with 3,330 additions and 5,384 deletions.
3 changes: 1 addition & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,11 @@
.env-production
.DS_STORE
DS_STORE
yarn.lock
node_modules
dist
analytics.txt

/**/*/.DS_STORE
/**/*/node_modules
/**/*/.next
/**/*/.data
/**/*/.data
13 changes: 13 additions & 0 deletions common/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"name": "@bluesky-demo/common",
"version": "1.0.0",
"main": "src/index.ts",
"license": "MIT",
"dependencies": {
"@ipld/car": "^3.2.3",
"@ipld/dag-cbor": "^7.0.0",
"axios": "^0.24.0",
"multiformats": "^9.5.6",
"ucans": "^0.8.0"
}
}
14 changes: 0 additions & 14 deletions common/requests.ts

This file was deleted.

19 changes: 0 additions & 19 deletions common/server.ts

This file was deleted.

7 changes: 7 additions & 0 deletions common/src/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
export * from './ipld-store'
export * from './memory-db'
export * from './user-store'
export * from './types'
export * as check from './type-check'
export * as service from './service'
export * as util from './util'
4 changes: 3 additions & 1 deletion common/ipld-store.ts → common/src/ipld-store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import * as blockCodec from '@ipld/dag-cbor'
import { SignedRoot, User } from "./types"
import * as check from './type-check'

export default class IpldStore {
export class IpldStore {

db: MemoryDB

Expand Down Expand Up @@ -44,3 +44,5 @@ export default class IpldStore {
return block.cid
}
}

export default IpldStore
4 changes: 3 additions & 1 deletion common/memory-db.ts → common/src/memory-db.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { BlockWriter } from '@ipld/car/lib/writer-browser'
import { CID } from 'multiformats/cid'
import { flattenUint8Arrays } from './util'

export default class MemoryDB {
export class MemoryDB {

map: Map<string, any>

Expand Down Expand Up @@ -42,3 +42,5 @@ export default class MemoryDB {
}

}

export default MemoryDB
File renamed without changes.
File renamed without changes.
File renamed without changes.
4 changes: 3 additions & 1 deletion common/user-store.ts → common/src/user-store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import * as hashmap from 'ipld-hashmap'
import { User, Post } from "./types"
import { CarReader } from '@ipld/car'

export default class UserStore {
export class UserStore {

db: MemoryDB
ipldStore: IpldStore
Expand Down Expand Up @@ -124,3 +124,5 @@ export default class UserStore {
}

}

export default UserStore
File renamed without changes.
84 changes: 0 additions & 84 deletions common/utilities.ts

This file was deleted.

File renamed without changes.
File renamed without changes.
5 changes: 1 addition & 4 deletions components/Register.tsx → frontend/components/Register.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,9 @@ import styles from "@components/App.module.scss";

import React, { ChangeEvent, FormEvent } from 'react'

import * as service from '@common/service'
import { service, LocalUser, UserStore } from '@bluesky-demo/common'
import * as ucan from 'ucans'

import { LocalUser } from '@root/common/types'
import UserStore from "@root/common/user-store";

interface Props {
onRegister: (user: LocalUser) => void
}
Expand Down
File renamed without changes.
File renamed without changes.
8 changes: 8 additions & 0 deletions frontend/next.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
const withPlugins = require('next-compose-plugins');
const withTM = require('next-transpile-modules')([
'@bluesky-demo/common',
]);

module.exports = withPlugins([
withTM,
]);
34 changes: 34 additions & 0 deletions frontend/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
{
"name": "@bluesky-demo/frontend",
"version": "0.0.2",
"scripts": {
"dev": "next -p 3005",
"build": "next build",
"start": "next start"
},
"dependencies": {
"@bluesky-demo/common": "*",
"@ipld/car": "3.2.2",
"@ipld/dag-cbor": "^6.0.12",
"axios": "^0.24.0",
"cors": "^2.8.5",
"express": "^4.17.1",
"ipld-hashmap": "^2.1.7",
"next": "11.1.2",
"next-compose-plugins": "^2.2.1",
"next-transpile-modules": "^9.0.0",
"react": "^17.0.2",
"react-dom": "^17.0.2",
"sass": "1.39.0",
"ucans": "0.9.0-alpha"
},
"license": "MIT",
"devDependencies": {
"@types/cors": "^2.8.12",
"@types/express": "^4.17.13",
"@types/react": "^17.0.20",
"nodemon": "^2.0.15",
"ts-node": "^10.4.0",
"typescript": "^4.4.2"
}
}
File renamed without changes.
3 changes: 3 additions & 0 deletions frontend/pages/api/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export default async function apiIndex(req, res) {
res.status(200).send()
}
4 changes: 1 addition & 3 deletions pages/index.tsx → frontend/pages/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,11 @@ import styles from "@components/App.module.scss";

import * as React from "react";

import * as service from '@common/service'
import { service, UserStore, LocalUser, Post } from '@bluesky-demo/common'
import * as ucan from 'ucans'

import App from "@components/App"
import Register from "@components/Register"
import UserStore from "@root/common/user-store";
import { LocalUser, Post } from "@root/common/types";

function Home(props: {}) {
const [localUser, setLocalUser] = React.useState<LocalUser | null>(null);
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
Loading

0 comments on commit b87a62f

Please sign in to comment.