Skip to content

Commit 44e7cea

Browse files
committed
feat: added libraries react / next and CLI
1 parent ac4eb37 commit 44e7cea

28 files changed

Lines changed: 1601 additions & 0 deletions

packages/cli/package.json

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
{
2+
"name": "origamichat-cli",
3+
"version": "0.1.0",
4+
"description": "CLI tool for initializing OrigamiChat in your projects",
5+
"main": "./dist/index.js",
6+
"types": "./dist/index.d.ts",
7+
"bin": {
8+
"origamichat": "./dist/cli.js"
9+
},
10+
"files": [
11+
"dist/**",
12+
"templates/**"
13+
],
14+
"scripts": {
15+
"build": "tsup",
16+
"dev": "tsup --watch",
17+
"lint": "eslint src --ext .ts",
18+
"check-types": "tsc --noEmit",
19+
"clean": "rm -rf dist"
20+
},
21+
"keywords": [
22+
"cli",
23+
"origamichat",
24+
"init",
25+
"setup",
26+
"chat",
27+
"support",
28+
"ai"
29+
],
30+
"author": "Anthony Riera",
31+
"license": "MIT",
32+
"homepage": "https://origamichat.com",
33+
"repository": {
34+
"type": "git",
35+
"url": "https://github.com/anthonyriera/origami-monorepo",
36+
"directory": "packages/cli"
37+
},
38+
"bugs": {
39+
"url": "https://github.com/anthonyriera/origami-monorepo/issues"
40+
},
41+
"publishConfig": {
42+
"access": "public"
43+
},
44+
"dependencies": {
45+
"commander": "^12.1.0",
46+
"inquirer": "^12.1.0",
47+
"fs-extra": "^11.2.0",
48+
"chalk": "^5.3.0",
49+
"ora": "^8.1.1"
50+
},
51+
"devDependencies": {
52+
"@repo/eslint-config": "workspace:*",
53+
"@repo/typescript-config": "workspace:*",
54+
"@types/fs-extra": "^11.0.4",
55+
"@types/inquirer": "^9.0.7",
56+
"eslint": "^8.57.1",
57+
"tsup": "^8.3.5",
58+
"typescript": "^5.8.2"
59+
}
60+
}

packages/cli/src/cli.ts

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
#!/usr/bin/env node
2+
3+
import { program } from "commander";
4+
import { initCommand } from "./commands/init";
5+
import { version } from "./utils/version";
6+
7+
async function main() {
8+
program
9+
.name("origamichat")
10+
.description("CLI for OrigamiChat - AI-human support integration")
11+
.version(version);
12+
13+
program
14+
.command("init")
15+
.description("Initialize OrigamiChat in your project")
16+
.action(initCommand);
17+
18+
await program.parseAsync();
19+
}
20+
21+
main().catch(console.error);

packages/cli/src/commands/init.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
export const initCommand = async () => {
2+
console.log("🎉 Initializing OrigamiChat...");
3+
4+
// TODO: Implement init logic
5+
// - Detect project type (React, Next.js, etc.)
6+
// - Install dependencies
7+
// - Create config files
8+
// - Generate example components
9+
10+
console.log("✅ OrigamiChat initialized successfully!");
11+
console.log("📖 Check the documentation at https://origamichat.com/docs");
12+
};

packages/cli/src/index.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
export { initCommand } from "./commands/init";
2+
export { version } from "./utils/version";

packages/cli/src/utils/version.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
// This would normally read from package.json
2+
export const version = "0.1.0";

packages/cli/tsconfig.json

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
{
2+
"extends": "@repo/typescript-config/nextjs.json",
3+
"compilerOptions": {
4+
"lib": ["es2020"],
5+
"module": "commonjs",
6+
"target": "es2020",
7+
"moduleResolution": "node",
8+
"allowSyntheticDefaultImports": true,
9+
"esModuleInterop": true,
10+
"skipLibCheck": true,
11+
"strict": true,
12+
"forceConsistentCasingInFileNames": true,
13+
"noEmit": true,
14+
"resolveJsonModule": true,
15+
"isolatedModules": true,
16+
"incremental": true
17+
},
18+
"include": ["src/**/*"],
19+
"exclude": ["node_modules", "dist"]
20+
}

