Skip to content

Commit

Permalink
fix: Fixes missing types on core module
Browse files Browse the repository at this point in the history
  • Loading branch information
jakobo committed Oct 29, 2024
1 parent 635811b commit 7a4a5a3
Show file tree
Hide file tree
Showing 7 changed files with 19 additions and 7 deletions.
5 changes: 5 additions & 0 deletions .changeset/brown-hotels-march.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@taskless/loader": patch
---

Fixes issue where types were not available in taskless/core
10 changes: 8 additions & 2 deletions src/dev/packcheck.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
/* eslint-disable n/no-process-env */
import process from "node:process";
import { type ConsolePayload, taskless } from "@~/core.js";
import { taskless } from "@~/core.js";
import { type ConsolePayload } from "@~/types.js";
import { http } from "msw";
import { setupServer } from "msw/node";

Expand All @@ -13,7 +14,10 @@ type Fixture = {
* Packcheck - simple tool for checking your Taskless packs, easily integrated
* with your existing unit testing framework
*/
export async function packcheck(configOrPack: string, fixture: Fixture) {
export async function packCheck(
configOrPack: string,
fixture: Fixture
): Promise<ConsolePayload> {
if (process.env.NODE_ENV === "production") {
throw new Error(
"Taskless `dev` actions cannot be used in production node environments"
Expand Down Expand Up @@ -69,3 +73,5 @@ export async function packcheck(configOrPack: string, fixture: Fixture) {
const result = Array.from(grouped.values())[0] ?? {};
return result;
}

export { type ConsolePayload } from "@~/types.js";
1 change: 1 addition & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,3 +56,4 @@ autoload(TASKLESS_API_KEY, {

// eslint-disable-next-line @typescript-eslint/no-useless-empty-export
export {};
export type * from "./types.js";
2 changes: 2 additions & 0 deletions src/lib/taskless.ts
Original file line number Diff line number Diff line change
Expand Up @@ -514,3 +514,5 @@ export const autoload = (secret?: string, options?: InitOptions) => {
handleError(error);
}
};

export type * from "../types.js";
2 changes: 0 additions & 2 deletions test/env.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,7 @@ import { dirname, resolve } from "node:path";
import { fileURLToPath } from "node:url";
import { execa } from "execa";
import { vi, test as vitest, afterEach, describe, beforeAll } from "vitest";
import { packcheck } from "../dist/dev/packcheck.js";
import { taskless } from "../src/core.js";
import sampleYaml from "./fixtures/sample.yaml?raw";
import { defaultConfig, withHono } from "./helpers/server.js";

const test = withHono(vitest);
Expand Down
4 changes: 2 additions & 2 deletions test/packcheck.spec.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { packcheck } from "@~/dev/packcheck.js";
import { packCheck } from "@~/dev/packcheck.js";
import { describe, test } from "vitest";
import sampleYaml from "./fixtures/sample.yaml?raw";

describe("Packcheck", () => {
test("Packcheck assertion library is working", async ({ expect }) => {
const results = await packcheck(sampleYaml, {
const results = await packCheck(sampleYaml, {
request: new Request("https://example.com"),
response: new Response("Hello world!"),
});
Expand Down
2 changes: 1 addition & 1 deletion vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export default defineConfig({
tsconfigPaths(),
externalizeDeps(),
dts({
include: Object.values(ENTRY_POINTS),
include: ["src/**/*"],
}),
],
test: {
Expand Down

0 comments on commit 7a4a5a3

Please sign in to comment.