Skip to content

Commit

Permalink
Revert "Ensure consistent package structure (#45)"
Browse files Browse the repository at this point in the history
This reverts commit ff3379c.
  • Loading branch information
NuroDev committed Feb 11, 2025
1 parent aafc325 commit 6840942
Show file tree
Hide file tree
Showing 13 changed files with 55 additions and 73 deletions.
11 changes: 5 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,13 @@
}
},
"scripts": {
"build": "tsup",
"dev": "tsup --watch",
"format": "biome check --write && biome format --write",
"lint": "bun run --bun lint:tsc && bun run --bun lint:biome",
"lint:biome": "biome check",
"lint:tsc": "tsc --pretty",
"lint": "bun run --bun lint:tsc && bun run --bun lint:biome",
"prepare": "bun run build",
"test": "bun test"
"format": "biome check --write && biome format --write",
"test": "bun test",
"build": "tsup",
"prepare": "bun run build"
},
"keywords": [
"database",
Expand Down
3 changes: 1 addition & 2 deletions src/helpers/functions.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { QUERY_SYMBOLS, getQuerySymbol } from '@ronin/compiler';

import { expression } from '@/src/helpers/expressions';
import { QUERY_SYMBOLS, getQuerySymbol } from '@ronin/compiler';

/**
* Wraps a raw SQL expression as-is.
Expand Down
8 changes: 2 additions & 6 deletions src/queries/index.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
import { QUERY_SYMBOLS } from '@ronin/compiler';

import { mutateStructure, setProperty } from '@/src/utils';

import type { ModelField, Query } from '@ronin/compiler';

import type { DeepCallable, ResultRecord } from '@/src/queries/types';
import type { Model } from '@/src/schema';
import { mutateStructure, setProperty } from '@/src/utils';
import { type ModelField, QUERY_SYMBOLS, type Query } from '@ronin/compiler';

/**
* Utility type to convert a tuple of promises into a tuple of their resolved types.
Expand Down
6 changes: 2 additions & 4 deletions src/schema/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
export { model } from '@/src/schema/model';
export { op } from '@/src/helpers/expressions';
export { model, type Model } from '@/src/schema/model';
export * from '@/src/schema/primitives';
export { op } from '@/src/helpers/expressions';
export * from '@/src/helpers/functions';

export type { Model } from '@/src/schema/model';
20 changes: 9 additions & 11 deletions src/schema/model.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,4 @@
import { getSyntaxProxy } from '@/src/queries';

import type {
GetInstructions,
ModelField,
ModelIndex,
ModelTrigger,
Model as RawModel,
StoredObject,
WithInstruction,
} from '@ronin/compiler';

import type {
Chain,
FieldOutput,
Expand All @@ -22,6 +11,15 @@ import type {
number,
string,
} from '@/src/schema';
import type {
GetInstructions,
ModelField,
ModelIndex,
ModelTrigger,
Model as RawModel,
StoredObject,
WithInstruction,
} from '@ronin/compiler';

// This is used to ensure that any object adhering to this interface has both fields.
export interface RoninFields {
Expand Down
5 changes: 1 addition & 4 deletions src/schema/primitives.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
import { getSyntaxProxy } from '@/src/queries';

import { type SyntaxItem, getSyntaxProxy } from '@/src/queries';
import type { ModelField } from '@ronin/compiler';

import type { SyntaxItem } from '@/src/queries';

/** A utility type that maps an attribute's type to a function signature. */
type AttributeSignature<T, Attribute> = T extends boolean
? () => any
Expand Down
1 change: 0 additions & 1 deletion tests/helpers/expressions.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { describe, expect, test } from 'bun:test';

import { op } from '@/src/helpers/expressions';
import {
abs,
Expand Down
29 changes: 14 additions & 15 deletions tests/queries/index.test.ts
Original file line number Diff line number Diff line change
@@ -1,23 +1,22 @@
import { describe, expect, spyOn, test } from 'bun:test';
import { QUERY_SYMBOLS } from '@ronin/compiler';

import { op } from '@/src/helpers/expressions';
import { getBatchProxy, getSyntaxProxy } from '@/src/queries';
import { concat, string } from '@/src/schema';

import type {
AddQuery,
AlterQuery,
CreateQuery,
DropQuery,
GetQuery,
Model,
ModelField,
ModelIndex,
ModelPreset,
ModelTrigger,
Query,
SetQuery,
import {
type AddQuery,
type AlterQuery,
type CreateQuery,
type DropQuery,
type GetQuery,
type Model,
type ModelField,
type ModelIndex,
type ModelPreset,
type ModelTrigger,
QUERY_SYMBOLS,
type Query,
type SetQuery,
} from '@ronin/compiler';

describe('syntax proxy', () => {
Expand Down
2 changes: 0 additions & 2 deletions tests/queries/statements.test.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
import { expect, spyOn, test } from 'bun:test';

import { getBatchProxySQL, getSyntaxProxySQL } from '@/src/queries';

import type { Statement } from '@ronin/compiler';

test('using raw SQL', async () => {
Expand Down
5 changes: 1 addition & 4 deletions tests/schema/model.test.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
import { describe, expect, test } from 'bun:test';
import { QUERY_SYMBOLS } from '@ronin/compiler';

import { getSyntaxProxy } from '@/src/queries';
import { blob, boolean, date, json, link, model, number, string } from '@/src/schema';

import type { GetQuery } from '@ronin/compiler';
import { type GetQuery, QUERY_SYMBOLS } from '@ronin/compiler';

describe('models', () => {
test('create empty model', () => {
Expand Down
14 changes: 10 additions & 4 deletions tests/schema/primitives.test.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,14 @@
import { expect, test } from 'bun:test';

import { blob, boolean, date, json, link, number, string } from '@/src/schema';

import type { SyntaxField } from '@/src/schema';
import {
type SyntaxField,
blob,
boolean,
date,
json,
link,
number,
string,
} from '@/src/schema';

test('create string field', () => {
const field = string({ displayAs: 'secret' }) as unknown as SyntaxField<'string'>;
Expand Down
10 changes: 10 additions & 0 deletions tsup.config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"dts": {
"resolve": true
},
"format": "esm",
"entry": {
"schema": "src/schema/index.ts",
"queries": "src/queries/index.ts"
}
}
14 changes: 0 additions & 14 deletions tsup.config.ts

This file was deleted.

0 comments on commit 6840942

Please sign in to comment.