@inglorious/ssx 1.3.2 → 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.
Files changed (2) hide show
  1. package/bin/ssx.js +22 -15
  2. package/package.json +1 -1
package/bin/ssx.js CHANGED
@@ -27,19 +27,23 @@ program
27
27
  program
28
28
  .command("dev")
29
29
  .description("Start development server with hot reload")
30
- .option("-c, --config <file>", "config file", "site.config.js")
30
+ .option("-c, --config <file>", "config file path", "site.config.js")
31
31
  .option("-r, --root <dir>", "source root directory", "src")
32
32
  .option("-p, --port <port>", "dev server port", 3000)
33
33
  .action(async (options) => {
34
34
  const cwd = process.cwd()
35
- const config = resolveConfigFile(options.config)
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({
39
41
  ...options,
40
- config,
41
- rootDir: path.resolve(cwd, options.root),
42
- port: Number(options.port),
42
+ config: undefined,
43
+ root: undefined,
44
+ configPath,
45
+ rootDir,
46
+ port,
43
47
  })
44
48
  } catch (error) {
45
49
  console.error("Dev server failed:", error)
@@ -50,23 +54,26 @@ program
50
54
  program
51
55
  .command("build")
52
56
  .description("Build site from pages directory")
53
- .option("-c, --config <file>", "config file", "site.config.js")
57
+ .option("-c, --config <file>", "config file path", "site.config.js")
54
58
  .option("-r, --root <dir>", "source root directory", "src")
55
59
  .option("-o, --out <dir>", "output directory", "dist")
56
60
  .option("-i, --incremental", "enable incremental builds", true)
57
61
  .option("-f, --force", "force clean build (ignore cache)", false)
58
62
  .action(async (options) => {
59
63
  const cwd = process.cwd()
60
- const config = resolveConfigFile(options.config)
64
+ const rootDir = path.resolve(cwd, options.root)
65
+ const configPath = resolveConfigFile(rootDir, options.config)
66
+ const outDir = path.resolve(cwd, options.out)
61
67
 
62
68
  try {
63
69
  await build({
64
70
  ...options,
65
- config,
66
- rootDir: path.resolve(cwd, options.root),
67
- outDir: path.resolve(cwd, options.out),
68
- incremental: options.incremental, // Enabled by default
69
- clean: options.force,
71
+ config: undefined,
72
+ root: undefined,
73
+ out: undefined,
74
+ configPath,
75
+ rootDir,
76
+ outDir,
70
77
  })
71
78
 
72
79
  // if (result.skipped) {
@@ -82,10 +89,10 @@ program
82
89
 
83
90
  program.parse()
84
91
 
85
- function resolveConfigFile(configFile) {
92
+ function resolveConfigFile(rootDir, configFile) {
86
93
  if (configFile === "site.config.js") {
87
- const jsPath = path.resolve(process.cwd(), "site.config.js")
88
- const tsPath = path.resolve(process.cwd(), "site.config.ts")
94
+ const jsPath = path.resolve(rootDir, "site.config.js")
95
+ const tsPath = path.resolve(rootDir, "site.config.ts")
89
96
 
90
97
  if (!existsSync(jsPath) && existsSync(tsPath)) {
91
98
  return "site.config.ts"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@inglorious/ssx",
3
- "version": "1.3.2",
3
+ "version": "1.3.4",
4
4
  "description": "Server-Side-X. Xecution? Xperience? Who knows.",
5
5
  "author": "IceOnFire <antony.mistretta@gmail.com> (https://ingloriouscoderz.it)",
6
6
  "license": "MIT",