Skip to content

Commit 8607bc5

Browse files
committed
Fix build
Signed-off-by: Dmitriy Lazarev <w@kich.dev>
1 parent 974f21c commit 8607bc5

8 files changed

Lines changed: 16 additions & 25 deletions

File tree

packages/cli/package.json

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
"name": "@interactors/cli",
33
"version": "1.0.0-rc1.6",
44
"description": "Interactors CLI tool",
5+
"type": "commonjs",
56
"main": "dist/index.js",
67
"types": "dist/index.d.ts",
78
"repository": "https://github.com/thefrontside/interactors.git",
@@ -14,17 +15,17 @@
1415
"README.md"
1516
],
1617
"bin": {
17-
"interactors": "./dist/index.js"
18+
"interactors": "./dist/main.js"
1819
},
1920
"scripts": {
20-
"interactors": "tsx ./src/index.ts build",
21+
"interactors": "tsx ./src/main.ts build",
2122
"agent": "esbuild build/agent.ts --bundle --outfile=build/agent.js",
2223
"clean": "rm -rf dist *.tsbuildinfo",
2324
"lint": "eslint \"{src,test}/**/*.ts\"",
2425
"check:types": "tsc --noEmit",
2526
"test:unit": "tsx --test --test-reporter spec --no-deprecation test/**/*.test.ts",
2627
"test": "yarn test:unit",
27-
"prepack": "tsc --build ./tsconfig.build.json && tsc --project ./tsconfig.build.json",
28+
"prepack": "tsc --build ./tsconfig.build.json && tsc --project ./tsconfig.build.json --module commonjs",
2829
"postinstall": "playwright install"
2930
},
3031
"dependencies": {

packages/cli/src/build.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@ import { call, Operation } from "effection";
22
import { mkdir, readFile, writeFile } from "node:fs/promises";
33
import * as path from "node:path";
44
import * as esbuild from "esbuild";
5-
import { generateImports } from "./generate-imports.ts";
6-
import { importInteractors } from "./import-interactors.ts";
7-
import { generateConstructors } from "./generate-constructors.ts";
5+
import { generateImports } from "./generate-imports.js";
6+
import { importInteractors } from "./import-interactors.js";
7+
import { generateConstructors } from "./generate-constructors.js";
88

99
export interface BuildOptions {
1010
outDir: string;
@@ -16,11 +16,11 @@ export function* build(options: BuildOptions): Operation<void> {
1616

1717
yield* call(() => mkdir(outDir, { recursive: true }));
1818

19-
const { modules, agentScriptPath, constructorsPath } = buildAttrs(options);
19+
let { modules, agentScriptPath, constructorsPath } = buildAttrs(options);
2020

2121
let modulesList = new Set([
2222
// NOTE: Include core by default
23-
"@interactors/core",
23+
// "@interactors/core",
2424
"@interactors/html",
2525
...modules,
2626
]);
@@ -37,7 +37,7 @@ export function* build(options: BuildOptions): Operation<void> {
3737
// TODO use esbuild to agent
3838

3939
let templatePath =
40-
new URL("../src/templates/agent.ts.template", import.meta.url).pathname;
40+
require.resolve("../src/templates/agent.ts.template");
4141

4242
let agentTemplate = yield* call(readFile(templatePath, "utf8"));
4343

packages/cli/src/dev.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { Operation } from "effection";
2-
import { build, buildAttrs, BuildOptions } from "./build.ts";
3-
import { useWatcher } from "./watcher.ts";
4-
import { useTestPage } from "./test-page.ts";
2+
import { build, buildAttrs, BuildOptions } from "./build.js";
3+
import { useWatcher } from "./watcher.js";
4+
import { useTestPage } from "./test-page.js";
55

66
export interface DevOptions extends BuildOptions {
77
repl?: string;

packages/cli/src/index.ts

Lines changed: 0 additions & 4 deletions
This file was deleted.

packages/cli/src/main.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import { main } from "effection";
22
import yargs from "yargs";
33

4-
import { build } from "./build.ts";
5-
import { dev } from "./dev.ts";
4+
import { build } from "./build.js";
5+
import { dev } from "./dev.js";
66

77
const commands = { build, dev } as const;
88

packages/cli/src/test-page.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import {
88
} from "effection";
99
import { readFile } from "fs/promises";
1010
import { chromium, Page } from "playwright";
11-
import { buildAttrs, BuildOptions } from "./build";
11+
import { buildAttrs, BuildOptions } from "./build.js";
1212

1313
interface TestPage {
1414
update(): Operation<void>;

packages/cli/tsconfig.json

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,4 @@
11
{
22
"extends": "@frontside/tsconfig",
33
"exclude": ["types/**/*.ts"],
4-
"compilerOptions": {
5-
"allowImportingTsExtensions": true,
6-
"module": "esnext"
7-
}
84
}

packages/html/src/page.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,5 +42,3 @@ const PageInteractor = createInteractor<HTMLHtmlElement>('Page')
4242
* @category Interactor
4343
*/
4444
export const Page = PageInteractor();
45-
46-
export const Page = () => PageInteractor();

0 commit comments

Comments
 (0)