@mifune/agro 0.12.0 → 0.12.1
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/dist/agro.js +37 -15
- package/dist/oh.js +37 -15
- package/package.json +1 -1
package/dist/agro.js
CHANGED
|
@@ -230,6 +230,17 @@ function resolveRegistryHome(env = process.env, home = homedir(), warn) {
|
|
|
230
230
|
if (configured !== void 0) return { path: resolve(configured), configured: true };
|
|
231
231
|
return { path: home, configured: false };
|
|
232
232
|
}
|
|
233
|
+
function generationUserStateHome(generation, env, home, warn) {
|
|
234
|
+
const configured = aliasedEnvValue(env, "HOME", warn);
|
|
235
|
+
if (configured !== void 0) return resolve(configured);
|
|
236
|
+
return join(home, GENERATIONS[generation].userStateDir);
|
|
237
|
+
}
|
|
238
|
+
function resolveAgroUserStateHome(env = process.env, home = homedir(), warn) {
|
|
239
|
+
return generationUserStateHome("agro", env, home, warn);
|
|
240
|
+
}
|
|
241
|
+
function resolveLegacyUserStateHome(env = process.env, home = homedir(), warn) {
|
|
242
|
+
return generationUserStateHome("legacy", env, home, warn);
|
|
243
|
+
}
|
|
233
244
|
function resolveUserStateHome(env = process.env, home = homedir(), warn) {
|
|
234
245
|
const configured = aliasedEnvValue(env, "HOME", warn);
|
|
235
246
|
if (configured !== void 0) return resolve(configured);
|
|
@@ -4017,15 +4028,20 @@ function sourceDocsUrl(docsPath) {
|
|
|
4017
4028
|
import { existsSync as existsSync16, mkdirSync as mkdirSync7, readFileSync as readFileSync11, renameSync as renameSync5, unlinkSync as unlinkSync5, writeFileSync as writeFileSync8 } from "node:fs";
|
|
4018
4029
|
import { basename as basename6, dirname as dirname8, isAbsolute as isAbsolute2, join as join10, resolve as resolve10 } from "node:path";
|
|
4019
4030
|
var HOST_CONFIG_MODE = 420;
|
|
4020
|
-
function
|
|
4021
|
-
return
|
|
4031
|
+
function hostConfigPath(env = process.env, home) {
|
|
4032
|
+
return join10(resolveAgroUserStateHome(env, home), GENERATIONS.agro.configFile);
|
|
4033
|
+
}
|
|
4034
|
+
function legacyHostConfigPath(env = process.env, home) {
|
|
4035
|
+
return join10(resolveLegacyUserStateHome(env, home), GENERATIONS.legacy.configFile);
|
|
4022
4036
|
}
|
|
4023
|
-
function
|
|
4024
|
-
const
|
|
4025
|
-
|
|
4037
|
+
function readableHostConfigPath(env, home) {
|
|
4038
|
+
const path4 = hostConfigPath(env, home);
|
|
4039
|
+
if (existsSync16(path4)) return path4;
|
|
4040
|
+
const legacy = legacyHostConfigPath(env, home);
|
|
4041
|
+
return existsSync16(legacy) ? legacy : path4;
|
|
4026
4042
|
}
|
|
4027
|
-
function defaultHarnessRoot(env = process.env) {
|
|
4028
|
-
return
|
|
4043
|
+
function defaultHarnessRoot(env = process.env, home) {
|
|
4044
|
+
return resolveAgroUserStateHome(env, home);
|
|
4029
4045
|
}
|
|
4030
4046
|
function validateHostConfig(value) {
|
|
4031
4047
|
if (!value || typeof value !== "object" || Array.isArray(value)) {
|
|
@@ -4081,8 +4097,8 @@ function validateReceipts(value, field, noun) {
|
|
|
4081
4097
|
}
|
|
4082
4098
|
}
|
|
4083
4099
|
}
|
|
4084
|
-
function readHostConfig(env = process.env) {
|
|
4085
|
-
const path4 =
|
|
4100
|
+
function readHostConfig(env = process.env, home) {
|
|
4101
|
+
const path4 = readableHostConfigPath(env, home);
|
|
4086
4102
|
if (!existsSync16(path4)) return { version: 1 };
|
|
4087
4103
|
let raw;
|
|
4088
4104
|
try {
|
|
@@ -4099,8 +4115,8 @@ function readHostConfig(env = process.env) {
|
|
|
4099
4115
|
}
|
|
4100
4116
|
return validateHostConfig(parsed);
|
|
4101
4117
|
}
|
|
4102
|
-
function writeHostConfig(config, env = process.env) {
|
|
4103
|
-
const path4 = hostConfigPath(env);
|
|
4118
|
+
function writeHostConfig(config, env = process.env, home) {
|
|
4119
|
+
const path4 = hostConfigPath(env, home);
|
|
4104
4120
|
const validated = validateHostConfig({ ...config, version: 1 });
|
|
4105
4121
|
const body = `${JSON.stringify(validated, null, 2)}
|
|
4106
4122
|
`;
|
|
@@ -4109,6 +4125,7 @@ function writeHostConfig(config, env = process.env) {
|
|
|
4109
4125
|
try {
|
|
4110
4126
|
writeFileSync8(tmp, body, { mode: HOST_CONFIG_MODE, encoding: "utf8" });
|
|
4111
4127
|
renameSync5(tmp, path4);
|
|
4128
|
+
retireLegacyHostConfig(env, home, path4);
|
|
4112
4129
|
} catch (error) {
|
|
4113
4130
|
try {
|
|
4114
4131
|
unlinkSync5(tmp);
|
|
@@ -4117,11 +4134,16 @@ function writeHostConfig(config, env = process.env) {
|
|
|
4117
4134
|
throw error;
|
|
4118
4135
|
}
|
|
4119
4136
|
}
|
|
4120
|
-
function resolveHarnessRoot(explicit, env = process.env) {
|
|
4137
|
+
function resolveHarnessRoot(explicit, env = process.env, home) {
|
|
4121
4138
|
if (typeof explicit === "string" && explicit !== "") return resolve10(explicit);
|
|
4122
|
-
const configured = readHostConfig(env).harnessRoot;
|
|
4139
|
+
const configured = readHostConfig(env, home).harnessRoot;
|
|
4123
4140
|
if (typeof configured === "string" && configured !== "") return resolve10(configured);
|
|
4124
|
-
return defaultHarnessRoot(env);
|
|
4141
|
+
return defaultHarnessRoot(env, home);
|
|
4142
|
+
}
|
|
4143
|
+
function retireLegacyHostConfig(env, home, written) {
|
|
4144
|
+
const legacy = legacyHostConfigPath(env, home);
|
|
4145
|
+
if (legacy === written || !existsSync16(legacy)) return;
|
|
4146
|
+
unlinkSync5(legacy);
|
|
4125
4147
|
}
|
|
4126
4148
|
function fieldError2(path4, requirement) {
|
|
4127
4149
|
return new Error(`${GENERATIONS.agro.configFile}: ${path4} ${requirement}`);
|
|
@@ -5602,7 +5624,7 @@ function fetchRemoteSource(opts) {
|
|
|
5602
5624
|
}
|
|
5603
5625
|
|
|
5604
5626
|
// src/cli.ts
|
|
5605
|
-
var VERSION = true ? "0.12.
|
|
5627
|
+
var VERSION = true ? "0.12.1" : "0.0.0-dev";
|
|
5606
5628
|
var DEFAULT_SOURCE_OH_DIR = resolve14(
|
|
5607
5629
|
dirname10(fileURLToPath(import.meta.url)),
|
|
5608
5630
|
"../.."
|
package/dist/oh.js
CHANGED
|
@@ -230,6 +230,17 @@ function resolveRegistryHome(env = process.env, home = homedir(), warn) {
|
|
|
230
230
|
if (configured !== void 0) return { path: resolve(configured), configured: true };
|
|
231
231
|
return { path: home, configured: false };
|
|
232
232
|
}
|
|
233
|
+
function generationUserStateHome(generation, env, home, warn) {
|
|
234
|
+
const configured = aliasedEnvValue(env, "HOME", warn);
|
|
235
|
+
if (configured !== void 0) return resolve(configured);
|
|
236
|
+
return join(home, GENERATIONS[generation].userStateDir);
|
|
237
|
+
}
|
|
238
|
+
function resolveAgroUserStateHome(env = process.env, home = homedir(), warn) {
|
|
239
|
+
return generationUserStateHome("agro", env, home, warn);
|
|
240
|
+
}
|
|
241
|
+
function resolveLegacyUserStateHome(env = process.env, home = homedir(), warn) {
|
|
242
|
+
return generationUserStateHome("legacy", env, home, warn);
|
|
243
|
+
}
|
|
233
244
|
function resolveUserStateHome(env = process.env, home = homedir(), warn) {
|
|
234
245
|
const configured = aliasedEnvValue(env, "HOME", warn);
|
|
235
246
|
if (configured !== void 0) return resolve(configured);
|
|
@@ -4017,15 +4028,20 @@ function sourceDocsUrl(docsPath) {
|
|
|
4017
4028
|
import { existsSync as existsSync16, mkdirSync as mkdirSync7, readFileSync as readFileSync11, renameSync as renameSync5, unlinkSync as unlinkSync5, writeFileSync as writeFileSync8 } from "node:fs";
|
|
4018
4029
|
import { basename as basename6, dirname as dirname8, isAbsolute as isAbsolute2, join as join10, resolve as resolve10 } from "node:path";
|
|
4019
4030
|
var HOST_CONFIG_MODE = 420;
|
|
4020
|
-
function
|
|
4021
|
-
return
|
|
4031
|
+
function hostConfigPath(env = process.env, home) {
|
|
4032
|
+
return join10(resolveAgroUserStateHome(env, home), GENERATIONS.agro.configFile);
|
|
4033
|
+
}
|
|
4034
|
+
function legacyHostConfigPath(env = process.env, home) {
|
|
4035
|
+
return join10(resolveLegacyUserStateHome(env, home), GENERATIONS.legacy.configFile);
|
|
4022
4036
|
}
|
|
4023
|
-
function
|
|
4024
|
-
const
|
|
4025
|
-
|
|
4037
|
+
function readableHostConfigPath(env, home) {
|
|
4038
|
+
const path4 = hostConfigPath(env, home);
|
|
4039
|
+
if (existsSync16(path4)) return path4;
|
|
4040
|
+
const legacy = legacyHostConfigPath(env, home);
|
|
4041
|
+
return existsSync16(legacy) ? legacy : path4;
|
|
4026
4042
|
}
|
|
4027
|
-
function defaultHarnessRoot(env = process.env) {
|
|
4028
|
-
return
|
|
4043
|
+
function defaultHarnessRoot(env = process.env, home) {
|
|
4044
|
+
return resolveAgroUserStateHome(env, home);
|
|
4029
4045
|
}
|
|
4030
4046
|
function validateHostConfig(value) {
|
|
4031
4047
|
if (!value || typeof value !== "object" || Array.isArray(value)) {
|
|
@@ -4081,8 +4097,8 @@ function validateReceipts(value, field, noun) {
|
|
|
4081
4097
|
}
|
|
4082
4098
|
}
|
|
4083
4099
|
}
|
|
4084
|
-
function readHostConfig(env = process.env) {
|
|
4085
|
-
const path4 =
|
|
4100
|
+
function readHostConfig(env = process.env, home) {
|
|
4101
|
+
const path4 = readableHostConfigPath(env, home);
|
|
4086
4102
|
if (!existsSync16(path4)) return { version: 1 };
|
|
4087
4103
|
let raw;
|
|
4088
4104
|
try {
|
|
@@ -4099,8 +4115,8 @@ function readHostConfig(env = process.env) {
|
|
|
4099
4115
|
}
|
|
4100
4116
|
return validateHostConfig(parsed);
|
|
4101
4117
|
}
|
|
4102
|
-
function writeHostConfig(config, env = process.env) {
|
|
4103
|
-
const path4 = hostConfigPath(env);
|
|
4118
|
+
function writeHostConfig(config, env = process.env, home) {
|
|
4119
|
+
const path4 = hostConfigPath(env, home);
|
|
4104
4120
|
const validated = validateHostConfig({ ...config, version: 1 });
|
|
4105
4121
|
const body = `${JSON.stringify(validated, null, 2)}
|
|
4106
4122
|
`;
|
|
@@ -4109,6 +4125,7 @@ function writeHostConfig(config, env = process.env) {
|
|
|
4109
4125
|
try {
|
|
4110
4126
|
writeFileSync8(tmp, body, { mode: HOST_CONFIG_MODE, encoding: "utf8" });
|
|
4111
4127
|
renameSync5(tmp, path4);
|
|
4128
|
+
retireLegacyHostConfig(env, home, path4);
|
|
4112
4129
|
} catch (error) {
|
|
4113
4130
|
try {
|
|
4114
4131
|
unlinkSync5(tmp);
|
|
@@ -4117,11 +4134,16 @@ function writeHostConfig(config, env = process.env) {
|
|
|
4117
4134
|
throw error;
|
|
4118
4135
|
}
|
|
4119
4136
|
}
|
|
4120
|
-
function resolveHarnessRoot(explicit, env = process.env) {
|
|
4137
|
+
function resolveHarnessRoot(explicit, env = process.env, home) {
|
|
4121
4138
|
if (typeof explicit === "string" && explicit !== "") return resolve10(explicit);
|
|
4122
|
-
const configured = readHostConfig(env).harnessRoot;
|
|
4139
|
+
const configured = readHostConfig(env, home).harnessRoot;
|
|
4123
4140
|
if (typeof configured === "string" && configured !== "") return resolve10(configured);
|
|
4124
|
-
return defaultHarnessRoot(env);
|
|
4141
|
+
return defaultHarnessRoot(env, home);
|
|
4142
|
+
}
|
|
4143
|
+
function retireLegacyHostConfig(env, home, written) {
|
|
4144
|
+
const legacy = legacyHostConfigPath(env, home);
|
|
4145
|
+
if (legacy === written || !existsSync16(legacy)) return;
|
|
4146
|
+
unlinkSync5(legacy);
|
|
4125
4147
|
}
|
|
4126
4148
|
function fieldError2(path4, requirement) {
|
|
4127
4149
|
return new Error(`${GENERATIONS.agro.configFile}: ${path4} ${requirement}`);
|
|
@@ -5602,7 +5624,7 @@ function fetchRemoteSource(opts) {
|
|
|
5602
5624
|
}
|
|
5603
5625
|
|
|
5604
5626
|
// src/cli.ts
|
|
5605
|
-
var VERSION = true ? "0.12.
|
|
5627
|
+
var VERSION = true ? "0.12.1" : "0.0.0-dev";
|
|
5606
5628
|
var DEFAULT_SOURCE_OH_DIR = resolve14(
|
|
5607
5629
|
dirname10(fileURLToPath(import.meta.url)),
|
|
5608
5630
|
"../.."
|