Skip to content

Commit

Permalink
Break out routes, node, bun and ignite
Browse files Browse the repository at this point in the history
  • Loading branch information
robertherber committed Oct 17, 2023
1 parent 7a47832 commit 36d1129
Show file tree
Hide file tree
Showing 61 changed files with 713 additions and 133 deletions.
8 changes: 2 additions & 6 deletions apps/supplement-stack/app.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { createApp } from '@zemble/core'
import bunRunner from '@zemble/bun'
import YogaGraphQL from '@zemble/graphql'
import AuthOTP from 'zemble-plugin-auth-otp'

Expand All @@ -14,7 +14,7 @@ declare global {
}
}

const app = createApp({
void bunRunner({
plugins: [
YogaGraphQL.configure({
yoga: {
Expand Down Expand Up @@ -50,7 +50,3 @@ const app = createApp({
})

void connect()

void app.then(({ start }) => {
start()
})
3 changes: 2 additions & 1 deletion apps/supplement-stack/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@
"zemble-plugin-apple-app-site-association": "workspace:*",
"zemble-plugin-auth-otp": "workspace:*",
"zemble-plugin-bull": "workspace:*",
"zemble-plugin-todo": "workspace:*"
"zemble-plugin-todo": "workspace:*",
"@zemble/bun": "workspace:*"
},
"devDependencies": {
"@tsconfig/node20": "^20.1.1",
Expand Down
17 changes: 4 additions & 13 deletions apps/todo-app-with-auth-backend/app.ts
Original file line number Diff line number Diff line change
@@ -1,19 +1,12 @@
import { createApp } from '@zemble/core'
import YogaGraphQL from '@zemble/graphql'
import bunRunner from '@zemble/bun'
import Ignite from '@zemble/ignite'
import AppleAppSiteAssociation from 'zemble-plugin-apple-app-site-association'
import AnonymousAuth from 'zemble-plugin-auth-anonymous'
import Bull from 'zemble-plugin-bull'
import TodoPlugin from 'zemble-plugin-todo'

const app = createApp({
void bunRunner({
plugins: [
YogaGraphQL.configure({
yoga: {
graphqlEndpoint: '/graphql',
plugins: [],
},
}),
Bull.configure(),
Ignite.configure(),
AnonymousAuth.configure(),
TodoPlugin.configure(),
AppleAppSiteAssociation.configure({
Expand All @@ -29,5 +22,3 @@ const app = createApp({
}),
],
})

void app.then(({ start }) => start())
6 changes: 4 additions & 2 deletions apps/todo-app-with-auth-backend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"private": true,
"main": "app.ts",
"scripts": {
"dev": "bun app.ts",
"dev": "bun --hot app.ts",
"lint": "eslint .",
"lint-quiet": "eslint . --quiet",
"typecheck": "tsc --noEmit"
Expand All @@ -20,7 +20,9 @@
"zemble-plugin-auth-anonymous": "workspace:*",
"zemble-plugin-apple-app-site-association": "workspace:*",
"zemble-plugin-bull": "workspace:*",
"zemble-plugin-todo": "workspace:*"
"zemble-plugin-todo": "workspace:*",
"@zemble/ignite": "workspace:*",
"@zemble/bun": "workspace:*"
},
"devDependencies": {
"@tsconfig/node20": "^20.1.1",
Expand Down
14 changes: 14 additions & 0 deletions apps/todo-app-with-auth-backend/routes/hey/get2.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import type { Context } from 'hono'

export const get = async (c: Context) => c.html(`<html>
<head>
<title>yeah it's a get</title>
<meta name="color-scheme" content="light dark">
</head>
<body>
<div>
<p>Hello Zemble! Serving</p>
<p><a href='/graphql'>Check out your GraphQL API here</a></p>
</div>
</body>
</html>`)
16 changes: 16 additions & 0 deletions apps/todo-app-with-auth-backend/routes/hey/getting.post.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import type { Context } from 'hono'

const getter = async (c: Context) => c.html(`<html>
<head>
<title>yeah it's a get</title>
<meta name="color-scheme" content="light dark">
</head>
<body>
<div>
<p>Hello Zemble! Serving</p>
<p><a href='/graphql'>Check out your GraphQL API here</a></p>
</div>
</body>
</html>`)

export default getter
127 changes: 127 additions & 0 deletions apps/todo-app-with-auth-backend/routes/hey/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,127 @@
<html>
<head>
<title>Todo App</title>
</head>
<body>
<div>
<p>TEST!</p>
</div>
<div>
<p>TEST!</p>
</div>
<div>
<p>TEST!</p>
</div>
<div>
<p>TEST!</p>
</div>
<div>
<p>TEST!</p>
</div>
<div>
<p>TEST!</p>
</div>

<div>
<p>TEST!</p>
</div>
<div>
<p>TEST!</p>
</div>
v
<div>
<p>TEST!</p>
</div>
<div>
<p>TEST!</p>
</div>
<div>
<p>TEST!</p>
</div>
<div>
<p>TEST!</p>
</div>
<div>
<p>TEST!</p>
</div>
<div>
<p>TEST!</p>
</div>
<div>
<p>TEST!</p>
</div>
<div>
<p>TEST!</p>
</div>
<div>
<p>TEST!</p>
</div>
<div>
<p>TEST!</p>
</div>


<div>
<p>TEST!</p>
</div>
<div>
<p>TEST!</p>
</div>
<div>
<p>TEST!</p>
</div>
<div>
<p>TEST!</p>
</div>
<div>
<p>TEST!</p>
</div>
<div>
<p>TEST!</p>
</div>
<div>
<p>TEST!</p>
</div>
v
<div>
<p>TEST!</p>
</div>
<div>
<p>TEST!</p>
</div>
<div>
<p>TEST!</p>
</div>
<div>
<p>TEST!</p>
</div>

<div>
<p>TEST!</p>
</div>
<div>
<p>TEST!</p>
</div>
<div>
<p>TEST!</p>
</div>
<div>
<p>TEST!</p>
</div>
<div>
<p>TEST!</p>
</div>
<div>
<p>TEST!</p>
</div>
<div>
<p>TEST!</p>
</div>
<div>
<p>TEST!</p>
</div>
<div>
<p>TEST!</p>
</div>

</html>
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Binary file added apps/todo-app-with-auth-backend/routes/hey/test.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion apps/todo-app-with-auth/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"android": "expo start --android",
"ios": "expo start --ios",
"web": "expo start --web",
"dev": "PLUGIN_DEV=true bun --hot index.ts",
"dev": "zemble-bun index.ts",
"lint": "eslint .",
"lint-quiet": "eslint . --quiet",
"typecheck": "tsc --noEmit"
Expand Down
Binary file modified bun.lockb
Binary file not shown.
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@
"pre-push": "bunx turbo run lint-quiet test typecheck --continue",
"generate-cms-json-schema": "typescript-json-schema ./packages/cms/tsconfig.json CmsConfigFile --include ./packages/cms/types.ts --out ./packages/cms/entities-json-schema.json --required --strictNullChecks --rejectDateType",
"fix-workspace-dependencies": "find . -type f -name 'package.json' -not -path './package.json' -not -path '*/node_modules/*' -exec perl -pi -e 's/\"workspace:[^\"]*\"/\"*\"/g' {} \\;",
"changeset-release": "bun run fix-workspace-dependencies && bunx changeset publish"
"changeset-release": "bun run fix-workspace-dependencies && bunx changeset publish",
"reinstall": "rm -rf node_modules/ && rm bun.lockb && find . -name 'node_modules' -type d -prune -exec rm -rf '{}' + && bun install"
},
"keywords": [],
"author": "",
Expand Down
2 changes: 1 addition & 1 deletion packages/anonymous-auth-expo/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"ios": "expo start --ios",
"web": "expo start --web",
"codegen": "graphql-code-generator",
"dev": "PLUGIN_DEV=true bun --hot index.ts",
"dev": "zemble-bun index.ts",
"lint": "eslint .",
"lint-quiet": "eslint . --quiet",
"typecheck": "tsc --noEmit"
Expand Down
2 changes: 1 addition & 1 deletion packages/apple-app-site-association/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"private": true,
"main": "plugin.ts",
"scripts": {
"dev": "PLUGIN_DEV=true bun --hot plugin.ts",
"dev": "zemble-bun plugin.ts",
"lint": "eslint .",
"lint-quiet": "eslint . --quiet",
"typecheck": "tsc --noEmit"
Expand Down
2 changes: 1 addition & 1 deletion packages/auth-anonymous/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"description": "",
"main": "plugin.ts",
"scripts": {
"dev": "PLUGIN_DEV=true bun --hot plugin.ts",
"dev": "zemble-bun plugin.ts",
"lint": "eslint .",
"lint-quiet": "eslint . --quiet",
"typecheck": "tsc --noEmit",
Expand Down
2 changes: 1 addition & 1 deletion packages/auth-api-token/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"description": "",
"main": "plugin.ts",
"scripts": {
"dev": "PLUGIN_DEV=true bun --hot plugin.ts",
"dev": "zemble-bun plugin.ts",
"lint": "eslint .",
"lint-quiet": "eslint . --quiet",
"graphql-codegen": "graphql-codegen",
Expand Down
2 changes: 1 addition & 1 deletion packages/auth-expo/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"android": "expo start --android",
"ios": "expo start --ios",
"web": "expo start --web",
"dev": "PLUGIN_DEV=true bun --hot index.ts",
"dev": "zemble-bun index.ts",
"lint": "eslint .",
"lint-quiet": "eslint . --quiet",
"typecheck": "tsc --noEmit"
Expand Down
2 changes: 1 addition & 1 deletion packages/auth-otp/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"main": "plugin.ts",
"scripts": {
"test": "bun test",
"dev": "PLUGIN_DEV=true bun --hot plugin.ts",
"dev": "zemble-bun plugin.ts",
"lint": "eslint .",
"lint-quiet": "eslint . --quiet",
"typecheck": "tsc --noEmit",
Expand Down
3 changes: 2 additions & 1 deletion packages/auth/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
},
"scripts": {
"test": "bun test",
"dev": "PLUGIN_DEV=true bun --hot plugin.ts",
"dev": "zemble-bun plugin.ts",
"lint": "eslint .",
"lint-quiet": "eslint . --quiet",
"graphql-codegen": "graphql-codegen",
Expand All @@ -22,6 +22,7 @@
"@envelop/generic-auth": "^6.0.1",
"@graphql-tools/wrap": "^10.0.1",
"@zemble/core": "workspace:*",
"@zemble/bun": "workspace:*",
"@zemble/graphql": "workspace:*",
"graphql": "^16.8.0",
"graphql-scalars": "^1.22.2",
Expand Down
2 changes: 1 addition & 1 deletion packages/bull/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"description": "",
"main": "plugin.ts",
"scripts": {
"dev": "REDIS_URL=redis://localhost:6379 PLUGIN_DEV=true bun --hot plugin.ts",
"dev": "REDIS_URL=redis://localhost:6379 zemble-bun plugin.ts",
"lint": "eslint .",
"lint-quiet": "eslint . --quiet",
"graphql-codegen": "graphql-codegen",
Expand Down
File renamed without changes.
4 changes: 2 additions & 2 deletions packages/bull/utils/setupQueues.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
/* eslint-disable no-underscore-dangle */
import readDir from '@zemble/core/utils/readDir'
import * as fs from 'node:fs'
import * as path from 'node:path'

import '@zemble/graphql'

import readDir from './readDir'
import createClient from '../clients/redis'
import { type BullPluginConfig } from '../plugin'
import ZembleQueueBull from '../ZembleQueueBull'
Expand Down Expand Up @@ -43,6 +42,7 @@ const setupQueues = (pluginPath: string, pubSub: Zemble.PubSubType, config: Bull
}

if (hasQueues) {
console.log('[bull-plugin] Initializing queues from ', queuePath)
const redisUrl = config?.redisUrl

if (redisUrl || process.env.NODE_ENV === 'test') {
Expand Down
5 changes: 5 additions & 0 deletions packages/bun/.eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"extends": [
"../../.eslintrc"
]
}
7 changes: 7 additions & 0 deletions packages/bun/cli.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/usr/bin/env bun --hot

import cliRunner from '@zemble/core/cli-runner'

import bunRunner from './runner'

void cliRunner(bunRunner)
Loading

0 comments on commit 36d1129

Please sign in to comment.