Skip to content

Commit

Permalink
Merge pull request #47 from xmtp-labs/rygine/setup-publishing
Browse files Browse the repository at this point in the history
Setup test and publish workflows
  • Loading branch information
rygine authored Jun 28, 2024
2 parents d5e620c + 8c1095c commit 1690b39
Show file tree
Hide file tree
Showing 32 changed files with 84 additions and 63 deletions.
17 changes: 17 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,23 @@ jobs:
- name: Check types
run: yarn typecheck

test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version-file: ".node-version"
cache: "yarn"
env:
SKIP_YARN_COREPACK_CHECK: "1"
- name: Enable corepack
run: corepack enable
- name: Install dependencies
run: yarn
- name: Check types
run: yarn test

build:
runs-on: ubuntu-latest
steps:
Expand Down
2 changes: 1 addition & 1 deletion examples/gm/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
"typecheck": "tsc --noEmit"
},
"dependencies": {
"message-kit": "workspace:*"
"@xmtp/message-kit": "workspace:*"
},
"devDependencies": {
"@types/node": "^20.14.2",
Expand Down
2 changes: 1 addition & 1 deletion examples/gm/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { run, HandlerContext } from "message-kit";
import { run, HandlerContext } from "@xmtp/message-kit";

run(async (context: HandlerContext) => {
// Get the message and the address from the sender
Expand Down
2 changes: 1 addition & 1 deletion examples/group/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
"typecheck": "tsc --noEmit"
},
"dependencies": {
"message-kit": "workspace:^",
"@xmtp/message-kit": "workspace:^",
"openai": "^4.52.0"
},
"devDependencies": {
Expand Down
2 changes: 1 addition & 1 deletion examples/group/src/commands.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { CommandGroup } from "message-kit";
import type { CommandGroup } from "@xmtp/message-kit";

export const commands: CommandGroup[] = [
{
Expand Down
4 changes: 2 additions & 2 deletions examples/group/src/handler/admin.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { HandlerContext } from "message-kit";
import type { User } from "message-kit";
import { HandlerContext } from "@xmtp/message-kit";
import type { User } from "@xmtp/message-kit";

// Reusable function to handle adding members
function handleAddMembers(
Expand Down
2 changes: 1 addition & 1 deletion examples/group/src/handler/agent.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { HandlerContext } from "message-kit";
import { HandlerContext } from "@xmtp/message-kit";
import { textGeneration } from "../lib/openai.js";

export async function handler(context: HandlerContext) {
Expand Down
4 changes: 2 additions & 2 deletions examples/group/src/handler/betting.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { HandlerContext } from "message-kit";
import { HandlerContext } from "@xmtp/message-kit";
import { ContentTypeText } from "@xmtp/content-type-text";
import type { User } from "message-kit";
import type { User } from "@xmtp/message-kit";

export async function handler(context: HandlerContext) {
const {
Expand Down
2 changes: 1 addition & 1 deletion examples/group/src/handler/game.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { HandlerContext } from "message-kit";
import { HandlerContext } from "@xmtp/message-kit";

// Handler function to process game-related commands
export async function handler(context: HandlerContext) {
Expand Down
2 changes: 1 addition & 1 deletion examples/group/src/handler/payment.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { HandlerContext } from "message-kit";
import { HandlerContext } from "@xmtp/message-kit";
import { vision, textGeneration } from "../lib/openai.js";

export async function handler(context: HandlerContext) {
Expand Down
2 changes: 1 addition & 1 deletion examples/group/src/handler/tipping.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { HandlerContext } from "message-kit";
import { HandlerContext } from "@xmtp/message-kit";
export async function handler(context: HandlerContext) {
const {
getMessageById,
Expand Down
2 changes: 1 addition & 1 deletion examples/group/src/handler/transaction.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { HandlerContext } from "message-kit";
import { HandlerContext } from "@xmtp/message-kit";

// Main handler function for processing commands
export async function handler(context: HandlerContext) {
Expand Down
2 changes: 1 addition & 1 deletion examples/group/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import {
HandlerContext,
AgentHandlers,
CommandHandlers,
} from "message-kit";
} from "@xmtp/message-kit";
import { commands } from "./commands.js";
import { handler as bet } from "./handler/betting.js";
import { handler as tipping } from "./handler/tipping.js";
Expand Down
2 changes: 1 addition & 1 deletion examples/one-to-one/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@
"dependencies": {
"@redis/client": "^1.5.16",
"@xmtp/content-type-text": "^1.0.0",
"@xmtp/message-kit": "workspace:*",
"@xmtp/redis-persistence": "^0.0.4",
"message-kit": "workspace:*",
"node-cron": "^3.0.3"
},
"devDependencies": {
Expand Down
2 changes: 1 addition & 1 deletion examples/one-to-one/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { getRedisClient, getRedisConfig } from "./lib/redis.js";
import cron from "node-cron";
import { ContentTypeText } from "@xmtp/content-type-text";
import { xmtpClient, run, HandlerContext } from "message-kit";
import { xmtpClient, run, HandlerContext } from "@xmtp/message-kit";

//Tracks conversation steps
const inMemoryCacheStep = new Map<string, number>();
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@
"clean": "turbo run clean && rm -rf node_modules && rm -rf .turbo && yarn cache clean",
"format": "turbo run format",
"format:check": "turbo run format:check",
"publish": "yarn build && changeset publish",
"publish": "turbo run build --filter='./packages/*' --filter='!./packages/docs' && changeset publish",
"test": "FORCE_COLOR=1 turbo run test",
"typecheck": "FORCE_COLOR=1 turbo run typecheck"
},
"dependencies": {
Expand Down
2 changes: 1 addition & 1 deletion packages/docs/pages/concepts/access.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ run(async (context: HandlerContext) => {
## Full example

```jsx [src/index.ts]
import { run, HandlerContext } from "message-kit";
import { run, HandlerContext } from "@xmtp/message-kit";

type AccessHandler = (request: any) => Promise<boolean>;

Expand Down
4 changes: 2 additions & 2 deletions packages/docs/pages/concepts/commands.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ First think of which command you want the app to respond to. For example:
Create the command file `commands.ts` in your project root `src` folder.

```tsx [src/commands.ts]
import type { CommandGroup } from "message-kit";
import type { CommandGroup } from "@xmtp/message-kit";

export const commands: CommandGroup[] = [
{
Expand Down Expand Up @@ -67,7 +67,7 @@ export const commands: CommandGroup[] = [
To declare the access command in the app, you need to add the following code:

```tsx
import { run, HandlerContext, CommandHandlers } from "message-kit";
import { run, HandlerContext, CommandHandlers } from "@xmtp/message-kit";
import { commands } from "./commands.js";
import { transaction } from "./handler/transaction.js";

Expand Down
2 changes: 1 addition & 1 deletion packages/docs/pages/concepts/structure.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ app-project/ # Optional middleware files
The `index.ts` file is the entry point for your app. It should contain something like the following:

```jsx [src/index.ts]
import { run, HandlerContext } from "message-kit";
import { run, HandlerContext } from "@xmtp/message-kit";

run(async (context: HandlerContext) => {
// Get the message and the address from the sender
Expand Down
2 changes: 1 addition & 1 deletion packages/docs/pages/installation.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ Next, let's add a `tsconfig.json` file to the root of our project.
Add the following code to `src/index.ts`. This app will reply `gm` to every message it receives.

```jsx [src/index.ts]
import { run, HandlerContext } from "message-kit";
import { run, HandlerContext } from "@xmtp/message-kit";

run(async (context: HandlerContext) => {
// Get the message and the address from the sender
Expand Down
2 changes: 1 addition & 1 deletion packages/docs/pages/use-cases/group/admin.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ Here are the commands to block and unblock users:
## Main code

```jsx [src/handler/admin.ts]
import { HandlerContext } from "message-kit";
import { HandlerContext } from "@xmtp/message-kit";

// Reusable function to handle adding members
function handleAddMembers(addedInboxes: any, members: any, adminName: any) {
Expand Down
2 changes: 1 addition & 1 deletion packages/docs/pages/use-cases/group/agents.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ Messages that start with `@agent` will trigger the GPT response.
In this case the app replies with context about the group like users and commands.

```jsx [src/handler/agent.ts]
import { HandlerContext } from "message-kit";
import { HandlerContext } from "@xmtp/message-kit";
import { textGeneration } from "../lib/openai.js";

export async function handler(context: HandlerContext) {
Expand Down
4 changes: 2 additions & 2 deletions packages/docs/pages/use-cases/group/betting.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,9 @@ This is the command to create a bet:
the app creates a new group and sends a message to the users with a Frame to confirm the bet

```jsx [src/handler/betting.ts]
import { HandlerContext } from "message-kit";
import { HandlerContext } from "@xmtp/message-kit";
import { ContentTypeText } from "@xmtp/content-type-text";
import type { User } from "message-kit";
import type { User } from "@xmtp/message-kit";

export async function handler(context: HandlerContext) {
const {
Expand Down
2 changes: 1 addition & 1 deletion packages/docs/pages/use-cases/group/games.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ Here are the commands to play the games:
## Main code

```jsx [src/handler/games.ts]
import { HandlerContext } from "message-kit";
import { HandlerContext } from "@xmtp/message-kit";

// Handler function to process game-related commands
export async function handler(context: HandlerContext) {
Expand Down
4 changes: 2 additions & 2 deletions packages/docs/pages/use-cases/group/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ To declare these commands you need to add them first. Learn more about commands
:::details[Snippet]

```tsx [src/commands.ts]
import type { CommandGroup } from "message-kit";
import type { CommandGroup } from "@xmtp/message-kit";

export const commands: CommandGroup[] = [
{
Expand Down Expand Up @@ -215,7 +215,7 @@ import {
HandlerContext,
AgentHandlers,
CommandHandlers,
} from "message-kit";
} from "@xmtp/message-kit";
import { commands } from "./commands.js";
import { handler as bet } from "./handler/betting.js";
import { handler as tipping } from "./handler/tipping.js";
Expand Down
2 changes: 1 addition & 1 deletion packages/docs/pages/use-cases/group/payments.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ When you upload an image and this image is a bill of a dinner, the app will proc
In this case the app replies with context about the group like users and commands.

```jsx [src/handler/paments.ts]
import { HandlerContext } from "message-kit";
import { HandlerContext } from "@xmtp/message-kit";
import { vision, textGeneration } from "../lib/openai.js";

export async function handler(context: HandlerContext) {
Expand Down
2 changes: 1 addition & 1 deletion packages/docs/pages/use-cases/group/tipping.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ In this example you can tip using 3 primitives:
## Main code

```jsx [src/handler/tipping.ts]
import { HandlerContext } from "message-kit";
import { HandlerContext } from "@xmtp/message-kit";
export async function handler(context: HandlerContext) {
const {
members,
Expand Down
2 changes: 1 addition & 1 deletion packages/docs/pages/use-cases/group/transactions.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ _The frame used in this example is [BaseFrame](https://base-frame-lyart.vercel.a
## Main code

```jsx [src/handler/frames.ts]
import { HandlerContext } from "message-kit";
import { HandlerContext } from "@xmtp/message-kit";

// Main handler function for processing commands
export function handler(context: HandlerContext) {
Expand Down
2 changes: 1 addition & 1 deletion packages/docs/pages/use-cases/one-to-one/subscribe.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ Import the redis config file and send it as parameter to the `run` function.
import { getRedisClient, getRedisConfig } from "./lib/redis.js";
import cron from "node-cron";
import { ContentTypeText } from "@xmtp/content-type-text";
import { xmtpClient, run, HandlerContext } from "message-kit";
import { xmtpClient, run, HandlerContext } from "@xmtp/message-kit";

//Tracks conversation steps
const inMemoryCacheStep = new Map<string, number>();
Expand Down
2 changes: 1 addition & 1 deletion packages/message-kit/package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "message-kit",
"name": "@xmtp/message-kit",
"version": "1.0.0",
"license": "MIT",
"type": "module",
Expand Down
3 changes: 3 additions & 0 deletions turbo.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@
"format:check": {
"outputs": []
},
"test": {
"outputs": []
},
"typecheck": {
"dependsOn": ["^build"],
"outputs": []
Expand Down
58 changes: 29 additions & 29 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3492,6 +3492,32 @@ __metadata:
languageName: node
linkType: hard

"@xmtp/message-kit@workspace:*, @xmtp/message-kit@workspace:^, @xmtp/message-kit@workspace:packages/message-kit":
version: 0.0.0-use.local
resolution: "@xmtp/message-kit@workspace:packages/message-kit"
dependencies:
"@rollup/plugin-typescript": "npm:^11.1.6"
"@types/jest": "npm:^29.5.12"
"@types/node": "npm:^20.14.2"
"@xmtp/content-type-primitives": "npm:^1.0.1"
"@xmtp/content-type-reaction": "npm:^1.1.9"
"@xmtp/content-type-remote-attachment": "npm:^1.1.9"
"@xmtp/content-type-reply": "npm:^1.1.11"
"@xmtp/content-type-text": "npm:^1.0.0"
"@xmtp/mls-client": "npm:^0.0.11"
dotenv: "npm:^16.4.5"
jest: "npm:^29.7.0"
nodemon: "npm:^3.1.3"
prettier: "npm:^3.3.1"
rollup: "npm:^4.18.0"
rollup-plugin-dts: "npm:^6.1.1"
ts-jest: "npm:^29.1.5"
ts-node: "npm:^10.9.2"
typescript: "npm:^5.4.5"
viem: "npm:^2.15.1"
languageName: unknown
linkType: soft

"@xmtp/mls-client-bindings-node@npm:^0.0.7":
version: 0.0.7
resolution: "@xmtp/mls-client-bindings-node@npm:0.0.7"
Expand Down Expand Up @@ -6064,7 +6090,7 @@ __metadata:
resolution: "gm@workspace:examples/gm"
dependencies:
"@types/node": "npm:^20.14.2"
message-kit: "workspace:*"
"@xmtp/message-kit": "workspace:*"
nodemon: "npm:^3.1.3"
prettier: "npm:^3.3.1"
typescript: "npm:^5.4.5"
Expand Down Expand Up @@ -6099,7 +6125,7 @@ __metadata:
resolution: "group@workspace:examples/group"
dependencies:
"@types/node": "npm:^20.14.2"
message-kit: "workspace:^"
"@xmtp/message-kit": "workspace:^"
nodemon: "npm:^3.1.3"
openai: "npm:^4.52.0"
prettier: "npm:^3.3.1"
Expand Down Expand Up @@ -8115,32 +8141,6 @@ __metadata:
languageName: unknown
linkType: soft

"message-kit@workspace:*, message-kit@workspace:^, message-kit@workspace:packages/message-kit":
version: 0.0.0-use.local
resolution: "message-kit@workspace:packages/message-kit"
dependencies:
"@rollup/plugin-typescript": "npm:^11.1.6"
"@types/jest": "npm:^29.5.12"
"@types/node": "npm:^20.14.2"
"@xmtp/content-type-primitives": "npm:^1.0.1"
"@xmtp/content-type-reaction": "npm:^1.1.9"
"@xmtp/content-type-remote-attachment": "npm:^1.1.9"
"@xmtp/content-type-reply": "npm:^1.1.11"
"@xmtp/content-type-text": "npm:^1.0.0"
"@xmtp/mls-client": "npm:^0.0.11"
dotenv: "npm:^16.4.5"
jest: "npm:^29.7.0"
nodemon: "npm:^3.1.3"
prettier: "npm:^3.3.1"
rollup: "npm:^4.18.0"
rollup-plugin-dts: "npm:^6.1.1"
ts-jest: "npm:^29.1.5"
ts-node: "npm:^10.9.2"
typescript: "npm:^5.4.5"
viem: "npm:^2.15.1"
languageName: unknown
linkType: soft

"micromark-core-commonmark@npm:^2.0.0":
version: 2.0.1
resolution: "micromark-core-commonmark@npm:2.0.1"
Expand Down Expand Up @@ -9125,8 +9125,8 @@ __metadata:
"@types/node": "npm:^20.14.2"
"@types/node-cron": "npm:^3.0.11"
"@xmtp/content-type-text": "npm:^1.0.0"
"@xmtp/message-kit": "workspace:*"
"@xmtp/redis-persistence": "npm:^0.0.4"
message-kit: "workspace:*"
node-cron: "npm:^3.0.3"
nodemon: "npm:^3.1.3"
prettier: "npm:^3.3.1"
Expand Down

0 comments on commit 1690b39

Please sign in to comment.