juice-email-cli 2.3.12 → 2.3.13

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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/snippet.js +22 -7
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "juice-email-cli",
3
- "version": "2.3.12",
3
+ "version": "2.3.13",
4
4
  "description": "CLI tool to generate email-client-compatible HTML with juice (CSS inlining) + Mustache templating + minification",
5
5
  "main": "src/index.js",
6
6
  "bin": {
package/src/snippet.js CHANGED
@@ -772,11 +772,8 @@ 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),收集 CWD + 片段目录配置
776
- const configs = collectConfigs([
777
- { dir: snippetDir, label: path.basename(snippetDir), markOptimal: true },
778
- { dir: process.cwd(), label: '当前目录' },
779
- ]);
775
+ // 交互模式(只有 -s),列出片段目录下的全部配置
776
+ const configs = findConfigs(snippetDir, path.basename(snippetDir));
780
777
  const configChoice = await promptConfig(configs);
781
778
  priorityConfigPath = (configChoice.type === 'file') ? configChoice.path : null;
782
779
  }
@@ -881,8 +878,26 @@ async function runInteractiveMode({ config: cliConfigPath }) {
881
878
  }
882
879
 
883
880
  // 5. 选择配置文件
884
- const configs = findConfigs(variant.path, path.basename(variant.path));
885
- const configChoice = await promptConfig(configs, cliConfigPath);
881
+ let configs = findConfigs(variant.path, path.basename(variant.path));
882
+
883
+ // If -c specified a config from outside the variant dir, add it to the list
884
+ let preferredPath = null;
885
+ if (cliConfigPath) {
886
+ preferredPath = path.resolve(cliConfigPath);
887
+ if (!configs.some(c => c.path === preferredPath) && fs.existsSync(preferredPath)) {
888
+ configs = [
889
+ {
890
+ name: path.basename(preferredPath),
891
+ path: preferredPath,
892
+ isOptimal: false,
893
+ source: '指定配置',
894
+ },
895
+ ...configs,
896
+ ];
897
+ }
898
+ }
899
+
900
+ const configChoice = await promptConfig(configs, preferredPath);
886
901
 
887
902
  let priorityConfigPath = null;
888
903
  let configFileName = '(跳过)';