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