@travetto/email-compiler 8.0.0-alpha.2 → 8.0.0-alpha.20
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 +13 -4
- package/package.json +9 -9
- package/src/util.ts +1 -1
- package/support/bin/config.ts +1 -1
- package/support/cli.email_compile.ts +6 -2
- package/support/cli.email_editor.ts +6 -1
- package/support/cli.email_test.ts +4 -1
package/README.md
CHANGED
|
@@ -53,15 +53,24 @@ The module provides [Command Line Interface](https://github.com/travetto/travett
|
|
|
53
53
|
## CLI Compilation
|
|
54
54
|
The module provides [Command Line Interface](https://github.com/travetto/travetto/tree/main/module/cli#readme "CLI infrastructure for Travetto framework") support for email template compilation also. Running
|
|
55
55
|
|
|
56
|
-
|
|
56
|
+
## CLI - email:compile
|
|
57
|
+
|
|
58
|
+
**Terminal: Help for email:compile**
|
|
57
59
|
```bash
|
|
58
|
-
$ trv email:compile
|
|
60
|
+
$ trv email:compile --help
|
|
59
61
|
|
|
60
62
|
Usage: email:compile [options]
|
|
61
63
|
|
|
64
|
+
Description:
|
|
65
|
+
Compile all email templates into generated runtime artifacts.
|
|
66
|
+
|
|
67
|
+
The command discovers templated inputs (for example, `.email.html`) and emits
|
|
68
|
+
compiled outputs used at runtime (html/text/subject variants). With watch
|
|
69
|
+
enabled, recompilation runs automatically on matching template changes.
|
|
70
|
+
|
|
62
71
|
Options:
|
|
63
|
-
-w, --watch
|
|
64
|
-
|
|
72
|
+
-w, --watch Recompile templates whenever source templates change.
|
|
73
|
+
--help display help for command
|
|
65
74
|
```
|
|
66
75
|
|
|
67
76
|
Will convert all `.email.html` files into the appropriate `.compiled.html`, `.compiled.text` and `.compiled.subject` files. These will be used during the running of the application. By default these files are added to the `.gitignore` as they are generally not intended to be saved but to be generated during the build process.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@travetto/email-compiler",
|
|
3
|
-
"version": "8.0.0-alpha.
|
|
3
|
+
"version": "8.0.0-alpha.20",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Email compiling module",
|
|
6
6
|
"keywords": [
|
|
@@ -27,20 +27,20 @@
|
|
|
27
27
|
"directory": "module/email-compiler"
|
|
28
28
|
},
|
|
29
29
|
"dependencies": {
|
|
30
|
-
"@travetto/config": "^8.0.0-alpha.
|
|
31
|
-
"@travetto/di": "^8.0.0-alpha.
|
|
32
|
-
"@travetto/email": "^8.0.0-alpha.
|
|
33
|
-
"@travetto/image": "^8.0.0-alpha.
|
|
34
|
-
"@travetto/runtime": "^8.0.0-alpha.
|
|
35
|
-
"@travetto/worker": "^8.0.0-alpha.
|
|
30
|
+
"@travetto/config": "^8.0.0-alpha.19",
|
|
31
|
+
"@travetto/di": "^8.0.0-alpha.18",
|
|
32
|
+
"@travetto/email": "^8.0.0-alpha.19",
|
|
33
|
+
"@travetto/image": "^8.0.0-alpha.18",
|
|
34
|
+
"@travetto/runtime": "^8.0.0-alpha.18",
|
|
35
|
+
"@travetto/worker": "^8.0.0-alpha.18",
|
|
36
36
|
"@types/inline-css": "^3.0.4",
|
|
37
37
|
"html-entities": "^2.6.0",
|
|
38
38
|
"inline-css": "^4.0.3",
|
|
39
39
|
"purgecss": "^8.0.0",
|
|
40
|
-
"sass": "^1.
|
|
40
|
+
"sass": "^1.100.0"
|
|
41
41
|
},
|
|
42
42
|
"peerDependencies": {
|
|
43
|
-
"@travetto/cli": "^8.0.0-alpha.
|
|
43
|
+
"@travetto/cli": "^8.0.0-alpha.25"
|
|
44
44
|
},
|
|
45
45
|
"peerDependenciesMeta": {
|
|
46
46
|
"@travetto/cli": {
|
package/src/util.ts
CHANGED
|
@@ -185,7 +185,7 @@ export class EmailCompileUtil {
|
|
|
185
185
|
static async applyStyles(html: string, options: EmailTemplateResource): Promise<string> {
|
|
186
186
|
const styles = [
|
|
187
187
|
options.globalStyles ?? '',
|
|
188
|
-
await options.loader.
|
|
188
|
+
await options.loader.readUTF8('/email/main.scss').catch(() => '')
|
|
189
189
|
]
|
|
190
190
|
.filter(line => !!line)
|
|
191
191
|
.join('\n');
|
package/support/bin/config.ts
CHANGED
|
@@ -51,7 +51,7 @@ export class EditorConfig {
|
|
|
51
51
|
|
|
52
52
|
static async ensureConfig(): Promise<string> {
|
|
53
53
|
const resolved = Runtime.workspaceRelative(CONFIG_FILE);
|
|
54
|
-
if (!(await fs.stat(resolved
|
|
54
|
+
if (!(await fs.stat(resolved, { throwIfNoEntry: false }))) {
|
|
55
55
|
await ManifestFileUtil.bufferedFileWrite(resolved, this.getDefaultConfig());
|
|
56
56
|
}
|
|
57
57
|
return resolved;
|
|
@@ -6,12 +6,16 @@ import { EmailCompiler } from '../src/compiler.ts';
|
|
|
6
6
|
import { EmailCompileUtil } from '../src/util.ts';
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
|
-
*
|
|
9
|
+
* Compile all email templates into generated runtime artifacts.
|
|
10
|
+
*
|
|
11
|
+
* The command discovers templated inputs (for example, `.email.html`) and emits
|
|
12
|
+
* compiled outputs used at runtime (html/text/subject variants). With watch
|
|
13
|
+
* enabled, recompilation runs automatically on matching template changes.
|
|
10
14
|
*/
|
|
11
15
|
@CliCommand()
|
|
12
16
|
export class EmailCompileCommand implements CliCommandShape {
|
|
13
17
|
|
|
14
|
-
/**
|
|
18
|
+
/** Recompile templates whenever source templates change. */
|
|
15
19
|
watch?: boolean;
|
|
16
20
|
|
|
17
21
|
finalize(): void {
|
|
@@ -5,7 +5,12 @@ import { DependencyRegistryIndex } from '@travetto/di';
|
|
|
5
5
|
|
|
6
6
|
import { EditorService } from './bin/editor.ts';
|
|
7
7
|
|
|
8
|
-
/**
|
|
8
|
+
/**
|
|
9
|
+
* Start the email template editor service for interactive preview and testing.
|
|
10
|
+
*
|
|
11
|
+
* The editor compiles templates on demand and hosts the preview/test workflow
|
|
12
|
+
* used during local template authoring.
|
|
13
|
+
*/
|
|
9
14
|
@CliCommand()
|
|
10
15
|
export class EmailEditorCommand {
|
|
11
16
|
|
|
@@ -8,7 +8,10 @@ import { Env } from '@travetto/runtime';
|
|
|
8
8
|
import { EditorService } from './bin/editor.ts';
|
|
9
9
|
|
|
10
10
|
/**
|
|
11
|
-
*
|
|
11
|
+
* Render and send a template file to a target recipient for quick validation.
|
|
12
|
+
*
|
|
13
|
+
* This command is useful during template development to verify real delivery and
|
|
14
|
+
* formatting without running the full editor workflow.
|
|
12
15
|
*/
|
|
13
16
|
@CliCommand()
|
|
14
17
|
export class EmailTestCommand implements CliCommandShape {
|