Skip to content
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
5 changes: 5 additions & 0 deletions .changeset/flat-bags-tap.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"sv": patch
---

feat(deno): support `$lib` alias in `deno`
3 changes: 3 additions & 0 deletions packages/sv/lib/cli/create.ts
Original file line number Diff line number Diff line change
Expand Up @@ -341,6 +341,9 @@ async function createProject(cwd: ProjectPath, options: Options) {

await addPnpmBuildDependencies(projectPath, packageManager, ['esbuild']);
if (packageManager) {
if (packageManager === 'deno') {
common.createDenoJson(directory);
}
await installDependencies(packageManager, projectPath);
await formatFiles({ packageManager, cwd: projectPath, filesToFormat: addOnFilesToFormat });
}
Expand Down
12 changes: 12 additions & 0 deletions packages/sv/lib/cli/utils/common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -190,3 +190,15 @@ export function errorAndExit(message: string) {
export const normalizePosix = (dir: string) => {
return path.posix.normalize(dir.replace(/\\/g, '/'));
};

export function createDenoJson(projectPath: string) {
const filePath = path.join(projectPath, 'deno.json');
const content = `{
"imports": {
"$lib/": "./src/lib/"
}
}
`;

fs.writeFileSync(filePath, content);
}
Loading