@luna-park/plugin 1.4.1 → 1.4.2
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/bin/preview.js +50 -0
- package/package.json +2 -2
package/bin/preview.js
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { parseArgs } from "node:util";
|
|
3
|
+
|
|
4
|
+
import { resolve } from "path";
|
|
5
|
+
|
|
6
|
+
import { startPreviewServer } from "../dist/preview.mjs";
|
|
7
|
+
|
|
8
|
+
const cwd = process.cwd();
|
|
9
|
+
|
|
10
|
+
// Parse CLI arguments
|
|
11
|
+
const { values } = parseArgs({
|
|
12
|
+
options: {
|
|
13
|
+
dist: {
|
|
14
|
+
default: "dist",
|
|
15
|
+
short: "d",
|
|
16
|
+
type: "string"
|
|
17
|
+
},
|
|
18
|
+
help: {
|
|
19
|
+
default: false,
|
|
20
|
+
short: "h",
|
|
21
|
+
type: "boolean"
|
|
22
|
+
},
|
|
23
|
+
port: {
|
|
24
|
+
default: "2084",
|
|
25
|
+
short: "p",
|
|
26
|
+
type: "string"
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
if (values.help) {
|
|
32
|
+
console.log(`
|
|
33
|
+
Usage: luna-preview [options]
|
|
34
|
+
|
|
35
|
+
Options:
|
|
36
|
+
-p, --port <port> Port to run the server on (default: 2084)
|
|
37
|
+
-d, --dist <dir> Distribution directory to serve (default: dist)
|
|
38
|
+
-h, --help Show this help message
|
|
39
|
+
`);
|
|
40
|
+
process.exit(0);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
const dist = resolve(cwd, values.dist);
|
|
44
|
+
const port = parseInt(values.port);
|
|
45
|
+
|
|
46
|
+
startPreviewServer({
|
|
47
|
+
dist,
|
|
48
|
+
externals: ["vue", "vue-router", "@luna-park/design"],
|
|
49
|
+
port
|
|
50
|
+
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@luna-park/plugin",
|
|
3
|
-
"version": "1.4.
|
|
3
|
+
"version": "1.4.2",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Plugin helper for Luna Park.",
|
|
6
6
|
"homepage": "https://luna-park.app",
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
"module": "./dist/index.mjs",
|
|
28
28
|
"types": "./dist/index.d.mts",
|
|
29
29
|
"bin": {
|
|
30
|
-
"luna-preview": "./bin/preview.
|
|
30
|
+
"luna-preview": "./bin/preview.js"
|
|
31
31
|
},
|
|
32
32
|
"files": [
|
|
33
33
|
"dist/**"
|