@raystack/chronicle 0.10.3 → 0.10.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli/index.js +2 -2
- package/package.json +1 -1
- package/src/cli/commands/dev.ts +2 -1
- package/src/server/api/ready.ts +13 -9
package/dist/cli/index.js
CHANGED
|
@@ -835,14 +835,14 @@ var buildCommand = new Command("build").description("Build for production").opti
|
|
|
835
835
|
// src/cli/commands/dev.ts
|
|
836
836
|
import chalk3 from "chalk";
|
|
837
837
|
import { Command as Command2 } from "commander";
|
|
838
|
-
var devCommand = new Command2("dev").description("Start development server").option("-p, --port <port>", "Port number", "3000").option("--config <path>", "Path to chronicle.yaml").option("--host <host>", "Host address", "localhost").action(async (options) => {
|
|
838
|
+
var devCommand = new Command2("dev").description("Start development server").option("-p, --port <port>", "Port number", "3000").option("--config <path>", "Path to chronicle.yaml").option("--host <host>", "Host address", "localhost").option("--preset <preset>", "Deploy preset (bun, node-server, etc.)").action(async (options) => {
|
|
839
839
|
const { config: config2, projectRoot, configPath } = await loadCLIConfig(options.config);
|
|
840
840
|
const port = parseInt(options.port, 10);
|
|
841
841
|
await linkContent(projectRoot, config2);
|
|
842
842
|
console.log(chalk3.cyan("Starting dev server..."));
|
|
843
843
|
const { createServer } = await import("vite");
|
|
844
844
|
const { createViteConfig: createViteConfig2 } = await Promise.resolve().then(() => (init_vite_config(), exports_vite_config));
|
|
845
|
-
const viteConfig = await createViteConfig2({ packageRoot: PACKAGE_ROOT, projectRoot, configPath });
|
|
845
|
+
const viteConfig = await createViteConfig2({ packageRoot: PACKAGE_ROOT, projectRoot, configPath, preset: options.preset });
|
|
846
846
|
const server = await createServer({
|
|
847
847
|
...viteConfig,
|
|
848
848
|
server: { ...viteConfig.server, port, host: options.host }
|
package/package.json
CHANGED
package/src/cli/commands/dev.ts
CHANGED
|
@@ -9,6 +9,7 @@ export const devCommand = new Command('dev')
|
|
|
9
9
|
.option('-p, --port <port>', 'Port number', '3000')
|
|
10
10
|
.option('--config <path>', 'Path to chronicle.yaml')
|
|
11
11
|
.option('--host <host>', 'Host address', 'localhost')
|
|
12
|
+
.option('--preset <preset>', 'Deploy preset (bun, node-server, etc.)')
|
|
12
13
|
.action(async options => {
|
|
13
14
|
const { config, projectRoot, configPath } = await loadCLIConfig(options.config);
|
|
14
15
|
const port = parseInt(options.port, 10);
|
|
@@ -20,7 +21,7 @@ export const devCommand = new Command('dev')
|
|
|
20
21
|
const { createServer } = await import('vite');
|
|
21
22
|
const { createViteConfig } = await import('@/server/vite-config');
|
|
22
23
|
|
|
23
|
-
const viteConfig = await createViteConfig({ packageRoot: PACKAGE_ROOT, projectRoot, configPath });
|
|
24
|
+
const viteConfig = await createViteConfig({ packageRoot: PACKAGE_ROOT, projectRoot, configPath, preset: options.preset });
|
|
24
25
|
const server = await createServer({
|
|
25
26
|
...viteConfig,
|
|
26
27
|
server: { ...viteConfig.server, port, host: options.host }
|
package/src/server/api/ready.ts
CHANGED
|
@@ -1,15 +1,19 @@
|
|
|
1
1
|
import { defineHandler } from 'nitro';
|
|
2
|
-
import { isSearchReady } from './search';
|
|
2
|
+
import { ensureIndex, isSearchReady } from './search';
|
|
3
|
+
import { LATEST_CONTEXT } from '@/lib/version-source';
|
|
3
4
|
|
|
4
|
-
export default defineHandler(() => {
|
|
5
|
-
|
|
5
|
+
export default defineHandler(async () => {
|
|
6
|
+
ensureIndex(LATEST_CONTEXT).catch(e => console.error('[search:index]', e));
|
|
6
7
|
|
|
7
|
-
if (!
|
|
8
|
-
return Response.
|
|
9
|
-
|
|
10
|
-
{
|
|
11
|
-
);
|
|
8
|
+
if (!isSearchReady()) {
|
|
9
|
+
return new Response(JSON.stringify({ status: 'not_ready', search: false }), {
|
|
10
|
+
status: 503,
|
|
11
|
+
headers: { 'Content-Type': 'application/json' },
|
|
12
|
+
});
|
|
12
13
|
}
|
|
13
14
|
|
|
14
|
-
return Response.
|
|
15
|
+
return new Response(JSON.stringify({ status: 'ready', search: true }), {
|
|
16
|
+
status: 200,
|
|
17
|
+
headers: { 'Content-Type': 'application/json' },
|
|
18
|
+
});
|
|
15
19
|
});
|