juice-email-cli 2.3.12 → 2.3.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/package.json +1 -1
- package/src/snippet.js +36 -9
package/package.json
CHANGED
package/src/snippet.js
CHANGED
|
@@ -772,12 +772,23 @@ async function runSnippetMode({ snippet, template, config: cliConfigPath, output
|
|
|
772
772
|
// 命令行完整指定(-s + -f),自动检测
|
|
773
773
|
priorityConfigPath = findLocalConfig(snippetDir) || findLocalConfig(process.cwd());
|
|
774
774
|
} else {
|
|
775
|
-
// 交互模式(只有 -s
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
775
|
+
// 交互模式(只有 -s),列出片段目录下的全部配置
|
|
776
|
+
let configs = findConfigs(snippetDir, path.basename(snippetDir));
|
|
777
|
+
// If -c also specified, collect from its directory too
|
|
778
|
+
let preferredPath = null;
|
|
779
|
+
if (cliConfigPath) {
|
|
780
|
+
preferredPath = path.resolve(cliConfigPath);
|
|
781
|
+
if (fs.existsSync(preferredPath)) {
|
|
782
|
+
const cfgDir = path.dirname(preferredPath);
|
|
783
|
+
if (path.resolve(cfgDir) !== path.resolve(snippetDir)) {
|
|
784
|
+
configs = [
|
|
785
|
+
...findConfigs(cfgDir, path.basename(cfgDir)),
|
|
786
|
+
...configs,
|
|
787
|
+
];
|
|
788
|
+
}
|
|
789
|
+
}
|
|
790
|
+
}
|
|
791
|
+
const configChoice = await promptConfig(configs, preferredPath);
|
|
781
792
|
priorityConfigPath = (configChoice.type === 'file') ? configChoice.path : null;
|
|
782
793
|
}
|
|
783
794
|
|
|
@@ -880,9 +891,25 @@ async function runInteractiveMode({ config: cliConfigPath }) {
|
|
|
880
891
|
return;
|
|
881
892
|
}
|
|
882
893
|
|
|
883
|
-
// 5. 选择配置文件
|
|
884
|
-
|
|
885
|
-
|
|
894
|
+
// 5. 选择配置文件 — 收集:变体目录 + 指定配置的目录
|
|
895
|
+
let configs = findConfigs(variant.path, path.basename(variant.path));
|
|
896
|
+
|
|
897
|
+
let preferredPath = null;
|
|
898
|
+
if (cliConfigPath) {
|
|
899
|
+
preferredPath = path.resolve(cliConfigPath);
|
|
900
|
+
if (fs.existsSync(preferredPath)) {
|
|
901
|
+
const cfgDir = path.dirname(preferredPath);
|
|
902
|
+
// Collect from specified config's directory if different from variant dir
|
|
903
|
+
if (path.resolve(cfgDir) !== path.resolve(variant.path)) {
|
|
904
|
+
configs = [
|
|
905
|
+
...findConfigs(cfgDir, path.basename(cfgDir)),
|
|
906
|
+
...configs,
|
|
907
|
+
];
|
|
908
|
+
}
|
|
909
|
+
}
|
|
910
|
+
}
|
|
911
|
+
|
|
912
|
+
const configChoice = await promptConfig(configs, preferredPath);
|
|
886
913
|
|
|
887
914
|
let priorityConfigPath = null;
|
|
888
915
|
let configFileName = '(跳过)';
|