@hagicode/hagiscript 0.1.14 → 0.1.15-dev.94.1.64ce9f6
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/README.md +248 -155
- package/dist/cli.js +4 -0
- package/dist/cli.js.map +1 -1
- package/dist/commands/manifest-commands.d.ts +2 -0
- package/dist/commands/manifest-commands.js +136 -0
- package/dist/commands/manifest-commands.js.map +1 -0
- package/dist/commands/npm-sync-commands.js +63 -6
- package/dist/commands/npm-sync-commands.js.map +1 -1
- package/dist/commands/server-commands.d.ts +2 -0
- package/dist/commands/server-commands.js +404 -0
- package/dist/commands/server-commands.js.map +1 -0
- package/dist/index.d.ts +7 -3
- package/dist/index.js +7 -3
- package/dist/index.js.map +1 -1
- package/dist/runtime/manifest-manager.d.ts +57 -0
- package/dist/runtime/manifest-manager.js +213 -0
- package/dist/runtime/manifest-manager.js.map +1 -0
- package/dist/runtime/npm-sync.d.ts +3 -1
- package/dist/runtime/npm-sync.js +31 -3
- package/dist/runtime/npm-sync.js.map +1 -1
- package/dist/runtime/pm2-manager.d.ts +5 -2
- package/dist/runtime/pm2-manager.js +181 -49
- package/dist/runtime/pm2-manager.js.map +1 -1
- package/dist/runtime/runtime-executor.d.ts +6 -0
- package/dist/runtime/runtime-executor.js +55 -0
- package/dist/runtime/runtime-executor.js.map +1 -1
- package/dist/runtime/runtime-manager.d.ts +9 -0
- package/dist/runtime/runtime-manager.js +146 -16
- package/dist/runtime/runtime-manager.js.map +1 -1
- package/dist/runtime/runtime-manifest.d.ts +5 -1
- package/dist/runtime/runtime-manifest.js +23 -8
- package/dist/runtime/runtime-manifest.js.map +1 -1
- package/dist/runtime/runtime-paths.d.ts +11 -1
- package/dist/runtime/runtime-paths.js +41 -5
- package/dist/runtime/runtime-paths.js.map +1 -1
- package/dist/runtime/server-config.d.ts +21 -0
- package/dist/runtime/server-config.js +169 -0
- package/dist/runtime/server-config.js.map +1 -0
- package/dist/runtime/server-manager.d.ts +104 -0
- package/dist/runtime/server-manager.js +899 -0
- package/dist/runtime/server-manager.js.map +1 -0
- package/dist/runtime/server-version-state.d.ts +43 -0
- package/dist/runtime/server-version-state.js +156 -0
- package/dist/runtime/server-version-state.js.map +1 -0
- package/dist/runtime/tool-sync-catalog.config.json +0 -18
- package/dist/runtime/tool-sync-catalog.js +1 -1
- package/dist/runtime/tool-sync-catalog.js.map +1 -1
- package/package.json +23 -2
- package/runtime/lib/runtime-script-lib.mjs +128 -69
- package/runtime/manifest.yaml +96 -81
- package/runtime/scripts/configure-code-server.mjs +14 -3
- package/runtime/scripts/configure-omniroute.mjs +15 -5
- package/runtime/scripts/install-code-server.mjs +20 -23
- package/runtime/scripts/install-omniroute.mjs +19 -22
- package/runtime/scripts/install-pm2.mjs +39 -0
- package/runtime/scripts/remove-pm2.mjs +25 -0
- package/runtime/templates/code-server-config.yaml +0 -5
- package/runtime/templates/omniroute-config.yaml +0 -4
|
@@ -5,46 +5,43 @@ import {
|
|
|
5
5
|
ensureDirectory,
|
|
6
6
|
installVendoredPackage,
|
|
7
7
|
materializeTemplate,
|
|
8
|
+
quoteYamlString,
|
|
8
9
|
readRuntimeScriptContext,
|
|
9
10
|
writeCommandWrapper,
|
|
10
|
-
writeComponentMarker
|
|
11
|
-
writeManagedPackageLauncher
|
|
11
|
+
writeComponentMarker
|
|
12
12
|
} from "../lib/runtime-script-lib.mjs"
|
|
13
13
|
|
|
14
14
|
const context = readRuntimeScriptContext()
|
|
15
15
|
const currentRoot = path.join(context.componentRoot, "current")
|
|
16
|
-
const launcherPath = path.join(currentRoot, "omniroute-launcher.mjs")
|
|
17
16
|
const configPath = path.join(context.componentConfigDir, "config.yaml")
|
|
17
|
+
const wrapperPath = path.join(
|
|
18
|
+
currentRoot,
|
|
19
|
+
process.platform === "win32" ? "omniroute.cmd" : "omniroute.sh"
|
|
20
|
+
)
|
|
18
21
|
|
|
19
22
|
await ensureDirectory(currentRoot)
|
|
20
|
-
await materializeTemplate("omniroute-config.yaml", configPath, {
|
|
21
|
-
RUNTIME_ROOT: context.runtimeHome,
|
|
22
|
-
DATA_DIR: context.runtimeDataHome,
|
|
23
|
-
LOGS_DIR: context.componentLogsDir
|
|
24
|
-
})
|
|
25
23
|
const installedPackage = await installVendoredPackage(context, {
|
|
26
24
|
prefixRoot: currentRoot,
|
|
27
25
|
packageName: "omniroute",
|
|
28
26
|
entrypointRelativePath: path.join("bin", "omniroute.mjs")
|
|
29
27
|
})
|
|
30
|
-
await
|
|
31
|
-
|
|
28
|
+
await materializeTemplate(
|
|
29
|
+
"omniroute-config.yaml",
|
|
30
|
+
configPath,
|
|
32
31
|
{
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
PORT: "39001"
|
|
40
|
-
},
|
|
41
|
-
serviceKind: "omniroute"
|
|
42
|
-
}
|
|
32
|
+
RUNTIME_ROOT: quoteYamlString(context.runtimeHome),
|
|
33
|
+
LISTEN_ADDR: quoteYamlString("127.0.0.1:39001"),
|
|
34
|
+
DATA_DIR: quoteYamlString(context.runtimeDataHome),
|
|
35
|
+
LOGS_DIR: quoteYamlString(context.componentLogsDir)
|
|
36
|
+
},
|
|
37
|
+
path.join(currentRoot, "templates")
|
|
43
38
|
)
|
|
44
|
-
await writeCommandWrapper(context.binDir, "omniroute",
|
|
39
|
+
await writeCommandWrapper(context.binDir, "omniroute", wrapperPath, {
|
|
40
|
+
baseArgs: ["--config", configPath, "--no-open"]
|
|
41
|
+
})
|
|
45
42
|
await writeComponentMarker(context, {
|
|
46
43
|
configPath,
|
|
47
|
-
|
|
44
|
+
wrapperPath,
|
|
48
45
|
entrypointPath: installedPackage.entrypointPath,
|
|
49
46
|
vendoredReleaseRepository: installedPackage.releaseRepository,
|
|
50
47
|
vendoredReleaseTag: installedPackage.releaseTag,
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import process from "node:process"
|
|
3
|
+
import {
|
|
4
|
+
ensureDirectory,
|
|
5
|
+
readRuntimeScriptContext,
|
|
6
|
+
runManagedCommand,
|
|
7
|
+
writeComponentMarker
|
|
8
|
+
} from "../lib/runtime-script-lib.mjs"
|
|
9
|
+
|
|
10
|
+
const context = readRuntimeScriptContext()
|
|
11
|
+
const npmExecPath = process.env.npm_execpath?.trim()
|
|
12
|
+
|
|
13
|
+
if (!npmExecPath) {
|
|
14
|
+
throw new Error("Missing npm_execpath for managed pm2 installation")
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
const versionSpec = context.pm2VersionOverride || context.componentVersion || "*"
|
|
18
|
+
const installSpec = versionSpec === "*" ? "pm2" : `pm2@${versionSpec}`
|
|
19
|
+
const args = ["install", "--global", installSpec, "--prefix", context.runtimeNpmPrefix]
|
|
20
|
+
|
|
21
|
+
if (context.npmRegistryMirror) {
|
|
22
|
+
args.push("--registry", context.npmRegistryMirror)
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
await ensureDirectory(context.componentRoot)
|
|
26
|
+
await ensureDirectory(context.runtimeNpmPrefix)
|
|
27
|
+
await runManagedCommand(npmExecPath, args, {
|
|
28
|
+
env: process.env,
|
|
29
|
+
cwd: context.runtimeHome
|
|
30
|
+
})
|
|
31
|
+
|
|
32
|
+
await writeComponentMarker(context, {
|
|
33
|
+
packageName: "pm2",
|
|
34
|
+
installSpec,
|
|
35
|
+
npmPrefix: context.runtimeNpmPrefix,
|
|
36
|
+
ownership: "runtime-managed-package"
|
|
37
|
+
})
|
|
38
|
+
|
|
39
|
+
process.stdout.write(`Prepared pm2 in ${context.runtimeNpmPrefix}\n`)
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import process from "node:process"
|
|
3
|
+
import { readRuntimeScriptContext, runManagedCommand } from "../lib/runtime-script-lib.mjs"
|
|
4
|
+
|
|
5
|
+
const context = readRuntimeScriptContext()
|
|
6
|
+
const npmExecPath = process.env.npm_execpath?.trim()
|
|
7
|
+
|
|
8
|
+
if (!npmExecPath) {
|
|
9
|
+
throw new Error("Missing npm_execpath for managed pm2 removal")
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
try {
|
|
13
|
+
await runManagedCommand(
|
|
14
|
+
npmExecPath,
|
|
15
|
+
["uninstall", "--global", "pm2", "--prefix", context.runtimeNpmPrefix],
|
|
16
|
+
{
|
|
17
|
+
env: process.env,
|
|
18
|
+
cwd: context.runtimeHome
|
|
19
|
+
}
|
|
20
|
+
)
|
|
21
|
+
} catch {
|
|
22
|
+
process.stdout.write(`pm2 uninstall skipped for ${context.runtimeNpmPrefix}\n`)
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
process.stdout.write(`Removed pm2 from ${context.runtimeNpmPrefix}\n`)
|