@pubinfo/cli 2.0.0-beta.5 → 2.0.0-beta.7

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.
@@ -1,5 +1,6 @@
1
1
  import { build } from '@pubinfo/vite';
2
2
  import { defineCommand, runMain } from 'citty';
3
+ import { merge } from 'lodash-es';
3
4
  import { loadConfig } from 'unconfig';
4
5
  import command$1 from './generate.mjs';
5
6
  import 'node:fs/promises';
@@ -13,7 +14,17 @@ const command = defineCommand({
13
14
  name: "build",
14
15
  description: "Build the application for production"
15
16
  },
16
- async run() {
17
+ args: {
18
+ watch: {
19
+ type: "boolean",
20
+ alias: "w"
21
+ },
22
+ mode: {
23
+ type: "string",
24
+ alias: "m"
25
+ }
26
+ },
27
+ async run({ args }) {
17
28
  await runMain(command$1);
18
29
  const { config } = await loadConfig({
19
30
  sources: [
@@ -22,9 +33,15 @@ const command = defineCommand({
22
33
  merge: false
23
34
  });
24
35
  const inlineConfig = typeof config.vite === "function" ? await config.vite({ mode: "production", command: "build" }) : config.vite;
25
- await build({
26
- ...inlineConfig
27
- });
36
+ await build(merge(
37
+ inlineConfig,
38
+ {
39
+ mode: args.mode,
40
+ build: {
41
+ watch: args.watch ? {} : null
42
+ }
43
+ }
44
+ ));
28
45
  }
29
46
  });
30
47
 
@@ -1,5 +1,6 @@
1
1
  import { createServer } from '@pubinfo/vite';
2
2
  import { defineCommand, runMain } from 'citty';
3
+ import { merge } from 'lodash-es';
3
4
  import { loadConfig } from 'unconfig';
4
5
  import command$1 from './generate.mjs';
5
6
  import 'node:fs/promises';
@@ -13,7 +14,19 @@ const command = defineCommand({
13
14
  name: "dev",
14
15
  description: "Run Pubinfo development server"
15
16
  },
16
- async run() {
17
+ args: {
18
+ host: {
19
+ type: "string"
20
+ },
21
+ port: {
22
+ type: "string"
23
+ },
24
+ mode: {
25
+ type: "string",
26
+ alias: "m"
27
+ }
28
+ },
29
+ async run({ args }) {
17
30
  await runMain(command$1);
18
31
  const { config } = await loadConfig({
19
32
  sources: [
@@ -22,11 +35,17 @@ const command = defineCommand({
22
35
  merge: false
23
36
  });
24
37
  const inlineConfig = typeof config.vite === "function" ? await config.vite({ mode: "development", command: "serve" }) : config.vite;
25
- const server = await createServer({
26
- ...inlineConfig,
27
- mode: "development",
28
- configFile: false
29
- });
38
+ const server = await createServer(merge(
39
+ inlineConfig,
40
+ {
41
+ server: {
42
+ host: args.host,
43
+ port: args.port ? Number(args.port) : void 0
44
+ },
45
+ mode: args.mode,
46
+ configFile: false
47
+ }
48
+ ));
30
49
  await server.listen();
31
50
  server.printUrls();
32
51
  server.bindCLIShortcuts({ print: true });
package/dist/index.mjs CHANGED
@@ -2,7 +2,7 @@ import { defineCommand, runMain as runMain$1 } from 'citty';
2
2
  import { fileURLToPath } from 'node:url';
3
3
 
4
4
  const name = "@pubinfo/cli";
5
- const version = "2.0.0-beta.5";
5
+ const version = "2.0.0-beta.7";
6
6
  const description = "CLI for Pubinfo";
7
7
  const cliPkg = {
8
8
  name: name,
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@pubinfo/cli",
3
3
  "type": "module",
4
- "version": "2.0.0-beta.5",
4
+ "version": "2.0.0-beta.7",
5
5
  "description": "CLI for Pubinfo",
6
6
  "exports": {
7
7
  ".": "./bin/pubinfo.mjs"
@@ -15,10 +15,11 @@
15
15
  "dist"
16
16
  ],
17
17
  "peerDependencies": {
18
- "@pubinfo/vite": "2.0.0-beta.5"
18
+ "@pubinfo/vite": "2.0.0-beta.7"
19
19
  },
20
20
  "dependencies": {
21
21
  "citty": "^0.1.6",
22
+ "lodash-es": "^4.17.21",
22
23
  "pathe": "^1.1.2",
23
24
  "unconfig": "^7.3.0"
24
25
  },
@@ -26,7 +27,7 @@
26
27
  "@types/node": "^22.13.9",
27
28
  "unbuild": "^3.5.0",
28
29
  "unplugin-purge-polyfills": "^0.0.7",
29
- "@pubinfo/vite": "2.0.0-beta.5"
30
+ "@pubinfo/vite": "2.0.0-beta.7"
30
31
  },
31
32
  "scripts": {
32
33
  "stub": "unbuild --stub",