packages/ at markup-kit dd1e6eb5270e
A snapshot of packages/ in the Weft repository; the official packages are published from these commits. Markup-Kit-Commit: dd1e6eb5270e62e0c8b6c202b3d01f0da6e00ddc
This commit is contained in:
commit
306b143104
72 changed files with 10915 additions and 0 deletions
28
email/scripts/integration.mjs
Normal file
28
email/scripts/integration.mjs
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
// Runs packages/integration/email, then checks the MIME it prints with Python's `email` parser.
|
||||
import { spawnSync } from "node:child_process"
|
||||
import { mkdirSync, writeFileSync } from "node:fs"
|
||||
import { dirname, join } from "node:path"
|
||||
import { fileURLToPath } from "node:url"
|
||||
|
||||
const root = join(dirname(fileURLToPath(import.meta.url)), "..")
|
||||
const weft = process.env.WEFT_BIN ?? join(root, "../../core/target/release/weft")
|
||||
const app = join(root, "../integration/email")
|
||||
spawnSync(weft, ["install"], { cwd: app, stdio: "inherit" })
|
||||
const r = spawnSync(weft, ["run", "."], { cwd: app, encoding: "utf8", env: { ...process.env, WEFT_DEADLINE_MS: "0" } })
|
||||
const out = r.stdout
|
||||
const [before, rest] = out.split("=====MIME=====\n")
|
||||
if (!rest) {
|
||||
console.log(out, r.stderr)
|
||||
process.exit(1)
|
||||
}
|
||||
const [mime, after] = rest.split("=====END=====\n")
|
||||
process.stdout.write(before + after)
|
||||
if (r.stderr) process.stderr.write(r.stderr)
|
||||
const dir = join(root, "../../core/target/tools")
|
||||
mkdirSync(dir, { recursive: true })
|
||||
const file = join(dir, "email-sample.eml")
|
||||
writeFileSync(file, mime, "latin1")
|
||||
const py = spawnSync("python3", ["-I", join(root, "scripts/check_mime.py"), file], { encoding: "utf8" })
|
||||
process.stdout.write(py.stdout)
|
||||
process.stderr.write(py.stderr)
|
||||
process.exit(r.status === 0 && py.status === 0 ? 0 : 1)
|
||||
Loading…
Reference in a new issue