@zalkera/cli 0.30.0 → 0.31.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/main.js +52 -26
- package/package.json +1 -1
package/dist/main.js
CHANGED
|
@@ -2431,6 +2431,32 @@ async function startDevServerWithEnv(options, storefrontKey, envName) {
|
|
|
2431
2431
|
|
|
2432
2432
|
// ../core/dist/fetchSource.js
|
|
2433
2433
|
import { createHash as createHash6 } from "node:crypto";
|
|
2434
|
+
|
|
2435
|
+
// ../core/dist/emptyDir.js
|
|
2436
|
+
import { basename as basename2, dirname as dirname2, join as join13 } from "node:path";
|
|
2437
|
+
var OS_JUNK = /* @__PURE__ */ new Set([
|
|
2438
|
+
".DS_Store",
|
|
2439
|
+
// macOS
|
|
2440
|
+
"Thumbs.db",
|
|
2441
|
+
// Windows
|
|
2442
|
+
"desktop.ini"
|
|
2443
|
+
// Windows
|
|
2444
|
+
]);
|
|
2445
|
+
var IGNORED = /* @__PURE__ */ new Set([
|
|
2446
|
+
".vscode",
|
|
2447
|
+
// 편집기·확장이 만든다(우리가 만드는 쪽이다)
|
|
2448
|
+
...OS_JUNK
|
|
2449
|
+
]);
|
|
2450
|
+
var OWN_STATE_FILES = [SOURCE_MARK_PATH, SYNC_LEDGER_PATH];
|
|
2451
|
+
var OWN_STATE_DIR = (() => {
|
|
2452
|
+
const dirs = new Set(OWN_STATE_FILES.map((p) => dirname2(p)));
|
|
2453
|
+
if (dirs.size !== 1)
|
|
2454
|
+
throw new Error(`\uC790\uAE30 \uC0C1\uD0DC \uD30C\uC77C\uC774 \uD55C \uD3F4\uB354\uC5D0 \uC788\uC9C0 \uC54A\uB2E4: ${[...dirs].join(", ")}`);
|
|
2455
|
+
return [...dirs][0];
|
|
2456
|
+
})();
|
|
2457
|
+
var OWN_STATE_NAMES = new Set(OWN_STATE_FILES.map((p) => basename2(p)));
|
|
2458
|
+
|
|
2459
|
+
// ../core/dist/fetchSource.js
|
|
2434
2460
|
init_errors();
|
|
2435
2461
|
|
|
2436
2462
|
// ../core/dist/fetchTarget.js
|
|
@@ -2540,7 +2566,7 @@ init_notice();
|
|
|
2540
2566
|
// ../core/dist/npmChoice.js
|
|
2541
2567
|
import { execFileSync } from "node:child_process";
|
|
2542
2568
|
import { existsSync as existsSync7, realpathSync } from "node:fs";
|
|
2543
|
-
import { delimiter as delimiter2, isAbsolute as isAbsolute2, join as
|
|
2569
|
+
import { delimiter as delimiter2, isAbsolute as isAbsolute2, join as join14, normalize as normalize3, sep as sep5 } from "node:path";
|
|
2544
2570
|
var MIN_SYSTEM_NPM_MAJOR = 9;
|
|
2545
2571
|
function majorOf(version2) {
|
|
2546
2572
|
const m = /^(\d+)\./.exec((version2 ?? "").trim());
|
|
@@ -2603,7 +2629,7 @@ function npmArgvOf(choice, nodePath) {
|
|
|
2603
2629
|
return null;
|
|
2604
2630
|
}
|
|
2605
2631
|
}
|
|
2606
|
-
var PATH_OPS = { join:
|
|
2632
|
+
var PATH_OPS = { join: join14, isAbsolute: isAbsolute2, normalize: normalize3, sep: sep5 };
|
|
2607
2633
|
function probeSystemNpm(nodePath, excludeUnder = [], env = process.env) {
|
|
2608
2634
|
const entries = (env.PATH ?? "").split(delimiter2);
|
|
2609
2635
|
for (const step of systemNpmSearchSteps(entries, PATH_OPS, excludeUnder)) {
|
|
@@ -2682,12 +2708,12 @@ var UPGRADE_NOTICE_INTERVAL_MS = 24 * 60 * 60 * 1e3;
|
|
|
2682
2708
|
|
|
2683
2709
|
// ../core/dist/tokenPath.js
|
|
2684
2710
|
import { homedir as homedir2 } from "node:os";
|
|
2685
|
-
import { isAbsolute as isAbsolute3, join as
|
|
2711
|
+
import { isAbsolute as isAbsolute3, join as join15, resolve as resolve5, sep as sep6 } from "node:path";
|
|
2686
2712
|
function tokenPath(env = process.env, home = homedir2()) {
|
|
2687
|
-
const fallback =
|
|
2713
|
+
const fallback = join15(home, ".config");
|
|
2688
2714
|
const base = env.XDG_CONFIG_HOME;
|
|
2689
2715
|
const inside = base !== void 0 && isAbsolute3(base) && (resolve5(base) === resolve5(home) || resolve5(base).startsWith(resolve5(home) + sep6));
|
|
2690
|
-
return
|
|
2716
|
+
return join15(inside ? resolve5(base) : fallback, "zalkera", "auth.json");
|
|
2691
2717
|
}
|
|
2692
2718
|
|
|
2693
2719
|
// ../core/dist/index.js
|
|
@@ -2809,7 +2835,7 @@ function trimPaths(paths, cap = PATH_LIST_CAP, all = false) {
|
|
|
2809
2835
|
// ../core/dist/pull.js
|
|
2810
2836
|
import { lstat as lstat5, mkdir as mkdir5, readFile as readFile6, realpath as realpath2, rename as rename2, rmdir, unlink } from "node:fs/promises";
|
|
2811
2837
|
init_errors();
|
|
2812
|
-
import { basename as
|
|
2838
|
+
import { basename as basename3, dirname as dirname3, join as join16, relative as relative4, resolve as resolve6, sep as sep7 } from "node:path";
|
|
2813
2839
|
var SAVED_SUFFIX = ".zalkera-saved";
|
|
2814
2840
|
async function pullSiteSource(options) {
|
|
2815
2841
|
const report = options.onProgress ?? (() => {
|
|
@@ -2841,7 +2867,7 @@ async function pullSiteSource(options) {
|
|
|
2841
2867
|
const aside = await setAside(root, plan);
|
|
2842
2868
|
savedTo = aside.folder;
|
|
2843
2869
|
movedAway = aside.moved;
|
|
2844
|
-
report(`\uACE0\uCE5C \uB0B4\uC6A9\uC744 ${
|
|
2870
|
+
report(`\uACE0\uCE5C \uB0B4\uC6A9\uC744 ${basename3(savedTo)} \uC5D0 \uC62E\uACA8 \uB450\uC5C8\uC2B5\uB2C8\uB2E4.`);
|
|
2845
2871
|
}
|
|
2846
2872
|
const todo = savedTo ? applyAfterDiscard(plan, incoming) : { writes: plan.writes, deletes: plan.deletes };
|
|
2847
2873
|
await requireNoLinkedTargets(root, todo.writes);
|
|
@@ -2908,7 +2934,7 @@ async function requireNoLinkedTargets(root, paths) {
|
|
|
2908
2934
|
const segments = path.split("/").filter((s) => s !== "");
|
|
2909
2935
|
let current = root;
|
|
2910
2936
|
for (const part of segments) {
|
|
2911
|
-
current =
|
|
2937
|
+
current = join16(current, part);
|
|
2912
2938
|
if (checked.has(current))
|
|
2913
2939
|
continue;
|
|
2914
2940
|
checked.add(current);
|
|
@@ -2931,13 +2957,13 @@ function withoutExcluded(declared) {
|
|
|
2931
2957
|
return { incoming, dropped: dropped.sort() };
|
|
2932
2958
|
}
|
|
2933
2959
|
async function readLedger(root) {
|
|
2934
|
-
const text = await readFile6(
|
|
2960
|
+
const text = await readFile6(join16(root, SYNC_LEDGER_PATH), "utf8").catch(() => null);
|
|
2935
2961
|
return text === null ? null : parseSyncLedger(text);
|
|
2936
2962
|
}
|
|
2937
2963
|
async function writeLedger(root, ledger) {
|
|
2938
2964
|
try {
|
|
2939
2965
|
const dir = await ensureOwnDir(root, ...SYNC_LEDGER_PATH.split("/").slice(0, -1));
|
|
2940
|
-
await writeOwnFile(
|
|
2966
|
+
await writeOwnFile(join16(dir, basename3(SYNC_LEDGER_PATH)), serializeSyncLedger(ledger));
|
|
2941
2967
|
} catch {
|
|
2942
2968
|
return false;
|
|
2943
2969
|
}
|
|
@@ -2961,10 +2987,10 @@ async function applyDeletes(root, paths) {
|
|
|
2961
2987
|
await unlink(target).catch(() => {
|
|
2962
2988
|
});
|
|
2963
2989
|
count2 += 1;
|
|
2964
|
-
let dir =
|
|
2990
|
+
let dir = dirname3(target);
|
|
2965
2991
|
while (dir.length > root.length && dir.startsWith(root)) {
|
|
2966
2992
|
parents.add(dir);
|
|
2967
|
-
dir =
|
|
2993
|
+
dir = dirname3(dir);
|
|
2968
2994
|
}
|
|
2969
2995
|
}
|
|
2970
2996
|
for (const dir of [...parents].sort((a, b) => b.length - a.length)) {
|
|
@@ -2976,14 +3002,14 @@ async function applyDeletes(root, paths) {
|
|
|
2976
3002
|
async function setAside(root, plan) {
|
|
2977
3003
|
const stamp = (/* @__PURE__ */ new Date()).toISOString().replace(/[:.]/g, "-");
|
|
2978
3004
|
const real = await realpath2(root).catch(() => root);
|
|
2979
|
-
const saved =
|
|
3005
|
+
const saved = join16(dirname3(real), `${basename3(real)}${SAVED_SUFFIX}`, stamp);
|
|
2980
3006
|
const moved = [];
|
|
2981
3007
|
for (const conflict of plan.conflicts) {
|
|
2982
3008
|
const from = await resolveExisting(root, conflict.path);
|
|
2983
3009
|
if (!from)
|
|
2984
3010
|
continue;
|
|
2985
|
-
const to =
|
|
2986
|
-
await mkdir5(
|
|
3011
|
+
const to = join16(saved, conflict.path);
|
|
3012
|
+
await mkdir5(dirname3(to), { recursive: true });
|
|
2987
3013
|
await rename2(from, to);
|
|
2988
3014
|
moved.push(conflict.path);
|
|
2989
3015
|
}
|
|
@@ -3005,12 +3031,12 @@ ${list}`,
|
|
|
3005
3031
|
// ../core/dist/baseline.js
|
|
3006
3032
|
init_errors();
|
|
3007
3033
|
import { readFile as readFile7 } from "node:fs/promises";
|
|
3008
|
-
import { join as
|
|
3034
|
+
import { join as join17, resolve as resolve7 } from "node:path";
|
|
3009
3035
|
async function rebuildBaseline(options) {
|
|
3010
3036
|
const report = options.onProgress ?? (() => {
|
|
3011
3037
|
});
|
|
3012
3038
|
const root = resolve7(options.folder);
|
|
3013
|
-
const previousText = await readFile7(
|
|
3039
|
+
const previousText = await readFile7(join17(root, SYNC_LEDGER_PATH), "utf8").catch(() => null);
|
|
3014
3040
|
const previous = previousText === null ? null : parseSyncLedger(previousText);
|
|
3015
3041
|
report("\uD310\uC758 \uD30C\uC77C \uBAA9\uB85D\uC744 \uB2E4\uC2DC \uC77D\uB294 \uC911\uC785\uB2C8\uB2E4\u2026");
|
|
3016
3042
|
const tar = await fetchVerifiedSourceTar({
|
|
@@ -3111,7 +3137,7 @@ function ledgerCorrection(ledger, draft) {
|
|
|
3111
3137
|
init_errors();
|
|
3112
3138
|
init_notice();
|
|
3113
3139
|
import { readFile as readFile8, stat as stat3 } from "node:fs/promises";
|
|
3114
|
-
import { basename as
|
|
3140
|
+
import { basename as basename4, join as join18, resolve as resolve8 } from "node:path";
|
|
3115
3141
|
|
|
3116
3142
|
// ../core/dist/pushPlan.js
|
|
3117
3143
|
function effectiveSha(base, draft, path) {
|
|
@@ -3388,14 +3414,14 @@ async function bodyOf(root, edits) {
|
|
|
3388
3414
|
body.push({ path: edit.path, remove: true, ...edit.baseSha256 === null ? {} : { baseSha256: edit.baseSha256 } });
|
|
3389
3415
|
continue;
|
|
3390
3416
|
}
|
|
3391
|
-
const size = (await stat3(
|
|
3417
|
+
const size = (await stat3(join18(root, edit.path))).size;
|
|
3392
3418
|
if (size > MAX_PUSH_FILE_BYTES) {
|
|
3393
3419
|
throw new DevtoolsError("PUSH_TOO_LARGE", `\uD30C\uC77C \uD558\uB098\uAC00 \uB108\uBB34 \uD07D\uB2C8\uB2E4: ${edit.path} (${Math.round(size / 1024)}KB \xB7 \uC0C1\uD55C ${MAX_PUSH_FILE_BYTES / 1024}KB).`, "\uB3D9\uC601\uC0C1\xB7\uC6D0\uBCF8 \uC774\uBBF8\uC9C0\xB7\uBE4C\uB4DC \uC0B0\uCD9C\uBB3C\uC774 \uC18C\uC2A4 \uD3F4\uB354\uC5D0 \uB4E4\uC5B4 \uC788\uC9C0 \uC54A\uC740\uC9C0 \uD655\uC778\uD574 \uC8FC\uC138\uC694.");
|
|
3394
3420
|
}
|
|
3395
3421
|
if (total + size > MAX_PUSH_BYTES)
|
|
3396
3422
|
throw tooLarge();
|
|
3397
|
-
const raw = await readFile8(
|
|
3398
|
-
const breach = templateBreach(
|
|
3423
|
+
const raw = await readFile8(join18(root, edit.path));
|
|
3424
|
+
const breach = templateBreach(basename4(edit.path), raw);
|
|
3399
3425
|
if (breach !== null) {
|
|
3400
3426
|
throw new DevtoolsError("PUSH_SECRET_TEMPLATE", `${edit.path} \uC5D0 \uC2E4\uC81C \uAC12\uC774 \uB4E4\uC5B4 \uC788\uC5B4 \uC62C\uB9AC\uC9C0 \uC54A\uC558\uC2B5\uB2C8\uB2E4(${breach}).`, "`.env.example` \uAC19\uC740 \uC11C\uC2DD \uD30C\uC77C\uC740 \uAC12\uC744 \uBE44\uC6CC \uB450\uC5B4\uC57C \uC62C\uB77C\uAC11\uB2C8\uB2E4. \uC2E4\uC81C \uAC12\uC740 \uCF58\uC194\uC758 \uD658\uACBD\uBCC0\uC218 \uD654\uBA74\uC5D0\uC11C \uAD00\uB9AC\uD574 \uC8FC\uC138\uC694.");
|
|
3401
3427
|
}
|
|
@@ -3663,11 +3689,11 @@ function flagValue(flags, name) {
|
|
|
3663
3689
|
import { readFileSync } from "node:fs";
|
|
3664
3690
|
import { readFile as readFile10 } from "node:fs/promises";
|
|
3665
3691
|
import { fileURLToPath } from "node:url";
|
|
3666
|
-
import { join as
|
|
3692
|
+
import { join as join20, resolve as resolve11 } from "node:path";
|
|
3667
3693
|
|
|
3668
3694
|
// src/tokenStore.ts
|
|
3669
3695
|
import { chmod as chmod4, readFile as readFile9, rm as rm6 } from "node:fs/promises";
|
|
3670
|
-
import { basename as
|
|
3696
|
+
import { basename as basename5, dirname as dirname4 } from "node:path";
|
|
3671
3697
|
var FileTokenStore = class {
|
|
3672
3698
|
// ⚠ 매개변수 프로퍼티(`constructor(private path)`)를 안 쓴다 — Node 의 타입 제거 실행기가
|
|
3673
3699
|
// 그 문법을 거절해 **시험이 아예 안 돈다.** 이 레포의 시험은 전부 그 실행기로 돈다.
|
|
@@ -3696,7 +3722,7 @@ var FileTokenStore = class {
|
|
|
3696
3722
|
}
|
|
3697
3723
|
}
|
|
3698
3724
|
async write(tokens) {
|
|
3699
|
-
const dir = await ensureOwnDir(
|
|
3725
|
+
const dir = await ensureOwnDir(dirname4(dirname4(this.path)), basename5(dirname4(this.path)));
|
|
3700
3726
|
await chmod4(dir, 448).catch(() => {
|
|
3701
3727
|
});
|
|
3702
3728
|
await writeOwnFile(this.path, JSON.stringify(tokens), 384);
|
|
@@ -3723,9 +3749,9 @@ function serverUrlOf(env = process.env) {
|
|
|
3723
3749
|
}
|
|
3724
3750
|
async function tenantOf(folder, explicit) {
|
|
3725
3751
|
if (explicit) return TENANT_CODE.test(explicit) ? explicit : null;
|
|
3726
|
-
const mark = parseSourceMark(await readFile10(
|
|
3752
|
+
const mark = parseSourceMark(await readFile10(join20(folder, SOURCE_MARK_PATH), "utf8").catch(() => null));
|
|
3727
3753
|
if (mark) return mark.tenant;
|
|
3728
|
-
const text = await readFile10(
|
|
3754
|
+
const text = await readFile10(join20(folder, SYNC_LEDGER_PATH), "utf8").catch(() => null);
|
|
3729
3755
|
return text === null ? null : parseSyncLedger(text)?.tenant ?? null;
|
|
3730
3756
|
}
|
|
3731
3757
|
async function openAuth(options = {}) {
|