@travetto/email-compiler 7.0.0-rc.5 → 7.0.1
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 +8 -8
- package/src/compiler.ts +0 -5
- package/support/bin/editor.ts +8 -8
- package/support/cli.email_compile.ts +5 -4
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@travetto/email-compiler",
|
|
3
|
-
"version": "7.0.
|
|
3
|
+
"version": "7.0.1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Email compiling module",
|
|
6
6
|
"keywords": [
|
|
@@ -27,12 +27,12 @@
|
|
|
27
27
|
"directory": "module/email-compiler"
|
|
28
28
|
},
|
|
29
29
|
"dependencies": {
|
|
30
|
-
"@travetto/config": "^7.0.
|
|
31
|
-
"@travetto/di": "^7.0.
|
|
32
|
-
"@travetto/email": "^7.0.
|
|
33
|
-
"@travetto/image": "^7.0.
|
|
34
|
-
"@travetto/runtime": "^7.0.
|
|
35
|
-
"@travetto/worker": "^7.0.
|
|
30
|
+
"@travetto/config": "^7.0.1",
|
|
31
|
+
"@travetto/di": "^7.0.1",
|
|
32
|
+
"@travetto/email": "^7.0.1",
|
|
33
|
+
"@travetto/image": "^7.0.1",
|
|
34
|
+
"@travetto/runtime": "^7.0.1",
|
|
35
|
+
"@travetto/worker": "^7.0.1",
|
|
36
36
|
"@types/inline-css": "^3.0.4",
|
|
37
37
|
"html-entities": "^2.6.0",
|
|
38
38
|
"inline-css": "^4.0.3",
|
|
@@ -40,7 +40,7 @@
|
|
|
40
40
|
"sass": "^1.97.1"
|
|
41
41
|
},
|
|
42
42
|
"peerDependencies": {
|
|
43
|
-
"@travetto/cli": "^7.0.
|
|
43
|
+
"@travetto/cli": "^7.0.1"
|
|
44
44
|
},
|
|
45
45
|
"peerDependenciesMeta": {
|
|
46
46
|
"@travetto/cli": {
|
package/src/compiler.ts
CHANGED
|
@@ -88,10 +88,6 @@ export class EmailCompiler {
|
|
|
88
88
|
* Spawn the compiler for a given file
|
|
89
89
|
*/
|
|
90
90
|
static async spawnCompile(file: string): Promise<boolean> {
|
|
91
|
-
if (!EmailCompileUtil.isTemplateFile(file)) {
|
|
92
|
-
return false;
|
|
93
|
-
}
|
|
94
|
-
|
|
95
91
|
const child = spawn(process.argv0, [Runtime.trvEntryPoint, 'email:compile', file], {
|
|
96
92
|
cwd: Runtime.mainSourcePath,
|
|
97
93
|
env: { ...process.env },
|
|
@@ -104,7 +100,6 @@ export class EmailCompiler {
|
|
|
104
100
|
} else {
|
|
105
101
|
console.log('Successfully compiled template', { changed: [file] });
|
|
106
102
|
}
|
|
107
|
-
|
|
108
103
|
return result.valid;
|
|
109
104
|
}
|
|
110
105
|
}
|
package/support/bin/editor.ts
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import { Inject, Injectable } from '@travetto/di';
|
|
2
2
|
import { MailUtil, EmailCompiled, MailInterpolator } from '@travetto/email';
|
|
3
|
-
import { AppError, TypedObject,
|
|
3
|
+
import { AppError, TypedObject, WatchUtil } from '@travetto/runtime';
|
|
4
4
|
|
|
5
5
|
import { EditorSendService } from './send.ts';
|
|
6
6
|
import { EditorConfig } from './config.ts';
|
|
7
7
|
import { EditorRequest, EditorResponse } from './types.ts';
|
|
8
8
|
|
|
9
9
|
import { EmailCompiler } from '../../src/compiler.ts';
|
|
10
|
+
import { EmailCompileUtil } from '../../src/util.ts';
|
|
10
11
|
|
|
11
12
|
/**
|
|
12
13
|
* Utils for interacting with editors
|
|
@@ -87,14 +88,13 @@ export class EditorService {
|
|
|
87
88
|
|
|
88
89
|
process.send({ type: 'init' });
|
|
89
90
|
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
await this.#response(this.#renderFile(file),
|
|
91
|
+
await WatchUtil.watchCompilerEvents('change',
|
|
92
|
+
({ file }) => EmailCompiler.spawnCompile(file).then(success =>
|
|
93
|
+
success ? this.#response(this.#renderFile(file),
|
|
94
94
|
result => ({ type: 'compiled', ...result }),
|
|
95
95
|
error => ({ type: 'compiled-failed', message: error.message, stack: error.stack, file })
|
|
96
|
-
)
|
|
97
|
-
|
|
98
|
-
|
|
96
|
+
) : undefined
|
|
97
|
+
),
|
|
98
|
+
({ file }) => EmailCompileUtil.isTemplateFile(file));
|
|
99
99
|
}
|
|
100
100
|
}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { Registry } from '@travetto/registry';
|
|
2
2
|
import { CliCommandShape, CliCommand, cliTpl } from '@travetto/cli';
|
|
3
|
-
import { Env, Runtime,
|
|
3
|
+
import { Env, Runtime, WatchUtil } from '@travetto/runtime';
|
|
4
4
|
|
|
5
5
|
import { EmailCompiler } from '../src/compiler.ts';
|
|
6
|
+
import { EmailCompileUtil } from '../src/util.ts';
|
|
6
7
|
|
|
7
8
|
/**
|
|
8
9
|
* CLI Entry point for running the email server
|
|
@@ -29,9 +30,9 @@ export class EmailCompileCommand implements CliCommandShape {
|
|
|
29
30
|
}
|
|
30
31
|
|
|
31
32
|
if (this.watch) {
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
33
|
+
await WatchUtil.watchCompilerEvents('change',
|
|
34
|
+
({ file }) => EmailCompiler.spawnCompile(file),
|
|
35
|
+
({ file }) => EmailCompileUtil.isTemplateFile(file));
|
|
35
36
|
}
|
|
36
37
|
}
|
|
37
38
|
}
|