Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,4 @@ jobs:
with:
project: "fresh"
entrypoint: "server.js"
root: "./www/_fresh/"
root: "./www/.fresh/"
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
_fresh/
.fresh/
.vite/
vendor/
node_modules/
Expand Down
2 changes: 1 addition & 1 deletion deno.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"release": "deno run -A tools/release.ts"
},
"exclude": [
"**/_fresh/*",
"**/.fresh/*",
"**/tmp/*",
"*/tests_OLD/**",
"**/vite.config.ts.*",
Expand Down
2 changes: 1 addition & 1 deletion docs/latest/advanced/builder.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ const builder = new Builder({
// The path to your server entry point. (Default: `<root>/main.ts`)
serverEntry?: string;
// Where to write generated files when doing a production build.
// (default: `<root>/_fresh/`)
// (default: `<root>/.fresh/`)
outDir?: string;
// Path to static file directory. (Default: `<root>/static/`)
staticDir?: string;
Expand Down
2 changes: 1 addition & 1 deletion docs/latest/deployment/deno-compile.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ platform without requiring Deno to be installed.
# Build your app first
$ deno task build
# Generate self-contained executable
deno compile --include static --include _fresh --include deno.json -A my-app _fresh/compiled-entry.js
deno compile --include static --include .fresh --include deno.json -A my-app .fresh/compiled-entry.js
```

The compiled entry supports two environment variables out of the box:
Expand Down
4 changes: 2 additions & 2 deletions docs/latest/deployment/docker.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,11 @@ WORKDIR /app

COPY . .
RUN deno task build
RUN deno cache _fresh/server.js
RUN deno cache .fresh/server.js

EXPOSE 8000

CMD ["serve", "-A", "_fresh/server.js"]
CMD ["serve", "-A", ".fresh/server.js"]
```

To build your Docker image inside of a Git repository:
Expand Down
10 changes: 5 additions & 5 deletions docs/latest/deployment/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,15 @@ deno task build
deno run -A dev.ts build
```

Once completed, it will have created a `_fresh` folder in the project directory
Once completed, it will have created a `.fresh` folder in the project directory
which contains the optimized assets.

> [info]: The `_fresh` folder should not be committed to git. Exclude it via
> [info]: The `.fresh` folder should not be committed to git. Exclude it via
> `.gitignore`.
>
> ```gitignore .gitignore
> # Ignore fresh build directory
> _fresh/
> .fresh/
> ```

## Running a production build
Expand All @@ -29,7 +29,7 @@ To run Fresh in production mode, run the `start` task:
```sh Terminal
deno task start
# or
deno serve -A _fresh/server.js
deno serve -A .fresh/server.js
```

Fresh will automatically pick up the optimized assets in the `_fresh` directory.
Fresh will automatically pick up the optimized assets in the `.fresh` directory.
4 changes: 2 additions & 2 deletions docs/latest/examples/migration-guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ To launch Fresh in production mode:

```diff
- deno run -A main.ts
+ deno serve -A _fresh/server.js
+ deno serve -A .fresh/server.js
```

You'll likely have that command inside your `deno.json` as a task. Update it
Expand All @@ -150,7 +150,7 @@ accordingly.
- "preview": "deno run -A main.ts"
+ "dev": "vite",
+ "build": "vite build",
+ "preview": "deno serve -A _fresh/server.js"
+ "preview": "deno serve -A .fresh/server.js"
}
}
```
Expand Down
2 changes: 1 addition & 1 deletion docs/latest/testing/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ const builder = await createBuilder({
});
await builder.build();

const { app } = await import("./path/to/app/_fresh/server.js");
const { app } = await import("./path/to/app/.fresh/server.js");

Deno.test("My Test", async () => {
const handler = app.handler();
Expand Down
2 changes: 1 addition & 1 deletion packages/fresh/src/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -362,7 +362,7 @@ export class App<State> {
DENO_DEPLOYMENT_ID !== undefined
) {
throw new Error(
`Could not find _fresh directory. Maybe you forgot to run "deno task build"?`,
`Could not find .fresh directory. Maybe you forgot to run "deno task build"?`,
);
} else {
buildCache = new MockBuildCache([], this.config.mode);
Expand Down
4 changes: 2 additions & 2 deletions packages/fresh/src/dev/builder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ export interface BuildOptions {
*
* This can be an absolute path, a file URL or a relative path.
* Relative paths are resolved against the `root` option.
* @default "_fresh"
* @default ".fresh"
*/
outDir?: string;
/**
Expand Down Expand Up @@ -118,7 +118,7 @@ export class Builder<State = any> {
constructor(options?: BuildOptions) {
const root = parseDirPath(options?.root ?? ".", Deno.cwd());
const serverEntry = parseDirPath(options?.serverEntry ?? "main.ts", root);
const outDir = parseDirPath(options?.outDir ?? "_fresh", root);
const outDir = parseDirPath(options?.outDir ?? ".fresh", root);
const staticDir = parseDirPath(options?.staticDir ?? "static", root);
const islandDir = parseDirPath(options?.islandDir ?? "islands", root);
const routeDir = parseDirPath(options?.routeDir ?? "routes", root);
Expand Down
8 changes: 4 additions & 4 deletions packages/fresh/src/dev/builder_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -489,7 +489,7 @@ export const app = new App()
await new Builder({ root: tmp }).build();

await withChildProcessServer(
{ cwd: tmp, args: ["serve", "-A", "_fresh/server.js"] },
{ cwd: tmp, args: ["serve", "-A", ".fresh/server.js"] },
async (address) => {
let res = await fetch(`${address}/foo.txt`);
expect(await res.text()).toEqual("ok");
Expand Down Expand Up @@ -519,7 +519,7 @@ export const app = new App()
await new Builder({ root: tmp, serverEntry: "other.ts" }).build();

await withChildProcessServer(
{ cwd: tmp, args: ["serve", "-A", "--port=0", "_fresh/server.js"] },
{ cwd: tmp, args: ["serve", "-A", "--port=0", ".fresh/server.js"] },
async (address) => {
const res = await fetch(`${address}`);
expect(await res.text()).toEqual("ok");
Expand Down Expand Up @@ -714,10 +714,10 @@ export const app = new App()
"--include",
"static/",
"--include",
"_fresh",
".fresh",
"--output",
outBin,
path.join("_fresh", "compiled-entry.js"),
path.join(".fresh", "compiled-entry.js"),
],
cwd: tmp,
}).output();
Expand Down
10 changes: 5 additions & 5 deletions packages/init/src/init.ts
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ export async function initProject(
.env.local

# Fresh build directory
_fresh/
.fresh/
# npm + other dependencies
node_modules/
vendor/
Expand All @@ -167,11 +167,11 @@ ENV DENO_DEPLOYMENT_ID=\${GIT_REVISION}
WORKDIR /app

COPY . .
RUN deno cache _fresh/server.js
RUN deno cache .fresh/server.js

EXPOSE 8000

CMD ["serve", "-A", "_fresh/server.js"]
CMD ["serve", "-A", ".fresh/server.js"]

`;
await writeFile("Dockerfile", DOCKERFILE_TEXT);
Expand Down Expand Up @@ -543,15 +543,15 @@ if (Deno.args.includes("build")) {
check: "deno fmt --check . && deno lint . && deno check",
dev: "deno run -A --watch=static/,routes/ dev.ts",
build: "deno run -A dev.ts build",
start: "deno serve -A _fresh/server.js",
start: "deno serve -A .fresh/server.js",
update: "deno run -A -r jsr:@fresh/update .",
},
lint: {
rules: {
tags: ["fresh", "recommended"],
},
},
exclude: ["**/_fresh/*"],
exclude: ["**/.fresh/*"],
imports: {
"fresh": `jsr:@fresh/core@^${freshVersion}`,
"preact": `npm:preact@^${PREACT_VERSION}`,
Expand Down
2 changes: 1 addition & 1 deletion packages/plugin-vite/deno.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"demo": "vite demo",
"debug": "deno run -A --inspect-brk npm:vite demo",
"demo:build": "vite build demo",
"demo:start": "cd demo && deno serve -A _fresh/server.js"
"demo:start": "cd demo && deno serve -A .fresh/server.js"
},
"imports": {
"@babel/core": "npm:@babel/core@^7.28.0",
Expand Down
4 changes: 2 additions & 2 deletions packages/plugin-vite/src/mod.ts
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ export function fresh(config?: FreshViteConfig): Plugin[] {
manifest: true,

outDir: config.environments?.client?.build?.outDir ??
"_fresh/client",
".fresh/client",
rollupOptions: {
preserveEntrySignatures: "strict",
input: {
Expand All @@ -116,7 +116,7 @@ export function fresh(config?: FreshViteConfig): Plugin[] {
copyPublicDir: false,

outDir: config.environments?.ssr?.build?.outDir ??
"_fresh/server",
".fresh/server",
rollupOptions: {
onwarn(warning, handler) {
// Ignore "use client"; warnings
Expand Down
2 changes: 1 addition & 1 deletion packages/plugin-vite/tests/build_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -455,7 +455,7 @@ Deno.test({

// Read the generated server.js to check asset paths
const serverJs = await Deno.readTextFile(
path.join(res.tmp, "_fresh", "server.js"),
path.join(res.tmp, ".fresh", "server.js"),
);

// Asset paths should include the base path /my-app/
Expand Down
10 changes: 6 additions & 4 deletions packages/plugin-vite/tests/test_utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,9 @@ async function copyDir(from: string, to: string) {
const entries = walk(from, {
includeFiles: true,
includeDirs: false,
skip: [/([\\/]+(_fresh|node_modules|vendor)[\\/]+|[\\/]+vite\.config\.ts)/],
skip: [
/([\\/]+(\.fresh|node_modules|vendor)[\\/]+|[\\/]+vite\.config\.ts)/,
],
});

for await (const entry of entries) {
Expand Down Expand Up @@ -150,12 +152,12 @@ export async function buildVite(
environments: {
ssr: {
build: {
outDir: path.join(tmp.dir, "_fresh", "server"),
outDir: path.join(tmp.dir, ".fresh", "server"),
},
},
client: {
build: {
outDir: path.join(tmp.dir, "_fresh", "client"),
outDir: path.join(tmp.dir, ".fresh", "client"),
},
},
},
Expand Down Expand Up @@ -199,7 +201,7 @@ export async function launchProd(
{
cwd: options.cwd,
args: options.args ??
["serve", "-A", "--cached-only", "--port", "0", "_fresh/server.js"],
["serve", "-A", "--cached-only", "--port", "0", ".fresh/server.js"],
},
fn,
);
Expand Down
7 changes: 5 additions & 2 deletions packages/update/src/update.ts
Original file line number Diff line number Diff line change
Expand Up @@ -137,8 +137,11 @@ export async function updateProject(dir: string) {
tasks.check = "deno fmt --check && deno lint && deno check";
}

if (tasks.preview === "deno run -A main.ts") {
tasks.preview = "deno serve -A _fresh/server.js";
if (
tasks.preview === "deno run -A main.ts" ||
tasks.preview === "deno serve -A _fresh/server.js"
) {
tasks.preview = "deno serve -A .fresh/server.js";
}
}
});
Expand Down
2 changes: 1 addition & 1 deletion packages/update/src/update_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ Deno.test("update - 1.x project deno.json tasks + lock", async () => {
.toEqual({
build: "deno run -A dev.ts build",
check: "deno fmt --check && deno lint && deno check",
preview: "deno serve -A _fresh/server.js",
preview: "deno serve -A .fresh/server.js",
start: "deno run -A --watch=static/,routes/ dev.ts",
update: "deno run -A -r jsr:@fresh/update .",
});
Expand Down
2 changes: 1 addition & 1 deletion www/deno.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"tasks": {
"start": "deno serve -A _fresh/server.js",
"start": "deno serve -A .fresh/server.js",
"dev": "vite",
"build": "vite build"
},
Expand Down
4 changes: 2 additions & 2 deletions www/main_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ Deno.test("CORS should not set on GET /fresh-badge.svg", async () => {
await withChildProcessServer(
{
cwd: result.tmp,
args: ["serve", "-A", "--port", "0", "_fresh/server.js"],
args: ["serve", "-A", "--port", "0", ".fresh/server.js"],
},
async (address) => {
const resp = await fetch(`${address}/fresh-badge.svg`);
Expand All @@ -29,7 +29,7 @@ Deno.test({
await withChildProcessServer(
{
cwd: result.tmp,
args: ["serve", "-A", "--port", "0", "_fresh/server.js"],
args: ["serve", "-A", "--port", "0", ".fresh/server.js"],
},
async (address) => {
await withBrowser(async (page) => {
Expand Down
Loading