Skip to content

Commit

Permalink
Improved preview
Browse files Browse the repository at this point in the history
  • Loading branch information
FlorianRappl committed May 10, 2021
1 parent 1eef2f4 commit 7beaa7c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/node.js.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ jobs:
- name: Build Package
run: npm run build
- name: Publish Package
run: npm publish
run: npm publish --tag next
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }}

Expand Down
8 changes: 6 additions & 2 deletions src/server/management/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,15 @@ import { existsSync } from 'fs';
import { Request, Response } from 'express';
import { KrasConfiguration, KrasServer } from '../types';

// this only exists to trick "ncc" -> otherwise it tries to resolve it
// directly at compile-time
const indexHtml = [0].map(() => 'index.html').pop();

function getClient(cwd: string, path: string) {
const fullPath = resolve(cwd, path);

if (!existsSync(fullPath)) {
const indexPath = resolve(fullPath, 'index.html');
const indexPath = resolve(fullPath, indexHtml);

if (existsSync(indexPath)) {
return indexPath;
Expand All @@ -18,7 +22,7 @@ function getClient(cwd: string, path: string) {
paths: [__dirname, process.cwd(), cwd],
});
const mainDir = dirname(mainPath);
return resolve(mainDir, 'index.html');
return resolve(mainDir, indexHtml);
} catch {}
}

Expand Down

0 comments on commit 7beaa7c

Please sign in to comment.