Skip to content

Commit e4880bd

Browse files
committed
fix: file path
1 parent ef77394 commit e4880bd

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

lib/commands/static.js

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@ const fg = require("fast-glob");
99
const write = require("write");
1010
const ora = require("ora");
1111
const chalk = require("chalk");
12-
const fs = require("fs");
12+
const fse = require("fs-extra");
13+
1314
const resolve = util.resolve;
1415

1516
module.exports = function(
@@ -27,7 +28,8 @@ module.exports = function(
2728
const indexFile = resolve(path, indexName || "index.html");
2829
const render = new Renderer(config);
2930
const files = fg.sync("**/*.md", {
30-
cwd: path
31+
cwd: path,
32+
ignore: ["_*"]
3133
});
3234
let app;
3335
const spinner = ora();
@@ -43,23 +45,24 @@ module.exports = function(
4345
for (const file of files) {
4446
const res = await render.render(file);
4547
queue.push(res);
46-
spinner.text = "Rendering " + file;
48+
console.log("Rendering " + file);
4749
}
4850
return queue;
4951
})
5052
.then(data => {
51-
// 保存文件
53+
// save file
5254
return Promise.all(
5355
data.map(({ url, content, path }) => {
5456
const filePath = url
5557
.replace(/README\.md$/, "index.html")
5658
.replace(/\.md$/, ".html");
57-
spinner.text = `Rendering ${url}`;
5859
write(resolve(util.cwd(), dest, filePath), content);
59-
fs.copyFileSync(path, resolve(util.cwd(), dest, url));
6060
})
6161
);
6262
})
63+
.then(() => {
64+
return fse.copy(path, dest);
65+
})
6366
.then(() => {
6467
spinner.succeed(`Success! Generate static files at ${chalk.green(dest)}`);
6568
app && app.close();

0 commit comments

Comments
 (0)