Skip to content
Merged
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
Empty file added .npmrc
Empty file.
2 changes: 1 addition & 1 deletion demo/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,6 @@
"@vitejs/plugin-react": "^3.1.0",
"create-impala": "workspace:*",
"typescript": "^4.9.3",
"vite": "^4.2.0"
"vite": "^6.0.3"
}
}
14 changes: 13 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,17 @@
"name": "impala-workspace",
"version": "0.0.0",
"private": true,
"license": "MIT"
"license": "MIT",
"scripts": {
"build": "pnpm run --filter @impalajs/* build"
},
"packageManager": "pnpm@9.14.4+sha512.c8180b3fbe4e4bca02c94234717896b5529740a6cbadf19fa78254270403ea2f27d4e1d46a08a0f56c89b63dc8ebfd3ee53326da720273794e6200fcf0d184ab",
"pnpm": {
"overrides": {
"@impalajs/core": "workspace:*",
"@impalajs/react": "workspace:*",
"@impalajs/preact": "workspace:*",
"create-impala": "workspace:*"
}
}
}
2 changes: 1 addition & 1 deletion packages/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
"devDependencies": {
"@types/express": "^4.17.17",
"tsup": "^6.7.0",
"vite": "^4.2.0"
"vite": "^6.0.3"
},
"peerDependencies": {
"vite": ">=4"
Expand Down
9 changes: 7 additions & 2 deletions packages/core/src/prerender.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ function isDynamicRoute(route: string) {
function stripExtension(path: string) {
return path.replace(/\.[^/.]+$/, "");
}

export async function prerender(root: string) {
const { render, routeModules, dataModules } = (await import(
path.resolve(root, "./dist/server/entry-server.js")
Expand All @@ -25,9 +26,13 @@ export async function prerender(root: string) {
path.resolve(root, "./dist/static/index.html"),
"utf-8"
);
const manifestPaths = [
"dist/static/manifest.json",
"dist/static/.vite/manifest.json",
].map((p) => path.resolve(root, p));

const manifestPath = path.resolve(root, "dist/static/manifest.json");
if (!existsSync(manifestPath)) {
const manifestPath = manifestPaths.find((p) => existsSync(p));
if (!manifestPath) {
console.error(
`No manifest found at ${manifestPath}. Did you build the app?`
);
Expand Down
1 change: 1 addition & 0 deletions packages/create-impala/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
"license": "MIT",
"devDependencies": {
"@clack/prompts": "^0.6.3",
"@types/node": "^18.15.7",
"degit": "^2.8.4",
"picocolors": "^1.0.0",
"tsup": "^6.7.0"
Expand Down
11 changes: 9 additions & 2 deletions packages/create-impala/src/cli.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { intro, outro, spinner, text, isCancel, select } from "@clack/prompts";
import degit from "degit";
import { existsSync } from "node:fs";
import { existsSync, promises as fs } from "node:fs";
import { join } from "node:path";
import color from "picocolors";

export async function createImpala() {
Expand Down Expand Up @@ -65,5 +66,11 @@ export async function createImpala() {

await emitter.clone(target);
s.stop("Set up your project");
outro(`You're all set!`);
const packageJsonPath = join(target, "package.json");
const packageJson = JSON.parse(await fs.readFile(packageJsonPath, "utf-8"));
packageJson.name = target.replaceAll(/[^a-zA-Z0-9-]/g, "-");
await fs.writeFile(packageJsonPath, JSON.stringify(packageJson, null, 2));
outro(
`You're all set!\n\nTo get started, run:\n\n cd ${target}\n npm install\n npm run dev`
);
}
Loading