Skip to content
Snippets Groups Projects
Commit 5fec80ce authored by Marcus Schiesser's avatar Marcus Schiesser
Browse files

fix: use CJS for create-llama

parent 7364f71a
No related branches found
No related tags found
No related merge requests found
{
"extends": "../tsconfig.json",
"compilerOptions": {
"module": "ESNext",
"target": "ESNext",
"verbatimModuleSyntax": true
},
"include": [
"./**/*.ts"
]
}
import { ChildProcess, exec, execSync } from "child_process"; import { ChildProcess, exec, execSync } from "child_process";
import crypto from "node:crypto"; import crypto from "node:crypto";
import { mkdir } from "node:fs/promises"; import { mkdir } from "node:fs/promises";
import { fileURLToPath } from "node:url"; import * as path from "path";
import waitPort from "wait-port"; import waitPort from "wait-port";
export type AppType = "--frontend" | "--no-frontend" | ""; export type AppType = "--frontend" | "--no-frontend" | "";
...@@ -13,7 +13,7 @@ export async function runApp( ...@@ -13,7 +13,7 @@ export async function runApp(
appType: AppType, appType: AppType,
port: number, port: number,
): Promise<ChildProcess[]> { ): Promise<ChildProcess[]> {
const cps = []; const cps: ChildProcess[] = [];
try { try {
switch (appType) { switch (appType) {
...@@ -71,9 +71,7 @@ export function runCreateLlama( ...@@ -71,9 +71,7 @@ export function runCreateLlama(
templateUI: string, templateUI: string,
appType: AppType, appType: AppType,
) { ) {
const createLlama = fileURLToPath( const createLlama = path.join(__dirname, "..", "dist", "index.js");
new URL("../dist/index.js", import.meta.url),
);
const name = [ const name = [
templateType, templateType,
...@@ -110,9 +108,7 @@ export function runCreateLlama( ...@@ -110,9 +108,7 @@ export function runCreateLlama(
return name; return name;
} }
export async function createTestDir() { export async function createTestDir() {
const cwd = fileURLToPath( const cwd = path.join(__dirname, ".cache", crypto.randomUUID());
new URL(`.cache/${crypto.randomUUID()}`, import.meta.url),
);
await mkdir(cwd, { recursive: true }); await mkdir(cwd, { recursive: true });
return cwd; return cwd;
} }
{ {
"name": "create-llama", "name": "create-llama",
"version": "0.0.11", "version": "0.0.11",
"type": "module",
"keywords": [ "keywords": [
"rag", "rag",
"llamaindex", "llamaindex",
......
...@@ -7,10 +7,8 @@ ...@@ -7,10 +7,8 @@
"esModuleInterop": true, "esModuleInterop": true,
"skipLibCheck": false "skipLibCheck": false
}, },
"exclude": ["templates", "dist"], "exclude": [
"references": [ "templates",
{ "dist"
"path": "./e2e/tsconfig.json"
}
] ]
} }
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment