From ee7c039d45147ef74eb03c8617005c965b9446da Mon Sep 17 00:00:00 2001 From: Ourai Lin Date: Thu, 12 Sep 2024 01:15:33 +0800 Subject: [PATCH] feat: script for debugging site --- .knosys/scripts/command/site.js | 16 ++++++++++++++++ package.json | 4 +++- 2 files changed, 19 insertions(+), 1 deletion(-) create mode 100644 .knosys/scripts/command/site.js diff --git a/.knosys/scripts/command/site.js b/.knosys/scripts/command/site.js new file mode 100644 index 000000000..307ac043e --- /dev/null +++ b/.knosys/scripts/command/site.js @@ -0,0 +1,16 @@ +const { join: joinPath } = require('path'); +const { execSync } = require('child_process'); + +const { resolveRootPath } = require('../helper'); + +const siteRoot = joinPath(resolveRootPath(), '.knosys/sites/default'); + +module.exports = { + execute: subCmd => { + if (subCmd !== 'start') { + return; + } + + return execSync('npm run dev', { cwd: siteRoot, stdio: 'inherit' }); + }, +}; diff --git a/package.json b/package.json index 5e6f7eeb6..8b3d00976 100644 --- a/package.json +++ b/package.json @@ -10,6 +10,8 @@ "octokit": "^4.0.2" }, "scripts": { - "pmc": "node .knosys/scripts pmc" + "pmc": "node .knosys/scripts pmc", + "site": "node .knosys/scripts site", + "start": "npm run site start" } }