mirror of
https://github.com/logos-messaging/OpChan.git
synced 2026-01-02 12:53:10 +00:00
chore: setup workspace
This commit is contained in:
parent
a931f2a040
commit
611db99cb1
39
.gitignore
vendored
Normal file
39
.gitignore
vendored
Normal file
@ -0,0 +1,39 @@
|
||||
# Dependencies
|
||||
node_modules/
|
||||
npm-debug.log*
|
||||
yarn-debug.log*
|
||||
yarn-error.log*
|
||||
|
||||
# Build outputs
|
||||
dist/
|
||||
build/
|
||||
*.tsbuildinfo
|
||||
.tsbuildinfo
|
||||
|
||||
# Environment variables
|
||||
.env
|
||||
.env.local
|
||||
.env.development.local
|
||||
.env.test.local
|
||||
.env.production.local
|
||||
|
||||
# IDE
|
||||
.vscode/
|
||||
.idea/
|
||||
*.swp
|
||||
*.swo
|
||||
|
||||
# OS
|
||||
.DS_Store
|
||||
Thumbs.db
|
||||
|
||||
# Logs
|
||||
logs
|
||||
*.log
|
||||
|
||||
# Coverage
|
||||
coverage/
|
||||
.nyc_output/
|
||||
|
||||
# TypeScript cache
|
||||
*.tsbuildinfo
|
||||
72
README.md
Normal file
72
README.md
Normal file
@ -0,0 +1,72 @@
|
||||
# Opchan
|
||||
|
||||
A TypeScript browser library workspace.
|
||||
|
||||
## Structure
|
||||
|
||||
This is an npm workspace containing:
|
||||
|
||||
- `@opchan/core` - Core browser library package
|
||||
|
||||
## Development
|
||||
|
||||
### Installation
|
||||
|
||||
```bash
|
||||
npm install
|
||||
```
|
||||
|
||||
### Building
|
||||
|
||||
Build all packages:
|
||||
```bash
|
||||
npm run build
|
||||
```
|
||||
|
||||
Build specific package:
|
||||
```bash
|
||||
npm run build --workspace=@opchan/core
|
||||
```
|
||||
|
||||
### Development Mode
|
||||
|
||||
Watch mode for development:
|
||||
```bash
|
||||
npm run dev --workspace=@opchan/core
|
||||
```
|
||||
|
||||
### Testing
|
||||
|
||||
```bash
|
||||
npm test
|
||||
```
|
||||
|
||||
### Linting
|
||||
|
||||
```bash
|
||||
npm run lint
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
```typescript
|
||||
import { Opchan } from '@opchan/core';
|
||||
|
||||
const opchan = new Opchan({
|
||||
debug: true,
|
||||
version: '1.0.0'
|
||||
});
|
||||
|
||||
console.log(opchan.getVersion()); // "1.0.0"
|
||||
opchan.log('Hello from Opchan!'); // [Opchan] Hello from Opchan!
|
||||
```
|
||||
|
||||
## Packages
|
||||
|
||||
### @opchan/core
|
||||
|
||||
The core browser library providing the main functionality.
|
||||
|
||||
## License
|
||||
|
||||
MIT
|
||||
2355
package-lock.json
generated
Normal file
2355
package-lock.json
generated
Normal file
File diff suppressed because it is too large
Load Diff
26
package.json
Normal file
26
package.json
Normal file
@ -0,0 +1,26 @@
|
||||
{
|
||||
"name": "opchan",
|
||||
"version": "1.0.0",
|
||||
"description": "Browser-based Forum Library over Waku",
|
||||
"private": true,
|
||||
"workspaces": [
|
||||
"packages/*"
|
||||
],
|
||||
"scripts": {
|
||||
"build": "npm run build --workspaces",
|
||||
"test": "npm run test --workspaces",
|
||||
"dev": "npm run dev --workspaces",
|
||||
"lint": "npm run lint --workspaces"
|
||||
},
|
||||
"devDependencies": {
|
||||
"typescript": "^5.0.0",
|
||||
"@types/node": "^20.0.0",
|
||||
"tsx": "^4.0.0",
|
||||
"eslint": "^8.0.0",
|
||||
"@typescript-eslint/eslint-plugin": "^6.0.0",
|
||||
"@typescript-eslint/parser": "^6.0.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=18.0.0"
|
||||
}
|
||||
}
|
||||
37
packages/core/package.json
Normal file
37
packages/core/package.json
Normal file
@ -0,0 +1,37 @@
|
||||
{
|
||||
"name": "@opchan/core",
|
||||
"version": "1.0.0",
|
||||
"description": "Core browser library for opchan",
|
||||
"main": "dist/index.js",
|
||||
"module": "dist/index.esm.js",
|
||||
"types": "dist/index.d.ts",
|
||||
"files": [
|
||||
"dist"
|
||||
],
|
||||
"scripts": {
|
||||
"build": "npm run build:cjs && npm run build:esm && npm run build:types",
|
||||
"build:cjs": "tsc --module commonjs --outDir dist/cjs",
|
||||
"build:esm": "tsc --module esnext --outDir dist/esm && mv dist/esm/index.js dist/index.esm.js",
|
||||
"build:types": "tsc --declaration --emitDeclarationOnly --outDir dist",
|
||||
"dev": "tsc --watch",
|
||||
"test": "echo \"Error: no test specified\" && exit 1",
|
||||
"lint": "eslint src --ext .ts",
|
||||
"clean": "rm -rf dist"
|
||||
},
|
||||
"keywords": [
|
||||
"browser",
|
||||
"library",
|
||||
"typescript"
|
||||
],
|
||||
"author": "",
|
||||
"license": "MIT",
|
||||
"devDependencies": {
|
||||
"typescript": "^5.0.0",
|
||||
"@types/node": "^20.0.0"
|
||||
},
|
||||
"browserslist": [
|
||||
"> 1%",
|
||||
"last 2 versions",
|
||||
"not dead"
|
||||
]
|
||||
}
|
||||
40
packages/core/src/index.ts
Normal file
40
packages/core/src/index.ts
Normal file
@ -0,0 +1,40 @@
|
||||
/**
|
||||
* @opchan/core - Browser library for opchan
|
||||
*/
|
||||
|
||||
export interface OpchanOptions {
|
||||
debug?: boolean;
|
||||
version?: string;
|
||||
}
|
||||
|
||||
export class Opchan {
|
||||
private options: OpchanOptions;
|
||||
|
||||
constructor(options: OpchanOptions = {}) {
|
||||
this.options = {
|
||||
debug: false,
|
||||
version: '1.0.0',
|
||||
...options,
|
||||
};
|
||||
}
|
||||
|
||||
public getVersion(): string {
|
||||
return this.options.version || '1.0.0';
|
||||
}
|
||||
|
||||
public isDebug(): boolean {
|
||||
return this.options.debug || false;
|
||||
}
|
||||
|
||||
public log(message: string): void {
|
||||
if (this.options.debug) {
|
||||
console.log(`[Opchan] ${message}`);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Default export
|
||||
export default Opchan;
|
||||
|
||||
// Named exports for convenience
|
||||
export { Opchan as OpchanCore };
|
||||
24
packages/core/tsconfig.json
Normal file
24
packages/core/tsconfig.json
Normal file
@ -0,0 +1,24 @@
|
||||
{
|
||||
"extends": "../../tsconfig.json",
|
||||
"compilerOptions": {
|
||||
"outDir": "./dist",
|
||||
"rootDir": "./src",
|
||||
"composite": true,
|
||||
"tsBuildInfoFile": "./dist/.tsbuildinfo",
|
||||
"baseUrl": "./src",
|
||||
"paths": {
|
||||
"@/*": ["./*"],
|
||||
"@/types/*": ["./types/*"],
|
||||
"@/lib/*": ["./*"],
|
||||
"@/services/*": ["./services/*"],
|
||||
"@/utils/*": ["./utils/*"],
|
||||
"@/database/*": ["./database/*"],
|
||||
"@/delegation/*": ["./delegation/*"],
|
||||
"@/forum/*": ["./forum/*"],
|
||||
"@/waku/*": ["./waku/*"],
|
||||
"@/wallet/*": ["./wallet/*"]
|
||||
}
|
||||
},
|
||||
"include": ["src/**/*"],
|
||||
"exclude": ["dist", "**/*.test.ts", "**/*.spec.ts"]
|
||||
}
|
||||
24
tsconfig.json
Normal file
24
tsconfig.json
Normal file
@ -0,0 +1,24 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"target": "ES2020",
|
||||
"lib": ["ES2020", "DOM", "DOM.Iterable"],
|
||||
"module": "ESNext",
|
||||
"moduleResolution": "node",
|
||||
"esModuleInterop": true,
|
||||
"allowSyntheticDefaultImports": true,
|
||||
"strict": true,
|
||||
"skipLibCheck": true,
|
||||
"forceConsistentCasingInFileNames": true,
|
||||
"declaration": true,
|
||||
"declarationMap": true,
|
||||
"sourceMap": true,
|
||||
"outDir": "./dist",
|
||||
"rootDir": "./src",
|
||||
"removeComments": true,
|
||||
"noEmitOnError": true,
|
||||
"incremental": true,
|
||||
"tsBuildInfoFile": ".tsbuildinfo"
|
||||
},
|
||||
"include": ["packages/*/src/**/*"],
|
||||
"exclude": ["node_modules", "**/dist", "**/*.test.ts", "**/*.spec.ts"]
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user