Skip to content

Commit

Permalink
fix path resolving issues
Browse files Browse the repository at this point in the history
  • Loading branch information
atmelmicro committed Feb 23, 2024
1 parent 06e26b5 commit b5dfc7b
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 8 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"type": "module",
"name": "@atmelmicro/lack",
"version": "0.1.3",
"version": "0.1.4",
"dependencies": {
"@hono/node-server": "^1.8.0",
"aws-cdk-lib": "^2.127.0",
Expand Down
2 changes: 1 addition & 1 deletion src/build_cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ if (typeof globalThis.require === "undefined") {
}
`;

esbuild.build({
await esbuild.build({
entryPoints: ["./src/cli.ts"],
bundle: true,
outfile: "./build/cli.js",
Expand Down
6 changes: 2 additions & 4 deletions src/cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,16 +46,14 @@ async function newApp() {
};

log("creating new lack app");
log("initing npm");
spawn("npm", ["init", "-y"]);

log("downloading llrt");
const repoRes = await fetch(
"https://api.github.com/repos/awslabs/llrt/releases/latest"
);
const data: {
assets: {
url: string;
browser_download_url: string;
name: string;
}[];
} = await repoRes.json();
Expand All @@ -70,7 +68,7 @@ async function newApp() {
return;
}

const llrtBin = await fetch(correctVersion.url);
const llrtBin = await fetch(correctVersion.browser_download_url);
const blob = await llrtBin.blob();
await writeFile("./llrt.zip", Buffer.from(await blob.arrayBuffer()));
log("downloaded llrt");
Expand Down
4 changes: 2 additions & 2 deletions src/utils.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { readdir } from "fs/promises";
import { extname } from "path";
import { extname, resolve } from "path";

export async function getAllEntryPoint(path: string): Promise<string[]> {
const res = await readdir(path, { withFileTypes: true });
Expand Down Expand Up @@ -83,7 +83,7 @@ export async function getAllRoutes() {
return (
await Promise.all(
entries.map((file) =>
import(file).then((functions) =>
import("file://" + resolve(file)).then((functions) =>
Object.keys(functions).map((functionName) => {
const path = file.slice(base.length, -extname(file).length);
const fullPath = `${path}/${removeMethod(functionName)}`;
Expand Down

0 comments on commit b5dfc7b

Please sign in to comment.