@sfmc-bds/cli 0.2.0-beta.10 → 0.2.0-beta.11
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/LICENSE +663 -0
- package/dist/command-surface.test.js +92 -0
- package/dist/command-surface.test.js.map +7 -0
- package/dist/debug-command.test.js +76 -0
- package/dist/debug-command.test.js.map +7 -0
- package/dist/directory-picker.d.ts +27 -0
- package/dist/directory-picker.d.ts.map +1 -0
- package/dist/directory-picker.js +112 -0
- package/dist/directory-picker.js.map +7 -0
- package/dist/i18n/locales/en.d.ts +1 -0
- package/dist/i18n/locales/en.d.ts.map +1 -1
- package/dist/i18n/locales/en.js +1 -0
- package/dist/i18n/locales/en.js.map +2 -2
- package/dist/i18n/locales/zh-CN.d.ts.map +1 -1
- package/dist/i18n/locales/zh-CN.js +1 -0
- package/dist/i18n/locales/zh-CN.js.map +2 -2
- package/dist/interactive-prompts.d.ts +1 -2
- package/dist/interactive-prompts.d.ts.map +1 -1
- package/dist/interactive-prompts.js +12 -23
- package/dist/interactive-prompts.js.map +3 -3
- package/dist/log-filter.test.js +119 -0
- package/dist/log-filter.test.js.map +7 -0
- package/dist/module-commands.js +1 -1
- package/dist/module-commands.js.map +1 -1
- package/dist/module-pack-build.js.map +1 -1
- package/dist/module-toggle.test.js +37 -0
- package/dist/module-toggle.test.js.map +7 -0
- package/dist/world-packs-uninstall.test.js +54 -0
- package/dist/world-packs-uninstall.test.js.map +7 -0
- package/package.json +14 -12
- package/scripts/module-install/{install-resolver.test.mjs → test/install-resolver.test.ts} +4 -5
- package/scripts/module-install/{link-local.test.mjs → test/link-local.test.ts} +4 -5
- package/scripts/module-install/{local-resolver.test.mjs → test/local-resolver.test.ts} +5 -12
- package/scripts/module-install/{registry-index.test.mjs → test/registry-index.test.ts} +5 -6
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sfmc-bds/cli",
|
|
3
|
-
"version": "0.2.0-beta.
|
|
3
|
+
"version": "0.2.0-beta.11",
|
|
4
4
|
"description": "SFMC management CLI — REPL, service supervisor, module install, behavior-pack build/deploy",
|
|
5
5
|
"author": "Shiroha7z",
|
|
6
6
|
"license": "AGPL-3.0-only",
|
|
@@ -48,21 +48,23 @@
|
|
|
48
48
|
"scripts",
|
|
49
49
|
"README.md"
|
|
50
50
|
],
|
|
51
|
-
"scripts": {
|
|
52
|
-
"build": "sfmc-esbuild-transpile --dts",
|
|
53
|
-
"prepublishOnly": "npm run build",
|
|
54
|
-
"start": "node ./dist/main.js",
|
|
55
|
-
"test": "npm run build && node --test terminal-progress.test.mjs wrap-log-line.test.mjs world-packs-uninstall.test.mjs log-filter.test.mjs debug-command.test.mjs command-surface.test.mjs argv-parse.test.mjs command-palette.test.mjs repl-windows.test.mjs module-toggle.test.mjs llbot-launch.test.mjs scripts/module-install/*.test.mjs",
|
|
56
|
-
"typecheck": "tsc7 --noEmit -p tsconfig.json"
|
|
57
|
-
},
|
|
58
51
|
"dependencies": {
|
|
59
52
|
"@clack/prompts": "^1.7.0",
|
|
60
|
-
"
|
|
61
|
-
"@sfmc-bds/
|
|
62
|
-
"
|
|
53
|
+
"chalk": "^6.0.0",
|
|
54
|
+
"@sfmc-bds/bds-tools": "0.2.0-beta.9",
|
|
55
|
+
"@sfmc-bds/sdk": "0.2.0-beta.9"
|
|
56
|
+
},
|
|
57
|
+
"devDependencies": {
|
|
58
|
+
"@sfmc-bds/tools": "0.2.0-beta.10"
|
|
63
59
|
},
|
|
64
60
|
"publishConfig": {
|
|
65
61
|
"access": "public",
|
|
66
62
|
"registry": "https://registry.npmjs.org/"
|
|
63
|
+
},
|
|
64
|
+
"scripts": {
|
|
65
|
+
"build": "sfmc-esbuild-transpile --dts",
|
|
66
|
+
"start": "node ./dist/main.js",
|
|
67
|
+
"test": "pnpm run build && node --test \"dist/**/*.test.js\" && node --test --import tsx/esm \"scripts/module-install/test/**/*.test.ts\"",
|
|
68
|
+
"typecheck": "tsc7 --noEmit -p tsconfig.json"
|
|
67
69
|
}
|
|
68
|
-
}
|
|
70
|
+
}
|
|
@@ -1,14 +1,13 @@
|
|
|
1
|
-
// @ts-check
|
|
2
1
|
/**
|
|
3
|
-
* install-resolver
|
|
2
|
+
* install-resolver npm 包名解析表驱动
|
|
4
3
|
*/
|
|
5
4
|
import assert from "node:assert/strict";
|
|
6
5
|
import test from "node:test";
|
|
7
6
|
import {
|
|
8
|
-
resolveNpmPackageName,
|
|
9
7
|
folderFromNpmPackageName,
|
|
10
8
|
normalizeNpmPackageName,
|
|
11
|
-
|
|
9
|
+
resolveNpmPackageName,
|
|
10
|
+
} from "../lib/npm-resolver.mjs";
|
|
12
11
|
|
|
13
12
|
test("短 id → @sfmc-bds/module-<id>", () => {
|
|
14
13
|
assert.equal(resolveNpmPackageName("land"), "@sfmc-bds/module-land");
|
|
@@ -45,4 +44,4 @@ test("normalizeNpmPackageName 兼容两种前缀", () => {
|
|
|
45
44
|
assert.equal(normalizeNpmPackageName("@sfmc-bds/module-land"), "land");
|
|
46
45
|
assert.equal(normalizeNpmPackageName("@alice/sfmc-module-foo"), "foo");
|
|
47
46
|
assert.equal(normalizeNpmPackageName("@alice/module-bar"), "bar");
|
|
48
|
-
});
|
|
47
|
+
});
|
|
@@ -1,13 +1,12 @@
|
|
|
1
|
-
// @ts-check
|
|
2
1
|
/**
|
|
3
|
-
* link-local
|
|
2
|
+
* link-local normalizeLinkFrom 表驱动
|
|
4
3
|
*/
|
|
5
4
|
import assert from "node:assert/strict";
|
|
6
|
-
import test from "node:test";
|
|
7
|
-
import path from "node:path";
|
|
8
5
|
import fs from "node:fs";
|
|
9
6
|
import os from "node:os";
|
|
10
|
-
import
|
|
7
|
+
import path from "node:path";
|
|
8
|
+
import test from "node:test";
|
|
9
|
+
import { normalizeLinkFrom } from "../lib/link-from.mjs";
|
|
11
10
|
|
|
12
11
|
const CWD = process.cwd();
|
|
13
12
|
|
|
@@ -1,20 +1,13 @@
|
|
|
1
|
-
// @ts-check
|
|
2
1
|
/**
|
|
3
|
-
* local-resolver
|
|
4
|
-
*
|
|
5
|
-
* 不直接 import fetch-module.mjs(顶层副作用多);
|
|
6
|
-
* 走 logic-equivalent 表达式断言 resolveLocalPath 行为。
|
|
2
|
+
* local-resolver `--from local` 路径解析表驱动
|
|
7
3
|
*/
|
|
8
4
|
import assert from "node:assert/strict";
|
|
9
|
-
import test from "node:test";
|
|
10
5
|
import path from "node:path";
|
|
11
6
|
import process from "node:process";
|
|
7
|
+
import test from "node:test";
|
|
12
8
|
|
|
13
|
-
/**
|
|
14
|
-
|
|
15
|
-
* @param {string | undefined} tail
|
|
16
|
-
*/
|
|
17
|
-
function resolveLocalPath(tail) {
|
|
9
|
+
/** 镜像 fetch-module.mjs#resolveLocalPath */
|
|
10
|
+
function resolveLocalPath(tail: string | undefined): string {
|
|
18
11
|
const p = String(tail ?? "").trim();
|
|
19
12
|
if (!p || p === "." || p === "./") return path.resolve(process.cwd());
|
|
20
13
|
return path.isAbsolute(p) ? path.resolve(p) : path.resolve(process.cwd(), p);
|
|
@@ -48,4 +41,4 @@ test("绝对路径 .tgz", () => {
|
|
|
48
41
|
test("绝对路径 .zip", () => {
|
|
49
42
|
const abs = process.platform === "win32" ? "D:\\work\\foo.zip" : "/tmp/foo.zip";
|
|
50
43
|
assert.equal(resolveLocalPath(abs), path.resolve(abs));
|
|
51
|
-
});
|
|
44
|
+
});
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
// @ts-check
|
|
2
1
|
import assert from "node:assert/strict";
|
|
3
2
|
import test from "node:test";
|
|
4
|
-
import { parseRegistryIndex } from "
|
|
3
|
+
import { parseRegistryIndex } from "../lib/registry-index.mjs";
|
|
5
4
|
|
|
6
5
|
test("接受 npm 条目", () => {
|
|
7
6
|
const idx = parseRegistryIndex({
|
|
@@ -10,16 +9,16 @@ test("接受 npm 条目", () => {
|
|
|
10
9
|
land: { npm: "@sfmc-bds/module-land", version: "1.0.0", sdk: ">=0.2.0" },
|
|
11
10
|
},
|
|
12
11
|
});
|
|
13
|
-
assert.equal(idx.land
|
|
14
|
-
assert.equal(idx.land
|
|
12
|
+
assert.equal(idx.land?.npm, "@sfmc-bds/module-land");
|
|
13
|
+
assert.equal(idx.land?.version, "1.0.0");
|
|
15
14
|
});
|
|
16
15
|
|
|
17
16
|
test("仍接受 repo+tag", () => {
|
|
18
17
|
const idx = parseRegistryIndex({
|
|
19
18
|
modules: { afk: { repo: "Tanya7z/sfmc-modules", tag: "modules-v0.4.0" } },
|
|
20
19
|
});
|
|
21
|
-
assert.equal(idx.afk
|
|
22
|
-
assert.equal(idx.afk
|
|
20
|
+
assert.equal(idx.afk?.repo, "Tanya7z/sfmc-modules");
|
|
21
|
+
assert.equal(idx.afk?.tag, "modules-v0.4.0");
|
|
23
22
|
});
|
|
24
23
|
|
|
25
24
|
test("既无 npm 也无 repo 则跳过", () => {
|