refactor: add src alias to @/

This commit is contained in:
2026-04-02 16:03:44 +08:00
parent f4649e0dac
commit 2581a8e0e6
19 changed files with 48 additions and 34 deletions
+3 -4
View File
@@ -1,7 +1,6 @@
import { describe, it, expect } from 'vitest';
import { createGameContext, createGameCommand, createGameCommandRegistry, IGameContext } from '../../src/core/game';
import { Entity } from '../../src/utils/entity';
import type { PromptEvent } from '../../src/utils/command';
import { createGameContext, createGameCommand, createGameCommandRegistry } from '@/core/game';
import type { PromptEvent } from '@/utils/command';
type MyState = {
score: number;
@@ -77,7 +76,7 @@ describe('createGameContext', () => {
describe('createGameCommand', () => {
it('should run a command with access to game context', async () => {
const { registry } = createGameCommandRegistry<Entity<{ marker: string }>>();
const { registry } = createGameCommandRegistry<{ marker: string }>();
const ctx = createGameContext(registry, { marker: '' });
createGameCommand(registry, 'set-marker <id>', async function (cmd) {
+4 -4
View File
@@ -1,8 +1,8 @@
import { describe, it, expect } from 'vitest';
import { applyAlign, shuffle, type Region, type RegionAxis } from '../../src/core/region';
import { createRNG } from '../../src/utils/rng';
import { entity, Entity } from '../../src/utils/entity';
import { type Part } from '../../src/core/part';
import { applyAlign, shuffle, type Region, type RegionAxis } from '@/core/region';
import { createRNG } from '@/utils/rng';
import { entity, Entity } from '@/utils/entity';
import { type Part } from '@/core/part';
describe('Region', () => {
function createTestRegion(axes: RegionAxis[], parts: Part[]): Entity<Region> {
+4 -4
View File
@@ -7,10 +7,10 @@ import {
createInitialState,
TicTacToeState,
WinnerType, PlayerType
} from '../../src/samples/tic-tac-toe';
import {Entity} from "../../src/utils/entity";
import {createGameContext} from "../../src";
import type { PromptEvent } from '../../src/utils/command';
} from '@/samples/tic-tac-toe';
import {Entity} from "@/utils/entity";
import {createGameContext} from "@/";
import type { PromptEvent } from '@/utils/command';
function createTestContext() {
const ctx = createGameContext(registry, createInitialState);
+1 -1
View File
@@ -1,5 +1,5 @@
import { describe, it, expect } from 'vitest';
import { AsyncQueue } from '../../src/utils/async-queue';
import { AsyncQueue } from '@/utils/async-queue';
describe('AsyncQueue', () => {
describe('push', () => {
+1 -1
View File
@@ -5,7 +5,7 @@ import {
validateCommand,
parseCommand,
type CommandSchema,
} from '../../src/utils/command';
} from '@/utils/command';
describe('parseCommandSchema with inline-schema', () => {
it('should parse schema with typed params', () => {
+3 -3
View File
@@ -1,5 +1,5 @@
import { describe, it, expect } from 'vitest';
import { parseCommandSchema } from '../../src/utils/command/schema-parse';
import { parseCommandSchema } from '@/utils/command/schema-parse';
import {
createCommandRegistry,
registerCommand,
@@ -10,8 +10,8 @@ import {
createCommandRunnerContext,
type CommandRegistry,
type CommandRunnerContextExport,
} from '../../src/utils/command/command-registry';
import type { CommandRunner, PromptEvent } from '../../src/utils/command/command-runner';
} from '@/utils/command/command-registry';
import type { CommandRunner, PromptEvent } from '@/utils/command/command-runner';
type TestContext = {
counter: number;
+1 -1
View File
@@ -1,5 +1,5 @@
import { describe, it, expect } from 'vitest';
import { parseCommand, parseCommandSchema, validateCommand } from '../../src/utils/command';
import { parseCommand, parseCommandSchema, validateCommand } from '@/utils/command';
describe('parseCommandSchema', () => {
it('should parse empty schema', () => {
+1 -1
View File
@@ -1,5 +1,5 @@
import { describe, it, expect } from 'vitest';
import { parseCommand, type Command } from '../../src/utils/command';
import { parseCommand, type Command } from '@/utils/command';
describe('parseCommand', () => {
it('should parse empty string', () => {
+1 -1
View File
@@ -1,5 +1,5 @@
import { describe, it, expect } from 'vitest';
import { createEntityCollection, Entity, entity } from '../../src/utils/entity';
import { createEntityCollection, Entity, entity } from '@/utils/entity';
type TestEntity = {
id: string;
+1 -1
View File
@@ -1,5 +1,5 @@
import { describe, it, expect } from 'vitest';
import { createRNG } from '../../src/utils/rng';
import { createRNG } from '@/utils/rng';
describe('createRNG', () => {
it('should create RNG with default seed', () => {