Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add root project import in import_map #471

Closed
wants to merge 16 commits into from
Closed
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
8 changes: 8 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,14 @@ jobs:
if: startsWith(matrix.os, 'windows')
run: set "PUPPETEER_PRODUCT=chrome" && deno run -A --unstable https://deno.land/x/puppeteer@16.2.0/install.ts

# Workaround for using temporary directory on Windows
# https://github.com/denoland/fresh/pull/471#issuecomment-1563984847
- name: Set the TMP/TEMP environment variable (Windows)
if: startsWith(matrix.os, 'windows')
run: |
echo "TEMP=$env:USERPROFILE\AppData\Local\Temp" >> $env:GITHUB_ENV
echo "TMP=$env:USERPROFILE\AppData\Local\Temp" >> $env:GITHUB_ENV

- name: Run tests
run: deno test -A

Expand Down
4 changes: 2 additions & 2 deletions init.ts
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ CMD ["run", "-A", "main.ts"]

const ROUTES_INDEX_TSX = `import { Head } from "$fresh/runtime.ts";
import { useSignal } from "@preact/signals";
import Counter from "../islands/Counter.tsx";
import Counter from "@/islands/Counter.tsx";

export default function Home() {
const count = useSignal(3);
Expand Down Expand Up @@ -193,7 +193,7 @@ await Deno.writeTextFile(
);

const ISLANDS_COUNTER_TSX = `import type { Signal } from "@preact/signals";
import { Button } from "../components/Button.tsx";
import { Button } from "@/components/Button.tsx";

interface CounterProps {
count: Signal<number>;
Expand Down
1 change: 1 addition & 0 deletions src/dev/imports.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ export const RECOMMENDED_TWIND_VERSION = "0.16.19";
export const RECOMMENDED_STD_VERSION = "0.193.0";

export function freshImports(imports: Record<string, string>) {
imports["@/"] = "./";
imports["$fresh/"] = new URL("../../", import.meta.url).href;
imports["preact"] = `https://esm.sh/preact@${RECOMMENDED_PREACT_VERSION}`;
imports["preact/"] = `https://esm.sh/preact@${RECOMMENDED_PREACT_VERSION}/`;
Expand Down
Loading