init
This commit is contained in:
4
.gitignore
vendored
Normal file
4
.gitignore
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
/node_modules
|
||||
.turbo/
|
||||
/.env
|
||||
/coverage/
|
||||
18
.prettierrc.json
Normal file
18
.prettierrc.json
Normal file
@@ -0,0 +1,18 @@
|
||||
{
|
||||
"arrowParens": "always",
|
||||
"bracketSpacing": true,
|
||||
"htmlWhitespaceSensitivity": "css",
|
||||
"insertPragma": false,
|
||||
"bracketSameLine": false,
|
||||
"jsxSingleQuote": false,
|
||||
"printWidth": 120,
|
||||
"proseWrap": "preserve",
|
||||
"quoteProps": "as-needed",
|
||||
"requirePragma": false,
|
||||
"semi": true,
|
||||
"singleQuote": true,
|
||||
"tabWidth": 2,
|
||||
"trailingComma": "all",
|
||||
"useTabs": false,
|
||||
"singleAttributePerLine": false
|
||||
}
|
||||
41
.u8.json
Normal file
41
.u8.json
Normal file
@@ -0,0 +1,41 @@
|
||||
{
|
||||
"values": {
|
||||
"monoRepo": true,
|
||||
"packagePrefix": "@morten-olsen/fluxcurrent-",
|
||||
"packageVersion": "1.0.0"
|
||||
},
|
||||
"entries": [
|
||||
{
|
||||
"timestamp": "2025-09-08T20:17:12.679Z",
|
||||
"template": "monorepo",
|
||||
"values": {
|
||||
"monoRepo": true,
|
||||
"packagePrefix": "@morten-olsen/fluxcurrent-",
|
||||
"packageVersion": "1.0.0"
|
||||
}
|
||||
},
|
||||
{
|
||||
"timestamp": "2025-09-08T20:17:23.017Z",
|
||||
"template": "eslint",
|
||||
"values": {
|
||||
"monoRepo": true,
|
||||
"packagePrefix": "@morten-olsen/fluxcurrent-",
|
||||
"packageVersion": "1.0.0",
|
||||
"target-pkg": {
|
||||
"name": "@morten-olsen/fluxcurrent-repo",
|
||||
"dir": "/Users/alice/Projects/homelab/fluxcurrent"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"timestamp": "2025-09-08T20:18:03.052Z",
|
||||
"template": "pkg",
|
||||
"values": {
|
||||
"monoRepo": true,
|
||||
"packagePrefix": "@morten-olsen/fluxcurrent-",
|
||||
"packageVersion": "1.0.0",
|
||||
"packageName": "core"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
51
eslint.config.mjs
Normal file
51
eslint.config.mjs
Normal file
@@ -0,0 +1,51 @@
|
||||
import { FlatCompat } from '@eslint/eslintrc';
|
||||
import importPlugin from 'eslint-plugin-import';
|
||||
import eslint from '@eslint/js';
|
||||
import eslintConfigPrettier from 'eslint-config-prettier';
|
||||
import tseslint from 'typescript-eslint';
|
||||
|
||||
const compat = new FlatCompat({
|
||||
baseDirectory: import.meta.__dirname,
|
||||
resolvePluginsRelativeTo: import.meta.__dirname,
|
||||
});
|
||||
|
||||
export default tseslint.config(
|
||||
eslint.configs.recommended,
|
||||
...tseslint.configs.strict,
|
||||
...tseslint.configs.stylistic,
|
||||
eslintConfigPrettier,
|
||||
{
|
||||
files: ['**/*.{ts,tsxx}'],
|
||||
extends: [importPlugin.flatConfigs.recommended, importPlugin.flatConfigs.typescript],
|
||||
rules: {
|
||||
'import/no-unresolved': 'off',
|
||||
'import/extensions': ['error', 'ignorePackages'],
|
||||
'import/exports-last': 'error',
|
||||
'import/no-default-export': 'error',
|
||||
'import/order': [
|
||||
'error',
|
||||
{
|
||||
groups: ['builtin', 'external', 'internal', 'parent', 'sibling', 'index'],
|
||||
'newlines-between': 'always',
|
||||
},
|
||||
],
|
||||
'import/no-duplicates': 'error',
|
||||
},
|
||||
},
|
||||
{
|
||||
rules: {
|
||||
'@typescript-eslint/consistent-type-definitions': ['error', 'type'],
|
||||
},
|
||||
},
|
||||
{
|
||||
files: ['**.d.ts'],
|
||||
rules: {
|
||||
'@typescript-eslint/triple-slash-reference': 'off',
|
||||
'@typescript-eslint/consistent-type-definitions': 'off',
|
||||
},
|
||||
},
|
||||
...compat.extends('plugin:prettier/recommended'),
|
||||
{
|
||||
ignores: ['**/node_modules/', '**/dist/', '**/.turbo/', '**/generated/'],
|
||||
},
|
||||
);
|
||||
33
package.json
Normal file
33
package.json
Normal file
@@ -0,0 +1,33 @@
|
||||
{
|
||||
"version": "1.0.0",
|
||||
"name": "@morten-olsen/fluxcurrent-repo",
|
||||
"private": true,
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"test:lint": "eslint",
|
||||
"build": "turbo build",
|
||||
"build:dev": "tsc --build --watch",
|
||||
"test:unit": "vitest --run --coverage --passWithNoTests",
|
||||
"test": "pnpm run \"/^test:.+/\""
|
||||
},
|
||||
"packageManager": "pnpm@10.6.0",
|
||||
"workspaces": [
|
||||
"packages/*",
|
||||
"apps/*"
|
||||
],
|
||||
"devDependencies": {
|
||||
"turbo": "2.5.6",
|
||||
"typescript": "5.9.2",
|
||||
"vitest": "3.2.4",
|
||||
"@vitest/coverage-v8": "3.2.4",
|
||||
"@eslint/eslintrc": "3.3.1",
|
||||
"@eslint/js": "9.35.0",
|
||||
"@pnpm/find-workspace-packages": "6.0.9",
|
||||
"eslint": "9.35.0",
|
||||
"eslint-config-prettier": "10.1.8",
|
||||
"eslint-plugin-import": "2.32.0",
|
||||
"eslint-plugin-prettier": "5.5.4",
|
||||
"prettier": "3.6.2",
|
||||
"typescript-eslint": "8.43.0"
|
||||
}
|
||||
}
|
||||
4
packages/configs/package.json
Normal file
4
packages/configs/package.json
Normal file
@@ -0,0 +1,4 @@
|
||||
{
|
||||
"name": "@morten-olsen/fluxcurrent-configs",
|
||||
"version": "1.0.0"
|
||||
}
|
||||
20
packages/configs/tsconfig.json
Normal file
20
packages/configs/tsconfig.json
Normal file
@@ -0,0 +1,20 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"target": "ESNext",
|
||||
"module": "NodeNext",
|
||||
"moduleResolution": "NodeNext",
|
||||
"declaration": true,
|
||||
"declarationMap": true,
|
||||
"sourceMap": true,
|
||||
"strict": true,
|
||||
"resolveJsonModule": true,
|
||||
"allowSyntheticDefaultImports": true,
|
||||
"skipLibCheck": true,
|
||||
"noEmit": true,
|
||||
"jsx": "react-jsx",
|
||||
"isolatedModules": true,
|
||||
"verbatimModuleSyntax": true,
|
||||
"erasableSyntaxOnly": true,
|
||||
"allowImportingTsExtensions": true
|
||||
}
|
||||
}
|
||||
4
packages/core/.gitignore
vendored
Normal file
4
packages/core/.gitignore
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
/node_modules/
|
||||
/dist/
|
||||
/coverage/
|
||||
/.env
|
||||
38
packages/core/package.json
Normal file
38
packages/core/package.json
Normal file
@@ -0,0 +1,38 @@
|
||||
{
|
||||
"type": "module",
|
||||
"main": "src/exports.ts",
|
||||
"scripts": {
|
||||
"build": "tsc --build",
|
||||
"test:unit": "vitest --run --passWithNoTests",
|
||||
"test": "pnpm run \"/^test:/\""
|
||||
},
|
||||
"packageManager": "pnpm@10.6.0",
|
||||
"files": [
|
||||
"src"
|
||||
],
|
||||
"exports": {
|
||||
".": "./src/exports.ts",
|
||||
"./*": "./src/*"
|
||||
},
|
||||
"imports": {
|
||||
"#root/*": "./src/*"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@morten-olsen/fluxcurrent-configs": "workspace:*",
|
||||
"@morten-olsen/fluxcurrent-tests": "workspace:*",
|
||||
"@types/node": "24.3.1",
|
||||
"@vitest/coverage-v8": "3.2.4",
|
||||
"typescript": "5.9.2",
|
||||
"vitest": "3.2.4"
|
||||
},
|
||||
"name": "@morten-olsen/fluxcurrent-core",
|
||||
"version": "1.0.0",
|
||||
"imports": {
|
||||
"#root/*": "./src/*"
|
||||
},
|
||||
"dependencies": {
|
||||
"knex": "^3.1.0",
|
||||
"pg": "^8.16.3",
|
||||
"zod": "^4.1.5"
|
||||
}
|
||||
}
|
||||
0
packages/core/src/database/database.ts
Normal file
0
packages/core/src/database/database.ts
Normal file
0
packages/core/src/database/migrations/migrations.ts
Normal file
0
packages/core/src/database/migrations/migrations.ts
Normal file
0
packages/core/src/exports.ts
Normal file
0
packages/core/src/exports.ts
Normal file
93
packages/core/src/services/documents/documents.schemas.ts
Normal file
93
packages/core/src/services/documents/documents.schemas.ts
Normal file
@@ -0,0 +1,93 @@
|
||||
import { z } from 'zod';
|
||||
|
||||
const metaValueSchema = z.union([z.string(), z.number(), z.boolean()]);
|
||||
|
||||
const documentSchema = z.object({
|
||||
uri: z.string(),
|
||||
created: z.iso.datetime(),
|
||||
updated: z.iso.datetime(),
|
||||
deleted: z.iso.datetime().nullish(),
|
||||
type: z.string(),
|
||||
title: z.string().nullish(),
|
||||
description: z.string().nullish(),
|
||||
tags: z.array(z.string()),
|
||||
metadata: z.record(z.string(), metaValueSchema),
|
||||
data: z.record(z.string(), z.unknown()),
|
||||
});
|
||||
|
||||
type Document = z.infer<typeof Document>;
|
||||
|
||||
const documentUpsertSchema = documentSchema.omit({
|
||||
created: true,
|
||||
updated: true,
|
||||
deleted: true,
|
||||
});
|
||||
|
||||
type DocumentUpsert = z.infer<typeof documentUpsertSchema>;
|
||||
|
||||
const metaDateFilterSchema = z.object({
|
||||
type: z.literal('date'),
|
||||
field: z.string(),
|
||||
filter: z.object({
|
||||
gt: z.iso.datetime().optional(),
|
||||
gte: z.iso.datetime().optional(),
|
||||
lt: z.iso.datetime().optional(),
|
||||
lte: z.iso.datetime().optional(),
|
||||
nill: z.boolean().optional(),
|
||||
}),
|
||||
});
|
||||
|
||||
const metaNumberFilterSchema = z.object({
|
||||
type: z.literal('number'),
|
||||
field: z.string(),
|
||||
filter: z.object({
|
||||
gt: z.number().optional(),
|
||||
gte: z.number().optional(),
|
||||
lt: z.number().optional(),
|
||||
lte: z.number().optional(),
|
||||
eq: z.number().optional(),
|
||||
neq: z.number().optional(),
|
||||
nill: z.boolean().optional(),
|
||||
}),
|
||||
});
|
||||
|
||||
const metaTextFilterSchema = z.object({
|
||||
type: z.literal('text'),
|
||||
field: z.string(),
|
||||
filter: z.object({
|
||||
eq: z.string().optional(),
|
||||
neq: z.string().optional(),
|
||||
like: z.string().optional(),
|
||||
nlike: z.string().optional(),
|
||||
nill: z.boolean().optional(),
|
||||
}),
|
||||
});
|
||||
|
||||
const metaBoolFilterSchema = z.object({
|
||||
type: z.literal('bool'),
|
||||
field: z.string(),
|
||||
filter: z.object({
|
||||
eq: z.boolean(),
|
||||
nill: z.boolean().optional(),
|
||||
}),
|
||||
});
|
||||
|
||||
const metaFilterSchema = z.union([
|
||||
metaDateFilterSchema,
|
||||
metaNumberFilterSchema,
|
||||
metaTextFilterSchema,
|
||||
metaBoolFilterSchema,
|
||||
]);
|
||||
|
||||
type MetaFilter = z.infer<typeof metaFilterSchema>;
|
||||
|
||||
const documentSearchOptionsSchema = z.object({
|
||||
uris: z.array(z.string()).optional(),
|
||||
types: z.array(z.string()).optional(),
|
||||
meta: z.array(metaFilterSchema).optional(),
|
||||
});
|
||||
|
||||
type DocumentSearchOptions = z.infer<typeof documentSearchOptionsSchema>;
|
||||
|
||||
export type { Document, DocumentUpsert, MetaFilter, DocumentSearchOptions };
|
||||
export { documentSchema, documentUpsertSchema, metaFilterSchema, documentSearchOptionsSchema };
|
||||
0
packages/core/src/services/documents/documents.ts
Normal file
0
packages/core/src/services/documents/documents.ts
Normal file
0
packages/core/src/services/types/types.schemas.ts
Normal file
0
packages/core/src/services/types/types.schemas.ts
Normal file
0
packages/core/src/services/types/types.ts
Normal file
0
packages/core/src/services/types/types.ts
Normal file
0
packages/core/src/utils/services.ts
Normal file
0
packages/core/src/utils/services.ts
Normal file
10
packages/core/tsconfig.json
Normal file
10
packages/core/tsconfig.json
Normal file
@@ -0,0 +1,10 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"outDir": "./dist",
|
||||
"paths": {
|
||||
"#root/*": ["./src"]
|
||||
}
|
||||
},
|
||||
"include": ["src/**/*.ts"],
|
||||
"extends": "@morten-olsen/fluxcurrent-configs/tsconfig.json"
|
||||
}
|
||||
12
packages/core/vitest.config.ts
Normal file
12
packages/core/vitest.config.ts
Normal file
@@ -0,0 +1,12 @@
|
||||
import { defineConfig } from 'vitest/config';
|
||||
import { getAliases } from '@morten-olsen/fluxcurrent-tests/vitest';
|
||||
|
||||
// eslint-disable-next-line import/no-default-export
|
||||
export default defineConfig(async () => {
|
||||
const aliases = await getAliases();
|
||||
return {
|
||||
resolve: {
|
||||
alias: aliases,
|
||||
},
|
||||
};
|
||||
});
|
||||
4
packages/tests/.gitignore
vendored
Normal file
4
packages/tests/.gitignore
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
/node_modules
|
||||
/dist
|
||||
/coverage
|
||||
/.env
|
||||
27
packages/tests/package.json
Normal file
27
packages/tests/package.json
Normal file
@@ -0,0 +1,27 @@
|
||||
{
|
||||
"type": "module",
|
||||
"main": "dist/exports.js",
|
||||
"scripts": {
|
||||
"build": "tsc --build"
|
||||
},
|
||||
"packageManager": "pnpm@10.6.0",
|
||||
"files": [
|
||||
"dist"
|
||||
],
|
||||
"exports": {
|
||||
".": "./dist/exports.js",
|
||||
"./vitest": "./dist/vitest.js"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/node": "24.3.1",
|
||||
"@vitest/coverage-v8": "3.2.4",
|
||||
"typescript": "5.9.2",
|
||||
"vitest": "3.2.4",
|
||||
"@morten-olsen/fluxcurrent-configs": "workspace:*"
|
||||
},
|
||||
"dependencies": {
|
||||
"@pnpm/find-workspace-packages": "6.0.9"
|
||||
},
|
||||
"name": "@morten-olsen/fluxcurrent-tests",
|
||||
"version": "1.0.0"
|
||||
}
|
||||
1
packages/tests/src/exports.ts
Normal file
1
packages/tests/src/exports.ts
Normal file
@@ -0,0 +1 @@
|
||||
console.log('Hello World');
|
||||
10
packages/tests/src/vitest.ts
Normal file
10
packages/tests/src/vitest.ts
Normal file
@@ -0,0 +1,10 @@
|
||||
import { resolve } from 'node:path';
|
||||
|
||||
import { findWorkspacePackages } from '@pnpm/find-workspace-packages';
|
||||
|
||||
const getAliases = async () => {
|
||||
const packages = await findWorkspacePackages(process.cwd());
|
||||
return Object.fromEntries(packages.map((pkg) => [pkg.manifest.name, resolve(pkg.dir, 'src', 'exports.ts')]));
|
||||
};
|
||||
|
||||
export { getAliases };
|
||||
9
packages/tests/tsconfig.json
Normal file
9
packages/tests/tsconfig.json
Normal file
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"outDir": "./dist"
|
||||
},
|
||||
"include": [
|
||||
"src/**/*.ts"
|
||||
],
|
||||
"extends": "@morten-olsen/fluxcurrent-configs/tsconfig.json"
|
||||
}
|
||||
5010
pnpm-lock.yaml
generated
Normal file
5010
pnpm-lock.yaml
generated
Normal file
File diff suppressed because it is too large
Load Diff
3
pnpm-workspace.yaml
Normal file
3
pnpm-workspace.yaml
Normal file
@@ -0,0 +1,3 @@
|
||||
packages:
|
||||
- ./packages/*
|
||||
- ./apps/*
|
||||
16
scripts/set-version.mjs
Normal file
16
scripts/set-version.mjs
Normal file
@@ -0,0 +1,16 @@
|
||||
import { readFile, writeFile } from 'fs/promises';
|
||||
import { join } from 'path';
|
||||
import process from 'process';
|
||||
|
||||
import { findWorkspacePackages } from '@pnpm/find-workspace-packages';
|
||||
|
||||
const packages = await findWorkspacePackages(process.cwd());
|
||||
|
||||
for (const pkg of packages) {
|
||||
const pkgPath = join(pkg.dir, 'package.json');
|
||||
const pkgJson = JSON.parse(await readFile(pkgPath, 'utf-8'));
|
||||
|
||||
pkgJson.version = process.argv[2];
|
||||
|
||||
await writeFile(pkgPath, JSON.stringify(pkgJson, null, 2) + '\n');
|
||||
}
|
||||
37
turbo.json
Normal file
37
turbo.json
Normal file
@@ -0,0 +1,37 @@
|
||||
{
|
||||
"$schema": "https://turbo.build/schema.json",
|
||||
"tasks": {
|
||||
"build": {
|
||||
"dependsOn": [
|
||||
"^build"
|
||||
],
|
||||
"outputs": [
|
||||
"dist/**",
|
||||
"public/**"
|
||||
],
|
||||
"inputs": [
|
||||
"src/**/*.tsx",
|
||||
"src/**/*.ts",
|
||||
"./tsconfig.*",
|
||||
"../../pnpm-lock.yaml"
|
||||
]
|
||||
},
|
||||
"test": {
|
||||
"cache": false
|
||||
},
|
||||
"clean": {},
|
||||
"dev": {
|
||||
"dependsOn": [
|
||||
"^build"
|
||||
],
|
||||
"cache": false,
|
||||
"persistent": true
|
||||
},
|
||||
"demo": {
|
||||
"dependsOn": [
|
||||
"^build"
|
||||
],
|
||||
"persistent": true
|
||||
}
|
||||
}
|
||||
}
|
||||
14
vitest.config.ts
Normal file
14
vitest.config.ts
Normal file
@@ -0,0 +1,14 @@
|
||||
import { defineConfig, type UserConfigExport } from 'vitest/config';
|
||||
|
||||
// eslint-disable-next-line import/no-default-export
|
||||
export default defineConfig(async () => {
|
||||
const config: UserConfigExport = {
|
||||
test: {
|
||||
coverage: {
|
||||
provider: 'v8',
|
||||
include: ['packages/**/src/**/*.ts'],
|
||||
},
|
||||
},
|
||||
};
|
||||
return config;
|
||||
});
|
||||
Reference in New Issue
Block a user