Skip to content

Commit ede24b0

Browse files
fix: init + update
1 parent 44e2ae3 commit ede24b0

4 files changed

Lines changed: 30 additions & 24 deletions

File tree

init/src/init.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -158,11 +158,11 @@ ENV DENO_DEPLOYMENT_ID=\${GIT_REVISION}
158158
WORKDIR /app
159159
160160
COPY . .
161-
RUN deno cache main.ts
161+
RUN deno cache _fresh/server.js
162162
163163
EXPOSE 8000
164164
165-
CMD ["run", "-A", "main.ts"]
165+
CMD ["run", "-A", "_fresh/server.ts"]
166166
167167
`;
168168
await writeFile("Dockerfile", DOCKERFILE_TEXT);
@@ -372,8 +372,7 @@ const exampleLoggerMiddleware = define.middleware((ctx) => {
372372
app.use(exampleLoggerMiddleware);
373373
374374
// Include file-system based routes here
375-
app.fsRoutes();
376-
`;
375+
app.fsRoutes();`;
377376
await writeFile("main.ts", MAIN_TS);
378377

379378
const COMPONENTS_BUTTON_TSX =

init/src/init_test.ts

Lines changed: 22 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -139,28 +139,31 @@ Deno.test({
139139
},
140140
});
141141

142-
Deno.test("init with tailwind - fmt, lint, and type check project", async () => {
143-
await using tmp = await withTmpDir();
144-
const dir = tmp.dir;
145-
using _promptStub = stubPrompt(".");
146-
using _confirmStub = stubConfirm({
147-
[CONFIRM_TAILWIND_MESSAGE]: true,
148-
});
142+
Deno.test(
143+
"init with tailwind - fmt, lint, and type check project",
144+
async () => {
145+
await using tmp = await withTmpDir();
146+
const dir = tmp.dir;
147+
using _promptStub = stubPrompt(".");
148+
using _confirmStub = stubConfirm({
149+
[CONFIRM_TAILWIND_MESSAGE]: true,
150+
});
149151

150-
await initProject(dir, [], {});
151-
await expectProjectFile(dir, "main.ts");
152-
await expectProjectFile(dir, "dev.ts");
152+
await initProject(dir, [], {});
153+
await expectProjectFile(dir, "main.ts");
154+
await expectProjectFile(dir, "dev.ts");
153155

154-
await patchProject(dir);
156+
await patchProject(dir);
155157

156-
const check = await new Deno.Command(Deno.execPath(), {
157-
args: ["task", "check"],
158-
cwd: dir,
159-
stderr: "inherit",
160-
stdout: "inherit",
161-
}).output();
162-
expect(check.code).toEqual(0);
163-
});
158+
const check = await new Deno.Command(Deno.execPath(), {
159+
args: ["task", "check"],
160+
cwd: dir,
161+
stderr: "inherit",
162+
stdout: "inherit",
163+
}).output();
164+
expect(check.code).toEqual(0);
165+
},
166+
);
164167

165168
Deno.test("init - can start dev server", async () => {
166169
await using tmp = await withTmpDir();

update/src/update.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,10 @@ export async function updateProject(dir: string) {
135135
) {
136136
tasks.check = "deno fmt --check && deno lint && deno check";
137137
}
138+
139+
if (tasks.preview === "deno run -A main.ts") {
140+
tasks.preview = "deno run -A _fresh/server.js";
141+
}
138142
}
139143
});
140144

update/src/update_test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ Deno.test("update - 1.x project deno.json tasks + lock", async () => {
132132
.toEqual({
133133
build: "deno run -A dev.ts build",
134134
check: "deno fmt --check && deno lint && deno check",
135-
preview: "deno run -A main.ts",
135+
preview: "deno run -A _fresh/server.js",
136136
start: "deno run -A --watch=static/,routes/ dev.ts",
137137
update: "deno run -A -r jsr:@fresh/update .",
138138
});

0 commit comments

Comments
 (0)