Skip to content
Draft
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 packages/sv/src/create/playground.ts
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ export function setupPlaygroundProject(
installDependencies: boolean
): void {
const mainFile = playground.files.find((file) => file.name === 'App.svelte');
if (!mainFile) throw new Error('Failed to find `App.svelte` entrypoint.');
if (!mainFile) throw new Error('Failed to find `App.svelte` entrypoint');

const dependencies = detectPlaygroundDependencies(playground.files);
for (const file of playground.files) {
Expand Down
9 changes: 7 additions & 2 deletions packages/sv/src/create/scripts/build-templates.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,19 @@
import fs from 'node:fs';
import { createRequire } from 'node:module';
import path from 'node:path';
import * as find from 'empathic/find';
import parser from 'gitignore-parser';
import { format } from 'oxfmt';
import { transform } from 'sucrase';
import oxfmtConfig from '../../../../../oxfmt.config.ts';

/** @import { File, LanguageType } from '../index.ts' */

const pnpmWorkspace = find.up('pnpm-workspace.yaml', { cwd: import.meta.dirname });
if (!pnpmWorkspace) {
throw new Error("This project must have a 'pnpm-workspace.yaml' file");
}
const ROOT = path.dirname(pnpmWorkspace);
const pkgRoot = path.resolve(import.meta.dirname, '..');
const require = createRequire(import.meta.url);
const createVitePath = path.dirname(require.resolve('create-vite/package.json'));
Expand Down Expand Up @@ -94,9 +100,8 @@ async function generate_templates(dist, shared) {
// to be able to develop and deploy the app from here, but have a different
// package.json in newly created projects (based on package.template.json)
if (name === 'package.template.json') {
const packagesDir = path.resolve(pkgRoot, '..', '..', '..');
const getVersion = (/** @type {string} */ pkgDir) => {
const pkgPath = path.join(packagesDir, pkgDir, 'package.json');
const pkgPath = path.join(ROOT, 'packages', pkgDir, 'package.json');
return JSON.parse(fs.readFileSync(pkgPath, 'utf8')).version;
};
const replaceWorkspace = (
Expand Down