packages/cli/tsup.config.ts

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
import { defineConfig } from "tsup";
2+
3+
export default defineConfig({
4+
entry: {
5+
index: "src/index.ts",
6+
cli: "src/cli.ts",
7+
},
8+
format: ["cjs"],
9+
dts: true,
10+
splitting: false,
11+
sourcemap: true,
12+
clean: true,
13+
treeshake: true,
14+
minify: true,
15+
target: "node18",
16+
banner: {
17+
js: "#!/usr/bin/env node",
18+
},
19+
});

packages/next/package.json

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
{
2+
"name": "origamichat-next",
3+
"version": "0.1.0",
4+
"description": "Next.js components and utilities for OrigamiChat, built on top of the React package",
5+
"main": "./dist/index.js",
6+
"module": "./dist/index.mjs",
7+
"types": "./dist/index.d.ts",
8+
"exports": {
9+
".": {
10+
"types": "./dist/index.d.ts",
11+
"import": "./dist/index.mjs",
12+
"require": "./dist/index.js"
13+
}
14+
},
15+
"files": [
16+
"dist/**"
17+
],
18+
"scripts": {
19+
"build": "tsup",
20+
"dev": "tsup --watch",
21+
"lint": "eslint src --ext .ts,.tsx",
22+
"check-types": "tsc --noEmit",
23+
"clean": "rm -rf dist"
24+
},
25+
"keywords": [
26+
"nextjs",
27+
"react",
28+
"chat",
29+
"support",
30+
"ai",
31+
"customer-support",
32+
"server-components",
33+
"typescript"
34+
],
35+
"author": "Anthony Riera",
36+
"license": "MIT",
37+
"homepage": "https://origamichat.com",
38+
"repository": {
39+
"type": "git",
40+
"url": "https://github.com/anthonyriera/origami-monorepo",
41+
"directory": "packages/next"
42+
},
43+
"bugs": {
44+
"url": "https://github.com/anthonyriera/origami-monorepo/issues"
45+
},
46+
"publishConfig": {
47+
"access": "public"
48+
},
49+
"dependencies": {
50+
"origamichat": "workspace:*"
51+
},
52+
"peerDependencies": {
53+
"next": ">=13.0.0",
54+
"react": ">=16.8.0",
55+
"react-dom": ">=16.8.0"
56+
},
57+
"devDependencies": {
58+
"@repo/eslint-config": "workspace:*",
59+
"@repo/typescript-config": "workspace:*",
60+
"@types/react": "^18.3.12",
61+
"@types/react-dom": "^18.3.1",
62+
"eslint": "^8.57.1",
63+
"next": "^15.1.0",
64+
"react": "^18.3.1",
65+
"react-dom": "^18.3.1",
66+
"tsup": "^8.3.5",
67+
"typescript": "^5.8.2"
68+
}
69+
}

packages/next/src/index.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
// Re-export everything from the React package
2+
export * from "@repo/react";
3+
4+
// Next.js specific exports
5+
export { ServerSupport } from "./components/ServerSupport";
6+
export { SupportWidget } from "./components/SupportWidget";
7+
export { withOrigamiChat } from "./hoc/withOrigamiChat";
8+
9+
// Next.js utilities
10+
export { getServerSideProps } from "./utils/getServerSideProps";
11+
export { generateMetadata } from "./utils/generateMetadata";

packages/next/tsconfig.json

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
{
2+
"extends": "@repo/typescript-config/nextjs.json",
3+
"compilerOptions": {
4+
"lib": ["dom", "dom.iterable", "es6"],
5+
"allowJs": true,
6+
"skipLibCheck": true,
7+
"strict": true,
8+
"forceConsistentCasingInFileNames": true,
9+
"noEmit": true,
10+
"esModuleInterop": true,
11+
"module": "esnext",
12+
"moduleResolution": "node",
13+
"resolveJsonModule": true,
14+
"isolatedModules": true,
15+
"jsx": "react-jsx",
16+
"incremental": true
17+
},
18+
"include": ["src/**/*"],
19+
"exclude": ["node_modules", "dist"]
20+
}

0 commit comments

Comments
 (0)