juice-email-cli 2.3.13 → 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 +26 -14
package/package.json
CHANGED
package/src/snippet.js
CHANGED
|
@@ -773,8 +773,22 @@ async function runSnippetMode({ snippet, template, config: cliConfigPath, output
|
|
|
773
773
|
priorityConfigPath = findLocalConfig(snippetDir) || findLocalConfig(process.cwd());
|
|
774
774
|
} else {
|
|
775
775
|
// 交互模式(只有 -s),列出片段目录下的全部配置
|
|
776
|
-
|
|
777
|
-
|
|
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);
|
|
778
792
|
priorityConfigPath = (configChoice.type === 'file') ? configChoice.path : null;
|
|
779
793
|
}
|
|
780
794
|
|
|
@@ -877,23 +891,21 @@ async function runInteractiveMode({ config: cliConfigPath }) {
|
|
|
877
891
|
return;
|
|
878
892
|
}
|
|
879
893
|
|
|
880
|
-
// 5. 选择配置文件
|
|
894
|
+
// 5. 选择配置文件 — 收集:变体目录 + 指定配置的目录
|
|
881
895
|
let configs = findConfigs(variant.path, path.basename(variant.path));
|
|
882
896
|
|
|
883
|
-
// If -c specified a config from outside the variant dir, add it to the list
|
|
884
897
|
let preferredPath = null;
|
|
885
898
|
if (cliConfigPath) {
|
|
886
899
|
preferredPath = path.resolve(cliConfigPath);
|
|
887
|
-
if (
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
];
|
|
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
|
+
}
|
|
897
909
|
}
|
|
898
910
|
}
|
|
899
911
|
|