Update import paths to use module aliases
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import { sortBy } from "es-toolkit";
|
||||
import type { CollectionModel, CollectionField } from "pocketbase";
|
||||
import type { GenerateOpts } from "./server/utils.ts";
|
||||
import type { GenerateOpts } from "@/server/utils.ts";
|
||||
|
||||
export function stringifyContent(collections: CollectionModel[], opts: GenerateOpts) {
|
||||
function getCollectionSelectFields() {
|
||||
@@ -110,7 +110,8 @@ export function stringifyContent(collections: CollectionModel[], opts: GenerateO
|
||||
break;
|
||||
|
||||
case "select":
|
||||
// if (collectionName === "testFiles") console.log(`${collectionName}:`, field);
|
||||
// if (collectionName === "testFiles")
|
||||
console.log(`${collectionName}:`, field);
|
||||
// TODO: implement values
|
||||
const maxSelect = field.maxSelect;
|
||||
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import type { default as Pocketbase, SendOptions } from "pocketbase";
|
||||
import { fullListOptionsFrom, optionsFrom } from "./options.js";
|
||||
import type { AnyZodRecord, RecordFullListOpts, RecordIdRef, RecordRef, RecordSlugRef } from "./types.ts";
|
||||
import { AnyRecordsList } from "./schemas.ts";
|
||||
import type { RecordsList } from "./schemas.ts";
|
||||
import { fullListOptionsFrom, optionsFrom } from "@/options.ts";
|
||||
import type { AnyZodRecord, RecordFullListOpts, RecordIdRef, RecordRef, RecordSlugRef } from "@/types.ts";
|
||||
import { AnyRecordsList } from "@/schemas.ts";
|
||||
import type { RecordsList } from "@/schemas.ts";
|
||||
|
||||
export function helpersFrom({ fetch, pocketbase }: HelpersFromOpts) {
|
||||
async function getRecord<C extends string, S extends AnyZodRecord>(ref: RecordSlugRef<C>, opts: GetRecordOpts<S>): Promise<S["_output"]>;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { z } from "zod";
|
||||
import type { AnyZodObject, ZodTypeAny } from "zod";
|
||||
import type { AnyZodRecord, RecordFullListOpts, RecordListOpts } from "./types.ts";
|
||||
import type { AnyZodRecord, RecordFullListOpts, RecordListOpts } from "@/types.ts";
|
||||
|
||||
/**
|
||||
* Extends the given schema with the given expansion.
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { z, ZodOptional, ZodEffects } from "zod";
|
||||
import type { AnyZodObject, objectUtil, ZodObject, ZodRawShape } from "zod";
|
||||
import type { AnyZodRecord, HasRequiredKeys, ZodRecordKeys } from "./types.ts";
|
||||
import type { AnyZodRecord, HasRequiredKeys, ZodRecordKeys } from "@/types.ts";
|
||||
|
||||
/**
|
||||
* Records list schema.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import Pocketbase from "pocketbase";
|
||||
import type { Credentials } from "./config.ts";
|
||||
import type { Credentials } from "@/config.ts";
|
||||
|
||||
let adminPocketbase: Pocketbase;
|
||||
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
#!/usr/bin/env bun
|
||||
|
||||
import { Config } from "../config.ts";
|
||||
import type { ResolvedConfig } from "../config.ts";
|
||||
import { Config } from "@/config.ts";
|
||||
import type { ResolvedConfig } from "@/config.ts";
|
||||
import pkg from "../../package.json" with { type: "json" };
|
||||
import { loadConfig } from "c12";
|
||||
import { defineCommand, runMain } from "citty";
|
||||
import { cancel, group, intro, log, outro, confirm, text, spinner, multiselect, isCancel } from "@clack/prompts";
|
||||
import { fetchCollections } from "../utils.ts";
|
||||
import { generate } from "./utils.ts";
|
||||
import { fetchCollections } from "@/utils.ts";
|
||||
import { generate } from "@/server/utils.ts";
|
||||
import { existsSync } from "node:fs";
|
||||
|
||||
async function getConfig() {
|
||||
|
||||
@@ -2,8 +2,8 @@ import { mkdirSync, readFileSync, writeFileSync } from "node:fs";
|
||||
import { dirname, resolve } from "node:path";
|
||||
import { fileURLToPath } from "node:url";
|
||||
import type { CollectionModel } from "pocketbase";
|
||||
import { stringifyContent } from "../content.js";
|
||||
import type { ResolvedConfig } from "../config.ts";
|
||||
import { stringifyContent } from "@/content.js";
|
||||
import type { ResolvedConfig } from "@/config.ts";
|
||||
|
||||
export async function generate(collections: CollectionModel[], opts: GenerateOpts) {
|
||||
const stub = readFileSync(resolve(dirname(fileURLToPath(import.meta.url)), "../../assets/stubs/index.ts"), "utf-8");
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { sortBy } from "es-toolkit";
|
||||
import type { CollectionModel } from "pocketbase";
|
||||
import { getPocketbase } from "./sdk.js";
|
||||
import type { Credentials } from "./config.ts";
|
||||
import { getPocketbase } from "@/sdk.js";
|
||||
import type { Credentials } from "@/config.ts";
|
||||
|
||||
export async function fetchCollections(credentials: Credentials): Promise<CollectionModel[]> {
|
||||
const pocketbase = await getPocketbase(credentials);
|
||||
|
||||
@@ -46,7 +46,11 @@
|
||||
// Report an error for unreachable code instead of just a warning.
|
||||
"allowUnreachableCode": false,
|
||||
// Report an error for unused labels instead of just a warning.
|
||||
"allowUnusedLabels": false
|
||||
"allowUnusedLabels": false,
|
||||
"baseUrl": ".",
|
||||
"paths": {
|
||||
"@/*": ["./src/*"]
|
||||
}
|
||||
},
|
||||
"exclude": ["dist", "assets/stubs"]
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user