@inglorious/ssx 1.3.3 → 1.3.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/bin/ssx.js +13 -9
- package/package.json +1 -1
package/bin/ssx.js
CHANGED
|
@@ -32,7 +32,9 @@ program
|
|
|
32
32
|
.option("-p, --port <port>", "dev server port", 3000)
|
|
33
33
|
.action(async (options) => {
|
|
34
34
|
const cwd = process.cwd()
|
|
35
|
-
const
|
|
35
|
+
const rootDir = path.resolve(cwd, options.root)
|
|
36
|
+
const configPath = resolveConfigFile(rootDir, options.config)
|
|
37
|
+
const port = Number(options.port)
|
|
36
38
|
|
|
37
39
|
try {
|
|
38
40
|
await dev({
|
|
@@ -40,8 +42,8 @@ program
|
|
|
40
42
|
config: undefined,
|
|
41
43
|
root: undefined,
|
|
42
44
|
configPath,
|
|
43
|
-
rootDir
|
|
44
|
-
port
|
|
45
|
+
rootDir,
|
|
46
|
+
port,
|
|
45
47
|
})
|
|
46
48
|
} catch (error) {
|
|
47
49
|
console.error("Dev server failed:", error)
|
|
@@ -59,7 +61,9 @@ program
|
|
|
59
61
|
.option("-f, --force", "force clean build (ignore cache)", false)
|
|
60
62
|
.action(async (options) => {
|
|
61
63
|
const cwd = process.cwd()
|
|
62
|
-
const
|
|
64
|
+
const rootDir = path.resolve(cwd, options.root)
|
|
65
|
+
const configPath = resolveConfigFile(rootDir, options.config)
|
|
66
|
+
const outDir = path.resolve(cwd, options.out)
|
|
63
67
|
|
|
64
68
|
try {
|
|
65
69
|
await build({
|
|
@@ -68,8 +72,8 @@ program
|
|
|
68
72
|
root: undefined,
|
|
69
73
|
out: undefined,
|
|
70
74
|
configPath,
|
|
71
|
-
rootDir
|
|
72
|
-
outDir
|
|
75
|
+
rootDir,
|
|
76
|
+
outDir,
|
|
73
77
|
})
|
|
74
78
|
|
|
75
79
|
// if (result.skipped) {
|
|
@@ -85,10 +89,10 @@ program
|
|
|
85
89
|
|
|
86
90
|
program.parse()
|
|
87
91
|
|
|
88
|
-
function resolveConfigFile(configFile) {
|
|
92
|
+
function resolveConfigFile(rootDir, configFile) {
|
|
89
93
|
if (configFile === "site.config.js") {
|
|
90
|
-
const jsPath = path.resolve(
|
|
91
|
-
const tsPath = path.resolve(
|
|
94
|
+
const jsPath = path.resolve(rootDir, "site.config.js")
|
|
95
|
+
const tsPath = path.resolve(rootDir, "site.config.ts")
|
|
92
96
|
|
|
93
97
|
if (!existsSync(jsPath) && existsSync(tsPath)) {
|
|
94
98
|
return "site.config.ts"
|
package/package.json
CHANGED