@le-space/node 0.1.13 → 0.1.14
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/index.d.ts +2 -1
- package/index.js +30 -1
- package/package.json +4 -4
package/index.d.ts
CHANGED
|
@@ -414,8 +414,9 @@ interface RunResult {
|
|
|
414
414
|
}
|
|
415
415
|
declare function parseLastJsonObject(text: string): Record<string, unknown>;
|
|
416
416
|
declare function runSitePublishMode(env?: NodeJS.ProcessEnv): Promise<void>;
|
|
417
|
+
declare function runDomainLinkMode(env?: NodeJS.ProcessEnv): Promise<void>;
|
|
417
418
|
declare function runProbeMode(env?: NodeJS.ProcessEnv): Promise<void>;
|
|
418
419
|
declare function runBootstrapEnvMode(env?: NodeJS.ProcessEnv): Promise<void>;
|
|
419
420
|
declare function runSiteMode(env?: NodeJS.ProcessEnv): Promise<void>;
|
|
420
421
|
|
|
421
|
-
export { type DeployConfigurationResult, type DeployExecutorDependencies, type DeployMetadataResult, type DeployOutputResult, type DeployPlan, type ParsedRootfsRunnerInputs, type PrivateKeyIdentity, type RunResult, actionLog, appendGithubOutput, appendGithubSummary, booleanEnv, buildScaffoldDeployResult, createPrivateKeyIdentity, createPrivateKeySigner, emitDeployOutputs, emitGeocodedCrnOutputs, emitRootfsOutputs, executeDeployPlan, integerEnv, jsonEnv, main, optionalEnv, parseDeployPlan, parseLastJsonObject, parseRootfsRunnerInputs, requiredEnv, rootfsMain, runActionMode, runBootstrapEnvMode, runLocalCommand, runProbeMode, runRootfsMode, runSiteMode, runSitePublishMode };
|
|
422
|
+
export { type DeployConfigurationResult, type DeployExecutorDependencies, type DeployMetadataResult, type DeployOutputResult, type DeployPlan, type ParsedRootfsRunnerInputs, type PrivateKeyIdentity, type RunResult, actionLog, appendGithubOutput, appendGithubSummary, booleanEnv, buildScaffoldDeployResult, createPrivateKeyIdentity, createPrivateKeySigner, emitDeployOutputs, emitGeocodedCrnOutputs, emitRootfsOutputs, executeDeployPlan, integerEnv, jsonEnv, main, optionalEnv, parseDeployPlan, parseLastJsonObject, parseRootfsRunnerInputs, requiredEnv, rootfsMain, runActionMode, runBootstrapEnvMode, runDomainLinkMode, runLocalCommand, runProbeMode, runRootfsMode, runSiteMode, runSitePublishMode };
|
package/index.js
CHANGED
|
@@ -2899,6 +2899,7 @@ async function runSitePublishMode(env = process2.env) {
|
|
|
2899
2899
|
const publishScript = optionalEnv("ALEPH_SITE_PUBLISH_SCRIPT", "go-peer/aleph/publish-static-site.py", env);
|
|
2900
2900
|
const siteDirectory = requiredEnv("ALEPH_SITE_DIRECTORY", env);
|
|
2901
2901
|
const pythonBin = optionalEnv("ALEPH_SITE_PYTHON", "python3", env);
|
|
2902
|
+
const alephBin = optionalEnv("ALEPH_SITE_ALEPH_BIN", "aleph", env);
|
|
2902
2903
|
const pin = optionalEnv("ALEPH_SITE_PIN", "true", env) === "true";
|
|
2903
2904
|
const publish = await runCapture(pythonBin, [publishScript, siteDirectory], { cwd: projectDir });
|
|
2904
2905
|
process2.stdout.write(publish.stdout);
|
|
@@ -2917,7 +2918,7 @@ async function runSitePublishMode(env = process2.env) {
|
|
|
2917
2918
|
await appendGithubOutput("url", `https://${cidV1}.ipfs.aleph.sh`, env);
|
|
2918
2919
|
let itemHash = "";
|
|
2919
2920
|
if (pin) {
|
|
2920
|
-
const pinResult = await runCapture(
|
|
2921
|
+
const pinResult = await runCapture(alephBin, ["file", "pin", cidV0], { cwd: projectDir });
|
|
2921
2922
|
if (pinResult.stdout) process2.stdout.write(pinResult.stdout);
|
|
2922
2923
|
if (pinResult.stderr) process2.stderr.write(pinResult.stderr);
|
|
2923
2924
|
if (pinResult.exitCode !== 0) {
|
|
@@ -2940,6 +2941,32 @@ async function runSitePublishMode(env = process2.env) {
|
|
|
2940
2941
|
`- Aleph item hash: \`${itemHash}\``
|
|
2941
2942
|
], env);
|
|
2942
2943
|
}
|
|
2944
|
+
async function runDomainLinkMode(env = process2.env) {
|
|
2945
|
+
const projectDir = optionalEnv("ALEPH_SITE_PROJECT_DIR", process2.cwd(), env);
|
|
2946
|
+
const domain = requiredEnv("ALEPH_SITE_DOMAIN", env);
|
|
2947
|
+
const itemHash = requiredEnv("ALEPH_SITE_ITEM_HASH", env);
|
|
2948
|
+
const catchAllPath = optionalEnv("ALEPH_SITE_DOMAIN_CATCH_ALL_PATH", "/index.html", env);
|
|
2949
|
+
const alephBin = optionalEnv("ALEPH_SITE_ALEPH_BIN", "aleph", env);
|
|
2950
|
+
const detach = await runCapture(alephBin, ["domain", "detach", domain, "--no-ask"], { cwd: projectDir });
|
|
2951
|
+
if (detach.stdout) process2.stdout.write(detach.stdout);
|
|
2952
|
+
if (detach.stderr) process2.stderr.write(detach.stderr);
|
|
2953
|
+
const attach = await runCapture(alephBin, ["domain", "attach", domain, "--item-hash", itemHash, "--catch-all-path", catchAllPath, "--no-ask"], { cwd: projectDir });
|
|
2954
|
+
if (attach.stdout) process2.stdout.write(attach.stdout);
|
|
2955
|
+
if (attach.stderr) process2.stderr.write(attach.stderr);
|
|
2956
|
+
if (attach.exitCode !== 0) {
|
|
2957
|
+
throw new Error(`aleph domain attach ${domain} failed with exit code ${attach.exitCode}`);
|
|
2958
|
+
}
|
|
2959
|
+
await appendGithubOutput("domain", domain, env);
|
|
2960
|
+
await appendGithubOutput("item_hash", itemHash, env);
|
|
2961
|
+
await appendGithubOutput("url", `https://${domain}`, env);
|
|
2962
|
+
await appendGithubSummary([
|
|
2963
|
+
"## Shared Site Runner",
|
|
2964
|
+
"",
|
|
2965
|
+
`- Linked domain: \`${domain}\``,
|
|
2966
|
+
`- Aleph item hash: \`${itemHash}\``,
|
|
2967
|
+
`- Catch-all path: \`${catchAllPath}\``
|
|
2968
|
+
], env);
|
|
2969
|
+
}
|
|
2943
2970
|
async function runProbeMode(env = process2.env) {
|
|
2944
2971
|
const addrs = mergedAddrs(env);
|
|
2945
2972
|
if (addrs.length === 0) throw new Error("No relay probe or browser bootstrap multiaddrs were supplied.");
|
|
@@ -2971,6 +2998,7 @@ async function runBootstrapEnvMode(env = process2.env) {
|
|
|
2971
2998
|
async function runSiteMode(env = process2.env) {
|
|
2972
2999
|
const mode = optionalEnv("ALEPH_VM_MODE", "site-publish", env);
|
|
2973
3000
|
if (mode === "site-publish") return await runSitePublishMode(env);
|
|
3001
|
+
if (mode === "site-domain-link") return await runDomainLinkMode(env);
|
|
2974
3002
|
if (mode === "relay-probe") return await runProbeMode(env);
|
|
2975
3003
|
if (mode === "bootstrap-env") return await runBootstrapEnvMode(env);
|
|
2976
3004
|
throw new Error(`Unsupported ALEPH_VM_MODE "${mode}" in shared site runner.`);
|
|
@@ -2998,6 +3026,7 @@ export {
|
|
|
2998
3026
|
rootfsMain,
|
|
2999
3027
|
runActionMode,
|
|
3000
3028
|
runBootstrapEnvMode,
|
|
3029
|
+
runDomainLinkMode,
|
|
3001
3030
|
runLocalCommand,
|
|
3002
3031
|
runProbeMode,
|
|
3003
3032
|
runRootfsMode,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@le-space/node",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.14",
|
|
4
4
|
"description": "Node and GitHub Actions adapters for shared Aleph tooling.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -16,9 +16,9 @@
|
|
|
16
16
|
"access": "public"
|
|
17
17
|
},
|
|
18
18
|
"dependencies": {
|
|
19
|
-
"@le-space/core": "0.1.
|
|
20
|
-
"@le-space/shared-types": "0.1.
|
|
21
|
-
"@le-space/rootfs": "0.1.
|
|
19
|
+
"@le-space/core": "0.1.14",
|
|
20
|
+
"@le-space/shared-types": "0.1.14",
|
|
21
|
+
"@le-space/rootfs": "0.1.14",
|
|
22
22
|
"ethers": "^6.15.0"
|
|
23
23
|
}
|
|
24
24
|
}
|