Skip to content

Commit 24472a9

Browse files
author
Theryston
committed
fix: mkdir
1 parent 7f1e19e commit 24472a9

File tree

3 files changed

+13
-6
lines changed

3 files changed

+13
-6
lines changed

packages/cli/CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
# @jsx-mail/cli
22

3+
## 1.2.3
4+
5+
### Patch Changes
6+
7+
- fix mkdir
8+
39
## 1.2.2
410

511
### Patch Changes

packages/cli/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@jsx-mail/cli",
3-
"version": "1.2.2",
3+
"version": "1.2.3",
44
"description": "The official jsx mail CLI. 🚀✉️",
55
"types": "build/types/types.d.ts",
66
"bin": {

packages/cli/src/core/handlebars.ts

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,20 @@ import { getIndexContent } from '../utils/getIndexContent'
55
import * as rimraf from 'rimraf'
66
import * as fs from 'fs'
77
import { promisify } from 'util'
8+
import * as path from 'path'
89

910
const rimrafAsync = promisify(rimraf)
1011

1112
export async function handlebars(toolbox: GluegunToolbox): Promise<void> {
1213
const config = await getFileConfig()
1314
const mailPath = config.mailPath.replace('./', `${process.cwd()}/`)
1415

15-
if (fs.existsSync(`${mailPath}/hbs`)) {
16-
await rimrafAsync(`${mailPath}/hbs`)
16+
if (fs.existsSync(path.join(mailPath, 'hbs'))) {
17+
await rimrafAsync(path.join(mailPath, 'hbs'))
1718
}
1819

20+
fs.mkdirSync(path.join(mailPath, 'hbs'))
21+
1922
const templates: {
2023
[key: string]: {
2124
componentFunction: any
@@ -42,8 +45,6 @@ export async function handlebars(toolbox: GluegunToolbox): Promise<void> {
4245

4346
const htmlResult = await core.render(name, propsObject)
4447

45-
fs.mkdirSync(`${mailPath}/hbs`)
46-
47-
fs.writeFileSync(`${mailPath}/hbs/${name}.hbs`, htmlResult)
48+
fs.writeFileSync(path.join(mailPath, 'hbs', `${name}.hbs`), htmlResult)
4849
}
4950
}

0 commit comments

Comments
 (0)