juice-email-cli 2.3.9 → 2.3.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/README.md +11 -1
- package/package.json +1 -1
- package/src/init.js +12 -3
- package/src/view.js +2 -1
package/README.md
CHANGED
|
@@ -122,9 +122,12 @@ juice view -i elabscience
|
|
|
122
122
|
### 拷贝资源到当前目录
|
|
123
123
|
|
|
124
124
|
```bash
|
|
125
|
-
#
|
|
125
|
+
# 交互式选择(每步支持返回/退出)
|
|
126
126
|
juice init
|
|
127
127
|
|
|
128
|
+
# 拷贝整个 EDM 资源库
|
|
129
|
+
juice init --all
|
|
130
|
+
|
|
128
131
|
# 从指定 EDM 路径拷贝
|
|
129
132
|
juice init elabscience/templates/standard
|
|
130
133
|
|
|
@@ -134,6 +137,13 @@ juice init --snippet edm/elabscience/series/literature/default/snippet.html
|
|
|
134
137
|
juice init --config edm/elabscience/series/literature/default/juice.yaml
|
|
135
138
|
```
|
|
136
139
|
|
|
140
|
+
交互拷贝进入变体后提供三个操作:
|
|
141
|
+
- `🧩 仅片段+配置` — 快捷拷贝片段 HTML + juice.yaml(跳过模板)
|
|
142
|
+
- `✅ 确认拷贝` — 按当前选择执行
|
|
143
|
+
- `🔄 自定义选择` — 打开多选 checkbox 调整
|
|
144
|
+
|
|
145
|
+
拷贝模板时自动附带 `favicon.ico`。配置文件冲突自动加版本号。
|
|
146
|
+
|
|
137
147
|
### 参数说明
|
|
138
148
|
|
|
139
149
|
| 参数 | 简写 | 说明 |
|
package/package.json
CHANGED
package/src/init.js
CHANGED
|
@@ -195,7 +195,7 @@ async function interactiveInit(edmDir, cwd) {
|
|
|
195
195
|
console.log(chalk.dim(`\n 品牌:${brand.meta.name || brand.name} → 模板:${version.meta.name || version.name}`));
|
|
196
196
|
if (series) console.log(chalk.dim(` 系列:${series.meta.name || series.name}${variant ? ' → 变体:' + (variant.meta.name || variant.name) : ''}`));
|
|
197
197
|
|
|
198
|
-
// Loop:
|
|
198
|
+
// Loop: confirm / shortcuts / customize, allow back at any point
|
|
199
199
|
let selected = copyItems.filter(c => c.checked).map(c => c.value);
|
|
200
200
|
while (true) {
|
|
201
201
|
const picked = selected
|
|
@@ -204,10 +204,14 @@ async function interactiveInit(edmDir, cwd) {
|
|
|
204
204
|
.map(c => c.name.replace(/^[^\s]+\s/, ''));
|
|
205
205
|
const summary = picked.length > 0 ? picked.join(' + ') : '(未选择)';
|
|
206
206
|
const mainChoices = [];
|
|
207
|
+
// Quick shortcut: snippet + config only (skip template)
|
|
208
|
+
if (variant && copyItems.some(c => c.value === 'snippet') && copyItems.some(c => c.value === 'config')) {
|
|
209
|
+
mainChoices.push({ name: '🧩 仅片段 + 配置', value: 'snippet-config' });
|
|
210
|
+
}
|
|
207
211
|
if (picked.length > 0) {
|
|
208
212
|
mainChoices.push({ name: `✅ 确认拷贝(${summary})`, value: 'confirm' });
|
|
209
213
|
}
|
|
210
|
-
mainChoices.push({ name: `🔄
|
|
214
|
+
mainChoices.push({ name: `🔄 自定义选择(${summary})`, value: 'edit' });
|
|
211
215
|
|
|
212
216
|
const action = await selectWithNav(
|
|
213
217
|
'拷贝操作:',
|
|
@@ -225,6 +229,10 @@ async function interactiveInit(edmDir, cwd) {
|
|
|
225
229
|
if (selected.length === 0) { console.log(chalk.dim(' (已清空选择)\n')); }
|
|
226
230
|
continue;
|
|
227
231
|
}
|
|
232
|
+
if (action === 'snippet-config') {
|
|
233
|
+
selected = ['snippet', 'config'];
|
|
234
|
+
continue;
|
|
235
|
+
}
|
|
228
236
|
|
|
229
237
|
if (selected.length === 0) {
|
|
230
238
|
console.log(chalk.gray('未选择任何内容。\n'));
|
|
@@ -339,7 +347,8 @@ function copyIcon(variantDir, versionDir, brandDir, cwd) {
|
|
|
339
347
|
} catch (_) {}
|
|
340
348
|
for (const src of candidates) {
|
|
341
349
|
if (fs.existsSync(src)) {
|
|
342
|
-
const dest =
|
|
350
|
+
const dest = path.join(cwd, 'favicon.ico');
|
|
351
|
+
fs.copyFileSync(src, dest);
|
|
343
352
|
return dest;
|
|
344
353
|
}
|
|
345
354
|
}
|
package/src/view.js
CHANGED
|
@@ -634,7 +634,8 @@ async function interactiveBrowse(edmDir, startParsed) {
|
|
|
634
634
|
];
|
|
635
635
|
for (const isrc of iconSrcs) {
|
|
636
636
|
if (fs.existsSync(isrc)) {
|
|
637
|
-
const idest =
|
|
637
|
+
const idest = path.join(cwd, 'favicon.ico');
|
|
638
|
+
fs.copyFileSync(isrc, idest);
|
|
638
639
|
console.log(` ${chalk.cyan('·')} ${cwdRel(idest)} ${chalk.gray('(图标, ' + fmtBytes(fs.statSync(idest).size) + ')')}`);
|
|
639
640
|
break;
|
|
640
641
|
}
|